for (line = getNextLine(line);
line && strncmp(line, "readonly def", 12);
line = getNextLine(line)) ;
+ if (line) {
+ line = getNextLine(line);
+ }
}
if (line) {
(*outputFunc)(outputStream, line, ((char *)file + len) - line);
encoding = fofiType1StandardEncoding;
} else if (!encoding &&
!strncmp(line, "/Encoding 256 array", 19)) {
- encoding = (char **)gmalloc(256 * sizeof(char *));
+ encoding = (char **)gmallocn(256, sizeof(char *));
for (j = 0; j < 256; ++j) {
encoding[j] = NULL;
}
- line = getNextLine(line);
- for (j = 0; j < 300 && line; ++j) {
- line1 = getNextLine(line);
+ for (j = 0, line = getNextLine(line);
+ j < 300 && line && (line1 = getNextLine(line));
+ ++j, line = line1) {
if ((n = line1 - line) > 255) {
n = 255;
}
}
}
} else {
- if (strtok(buf, " \t") &&
- (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) {
- break;
+ p = strtok(buf, " \t\n\r");
+ if (p)
+ {
+ if (!strcmp(p, "def")) break;
+ if (!strcmp(p, "readonly")) break;
+ // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array
+ p = strtok(buf, " \t\n\r");
+ if (p && !strcmp(p, "def")) break;
}
}
- line = line1;
}
//~ check for getinterval/putinterval junk
} else {
line = getNextLine(line);
}
-
- ++i;
}
parsed = gTrue;