1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-19 21:34:12 +01:00

Fixed bug related to incorrect reading of ppm files.

This commit is contained in:
dan
2000-09-28 12:07:38 +00:00
parent 8382063736
commit 44fd05f1c3

View File

@@ -46,14 +46,14 @@ load_graymap(char *file_name, FILE *file, int w, int h, int max, int raw)
int x, y; int x, y;
char *buf, *ptr; char *buf, *ptr;
buf = malloc(w); buf = malloc(w+1);
if (!buf) { if (!buf) {
return NULL; return NULL;
} }
ptr = image->data; ptr = image->data;
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
if (!fgets(buf, w, file)) { if (!fread(buf, w, 1, file)) {
free(buf); free(buf);
goto short_file; goto short_file;
} }