1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
Description: Not available
Author: Masayuki Hatta <mhatta@debian.org>
Origin: vendor
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/zipinputstreambuf.cpp
+++ b/src/zipinputstreambuf.cpp
@@ -18,7 +18,13 @@
ZipInputStreambuf::ZipInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf )
: InflateInputStreambuf( inbuf, s_pos, del_inbuf ),
_open_entry( false )
-{}
+{
+ ConstEntryPointer entry = getNextEntry() ;
+
+ if ( ! entry->isValid() ) {
+ ; // FIXME: throw something?
+ }
+}
void ZipInputStreambuf::closeEntry() {
if ( ! _open_entry )
@@ -42,30 +48,28 @@
// read the zip local header
istream is( _inbuf ) ; // istream does not destroy the streambuf.
- is.exceptions( ios::eofbit | ios::failbit | ios::badbit );
-
- try {
- is >> _curr_entry ;
- if ( _curr_entry.isValid() ) {
- _data_start = _inbuf->pubseekoff(0, ios::cur, ios::in);
- if ( _curr_entry.getMethod() == DEFLATED ) {
- _open_entry = true ;
- reset() ; // reset inflatestream data structures
- // cerr << "deflated" << endl ;
- } else if ( _curr_entry.getMethod() == STORED ) {
- _open_entry = true ;
- _remain = _curr_entry.getSize() ;
- // Force underflow on first read:
- setg( &( _outvec[ 0 ] ),
- &( _outvec[ 0 ] ) + _outvecsize,
- &( _outvec[ 0 ] ) + _outvecsize );
- // cerr << "stored" << endl ;
- } else {
- _open_entry = false ; // Unsupported compression format.
- throw FCollException( "Unsupported compression format" ) ;
- }
+ is.exceptions(istream::eofbit | istream::failbit | istream::badbit);
+ is >> _curr_entry ;
+ if ( _curr_entry.isValid() ) {
+ _data_start = _inbuf->pubseekoff(0, ios::cur,
+ ios::in);
+ if ( _curr_entry.getMethod() == DEFLATED ) {
+ _open_entry = true ;
+ reset() ; // reset inflatestream data structures
+// cerr << "deflated" << endl ;
+ } else if ( _curr_entry.getMethod() == STORED ) {
+ _open_entry = true ;
+ _remain = _curr_entry.getSize() ;
+ // Force underflow on first read:
+ setg( &( _outvec[ 0 ] ),
+ &( _outvec[ 0 ] ) + _outvecsize,
+ &( _outvec[ 0 ] ) + _outvecsize ) ;
+// cerr << "stored" << endl ;
+ } else {
+ _open_entry = false ; // Unsupported compression format.
+ throw FCollException( "Unsupported compression format" ) ;
}
- } catch (...) {
+ } else {
_open_entry = false ;
}
@@ -119,7 +123,7 @@
/*
Zipios++ - a small C++ library that provides easy access to .zip files.
- Copyright (C) 2000 Thomas Søndergaard
+ Copyright (C) 2000 Thomas Sndergaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
|