[c][cpp] Fix multi-page atlas parsing, closes #1935

This commit is contained in:
badlogic 2021-08-05 16:19:06 +02:00
parent d4c099018b
commit 8057c114db
2 changed files with 8 additions and 2 deletions

View File

@ -139,7 +139,10 @@ typedef struct SimpleString {
static SimpleString *ss_trim(SimpleString *self) {
while (isspace((unsigned char) *self->start) && self->start < self->end)
self->start++;
if (self->start == self->end) return self;
if (self->start == self->end) {
self->length = self->end - self->start;
return self;
}
self->end--;
while (((unsigned char) *self->end == '\r') && self->end >= self->start)
self->end--;

View File

@ -111,7 +111,10 @@ struct SimpleString {
SimpleString trim() {
while (isspace((unsigned char) *start) && start < end)
start++;
if (start == end) return *this;
if (start == end) {
length = end - start;
return *this;
}
end--;
while (((unsigned char) *end == '\r') && end >= start)
end--;