git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
expose current_include_dirs
[swftools.git]
/
lib
/
jpeg.c
diff --git
a/lib/jpeg.c
b/lib/jpeg.c
index
d58215c
..
66882b0
100644
(file)
--- a/
lib/jpeg.c
+++ b/
lib/jpeg.c
@@
-298,12
+298,10
@@
int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
struct jpeg_source_mgr mgr;
FILE*fi = fopen(filename, "rb");
struct jpeg_source_mgr mgr;
FILE*fi = fopen(filename, "rb");
- if(!fi)
+ if(!fi) {
+ fprintf(stderr, "Couldn't open file %s\n", filename);
return 0;
return 0;
- fseek(fi, SEEK_END, 0);
- long filesize = ftell(fi);
- fseek(fi, SEEK_SET, 0);
- fclose(fi);
+ }
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
@@
-315,13
+313,13
@@
int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
- *dest = malloc(width*height*4);
+ *dest = (unsigned char*)malloc(width*height*4);
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
- RGBA*line = (RGBA*)&(*dest)[y*width];
+ RGBA*line = &((RGBA*)(*dest))[y*width];
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {