Skip to content

Commit

Permalink
Renamal of DEFAULT_CHUNK_SIZE define
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Tabin committed Apr 18, 2020
1 parent bbc64c1 commit 6f6f8f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/libzippp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ int ZipArchive::readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, Stat
struct zip_file* zipFile = zip_fopen_index(zipHandle, zipEntry.getIndex(), flag);
if (zipFile) {
libzippp_uint64 maxSize = zipEntry.getSize();
if (!chunksize) { chunksize = DEFAULT_CHUNK_SIZE; } // use the default chunk size (512K) if not specified by the user
if (!chunksize) { chunksize = LIBZIPPP_DEFAULT_CHUNK_SIZE; } // use the default chunk size (512K) if not specified by the user

if (maxSize<chunksize) {
char* data = NEW_CHAR_ARRAY(maxSize)
Expand Down
10 changes: 5 additions & 5 deletions src/libzippp.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct zip_source;

#define LIBZIPPP_ENTRY_PATH_SEPARATOR '/'
#define LIBZIPPP_ENTRY_IS_DIRECTORY(str) ((str).length()>0 && (str)[(str).length()-1]==LIBZIPPP_ENTRY_PATH_SEPARATOR)
#define DEFAULT_CHUNK_SIZE 524288
#define LIBZIPPP_DEFAULT_CHUNK_SIZE 524288

//libzip documentation
//- http://www.nih.at/libzip/libzip.html
Expand Down Expand Up @@ -300,10 +300,10 @@ namespace libzippp {
* a memory allocation has failed, LIBZIPPP_ERROR_FREAD_FAILURE if zip_fread() didn't succeed to read data,
* LIBZIPPP_ERROR_OWRITE_INDEX_FAILURE if the last ofstream operation has failed, LIBZIPPP_ERROR_OWRITE_FAILURE if fread() didn't
* return the exact amount of requested bytes and -9 if the amount of extracted bytes didn't match the size of the file (unknown error).
* If the provided chunk size is zero, it will be defaulted to DEFAULT_CHUNK_SIZE (512KB).
* If the provided chunk size is zero, it will be defaulted to LIBZIPPP_DEFAULT_CHUNK_SIZE (512KB).
* The method doesn't close the ofstream after the extraction.
*/
int readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, State state=CURRENT, libzippp_uint64 chunksize=DEFAULT_CHUNK_SIZE) const;
int readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, State state=CURRENT, libzippp_uint64 chunksize=LIBZIPPP_DEFAULT_CHUNK_SIZE) const;

/**
* Deletes the specified entry from the zip file. If the entry is a folder, all its
Expand Down Expand Up @@ -514,10 +514,10 @@ namespace libzippp {
* a memory allocation has failed, LIBZIPPP_ERROR_FREAD_FAILURE if zip_fread() didn't succeed to read data,
* LIBZIPPP_ERROR_OWRITE_INDEX_FAILURE if the last ofstream operation has failed, LIBZIPPP_ERROR_OWRITE_FAILURE if fread() didn't
* return the exact amount of requested bytes and -9 if the amount of extracted bytes didn't match the size of the file (unknown error).
* If the provided chunk size is zero, it will be defaulted to DEFAULT_CHUNK_SIZE (512KB).
* If the provided chunk size is zero, it will be defaulted to LIBZIPPP_DEFAULT_CHUNK_SIZE (512KB).
* The method doesn't close the ofstream after the extraction.
*/
int readContent(std::ostream& ofOutput, ZipArchive::State state=ZipArchive::CURRENT, libzippp_uint64 chunksize=DEFAULT_CHUNK_SIZE) const;
int readContent(std::ostream& ofOutput, ZipArchive::State state=ZipArchive::CURRENT, libzippp_uint64 chunksize=LIBZIPPP_DEFAULT_CHUNK_SIZE) const;

private:
const ZipArchive* zipFile;
Expand Down

0 comments on commit 6f6f8f6

Please sign in to comment.