Fixed == operator for empty string comparison.

This commit is contained in:
Brad Arant committed 2024-06-14 10:21:28 -07:00
1 parent f6e5e60e5b
commit beb3673241
8 files changed
+25 -14

No files matched your search

+5 -3
View File
@@ -68,6 +68,8 @@ namespace coreutils {
}
bool ZString::operator==(const ZString &valuex) {
if((valuex.getLength() == 0) && (length != 0))
return false;
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) == 0);
}
@@ -348,11 +350,11 @@ namespace coreutils {
return ZString(temp, size);
}
char *ZString::getData() {
char *ZString::getData() const {
return data;
}
char *ZString::getCursor() {
char *ZString::getCursor() const {
return cursor;
}
@@ -362,7 +364,7 @@ namespace coreutils {
this->cursor = cursor;
}
size_t ZString::getLength() {
size_t ZString::getLength() const {
return length - (cursor - data);
}