fix set-but-not-used errors from newer gcc.

SVN revision: 67352
This commit is contained in:
Gustavo Sverzut Barbieri 2012-01-19 16:35:47 +00:00
parent 12af485e26
commit 883923028e
4 changed files with 72 additions and 90 deletions

View File

@ -107,12 +107,8 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
void *map = NULL; void *map = NULL;
size_t position = 0; size_t position = 0;
char hasa = 0; char hasa = 0;
int w = 0, h = 0, planes = 0, bit_count = 0, int w = 0, h = 0, bit_count = 0, image_size = 0, comp = 0;
image_size = 0, comp = 0, hdpi = 0, vdpi = 0, unsigned int offset, head_size, amask = 0;
palette_size = -1, important_colors = 0;
unsigned int offset, head_size, rmask = 0, gmask = 0, bmask = 0, amask = 0;
unsigned int pal_num = 0;
int right_way_up = 0;
int fsize = 0; int fsize = 0;
unsigned int bmpsize; unsigned int bmpsize;
unsigned short res1, res2; unsigned short res1, res2;
@ -148,7 +144,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
h = tmp; // height h = tmp; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8 & 24 bit_count = tmp; // bits per pixel: 1, 4, 8 & 24
} }
@ -162,7 +158,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -170,13 +166,13 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) //palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_skip(fsize, &position, 24)) goto close_file; // skip unused header if (!read_skip(fsize, &position, 24)) goto close_file; // skip unused header
if (image_size == 0) image_size = fsize - offset; if (image_size == 0) image_size = fsize - offset;
} }
@ -190,7 +186,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -198,13 +194,13 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) //palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (image_size == 0) image_size = fsize - offset; if (image_size == 0) image_size = fsize - offset;
if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way
} }
@ -218,7 +214,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -226,19 +222,19 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) //palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
rmask = tmp2; // red mask //rmask = tmp2; // red mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
gmask = tmp2; // green mask //gmask = tmp2; // green mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
bmask = tmp2; // blue mask //bmask = tmp2; // blue mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
amask = tmp2; // alpha mask amask = tmp2; // alpha mask
if (!read_skip(fsize, &position, 36)) goto close_file; // skip unused cie if (!read_skip(fsize, &position, 36)) goto close_file; // skip unused cie
@ -256,27 +252,27 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
comp = tmp2; // compression method comp = tmp2; // compression method
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size //image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) //palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
rmask = tmp2; // red mask //rmask = tmp2; // red mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
gmask = tmp2; // green mask //gmask = tmp2; // green mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
bmask = tmp2; // blue mask //bmask = tmp2; // blue mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
amask = tmp2; // alpha mask amask = tmp2; // alpha mask
if (!read_skip(fsize, &position, 36)) goto close_file; // skip unused cie if (!read_skip(fsize, &position, 36)) goto close_file; // skip unused cie
@ -291,7 +287,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (h < 0) if (h < 0)
{ {
h = -h; h = -h;
right_way_up = 1; //right_way_up = 1;
} }
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) || if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
@ -313,8 +309,8 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
if (bit_count < 16) if (bit_count < 16)
{ {
if ((palette_size < 0) || (palette_size > 256)) pal_num = 256; //if ((palette_size < 0) || (palette_size > 256)) pal_num = 256;
else pal_num = palette_size; //else pal_num = palette_size;
if (bit_count == 1) if (bit_count == 1)
{ {
if (comp == 0) // no compression if (comp == 0) // no compression
@ -389,8 +385,8 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
size_t position = 0; size_t position = 0;
unsigned char *buffer = NULL, *buffer_end = NULL, *p; unsigned char *buffer = NULL, *buffer_end = NULL, *p;
char hasa = 0; char hasa = 0;
int x = 0, y = 0, w = 0, h = 0, planes = 0, bit_count = 0, image_size = 0, int x = 0, y = 0, w = 0, h = 0, bit_count = 0, image_size = 0,
comp = 0, hdpi = 0, vdpi = 0, palette_size = -1, important_colors = 0; comp = 0, palette_size = -1;
unsigned int offset = 0, head_size = 0; unsigned int offset = 0, head_size = 0;
unsigned int *pal = NULL, pal_num = 0, *pix = NULL, *surface = NULL, fix, unsigned int *pal = NULL, pal_num = 0, *pix = NULL, *surface = NULL, fix,
rmask = 0, gmask = 0, bmask = 0, amask = 0; rmask = 0, gmask = 0, bmask = 0, amask = 0;
@ -440,7 +436,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
h = tmp; // height h = tmp; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8 & 24 bit_count = tmp; // bits per pixel: 1, 4, 8 & 24
} }
@ -454,7 +450,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -462,13 +458,13 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_skip(fsize, &position, 24)) goto close_file; // skip unused header if (!read_skip(fsize, &position, 24)) goto close_file; // skip unused header
if (image_size == 0) image_size = fsize - offset; if (image_size == 0) image_size = fsize - offset;
} }
@ -482,7 +478,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -490,13 +486,13 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (image_size == 0) image_size = fsize - offset; if (image_size == 0) image_size = fsize - offset;
if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way
} }
@ -510,7 +506,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -518,13 +514,13 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
rmask = tmp2; // red mask rmask = tmp2; // red mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -548,7 +544,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
h = tmp2; // height h = tmp2; // height
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
planes = tmp; // must be 1 //planes = tmp; // must be 1
if (!read_short(map, fsize, &position, &tmp)) goto close_file; if (!read_short(map, fsize, &position, &tmp)) goto close_file;
bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32 bit_count = tmp; // bits per pixel: 1, 4, 8, 16, 24 & 32
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@ -556,13 +552,13 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
image_size = tmp2; // bitmap data size image_size = tmp2; // bitmap data size
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter //vdpi = (tmp2 * 254) / 10000; // vertical pixles/meter
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8) palette_size = tmp2; // number of palette colors power (2^n - so 0 - 8)
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all //important_colors = tmp2; // number of important colors - 0 if all
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
rmask = tmp2; // red mask rmask = tmp2; // red mask
if (!read_int(map, fsize, &position, &tmp2)) goto close_file; if (!read_int(map, fsize, &position, &tmp2)) goto close_file;

View File

@ -88,7 +88,7 @@ evas_image_load_file_head_ico(Image_Entry *ie, const char *file, const char *key
unsigned short word; unsigned short word;
unsigned char byte; unsigned char byte;
int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0, int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0,
hot_x = 0, hot_y = 0, bpp = 0, pdelta, search = -1, have_choice = 0, bpp = 0, pdelta, search = -1, have_choice = 0,
hasa = 1; hasa = 1;
unsigned int bmoffset, bmsize, fsize; unsigned int bmoffset, bmsize, fsize;
unsigned short reserved, type, count; unsigned short reserved, type, count;
@ -182,10 +182,10 @@ evas_image_load_file_head_ico(Image_Entry *ie, const char *file, const char *key
if (!read_uchar(map, fsize, &position, &byte)) goto close_file; if (!read_uchar(map, fsize, &position, &byte)) goto close_file;
if (!read_ushort(map, fsize, &position, &word)) goto close_file; if (!read_ushort(map, fsize, &position, &word)) goto close_file;
if (type == CURSOR) planes = word; if (type == CURSOR) planes = word;
else hot_x = word; //else hot_x = word;
if (!read_ushort(map, fsize, &position, &word)) goto close_file; if (!read_ushort(map, fsize, &position, &word)) goto close_file;
if (type == CURSOR) bpp = word; if (type == CURSOR) bpp = word;
else hot_y = word; //else hot_y = word;
if (!read_uint(map, fsize, &position, &bmsize)) goto close_file; if (!read_uint(map, fsize, &position, &bmsize)) goto close_file;
if (!read_uint(map, fsize, &position, &bmoffset)) goto close_file; if (!read_uint(map, fsize, &position, &bmoffset)) goto close_file;
if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file; if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file;
@ -315,11 +315,11 @@ evas_image_load_file_data_ico(Image_Entry *ie, const char *file, const char *key
unsigned char byte; unsigned char byte;
unsigned int dword; unsigned int dword;
int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0, int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0,
hot_x = 0, hot_y = 0, bpp = 0, pdelta, search = -1, have_choice = 0, bpp = 0, pdelta, search = -1, have_choice = 0,
stride, pstride, j, right_way_up = 0, diff_size = 0, cols2; stride, pstride, j, right_way_up = 0, diff_size = 0, cols2;
unsigned int bmoffset, bmsize, bitcount, compression, imagesize, fsize, unsigned int bmoffset, bmsize, bitcount, fsize,
colorsused, colorsimportant, *pal, *surface, *pix, none_zero_alpha = 0; *pal, *surface, *pix, none_zero_alpha = 0;
unsigned short reserved, type, count, planes2; unsigned short reserved, type, count;
unsigned char *maskbuf, *pixbuf, *p; unsigned char *maskbuf, *pixbuf, *p;
struct { struct {
int pdelta; int pdelta;
@ -411,10 +411,10 @@ evas_image_load_file_data_ico(Image_Entry *ie, const char *file, const char *key
if (!read_uchar(map, fsize, &position, &byte)) goto close_file; if (!read_uchar(map, fsize, &position, &byte)) goto close_file;
if (!read_ushort(map, fsize, &position, &word)) goto close_file; if (!read_ushort(map, fsize, &position, &word)) goto close_file;
if (type == 1) planes = word; if (type == 1) planes = word;
else hot_x = word; //else hot_x = word;
if (!read_ushort(map, fsize, &position, &word)) goto close_file; if (!read_ushort(map, fsize, &position, &word)) goto close_file;
if (type == 1) bpp = word; if (type == 1) bpp = word;
else hot_y = word; //else hot_y = word;
if (!read_uint(map, fsize, &position, &bmsize)) goto close_file; if (!read_uint(map, fsize, &position, &bmsize)) goto close_file;
if (!read_uint(map, fsize, &position, &bmoffset)) goto close_file; if (!read_uint(map, fsize, &position, &bmoffset)) goto close_file;
if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file; if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file;
@ -540,19 +540,19 @@ evas_image_load_file_data_ico(Image_Entry *ie, const char *file, const char *key
file, ie->w, ie->h, w, h); file, ie->w, ie->h, w, h);
} }
if (!read_ushort(map, fsize, &position, &word)) goto close_file; // planes if (!read_ushort(map, fsize, &position, &word)) goto close_file; // planes
planes2 = word; //planes2 = word;
if (!read_ushort(map, fsize, &position, &word)) goto close_file; // bitcount if (!read_ushort(map, fsize, &position, &word)) goto close_file; // bitcount
bitcount = word; bitcount = word;
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // compression if (!read_uint(map, fsize, &position, &dword)) goto close_file; // compression
compression = dword; //compression = dword;
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // imagesize if (!read_uint(map, fsize, &position, &dword)) goto close_file; // imagesize
imagesize = dword; //imagesize = dword;
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // z pixels per m if (!read_uint(map, fsize, &position, &dword)) goto close_file; // z pixels per m
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // y pizels per m if (!read_uint(map, fsize, &position, &dword)) goto close_file; // y pizels per m
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // colors used if (!read_uint(map, fsize, &position, &dword)) goto close_file; // colors used
colorsused = dword; //colorsused = dword;
if (!read_uint(map, fsize, &position, &dword)) goto close_file; // colors important if (!read_uint(map, fsize, &position, &dword)) goto close_file; // colors important
colorsimportant = dword; //colorsimportant = dword;
evas_cache_image_surface_alloc(ie, ie->w, ie->h); evas_cache_image_surface_alloc(ie, ie->w, ie->h);
surface = evas_cache_image_pixels(ie); surface = evas_cache_image_pixels(ie);

View File

@ -509,12 +509,10 @@ get_single_channel(Image_Entry *ie __UNUSED__,
Eina_Bool compressed) Eina_Bool compressed)
{ {
unsigned int i, bpc; unsigned int i, bpc;
unsigned short *tmp;
char headbyte; char headbyte;
int c; int c;
int pixels_count; int pixels_count;
tmp = (unsigned short*)buffer;
bpc = (head->depth / 8); bpc = (head->depth / 8);
pixels_count = head->width * head->height; pixels_count = head->width * head->height;
@ -569,7 +567,6 @@ read_psd_grey(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_
{ {
unsigned int color_mode, resource_size, misc_info; unsigned int color_mode, resource_size, misc_info;
unsigned short compressed; unsigned short compressed;
unsigned int type;
void *surface = NULL; void *surface = NULL;
*error = EVAS_LOAD_ERROR_CORRUPT_FILE; *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
@ -602,10 +599,7 @@ read_psd_grey(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_
switch (head->depth) switch (head->depth)
{ {
case 8: case 8:
type = 1;
break;
case 16: case 16:
type = 2;
break; break;
default: default:
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
@ -697,7 +691,6 @@ read_psd_rgb(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_t
{ {
unsigned int color_mode, resource_size, misc_info; unsigned int color_mode, resource_size, misc_info;
unsigned short compressed; unsigned short compressed;
unsigned int type;
void *surface; void *surface;
#define CHECK_RET(Call) \ #define CHECK_RET(Call) \
@ -721,10 +714,7 @@ read_psd_rgb(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_t
switch (head->depth) switch (head->depth)
{ {
case 8: case 8:
type = 1;
break;
case 16: case 16:
type = 2;
break; break;
default: default:
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
@ -758,7 +748,7 @@ read_psd_rgb(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_t
Eina_Bool Eina_Bool
read_psd_cmyk(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error) read_psd_cmyk(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error)
{ {
unsigned int color_mode, resource_size, misc_info, size, i, j, data_size; unsigned int color_mode, resource_size, misc_info, size, j, data_size;
unsigned short compressed; unsigned short compressed;
unsigned int format, type; unsigned int format, type;
unsigned char *kchannel = NULL; unsigned char *kchannel = NULL;
@ -841,7 +831,7 @@ read_psd_cmyk(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_
unsigned char *tmp = surface; unsigned char *tmp = surface;
const unsigned char *limit = tmp + data_size; const unsigned char *limit = tmp + data_size;
for (i = 0, j = 0; tmp < limit; tmp++, j++) for (j = 0; tmp < limit; tmp++, j++)
{ {
int k; int k;
@ -857,7 +847,7 @@ read_psd_cmyk(Image_Entry *ie, PSD_Header *head, const unsigned char *map, size_
const unsigned char *limit = tmp + data_size; const unsigned char *limit = tmp + data_size;
// The KChannel array really holds the alpha channel on this one. // The KChannel array really holds the alpha channel on this one.
for (i = 0, j = 0; tmp < limit; tmp += 4, j++) for (j = 0; tmp < limit; tmp += 4, j++)
{ {
tmp[0] = (tmp[0] * tmp[3]) >> 8; tmp[0] = (tmp[0] * tmp[3]) >> 8;
tmp[1] = (tmp[1] * tmp[3]) >> 8; tmp[1] = (tmp[1] * tmp[3]) >> 8;

View File

@ -76,10 +76,9 @@ evas_image_load_file_head_tga(Image_Entry *ie, const char *file, const char *key
unsigned char *seg = NULL, *filedata; unsigned char *seg = NULL, *filedata;
tga_header *header; tga_header *header;
tga_footer *footer, tfooter; tga_footer *footer, tfooter;
char hasa = 0, footer_present = 0, vinverted = 0; char hasa = 0;
int w = 0, h = 0, bpp; int w = 0, h = 0, bpp;
int x, y; int x, y;
int abits;
f = eina_file_open(file, EINA_FALSE); f = eina_file_open(file, EINA_FALSE);
*error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
@ -98,7 +97,7 @@ evas_image_load_file_head_tga(Image_Entry *ie, const char *file, const char *key
memcpy((unsigned char *)(&tfooter), memcpy((unsigned char *)(&tfooter),
(unsigned char *)footer, (unsigned char *)footer,
sizeof(tga_footer)); sizeof(tga_footer));
printf("0\n"); //printf("0\n");
if (!memcmp(tfooter.signature, TGA_SIGNATURE, sizeof(tfooter.signature))) if (!memcmp(tfooter.signature, TGA_SIGNATURE, sizeof(tfooter.signature)))
{ {
if ((tfooter.dot == '.') && (tfooter.null == 0)) if ((tfooter.dot == '.') && (tfooter.null == 0))
@ -106,14 +105,12 @@ evas_image_load_file_head_tga(Image_Entry *ie, const char *file, const char *key
// footer is there and matches. this is a tga file - any problems now // footer is there and matches. this is a tga file - any problems now
// are a corrupt file // are a corrupt file
*error = EVAS_LOAD_ERROR_CORRUPT_FILE; *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
footer_present = 1;
} }
} }
// else goto close_file; // else goto close_file;
printf("1\n"); //printf("1\n");
filedata = (unsigned char *)filedata + sizeof(tga_header); filedata = (unsigned char *)filedata + sizeof(tga_header);
vinverted = !(header->descriptor & TGA_DESC_VERTICAL);
switch (header->imageType) switch (header->imageType)
{ {
case TGA_TYPE_COLOR_RLE: case TGA_TYPE_COLOR_RLE:
@ -131,7 +128,6 @@ evas_image_load_file_head_tga(Image_Entry *ie, const char *file, const char *key
if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8))) if (!((bpp == 32) || (bpp == 24) || (bpp == 16) || (bpp == 8)))
goto close_file; goto close_file;
if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1; if ((bpp == 32) && (header->descriptor & TGA_DESC_ABITS)) hasa = 1;
abits = header->descriptor & TGA_DESC_ABITS;
// don't handle colormapped images // don't handle colormapped images
if ((header->colorMapType) != 0) if ((header->colorMapType) != 0)
goto close_file; goto close_file;