Skip to content

Commit bbc64c1

Browse files
author
Cédric Tabin
committed
Renamal of ENTRY_IS_DIRECTORY define
1 parent 10ac27d commit bbc64c1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/libzippp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ int ZipArchive::renameEntry(const ZipEntry& entry, const string& newName) const
438438
if (newName==entry.getName()) { return LIBZIPPP_ERROR_INVALID_PARAMETER; }
439439

440440
if (entry.isFile()) {
441-
if (ENTRY_IS_DIRECTORY(newName)) { return LIBZIPPP_ERROR_INVALID_PARAMETER; } //invalid new name
441+
if (LIBZIPPP_ENTRY_IS_DIRECTORY(newName)) { return LIBZIPPP_ERROR_INVALID_PARAMETER; } //invalid new name
442442

443443
int lastSlash = newName.rfind(LIBZIPPP_ENTRY_PATH_SEPARATOR);
444444
if (lastSlash!=1) {
@@ -450,7 +450,7 @@ int ZipArchive::renameEntry(const ZipEntry& entry, const string& newName) const
450450
if (result==0) { return 1; }
451451
return LIBZIPPP_ERROR_UNKNOWN; //renaming was not possible (entry already exists ?)
452452
} else {
453-
if (!ENTRY_IS_DIRECTORY(newName)) { return LIBZIPPP_ERROR_INVALID_PARAMETER; } //invalid new name
453+
if (!LIBZIPPP_ENTRY_IS_DIRECTORY(newName)) { return LIBZIPPP_ERROR_INVALID_PARAMETER; } //invalid new name
454454

455455
int parentSlash = newName.rfind(LIBZIPPP_ENTRY_PATH_SEPARATOR, newName.length()-2);
456456
if (parentSlash!=-1) { //updates the dir hierarchy
@@ -507,7 +507,7 @@ int ZipArchive::renameEntry(const string& e, const string& newName) const {
507507
bool ZipArchive::addFile(const string& entryName, const string& file) const {
508508
if (!isOpen()) { return false; }
509509
if (mode==READ_ONLY) { return false; } //adding not allowed
510-
if (ENTRY_IS_DIRECTORY(entryName)) { return false; }
510+
if (LIBZIPPP_ENTRY_IS_DIRECTORY(entryName)) { return false; }
511511

512512
int lastSlash = entryName.rfind(LIBZIPPP_ENTRY_PATH_SEPARATOR);
513513
if (lastSlash!=-1) { //creates the needed parent directories
@@ -537,7 +537,7 @@ bool ZipArchive::addFile(const string& entryName, const string& file) const {
537537
bool ZipArchive::addData(const string& entryName, const void* data, libzippp_uint64 length, bool freeData) const {
538538
if (!isOpen()) { return false; }
539539
if (mode==READ_ONLY) { return false; } //adding not allowed
540-
if (ENTRY_IS_DIRECTORY(entryName)) { return false; }
540+
if (LIBZIPPP_ENTRY_IS_DIRECTORY(entryName)) { return false; }
541541

542542
int lastSlash = entryName.rfind(LIBZIPPP_ENTRY_PATH_SEPARATOR);
543543
if (lastSlash!=-1) { //creates the needed parent directories
@@ -560,7 +560,7 @@ bool ZipArchive::addData(const string& entryName, const void* data, libzippp_uin
560560
bool ZipArchive::addEntry(const string& entryName) const {
561561
if (!isOpen()) { return false; }
562562
if (mode==READ_ONLY) { return false; } //adding not allowed
563-
if (!ENTRY_IS_DIRECTORY(entryName)) { return false; }
563+
if (!LIBZIPPP_ENTRY_IS_DIRECTORY(entryName)) { return false; }
564564

565565
int nextSlash = entryName.find(LIBZIPPP_ENTRY_PATH_SEPARATOR);
566566
while (nextSlash!=-1) {

src/libzippp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct zip;
4545
struct zip_source;
4646

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

5151
//libzip documentation
@@ -459,7 +459,7 @@ namespace libzippp {
459459
/**
460460
* Returns true if the entry is a directory.
461461
*/
462-
inline bool isDirectory(void) const { return ENTRY_IS_DIRECTORY(name); }
462+
inline bool isDirectory(void) const { return LIBZIPPP_ENTRY_IS_DIRECTORY(name); }
463463

464464
/**
465465
* Returns true if the entry is a file.

0 commit comments

Comments
 (0)