Remove more compiler warning.

SVN revision: 36614
This commit is contained in:
Cedric BAIL 2008-10-13 11:51:10 +00:00
parent 9ff9555cc7
commit 2127e5c551
4 changed files with 58 additions and 47 deletions

View File

@ -51,13 +51,15 @@ struct _JPEG_error_mgr
struct jpeg_membuf_src {
struct jpeg_source_mgr pub;
const char *buf;
const unsigned char *buf;
size_t len;
};
static void
_eet_jpeg_membuf_src_init(j_decompress_ptr cinfo)
{
/* FIXME: Use attribute unused */
(void) cinfo;
}
static boolean
@ -116,7 +118,7 @@ struct jpeg_membuf_dst {
void **dst_buf;
size_t *dst_len;
char *buf;
unsigned char *buf;
size_t len;
int failed;
};
@ -124,13 +126,15 @@ struct jpeg_membuf_dst {
static void
_eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
{
/* FIXME: Use eina attribute */
(void) cinfo;
}
static boolean
_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
{
struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
char *buf;
unsigned char *buf;
if (dst->len >= 0x40000000 ||
(buf = realloc(dst->buf, dst->len * 2)) == NULL) {
@ -141,7 +145,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
}
dst->pub.next_output_byte =
buf + ((char *)dst->pub.next_output_byte - dst->buf);
buf + ((unsigned char *)dst->pub.next_output_byte - dst->buf);
dst->buf = buf;
dst->pub.free_in_buffer += dst->len;
dst->len *= 2;
@ -160,7 +164,7 @@ _eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
free(dst->buf);
} else {
*dst->dst_buf = dst->buf;
*dst->dst_len = (char *)dst->pub.next_output_byte - dst->buf;
*dst->dst_len = (unsigned char *)dst->pub.next_output_byte - dst->buf;
}
free(dst);
cinfo->dest = NULL;
@ -276,9 +280,11 @@ _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level)
static int
eet_data_image_jpeg_header_decode(const void *data, int size, unsigned int *w, unsigned int *h)
{
struct jpeg_decompress_struct cinfo = { 0 };
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct));
cinfo.err = jpeg_std_error(&(jerr.pub));
jerr.pub.error_exit = _JPEGFatalErrorHandler;
jerr.pub.emit_message = _JPEGErrorHandler2;
@ -315,17 +321,19 @@ static int
eet_data_image_jpeg_rgb_decode(const void *data, int size, unsigned int src_x, unsigned int src_y,
unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride)
{
struct jpeg_decompress_struct cinfo = { 0 };
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
unsigned char *ptr, *line[16], *tdata = NULL;
unsigned int *ptr2, *tmp;
unsigned int iw, ih;
int x, y, l, scans;
int i, count, prevy;
unsigned int x, y, l, scans;
unsigned int i, count, prevy;
/* FIXME: handle src_x, src_y and row_stride correctly */
if (!d) return 0;
memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct));
cinfo.err = jpeg_std_error(&(jerr.pub));
jerr.pub.error_exit = _JPEGFatalErrorHandler;
jerr.pub.emit_message = _JPEGErrorHandler2;
@ -373,7 +381,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, int size, unsigned int src_x, u
if (cinfo.output_components == 3)
{
for (i = 0; i < cinfo.rec_outbuf_height; i++)
for (i = 0; i < (unsigned int) cinfo.rec_outbuf_height; i++)
line[i] = tdata + (i * (iw) * 3);
for (l = 0; l < ih; l += cinfo.rec_outbuf_height)
{
@ -385,7 +393,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, int size, unsigned int src_x, u
if (l + scans >= src_y && l < src_y + h)
{
y = src_y - l;
if (y < 0) y = 0;
if (src_y < l) y = 0;
for (ptr += 3 * iw * y; y < scans && (y + l) < (src_y + h); y++)
{
tmp = ptr2;
@ -409,7 +417,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, int size, unsigned int src_x, u
}
else if (cinfo.output_components == 1)
{
for (i = 0; i < cinfo.rec_outbuf_height; i++)
for (i = 0; i < (unsigned int) cinfo.rec_outbuf_height; i++)
line[i] = tdata + (i * (iw));
for (l = 0; l < (ih); l += cinfo.rec_outbuf_height)
{
@ -421,7 +429,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, int size, unsigned int src_x, u
if (l >= src_y && l < src_y + h)
{
y = src_y - l;
if (y < 0) y = 0;
if (src_y < l) y = 0;
for (ptr += iw * y; y < scans && (y + l) < (src_y + h); y++)
{
tmp = ptr2;
@ -453,12 +461,14 @@ static void *
eet_data_image_jpeg_alpha_decode(const void *data, int size, unsigned int src_x, unsigned int src_y,
unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride)
{
struct jpeg_decompress_struct cinfo = { 0 };
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
unsigned char *ptr, *line[16], *tdata = NULL;
unsigned int *ptr2, *tmp;
int x, y, l, scans;
int i, count, prevy, iw;
unsigned int x, y, l, scans;
unsigned int i, count, prevy, iw;
memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct));
cinfo.err = jpeg_std_error(&(jerr.pub));
jerr.pub.error_exit = _JPEGFatalErrorHandler;
@ -506,7 +516,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, int size, unsigned int src_x,
prevy = 0;
if (cinfo.output_components == 1)
{
for (i = 0; i < cinfo.rec_outbuf_height; i++)
for (i = 0; i < (unsigned int) cinfo.rec_outbuf_height; i++)
line[i] = tdata + (i * w);
for (l = 0; l < h; l += cinfo.rec_outbuf_height)
{
@ -518,7 +528,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, int size, unsigned int src_x,
if (l >= src_y && l < src_y + h)
{
y = src_y - l;
if (y < 0) y = 0;
if (src_y < l) y = 0;
for (ptr += iw * y; y < scans && (y + l) < (src_y + h); y++)
{
tmp = ptr2;
@ -651,19 +661,20 @@ eet_data_image_lossless_compressed_convert(int *size, const void *data, unsigned
static void *
eet_data_image_jpeg_convert(int *size, const void *data, unsigned int w, unsigned int h, int alpha, int quality)
{
struct jpeg_compress_struct cinfo;
struct _JPEG_error_mgr jerr;
const int *ptr;
void *d = NULL;
size_t sz = 0;
struct _JPEG_error_mgr jerr;
JSAMPROW *jbuf;
struct jpeg_compress_struct cinfo;
FILE *f;
unsigned char *buf;
(void) alpha; /* unused */
buf = alloca(3 * w);
memset(&cinfo, 0, sizeof (struct jpeg_compress_struct));
cinfo.err = jpeg_std_error(&(jerr.pub));
jerr.pub.error_exit = _JPEGFatalErrorHandler;
jerr.pub.emit_message = _JPEGErrorHandler2;

View File

@ -47,6 +47,10 @@ void *alloca (size_t);
# include <Evil.h>
#endif
#ifdef HAVE_OPENSSL
# include <openssl/err.h>
#endif
#include "Eet.h"
#include "Eet_private.h"
@ -902,7 +906,7 @@ eet_internal_read2(Eet_File *ef)
const int *dico = (const int*) ef->data + EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries + EET_FILE2_HEADER_COUNT;
int j;
if (eet_test_close((num_dictionary_entries * EET_FILE2_DICTIONARY_ENTRY_SIZE + index) > (bytes_dictionary_entries + bytes_directory_entries), ef))
if (eet_test_close((num_dictionary_entries * (int) EET_FILE2_DICTIONARY_ENTRY_SIZE + index) > (bytes_dictionary_entries + bytes_directory_entries), ef))
return NULL;
ef->ed = calloc(1, sizeof (Eet_Dictionary));
@ -1016,7 +1020,7 @@ eet_internal_read1(Eet_File *ef)
return NULL;
/* check we will not outrun the file limit */
if (eet_test_close(((byte_entries + sizeof(int) * 3) > ef->data_size), ef))
if (eet_test_close(((byte_entries + (int) sizeof(int) * 3) > ef->data_size), ef))
return NULL;
/* allocate header */
@ -1150,7 +1154,7 @@ eet_internal_read(Eet_File *ef)
if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
return NULL;
if (eet_test_close(ef->data_size < sizeof(int) * 3, ef))
if (eet_test_close(ef->data_size < (int) sizeof(int) * 3, ef))
return NULL;
switch (ntohl(*data))
@ -1249,7 +1253,7 @@ eet_open(const char *file, Eet_File_Mode mode)
goto on_error;
}
if ((mode == EET_FILE_MODE_READ) &&
(file_stat.st_size < (sizeof(int) * 3)))
(file_stat.st_size < ((int) sizeof(int) * 3)))
{
fclose(fp);
fp = NULL;

View File

@ -12,6 +12,8 @@ _eet_str_direct_alloc(const char *str)
static void
_eet_str_direct_free(const char *str)
{
/* FIXME: Use attribute unused */
(void) str;
}
/* Internal list stuff. */
@ -106,8 +108,6 @@ Eet_Hash*
eet_hash_add(Eet_Hash *hash, const char *key, const void *data)
{
Eet_Hash_Item *item;
Eet_List *find;
int index;
if (!hash) hash = calloc(1, sizeof (Eet_Hash));
if (!hash) return NULL;
@ -150,14 +150,14 @@ eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc)
eddc->func.mem_free = NULL;
eddc->func.str_alloc = NULL;
eddc->func.str_free = NULL;
eddc->func.list_next = eet_list_next;
eddc->func.list_append = eet_list_prepend;
eddc->func.list_data = eet_list_data;
eddc->func.list_free = eet_list_free;
eddc->func.hash_foreach = eet_hash_foreach;
eddc->func.hash_add = eet_hash_add;
eddc->func.hash_free = eet_hash_free;
eddc->func.str_direct_alloc = _eet_str_direct_alloc;
eddc->func.str_direct_free = _eet_str_direct_free;
eddc->func.list_next = (void*) eet_list_next;
eddc->func.list_append = (void*) eet_list_prepend;
eddc->func.list_data = (void*) eet_list_data;
eddc->func.list_free = (void*) eet_list_free;
eddc->func.hash_foreach = (void*) eet_hash_foreach;
eddc->func.hash_add = (void*) eet_hash_add;
eddc->func.hash_free = (void*) eet_hash_free;
eddc->func.str_direct_alloc = (void*) _eet_str_direct_alloc;
eddc->func.str_direct_free = (void*) _eet_str_direct_free;
}

View File

@ -449,6 +449,9 @@ func(const Eet_Hash *hash, const char *key, void *data, void *fdata)
{
int *res = fdata;
/* FIXME: Use attribute unused */
(void) hash;
if (strcmp(key, EET_TEST_KEY1) != 0
&& strcmp(key, EET_TEST_KEY2) != 0) *res = 1;
if (_eet_test_ex_check(data, 2)) *res = 1;
@ -462,6 +465,10 @@ func7(const Eet_Hash *hash, const char *key, void *data, void *fdata)
int *res = fdata;
int *val;
/* FIXME: Use attribute unused */
(void) hash;
(void) key;
val = data;
if (!val) *res = 1;
if (*val != 7) *res = 1;
@ -535,7 +542,6 @@ START_TEST(eet_test_data_type_dump_undump)
{
Eet_Data_Descriptor *edd;
Eet_Test_Ex_Type *result;
Eet_Test_Ex_Type *tmp;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
char *transfert1;
@ -546,8 +552,6 @@ START_TEST(eet_test_data_type_dump_undump)
int size2;
int test;
int i;
eet_init();
_eet_test_ex_set(&etbt, 0);
@ -793,23 +797,15 @@ END_TEST
START_TEST(eet_file_data_dump_test)
{
const char *buffer = "Here is a string of data to save !";
Eet_Data_Descriptor *edd;
Eet_Test_Ex_Type *result;
Eet_Test_Ex_Type *tmp;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
Eet_File *ef;
char *string1;
char *string2;
char *file = strdup("/tmp/eet_suite_testXXXXXX");
int size;
int size1;
int size2;
int test;
int i;
eet_init();
_eet_test_ex_set(&etbt, 0);