diff -Naur zipios++-0.1.5.9+cvs.2007.04.28.orig/src/zipinputstreambuf.cpp zipios++-0.1.5.9+cvs.2007.04.28/src/zipinputstreambuf.cpp
--- zipios++-0.1.5.9+cvs.2007.04.28.orig/src/zipinputstreambuf.cpp 2007-01-28 18:08:47.000000000 -0600
+++ zipios++-0.1.5.9+cvs.2007.04.28/src/zipinputstreambuf.cpp 2012-06-27 10:21:24.767156783 -0500
@@ -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 Søndergaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public