Fixed delimiter depth on ZString::split.
This commit is contained in:
1 parent
6697a59c43
commit
2a4fc0ad6f
3 files changed
+8
-44
No files matched your search
+3
-2
@@ -118,17 +118,18 @@ namespace coreutils {
|
||||
char *end = data + length;
|
||||
char *pos = cursor;
|
||||
while ((pos + delimiter.getLength()) <= end) {
|
||||
if (strncmp(pos, delimiter.getData(), delimiter.getLength()) == 0)
|
||||
if ((strncmp(pos, delimiter.getData(), delimiter.getLength()) == 0) && (maxSize > 0))
|
||||
{
|
||||
list.push_back(ZString(cursor, pos - cursor));
|
||||
cursor = pos + delimiter.getLength();
|
||||
pos = cursor;
|
||||
--maxSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
list.push_back(ZString(cursor, pos - cursor));
|
||||
cursor = pos;
|
||||
return list;
|
||||
|
||||
Reference in new issue
Block a user