Browse code

remove some warnings from gcc

git-svn: trunk@2674

Tomasz Kojm authored on 2007/02/05 02:00:53
Showing 7 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sun Feb  4 17:58:16 CET 2007 (tk)
2
+---------------------------------
3
+  * libclamav: remove some warnings from gcc
4
+
1 5
 Sun Feb  4 00:33:54 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * sigtool/sigtool.c: --build now allows to manually specify path to current
... ...
@@ -126,7 +126,7 @@ static const struct cli_magic_s cli_magic[] = {
126 126
     /* Others */
127 127
 
128 128
     {0,  "\320\317\021\340\241\261\032\341", 8, "OLE2 container", CL_TYPE_MSOLE2},
129
-    {0,  "\%PDF-",			 5, "PDF document", CL_TYPE_PDF},
129
+    {0,  "%PDF-",			 5, "PDF document", CL_TYPE_PDF},
130 130
     {0,  "\266\271\254\256\376\377\377\377", 8, "CryptFF", CL_TYPE_CRYPTFF},
131 131
     {0,  "{\\rtf",                           5, "RTF", CL_TYPE_RTF}, 
132 132
 
... ...
@@ -137,7 +137,7 @@ static const struct cli_magic_s cli_magic[] = {
137 137
     {0,  "OggS",                         4, "Ogg Stream",         CL_TYPE_DATA},
138 138
     {0,  "ID3",				 3, "MP3",		  CL_TYPE_DATA},
139 139
     {0,  "\377\373\220",		 3, "MP3",		  CL_TYPE_DATA},
140
-    {0,  "\%!PS-Adobe-",		11, "PostScript",	  CL_TYPE_DATA},
140
+    {0,  "%!PS-Adobe-",			11, "PostScript",	  CL_TYPE_DATA},
141 141
     {0,  "\060\046\262\165\216\146\317", 7, "WMA/WMV/ASF",	  CL_TYPE_DATA},
142 142
     {0,  ".RMF" ,			 4, "Real Media File",	  CL_TYPE_DATA},
143 143
 
... ...
@@ -272,9 +272,9 @@ cli_file_t cli_filetype2(int desc, const struct cl_engine *engine)
272 272
 	    if(cli_ac_initdata(&mdata, root->ac_partsigs, AC_DEFAULT_TRACKLEN))
273 273
 		return ret;
274 274
 
275
-	    decoded = cli_utf16toascii(smallbuff, bread);
275
+	    decoded = (unsigned char *) cli_utf16toascii((char *) smallbuff, bread);
276 276
 	    if(decoded) {
277
-		sret = cli_ac_scanbuff(decoded, strlen(decoded), NULL, engine->root[0], &mdata, 1, 0, 0, -1, NULL);
277
+		sret = cli_ac_scanbuff(decoded, strlen((char *) decoded), NULL, engine->root[0], &mdata, 1, 0, 0, -1, NULL);
278 278
 		free(decoded);
279 279
 		if(sret == CL_TYPE_HTML)
280 280
 		    ret = CL_TYPE_HTML_UTF16;
... ...
@@ -124,7 +124,7 @@ struct cli_md5_node *cli_vermd5(const unsigned char *md5, const struct cl_engine
124 124
 off_t cli_caloff(const char *offstr, struct cli_target_info *info, int fd, cli_file_t ftype, int *ret)
125 125
 {
126 126
 	int (*einfo)(int, struct cli_exe_info *) = NULL;
127
-	unsigned int n;
127
+	unsigned int n, val;
128 128
 	off_t pos, offset;
129 129
 
130 130
 
... ...
@@ -176,16 +176,16 @@ off_t cli_caloff(const char *offstr, struct cli_target_info *info, int fd, cli_f
176 176
 
177 177
 	if(!strncmp(offstr, "SL", 2) && info->exeinfo.section[info->exeinfo.nsections - 1].rsz) {
178 178
 
179
-	    if(sscanf(offstr, "SL+%lu", &offset) != 1) {
179
+	    if(sscanf(offstr, "SL+%u", &val) != 1) {
180 180
 		*ret = -1;
181 181
 		return 0;
182 182
 	    }
183 183
 
184
-	    offset += info->exeinfo.section[info->exeinfo.nsections - 1].raw;
184
+	    offset = val + info->exeinfo.section[info->exeinfo.nsections - 1].raw;
185 185
 
186 186
 	} else {
187 187
 
188
-	    if(sscanf(offstr, "S%u+%lu", &n, &offset) != 2) {
188
+	    if(sscanf(offstr, "S%u+%u", &n, &val) != 2) {
189 189
 		*ret = -1;
190 190
 		return 0;
191 191
 	    }
... ...
@@ -195,7 +195,7 @@ off_t cli_caloff(const char *offstr, struct cli_target_info *info, int fd, cli_f
195 195
 		return 0;
196 196
 	    }
197 197
 
198
-	    offset += info->exeinfo.section[n].raw;
198
+	    offset = val + info->exeinfo.section[n].raw;
199 199
 	}
200 200
 
201 201
 	return offset;
... ...
@@ -69,8 +69,8 @@
69 69
 
70 70
 typedef struct ole2_header_tag
71 71
 {
72
-	unsigned char magic[8] __attribute__ ((packed));		/* should be: 0xd0cf11e0a1b11ae1 */
73
-	unsigned char clsid[16] __attribute__ ((packed));
72
+	unsigned char magic[8];		/* should be: 0xd0cf11e0a1b11ae1 */
73
+	unsigned char clsid[16];
74 74
 	uint16_t minor_version __attribute__ ((packed));
75 75
 	uint16_t dll_version __attribute__ ((packed));
76 76
 	int16_t byte_order __attribute__ ((packed));			/* -2=intel */
... ...
@@ -102,15 +102,15 @@ typedef struct ole2_header_tag
102 102
 
103 103
 typedef struct property_tag
104 104
 {
105
-	unsigned char name[64] __attribute__ ((packed));		/* in unicode */
105
+	char name[64];		/* in unicode */
106 106
 	uint16_t name_size __attribute__ ((packed));
107
-	unsigned char type __attribute__ ((packed));			/* 1=dir 2=file 5=root */
108
-	unsigned char color __attribute__ ((packed));			/* black or red */
107
+	unsigned char type;		/* 1=dir 2=file 5=root */
108
+	unsigned char color;		/* black or red */
109 109
 	uint32_t prev __attribute__ ((packed));
110 110
 	uint32_t next __attribute__ ((packed));
111 111
 	uint32_t child __attribute__ ((packed));
112 112
 
113
-	unsigned char clsid[16] __attribute__ ((packed));
113
+	unsigned char clsid[16];
114 114
 	uint32_t user_flags __attribute__ ((packed));
115 115
 
116 116
 	uint32_t create_lowdate __attribute__ ((packed));
... ...
@@ -119,14 +119,14 @@ typedef struct property_tag
119 119
 	uint32_t mod_highdate __attribute__ ((packed));
120 120
 	uint32_t start_block __attribute__ ((packed));
121 121
 	uint32_t size __attribute__ ((packed));
122
-	unsigned char reserved[4] __attribute__ ((packed));
122
+	unsigned char reserved[4];
123 123
 } property_t;
124 124
 
125 125
 #ifdef HAVE_PRAGMA_PACK
126 126
 #pragma pack()
127 127
 #endif
128 128
 
129
-unsigned char magic_id[] = { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1};
129
+static unsigned char magic_id[] = { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1};
130 130
 
131 131
 static char *get_property_name(char *name, int size)
132 132
 {
... ...
@@ -402,6 +402,7 @@ static int32_t ole2_get_sbat_data_block(int fd, ole2_header_t *hdr, void *buff,
402 402
 
403 403
 /* Read the property tree.
404 404
    It is read as just an array rather than a tree */
405
+/*
405 406
 static void ole2_read_property_tree(int fd, ole2_header_t *hdr, const char *dir,
406 407
 				int (*handler)(int fd, ole2_header_t *hdr, property_t *prop, const char *dir))
407 408
 {
... ...
@@ -443,7 +444,6 @@ static void ole2_read_property_tree(int fd, ole2_header_t *hdr, const char *dir,
443 443
 			}
444 444
 		}
445 445
 		current_block = ole2_get_next_block_number(fd, hdr, current_block);
446
-		/* Loop detection */
447 446
 		if (++count > 100000) {
448 447
 			cli_dbgmsg("ERROR: loop detected\n");
449 448
 			return;
... ...
@@ -451,14 +451,15 @@ static void ole2_read_property_tree(int fd, ole2_header_t *hdr, const char *dir,
451 451
 	}
452 452
 	return;
453 453
 }
454
+*/
454 455
 
455 456
 static void ole2_walk_property_tree(int fd, ole2_header_t *hdr, const char *dir, int32_t prop_index,
456 457
 				int (*handler)(int fd, ole2_header_t *hdr, property_t *prop, const char *dir),
457
-				int rec_level, int *file_count, const struct cl_limits *limits)
458
+				unsigned int rec_level, unsigned int *file_count, const struct cl_limits *limits)
458 459
 {
459 460
 	property_t prop_block[4];
460 461
 	int32_t index, current_block, i;
461
-	unsigned char *dirname;
462
+	char *dirname;
462 463
 
463 464
 	current_block = hdr->prop_start;
464 465
 
... ...
@@ -672,6 +673,7 @@ static int handler_writefile(int fd, ole2_header_t *hdr, property_t *prop, const
672 672
 	return TRUE;
673 673
 }
674 674
 
675
+#if !defined(HAVE_ATTRIB_PACKED) && !defined(HAVE_PRAGMA_PACK)
675 676
 static int ole2_read_header(int fd, ole2_header_t *hdr)
676 677
 {
677 678
 	int i;
... ...
@@ -731,13 +733,14 @@ static int ole2_read_header(int fd, ole2_header_t *hdr)
731 731
 	}
732 732
 	return TRUE;
733 733
 }
734
+#endif
734 735
 
735 736
 int cli_ole2_extract(int fd, const char *dirname, const struct cl_limits *limits)
736 737
 {
737 738
 	ole2_header_t hdr;
738 739
 	int hdr_size;
739 740
 	struct stat statbuf;
740
-	int file_count=0;
741
+	unsigned int file_count=0;
741 742
 	
742 743
 	cli_dbgmsg("in cli_ole2_extract()\n");
743 744
 	
... ...
@@ -795,7 +798,7 @@ int cli_ole2_extract(int fd, const char *dirname, const struct cl_limits *limits
795 795
 		return CL_EOLE2;
796 796
 	}
797 797
 
798
-	if (strncmp(hdr.magic, magic_id, 8) != 0) {
798
+	if (memcmp(hdr.magic, magic_id, 8) != 0) {
799 799
 		cli_dbgmsg("OLE2 magic failed!\n");
800 800
 #ifdef HAVE_MMAP
801 801
 		if (hdr.m_area != NULL) {
... ...
@@ -444,7 +444,7 @@ static int rtf_object_end(struct rtf_state* state,cli_ctx* ctx)
444 444
 }
445 445
 
446 446
 
447
-static void rtf_action(struct rtf_state* state,long action, const char* tempname,cli_ctx* ctx)
447
+static void rtf_action(struct rtf_state* state,long action)
448 448
 {
449 449
 	switch(action) {
450 450
 		case RTF_OBJECT:
... ...
@@ -652,7 +652,7 @@ int cli_scanrtf(int desc, cli_ctx *ctx)
652 652
 						state.controlword[state.controlword_cnt] = '\0';
653 653
 						action = tableFind(actiontable, state.controlword);
654 654
 						if(action != -1)
655
-							rtf_action(&state,action, tempname, ctx);
655
+							rtf_action(&state,action);
656 656
 						state.parse_state = PARSE_MAIN;
657 657
 						break;
658 658
 					}
... ...
@@ -121,7 +121,7 @@ typedef struct mark_header_tag
121 121
 typedef struct main_header_tag
122 122
 {
123 123
 	uint16_t head_crc __attribute__ ((packed));
124
-	uint8_t head_type __attribute__ ((packed));
124
+	uint8_t head_type;
125 125
 	uint16_t flags __attribute__ ((packed));
126 126
 	uint16_t head_size __attribute__ ((packed));
127 127
 	uint16_t highposav __attribute__ ((packed));
... ...
@@ -131,16 +131,16 @@ typedef struct main_header_tag
131 131
 typedef struct file_header_tag
132 132
 {
133 133
 	uint16_t head_crc __attribute__ ((packed));
134
-	uint8_t head_type __attribute__ ((packed));
134
+	uint8_t head_type;
135 135
 	uint16_t flags __attribute__ ((packed));
136 136
 	uint16_t head_size __attribute__ ((packed));
137 137
 	uint32_t pack_size __attribute__ ((packed));
138 138
 	uint32_t unpack_size __attribute__ ((packed));
139
-	uint8_t host_os __attribute__ ((packed));
139
+	uint8_t host_os;
140 140
 	uint32_t file_crc __attribute__ ((packed));
141 141
 	uint32_t file_time __attribute__ ((packed));
142
-	uint8_t unpack_ver __attribute__ ((packed));
143
-	uint8_t method __attribute__ ((packed));
142
+	uint8_t unpack_ver;
143
+	uint8_t method;
144 144
 	uint16_t name_size __attribute__ ((packed));
145 145
 	uint32_t file_attr __attribute__ ((packed));
146 146
 	uint32_t high_pack_size __attribute__ ((packed));   /* optional */
... ...
@@ -153,12 +153,12 @@ typedef struct file_header_tag
153 153
 typedef struct comment_header_tag
154 154
 {
155 155
 	uint16_t head_crc __attribute__ ((packed));
156
-	uint8_t head_type __attribute__ ((packed));
156
+	uint8_t head_type;
157 157
 	uint16_t flags __attribute__ ((packed));
158 158
 	uint16_t head_size __attribute__ ((packed));
159 159
 	uint16_t unpack_size __attribute__ ((packed));
160
-	uint8_t unpack_ver __attribute__ ((packed));
161
-	uint8_t method __attribute__ ((packed));
160
+	uint8_t unpack_ver;
161
+	uint8_t method;
162 162
 	uint16_t comm_crc __attribute__ ((packed));
163 163
 } comment_header_t;
164 164
 
... ...
@@ -59,7 +59,7 @@ typedef enum rarvm_standard_filters {
59 59
 enum VM_Flags {
60 60
 	VM_FC=1,
61 61
 	VM_FZ=2,
62
-	VM_FS=0x80000000,
62
+	VM_FS=0x80000000
63 63
 };
64 64
 
65 65
 enum rarvm_op_type {