Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 876026 Details for
Bug 1077716
FlightCrew bundles zipios++
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
use system zipios - preliminary fix
FlightCrew-0.7.2-system-zipios.diff (text/plain), 209.70 KB, created by
Dan Horák
on 2014-03-18 16:30:24 UTC
(
hide
)
Description:
use system zipios - preliminary fix
Filename:
MIME Type:
Creator:
Dan Horák
Created:
2014-03-18 16:30:24 UTC
Size:
209.70 KB
patch
obsolete
>diff -Nrup FlightCrew-0.7.2/src/FlightCrew/CMakeLists.txt FlightCrew-0.7.2.dev/src/FlightCrew/CMakeLists.txt >--- FlightCrew-0.7.2/src/FlightCrew/CMakeLists.txt 2014-03-18 17:24:53.000000000 +0100 >+++ FlightCrew-0.7.2.dev/src/FlightCrew/CMakeLists.txt 2014-03-18 17:16:33.000000000 +0100 >@@ -87,7 +87,7 @@ else() > add_library( ${PROJECT_NAME} ${SOURCES} ) > endif() > >-target_link_libraries( ${PROJECT_NAME} zipios ${BOOST_LIBS} XercesExtensions ) >+target_link_libraries( ${PROJECT_NAME} zipiosext ${BOOST_LIBS} XercesExtensions zipios) > > ############################################################################# > >diff -Nrup FlightCrew-0.7.2/src/zipios/CMakeLists.txt FlightCrew-0.7.2.dev/src/zipios/CMakeLists.txt >--- FlightCrew-0.7.2/src/zipios/CMakeLists.txt 2014-03-18 17:24:53.000000000 +0100 >+++ FlightCrew-0.7.2.dev/src/zipios/CMakeLists.txt 2014-03-18 17:16:11.000000000 +0100 >@@ -9,7 +9,7 @@ > > cmake_minimum_required( VERSION 2.8 ) > >-project( zipios ) >+project( zipiosext ) > > file( GLOB_RECURSE SOURCES *.cpp *.h ) > >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipextraction.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipextraction.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipextraction.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipextraction.cpp 2014-03-18 17:09:51.000000000 +0100 >@@ -66,7 +66,7 @@ void CreateFilepath( const fs::path &fil > > void ExtractZipToFolder( const fs::path &path_to_zip, const fs::path &path_to_folder ) > { >- ZipFile zip( path_to_zip ); >+ ZipFile zip( path_to_zip.string() ); > > ConstEntries entries = zip.entries(); > for ( ConstEntries::iterator it = entries.begin(); it != entries.end(); ++it ) >diff -Nrup FlightCrew-0.7.2/src/zipios/src/backbuffer.h FlightCrew-0.7.2.dev/src/zipios/src/backbuffer.h >--- FlightCrew-0.7.2/src/zipios/src/backbuffer.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/backbuffer.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,117 +0,0 @@ >-#ifndef BACKBUFFER_H >-#define BACKBUFFER_H >- >-#include "zipios++/zipios-config.h" >- >-#include <algorithm> >- >-#include "zipios++/meta-iostreams.h" >-#include <vector> >- >-#include "zipios++/fcollexceptions.h" >-#include "zipios++/ziphead.h" >-#include "zipios++/zipheadio.h" >-#include "zipios++/virtualseeker.h" >-#include "zipios_common.h" >- >-namespace zipios { >- >-using std::ios ; >-using std::cerr ; >-using std::endl ; >- >-/** A BackBuffer instance is useful for reading the last part of a >- file in an efficient manner, when it is not known exactly how far >- back (towards the front!) to go, to find the start of the desired >- data block. BackBuffer is a vector< unsigned char > that fills >- itself with data from a file by reading chunks from the end of the >- file progressing towards the start. Upon construction the >- BackBuffer instance is associated with a file and a chunksize can >- be specified. To read a chunk of the file into the BackBuffer call >- readChunk(). */ >-class BackBuffer : public vector< unsigned char > { >-public: >- /** BackBuffer constructor. >- @param is The istream to read the data from. The stream must be seekable, >- as BackBuffer will reposition the file position to read chunks from the back >- of the file. >- @param chunk_size specifies the size of the chunks to read the file into >- the BackBuffer in. >- @throw FCollException Thrown if the VirtualSeeker vs that has been specified is >- invalid for the istream is. */ >- inline explicit BackBuffer( istream &is, VirtualSeeker vs = VirtualSeeker(), >- int chunk_size = 1024 ) ; >- /** Reads another chunk and returns the size of the chunk that has >- been read. Returns 0 on I/O failure. >- @param read_pointer When a new chunk is read in the already >- stored bytes change position in the BackBuffer. read_pointer is >- assumed by readChunk() to be a pointer into a position in the >- BackBuffer, and is updated to point to the same position in the file >- as it pointed to before the new chunk was read. */ >- inline int readChunk( int &read_pointer ) ; >- >-private: >- VirtualSeeker _vs ; >- int _chunk_size ; >- istream &_is ; >- streampos _file_pos ; >- >-}; >- >-BackBuffer::BackBuffer( istream &is, VirtualSeeker vs, int chunk_size ) >- : _vs ( vs ), >- _chunk_size( chunk_size ), >- _is ( is ) >-{ >- _vs.vseekg( is, 0, ios::end ) ; >- _file_pos = _vs.vtellg( is ) ; >- // Only happens if _vs.startOffset() is a position >- // in the file that lies after _vs.endOffset(), which >- // is clearly not a valid situation. >- if ( _file_pos < 0 ) >- throw FCollException( "Invalid virtual file endings" ) ; >-} >- >-int BackBuffer::readChunk( int &read_pointer ) { >- // Update chunk_size and file position >- _chunk_size = min<int> ( static_cast< int >( _file_pos ), _chunk_size ) ; >- _file_pos -= _chunk_size ; >- _vs.vseekg( _is, static_cast< int >( _file_pos ), ios::beg ) ; >- // Make space for _chunk_size new bytes first in buffer >- insert ( begin(), _chunk_size, static_cast< char > ( 0 ) ) ; >- // Read in the next _chunk_size of bytes >- >- readByteSeq ( _is, &( (*this)[ 0 ] ), _chunk_size ) ; >- read_pointer += _chunk_size ; >- >- if ( _is.good() ) >- return _chunk_size ; >- else >- return 0 ; >-} >- >-} >-#endif >- >-/** \file >- The header file for BackBuffer >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/basicentry.cpp FlightCrew-0.7.2.dev/src/zipios/src/basicentry.cpp >--- FlightCrew-0.7.2/src/zipios/src/basicentry.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/basicentry.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,163 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include <cassert> >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >- >-#include "zipios_common.h" >-#include "zipios++/basicentry.h" >-#include "zipios++/zipios_defs.h" >- >-#include "outputstringstream.h" >- >-namespace zipios { >- >-using std::ifstream ; >-using std::ios ; >- >-// >-// Public definitions >-// >- >-BasicEntry::BasicEntry( const string &filename, const string &comment, >- const FilePath &basepath ) >- : _filename ( filename ), >- _comment ( comment ), >- _basepath ( basepath ) >-{ >- string full_path = _basepath + _filename ; >- ifstream is( full_path.c_str(), ios::in | ios::binary ) ; >- if ( ! is ) { >- _valid = false ; >- } else { >- is.seekg( 0, ios::end ) ; >- _size = static_cast< int >( is.tellg() ) ; >- is.close() ; >- _valid = true ; >- } >-} >- >-string BasicEntry::getComment() const { >- return _comment ; >-} >- >-uint32 BasicEntry::getCompressedSize() const { >- return getSize() ; >-} >- >-uint32 BasicEntry::getCrc() const { >- return 0 ; >-} >- >-vector< unsigned char > BasicEntry::getExtra() const { >- return vector< unsigned char > () ; >-} >- >-StorageMethod BasicEntry::getMethod() const { >- return STORED ; >-} >- >-string BasicEntry::getName() const { >- return _filename ; >-} >- >-string BasicEntry::getFileName() const { >- if ( isDirectory() ) >- return string() ; >- string::size_type pos ; >- pos = _filename.find_last_of( separator ) ; >- if ( pos != string::npos ) { // separator found! >- // isDirectory() check means pos should not be last, so pos+1 is ok >- return _filename.substr(pos + 1) ; >- } else { >- return _filename ; >- } >-} >- >-uint32 BasicEntry::getSize() const { >- return _size ; >-} >- >-int BasicEntry::getTime() const { >- return 0 ; // FIXME later >-} >- >-bool BasicEntry::isValid() const { >- return _valid ; >-} >- >-// virtual int hashCode() const {} >-bool BasicEntry::isDirectory() const { >- assert( _filename.size() != 0 ) ; >- return _filename[ _filename.size() - 1 ] == separator ; >-} >- >- >-void BasicEntry::setComment( const string &comment ) { >- _comment = comment ; >-} >- >-void BasicEntry::setCompressedSize( uint32 ) { >-} >- >-void BasicEntry::setCrc( uint32 ) { >-} >- >-void BasicEntry::setExtra( const vector< unsigned char > & ) { >-} >- >-void BasicEntry::setMethod( StorageMethod ) { >-} >- >-void BasicEntry::setName( const string &name ) { >- _filename = name ; >-} >- >-void BasicEntry::setSize( uint32 size ) { >- _size = size ; >-} >- >-void BasicEntry::setTime( int ) { >-} >- >- >-string BasicEntry::toString() const { >- OutputStringStream sout ; >- sout << _filename << " (" << _size << " bytes)" ; >- return sout.str() ; >-} >- >-FileEntry *BasicEntry::clone() const { >- return new BasicEntry( *this ) ; >-} >- >-BasicEntry::~BasicEntry() { >-} >- >- >-} // namespace >- >-/** \file >- Implementation of BasicEntry. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/collcoll.cpp FlightCrew-0.7.2.dev/src/zipios/src/collcoll.cpp >--- FlightCrew-0.7.2/src/zipios/src/collcoll.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/collcoll.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,162 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/collcoll.h" >-#include "zipios_common.h" >- >-namespace zipios { >- >-using std::ifstream ; >- >-CollectionCollection *CollectionCollection::_inst = 0 ; >- >- >-CollectionCollection::CollectionCollection() { >- _valid = true ; // we're valid even though we are empty! >-} >- >- >-bool CollectionCollection::addCollection( const FileCollection &collection ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ; >- if ( this == &collection || ! collection.isValid() ) >- return false ; >- _collections.push_back( collection.clone() ) ; >- return true ; >- >-} >- >-bool CollectionCollection::addCollection( FileCollection *collection ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ; >- if ( collection == 0 || this == collection || ! collection->isValid() ) >- return false ; >- _collections.push_back( collection ) ; >- return true ; >-} >- >- >-void CollectionCollection::close() { >- _valid = false ; >-} >- >- >-ConstEntries CollectionCollection::entries() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get entries from an invalid CollectionCollection" ) ; >- >- ConstEntries all_entries ; >- std::vector< FileCollection * >::const_iterator it ; >- for ( it = _collections.begin() ; it != _collections.end() ; it++ ) >- all_entries += (*it)->entries() ; >- return all_entries ; >-} >- >- >-ConstEntryPointer CollectionCollection::getEntry( const string &name, >- MatchPath matchpath ) const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get an entry from an invalid CollectionCollection" ) ; >- // Returns the first matching entry. >- std::vector< FileCollection * >::const_iterator it ; >- ConstEntryPointer cep ; >- >- getEntry( name, cep, it, matchpath ) ; >- >- return cep ; >-} >- >- >-istream *CollectionCollection::getInputStream( const ConstEntryPointer &entry ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ; >- >- return getInputStream( entry->getName() ) ; >-} >- >- >-istream *CollectionCollection::getInputStream( const string &entry_name, >- MatchPath matchpath ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ; >- >- std::vector< FileCollection * >::const_iterator it ; >- ConstEntryPointer cep ; >- >- getEntry( entry_name, cep, it, matchpath ) ; >- >- if ( cep == 0 ) >- return 0 ; >- else >- return (*it)->getInputStream( entry_name ) ; >- >-} >- >- >-int CollectionCollection::size() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get the size of an invalid CollectionCollection" ) ; >- int sz = 0 ; >- std::vector< FileCollection * >::const_iterator it ; >- for ( it = _collections.begin() ; it != _collections.end() ; it++ ) >- sz += (*it)->size() ; >- return sz ; >-} >- >-FileCollection *CollectionCollection::clone() const { >- return new CollectionCollection( *this ) ; >-} >- >-CollectionCollection::~CollectionCollection() { >- std::vector< FileCollection * >::iterator it ; >- for ( it = _collections.begin() ; it != _collections.end() ; ++it ) >- delete *it ; >-} >- >- >-// >-// Protected member functions >-// >- >-void CollectionCollection::getEntry( const string &name, >- ConstEntryPointer &cep, >- std::vector< FileCollection * >::const_iterator &it, >- MatchPath matchpath ) const { >- >- // Returns the first matching entry. >- cep = 0 ; >- for ( it = _collections.begin() ; it != _collections.end() ; it++ ) { >- cep = (*it)->getEntry( name, matchpath ) ; >- if ( cep ) >- break ; >- } >-} >- >- >- >-} // namespace >- >-/** \file >- Implementation of CollectionCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/deflateoutputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/deflateoutputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/deflateoutputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/deflateoutputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,224 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include <zlib.h> >- >-#include "zipios++/fcollexceptions.h" >-#include "zipios++/deflateoutputstreambuf.h" >- >-#include "outputstringstream.h" >- >-namespace zipios { >- >-using std::cerr ; >-using std::endl ; >- >-DeflateOutputStreambuf::DeflateOutputStreambuf( streambuf *outbuf, bool user_init, >- bool del_outbuf ) >- : FilterOutputStreambuf( outbuf, del_outbuf ), >- _zs_initialized ( false ), >- _invecsize ( 1000 ), >- _invec ( _invecsize ), >- _outvecsize ( 1000 ), >- _outvec ( _outvecsize ) >-{ >- // NOTICE: It is important that this constructor and the methods it >- // calls doesn't do anything with the output streambuf _outbuf The >- // reason is that this class can be subclassed, and the subclass >- // should get a chance to write to the buffer first >- >- // zlib init: >- _zs.zalloc = Z_NULL ; >- _zs.zfree = Z_NULL ; >- _zs.opaque = Z_NULL ; >- >- if ( user_init && ! init() ) >- cerr << "DeflateOutputStreambuf::reset() failed!\n" ; // FIXME: throw something >- >-} >- >- >-DeflateOutputStreambuf::~DeflateOutputStreambuf() { >- closeStream() ; >-} >- >- >-// This method is called in the constructor, so it must not write >-// anything to the output streambuf _outbuf (see notice in >-// constructor) >-bool DeflateOutputStreambuf::init( int comp_level ) { >- static const int default_mem_level = 8 ; >- >- // _zs.next_in and avail_in must be set according to >- // zlib.h (inline doc). >- _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[ 0 ] ) ) ; >- _zs.avail_in = 0 ; >- >- _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; >- _zs.avail_out = _outvecsize ; >- >- int err ; >- if( _zs_initialized ) { // just reset it >- endDeflation() ; >- err = deflateReset( &_zs ) ; >- // FIXME: bug, for deflateReset we do not update the compression level >- } else { // init it >- err = deflateInit2( &_zs, comp_level, Z_DEFLATED, -MAX_WBITS, >- default_mem_level, Z_DEFAULT_STRATEGY ) ; >- /* windowBits is passed < 0 to tell that no zlib header should be >- written. */ >- _zs_initialized = true ; >- } >- >- // streambuf init: >- setp( &( _invec[ 0 ] ), &( _invec[ 0 ] ) + _invecsize ) ; >- >- _crc32 = crc32( 0, Z_NULL, 0 ) ; >- _overflown_bytes = 0 ; >- >- if ( err == Z_OK ) >- return true ; >- else >- return false ; >-} >- >- >-bool DeflateOutputStreambuf::closeStream() { >- int err = Z_OK ; >- if( _zs_initialized ) { >- endDeflation() ; >- err = deflateEnd( &_zs ) ; >- _zs_initialized = false ; >- } >- >- if ( err == Z_OK ) >- return true ; >- else { >- cerr << "DeflateOutputStreambuf::closeStream(): deflateEnd failed" ; >-#ifdef HAVE_ZERROR >- cerr << ": " << zError( err ) ; >-#endif >- cerr << endl ; >- return false ; >- } >-} >- >- >-int DeflateOutputStreambuf::overflow( int c ) { >- _zs.avail_in = static_cast< uInt >( pptr() - pbase() ) ; >- _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[ 0 ] ) ) ; >- >- _crc32 = crc32( _crc32, _zs.next_in, _zs.avail_in ) ; // update crc32 >- _overflown_bytes += _zs.avail_in ; >- >- _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; >- _zs.avail_out = _outvecsize ; >- >- // Deflate until _invec is empty. >- int err = Z_OK ; >- while ( ( _zs.avail_in > 0 || _zs.avail_out == 0 ) && err == Z_OK ) { >- if ( _zs.avail_out == 0 ) >- flushOutvec() ; >- >- err = deflate( &_zs, Z_NO_FLUSH ) ; >- } >- >- flushOutvec() ; >- >- // Update 'put' pointers >- setp( &( _invec[ 0 ] ), &( _invec[ 0 ] ) + _invecsize ) ; >- >- if( err != Z_OK && err != Z_STREAM_END ) { >-#if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) >- // Throw an exception to make istream set badbit >- OutputStringStream msgs ; >- msgs << "Deflation failed" ; >-#ifdef HAVE_ZERROR >- msgs << ": " << zError( err ) ; >-#endif >- throw IOException( msgs.str() ) ; >-#endif >- cerr << "Deflation failed\n" ; >- return EOF ; >- } >- >- if ( c != EOF ) { >- *pptr() = c ; >- pbump( 1 ) ; >- } >- >- return 0 ; >-} >- >-int DeflateOutputStreambuf::sync() { >- // FIXME: Do something >-// return overflow() ; >- return 0 ; >-} >- >- >-bool DeflateOutputStreambuf::flushOutvec() { >- int deflated_bytes = _outvecsize - _zs.avail_out ; >- int bc = static_cast< int >( _outbuf->sputn( &( _outvec[ 0 ] ), deflated_bytes ) ) ; >- >- _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; >- _zs.avail_out = _outvecsize ; >- >- return deflated_bytes == bc ; >-} >- >- >-void DeflateOutputStreambuf::endDeflation() { >- overflow() ; >- >- _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; >- _zs.avail_out = _outvecsize ; >- >- // Deflate until _invec is empty. >- int err = Z_OK ; >- >- while ( err == Z_OK ) { >- if ( _zs.avail_out == 0 ) >- flushOutvec() ; >- >- err = deflate( &_zs, Z_FINISH ) ; >- } >- >- flushOutvec() ; >- >- if ( err != Z_STREAM_END ) { >- cerr << "DeflateOutputStreambuf::endDeflation(): deflation failed:\n" ; >-#ifdef HAVE_ZERROR >- cerr << ": " << zError( err ) ; >-#endif >- cerr << endl ; >- } >-} >- >- >-} // namespace >- >-/** \file >- Implementation of DeflateOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/dircoll.cpp FlightCrew-0.7.2.dev/src/zipios/src/dircoll.cpp >--- FlightCrew-0.7.2/src/zipios/src/dircoll.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/dircoll.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,172 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <vector> >-#include <sys/stat.h> >- >-#include "zipios++/dircoll.h" >- >-#include "../FlightCrew/Misc/BoostFilesystemUse.h" >- >- >-namespace zipios { >- >-using std::cerr ; >-using std::endl ; >-using std::vector ; >-using std::ifstream ; >- >-DirectoryCollection::DirectoryCollection( const string &path, bool recursive, >- bool load_now ) >- : _entries_loaded( false ), >- _recursive ( recursive ), >- _filepath ( path ) >-{ >- _filename = _filepath ; >- _valid = _filepath.isDirectory() ; >- >- if( _valid && load_now ) >- loadEntries() ; >-} >- >-void DirectoryCollection::close() { >- _valid = false ; >-} >- >- >-ConstEntries DirectoryCollection::entries() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; >- >- loadEntries() ; >- >- return FileCollection::entries() ; >-} >- >- >-ConstEntryPointer >-DirectoryCollection::getEntry( const string &name, >- MatchPath matchpath ) const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; >- >- if ( matchpath != MATCH || _entries_loaded ) { >- loadEntries() ; >- return FileCollection::getEntry( name, matchpath ) ; >- } else { >- // avoid loading entries if possible. >- ConstEntryPointer ent ( new DirEntry( name, "", _filepath ) ) ; >- if ( ent->isValid() ) >- return ent ; >- else >- return 0 ; >- } >-} >- >- >-istream *DirectoryCollection::getInputStream( const ConstEntryPointer &entry ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; >- >- return getInputStream( entry->getName() ) ; >-} >- >- >-istream *DirectoryCollection::getInputStream( const string &entry_name, >- MatchPath matchpath ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; >- >- if ( matchpath != MATCH || _entries_loaded ) { >- loadEntries() ; >- >- ConstEntryPointer ent = getEntry( entry_name, matchpath ) ; >- >- if ( ent == 0 ) >- return 0 ; >- else { >- string real_path( _filepath + entry_name ) ; >- return new ifstream( real_path.c_str(), ios::in | ios::binary ) ; >- } >- >- } else { >- // avoid loading entries if possible. >- string real_path( _filepath + entry_name ) ; >- ifstream *ifs = new ifstream( real_path.c_str(), ios::in | ios::binary ) ; >- if( ! *ifs ) { >- delete ifs ; >- return 0 ; >- } else >- return ifs ; >- } >-} >- >- >-int DirectoryCollection::size() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; >- loadEntries() ; >- >- return (int) _entries.size() ; >-} >- >-FileCollection *DirectoryCollection::clone() const { >- return new DirectoryCollection( *this ) ; >-} >- >-DirectoryCollection::~DirectoryCollection() {} >- >- >-void DirectoryCollection::loadEntries() const { >- if( _entries_loaded ) >- return ; >- >- const_cast< DirectoryCollection * >( this )->load( _recursive ) ; >- >- _entries_loaded = true ; >-} >- >- >-void DirectoryCollection::load( bool recursive, const FilePath &subdir ) { >- using namespace boost::filesystem ; >- BasicEntry *ent ; >- for ( fs::directory_iterator it( (_filepath + subdir).asString() ) ; it != fs::directory_iterator() ; ++it ) { >- >- if ( *it == "." || *it == ".." || *it == "..." ) >- continue ; >- >- if ( fs::is_directory( it->path() ) && recursive ) { >- load( recursive, subdir + it->path().filename().string() ) ; >- } else { >- _entries.push_back( ent = new BasicEntry( subdir + it->path().filename().string(), "", _filepath ) ) ; >- ent->setSize( (zipios::uint32) fs::file_size( it->path() ) ) ; >- } >- >- } >-} >- >-} // namespace >- >-/** \file >- Implementation of DirectoryCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/fcoll.cpp FlightCrew-0.7.2.dev/src/zipios/src/fcoll.cpp >--- FlightCrew-0.7.2/src/zipios/src/fcoll.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/fcoll.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,90 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include <algorithm> >-#include <string> >-#include <vector> >- >-#include "zipios++/fcoll.h" >- >-namespace zipios { >- >-using std::find_if ; >- >-// FIXME: make InvalidStateException message customized for >-// subclasses. maybe make an InvalidStateException factory ;-) >- >-ConstEntries FileCollection::entries() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get entries from an invalid FileCollection" ) ; >- >- // The constructor below is not in all vector impl. (not those >- // without member templates) >- // ConstEntries ( _entries.begin(), _entries.end() ) ; >- // Instead of using that we copy the vector manually >- ConstEntries cep_vec ; >- cep_vec.reserve( _entries.size() ) ; >- Entries::const_iterator cit ; >- for ( cit = _entries.begin() ; cit != _entries.end() ; ++cit ) >- cep_vec.push_back( *cit ) ; >- >- return cep_vec ; >-} >- >-ConstEntryPointer FileCollection::getEntry( const string &name, >- MatchPath matchpath ) const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get an entry from an invalid FileCollection" ) ; >- >- Entries::const_iterator iter ; >- if ( matchpath == MATCH ) >- iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchName( name ) ) ; >- else >- iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchFileName( name ) ) ; >- if ( iter == _entries.end() ) >- return 0 ; >- else >- return *iter ; >-} >- >-string FileCollection::getName() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get the name of an invalid FileCollection" ) ; >- return _filename ; >-} >- >- >-int FileCollection::size() const { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to get size of an invalid FileCollection" ) ; >- return static_cast< int >( _entries.size() ) ; >-} >- >-FileCollection::~FileCollection() { >-} >- >- >-} // namespace >- >-/** \file >- Implementation of FileCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/fcollexceptions.cpp FlightCrew-0.7.2.dev/src/zipios/src/fcollexceptions.cpp >--- FlightCrew-0.7.2/src/zipios/src/fcollexceptions.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/fcollexceptions.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,144 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/fcollexceptions.h" >- >-namespace zipios { >- >-using std::cerr ; >-using std::endl ; >- >-IOException::IOException() throw () >- : _what( "I/O exception" ) {} >- >-IOException::IOException( const string &msg ) throw () >- : _what( msg ) {} >- >-IOException::IOException( const IOException &src ) throw () >- : std::exception(), _what( src._what ) {} >- >- >-IOException &IOException::operator= ( const IOException &src ) throw () { >- _what = src._what ; >- return *this ; >-} >- >- >-const char *IOException::what() const throw () { >- return _what.c_str() ; >-} >- >-IOException::~IOException() throw () {} >- >- >- >- >- >- >-FCollException::FCollException() throw () >- : _what( "FileCollection exception" ) {} >- >-FCollException::FCollException( const string &msg ) throw () >- : _what( msg ) {} >- >-FCollException::FCollException( const FCollException &src ) throw () >- : std::exception(),_what( src._what ) {} >- >- >-FCollException &FCollException::operator= ( const FCollException &src ) throw () { >- _what = src._what ; >- return *this ; >-} >- >- >-const char *FCollException::what() const throw () { >- return _what.c_str() ; >-} >- >-FCollException::~FCollException() throw () {} >- >- >- >- >- >- >-InvalidStateException::InvalidStateException() throw () >- : _what( "InvalidState exception" ) {} >- >-InvalidStateException::InvalidStateException( const string &msg ) throw () >- : _what( msg ) {} >- >-InvalidStateException:: >-InvalidStateException( const InvalidStateException &src ) throw () >- : std::exception(), _what( src._what ) {} >- >- >-InvalidStateException &InvalidStateException:: >-operator= ( const InvalidStateException &src ) throw () { >- _what = src._what ; >- return *this ; >-} >- >- >-const char *InvalidStateException::what() const throw () { >- return _what.c_str() ; >-} >- >-InvalidStateException::~InvalidStateException() throw () {} >- >- >- >- >- >-Exception::Exception() throw () >- : _what( "Exception" ) {} >- >-Exception::Exception( const string &msg ) throw () >- : _what( msg ) {} >- >-Exception:: >-Exception( const Exception &src ) throw () >- : std::exception(),_what( src._what ) {} >- >- >-Exception &Exception:: >-operator= ( const Exception &src ) throw () { >- _what = src._what ; >- return *this ; >-} >- >- >-const char *Exception::what() const throw () { >- return _what.c_str() ; >-} >- >-Exception::~Exception() throw () {} >- >- >-} // namespace >- >-/** \file >- Implementation of a number of Exceptions used by FileCollection and its >- subclasses. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/fileentry.cpp FlightCrew-0.7.2.dev/src/zipios/src/fileentry.cpp >--- FlightCrew-0.7.2/src/zipios/src/fileentry.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/fileentry.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,39 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >- >-#include "zipios++/fileentry.h" >- >-namespace zipios { >- >-ostream &operator<< ( ostream &os, const FileEntry &entry ) { >- os << entry.toString() ; >- return os ; >-} >- >-} // namespace >- >-/** \file >- Implementation of FileEntry. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/filepath.cpp FlightCrew-0.7.2.dev/src/zipios/src/filepath.cpp >--- FlightCrew-0.7.2/src/zipios/src/filepath.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/filepath.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,78 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include <stdexcept> >-#include <string> >-#include <sys/types.h> >-#include <sys/stat.h> >- >-#include "zipios++/filepath.h" >- >-namespace zipios { >- >-using namespace std ; >- >-const char FilePath::_separator = '/' ; >- >- >-FilePath::FilePath( const string &path, bool check_exists ) >- : _checked( false ), >- _path( path ) { >- pruneTrailingSeparator() ; >- if ( check_exists ) >- exists() ; >-} >- >- >-void FilePath::check() const { >- _checked = true ; >- _exists = false ; >- _is_reg = false ; >- _is_dir = false ; >- _is_char = false ; >- _is_block = false ; >- _is_socket = false ; >- _is_fifo = false ; >- >- struct stat buf ; >- if ( stat( _path.c_str(), &buf ) != -1 ) { >- _exists = true ; >- #if defined(BOOST_WINNT) >- _is_reg = _S_IFREG & buf.st_mode ; >- _is_dir = _S_IFDIR & buf.st_mode ; >- _is_char = _S_IFCHR & buf.st_mode ; >- #else >- _is_reg = S_ISREG ( buf.st_mode ) ; >- _is_dir = S_ISDIR ( buf.st_mode ) ; >- _is_char = S_ISCHR ( buf.st_mode ) ; >- _is_block = S_ISBLK ( buf.st_mode ) ; >- _is_socket = S_ISSOCK( buf.st_mode ) ; >- _is_fifo = S_ISFIFO( buf.st_mode ) ; >- #endif >- } >-} >- >-} // namespace >- >-/** \file >- Implementation of FilePath. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/filterinputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/filterinputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/filterinputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/filterinputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,47 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/filterinputstreambuf.h" >- >-namespace zipios { >- >-FilterInputStreambuf::FilterInputStreambuf( streambuf *inbuf, bool del_inbuf ) >- : _inbuf( inbuf), >- _del_inbuf( del_inbuf ) >-{ >- if ( _inbuf == NULL ) { >- // throw an exception >- } >-} >- >- >-FilterInputStreambuf::~FilterInputStreambuf() { >- if ( _del_inbuf ) >- delete _inbuf ; >-} >- >- >-} // namespace >- >-/** \file >- Implementation of FilterInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/filteroutputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/filteroutputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/filteroutputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/filteroutputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,47 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/filteroutputstreambuf.h" >- >-namespace zipios { >- >-FilterOutputStreambuf::FilterOutputStreambuf( streambuf *outbuf, bool del_outbuf ) >- : _outbuf( outbuf), >- _del_outbuf( del_outbuf ) >-{ >- if ( _outbuf == NULL ) { >- // throw an exception >- } >-} >- >- >-FilterOutputStreambuf::~FilterOutputStreambuf() { >- if ( _del_outbuf ) >- delete _outbuf ; >-} >- >- >-} // namespace >- >-/** \file >- Implementation of FilterOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/gzipoutputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/gzipoutputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/gzipoutputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/gzipoutputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,127 +0,0 @@ >- >-#include <time.h> >- >-#include "zipios++/zipios-config.h" >- >-#include <algorithm> >-#include "zipios++/meta-iostreams.h" >- >-#include <zlib.h> >- >-#include "zipios++/gzipoutputstreambuf.h" >- >-namespace zipios { >- >-using std::ios ; >-using std::cerr ; >-using std::endl ; >- >-GZIPOutputStreambuf::GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf ) >- : DeflateOutputStreambuf( outbuf, true, del_outbuf ), >- _open ( false ) >-{ >-} >- >-void GZIPOutputStreambuf::setFilename( const string &filename ) { >- _filename = filename ; >-} >- >-void GZIPOutputStreambuf::setComment( const string &comment ) { >- _comment = comment ; >-} >- >-void GZIPOutputStreambuf::close() { >- finish() ; >-} >- >-void GZIPOutputStreambuf::finish() { >- if( ! _open ) >- return ; >- >- closeStream(); >- writeTrailer(); >- >- _open = false ; >-} >- >-GZIPOutputStreambuf::~GZIPOutputStreambuf() { >- finish() ; >-} >- >-int GZIPOutputStreambuf::overflow( int c ) { >- if (!_open) { >- writeHeader(); >- _open = true; >- } >- return DeflateOutputStreambuf::overflow( c ) ; >-} >- >-int GZIPOutputStreambuf::sync() { >- return DeflateOutputStreambuf::sync() ; >-} >- >-void GZIPOutputStreambuf::writeHeader() { >- unsigned char flg = 0x00; >- flg |= (_filename == "") ? 0x00 : 0x08; >- flg |= (_comment == "") ? 0x00 : 0x10; >- >- ostream os( _outbuf ) ; >- os << (unsigned char)0x1f; // Magic # >- os << (unsigned char)0x8b; // Magic # >- os << (unsigned char)0x08; // Deflater.DEFLATED >- os << flg; // FLG >- os << (unsigned char)0x00; // MTIME >- os << (unsigned char)0x00; // MTIME >- os << (unsigned char)0x00; // MTIME >- os << (unsigned char)0x00; // MTIME >- os << (unsigned char)0x00; // XFLG >- os << (unsigned char)0x00; // OS >- >- if (_filename != "") { >- os << _filename.c_str();// Filename >- os << (unsigned char)0x00; >- } >- >- if (_comment != "") { >- os << _comment.c_str(); // Comment >- os << (unsigned char)0x00; >- } >-} >- >-void GZIPOutputStreambuf::writeTrailer() { >- writeInt(getCrc32()); >- writeInt(getCount()); >-} >- >-void GZIPOutputStreambuf::writeInt(uint32 i) { >- ostream os( _outbuf ) ; >- os << (unsigned char)( i & 0xFF); >- os << (unsigned char)((i >> 8) & 0xFF); >- os << (unsigned char)((i >> 16) & 0xFF); >- os << (unsigned char)((i >> 24) & 0xFF); >-} >- >-} // namespace >- >-/** \file >- Implementation of GZIPOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/gzipoutputstream.cpp FlightCrew-0.7.2.dev/src/zipios/src/gzipoutputstream.cpp >--- FlightCrew-0.7.2/src/zipios/src/gzipoutputstream.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/gzipoutputstream.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,80 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/gzipoutputstreambuf.h" >-#include "zipios++/gzipoutputstream.h" >- >-using std::ostream; >- >-namespace zipios { >- >-GZIPOutputStream::GZIPOutputStream( std::ostream &os ) >- : ostream( 0 ), >- ofs( 0 ) >-{ >- ozf = new GZIPOutputStreambuf( os.rdbuf() ) ; >- >- init( ozf ) ; >-} >- >-GZIPOutputStream::GZIPOutputStream( const std::string &filename ) >- : ostream( 0 ), >- ofs( 0 ) >-{ >- ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ; >- ozf = new GZIPOutputStreambuf( ofs->rdbuf() ) ; >- init( ozf ) ; >-} >- >-void GZIPOutputStream::setFilename( const string &filename ) { >- ozf->setFilename(filename); >-} >- >-void GZIPOutputStream::setComment( const string &comment ) { >- ozf->setComment(comment); >-} >- >-void GZIPOutputStream::close() { >- ozf->close() ; >- if ( ofs ) >- ofs->close() ; >-} >- >- >-void GZIPOutputStream::finish() { >- ozf->finish() ; >-} >- >- >-GZIPOutputStream::~GZIPOutputStream() { >- // It's ok to call delete with a Null pointer. >- delete ozf ; >- delete ofs ; >-} >- >-} // namespace >- >-/** \file >- Implementation of GZIPOutputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/inflateinputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/inflateinputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/inflateinputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/inflateinputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,179 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include <zlib.h> >- >-#include "zipios++/fcollexceptions.h" >-#include "zipios++/inflateinputstreambuf.h" >- >-#include "outputstringstream.h" >- >-namespace zipios { >- >-using std::cerr ; >-using std::endl ; >- >-InflateInputStreambuf::InflateInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf ) >- : FilterInputStreambuf( inbuf, del_inbuf ), >- _zs_initialized ( false ), >- _invecsize ( 1000 ), >- _invec ( _invecsize ), >- _outvecsize ( 1000 ), >- _outvec ( _outvecsize ) >-{ >- // NOTICE: It is important that this constructor and the methods it >- // calls doesn't do anything with the input streambuf _inbuf, other >- // than repositioning it to the specified position. The reason is >- // that this class can be subclassed, and the subclass should get a >- // chance to read from the buffer first) >- >- // zlib init: >- _zs.zalloc = Z_NULL ; >- _zs.zfree = Z_NULL ; >- _zs.opaque = Z_NULL ; >- >- reset( s_pos ) ; >- // We're not checking the return value of reset() and throwing >- // an exception in case of an error, because we cannot catch the exception >- // in the constructors of subclasses with all compilers. >-} >- >-InflateInputStreambuf::~InflateInputStreambuf() { >- // Dealloc z_stream stuff >- int err = inflateEnd( &_zs ) ; >- if( err != Z_OK ) { >- cerr << "~inflatebuf: inflateEnd failed" ; >-#ifdef HAVE_ZERROR >- cerr << ": " << zError( err ) ; >-#endif >- cerr << endl ; >- } >-} >- >- >-int InflateInputStreambuf::underflow() { >- // If not underflow don't fill buffer >- if ( gptr() < egptr() ) >- return static_cast< unsigned char >( *gptr() ) ; >- >- // Prepare _outvec and get array pointers >- _zs.avail_out = _outvecsize ; >- _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; >- >- // Inflate until _outvec is full >- // eof (or I/O prob) on _inbuf will break out of loop too. >- int err = Z_OK ; >- while ( _zs.avail_out > 0 && err == Z_OK ) { >- if ( _zs.avail_in == 0 ) { // fill _invec >- int bc = static_cast< int >( _inbuf->sgetn( &(_invec[ 0 ] ) , >- _invecsize ) ) ; >- // FIXME: handle i/o problems. >- _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[0] ) ) ; >- _zs.avail_in = bc ; >- // If we could not read any new data (bc == 0) and inflate isn't >- // done it will return Z_BUF_ERROR and thus breaks out of the >- // loop. This means we don't have to respond to the situation >- // where we can't read more bytes here. >- } >- >- err = inflate( &_zs, Z_NO_FLUSH ) ; >- } >- // Normally the number of inflated bytes will be the >- // full length of the output buffer, but if we can't read >- // more input from the _inbuf streambuf, we end up with >- // less. >- int inflated_bytes = _outvecsize - _zs.avail_out ; >- setg( &( _outvec[ 0 ] ), >- &( _outvec[ 0 ] ), >- &( _outvec[ 0 ] ) + inflated_bytes ) ; >- // FIXME: look at the error returned from inflate here, if there is >- // some way to report it to the InflateInputStreambuf user. >- // Until I find out I'll just print a warning to stdout. >- if( err != Z_OK && err != Z_STREAM_END ) { >-#if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) >- // Throw an exception to make istream set badbit >- OutputStringStream msgs ; >- msgs << "InflateInputStreambuf: inflate failed" ; >-#ifdef HAVE_ZERROR >- msgs << ": " << zError( err ) ; >-#endif >- throw IOException( msgs.str() ) ; >-#endif >- // If HAVE_STD_IOSTREAM not defined we just return eof >- // if no output is produced, and that happens anyway >- } >- if (inflated_bytes > 0 ) >- return static_cast< unsigned char >( *gptr() ) ; >- else >- return EOF ; // traits_type::eof() ; >-} >- >- >- >-// This method is called in the constructor, so it must not >-// read anything from the input streambuf _inbuf (see notice in constructor) >-bool InflateInputStreambuf::reset( int stream_position ) { >- if ( stream_position >= 0 ) { // reposition _inbuf >- _inbuf->pubseekpos( stream_position ) ; >- } >- >- // _zs.next_in and avail_in must be set according to >- // zlib.h (inline doc). >- _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[0] ) ) ; >- _zs.avail_in = 0 ; >- >- int err ; >- if( _zs_initialized ) { // just reset it >- err = inflateReset( &_zs ) ; >- } else { // init it >- err = inflateInit2( &_zs, -MAX_WBITS ) ; >- /* windowBits is passed < 0 to tell that there is no zlib header. >- Note that in this case inflate *requires* an extra "dummy" byte >- after the compressed stream in order to complete decompression >- and return Z_STREAM_END. We always have an extra "dummy" byte, >- because there is always some trailing data after the compressed >- data (either the next entry or the central directory. */ >- _zs_initialized = true ; >- } >- >- // streambuf init: >- // The important thing here, is that >- // - the pointers are not NULL (which would mean unbuffered) >- // - and that gptr() is not less than egptr() (so we trigger underflow >- // the first time data is read). >- setg( &( _outvec[ 0 ] ), >- &( _outvec[ 0 ] ) + _outvecsize, >- &( _outvec[ 0 ] ) + _outvecsize ) ; >- >- if ( err == Z_OK ) >- return true ; >- else >- return false ; >-} >- >-} // namespace >- >-/** \file >- Implementation of InflateInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/outputstringstream.h FlightCrew-0.7.2.dev/src/zipios/src/outputstringstream.h >--- FlightCrew-0.7.2/src/zipios/src/outputstringstream.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/outputstringstream.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,69 +0,0 @@ >-#ifndef OUTPUTSTRINGSTREAM_H >-#define OUTPUTSTRINGSTREAM_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >- >-namespace zipios { >- >-#if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) >- >-typedef std::ostringstream OutputStringStream ; >- >-#else >- >-/** OutputStringStream is typedefed to ostringstream if sstream is >- part of the standard library (unless Zipios++ has been explicitly >- configured not to use it). If sstream is not present >- OutputStringStream is a subclass of ostrstream from >- strstream.h. In this case OutputStringStream specializes the str() >- method, such that the caller does not have to concern himself with >- null-terminating the string and unfreezing the ostrstream. */ >-class OutputStringStream : public ostrstream { >-public: >- >- /** Specialization of ostrstream::str() that takes care of >- null-terminating the string and unfreezing the ostrstream. */ >- inline string str() { >- *this << ends ; // null terminate ostrstream >- string o_str( ostrstream::str() ) ; >- freeze( 0 ) ; >- return o_str ; >- } >-private: >- // To avoid invoking such a member function in the base >- // class if there is one! >- string str() const ; >-}; >- >-#endif >- >-} // namespace >- >- >-#endif >- >-/** \file >- Header file that defines OutputStringStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipfile.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipfile.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipfile.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipfile.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,223 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/fcoll.h" >-#include "zipios++/zipfile.h" >-#include "zipios++/zipinputstream.h" >-#include "zipios++/zipios_defs.h" >- >-#include "backbuffer.h" >- >-#include "../../FlightCrew/Misc/BoostFilesystemUse.h" >- >-namespace zipios { >- >-// >-// Public >-// >- >-ZipFile ZipFile::openEmbeddedZipFile( const string &name ) { >- // open zipfile, read 4 last bytes close file >- // create ZipFile object. >- ifstream ifs( name.c_str(), ios::in | ios::binary ) ; >- ifs.seekg( -4, ios::end ) ; >- uint32 start_offset = readUint32( ifs ) ; >- ifs.close() ; >- return ZipFile( name, start_offset, 4 ) ; >-} >- >- >-ZipFile::ZipFile( const string &name , int s_off, int e_off >- /* , ios::open_mode mode */ ) >- : _vs( s_off, e_off ) { >- >- _filename = name ; >- >- ifstream _zipfile( name.c_str(), ios::in | ios::binary ) ; >- init( _zipfile ) ; >-} >- >-ZipFile::ZipFile( const fs::path &name , int s_off, int e_off >- /* , ios::open_mode mode */ ) >- : _vs( s_off, e_off ) { >- >- _filename = name.string(); >- >- fs::ifstream _zipfile( name, ios::in | ios::binary ) ; >- init( _zipfile ) ; >-} >- >- >-FileCollection *ZipFile::clone() const { >- return new ZipFile( *this ) ; >-} >- >- >-ZipFile::~ZipFile() { >- close() ; >-} >- >-void ZipFile::close() { >- _valid = false ; >- >-} >- >-istream *ZipFile::getInputStream( const ConstEntryPointer &entry ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid FileCollection" ) ; >- return getInputStream( entry->getName() ) ; >-} >- >-istream *ZipFile::getInputStream( const string &entry_name, >- MatchPath matchpath ) { >- if ( ! _valid ) >- throw InvalidStateException( "Attempt to use an invalid ZipFile" ) ; >- >- ConstEntryPointer ent = getEntry( entry_name, matchpath ) ; >- >- if ( ent == 0 ) >- return 0 ; >- else { >- ZipInputStream *zis( new ZipInputStream( _filename, >- static_cast< const ZipCDirEntry * >( ent.get() )-> >- getLocalHeaderOffset() + _vs.startOffset() ) ) ; >- zis->getNextEntry(); >- return zis; >- } >-} >- >- >-// >-// Private >-// >- >-bool ZipFile::init( istream &_zipfile ) { >- >- // Check stream error state >- if ( ! _zipfile ) { >- setError ( "Error reading from file" ) ; >- return false ; >- } >- >- _valid = readCentralDirectory( _zipfile ) ; >- >- return _valid ; >-} >- >- >-bool ZipFile::readCentralDirectory ( istream &_zipfile ) { >- // Find and read eocd. >- if ( ! readEndOfCentralDirectory( _zipfile ) ) >- throw FCollException( "Unable to find zip structure: End-of-central-directory" ) ; >- >- // Position read pointer to start of first entry in central dir. >- _vs.vseekg( _zipfile, _eocd.offset(), ios::beg ) ; >- >- int entry_num = 0 ; >- // Giving the default argument in the next line to keep Visual C++ quiet >- _entries.resize ( _eocd.totalCount(), 0 ) ; >- while ( ( entry_num < _eocd.totalCount() ) ) { >- ZipCDirEntry *ent = new ZipCDirEntry ; >- _entries[ entry_num ] = ent ; >- _zipfile >> *ent ; >- if ( ! _zipfile ) { >- if ( _zipfile.bad() ) >- throw IOException( "Error reading zip file while reading zip file central directory" ) ; >- else if ( _zipfile.fail() ) >- throw FCollException( "Zip file consistency problem. Failure while reading zip file central directory" ) ; >- else if ( _zipfile.eof() ) >- throw IOException( "Premature end of file while reading zip file central directory" ) ; >- } >- ++entry_num ; >- } >- >- // Consistency check. eocd should start here >- >- int pos = _vs.vtellg( _zipfile ) ; >- _vs.vseekg( _zipfile, 0, ios::end ) ; >- int remaining = static_cast< int >( _vs.vtellg( _zipfile ) ) - pos ; >- if ( remaining != _eocd.eocdOffSetFromEnd() ) >- throw FCollException( "Zip file consistency problem. Zip file data fields are inconsistent with zip file layout" ) ; >- >- // Consistency check 2, are local headers consistent with >- // cd headers >- if ( ! confirmLocalHeaders( _zipfile ) ) >- throw FCollException( "Zip file consistency problem. Zip file data fields are inconsistent with zip file layout" ) ; >- >- return true ; >-} >- >- >-bool ZipFile::readEndOfCentralDirectory ( istream &_zipfile ) { >- BackBuffer bb( _zipfile, _vs ) ; >- int read_p = -1 ; >- bool found = false ; >- while ( ! found ) { >- if ( read_p < 0 ) >- if ( ! bb.readChunk ( read_p ) ) { >- found = false ; >- break ; >- } >- if ( _eocd.read( bb, read_p ) ) { >- found = true ; >- break ; >- } >- --read_p ; >- } >- >- return found ; >-} >- >-bool ZipFile::confirmLocalHeaders( istream &_zipfile ) { >- Entries::const_iterator it ; >- ZipCDirEntry *ent ; >- int inconsistencies = 0 ; >- ZipLocalEntry zlh ; >- for ( it = _entries.begin() ; it != _entries.end() ; it++ ) { >- ent = static_cast< ZipCDirEntry * >( (*it).get() ) ; >- _vs.vseekg( _zipfile, ent->getLocalHeaderOffset(), ios::beg ) ; >- _zipfile >> zlh ; >- if ( ! _zipfile || zlh != *ent ) { >- inconsistencies++ ; >- _zipfile.clear() ; >- } >- } >- return ! inconsistencies ; >-} >- >-void ZipFile::setError ( string error_str ) { >- _valid = false ; >-#ifdef _USE_EXCEPTIONS >- throw error_str ; // define exception class instead. >-#else >- cerr << error_str << endl ; // define operator<< for exception class if such a class replaces string >-#endif >-} >- >- >-} >- >-/** \file >- The implementation of ZipFile. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/ziphead.cpp FlightCrew-0.7.2.dev/src/zipios/src/ziphead.cpp >--- FlightCrew-0.7.2/src/zipios/src/ziphead.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/ziphead.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,295 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <iterator> >-#include <string> >-#include <cassert> >- >-#include "zipios_common.h" >-#include "zipios++/ziphead.h" >-#include "zipios++/zipheadio.h" >-#include "zipios++/zipios_defs.h" >- >-#include "outputstringstream.h" >- >-namespace zipios { >- >-using std::ios ; >- >-bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) { >- // Not all fields need to be identical. Some of the information >- // may be put in a data descriptor that trails the compressed >- // data, according to the specs (The trailing data descriptor >- // can contain crc_32, compress_size and uncompress_size.) >- >- // Experience has shown that extra_field and extra_field_len >- // can differ too. >- >-// cerr << "----- BEGIN -----" << endl ; >-// cerr << ( zlh.extract_version == ze.extract_version ) << endl ; >-// cerr << ( zlh.gp_bitfield == ze.gp_bitfield ) << endl ; >-// cerr << ( zlh.compress_method == ze.compress_method ) << endl ; >-// cerr << ( zlh.last_mod_ftime == ze.last_mod_ftime ) << endl ; >-// cerr << ( zlh.last_mod_fdate == ze.last_mod_fdate ) << endl ; >- >-// cerr << ( zlh.filename_len == ze.filename_len ) << endl ; >- >-// cerr << ( zlh.filename == ze.filename ) << endl ; >-// cerr << "----- END -----" << endl ; >- return ( zlh.extract_version == ze.extract_version && >- zlh.gp_bitfield == ze.gp_bitfield && >- zlh.compress_method == ze.compress_method && >- zlh.last_mod_ftime == ze.last_mod_ftime && >- zlh.last_mod_fdate == ze.last_mod_fdate && >- zlh.filename_len == ze.filename_len && >- >- zlh.filename == ze.filename ) ; >-} >- >-// >-// ZipLocalEntry methods >-// >- >-const uint32 ZipLocalEntry::signature = 0x04034b50 ; >- >- >- >-void ZipLocalEntry::setDefaultExtract() { >- extract_version = 20 ; // version number >-} >- >-string ZipLocalEntry::getComment() const { >- return "" ; // No comment in a local entry >-} >- >-uint32 ZipLocalEntry::getCompressedSize() const { >- return compress_size ; >-} >- >-uint32 ZipLocalEntry::getCrc() const { >- return crc_32 ; >-} >- >-vector< unsigned char > ZipLocalEntry::getExtra() const { >- return extra_field ; >-} >- >-StorageMethod ZipLocalEntry::getMethod() const { >- return static_cast< StorageMethod >( compress_method ) ; >-} >- >-string ZipLocalEntry::getName() const { >- return filename ; >-} >- >-string ZipLocalEntry::getFileName() const { >- if ( isDirectory() ) >- return string() ; >- string::size_type pos ; >- pos = filename.find_last_of( separator ) ; >- if ( pos != string::npos ) { // separator found! >- // isDirectory() check means pos should not be last, so pos+1 is ok >- return filename.substr( pos + 1 ) ; >- } else { >- return filename ; >- } >-} >- >-uint32 ZipLocalEntry::getSize() const { >- return uncompress_size ; >-} >- >-int ZipLocalEntry::getTime() const { >- return ( last_mod_fdate << 16 ) + last_mod_ftime ; >- // FIXME: what to do with this time date thing? (not only here?) >-} >- >-bool ZipLocalEntry::isValid() const { >- return _valid ; >-} >- >-bool ZipLocalEntry::isDirectory() const { >- assert( filename.size() != 0 ) ; >- return filename[ filename.size() - 1 ] == separator ; >-} >- >- >-void ZipLocalEntry::setComment( const string & ) { >- // A local entry cannot hold a comment >-} >- >-void ZipLocalEntry::setCompressedSize( uint32 size ) { >- compress_size = size ; >-} >- >-void ZipLocalEntry::setCrc( uint32 crc ) { >- crc_32 = crc ; >-} >- >-void ZipLocalEntry::setExtra( const vector< unsigned char > &extra ) { >- extra_field = extra ; >- extra_field_len = static_cast< uint16 >( extra_field.size() ) ; >-} >- >-void ZipLocalEntry::setMethod( StorageMethod method ) { >- compress_method = static_cast< uint16 >( method ) ; >-} >- >-void ZipLocalEntry::setName( const string &name ) { >- filename = name ; >- filename_len = static_cast< uint16 >( filename.size() ) ; >-} >- >-void ZipLocalEntry::setSize( uint32 size ) { >- uncompress_size = size ; >-} >- >-void ZipLocalEntry::setTime( int time ) { >- // FIXME: fix time setting here, and ind flist and elsewhere. Define the >- // date time semantics before mucking about - how surprising >- >- // Mark Donszelmann: added these lines to make zip work for winzip >- last_mod_fdate = (time >> 16) & 0x0000FFFF; >- last_mod_ftime = time & 0x0000FFFF; >-} >- >-string ZipLocalEntry::toString() const { >- OutputStringStream sout ; >- sout << filename << " (" << uncompress_size << " bytes, " ; >- sout << compress_size << " bytes compressed)" ; >- return sout.str() ; >-} >- >-int ZipLocalEntry::getLocalHeaderSize() const { >- return static_cast< int >( 30 + filename.size() + extra_field.size() ) ; >-} >- >-bool ZipLocalEntry::trailingDataDescriptor() const { >- // gp_bitfield bit 3 is one, if this entry uses a trailing data >- // descriptor to keep size, compressed size and crc-32 >- // fields. >- if ( ( gp_bitfield & 4 ) == 1 ) >- return true ; >- else >- return false ; >-} >- >-FileEntry *ZipLocalEntry::clone() const { >- return new ZipLocalEntry( *this ) ; >-} >- >- >-// >-// ZipCDirEntry methods >-// >- >-const uint32 ZipCDirEntry::signature = 0x02014b50 ; >- >-void ZipCDirEntry::setDefaultWriter() { >- writer_version = 0 ; >-#ifdef WIN32 >- writer_version |= static_cast< uint16 >( 0 ) << 8 ; // Windows, DOS >-#else >- writer_version |= static_cast< uint16 >( 3 ) << 8 ; // Unix >-#endif >- writer_version |= 20 ; // version number >-} >- >-string ZipCDirEntry::getComment() const { >- return file_comment ; >-} >- >-uint32 ZipCDirEntry::getLocalHeaderOffset() const { >- return rel_offset_loc_head ; >-} >- >-void ZipCDirEntry::setLocalHeaderOffset( uint32 offset ) { >- rel_offset_loc_head = offset ; >-} >- >- >-void ZipCDirEntry::setComment( const string &comment ) { >- file_comment = comment ; >- file_comment_len = static_cast< uint16 >( file_comment.size() ) ; >-} >- >- >-string ZipCDirEntry::toString() const { >- OutputStringStream sout ; >- sout << filename << " (" << uncompress_size << " bytes, " ; >- sout << compress_size << " bytes compressed)" ; >- return sout.str() ; >-} >- >- >-int ZipCDirEntry::getCDirHeaderSize() const { >- return static_cast< int >( 46 + filename.size() + extra_field.size() + file_comment.size() ) ; >-} >- >- >-FileEntry *ZipCDirEntry::clone() const { >- return new ZipCDirEntry( *this ) ; >-} >- >- >-// >-// EndOfCentralDirectory methods >-// >- >-const uint32 EndOfCentralDirectory::signature = 0x06054b50 ; >- >-bool EndOfCentralDirectory::read( vector<unsigned char> &buf, int pos ) { >- if ( ( buf.size() - pos < sizeof( uint32 ) ) || >- ( ! checkSignature( &( buf[ pos ] ) ) ) ) >- return false ; >- >- eocd_offset_from_end = buf.size() - pos ; >- pos += sizeof( uint32 ) ; >- disk_num = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; >- cdir_disk_num = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; >- cdir_entries = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; >- cdir_tot_entries = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; >- cdir_size = ztohl( &( buf[ pos ] ) ) ; pos += sizeof( uint32 ) ; >- cdir_offset = ztohl( &( buf[ pos ] ) ) ; pos += sizeof( uint32 ) ; >- zip_comment_len = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; >-// cerr << "Zip comment length = " << zip_comment_len << endl ; >-// cerr << "Length of remaining file = " << buf.size() - pos << endl ; >- >- return true ; // Dummy >-} >- >-bool EndOfCentralDirectory::checkSignature ( unsigned char *buf ) const { >-// cerr << "potential header: " << ztohl( buf ) << endl ; >- return checkSignature( ztohl( buf ) ) ; >-} >- >- >- >-} // namespace >- >- >- >-/** \file >- Implementation of routines for reading the central directory and >- local headers of a zip archive. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipheadio.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipheadio.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipheadio.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipheadio.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,195 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <iterator> >-#include <string> >- >-#include "zipios_common.h" >-#include "zipios++/zipheadio.h" >- >-#include "outputstringstream.h" >- >-namespace zipios { >- >-std::istream& operator>> ( std::istream &is, ZipLocalEntry &zlh ) { >- zlh._valid = false ; // set to true upon successful completion. >- if ( ! is ) >- return is ; >- >-// // Before reading anything we record the position in the stream >-// // This is a field in the central directory entry, but not >-// // in the local entry. After all, we know where we are, anyway. >-// zlh.rel_offset_loc_head = is.tellg() ; >- >- if ( zlh.signature != readUint32( is ) ) { >- // put stream in error state and return >- is.setstate ( std::ios::failbit ) ; >- return is ; >- } >- >- zlh.extract_version = readUint16( is ) ; >- zlh.gp_bitfield = readUint16( is ) ; >- zlh.compress_method = readUint16( is ) ; >- zlh.last_mod_ftime = readUint16( is ) ; >- zlh.last_mod_fdate = readUint16( is ) ; >- zlh.crc_32 = readUint32( is ) ; >- zlh.compress_size = readUint32( is ) ; >- zlh.uncompress_size = readUint32( is ) ; >- zlh.filename_len = readUint16( is ) ; >- zlh.extra_field_len = readUint16( is ) ; >- >- // Read filename and extra_field >- readByteSeq( is, zlh.filename, zlh.filename_len ) ; >- readByteSeq( is, zlh.extra_field, zlh.extra_field_len ) ; >- >- if ( is ) >- zlh._valid = true ; >- return is ; >-} >- >- >-std::istream& operator>> ( std::istream &is, DataDescriptor & ) { >- return is ; >-} >- >- >-std::istream& operator>> ( std::istream &is, ZipCDirEntry &zcdh ) { >- zcdh._valid = false ; // set to true upon successful completion. >- if ( ! is ) >- return is ; >- >- if ( zcdh.signature != readUint32( is ) ) { >- // put stream in error state and return >- is.setstate ( std::ios::failbit ) ; >- return is ; >- } >- >- zcdh.writer_version = readUint16( is ) ; >- zcdh.extract_version = readUint16( is ) ; >- zcdh.gp_bitfield = readUint16( is ) ; >- zcdh.compress_method = readUint16( is ) ; >- zcdh.last_mod_ftime = readUint16( is ) ; >- zcdh.last_mod_fdate = readUint16( is ) ; >- zcdh.crc_32 = readUint32( is ) ; >- zcdh.compress_size = readUint32( is ) ; >- zcdh.uncompress_size = readUint32( is ) ; >- zcdh.filename_len = readUint16( is ) ; >- zcdh.extra_field_len = readUint16( is ) ; >- zcdh.file_comment_len = readUint16( is ) ; >- zcdh.disk_num_start = readUint16( is ) ; >- zcdh.intern_file_attr = readUint16( is ) ; >- zcdh.extern_file_attr = readUint32( is ) ; >- zcdh.rel_offset_loc_head = readUint32( is ) ; >- >- // Read filename and extra_field >- readByteSeq( is, zcdh.filename, zcdh.filename_len ) ; >- readByteSeq( is, zcdh.extra_field, zcdh.extra_field_len ) ; >- readByteSeq( is, zcdh.file_comment, zcdh.file_comment_len ) ; >- >- if ( is ) >- zcdh._valid = true ; >- return is ; >-} >- >-std::ostream &operator<< ( std::ostream &os, const ZipLocalEntry &zlh ) { >- if ( ! os ) >- return os ; >- >- writeUint32( zlh.signature , os ) ; >- writeUint16( zlh.extract_version, os ) ; >- writeUint16( zlh.gp_bitfield , os ) ; >- writeUint16( zlh.compress_method, os ) ; >- writeUint16( zlh.last_mod_ftime , os ) ; >- writeUint16( zlh.last_mod_fdate , os ) ; >- writeUint32( zlh.crc_32 , os ) ; >- writeUint32( zlh.compress_size , os ) ; >- writeUint32( zlh.uncompress_size, os ) ; >- writeUint16( zlh.filename_len , os ) ; >- writeUint16( zlh.extra_field_len, os ) ; >- >- >- // Write filename and extra_field >- writeByteSeq( os, zlh.filename ) ; >- writeByteSeq( os, zlh.extra_field ) ; >- >- return os ; >-} >- >-std::ostream &operator<< ( std::ostream &os, const ZipCDirEntry &zcdh ) { >- if ( ! os ) >- return os ; >- >- writeUint32( zcdh.signature , os ) ; >- writeUint16( zcdh.writer_version , os ) ; >- writeUint16( zcdh.extract_version , os ) ; >- writeUint16( zcdh.gp_bitfield , os ) ; >- writeUint16( zcdh.compress_method , os ) ; >- writeUint16( zcdh.last_mod_ftime , os ) ; >- writeUint16( zcdh.last_mod_fdate , os ) ; >- writeUint32( zcdh.crc_32 , os ) ; >- writeUint32( zcdh.compress_size , os ) ; >- writeUint32( zcdh.uncompress_size , os ) ; >- writeUint16( zcdh.filename_len , os ) ; >- writeUint16( zcdh.extra_field_len , os ) ; >- writeUint16( zcdh.file_comment_len , os ) ; >- writeUint16( zcdh.disk_num_start , os ) ; >- writeUint16( zcdh.intern_file_attr , os ) ; >- writeUint32( zcdh.extern_file_attr , os ) ; >- writeUint32( zcdh.rel_offset_loc_head, os ) ; >- >- // Write filename and extra_field >- writeByteSeq( os, zcdh.filename ) ; >- writeByteSeq( os, zcdh.extra_field ) ; >- writeByteSeq( os, zcdh.file_comment ) ; >- >- return os ; >-} >- >-std::ostream &operator<< ( std::ostream &os, const EndOfCentralDirectory &eocd ) { >- if ( ! os ) >- return os ; >- >- writeUint32( eocd.signature , os ) ; >- writeUint16( eocd.disk_num , os ) ; >- writeUint16( eocd.cdir_disk_num , os ) ; >- writeUint16( eocd.cdir_entries , os ) ; >- writeUint16( eocd.cdir_tot_entries, os ) ; >- writeUint32( eocd.cdir_size , os ) ; >- writeUint32( eocd.cdir_offset , os ) ; >- writeUint16( eocd.zip_comment_len , os ) ; >- >- writeByteSeq( os, eocd.zip_comment ) ; >- >- return os ; >-} >- >- >- >-} // namespace >- >- >- >-/** \file >- Implementation of I/O functions for the header structures >- defined in ziphead.h. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipinputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipinputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipinputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipinputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,137 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include <algorithm> >-#include "zipios++/meta-iostreams.h" >- >-#include <zlib.h> >- >-#include "zipios++/zipinputstreambuf.h" >-#include "zipios_common.h" >- >-namespace zipios { >- >-using std::ios ; >-using std::cerr ; >-using std::endl ; >- >-ZipInputStreambuf::ZipInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf ) >- : InflateInputStreambuf( inbuf, s_pos, del_inbuf ), >- _open_entry( false ) >-{} >- >-void ZipInputStreambuf::closeEntry() { >- if ( ! _open_entry ) >- return ; >- >- // check if we're positioned correctly, otherwise position us correctly >- int position = static_cast< int >( _inbuf->pubseekoff(0, ios::cur, >- ios::in) ); >- if ( position != _data_start + static_cast< int >( _curr_entry.getCompressedSize() ) ) >- _inbuf->pubseekoff(_data_start + _curr_entry.getCompressedSize(), >- ios::beg, ios::in) ; >- >-} >- >-void ZipInputStreambuf::close() { >-} >- >-ConstEntryPointer ZipInputStreambuf::getNextEntry() { >- if ( _open_entry ) >- closeEntry() ; >- >- // 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 = static_cast< int >( _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 (...) { >- _open_entry = false ; >- } >- >- if ( _curr_entry.isValid() && _curr_entry.trailingDataDescriptor() ) >- throw FCollException( "Trailing data descriptor in zip file not supported" ) ; >- return new ZipLocalEntry( _curr_entry ) ; >-} >- >- >-ZipInputStreambuf::~ZipInputStreambuf() { >-} >- >- >-int ZipInputStreambuf::underflow() { >- if ( ! _open_entry ) >- return EOF ; // traits_type::eof() >- if ( _curr_entry.getMethod() == DEFLATED ) >- return InflateInputStreambuf::underflow() ; >- >- // Ok, we're are stored, so we handle it ourselves. >- int num_b = min( _remain, _outvecsize ) ; >- int g = static_cast< int >( _inbuf->sgetn( &(_outvec[ 0 ] ) , num_b ) ) ; >- setg( &( _outvec[ 0 ] ), >- &( _outvec[ 0 ] ), >- &( _outvec[ 0 ] ) + g ) ; >- _remain -= g ; >- if ( g > 0 ) >- return static_cast< unsigned char >( *gptr() ) ; >- else >- return EOF ; // traits_type::eof() >-} >- >- >-// FIXME: We need to check somew >-// >-// // gp_bitfield bit 3 is one, if the length of the zip entry >-// // is stored in a trailer. >-// if ( is->good && ( _curr_entry.gp_bitfield & 4 ) != 1 ) >-// return true ; >-// else { >-// is->clear() ; >-// return false ; >-// } >- >- >-} // namespace >- >-/** \file >- Implementation of ZipInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipinputstream.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipinputstream.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipinputstream.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipinputstream.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,82 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/zipinputstreambuf.h" >-#include "zipios++/zipinputstream.h" >- >-using std::istream; >- >-namespace zipios { >- >-ZipInputStream::ZipInputStream( std::istream &is, std::streampos pos ) >- : istream( 0 ), >-// SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first?? >- ifs( 0 ) >-{ >- izf = new ZipInputStreambuf( is.rdbuf(), static_cast< int >( pos ) ) ; >-// this->rdbuf( izf ) ; is replaced by: >- this->init( izf ) ; >-} >- >-ZipInputStream::ZipInputStream( const std::string &filename, std::streampos pos ) >- : istream( 0 ), >- ifs( 0 ) >-{ >- ifs = new std::ifstream( filename.c_str(), std::ios::in |std:: ios::binary ) ; >- izf = new ZipInputStreambuf( ifs->rdbuf(), static_cast< int >( pos ) ) ; >-// this->rdbuf( izf ) ; is replaced by: >- this->init( izf ) ; >-} >- >-int ZipInputStream::available() { >- return 1 ; // FIXME: Dummy implementation >-} >- >-void ZipInputStream::closeEntry() { >- izf->closeEntry() ; >-} >- >-void ZipInputStream::close() { >- izf->close() ; >-} >- >-// ZipLocalEntry *ZipInputStream::createZipCDirEntry( const string >-// &name ) {} >- >-ConstEntryPointer ZipInputStream::getNextEntry() { >- clear() ; // clear eof and other flags. >- return izf->getNextEntry() ; >-} >- >-ZipInputStream::~ZipInputStream() { >- // It's ok to call delete with a Null pointer. >- delete izf ; >- delete ifs ; >-} >- >-} // namespace >- >-/** \file >- Implementation of ZipInputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipios_common.h FlightCrew-0.7.2.dev/src/zipios/src/zipios_common.h >--- FlightCrew-0.7.2/src/zipios/src/zipios_common.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipios_common.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,52 +0,0 @@ >-#ifndef ZIPIOS_COMMON_H >-#define ZIPIOS_COMMON_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >- >-namespace zipios { >- >-using std::vector; >- >-static const char separator = '/' ; >- >-template< class Type > >-void operator += ( vector< Type > &v1, const vector< Type > &v2 ) { >- typename std::vector<Type>::const_iterator cit ; >- for ( cit = v2.begin() ; cit != v2.end() ; ++cit ) >- v1.push_back( *cit ) ; >-} >- >-template< class T > >-inline const T& min( const T& a, const T& b ) { >- return b < a ? b : a ; >-} >- >- >-} // namespace >- >-#endif >- >-/** \file >- Header file containing miscellaneous small functions. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipoutputstreambuf.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipoutputstreambuf.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipoutputstreambuf.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipoutputstreambuf.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,204 +0,0 @@ >- >-#include <time.h> >- >-#include "zipios++/zipios-config.h" >- >-#include <algorithm> >-#include "zipios++/meta-iostreams.h" >- >-#include <zlib.h> >- >-#include "zipios++/zipoutputstreambuf.h" >- >-namespace zipios { >- >-using std::ios ; >-using std::cerr ; >-using std::endl ; >-//using std::min ; >- >-ZipOutputStreambuf::ZipOutputStreambuf( streambuf *outbuf, bool del_outbuf ) >- : DeflateOutputStreambuf( outbuf, false, del_outbuf ), >- _open_entry( false ), >- _open ( true ), >- _method ( DEFLATED ), >- _level ( 6 ) >-{ >-} >- >- >-void ZipOutputStreambuf::closeEntry() { >- if ( ! _open_entry ) >- return ; >- >- closeStream() ; >- >- updateEntryHeaderInfo() ; >- setEntryClosedState( ) ; >-} >- >- >-void ZipOutputStreambuf::close() { >- finish() ; >-} >- >- >-void ZipOutputStreambuf::finish() { >- if( ! _open ) >- return ; >- closeEntry() ; >- ostream os( _outbuf ) ; >- writeCentralDirectory( _entries, EndOfCentralDirectory( _zip_comment), os ) ; >- _open = false ; >-} >- >- >-ZipOutputStreambuf::~ZipOutputStreambuf() { >- finish() ; >-} >- >- >-void ZipOutputStreambuf::putNextEntry( const ZipCDirEntry &entry ) { >- if ( _open_entry ) >- closeEntry() ; >- >- if ( ! init( _level ) ) >- cerr << "ZipOutputStreambuf::putNextEntry(): init() failed!\n" ; >- >- _entries.push_back( entry ) ; >- ZipCDirEntry &ent = _entries.back() ; >- >- ostream os( _outbuf ) ; >- >- // Update entry header info >- ent.setLocalHeaderOffset( static_cast< uint32 >( os.tellp() ) ) ; >- ent.setMethod( _method ) ; >- >- os << static_cast< ZipLocalEntry >( ent ) ; >- >- _open_entry = true ; >-} >- >- >-void ZipOutputStreambuf::setComment( const string &comment ) { >- _zip_comment = comment ; >-} >- >- >-void ZipOutputStreambuf::setLevel( int level ) { >- _level = level ; >-} >- >- >-void ZipOutputStreambuf::setMethod( StorageMethod method ) { >- _method = method ; >- if( method == STORED ) >- setLevel( NO_COMPRESSION ) ; >- else if ( method == DEFLATED ) { >- if( _level == NO_COMPRESSION ) >- setLevel( DEFAULT_COMPRESSION ) ; >- } else >- throw FCollException( "Specified compression method not supported" ) ; >-} >- >-// >-// Protected and private methods >-// >- >-int ZipOutputStreambuf::overflow( int c ) { >- return DeflateOutputStreambuf::overflow( c ) ; >-// // FIXME: implement >- >-// cout << "ZipOutputStreambuf::overflow() not implemented yet!\n" ; >-// return EOF ; >-} >- >- >- >-int ZipOutputStreambuf::sync() { >- return DeflateOutputStreambuf::sync() ; >-// // FIXME: implement >-// cout << "ZipOutputStreambuf::sync() not implemented yet!\n" ; >-// return EOF ; >-} >- >- >- >-void ZipOutputStreambuf::setEntryClosedState() { >- _open_entry = false ; >- // FIXME: update put pointers to trigger overflow on write. overflow >- // should then return EOF while _open_entry is false. >-} >- >- >-void ZipOutputStreambuf::updateEntryHeaderInfo() { >- if ( ! _open_entry ) >- return ; >- >- ostream os( _outbuf ) ; >- int curr_pos = static_cast< int >( os.tellp() ) ; >- >- // update fields in _entries.back() >- ZipCDirEntry &entry = _entries.back() ; >- entry.setSize( getCount() ) ; >- entry.setCrc( getCrc32() ) ; >- entry.setCompressedSize( curr_pos - entry.getLocalHeaderOffset() >- - entry.getLocalHeaderSize() ) ; >- >- // Mark Donszelmann: added current date and time >- time_t ltime; >- time( <ime ); >- struct tm *now; >- now = localtime( <ime ); >- int dosTime = (now->tm_year - 80) << 25 | (now->tm_mon + 1) << 21 | now->tm_mday << 16 | >- now->tm_hour << 11 | now->tm_min << 5 | now->tm_sec >> 1; >- entry.setTime(dosTime); >- >- // write ZipLocalEntry header to header position >- os.seekp( entry.getLocalHeaderOffset() ) ; >- os << static_cast< ZipLocalEntry >( entry ) ; >- os.seekp( curr_pos ) ; >-} >- >- >-void ZipOutputStreambuf::writeCentralDirectory( const vector< ZipCDirEntry > &entries, >- EndOfCentralDirectory eocd, >- ostream &os ) { >- int cdir_start = static_cast< int >( os.tellp() ) ; >- std::vector< ZipCDirEntry >::const_iterator it ; >- int cdir_size = 0 ; >- >- for ( it = entries.begin() ; it != entries.end() ; ++it ) { >- os << *it ; >- cdir_size += it->getCDirHeaderSize() ; >- } >- eocd.setOffset( cdir_start ) ; >- eocd.setCDirSize( cdir_size ) ; >- eocd.setTotalCount( static_cast< uint16 >( entries.size() ) ) ; >- os << eocd ; >-} >- >-} // namespace >- >-/** \file >- Implementation of ZipOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/src/zipoutputstream.cpp FlightCrew-0.7.2.dev/src/zipios/src/zipoutputstream.cpp >--- FlightCrew-0.7.2/src/zipios/src/zipoutputstream.cpp 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/src/zipoutputstream.cpp 1970-01-01 01:00:00.000000000 +0100 >@@ -1,103 +0,0 @@ >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/zipoutputstreambuf.h" >-#include "zipios++/zipoutputstream.h" >- >-using std::ostream; >- >-namespace zipios { >- >-ZipOutputStream::ZipOutputStream( std::ostream &os ) >- : ostream( 0 ), >-// SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first?? >- ofs( 0 ) >-{ >- ozf = new ZipOutputStreambuf( os.rdbuf() ) ; >- >- init( ozf ) ; >-} >- >- >-ZipOutputStream::ZipOutputStream( const std::string &filename ) >- : ostream( 0 ), >- ofs( 0 ) >-{ >- ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ; >- ozf = new ZipOutputStreambuf( ofs->rdbuf() ) ; >- this->init( ozf ) ; >-} >- >-void ZipOutputStream::closeEntry() { >- ozf->closeEntry() ; >-} >- >- >-void ZipOutputStream::close() { >- ozf->close() ; >- if ( ofs ) >- ofs->close() ; >-} >- >- >-void ZipOutputStream::finish() { >- ozf->finish() ; >-} >- >- >-void ZipOutputStream::putNextEntry( const ZipCDirEntry &entry ) { >- ozf->putNextEntry( entry ) ; >-} >- >-void ZipOutputStream::putNextEntry(const std::string& entryName) { >- putNextEntry( ZipCDirEntry(entryName)); >-} >- >- >-void ZipOutputStream::setComment( const std::string &comment ) { >- ozf->setComment( comment ) ; >-} >- >- >-void ZipOutputStream::setLevel( int level ) { >- ozf->setLevel( level ) ; >-} >- >- >-void ZipOutputStream::setMethod( StorageMethod method ) { >- ozf->setMethod( method ) ; >-} >- >- >-ZipOutputStream::~ZipOutputStream() { >- // It's ok to call delete with a Null pointer. >- delete ozf ; >- delete ofs ; >-} >- >-} // namespace >- >-/** \file >- Implementation of ZipOutputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/basicentry.h FlightCrew-0.7.2.dev/src/zipios/zipios++/basicentry.h >--- FlightCrew-0.7.2/src/zipios/zipios++/basicentry.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/basicentry.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,87 +0,0 @@ >-#ifndef BASICENTRY_H >-#define BASICENTRY_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >- >-#include "zipios++/fcollexceptions.h" >-#include "zipios++/fileentry.h" >-#include "zipios++/filepath.h" >-#include "zipios++/zipios_defs.h" >- >-namespace zipios { >- >-/** BasicEntry is a FileEntry that is suitable as a base class for >- basic entries, that e.g. do not support any form of compression */ >-class BasicEntry : public FileEntry { >-public: >- /** Constructor. >- @param filename the filename of the entry. >- @param comment a comment for the entry. >- */ >- explicit BasicEntry( const string &filename, const string &comment, >- const FilePath &basepath = FilePath() ) ; >- virtual string getComment() const ; >- virtual uint32 getCompressedSize() const ; >- virtual uint32 getCrc() const ; >- virtual vector< unsigned char > getExtra() const ; >- virtual StorageMethod getMethod() const ; >- virtual string getName() const ; >- virtual string getFileName() const ; >- virtual uint32 getSize() const ; >- virtual int getTime() const ; >- virtual bool isValid() const ; >- >- // virtual int hashCode() const ; >- virtual bool isDirectory() const ; >- >- virtual void setComment( const string &comment ) ; >- virtual void setCompressedSize( uint32 size ) ; >- virtual void setCrc( uint32 crc ) ; >- virtual void setExtra( const vector< unsigned char > &extra ) ; >- virtual void setMethod( StorageMethod method ) ; >- virtual void setName( const string &name ) ; >- virtual void setSize( uint32 size ) ; >- virtual void setTime( int time ) ; >- >- virtual string toString() const ; >- >- virtual FileEntry *clone() const ; >- >- virtual ~BasicEntry() ; >-protected: >- string _filename ; >- string _comment ; >- int _size ; >- bool _valid ; >- FilePath _basepath ; >- >-}; >- >-} >-#endif >- >-/** \file >- Header file that defines BasicEntry. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/collcoll.h FlightCrew-0.7.2.dev/src/zipios/zipios++/collcoll.h >--- FlightCrew-0.7.2/src/zipios/zipios++/collcoll.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/collcoll.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,174 +0,0 @@ >-#ifndef COLLCOLL_H >-#define COLLCOLL_H >- >-#include "zipios++/zipios-config.h" >- >-#include <string> >-#include <vector> >- >-#include "zipios++/fcoll.h" >- >-namespace zipios { >- >-using std::string ; >- >-/** \anchor collcoll_anchor >- CollectionCollection is a FileCollection that consists of an >- arbitrary number of FileCollections. With a CollectionCollection >- the user can use multiple FileCollections transparently, making it >- easy for a program to keep some of its files in a zip archive and >- others stored in ordinary files. CollectionCollection can be used >- to create a simple virtual filesystem, where all collections are >- mounted in /. If more than one collection contain a file with >- the same path only the one in the first added collection will >- be accessible. >-*/ >-class CollectionCollection : public FileCollection { >-public: >- /** \anchor collcoll_inst_anchor >- This static method provides a singleton instance of a CollectionCollection. >- The instance is instantiated the first time the method is called. >- @return A pointer to a singleton CollectionCollection instance. >- */ >- static inline CollectionCollection &inst() ; >- >- /** Constructor. >- */ >- explicit CollectionCollection() ; >- >- /** Copy constructor. */ >- inline CollectionCollection( const CollectionCollection &src ) ; >- >- /** Copy assignment operator. */ >- inline const CollectionCollection &operator= ( const CollectionCollection &src ) ; >- >- /** \anchor collcoll_addcoll_anchor >- Adds a collection. >- @param collection The collection to add. >- @return true if the collection was added succesfully and >- the added collection is valid. >- */ >- bool addCollection( const FileCollection &collection ) ; >- >- /** Adds the collection pointed to by collection. The CollectionCollection >- will call delete on the pointer when it is destructed, so the caller >- should make absolutely sure to only pass in a collection created with new >- and be sure to leave it alone after adding it. If the collection is not >- added false is returned and the caller remains responsible for the >- collection pointed to by collection. >- @param collection A pointer to the collection to add. >- @return true if the collection was added succesfully and >- the added collection is valid. */ >- bool addCollection( FileCollection *collection ) ; >- >- virtual void close() ; >- >- virtual ConstEntries entries() const ; >- >- virtual ConstEntryPointer getEntry( const string &name, >- MatchPath matchpath = MATCH ) const ; >- >- virtual istream *getInputStream( const ConstEntryPointer &entry ) ; >- >- virtual istream *getInputStream( const string &entry_name, >- MatchPath matchpath = MATCH ) ; >- >- /** Returns the number in entries in all collections kept by >- the CollectionCollection object */ >- virtual int size() const ; >- >- virtual FileCollection *clone() const ; >- >- virtual ~CollectionCollection() ; >- >-protected: >- /** A protected getEntry member function, that not only >- finds an entry that match the name, if such an entry exists >- in the collection, it also returns, which collection it was found >- in. >- */ >- void getEntry( const string &name, >- ConstEntryPointer &cep, >- std::vector< FileCollection * >::const_iterator &it, >- MatchPath matchpath = MATCH ) const ; >- >- vector< FileCollection * > _collections ; >-private: >- static CollectionCollection *_inst ; >-}; >- >- >-/** Shortcut name for a CollectionCollection. If the static method >-inst is used, it is often used a lot, so it's handy with a short name for >-CollectionCollection */ >-typedef CollectionCollection CColl ; >- >- >-// >-// Inline (member) functions >-// >- >-CollectionCollection &CollectionCollection::inst() { >- if( _inst != 0 ) >- return *_inst ; >- else >- return *( _inst = new CollectionCollection ) ; >-} >- >-CollectionCollection::CollectionCollection( const CollectionCollection &src ) >- : FileCollection( src ) >-{ >- _collections.reserve( src._collections.size() ) ; >- std::vector< FileCollection * >::const_iterator it ; >- for ( it = src._collections.begin() ; it != src._collections.end() ; ++it ) >- _collections.push_back( (*it)->clone() ) ; >-} >- >- >-const CollectionCollection & >-CollectionCollection::operator= ( const CollectionCollection &src ) { >- this->FileCollection::operator=( src ) ; >-// FileCollection::=( static_cast< FileCollection >( src ) ) ; >- >- if ( this != &src ) { >- // Destroy current contents. >- std::vector< FileCollection * >::const_iterator it ; >- for ( it = _collections.begin() ; it != _collections.end() ; ++it ) >- delete *it ; >- // Then copy src's content. >- _collections.clear() ; >- _collections.reserve( src._collections.size() ) ; >- for ( it = src._collections.begin() ; it != src._collections.end() ; ++it ) >- _collections.push_back( (*it)->clone() ) ; >- } >- return *this ; >-} >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines CollectionCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/deflateoutputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/deflateoutputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/deflateoutputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/deflateoutputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,109 +0,0 @@ >-#ifndef DEFLATEOUTPUTSTREAMBUF_H >-#define DEFLATEOUTPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <vector> >- >-#include <zlib.h> >- >-#include "zipios++/filteroutputstreambuf.h" >-#include "zipios++/ziphead.h" >-#include "zipios++/zipios_defs.h" >- >-namespace zipios { >- >-using std::vector ; >- >-/** DeflateOutputStreambuf is an output stream filter, that deflates >- the data that is written to it before it passes it on to the >- output stream it is attached to. Deflation/Inflation is a >- compression/decompression method used in gzip and zip. The zlib >- library is used to perform the actual deflation, this class only >- wraps the functionality in an output stream filter. */ >-class DeflateOutputStreambuf : public FilterOutputStreambuf { >-public: >- >- /** DeflateOutputStreambuf constructor. >- @param outbuf the streambuf to use for output. >- @param user_init If false user must invoke init() before writing any data. >- (ZipOutputStreambuf needs to do this) >- @param del_outbuf if true is specified outbuf will be deleted, when >- the DeflateOutputStreambuf is destructed. */ >- explicit DeflateOutputStreambuf( streambuf *outbuf, bool user_init = false, >- bool del_outbuf = false ) ; >- >- /** Destructor. */ >- virtual ~DeflateOutputStreambuf() ; >- >- bool init( int comp_level = 6 ) ; >- bool closeStream() ; >- >- /** Returns the CRC32 for the current stream. The returned value is >- the CRC for the data that has been compressed already (due to a >- call to overflow()). As DeflateOutputStreambuf may buffer an >- arbitrary amount of bytes until closeStream() has been invoked, >- the returned value is not very useful before closeStream() has >- been called. */ >- uint32 getCrc32() const { return _crc32 ; } >- >- /** Returns the number of bytes written to the streambuf, that has >- been processed from the input buffer by the compressor. After >- closeStream() has been called this number is the total number of >- bytes written to the stream. */ >- uint32 getCount() const { return _overflown_bytes ; } >- >-protected: >- virtual int overflow( int c = EOF ) ; >- virtual int sync() ; >- >- /** Flushes _outvec and updates _zs.next_out and _zs.avail_out. */ >- bool flushOutvec() ; >- >- /** Flushes the remaining data in the zlib buffers, after which the >- only possible operations are deflateEnd() or deflateReset(). */ >- void endDeflation() ; >- >-private: >- z_stream _zs ; >- bool _zs_initialized ; >-protected: // FIXME: reconsider design? >- const int _invecsize ; >- vector< char > _invec ; >- const int _outvecsize ; >- vector< char > _outvec ; >- >- uint32 _crc32 ; >- uint32 _overflown_bytes ; >-}; >- >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines DeflateOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/dircoll.h FlightCrew-0.7.2.dev/src/zipios/zipios++/dircoll.h >--- FlightCrew-0.7.2/src/zipios/zipios++/dircoll.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/dircoll.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,93 +0,0 @@ >-#ifndef DIRCOLL_H >-#define DIRCOLL_H >- >-#include "zipios++/zipios-config.h" >- >- >-#include "zipios++/fcoll.h" >-#include "zipios++/basicentry.h" >-#include "zipios++/filepath.h" >- >-namespace zipios { >- >-/** DirEntry is a BasicEntry. */ >-typedef BasicEntry DirEntry ; >- >-/** \anchor dircol_anchor >- DirectoryCollection is a FileCollection that obtains its entries >- from a directory. */ >-class DirectoryCollection : public FileCollection { >-public: >- >- /** Default Constructor. */ >- explicit DirectoryCollection() >- : _entries_loaded( false ), _recursive( true ) {} >- >- >- /** Constructor. >- @param path A directory path name. If the name is not a valid >- directory the created DirectoryCollection will be invalid. >- @param load_now Load directory into memory now. Otherwise it will >- be done when it is first needed. >- */ >- explicit DirectoryCollection( const string &path, >- bool recursive = true, >- bool load_now = false ) ; >- >- /* Default Copy constructor and copy assignment operator are sufficient. */ >- >- virtual void close() ; >- >- virtual ConstEntries entries() const ; >- >- virtual ConstEntryPointer getEntry( const string &name, >- MatchPath matchpath = MATCH ) const ; >- >- virtual istream *getInputStream( const ConstEntryPointer &entry ) ; >- >- virtual istream *getInputStream( const string &entry_name, >- MatchPath matchpath = MATCH ) ; >- >- virtual int size() const ; >- >- virtual FileCollection *clone() const ; >- >- /** Destructor. */ >- virtual ~DirectoryCollection() ; >- >-protected: >- mutable bool _entries_loaded ; >- bool _recursive ; // recurse into subdirs. >- FilePath _filepath ; >- >- void loadEntries() const ; >- void load( bool recursive, const FilePath &subdir = FilePath() ) ; >- >-}; >- >-} // namespace >- >-#endif >- >-/** \file >- Header file that defines DirectoryCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/fcollexceptions.h FlightCrew-0.7.2.dev/src/zipios/zipios++/fcollexceptions.h >--- FlightCrew-0.7.2/src/zipios/zipios++/fcollexceptions.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/fcollexceptions.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,100 +0,0 @@ >-#ifndef FCOLLEXCEPTIONS_H >-#define FCOLLEXCEPTIONS_H >- >-#include "zipios++/zipios-config.h" >- >-#include <stdexcept> >-#include <string> >- >-namespace zipios { >- >-using std::string ; >-using std::exception ; >- >-/** An IOException is used to signal an I/O error. >- */ >-class IOException : public exception { >-public: >- IOException() throw () ; >- explicit IOException( const string &msg ) throw () ; >- IOException( const IOException &src ) throw () ; >- IOException &operator= ( const IOException &src ) throw () ; >- >- virtual const char *what() const throw () ; >- virtual ~IOException() throw () ; >-private: >- string _what ; >-}; >- >-/** An FCollException is used to signal a problem with a >- FileCollection. */ >-class FCollException : public exception { >-public: >- FCollException() throw () ; >- explicit FCollException( const string &msg ) throw () ; >- FCollException( const FCollException &src ) throw () ; >- FCollException &operator= ( const FCollException &src ) throw () ; >- >- virtual const char *what() const throw () ; >- virtual ~FCollException() throw () ; >-private: >- string _what ; >-}; >- >-/** An object member function may throw this exception, if the >- operation it normally performs is inappropriate or impossible to >- perform because of the current state of the object. */ >-class InvalidStateException : public exception { >-public: >- InvalidStateException() throw () ; >- explicit InvalidStateException( const string &msg ) throw () ; >- InvalidStateException( const InvalidStateException &src ) throw () ; >- InvalidStateException &operator= ( const InvalidStateException &src ) throw () ; >- >- virtual const char *what() const throw () ; >- virtual ~InvalidStateException() throw () ; >-private: >- string _what ; >-}; >- >-/** Basic exception */ >-class Exception : public exception { >-public: >- Exception() throw () ; >- explicit Exception( const string &msg ) throw () ; >- Exception( const Exception &src ) throw () ; >- Exception &operator= ( const Exception &src ) throw () ; >- >- virtual const char *what() const throw () ; >- virtual ~Exception() throw () ; >-private: >- string _what ; >-}; >- >- >-} // namespace >-#endif >- >-/** \file >- Header file that defines a number of exceptions used by FileCollection and >- its subclasses. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/fcoll.h FlightCrew-0.7.2.dev/src/zipios/zipios++/fcoll.h >--- FlightCrew-0.7.2/src/zipios/zipios++/fcoll.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/fcoll.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,309 +0,0 @@ >-#ifndef fcoll_H >-#define fcoll_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >-#include <string> >- >-#include "zipios++/fcollexceptions.h" >-#include "zipios++/fileentry.h" >- >-namespace zipios { >- >-using std::vector; >- >-/** \anchor fcoll_anchor >- FileCollection is an abstract baseclass that represents a >- collection of files. The specializations of FileCollection >- represents different origins of file collections, such as >- directories, simple filename lists and compressed archives. */ >-class FileCollection { >-public: >- /** FileCollection constructor. */ >- explicit FileCollection() >- : _filename( "-" ), >- _entries ( 0 ), >- _valid ( false ) {} >- >- /** Copy constructor. */ >- inline FileCollection( const FileCollection &src ) ; >- >- /** Copy assignment operator. */ >- inline const FileCollection &operator= ( const FileCollection &src ) ; >- >- /** Closes the FileCollection. */ >- virtual void close() = 0 ; >- >- /** \anchor fcoll_entries_anchor >- Returns a vector of const pointers to the entries in the >- FileCollection. >- @return a ConstEntries >- containing the entries of the FileCollection. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual ConstEntries entries() const ; >- >- enum MatchPath { IGNORE, MATCH } ; >- >- /** \anchor fcoll_getentry_anchor >- Returns a ConstEntryPointer to a FileEntry object for the entry >- with the specified name. To ignore the path part of the filename in search of a >- match, specify FileCollection::IGNORE as the second argument. >- @param name A string containing the name of the entry to get. >- @param matchpath Speficy MATCH, if the path should match as well, >- specify IGNORE, if the path should be ignored. >- @return A ConstEntryPointer to the found entry. The returned pointer >- equals zero if no entry is found. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual ConstEntryPointer getEntry( const string &name, >- MatchPath matchpath = MATCH ) const ; >- /** \anchor fcoll_getinputstream >- Returns a pointer to an opened istream for the specified >- FileEntry. It is the callers responsibility to delete the stream >- when he is done with it. Returns 0, if there is no such >- FileEntry in the FileCollection. >- @param entry A ConstEntryPointer to the FileEntry to get an istream to. >- @return an open istream for the specified entry. The istream is allocated on >- heap and it is the users responsibility to delete it when he is done with it. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual istream *getInputStream( const ConstEntryPointer &entry ) = 0 ; >- /** Returns a pointer to an opened istream for the specified >- entry name. It is the callers responsibility to delete the stream >- when he is done with it. Returns 0, if there is no entry with the specified >- name in the FileCollection. >- @param matchpath Speficy MATCH, if the path should match as well, >- specify IGNORE, if the path should be ignored. >- @return an open istream for the specified entry. The istream is allocated on >- heap and it is the users responsibility to delete it when he is done with it. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual istream *getInputStream( const string &entry_name, >- MatchPath matchpath = MATCH ) = 0 ; >- /** Returns the name of the FileCollection. >- @return the name of the FileCollection. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual string getName() const ; >- /** Returns the number of entries in the FileCollection. >- @return the number of entries in the FileCollection. >- @throw InvalidStateException Thrown if the collection is invalid. */ >- virtual int size() const ; >- >- /** The member function returns true if the collection is valid. >- @return true if the collection is valid. >- */ >- bool isValid() const { return _valid ; } >- >- /** Create a heap allocated clone of the object this method is called for. The >- caller is responsible for deallocating the clone when he is done with it. >- @return A heap allocated copy of the object this method is called for. >- */ >- virtual FileCollection *clone() const = 0 ; >- >- >- /** FileCollection destructor. */ >- virtual ~FileCollection () ; >-protected: >- string _filename ; >- Entries _entries ; >- bool _valid ; >-}; >- >- >-// >-// Inline methods >-// >- >-FileCollection::FileCollection( const FileCollection &src ) >- : _filename( src._filename ), >- _valid ( src._valid ) >-{ >- _entries.reserve( src._entries.size() ) ; >- Entries::const_iterator it ; >- for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) >- _entries.push_back( (*it)->clone() ) ; >-} >- >-const FileCollection &FileCollection::operator= ( const FileCollection &src ) { >- if ( this != &src ) { >- _filename = src._filename ; >- _valid = src._valid ; >- _entries.clear() ; >- _entries.reserve( src._entries.size() ) ; >- >- Entries::const_iterator it ; >- for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) >- _entries.push_back( (*it)->clone() ) ; >- } >- return *this ; >-} >- >-inline ostream & operator<< (ostream &os, const FileCollection& collection) { >- os << "collection '" << collection.getName() << "' {" ; >- ConstEntries entries = collection.entries(); >- ConstEntries::const_iterator it; >- bool isFirst=true; >- for (it=entries.begin(); it != entries.end(); ++it) { >- if(! isFirst) >- os << ", "; >- isFirst = false; >- os << (*it)->getName(); >- } >- os << "}"; >- return os; >-} >- >- >-} // namespace >- >-#endif >- >- >-/** >- \mainpage Zipios++ >- >- \image html zipios++.jpg >- \image latex zipios++.eps width=10cm >- >- \section intro Introduction >- >- Zipios++ is a java.util.zip-like C++ library for reading and >- writing Zip files. Access to individual entries is provided through >- standard C++ iostreams. A simple read-only virtual file system that >- mounts regular directories and zip files is also provided. >- >- The source code is released under the <A >- HREF="http://www.gnu.org/copyleft/lesser.html">GNU Lesser General Public >- License</A>. >- >- \section status Status >- >- Spanned archives are not supported, and support is not planned. >- >- >- The library has been tested and appears to be working with >- <UL> >- <LI><A HREF="http://www.freebsd.org/ports/archivers.html#zipios++-0.1.5">FreeBSD stable and current / gcc 2.95.3</A></LI> >- <LI>Red Hat Linux release 7.0 / gcc 2.96</LI> >- <LI>Red Hat Linux release 6.2 (Zoot) / egcs-2.91.66</LI> >- <LI>Linux Mandrake release 7.0 (Air) / gcc 2.95.2</LI> >- <LI>SGI IRIX64 6.5 / gcc 2.95.2</LI> >- <LI>SGI IRIX64 6.5 / MIPSpro Compilers: Version 7.30</LI> >- </UL> >- >- If you are aware of any other platforms that Zipios++ works on, >- please let me know (thomass@deltadata.dk). >- >- \section documentation Documentation >- This web page is the front page to the library documentation which >- is generated from the source files using <A >- HREF="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</A>. Use >- the links at the top of the page to browse the API >- documentation. The documentation is also available in >- a printer-friendly format <A HREF="refman.pdf">[pdf]</A>. >- >- \subsection zipfiles Zip file access >- The two most important classes are \ref zipfile_anchor "ZipFile" and >- \ref ZipInputStream_anchor "ZipInputStream". ZipInputStream is an istream >- for reading zipfiles. It can be instantiated directly, without the >- use of ZipFile. \ref ZipInputStream_getnextentry_anchor >- "ZipInputStream::getNextEntry()" positions the new ZipInputStream at the >- first entry. The following entry can be accessed by calling >- \ref ZipInputStream_getnextentry_anchor "ZipInputStream::getNextEntry()" >- again. >- >- ZipFile scans the central directory of a zipfile and provides an >- interface to access that directory. The user may search for entries >- with a particular filename using \ref fcoll_getentry_anchor "ZipFile::getEntry()", >- or simply get the complete list of entries >- with \ref fcoll_entries_anchor "ZipFile::entries()". To get an >- istream (ZipInputStream) to a particular entry simply use >- \ref fcoll_getinputstream "ZipFile::getInputStream()". >- >- \ref example_zip_anchor "example_zip.cpp" demonstrates the central >- elements of Zipios++. >- >- A Zip file appended to another file, e.g. a binary program, with the program >- \ref appendzip_anchor "appendzip", can be read with >- \ref zipfile_openembeddedzipfile "ZipFile::openEmbeddedZipFile()". >- >- \subsection filecollections FileCollections >- >- A ZipFile is actually just a special kind of >- \ref fcoll_anchor "FileCollection" that >- obtains its entries from a .zip Zip archive. Zipios++ also implements >- a \ref dircol_anchor "DirectoryCollection" that obtains its entries >- from a specified directory, and a \ref collcoll_anchor "CollectionCollection" >- that obtains its entries from >- other collections. Using a single CollectionCollection any number of >- other FileCollections can be placed under its control and accessed >- through the same single interface that is used to access a ZipFile or >- a DirectoryCollection. A singleton (a unique global instance) >- CollectionCollection can be obtained through >- >- \ref collcoll_inst_anchor "CollectionCollection::inst()" ; >- >- To save typing CollectionCollection has been typedef'ed to CColl. In >- the initialization part of an application FileCollections can be >- created, and placed under CColll::inst()'s control using >- >- \ref collcoll_addcoll_anchor "CColl::inst().addCollection()" >- >- and later an istream can be obtained using >- >- \ref fcoll_getinputstream "CColl::inst().getInputStream()". >- >- \section download Download >- Go to Zipios++ project page on SourceForge for tar balls and ChangeLog. >- <A HREF="http://sourceforge.net/project/?group_id=5418" > >- http://sourceforge.net/project/?group_id=5418</A> >- >- \section links Links >- <A HREF="ftp://ftp.freesoftware.com/pub/infozip/zlib/zlib.html">zlib</A>. >- The compression library that Zipios++ uses to perform the actual >- decompression. >- >- <A HREF="http://java.sun.com/products/jdk/1.3/docs/api/index.html"> >- Java 2 Platform, Standard Edition, v 1.3 API Specification >- </A>. Zipios++ is heavily inspired by the java.util.zip package. >- >- <A >- HREF="http://www.geocities.com/SiliconValley/Lakes/2160/fformats/files/zip.txt"> >- PKWARE zip format >- </A>. A description of the zip file format. >- >- \section bugs Bugs >- Submit bug reports and patches to thomass@deltadata.dk >- >- >- >- \htmlonly >- Project hosted by <A HREF="http://sourceforge.net"> >- <img src="http://sourceforge.net/sflogo.php?group_id=5418&type=1" > >- </A><p> >- Logo created with <A HREF="http://www.webgfx.ch/titlepic.htm"> >- <img src="webgfx.gif" > >- </A> >- \endhtmlonly */ >- >- >-/** \file >- Header file that defines FileCollection. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/fileentry.h FlightCrew-0.7.2.dev/src/zipios/zipios++/fileentry.h >--- FlightCrew-0.7.2/src/zipios/zipios++/fileentry.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/fileentry.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,240 +0,0 @@ >-#ifndef FILEENTRY_H >-#define FILEENTRY_H >- >-#include "zipios++/zipios-config.h" >- >-#include <string> >-#include <vector> >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/simplesmartptr.h" >-#include "zipios++/zipios_defs.h" >- >-namespace zipios { >- >-using std::vector ; >-using std::ostream ; >-using std::istream ; >-using std::string ; >- >-/** The types used with FileEntry::setMethod and >- FileEntry::getMethod. The current entries are the types supported >- by the zip format. The numbering also matches the numbering used >- in the zip file format, ie STORED is indicated by a 0 in the >- method field in a zip file and so on. */ >-enum StorageMethod { STORED = 0, SHRUNK, REDUCED1, REDUCED2, >- REDUCED3, REDUCED4, IMPLODED, RESERVED, >- DEFLATED } ; >- >-class FileEntry ; >- >-/** \typedef typedef SimpleSmartPointer< FileEntry > EntryPointer >- EntryPointer is a SimpleSmartPointer for FileEntry's. */ >-typedef SimpleSmartPointer< FileEntry > EntryPointer ; >- >- >-/** ConstEntryPointer is a SimpleSmartPointer for const FileEntry's. */ >-typedef SimpleSmartPointer< const FileEntry > ConstEntryPointer ; >- >-/** Entries is a vector of EntryPointer's */ >-typedef vector< EntryPointer > Entries ; >- >-/** ConstEntries is a vector of ConstEntryPointer's */ >-typedef vector< EntryPointer > ConstEntries ; >- >- >- >-/** A FileEntry represents an entry in a FileCollection. The interface >- is a copy of the ZipEntry interface from the java.util.zip >- package. The name has been changed to FileEntry, as FileCollection >- is a more general abstraction, that covers other types of file >- collections than just zip files. */ >-class FileEntry { >-public: >- >- /* Default construcotr, copy constructor and copy assignment >- operator are sufficient. */ >- >- /** Returns the comment of the entry, if it has one. Otherwise it >- returns an empty string. >- @return the comment associated with the entry, if there is one. >- */ >- virtual string getComment() const = 0 ; >- /** Returns the compressed size of the entry. If the entry is not >- stored in a compressed format, the uncompressed size is >- returned. >- @return the compressed size of the entry. If the entry is stored without >- compression the uncompressed size is returned. >- */ >- virtual uint32 getCompressedSize() const = 0 ; >- /** Returns the Crc for the entry, if it has one. FIXME: what is >- returned if it doesn't have one? >- @return the Crc for the entry, if it has one. >- */ >- virtual uint32 getCrc() const = 0 ; >- /** Returns a vector of bytes of extra data that may be stored with >- the entry. >- @return A vector< unsigned char > of extra bytes that may potentially >- be associated with an entry. >- */ >- virtual vector< unsigned char > getExtra() const = 0 ; >- /** Returns the method used to store the entry in the FileCollection. >- @return the storage method used to store the entry in the collection. >- @see StorageMethod. >- */ >- virtual StorageMethod getMethod() const = 0 ; >- /** Returns the full filename of the entry, including a path if the >- entry is stored in a subfolder. >- @return the filename of the entry, including path if the entry is stored >- in a sub-folder. >- */ >- virtual string getName() const = 0 ; >- /** Returns the filename of the entry. >- @return Returns the filename of the entry. >- */ >- virtual string getFileName() const = 0 ; >- /** Returns the (uncompressed) size of the entry data. >- @return Returns the (uncompressed) size of the entry. >- */ >- virtual uint32 getSize() const = 0 ; >- /** Returns the date and time of FIXME: what? >- @return the date and time of the entry. >- */ >- virtual int getTime() const = 0 ; >- /** Any method or operator that initializes a FileEntry may set a >- flag, that specifies whether the read entry is valid or not. If >- it isn't this method returns false. >- @return true if the FileEntry has been parsed succesfully. >- */ >- virtual bool isValid() const = 0 ; >- // virtual int hashCode() const = 0 ; >- /** Returns true if the entry is a directory. A directory entry is >- an entry which name ends with a separator ('/' for Unix systems, >- '\' for Windows and DOS systems. >- @return true if the entry is a directory. >- */ >- virtual bool isDirectory() const = 0 ; >- >- /** Sets the comment field for the FileEntry. >- @param comment string with the new comment. >- */ >- virtual void setComment( const string &comment ) = 0 ; >- /** Set the compressed size field of the entry. >- @param size value to set the compressed size field of the entry to. >- */ >- virtual void setCompressedSize( uint32 size ) = 0 ; >- /** Sets the crc field. >- @param crc value to set the crc field to. >- */ >- virtual void setCrc( uint32 crc ) = 0 ; >- /** Sets the extra field. >- @param extra the extra field is set to this value. >- */ >- virtual void setExtra( const vector< unsigned char > &extra ) = 0 ; >- /** Sets the storage method field for the entry. >- @param method the method field is set to the specified value. >- */ >- virtual void setMethod( StorageMethod method ) = 0 ; >- /** Sets the name field for the entry. >- @param name the name field is set to the specified value. >- */ >- virtual void setName( const string &name ) = 0 ; >- /** Sets the size field for the entry. >- @param size the size field is set to this value. >- */ >- virtual void setSize( uint32 size ) = 0 ; >- /** Sets the time field for the entry. >- @param time the time field is set to the specified value. >- */ >- virtual void setTime( int time ) = 0 ; >- >- /** Returns a human-readable string representation of the entry. >- @return a human-readable string representation of the entry. >- */ >- virtual string toString() const = 0 ; >- >- /** Create a heap allocated clone of the object this method is called for. The >- caller is responsible for deallocating the clone when he is done with it. >- @return A heap allocated copy of the object this method is called for. >- */ >- virtual FileEntry *clone() const = 0 ; >- >- /** FileEntry destructor. */ >- virtual ~FileEntry() {} >- >-// protected: >- class MatchName ; >- class MatchFileName ; >-protected: >- friend class SimpleSmartPointer< FileEntry > ; >- friend class SimpleSmartPointer< const FileEntry > ; >- void ref() const { _refcount.ref() ; } >- unsigned int unref() const { return _refcount.unref() ; } >- >- ReferenceCount< FileEntry > _refcount ; >-}; >- >-/** Function object to be used with the STL find_if algorithm to >- find a FileEntry in a container, which name (as obtained with >- FileEntry::getName()) is identical to the name specified in the >- MatchName constructor. */ >-class FileEntry::MatchName { >-public: >- explicit MatchName( const string &name ) : _name( name ) {} >- bool operator() ( const ConstEntryPointer &entry ) { >- return entry->getName() == _name ; >- } >-private: >- string _name ; >-}; >- >-/** Function object to be used with the STL find_if algorithm to >- find a FileEntry in a container, which name (as obtained with >- FileEntry::getFileName()) is identical to the name specified in the >- MatchName constructor. */ >-class FileEntry::MatchFileName { >-public: >- explicit MatchFileName( const string &name ) : _name( name ) {} >- bool operator() ( const ConstEntryPointer &entry ) { >- return entry->getFileName() == _name ; >- } >-private: >- string _name ; >-}; >- >-ostream &operator<< ( ostream &os, const FileEntry &entry ) ; >- >-inline ostream &operator<< ( ostream &os, const ConstEntryPointer &entry ) { >- os << *entry ; >- return os ; >-} >- >- >- >-} // namespace >- >-#endif >- >- >-/** \file >- Header file that defines FileEntry. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/filepath.h FlightCrew-0.7.2.dev/src/zipios/zipios++/filepath.h >--- FlightCrew-0.7.2/src/zipios/zipios++/filepath.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/filepath.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,208 +0,0 @@ >-#ifndef FILEPATH_H >-#define FILEPATH_H >- >-#include "zipios++/zipios-config.h" >- >-#include <stdexcept> >-#include <string> >- >-namespace zipios { >- >-using namespace std ; >- >-/** FilePath represents a path to a file or directory name. FilePath has >- member functions to check if the file path is a valid file system entity, >- and to check what kind of file system entity it is, e.g. is it a file, a >- directory, a pipe etc. >-*/ >-class FilePath { >-public: >- /** Constructor. >- @param path A string representation of the path. >- @param check_exists If true is specified the constructor will >- check the existence and type of the path immediately, instead of >- deferring that task until it is needed. */ >- FilePath( const string &path = "", bool check_exists = false ) ; >- >- inline FilePath &operator= ( const string &rhs ) ; >- >- inline operator string() const ; >- >- inline std::string asString() const ; >- >- /** Concatenates FilePath objects. A file separator is inserted >- if appropriate. */ >- inline FilePath operator+ ( const FilePath &name ) const ; >- >- /** Returns filename of the FilePath object by pruning the path >- off. */ >- inline FilePath filename() const ; >- >- >- /** @return true If the path is a valid file system entity. */ >- inline bool exists() const ; >- >- /** @return true if the path is a regular file. */ >- inline bool isRegular() const ; >- >- /** @return true if the path is a directory. */ >- inline bool isDirectory() const ; >- >- /** @return true if the path is character special (a character >- device file). */ >- inline bool isCharSpecial() const ; >- >- /** @return true if the path is block special (a block device >- file). */ >- inline bool isBlockSpecial() const ; >- >- /** @return true if the path is a socket. */ >- inline bool isSocket() const ; >- >- /** @return true if the path is a Fifo (a pipe). */ >- inline bool isFifo() const ; >- >-protected: >- >- /** Prunes the trailing separator of a specified path. */ >- inline void pruneTrailingSeparator() ; >- >- /** This function sets _checked to true, stats the path, to see if >- it exists and to determine what type of file it is. All the query >- functions check if _checked is true, and if it isn't they call >- check(). This means stat'ing is deferred until it becomes >- necessary. */ >- void check() const ; >- >- static const char _separator; >- >- // FIXME: Should be bitfield >- mutable bool _checked ; >- mutable bool _exists ; >- mutable bool _is_reg ; >- mutable bool _is_dir ; >- mutable bool _is_char ; >- mutable bool _is_block ; >- mutable bool _is_socket ; >- mutable bool _is_fifo ; >- string _path ; >-}; >- >- >-// >-// Inline member functions >-// >- >-FilePath &FilePath::operator= ( const string &rhs ) { >- _path = rhs ; >- pruneTrailingSeparator() ; >- return *this ; >-} >- >-void FilePath::pruneTrailingSeparator() { >- if ( _path.size() > 0 ) >- if ( _path[ _path.size() -1 ] == _separator ) >- _path.erase( _path.size() - 1 ) ; >-} >- >-FilePath::operator string() const { >- return _path ; >-} >- >-std::string FilePath::asString() const { >- return _path ; >-} >- >- >-FilePath FilePath::operator+ ( const FilePath &name ) const { >- if ( _path.size() > 0 ) >- return _path + _separator + name._path ; >- else >- return name._path ; >-} >- >- >-FilePath FilePath::filename() const { >- string::size_type pos ; >- pos = _path.find_last_of( _separator ) ; >- if ( pos != string::npos ) >- return _path.substr( pos + 1); >- else >- return _path ; >-} >- >- >-bool FilePath::exists() const { >- if ( ! _checked ) >- check() ; >- return _exists ; >-} >- >- >-bool FilePath::isRegular() const { >- if ( ! _checked ) >- check() ; >- return _is_reg ; >-} >- >- >-bool FilePath::isDirectory() const { >- if ( ! _checked ) >- check() ; >- return _is_dir ; >-} >- >- >-bool FilePath::isCharSpecial() const { >- if ( ! _checked ) >- check() ; >- return _is_char ; >-} >- >- >-bool FilePath::isBlockSpecial() const { >- if ( ! _checked ) >- check() ; >- return _is_block ; >-} >- >- >-bool FilePath::isSocket() const { >- if ( ! _checked ) >- check() ; >- return _is_socket ; >-} >- >- >-bool FilePath::isFifo() const { >- if ( ! _checked ) >- check() ; >- return _is_fifo ; >-} >- >- >-} // namespace >-#endif >- >-/** \file >- Header file that defines FilePath. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/filterinputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/filterinputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/filterinputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/filterinputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,66 +0,0 @@ >-#ifndef FILTERINPUTSTREAMBUF_H >-#define FILTERINPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-namespace zipios { >- >-using std::streambuf ; >- >-/** An input streambuf filter is a streambuf that filters the input it >- gets from the streambuf it is attached to. FilterInputStreambuf is a base class to >- derive input streambuf filters from. */ >-class FilterInputStreambuf : public streambuf { >-public: >- /** Constructor. >- @param inbuf the streambuf to use for input. >- @param del_inbuf if true is specified inbuf will be deleted, when >- the FilterInputStreambuf is destructed. >- */ >- explicit FilterInputStreambuf( streambuf *inbuf, bool del_inbuf = false ) ; >- /** Destructor. */ >- virtual ~FilterInputStreambuf() ; >- >-protected: >- int _s_pos ; // Position in this streambuf - FIXME: is this used? >- streambuf *_inbuf ; >- bool _del_inbuf ; >-private: >- >- /** Copy-constructor is private to prevent copying. */ >- FilterInputStreambuf( const FilterInputStreambuf &src ) ; >- >- /** Copy-assignment operator is private to prevent copying. */ >- const FilterInputStreambuf &operator= ( const FilterInputStreambuf &src ) ; >-}; >- >- >-} // namespace >- >- >-#endif >- >-/** \file >- Header file that defines FilterInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/filteroutputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/filteroutputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/filteroutputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/filteroutputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,58 +0,0 @@ >-#ifndef FILTEROUTPUTSTREAMBUF_H >-#define FILTEROUTPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-namespace zipios { >- >-using std::streambuf ; >- >-/** A FilterOutputStreambuf is a streambuf that filters the data that is written >- to it before it passes it on to the output streambuf it is connected to. */ >-class FilterOutputStreambuf : public streambuf { >-public: >- >- /** Constructor. >- @param outbuf the streambuf to pass the filtered data on to. >- @param del_outbuf if true is specified outbuf will be deleted, when >- the FilterOutputStreambuf is destructed. */ >- explicit FilterOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; >- >- /** Destructor. */ >- virtual ~FilterOutputStreambuf() ; >- >-protected: >- streambuf *_outbuf ; >- bool _del_outbuf ; >-}; >- >- >-} // namespace >- >- >-#endif >- >-/** \file >- Header file that defines FilterOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/gzipoutputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/gzipoutputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/gzipoutputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/gzipoutputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,79 +0,0 @@ >-#ifndef GZIPOUTPUTSTREAMBUF_H >-#define GZIPOUTPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >- >-#include <zlib.h> >- >-#include "zipios++/deflateoutputstreambuf.h" >- >-namespace zipios { >- >-/** GZIPOutputStreambuf is a zip output streambuf filter. */ >-class GZIPOutputStreambuf : public DeflateOutputStreambuf { >-public: >- >- /** GZIPOutputStreambuf constructor. A newly constructed GZIPOutputStreambuf >- is ready to accept data. >- @param outbuf the streambuf to use for output. >- @param del_outbuf if true is specified outbuf will be deleted, when >- the GZIPOutputStreambuf is destructed. */ >- explicit GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; >- >- void setFilename( const string &filename ); >- void setComment( const string &comment ); >- >- /** Calls finish. */ >- void close() ; >- >- /** Finishes the compression. */ >- void finish() ; >- >- /** Destructor. */ >- virtual ~GZIPOutputStreambuf() ; >- >-protected: >- virtual int overflow( int c = EOF ) ; >- virtual int sync() ; >- >-private: >- void writeHeader(); >- void writeTrailer(); >- void writeInt(uint32 i); >- >- std::string _filename; >- std::string _comment; >- bool _open ; >-}; >- >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines ZipOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/gzipoutputstream.h FlightCrew-0.7.2.dev/src/zipios/zipios++/gzipoutputstream.h >--- FlightCrew-0.7.2/src/zipios/zipios++/gzipoutputstream.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/gzipoutputstream.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,71 +0,0 @@ >-#ifndef GZIPOUTPUTSTREAM_H >-#define GZIPOUTPUTSTREAM_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include <string> >- >-#include "zipios++/gzipoutputstreambuf.h" >- >-namespace zipios { >- >-/** \anchor GZIPOutputStream_anchor >- GZIPOutputStream is an ostream that writes the output to a gz file. The >- interface approximates the interface of the Java GZIPOutputStream. */ >-class GZIPOutputStream : public std::ostream { >-public: >- >- /** GZIPOutputStream constructor. >- @param os ostream to which the compressed zip archive is written. >- */ >- explicit GZIPOutputStream( std::ostream &os ) ; >- >- /** GZIPOutputStream constructor. >- @filename filename to write the gzip archive to. */ >- explicit GZIPOutputStream( const std::string &filename ) ; >- >- void setFilename( const string &filename ); >- void setComment( const string &comment ); >- >- /** Calls finish and closes the stream. */ >- void close() ; >- >- /** Finishes the stream. */ >- void finish() ; >- >- /** Destructor. */ >- virtual ~GZIPOutputStream() ; >- >-private: >- std::ofstream *ofs ; >- GZIPOutputStreambuf *ozf ; >-}; >- >-} // namespace. >- >-#endif >- >-/** \file >- Header file that defines GZIPOutputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/inflateinputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/inflateinputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/inflateinputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/inflateinputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,89 +0,0 @@ >-#ifndef INFLATEINPUTSTREAMBUF_H >-#define INFLATEINPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <vector> >- >-#include <zlib.h> >- >-#include "zipios++/filterinputstreambuf.h" >- >-namespace zipios { >- >-using std::vector ; >- >-/** InflateInputStreambuf is an input stream filter, that inflates the input >- from the attached input stream. Deflation/Inflation is a >- compression/decompression method used in gzip and zip. The zlib >- library is used to perform the actual inflation, this class only >- wraps the functionality in an input stream filter. */ >-class InflateInputStreambuf : public FilterInputStreambuf { >-public: >- /** InflateInputStreambuf constructor. >- @param inbuf the streambuf to use for input. >- @param s_pos a position to reset the inbuf to before reading. Specify >- -1 to read from the current position. >- @param del_inbuf if true is specified inbuf will be deleted, when >- the InflateInputStreambuf is destructed. >- */ >- explicit InflateInputStreambuf( streambuf *inbuf, int s_pos = -1, bool del_inbuf = false ) ; >- virtual ~InflateInputStreambuf() ; >- >- /** Resets the zlib stream and purges input and output buffers. >- repositions the input streambuf at stream_position. >- @param stream_position a position to reset the inbuf to before reading. Specify >- -1 to read from the current position. >- */ >- bool reset( int stream_position = -1 ) ; >-protected: >- virtual int underflow() ; >-private: >- z_stream _zs ; >- bool _zs_initialized ; >- const int _invecsize ; >- vector< char > _invec ; >-protected: // FIXME: reconsider design? >- const int _outvecsize ; >- vector< char > _outvec ; >- >-private: >- >- /** Copy-constructor is private to prevent copying. */ >- InflateInputStreambuf( const InflateInputStreambuf &src ) ; >- >- /** Copy-assignment operator is private to prevent copying. */ >- const InflateInputStreambuf &operator= ( const InflateInputStreambuf &src ) ; >- >-}; >- >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines InflateInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/meta-iostreams.h FlightCrew-0.7.2.dev/src/zipios/zipios++/meta-iostreams.h >--- FlightCrew-0.7.2/src/zipios/zipios++/meta-iostreams.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/meta-iostreams.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,17 +0,0 @@ >-#ifndef META_IOSTREAMS_H >-#define META_IOSTREAMS_H >- >-// Includes the different iostream libraries >- >-#include "zipios++/zipios-config.h" >- >-#include <iostream> >-#include <fstream> >- >-#if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) >-#include <sstream> >-#else >-#include <strstream> >-#endif >- >-#endif >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/simplesmartptr.h FlightCrew-0.7.2.dev/src/zipios/zipios++/simplesmartptr.h >--- FlightCrew-0.7.2/src/zipios/zipios++/simplesmartptr.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/simplesmartptr.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,173 +0,0 @@ >-#ifndef SIMPLESMARTPTR_H >-#define SIMPLESMARTPTR_H >- >-#include "zipios++/zipios-config.h" >- >-namespace zipios { >- >-/** SimpleSmartPointer is a simple reference counting smart pointer >- template. The type pointed to must keep a reference count that is >- accessible through the two methods void ref() const and unsigned >- int unref() const. The type must also handle the reference count >- properly. The easiest way to do that is to use the ReferenceCount >- template class. */ >-template< class Type > >-class SimpleSmartPointer { >-public: >- Type *operator-> () const { return _p ; } >- >- Type &operator* () const { return *_p ; } >- >- SimpleSmartPointer( Type *p = 0 ) : _p( p ) { ref() ; } >- >- template< class T2 > SimpleSmartPointer( const SimpleSmartPointer< T2 > &src ) >- : _p( src.get() ) { ref() ; } >- >- SimpleSmartPointer( const SimpleSmartPointer &src ) : _p( src.get() ) { >- ref() ; >- } >- >- ~SimpleSmartPointer () { if ( unref() == 0 ) deleteIt() ; } >- >- template< class T2 > >- SimpleSmartPointer &operator= ( const SimpleSmartPointer< T2 > &src ) { >- ref( src.get() ) ; >- if ( unref() == 0 ) >- deleteIt() ; >- _p = src.get() ; >- return *this ; >- } >- >- SimpleSmartPointer &operator= ( const SimpleSmartPointer &src ) { >- ref( src.get() ) ; >- if ( unref() == 0 ) >- deleteIt() ; >- _p = src.get() ; >- return *this ; >- } >- >- SimpleSmartPointer &operator=( Type *src ) { >- _p = src ; >- ref() ; >- return *this ; >- } >- >- bool operator== ( const Type *p ) const { return _p == p ; } >- bool operator!= ( const Type *p ) const { return _p != p ; } >- bool operator== ( const SimpleSmartPointer &sp ) const { return _p == sp.get() ; } >- bool operator!= ( const SimpleSmartPointer &sp ) const { return _p != sp.get() ; } >- bool operator! () const { return ! _p ; } >- // This next method is inspired by iostream, and is for use with >- // if ( some_smart_pointer ). >- operator void*() const { return _p ? (void *)(-1) : (void *)(0) ; } >- >- Type *get() const { return _p ; } >- >- /** Returns the reference count - For debugging purposes. */ >- unsigned int getReferenceCount() const { return _p->getReferenceCount(); } >- >- >-private: >- template< class T2 > >- void ref( const T2 *ptr ) { if ( ptr ) ptr->ref() ; } >- >- void ref() const { if ( _p ) _p->ref() ; } >- unsigned int unref() const { >- if ( _p ) >- return _p->unref(); >- else >- return 0 ; >- } >- void deleteIt() { >-// if( _p ) >-// cerr << "SimpleSmartPointer: Deleting object!" << endl ; >- delete _p ; >- } >- Type *_p ; >-}; >- >- >-/** ReferenceCount is useful to ensure proper handling of the >- reference count for (objects of) classes handled through a >- SimpleSmartPointer. Subclassing ReferenceCount is all a class >- needs to become ready for being handled by >- SimpleSmartPointer. Another way is to add a ReferenceCount member >- variable to a class and write two methods 'void ref() const' and >- 'unsigned int unref() const' that invoke the same methods in the >- ReferenceCount variable. */ >-template< class Type > >-class ReferenceCount { >- /** SimpleSmartPointer needs to be a friend to invoke the private >- ref() and unref() methods. */ >- friend class SimpleSmartPointer< Type > ; >- friend class SimpleSmartPointer< const Type > ; >- /** Type also needs to be a friend to invoke the private ref() and >- unref() methods, in case Type doesn't want to inherit >- ReferenceCount and thus needs to invoke ref() and unref() >- through forwarding member functions. */ >- // >- // Originally the following template parameter was made a friend. >- // This is not allowed by the standard so comment it out: >- // >- // friend Type ; >- // >- // Initially hack things by making the necessary classes friends >- // even though we don't know really which they are. This is an >- // Hideous Hack. >- friend class FileEntry ; >- friend class Bogus ; >- >-public: >- /** Constructor intializes count to zero. */ >- ReferenceCount() : _ref_count( 0 ) {} >- >- /** Copy-constructor intializes count to zero. It doesn't copy it >- from src. */ >- ReferenceCount( const ReferenceCount &src ) : _ref_count( 0 ) {} >- >- /** The assignment operator doesn't copy the reference count, it >- leaves it unchanged. */ >- const ReferenceCount &operator= ( const ReferenceCount &src ) { return *this; } >-private: >- >- /** Increases the reference count. */ >- void ref() const { ++_ref_count ; } >- >- /** Decreases the reference count. */ >- unsigned int unref() const { return --_ref_count ; } >- >- /** Returns the reference count - For debugging purposes. */ >- unsigned int getReferenceCount() const { return _ref_count; } >- >- /** Holds the actual reference count */ >- mutable unsigned short _ref_count ; >-}; >- >- >- >-} // namespace >- >-#endif >- >-/** \file >- Header file that defines SimpleSmartPointer and ReferenceCount. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/virtualseeker.h FlightCrew-0.7.2.dev/src/zipios/zipios++/virtualseeker.h >--- FlightCrew-0.7.2/src/zipios/zipios++/virtualseeker.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/virtualseeker.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,105 +0,0 @@ >-#ifndef VIRTUALSEEKER_H >-#define VIRTUALSEEKER_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >- >-namespace zipios { >- >-using std::ios ; >-using std::cerr ; >-using std::endl ; >- >-/** VirtualSeeker is a simple class that keeps track of a set of >- specified 'virtual' file endings that mark a subset of a real >- file. An example of its use (and its reason for existence) is to >- keep track of the file endings of a Zip file embedded in another >- file. */ >-class VirtualSeeker { >-public: >- inline VirtualSeeker( int start_offset = 0, int end_offset = 0) ; >- inline void setOffsets( int start_offset, int end_offset ) ; >- inline void getOffsets( int &start_offset, int &end_offset ) const ; >- inline int startOffset() const ; >- inline int endOffset() const ; >- inline void vseekg( istream &is, int offset, ios::seekdir sd ) const ; >- inline int vtellg( istream &is ) const ; >-private: >- // start and end offsets >- int _s_off, _e_off ; >-}; >- >- >- >-VirtualSeeker::VirtualSeeker( int start_offset, int end_offset ) >- : _s_off( start_offset ), >- _e_off( end_offset ) >-{} >- >- >-void VirtualSeeker::setOffsets( int start_offset, int end_offset ) { >- _s_off = start_offset ; >- _e_off = end_offset ; >-} >- >- >-void VirtualSeeker::getOffsets( int &start_offset, int &end_offset ) const { >- start_offset = _s_off ; >- end_offset = _e_off ; >-} >- >- >-int VirtualSeeker::startOffset() const { >- return _s_off ; >-} >- >- >-int VirtualSeeker::endOffset() const { >- return _e_off ; >-} >- >-void VirtualSeeker::vseekg( istream &is, int offset, ios::seekdir sd ) const { >- if ( sd == ios::cur ) >- is.seekg( offset, sd ) ; >- else if ( sd == ios::beg ) >- is.seekg( offset + _s_off, sd ) ; >- else if ( sd == ios::end ) >- is.seekg( offset - _e_off, sd ) ; >- else >- cerr << "VirtualSeekManager::seekg: error - not supposed to happen!" << endl ; >-} >- >- >-int VirtualSeeker::vtellg( istream &is ) const { >- return static_cast< int >( is.tellg() ) - _s_off ; >-} >- >- >-} // namespace >- >-#endif >- >-/** \file >- Header file that defines VirtualSeeker. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipfile.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipfile.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipfile.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipfile.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,109 +0,0 @@ >-#ifndef ZIPFILE_H >-#define ZIPFILE_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >-#include "zipios++/meta-iostreams.h" >- >-#include "zipios++/fcoll.h" >-#include "zipios++/ziphead.h" >-#include "zipios++/virtualseeker.h" >-#include "../../FlightCrew/Misc/BoostFilesystemUse.h" >- >-namespace zipios { >- >-using std::ifstream ; >- >-/** \anchor zipfile_anchor >- ZipFile is a FileCollection, where the files are stored >- in a .zip file. */ >-class ZipFile : public FileCollection { >-public: >- /** \anchor zipfile_openembeddedzipfile >- Opens a Zip archive embedded in another file, by writing the zip >- archive to the end of the file followed by the start offset of >- the zip file. The offset must be written in zip-file byte-order >- (little endian). The program appendzip, which is part of the >- Zipios++ distribution can be used to append a Zip archive to a >- file, e.g. a binary program. >- @throw FColException Thrown if the specified file name is not a valid zip >- archive. >- @throw IOException Thrown if an I/O problem is encountered, while the directory >- of the specified zip archive is being read. */ >- static ZipFile openEmbeddedZipFile( const string &name ) ; >- >- /** Default constructor. >- */ >- ZipFile() {} >- >- /* Default Copy constructor and copy assignment operator are sufficient. */ >- >- /** Constructor. Opens the zip file name. If the zip "file" is >- embedded in a file that contains other data, e.g. a binary >- program, the offset of the zip file start and end must be >- specified. >- @param name The filename of the zip file to open. >- @param s_off Offset relative to the start of the file, that >- indicates the beginning of the zip file. >- @param e_off Offset relative to the end of the file, that >- indicates the end of the zip file. The offset is a positive number, >- even though the offset is towards the beginning of the file. >- @throw FColException Thrown if the specified file name is not a valid zip >- archive. >- @throw IOException Thrown if an I/O problem is encountered, while the directory >- of the specified zip archive is being read. */ >- explicit ZipFile( const string &name, int s_off = 0, int e_off = 0 >- /* , ios::open_mode mode = ios::in | ios::binary */ ) ; >- >- explicit ZipFile( const fs::path &name, int s_off = 0, int e_off = 0 >- /* , ios::open_mode mode = ios::in | ios::binary */ ) ; >- >- virtual FileCollection *clone() const ; >- >- /** Destructor. */ >- virtual ~ZipFile() ; >- >- virtual void close() ; >- >- virtual istream *getInputStream( const ConstEntryPointer &entry ) ; >- virtual istream *getInputStream( const string &entry_name, >- MatchPath matchpath = MATCH ) ; >-private: >- VirtualSeeker _vs ; >- EndOfCentralDirectory _eocd ; >- >- bool init( istream &_zipfile ) ; >- bool readCentralDirectory( istream &_zipfile ) ; >- bool readEndOfCentralDirectory( istream &_zipfile ) ; >- bool confirmLocalHeaders( istream &_zipfile ) ; >- void setError( string error_str ) ; >-}; >- >- >-} >- >-#endif >- >-/** \file >- Header file that defines ZipFile. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/ziphead.h FlightCrew-0.7.2.dev/src/zipios/zipios++/ziphead.h >--- FlightCrew-0.7.2/src/zipios/zipios++/ziphead.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/ziphead.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,271 +0,0 @@ >-#ifndef ZIPHEAD_H >-#define ZIPHEAD_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >-#include <vector> >- >-#include "zipios++/fileentry.h" >-#include "zipios++/zipios_defs.h" >- >-namespace zipios { >- >-using std::streampos ; >- >-class ZipCDirEntry ; >- >-/** A concrete implementation of the abstract FileEntry base class for >- ZipFile entries, specifically for representing the information >- present in the local headers of file entries in a zip file. */ >-class ZipLocalEntry : public FileEntry { >- friend istream &operator>> ( istream &is, ZipLocalEntry &zcdh ) ; >- friend ostream &operator<< ( ostream &os, const ZipLocalEntry &zlh ) ; >- friend bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; >-public: >- inline ZipLocalEntry( const string &_filename = "", >- const vector< unsigned char > &_extra_field = >- vector< unsigned char >() ) >- : gp_bitfield( 0 ), >- _valid( false ) { >- setDefaultExtract() ; >- setName( _filename ) ; >- setExtra( _extra_field ) ; >- } >- >- void setDefaultExtract() ; >- inline ZipLocalEntry &operator=( const class ZipLocalEntry &src ) ; >- virtual string getComment() const ; >- virtual uint32 getCompressedSize() const ; >- virtual uint32 getCrc() const ; >- virtual vector< unsigned char > getExtra() const ; >- virtual StorageMethod getMethod() const ; >- virtual string getName() const ; >- virtual string getFileName() const ; >- virtual uint32 getSize() const ; >- virtual int getTime() const ; >- virtual bool isValid() const ; >- >- virtual bool isDirectory() const ; >- >- virtual void setComment( const string &comment ) ; >- virtual void setCompressedSize( uint32 size ) ; >- virtual void setCrc( uint32 crc ) ; >- virtual void setExtra( const vector< unsigned char > &extra ) ; >- virtual void setMethod( StorageMethod method ) ; >- virtual void setName( const string &name ) ; >- virtual void setSize( uint32 size ) ; >- virtual void setTime( int time ) ; >- >- virtual string toString() const ; >- >- int getLocalHeaderSize() const ; >- >- bool trailingDataDescriptor() const ; >- >- virtual FileEntry *clone() const ; >- >- virtual ~ZipLocalEntry() {} >-protected: >- static const uint32 signature ; >- uint16 extract_version ; >- uint16 gp_bitfield ; >- uint16 compress_method ; >- uint16 last_mod_ftime ; >- uint16 last_mod_fdate ; >- uint32 crc_32 ; >- uint32 compress_size ; >- uint32 uncompress_size ; >- uint16 filename_len ; >- uint16 extra_field_len ; >- >- string filename ; >- vector< unsigned char > extra_field ; >- >- bool _valid ; >-}; >- >-/** A struct containing fields for the entries in a zip file data >- descriptor, that trails the compressed data in files that were >- created by streaming, ie where the zip compressor cannot seek back >- to the local header and store the data. */ >-struct DataDescriptor { >- uint32 crc_32 ; >- uint32 compress_size ; >- uint32 uncompress_size ; >-}; >- >-/** Specialization of ZipLocalEntry, that add fields for storing the >- extra information, that is only present in the entries in the zip >- central directory and not in the local entry headers. */ >-class ZipCDirEntry : public ZipLocalEntry { >-friend istream &operator>> ( istream &is, ZipCDirEntry &zcdh ) ; >-friend ostream &operator<< ( ostream &os, const ZipCDirEntry &zcdh ) ; >-friend bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; >-public: >- >- inline ZipCDirEntry( const string &_filename = "", >- const string &_file_comment = "", >- const vector< unsigned char > &_extra_field = >- vector< unsigned char >() ) >- : ZipLocalEntry ( _filename, _extra_field ), >- disk_num_start ( 0x0 ), >- intern_file_attr( 0x0 ), >- extern_file_attr( 0x81B40000 ) >- // FIXME: I don't understand the external mapping, simply >- // copied value for a file with -rw-rw-r-- permissions >- // compressed with info-zip >- { >- setComment( _file_comment ) ; >- setDefaultWriter() ; >- } >- >- void setDefaultWriter() ; >- >- inline ZipCDirEntry &operator=( const class ZipCDirEntry &src ) ; >- virtual string toString() const ; >- >- virtual string getComment() const ; >- >- virtual void setComment( const string &comment ) ; >- >- virtual uint32 getLocalHeaderOffset() const ; >- virtual void setLocalHeaderOffset( uint32 offset ) ; >- >- int getCDirHeaderSize() const ; >- >- virtual FileEntry *clone() const ; >- >- virtual ~ZipCDirEntry() {} >-private: >- static const uint32 signature ; >- uint16 writer_version ; >- >- uint16 file_comment_len ; >- uint16 disk_num_start ; >- uint16 intern_file_attr ; >- uint32 extern_file_attr ; >- >- uint32 rel_offset_loc_head ; >- >- string file_comment ; >-}; >- >-/** The end of the Central directory structure. This structure is >- stored in the end of the zipfile, and contains information about >- the zipfile, including the position of the start of the central >- directory. */ >-class EndOfCentralDirectory { >- friend ostream &operator<< ( ostream &os, const EndOfCentralDirectory &eocd ) ; >-public: >- explicit EndOfCentralDirectory( const string &_zip_comment = "", >- uint16 _disk_num = 0, uint16 _cdir_disk_num = 0, >- uint16 _cdir_entries = 0, >- uint16 _cdir_tot_entries = 0, >- uint32 _cdir_size = 0, uint32 _cdir_offset = 0 ) >- : disk_num ( _disk_num ), >- cdir_disk_num ( _cdir_disk_num ), >- cdir_entries ( _cdir_entries ), >- cdir_tot_entries ( _cdir_tot_entries ), >- cdir_size ( _cdir_size ), >- cdir_offset ( _cdir_offset ), >- zip_comment_len ( static_cast< uint16 >( _zip_comment.size() ) ), >- zip_comment ( _zip_comment ) {} >- >- uint32 offset() const { return cdir_offset ; } >- uint16 totalCount() const { return cdir_tot_entries ; } >- void setCDirSize( uint32 size ) { cdir_size = size ; } >- void setOffset( uint32 offset ) { cdir_offset = offset ; } >- >- void setTotalCount( uint16 c ) { cdir_entries = c ; cdir_tot_entries = c ; } >- int eocdOffSetFromEnd() const { return static_cast< int >( eocd_offset_from_end ) ; } >- bool read( vector<unsigned char> &buf, int pos ) ; >-private: >- static const uint32 signature; >- uint16 disk_num ; >- uint16 cdir_disk_num ; >- uint16 cdir_entries ; >- uint16 cdir_tot_entries ; >- uint32 cdir_size ; >- uint32 cdir_offset ; >- uint16 zip_comment_len ; >- >- streampos eocd_offset_from_end ; // Not a Zip defined field >- string zip_comment; >- bool checkSignature( unsigned char *buf ) const ; >- inline bool checkSignature( uint32 sig ) const ; >-}; >- >- >-bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; >-inline bool operator== ( const ZipCDirEntry &ze, const ZipLocalEntry &zlh ) { >- return zlh == ze ; >-} >-inline bool operator!= ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) { >- return ! ( zlh == ze ) ; >-} >-inline bool operator!= ( const ZipCDirEntry &ze, const ZipLocalEntry &zlh ) { >- return ! ( zlh == ze ) ; >-} >- >-// Inline member functions >- >-ZipCDirEntry &ZipCDirEntry::operator=( const class ZipCDirEntry &src ) { >- writer_version = src.writer_version ; >- extract_version = src.extract_version ; >- gp_bitfield = src.gp_bitfield ; >- compress_method = src.compress_method ; >- last_mod_ftime = src.last_mod_ftime ; >- last_mod_fdate = src.last_mod_fdate ; >- crc_32 = src.crc_32 ; >- compress_size = src.compress_size ; >- uncompress_size = src.uncompress_size ; >- filename_len = src.filename_len ; >- extra_field_len = src.extra_field_len ; >- file_comment_len = src.file_comment_len ; >- disk_num_start = src.disk_num_start ; >- intern_file_attr = src.intern_file_attr ; >- extern_file_attr = src.extern_file_attr ; >- rel_offset_loc_head = src.rel_offset_loc_head ; >- >- filename = src.filename ; >- extra_field = src.extra_field ; >- file_comment = src.file_comment ; >- >- return *this ; >-} >- >-bool EndOfCentralDirectory::checkSignature ( uint32 sig ) const { >- return signature == sig ; >-} >- >- >-} // namespace >- >-#endif >- >- >-/** \file >- Header file containing classes and functions for reading the central >- directory and local header fields in a zip archive. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipheadio.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipheadio.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipheadio.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipheadio.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,192 +0,0 @@ >-#ifndef ZIPHEADIO_H >-#define ZIPHEADIO_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >-#include <vector> >- >-#include "zipios++/ziphead.h" >-#include "zipios++/zipios_defs.h" >- >-namespace zipios { >- >-// byte order conversion functions. >-// ztohs (zip-to-host-short) >-#ifdef MY_BIG_ENDIAN >- >-inline uint16 ztohs ( unsigned char *buf ) { >- uint16 out ; >-// *( reinterpret_cast<unsigned char *>( &out ) ) = *( buf + 1 ); >-// *( reinterpret_cast<unsigned char *>( &out ) + 1 ) = *( buf ); >- out = ( static_cast< uint16 >( buf[ 0 ] ) << 8 ) + >- ( static_cast< uint16 >( buf[ 1 ] ) ) ; >- >- return out; >-} >- >-// ztohl (zip-to-host-long) >-inline uint32 ztohl ( unsigned char *buf ) { >- uint32 out; >- out = ( static_cast< uint32 >( buf[ 0 ] ) << 24 ) + >- ( static_cast< uint32 >( buf[ 1 ] ) << 16 ) + >- ( static_cast< uint32 >( buf[ 2 ] ) << 8 ) + >- ( static_cast< uint32 >( buf[ 3 ] ) ) ; >- >- return out; >-} >- >-#else >- >-inline uint16 ztohs ( unsigned char *buf ) { >- uint16 out ; >- out = ( static_cast< uint16 >( buf[ 1 ] ) << 8 ) + >- ( static_cast< uint16 >( buf[ 0 ] ) ) ; >- return out; >-} >- >-// ztohl (zip-to-host-long) >-inline uint32 ztohl ( unsigned char *buf ) { >- uint32 out; >- out = ( static_cast< uint32 >( buf[ 3 ] ) << 24 ) + >- ( static_cast< uint32 >( buf[ 2 ] ) << 16 ) + >- ( static_cast< uint32 >( buf[ 1 ] ) << 8 ) + >- ( static_cast< uint32 >( buf[ 0 ] ) ) ; >-// cerr << "buf : " << static_cast< int >( buf[ 0 ] ) ; >-// cerr << " " << static_cast< int >( buf[ 1 ] ) ; >-// cerr << " " << static_cast< int >( buf[ 2 ] ) ; >-// cerr << " " << static_cast< int >( buf[ 3 ] ) << endl ; >-// cerr << "uint32 " << out << endl ; >- return out; >-} >- >- >-#endif >- >-// htozl (host-to-zip-long) >-inline uint32 htozl ( unsigned char *buf ) { >- return ztohl( buf ) ; >-} >- >-// htozs (host-to-zip-short) >-inline uint16 htozs ( unsigned char *buf ) { >- return ztohs( buf ) ; >-} >- >- >-inline uint32 readUint32 ( istream &is ) { >- static const int buf_len = sizeof ( uint32 ) ; >- unsigned char buf [ buf_len ] ; >- int rsf = 0 ; >- while ( rsf < buf_len ) { >- is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; >- rsf += static_cast< int >( is.gcount () ) ; >- } >- return ztohl ( buf ) ; >-} >- >-inline void writeUint32 ( uint32 host_val, ostream &os ) { >- uint32 val = htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ; >- os.write( reinterpret_cast< char * >( &val ), sizeof( uint32 ) ) ; >-} >- >-inline uint16 readUint16 ( istream &is ) { >- static const int buf_len = sizeof ( uint16 ) ; >- unsigned char buf [ buf_len ] ; >- int rsf = 0 ; >- while ( rsf < buf_len ) { >- is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; >- rsf += static_cast< int >( is.gcount () ) ; >- } >- return ztohs ( buf ) ; >-} >- >-inline void writeUint16 ( uint16 host_val, ostream &os ) { >- uint16 val = static_cast< uint16 >( htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ) ; >- os.write( reinterpret_cast< char * >( &val ), sizeof( uint16 ) ) ; >-} >- >-inline void readByteSeq ( istream &is, string &con, int count ) { >- char *buf = new char [ count + 1 ] ; >- int rsf = 0 ; >- while ( rsf < count && is ) { >- is.read ( buf + rsf, count - rsf ) ; >- rsf += static_cast< int >( is.gcount() ) ; >- } >- buf [ count ] = '\0' ; >- >- con = buf ; >- delete [] buf ; >-} >- >-inline void writeByteSeq( ostream &os, const string &con ) { >- os << con ; >-} >- >-inline void readByteSeq ( istream &is, unsigned char *buf, int count ) { >- int rsf = 0 ; >- >- while ( rsf < count && is ) { >- is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; >- rsf += static_cast< int >( is.gcount() ) ; >- } >-} >- >-inline void writeByteSeq ( ostream &os, const unsigned char *buf, int count ) { >- os.rdbuf()->sputn( reinterpret_cast< const char * >( buf ), count ) ; >-} >- >-inline void readByteSeq ( istream &is, vector < unsigned char > &vec, int count ) { >- unsigned char *buf = new unsigned char [ count ] ; >- int rsf = 0 ; >- while ( rsf < count && is ) { >- is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; >- rsf += static_cast< int >( is.gcount() ) ; >- } >- >- vec.insert ( vec.end (), buf, buf + count ) ; >- delete [] buf ; >-} >- >-inline void writeByteSeq ( ostream &os, const vector < unsigned char > &vec ) { >- os.rdbuf()->sputn( reinterpret_cast< const char * >( &( vec[ 0 ] ) ), vec.size() ) ; >-} >- >-istream& operator>> ( istream &is, ZipLocalEntry &zlh ) ; >-istream& operator>> ( istream &is, DataDescriptor &dd ) ; >-istream& operator>> ( istream &is, ZipCDirEntry &zcdh ) ; >-// istream& operator>> ( istream &is, EndOfCentralDirectory &eocd ) ; >- >-ostream &operator<< ( ostream &os, const ZipLocalEntry &zlh ) ; >-ostream &operator<< ( ostream &os, const ZipCDirEntry &zcdh ) ; >-ostream &operator<< ( ostream &os, const EndOfCentralDirectory &eocd ) ; >- >- >-} // namespace >- >-#endif >- >-/** \file >- Header file that defines I/O functions for the header structures >- defined in ziphead.h. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipinputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipinputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipinputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipinputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,89 +0,0 @@ >-#ifndef ZIPINPUTSTREAMBUF_H >-#define ZIPINPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >- >-#include <zlib.h> >- >-#include "zipios++/fcoll.h" >-#include "zipios++/inflateinputstreambuf.h" >-#include "zipios++/ziphead.h" >- >-namespace zipios { >- >-/** ZipInputStreambuf is a zip input streambuf filter. >- */ >-class ZipInputStreambuf : public InflateInputStreambuf { >-public: >- /** ZipInputStreambuf constructor. >- @param inbuf the streambuf to use for input. >- @param s_pos a position to reset the inbuf to before reading. Specify >- -1 to read from the current position. >- @param del_inbuf if true is specified inbuf will be deleted, when >- the ZipInputStreambuf is destructed. >- */ >- explicit ZipInputStreambuf( streambuf *inbuf, int s_pos = -1, bool del_inbuf = false ) ; >- >- /** Closes the current entry, and positions the stream read pointer at >- the beginning of the next entry (if there is one). */ >- void closeEntry() ; >- /** Closes the streambuf. */ >- void close() ; >- >- /** Opens the next entry in the zip archive and returns a const pointer to a >- FileEntry object for the entry. >- @return a const FileEntry * containing information about the (now) current >- entry. >- */ >- ConstEntryPointer getNextEntry() ; >- >- /** Destructor. */ >- virtual ~ZipInputStreambuf() ; >-protected: >- virtual int underflow() ; >-private: >- bool _open_entry ; >- ZipLocalEntry _curr_entry ; >- int _data_start ; // Don't forget entry header has a length too. >- int _remain ; // For STORED entry only. the number of bytes that >- // hasn't been put in the _outvec yet. >- >- /** Copy-constructor is private to prevent copying. */ >- ZipInputStreambuf( const ZipInputStreambuf &src ) ; >- >- /** Copy-assignment operator is private to prevent copying. */ >- const ZipInputStreambuf &operator= ( const ZipInputStreambuf &src ) ; >- >-}; >- >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines ZipInputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipinputstream.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipinputstream.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipinputstream.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipinputstream.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,92 +0,0 @@ >-#ifndef ZIPINPUTSTREAM_H >-#define ZIPINPUTSTREAM_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >-#include <string> >- >-#include "zipios++/ziphead.h" >-#include "zipios++/zipinputstreambuf.h" >- >-namespace zipios { >- >-using std::ifstream ; >- >-/** \anchor ZipInputStream_anchor >- ZipInputStream is an istream that gets it's input from a zip file. The >- interface approximates the interface of the Java >- ZipInputStream. */ >-class ZipInputStream : public istream { >-public: >- >- /** ZipInputStream constructor. >- @param is istream from which the compressed zip archive can be read. >- @param pos position to reposition the istream to before reading. */ >- explicit ZipInputStream( istream &is, streampos pos = 0 ) ; >- >- /** ZipInputStream constructor. >- @filename filename of a valid zip file. >- @param pos position to reposition the istream to before reading. */ >- explicit ZipInputStream( const string &filename, streampos pos = 0 ) ; >- >- int available() ; >- /** Closes the current entry, and positions the stream read pointer at >- the beginning of the next entry (if there is one). */ >- void closeEntry() ; >- >- /** Closes the istream. */ >- void close() ; >- >-// ZipLocalEntry *createZipCDirEntry( const string &name ) ; >- >- /** \anchor ZipInputStream_getnextentry_anchor >- Opens the next entry in the zip archive and returns a const pointer to a >- FileEntry object for the entry. For new instances this method has to be >- called once before you can read from the first entry. >- @return a const FileEntry * containing information about the (now) current >- entry. >- */ >- ConstEntryPointer getNextEntry() ; >- >- /** Destructor. */ >- virtual ~ZipInputStream() ; >- >-private: >- ifstream *ifs ; >- ZipInputStreambuf *izf ; >- >- /** Copy-constructor is private to prevent copying. */ >- ZipInputStream( const ZipInputStream &src ) ; >- >- /** Copy-assignment operator is private to prevent copying. */ >- const ZipInputStream &operator= ( const ZipInputStream &src ) ; >- >-}; >- >-} // namespace. >- >-#endif >- >-/** \file >- Header file that defines ZipInputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,10 +0,0 @@ >-#ifndef ZIPIOS_CONFIG_GEN_H >-#define ZIPIOS_CONFIG_GEN_H >- >-#if defined(_MSC_VER) >-# include "zipios-config.w32.h" >-#else >-# include "zipios-config.unix.h" >-#endif >- >-#endif // ZIPIOS_CONFIG_GEN_H >\ No newline at end of file >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.h.in FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.h.in >--- FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.h.in 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.h.in 1970-01-01 01:00:00.000000000 +0100 >@@ -1,151 +0,0 @@ >-/* zipios++/zipios-config.h.in. Generated from configure.ac by autoheader. */ >- >-/* Define to 1 if the `closedir' function returns void instead of `int'. */ >-#undef CLOSEDIR_VOID >- >-/* Define to 1 if your system has a working `chown' function. */ >-#undef HAVE_CHOWN >- >-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. >- */ >-#undef HAVE_DIRENT_H >- >-/* Define to 1 if you have the <dlfcn.h> header file. */ >-#undef HAVE_DLFCN_H >- >-/* Define to 1 if you have the <inttypes.h> header file. */ >-#undef HAVE_INTTYPES_H >- >-/* Define to 1 if you have the `z' library (-lz). */ >-#undef HAVE_LIBZ >- >-/* Define to 1 if you have the <memory.h> header file. */ >-#undef HAVE_MEMORY_H >- >-/* define if the compiler implements namespaces */ >-#undef HAVE_NAMESPACES >- >-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ >-#undef HAVE_NDIR_H >- >-/* Define to 1 if the system has the type `ptrdiff_t'. */ >-#undef HAVE_PTRDIFF_T >- >-/* Define to 1 if `stat' has the bug that it succeeds when given the >- zero-length file name argument. */ >-#undef HAVE_STAT_EMPTY_STRING_BUG >- >-/* define if the compiler supports ISO C++ standard library */ >-#undef HAVE_STD >- >-/* Define to 1 if stdbool.h conforms to C99. */ >-#undef HAVE_STDBOOL_H >- >-/* Define to 1 if you have the <stdint.h> header file. */ >-#undef HAVE_STDINT_H >- >-/* Define to 1 if you have the <stdlib.h> header file. */ >-#undef HAVE_STDLIB_H >- >-/* define if the compiler has std compliant iostream library */ >-#undef HAVE_STD_IOSTREAM >- >-/* define if the Standard Template Library is available */ >-#undef HAVE_STL >- >-/* Define to 1 if you have the <strings.h> header file. */ >-#undef HAVE_STRINGS_H >- >-/* Define to 1 if you have the <string.h> header file. */ >-#undef HAVE_STRING_H >- >-/* Define to 1 if `st_blksize' is member of `struct stat'. */ >-#undef HAVE_STRUCT_STAT_ST_BLKSIZE >- >-/* Define to 1 if `st_blocks' is member of `struct stat'. */ >-#undef HAVE_STRUCT_STAT_ST_BLOCKS >- >-/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use >- `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ >-#undef HAVE_ST_BLOCKS >- >-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. >- */ >-#undef HAVE_SYS_DIR_H >- >-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. >- */ >-#undef HAVE_SYS_NDIR_H >- >-/* Define to 1 if you have the <sys/stat.h> header file. */ >-#undef HAVE_SYS_STAT_H >- >-/* Define to 1 if you have the <sys/types.h> header file. */ >-#undef HAVE_SYS_TYPES_H >- >-/* Define to 1 if you have the `uname' function. */ >-#undef HAVE_UNAME >- >-/* Define to 1 if you have the <unistd.h> header file. */ >-#undef HAVE_UNISTD_H >- >-/* Define if zlib has zError */ >-#undef HAVE_ZERROR >- >-/* Define to 1 if the system has the type `_Bool'. */ >-#undef HAVE__BOOL >- >-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing >- slash. */ >-#undef LSTAT_FOLLOWS_SLASHED_SYMLINK >- >-/* Name of package */ >-#undef PACKAGE >- >-/* Define to the address where bug reports for this package should be sent. */ >-#undef PACKAGE_BUGREPORT >- >-/* Define to the full name of this package. */ >-#undef PACKAGE_NAME >- >-/* Define to the full name and version of this package. */ >-#undef PACKAGE_STRING >- >-/* Define to the one symbol short name of this package. */ >-#undef PACKAGE_TARNAME >- >-/* Define to the version of this package. */ >-#undef PACKAGE_VERSION >- >-/* Define to 1 if you have the ANSI C header files. */ >-#undef STDC_HEADERS >- >-/* Define to 1 if your <sys/time.h> declares `struct tm'. */ >-#undef TM_IN_SYS_TIME >- >-/* Define if the std compliant iostream library should be used (if present) */ >-#undef USE_STD_IOSTREAM >- >-/* Version number of package */ >-#undef VERSION >- >-/* Define to empty if `const' does not conform to ANSI C. */ >-#undef const >- >-/* Define to `int' if <sys/types.h> doesn't define. */ >-#undef gid_t >- >-/* Define to `__inline__' or `__inline' if that's what the C compiler >- calls it, or to nothing if 'inline' is not supported under any name. */ >-#ifndef __cplusplus >-#undef inline >-#endif >- >-/* Define to `int' if <sys/types.h> does not define. */ >-#undef mode_t >- >-/* Define to `unsigned int' if <sys/types.h> does not define. */ >-#undef size_t >- >-/* Define to `int' if <sys/types.h> doesn't define. */ >-#undef uid_t >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.unix.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.unix.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.unix.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.unix.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,150 +0,0 @@ >- >-/* Define to 1 if the `closedir' function returns void instead of `int'. */ >-/* #undef CLOSEDIR_VOID */ >- >-/* Define to 1 if your system has a working `chown' function. */ >-#define HAVE_CHOWN 1 >- >-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. >- */ >-#define HAVE_DIRENT_H 1 >- >-/* Define to 1 if you have the <dlfcn.h> header file. */ >-#define HAVE_DLFCN_H 1 >- >-/* Define to 1 if you have the <inttypes.h> header file. */ >-#define HAVE_INTTYPES_H 1 >- >-/* Define to 1 if you have the `z' library (-lz). */ >-//#define HAVE_LIBZ 1 >- >-/* Define to 1 if you have the <memory.h> header file. */ >-#define HAVE_MEMORY_H 1 >- >-/* define if the compiler implements namespaces */ >-#define HAVE_NAMESPACES >- >-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ >-/* #undef HAVE_NDIR_H */ >- >-/* Define to 1 if the system has the type `ptrdiff_t'. */ >-#define HAVE_PTRDIFF_T 1 >- >-/* Define to 1 if `stat' has the bug that it succeeds when given the >- zero-length file name argument. */ >-/* #undef HAVE_STAT_EMPTY_STRING_BUG */ >- >-/* define if the compiler supports ISO C++ standard library */ >-#define HAVE_STD >- >-/* Define to 1 if stdbool.h conforms to C99. */ >-#define HAVE_STDBOOL_H 1 >- >-/* Define to 1 if you have the <stdint.h> header file. */ >-#define HAVE_STDINT_H 1 >- >-/* Define to 1 if you have the <stdlib.h> header file. */ >-#define HAVE_STDLIB_H 1 >- >-/* define if the compiler has std compliant iostream library */ >-#define HAVE_STD_IOSTREAM >- >-/* define if the Standard Template Library is available */ >-#define HAVE_STL >- >-/* Define to 1 if you have the <strings.h> header file. */ >-#define HAVE_STRINGS_H 1 >- >-/* Define to 1 if you have the <string.h> header file. */ >-#define HAVE_STRING_H 1 >- >-/* Define to 1 if `st_blksize' is member of `struct stat'. */ >-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 >- >-/* Define to 1 if `st_blocks' is member of `struct stat'. */ >-#define HAVE_STRUCT_STAT_ST_BLOCKS 1 >- >-/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use >- `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ >-#define HAVE_ST_BLOCKS 1 >- >-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. >- */ >-/* #undef HAVE_SYS_DIR_H */ >- >-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. >- */ >-/* #undef HAVE_SYS_NDIR_H */ >- >-/* Define to 1 if you have the <sys/stat.h> header file. */ >-#define HAVE_SYS_STAT_H 1 >- >-/* Define to 1 if you have the <sys/types.h> header file. */ >-#define HAVE_SYS_TYPES_H 1 >- >-/* Define to 1 if you have the `uname' function. */ >-#define HAVE_UNAME 1 >- >-/* Define to 1 if you have the <unistd.h> header file. */ >-#define HAVE_UNISTD_H 1 >- >-/* Define if zlib has zError */ >-#define HAVE_ZERROR 1 >- >-/* Define to 1 if the system has the type `_Bool'. */ >-#define HAVE__BOOL 1 >- >-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing >- slash. */ >-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 >- >-/* Name of package */ >-#define PACKAGE "zipios++" >- >-/* Define to the address where bug reports for this package should be sent. */ >-#define PACKAGE_BUGREPORT "zipios-devel@lists.sourceforge.net" >- >-/* Define to the full name of this package. */ >-#define PACKAGE_NAME "zipios++" >- >-/* Define to the full name and version of this package. */ >-#define PACKAGE_STRING "zipios++ 0.1.5" >- >-/* Define to the one symbol short name of this package. */ >-#define PACKAGE_TARNAME "zipios++" >- >-/* Define to the version of this package. */ >-#define PACKAGE_VERSION "0.1.5" >- >-/* Define to 1 if you have the ANSI C header files. */ >-#define STDC_HEADERS 1 >- >-/* Define to 1 if your <sys/time.h> declares `struct tm'. */ >-/* #undef TM_IN_SYS_TIME */ >- >-/* Define if the std compliant iostream library should be used (if present) */ >-#define USE_STD_IOSTREAM 1 >- >-/* Version number of package */ >-#define VERSION "0.1.5" >- >-/* Define to empty if `const' does not conform to ANSI C. */ >-/* #undef const */ >- >-/* Define to `int' if <sys/types.h> doesn't define. */ >-/* #undef gid_t */ >- >-/* Define to `__inline__' or `__inline' if that's what the C compiler >- calls it, or to nothing if 'inline' is not supported under any name. */ >-#ifndef __cplusplus >-/* #undef inline */ >-#endif >- >-/* Define to `int' if <sys/types.h> does not define. */ >-/* #undef mode_t */ >- >-/* Define to `unsigned int' if <sys/types.h> does not define. */ >-/* #undef size_t */ >- >-/* Define to `int' if <sys/types.h> doesn't define. */ >-/* #undef uid_t */ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.w32.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.w32.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipios-config.w32.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios-config.w32.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,56 +0,0 @@ >-#ifndef ZIPIOS_CONFIG_H >-#define ZIPIOS_CONFIG_H >- >-#define HAVE_STD_IOSTREAM >-#define USE_STD_IOSTREAM >-#define HAVE_STL >-#define HAVE_STRING_H 1 >-#define HAVE_STDLIB_H 1 >-#define HAVE_STDINT_H 1 >- >-// Visual C++ >- >-#ifdef _MSC_VER >- >-// Disable class-browser warning about truncated template-names >-#pragma warning( disable : 4786 ) >- >-#endif //_MSC_VER >- >-// Needed for FilePath >-#define S_ISREG(mode) (((mode) & _S_IFREG) == _S_IFREG) >-#define S_ISDIR(mode) (((mode) & _S_IFDIR) == _S_IFDIR) >-#define S_ISCHR(mode) (((mode) & _S_IFCHR) == _S_IFCHR) >-#define S_ISBLK(mode) 0 >-#define S_ISSOCK(mode) 0 >-#define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO) >- >- >-// Convenient place to include any debugging-headers >-#include <assert.h> >- >-#endif // ZIPIOS_CONFIG_H >- >-/** \file >- Configuration header file that allows compatibility with win32 compilers >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- Copyright (C) 2000 1. Thomas Søndergaard 2. Kevin Shea >- Written by Kevin Shea >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Lesser General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipios_defs.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios_defs.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipios_defs.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipios_defs.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,36 +0,0 @@ >-#ifndef ZIPIOS_DEFS_H >-#define ZIPIOS_DEFS_H >- >-#include <boost/cstdint.hpp> >- >-namespace zipios { >- >-typedef boost::uint16_t uint16 ; >-typedef boost::uint32_t uint32 ; >- >-} // namespace >- >-#endif >- >-/** \file >- Header file that defines some simple data types. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- Copyright (C) 2000 Thomas Sondergaard >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Lesser General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipoutputstreambuf.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipoutputstreambuf.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipoutputstreambuf.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipoutputstreambuf.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,116 +0,0 @@ >-#ifndef ZIPOUTPUTSTREAMBUF_H >-#define ZIPOUTPUTSTREAMBUF_H >- >-#include "zipios++/zipios-config.h" >- >-#include <vector> >- >-#include <zlib.h> >- >-#include "zipios++/fcoll.h" >-#include "zipios++/deflateoutputstreambuf.h" >-#include "zipios++/ziphead.h" >- >-namespace zipios { >- >-/** ZipOutputStreambuf is a zip output streambuf filter. */ >-class ZipOutputStreambuf : public DeflateOutputStreambuf { >-public: >- >- enum CompressionLevels { NO_COMPRESSION = Z_NO_COMPRESSION, >- BEST_SPEED = Z_BEST_SPEED, >- BEST_COMPRESSION = Z_BEST_COMPRESSION, >- DEFAULT_COMPRESSION = Z_DEFAULT_COMPRESSION } ; >- >- /** ZipOutputStreambuf constructor. A newly constructed ZipOutputStreambuf >- is not ready to accept data, putNextEntry() must be invoked first. >- @param outbuf the streambuf to use for input. >- @param del_outbuf if true is specified outbuf will be deleted, when >- the ZipOutputStreambuf is destructed. */ >- explicit ZipOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; >- >- /** Closes the current entry, and positions the stream read pointer at >- the beginning of the next entry (if there is one). */ >- void closeEntry() ; >- >- /** Calls finish. */ >- void close() ; >- >- /** Closes the current entry (if one is open), then writes the Zip >- Central Directory Structure closing the ZipOutputStream. The >- output stream that the zip archive is being written to is not >- closed. */ >- void finish() ; >- >- /** Begins writing the next entry. >- Opens the next entry in the zip archive and returns a const pointer to a >- FileEntry object for the entry. >- @return a const FileEntry * containing information about the (now) current >- entry. */ >- void putNextEntry( const ZipCDirEntry &entry ) ; >- >- /** Sets the global comment for the Zip archive. */ >- void setComment( const string &comment ) ; >- >- /** Sets the compression level to be used for subsequent entries. */ >- void setLevel( int level ) ; >- >- /** Sets the compression method to be used. only STORED and DEFLATED are >- supported. */ >- void setMethod( StorageMethod method ) ; >- >- /** Destructor. */ >- virtual ~ZipOutputStreambuf() ; >- >-protected: >- virtual int overflow( int c = EOF ) ; >- virtual int sync() ; >- >- void setEntryClosedState() ; >- void updateEntryHeaderInfo() ; >- >- // Should/could be moved to zipheadio.h ?! >- static void writeCentralDirectory( const vector< ZipCDirEntry > &entries, >- EndOfCentralDirectory eocd, >- ostream &os ) ; >- >- >- >-private: >- string _zip_comment ; >- vector< ZipCDirEntry > _entries ; >- bool _open_entry ; >- bool _open ; >- StorageMethod _method ; >- int _level ; >-}; >- >- >-} // namespace >- >- >- >-#endif >- >-/** \file >- Header file that defines ZipOutputStreambuf. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/ >diff -Nrup FlightCrew-0.7.2/src/zipios/zipios++/zipoutputstream.h FlightCrew-0.7.2.dev/src/zipios/zipios++/zipoutputstream.h >--- FlightCrew-0.7.2/src/zipios/zipios++/zipoutputstream.h 2011-08-11 21:03:56.000000000 +0200 >+++ FlightCrew-0.7.2.dev/src/zipios/zipios++/zipoutputstream.h 1970-01-01 01:00:00.000000000 +0100 >@@ -1,101 +0,0 @@ >-#ifndef ZIPOUTPUTSTREAM_H >-#define ZIPOUTPUTSTREAM_H >- >-#include "zipios++/zipios-config.h" >- >-#include "zipios++/meta-iostreams.h" >- >-#include <string> >- >-#include "zipios++/ziphead.h" >-#include "zipios++/zipoutputstreambuf.h" >- >-namespace zipios { >- >-/** \anchor ZipOutputStream_anchor >- ZipOutputStream is an ostream that writes the output to a zip file. The >- interface approximates the interface of the Java ZipOutputStream. */ >-class ZipOutputStream : public std::ostream { >-public: >- >- /** ZipOutputStream constructor. >- @param os ostream to which the compressed zip archive is written. >- @param pos position to reposition the ostream to before reading. */ >- explicit ZipOutputStream( std::ostream &os ) ; >- >- /** ZipOutputStream constructor. >- @filename filename to write the zip archive to. */ >- explicit ZipOutputStream( const std::string &filename ) ; >- >- /** Closes the current entry updates its header with the relevant >- size information and positions the stream write pointer for the >- next entry header. Puts the stream in EOF state. Call >- putNextEntry() to clear the EOF stream state flag. */ >- void closeEntry() ; >- >- /** Calls finish and if the ZipOutputStream was created with a >- filename as a parameter that file is closed as well. If the >- ZipOutputStream was created with an ostream as its first >- parameter nothing but the call to finish happens. */ >- void close() ; >- >- /** Closes the current entry (if one is open), then writes the Zip >- Central Directory Structure closing the ZipOutputStream. The >- output stream that the zip archive is being written to is not >- closed. */ >- void finish() ; >- >- /** \anchor ZipOutputStream_putnextentry_anchor >- Begins writing the next entry. >- */ >- void putNextEntry( const ZipCDirEntry &entry ) ; >- >- /** \anchor ZipOutputStream_putnextentry2_anchor >- Begins writing the next entry. >- */ >- void putNextEntry(const std::string& entryName); >- >- /** Sets the global comment for the Zip archive. */ >- void setComment( const std::string& comment ) ; >- >- /** Sets the compression level to be used for subsequent entries. */ >- void setLevel( int level ) ; >- >- /** Sets the compression method to be used. only STORED and DEFLATED are >- supported. */ >- void setMethod( StorageMethod method ) ; >- >- /** Destructor. */ >- virtual ~ZipOutputStream() ; >- >-private: >- std::ofstream *ofs ; >- ZipOutputStreambuf *ozf ; >-}; >- >-} // namespace. >- >-#endif >- >-/** \file >- Header file that defines ZipOutputStream. >-*/ >- >-/* >- Zipios++ - a small C++ library that provides easy access to .zip files. >- 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 >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Lesser General Public License for more details. >- >- You should have received a copy of the GNU Lesser General Public >- License along with this library; if not, write to the Free Software >- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-*/
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1077716
:
875958
| 876026