From: Patrice Fournier Date: Fri, 5 Feb 2010 23:34:34 +0000 (-0500) Subject: Correctly check for long lines when checking for the last match X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=aa781806c11f77b4fa569e2e8a995ea859d3833e;p=thirdparty%2FHylaFAX.git Correctly check for long lines when checking for the last match Bodo Meissner found that textfmt would wrongfully return a line too long error message in some circumstances and suggested a fix for this. --- diff --git a/libhylafax/TextFormat.c++ b/libhylafax/TextFormat.c++ index dad03789..5aba4230 100644 --- a/libhylafax/TextFormat.c++ +++ b/libhylafax/TextFormat.c++ @@ -1190,13 +1190,13 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg) fxStr val = tmp; while (fgets(buf, sizeof(buf), fd) != NULL) { len = strcspn(buf, "%\n"); - *(buf + len) = '\0'; if (len == strlen(buf)) { emsg = fxStr::format( NLS::TEXT("Warning: %s - line too long."), (const char*) fontMapFile); break; } if (len == 0) continue; + *(buf + len) = '\0'; tmp = buf + strcspn(buf, ") \t"); *tmp++ = '\0'; tmp += strspn(tmp, " \t");