aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/id.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp
index 4320864a75..c41d6e7227 100644
--- a/engines/agi/id.cpp
+++ b/engines/agi/id.cpp
@@ -242,11 +242,12 @@ uint32 match_crc(uint32 crc, char *name, int len) {
if (c)
*c = 0;
- /* Remove spaces at end of line */
+ /* Remove spaces/tabs at end of line */
if (strlen(buf)) {
- for (c = buf + strlen(buf) - 1;
- *c == ' ' || *c == '\t'; *c-- = 0) {
- }
+ int i;
+ for (i = strlen(buf) - 1;
+ i >= 0 && (buf[i] == ' ' || buf[i] == '\t');
+ buf[i--] = 0) { }
}
t = strtok(buf, " \t\r\n");