From: Bruno Haible Date: Wed, 9 Jan 2002 12:34:04 +0000 (+0000) Subject: Fix two while loops. X-Git-Tag: v0.11~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a8e58ba59eee0dded31bdb5bf2e5ddb61b27ccc;p=thirdparty%2Fgettext.git Fix two while loops. --- diff --git a/src/ChangeLog b/src/ChangeLog index ee8cfe47e..61289d5cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-01-09 Bruno Haible + + * x-java.l (strip_ending_spaces): Fix logic. + +2002-01-09 Tommy Johansson + + * x-java.l: Avoid endless loop when encountering unterminated string. + 2002-01-08 Bruno Haible * message.h (format_type): New enum value 'format_elisp'. diff --git a/src/x-java.l b/src/x-java.l index 02053e93c..6e6bd998e 100644 --- a/src/x-java.l +++ b/src/x-java.l @@ -164,8 +164,8 @@ strip_ending_spaces (str) { int len = strlen (str); - while (isspace ((unsigned char) str[len--])) - ; + while (len > 0 && isspace ((unsigned char) str[len - 1])) + len--; str[len] = '\0'; } %} @@ -205,7 +205,7 @@ ID [a-zA-Z_][a-zA-Z0-9_]* int c; char *str; char_buf *charbuf = create_char_buf (); - while ((c = input ()) != '"') + while ((c = input ()) != EOF && c != '"') { update_line_no (c); append_char_buf (charbuf, c);