Fixed equals on zstring when length mismatches occured.
This commit is contained in:
parent
deb88cb14d
commit
191899fbb7
10
ZString.cpp
10
ZString.cpp
@ -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() {
|
||||
@ -115,6 +115,14 @@ namespace coreutils {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ namespace coreutils {
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const ZString& zstring);
|
||||
friend std::ostream& operator<<(std::ostream& os, const std::string& string);
|
||||
|
||||
friend std::ostream& operator+(std::ostream& os, const ZString& zstring);
|
||||
|
||||
///
|
||||
@ -138,6 +137,12 @@ namespace coreutils {
|
||||
///
|
||||
///
|
||||
|
||||
bool equals(char *value);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
bool equals(ZString &zstring);
|
||||
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user