Fixed equals on zstring when length mismatches occured.
This commit is contained in:
1 parent
deb88cb14d
commit
191899fbb7
2 files changed
+24
-11
No files matched your search
+13
-5
@@ -36,7 +36,7 @@ namespace coreutils {
|
||||
data = zstring.data;
|
||||
length = zstring.length;
|
||||
cursor = zstring.cursor;
|
||||
Log(LOG_DEBUG_2) << "ZSrting Copy Constructor: ";
|
||||
// Log(LOG_DEBUG_2) << "ZSrting Copy Constructor: ";
|
||||
}
|
||||
|
||||
std::vector<ZString> &ZString::getList() {
|
||||
@@ -109,15 +109,23 @@ namespace coreutils {
|
||||
ZString &ZString::operator[](int index) {
|
||||
return list[index];
|
||||
}
|
||||
|
||||
|
||||
bool ZString::eod() {
|
||||
return cursor >= data + length;
|
||||
}
|
||||
|
||||
|
||||
bool ZString::equals(const char *value) {
|
||||
if(strlen(value) != length)
|
||||
return false;
|
||||
return strncmp(data, value, length) == 0;
|
||||
}
|
||||
|
||||
|
||||
bool ZString::equals(char *value) {
|
||||
if(strlen(value) != length)
|
||||
return false;
|
||||
return strncmp(data, value, length) == 0;
|
||||
}
|
||||
|
||||
bool ZString::equals(ZString &zstring) {
|
||||
if(zstring.getLength() != getLength())
|
||||
return false;
|
||||
@@ -127,7 +135,7 @@ namespace coreutils {
|
||||
bool ZString::equals(std::string &string) {
|
||||
return string == std::string(data, length);
|
||||
}
|
||||
|
||||
|
||||
bool ZString::ifNext(const char *value) {
|
||||
bool test = (strncmp(cursor, value, strlen(value)) == 0);
|
||||
if(test)
|
||||
|
||||
Reference in new issue
Block a user