Mercurial > emacs
comparison src/w32fns.c @ 50164:61b178f7f6dc
(jpeg_load, png_load, slurp_file): Read image files
as binary.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sun, 16 Mar 2003 22:12:25 +0000 |
parents | a62497b91c74 |
children | e3a41ffa1cba |
comparison
equal
deleted
inserted
replaced
50163:6f30f0db5f30 | 50164:61b178f7f6dc |
---|---|
9533 FILE *fp = NULL; | 9533 FILE *fp = NULL; |
9534 char *buf = NULL; | 9534 char *buf = NULL; |
9535 struct stat st; | 9535 struct stat st; |
9536 | 9536 |
9537 if (stat (file, &st) == 0 | 9537 if (stat (file, &st) == 0 |
9538 && (fp = fopen (file, "r")) != NULL | 9538 && (fp = fopen (file, "rb")) != NULL |
9539 && (buf = (char *) xmalloc (st.st_size), | 9539 && (buf = (char *) xmalloc (st.st_size), |
9540 fread (buf, 1, st.st_size, fp) == st.st_size)) | 9540 fread (buf, 1, st.st_size, fp) == st.st_size)) |
9541 { | 9541 { |
9542 *size = st.st_size; | 9542 *size = st.st_size; |
9543 fclose (fp); | 9543 fclose (fp); |
11400 FILE *fp = NULL; | 11400 FILE *fp = NULL; |
11401 char *buf = NULL; | 11401 char *buf = NULL; |
11402 struct stat st; | 11402 struct stat st; |
11403 | 11403 |
11404 if (stat (SDATA (file), &st) == 0 | 11404 if (stat (SDATA (file), &st) == 0 |
11405 && (fp = fopen (SDATA (file), "r")) != NULL | 11405 && (fp = fopen (SDATA (file), "rb")) != NULL |
11406 && (buf = (char *) xmalloc (st.st_size), | 11406 && (buf = (char *) xmalloc (st.st_size), |
11407 fread (buf, 1, st.st_size, fp) == st.st_size)) | 11407 fread (buf, 1, st.st_size, fp) == st.st_size)) |
11408 { | 11408 { |
11409 *size = st.st_size; | 11409 *size = st.st_size; |
11410 fclose (fp); | 11410 fclose (fp); |
12493 image_error ("Cannot find image file `%s'", specified_file, Qnil); | 12493 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
12494 UNGCPRO; | 12494 UNGCPRO; |
12495 return 0; | 12495 return 0; |
12496 } | 12496 } |
12497 | 12497 |
12498 fp = fopen (SDATA (file), "r"); | 12498 fp = fopen (SDATA (file), "rb"); |
12499 if (fp == NULL) | 12499 if (fp == NULL) |
12500 { | 12500 { |
12501 image_error ("Cannot open `%s'", file, Qnil); | 12501 image_error ("Cannot open `%s'", file, Qnil); |
12502 UNGCPRO; | 12502 UNGCPRO; |
12503 return 0; | 12503 return 0; |