From 7b586b7b5465eba34ed20acfc6bfc15a38e0e3d6 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Wed, 24 Feb 2021 22:57:22 +0100 Subject: [PATCH] netradiant: some bikeshedding (whitespace, wording) --- plugins/archivezip/archive.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/archivezip/archive.cpp b/plugins/archivezip/archive.cpp index a8616e62..009040c0 100644 --- a/plugins/archivezip/archive.cpp +++ b/plugins/archivezip/archive.cpp @@ -50,12 +50,15 @@ DeflatedArchiveFile( const char* name, const char* archiveName, position_type po void release(){ delete this; } + size_type size() const { return m_size; } + const char* getName() const { return m_name.c_str(); } + InputStream& getInputStream(){ return m_zipstream; } @@ -68,6 +71,7 @@ FileInputStream m_istream; SubFileInputStream m_substream; DeflatedInputStream m_zipstream; BinaryToTextInputStream m_textStream; + public: typedef FileInputStream::size_type size_type; typedef FileInputStream::position_type position_type; @@ -79,6 +83,7 @@ DeflatedArchiveTextFile( const char* name, const char* archiveName, position_typ void release(){ delete this; } + TextInputStream& getInputStream(){ return m_textStream; } @@ -90,7 +95,6 @@ TextInputStream& getInputStream(){ #include "string/string.h" #include "fs_filesystem.h" - class ZipArchive : public Archive { class ZipRecord @@ -101,9 +105,11 @@ enum ECompressionMode eStored, eDeflated, }; + ZipRecord( unsigned int position, unsigned int compressed_size, unsigned int uncompressed_size, ECompressionMode mode ) : m_position( position ), m_stream_size( compressed_size ), m_file_size( uncompressed_size ), m_mode( mode ){ } + unsigned int m_position; unsigned int m_stream_size; unsigned int m_file_size; @@ -193,15 +199,17 @@ bool read_pkzip(){ } return false; } + public: ZipArchive( const char* name ) : m_name( name ), m_istream( name ){ if ( !m_istream.failed() ) { if ( !read_pkzip() ) { - globalErrorStream() << "ERROR: invalid zip-file " << makeQuoted( name ) << '\n'; + globalErrorStream() << "ERROR: invalid zip file " << makeQuoted( name ) << '\n'; } } } + ~ZipArchive(){ for ( ZipFileSystem::iterator i = m_filesystem.begin(); i != m_filesystem.end(); ++i ) { @@ -265,10 +273,12 @@ ArchiveTextFile* openTextFile( const char* name ){ bool containsFile( const char* name ){ ZipFileSystem::iterator i = m_filesystem.find( name ); return i != m_filesystem.end() && !i->second.is_directory(); + } void forEachFile( VisitorFunc visitor, const char* root ){ m_filesystem.traverse( visitor, root ); } + }; Archive* OpenArchive( const char* name ){ -- 2.39.2