Skip to content

Commit 6f6f8f6

Browse files
author
Cédric Tabin
committed
Renamal of DEFAULT_CHUNK_SIZE define
1 parent bbc64c1 commit 6f6f8f6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libzippp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ int ZipArchive::readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, Stat
585585
struct zip_file* zipFile = zip_fopen_index(zipHandle, zipEntry.getIndex(), flag);
586586
if (zipFile) {
587587
libzippp_uint64 maxSize = zipEntry.getSize();
588-
if (!chunksize) { chunksize = DEFAULT_CHUNK_SIZE; } // use the default chunk size (512K) if not specified by the user
588+
if (!chunksize) { chunksize = LIBZIPPP_DEFAULT_CHUNK_SIZE; } // use the default chunk size (512K) if not specified by the user
589589

590590
if (maxSize<chunksize) {
591591
char* data = NEW_CHAR_ARRAY(maxSize)

src/libzippp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct zip_source;
4646

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

5151
//libzip documentation
5252
//- http://www.nih.at/libzip/libzip.html
@@ -300,10 +300,10 @@ namespace libzippp {
300300
* a memory allocation has failed, LIBZIPPP_ERROR_FREAD_FAILURE if zip_fread() didn't succeed to read data,
301301
* LIBZIPPP_ERROR_OWRITE_INDEX_FAILURE if the last ofstream operation has failed, LIBZIPPP_ERROR_OWRITE_FAILURE if fread() didn't
302302
* 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).
303-
* If the provided chunk size is zero, it will be defaulted to DEFAULT_CHUNK_SIZE (512KB).
303+
* If the provided chunk size is zero, it will be defaulted to LIBZIPPP_DEFAULT_CHUNK_SIZE (512KB).
304304
* The method doesn't close the ofstream after the extraction.
305305
*/
306-
int readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, State state=CURRENT, libzippp_uint64 chunksize=DEFAULT_CHUNK_SIZE) const;
306+
int readEntry(const ZipEntry& zipEntry, std::ostream& ofOutput, State state=CURRENT, libzippp_uint64 chunksize=LIBZIPPP_DEFAULT_CHUNK_SIZE) const;
307307

308308
/**
309309
* Deletes the specified entry from the zip file. If the entry is a folder, all its
@@ -514,10 +514,10 @@ namespace libzippp {
514514
* a memory allocation has failed, LIBZIPPP_ERROR_FREAD_FAILURE if zip_fread() didn't succeed to read data,
515515
* LIBZIPPP_ERROR_OWRITE_INDEX_FAILURE if the last ofstream operation has failed, LIBZIPPP_ERROR_OWRITE_FAILURE if fread() didn't
516516
* 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).
517-
* If the provided chunk size is zero, it will be defaulted to DEFAULT_CHUNK_SIZE (512KB).
517+
* If the provided chunk size is zero, it will be defaulted to LIBZIPPP_DEFAULT_CHUNK_SIZE (512KB).
518518
* The method doesn't close the ofstream after the extraction.
519519
*/
520-
int readContent(std::ostream& ofOutput, ZipArchive::State state=ZipArchive::CURRENT, libzippp_uint64 chunksize=DEFAULT_CHUNK_SIZE) const;
520+
int readContent(std::ostream& ofOutput, ZipArchive::State state=ZipArchive::CURRENT, libzippp_uint64 chunksize=LIBZIPPP_DEFAULT_CHUNK_SIZE) const;
521521

522522
private:
523523
const ZipArchive* zipFile;

0 commit comments

Comments
 (0)