Browse code

compiler warning suppression

Kevin Lin authored on 2016/02/23 03:26:15
Showing 22 changed files
... ...
@@ -361,7 +361,7 @@ int main(int argc, char **argv)
361 361
 
362 362
 
363 363
         if(logg_size)
364
-            logg("#Log file size limited to %u bytes.\n", logg_size);
364
+            logg("#Log file size limited to %lld bytes.\n", (long long int)logg_size);
365 365
         else
366 366
             logg("#Log file size limit disabled.\n");
367 367
 
... ...
@@ -699,7 +699,7 @@ static int handle_stream(client_conn_t *conn, struct fd_buf *buf, const struct o
699 699
 	    logg("!INSTREAM: Can't write to temporary file.\n");
700 700
 	    *error = 1;
701 701
 	}
702
-	logg("$Processed %lu bytes of chunkdata, pos %lu\n", cmdlen, pos);
702
+	logg("$Processed %llu bytes of chunkdata, pos %llu\n", (long long unsigned)cmdlen, (long long unsigned)pos);
703 703
 	pos += cmdlen;
704 704
 	if (pos == buf->off) {
705 705
 	    buf->off = 0;
... ...
@@ -133,7 +133,7 @@ struct metachain {
133 133
 
134 134
 struct clamscan_cb_data {
135 135
     struct metachain * chain;
136
-    char * filename;
136
+    const char * filename;
137 137
 };
138 138
 
139 139
 static cl_error_t pre(int fd, const char *type, void *context)
... ...
@@ -277,7 +277,7 @@ static cl_error_t meta(const char* container_type, unsigned long fsize_container
277 277
 static void clamscan_virus_found_cb(int fd, const char *virname, void *context)
278 278
 {
279 279
     struct clamscan_cb_data *data = (struct clamscan_cb_data *)context;
280
-    char * filename;
280
+    const char * filename;
281 281
 
282 282
     if (data == NULL)
283 283
         return;
... ...
@@ -389,9 +389,9 @@ static void scanfile(const char *filename, struct cl_engine *engine, const struc
389 389
                 char str[128];
390 390
                 int toolong = print_chain(&chain, str, sizeof(str));
391 391
 
392
-                logg("~%s%s!(%u)%s: %s FOUND\n", str, toolong ? "..." : "", chain.lastvir-1, chain.chains[chain.nchains-1], virname);
392
+                logg("~%s%s!(%llu)%s: %s FOUND\n", str, toolong ? "..." : "", (long long unsigned)(chain.lastvir-1), chain.chains[chain.nchains-1], virname);
393 393
             } else if (chain.lastvir) {
394
-                logg("~%s!(%u): %s FOUND\n", filename, chain.lastvir-1, virname);
394
+                logg("~%s!(%llu): %s FOUND\n", filename, (long long unsigned)(chain.lastvir-1), virname);
395 395
             }
396 396
         }
397 397
         if (!(options & CL_SCAN_ALLMATCHES))
... ...
@@ -2205,8 +2205,8 @@ updatecustomdb (const char *url, int *signo, const struct optstruct *opts,
2205 2205
 
2206 2206
     if (strlen (url) > sizeof (urlcpy) - 1)
2207 2207
     {
2208
-        logg ("!DatabaseCustomURL: URL must be shorter than %lu\n",
2209
-              sizeof (urlcpy));
2208
+        logg ("!DatabaseCustomURL: URL must be shorter than %llu\n",
2209
+              (long long unsigned)sizeof (urlcpy));
2210 2210
         return FCE_FAILEDUPDATE;
2211 2211
     }
2212 2212
 
... ...
@@ -87,7 +87,8 @@ int adc_decompress(adc_stream *strm)
87 87
         return ADC_DATA_ERROR;
88 88
     }
89 89
 
90
-    cli_dbgmsg("adc_decompress: avail_in %lu avail_out %lu state %u\n", strm->avail_in, strm->avail_out, strm->state);
90
+    cli_dbgmsg("adc_decompress: avail_in %llu avail_out %llu state %u\n",
91
+               (long long unsigned)strm->avail_in, (long long unsigned)strm->avail_out, strm->state);
91 92
 
92 93
     while (strm->avail_out) {
93 94
         /* Exit if needs more in bytes and none available */
... ...
@@ -1482,7 +1482,7 @@ int asn1_check_mscat(struct cl_engine *engine, fmap_t *map, size_t offset, unsig
1482 1482
     if (engine->dconf->pe & PE_CONF_DISABLECERT)
1483 1483
         return CL_VIRUS;
1484 1484
 
1485
-    cli_dbgmsg("in asn1_check_mscat (offset: %lu)\n", offset);
1485
+    cli_dbgmsg("in asn1_check_mscat (offset: %llu)\n", (long long unsigned)offset);
1486 1486
     crtmgr_init(&certs);
1487 1487
     if(crtmgr_add_roots(engine, &certs)) {
1488 1488
 	crtmgr_free(&certs);
... ...
@@ -330,9 +330,9 @@ static int cli_hashtab_grow(struct cli_hashtable *s)
330 330
 	struct cli_element* htable;
331 331
 	size_t i,idx, used = 0;
332 332
 
333
-	cli_dbgmsg("hashtab.c: new capacity: %lu\n",new_capacity);
333
+	cli_dbgmsg("hashtab.c: new capacity: %llu\n",(long long unsigned)new_capacity);
334 334
 	if(new_capacity == s->capacity) {
335
-		cli_errmsg("hashtab.c: capacity problem growing from: %lu\n",s->capacity);
335
+		cli_errmsg("hashtab.c: capacity problem growing from: %llu\n",(long long unsigned)s->capacity);
336 336
 		return CL_EMEM;
337 337
 	}
338 338
 	htable = cli_calloc(new_capacity, sizeof(*s->htable));
... ...
@@ -373,7 +373,7 @@ static int cli_hashtab_grow(struct cli_hashtable *s)
373 373
 	s->used = used;
374 374
 	s->capacity = new_capacity;
375 375
 	s->maxfill = new_capacity*8/10;
376
-	cli_dbgmsg("Table %p size after grow:%ld\n",(void*)s,s->capacity);
376
+	cli_dbgmsg("Table %p size after grow:%llu\n",(void*)s,(long long unsigned)s->capacity);
377 377
 	PROFILE_GROW_DONE(s);
378 378
 	return CL_SUCCESS;
379 379
 }
... ...
@@ -387,7 +387,7 @@ static int cli_htu32_grow(struct cli_htu32 *s, mpool_t *mempool)
387 387
 	const size_t new_capacity = nearest_power(s->capacity + 1);
388 388
 	struct cli_htu32_element* htable = mpool_calloc(mempool, new_capacity, sizeof(*s->htable));
389 389
 	size_t i,idx, used = 0;
390
-	cli_dbgmsg("hashtab.c: new capacity: %lu\n",new_capacity);
390
+	cli_dbgmsg("hashtab.c: new capacity: %llu\n",(long long unsigned)new_capacity);
391 391
 	if(new_capacity == s->capacity || !htable)
392 392
 		return CL_EMEM;
393 393
 
... ...
@@ -423,7 +423,7 @@ static int cli_htu32_grow(struct cli_htu32 *s, mpool_t *mempool)
423 423
 	s->used = used;
424 424
 	s->capacity = new_capacity;
425 425
 	s->maxfill = new_capacity*8/10;
426
-	cli_dbgmsg("Table %p size after grow:%ld\n",(void*)s,s->capacity);
426
+	cli_dbgmsg("Table %p size after grow:%llu\n",(void*)s,(long long unsigned)s->capacity);
427 427
 	PROFILE_GROW_DONE(s);
428 428
 	return CL_SUCCESS;
429 429
 }
... ...
@@ -438,7 +438,7 @@ const struct cli_element* cli_hashtab_insert(struct cli_hashtable *s, const char
438 438
 	if(!s)
439 439
 		return NULL;
440 440
 	if(s->used > s->maxfill) {
441
-		cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%ld\n",(void*)s,s->capacity);
441
+		cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%llu\n",(void*)s,(long long unsigned)s->capacity);
442 442
 		cli_hashtab_grow(s);
443 443
 	}
444 444
 	do {
... ...
@@ -487,7 +487,7 @@ const struct cli_element* cli_hashtab_insert(struct cli_hashtable *s, const char
487 487
 		} while (tries <= s->capacity);
488 488
 		/* no free place found*/
489 489
 		PROFILE_HASH_EXHAUSTED(s);
490
-		cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%ld.\n",(void*)s,s->capacity);
490
+		cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%llu.\n",(void*)s,(long long unsigned)s->capacity);
491 491
 	} while( cli_hashtab_grow(s) >= 0 );
492 492
 	cli_warnmsg("hashtab.c: Unable to grow hashtable\n");
493 493
 	return NULL;
... ...
@@ -505,7 +505,7 @@ int cli_htu32_insert(struct cli_htu32 *s, const struct cli_htu32_element *item,
505 505
 	if(!s)
506 506
 		return CL_ENULLARG;
507 507
 	if(s->used > s->maxfill) {
508
-		cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%ld\n",(void*)s,s->capacity);
508
+		cli_dbgmsg("hashtab.c:Growing hashtable %p, because it has exceeded maxfill, old size:%llu\n",(void*)s,(long long unsigned)s->capacity);
509 509
 		cli_htu32_grow(s, mempool);
510 510
 	}
511 511
 	do {
... ...
@@ -544,7 +544,7 @@ int cli_htu32_insert(struct cli_htu32 *s, const struct cli_htu32_element *item,
544 544
 		} while (tries <= s->capacity);
545 545
 		/* no free place found*/
546 546
 		PROFILE_HASH_EXHAUSTED(s);
547
-		cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%ld.\n",(void*)s,s->capacity);
547
+		cli_dbgmsg("hashtab.c: Growing hashtable %p, because its full, old size:%llu.\n",(void*)s,(long long unsigned)s->capacity);
548 548
 	} while( (ret = cli_htu32_grow(s, mempool)) >= 0 );
549 549
 	cli_warnmsg("hashtab.c: Unable to grow hashtable\n");
550 550
 	return ret;
... ...
@@ -633,11 +633,12 @@ int cli_hashtab_generate_c(const struct cli_hashtable *s,const char* name)
633 633
 		else if(e->key == DELETED_KEY)
634 634
 			printf("\t{DELETED_KEY,0,0},\n");
635 635
 		else
636
-			printf("\t{\"%s\", %ld, %ld},\n", e->key, e->data, e->len);
636
+			printf("\t{\"%s\", %ld, %llu},\n", e->key, e->data, (long long unsigned)e->len);
637 637
 	}
638 638
 	printf("};\n");
639 639
 	printf("const struct cli_hashtable %s = {\n",name);
640
-	printf("\t%s_elements, %ld, %ld, %ld", name, s->capacity, s->used, s->maxfill);
640
+	printf("\t%s_elements, %llu, %llu, %llu", name, (long long unsigned)s->capacity,
641
+	       (long long unsigned)s->used, (long long unsigned)s->maxfill);
641 642
 	printf("\n};\n");
642 643
 
643 644
 	PROFILE_REPORT(s);
... ...
@@ -179,7 +179,7 @@ void cli_pcre_perf_print()
179 179
     while (elem->run_count) {
180 180
         cli_infomsg (NULL, "%-*s %*lu %*lu %*llu %*.2f\n", max_name_len, elem->name,
181 181
                      8, elem->run_count, 8, elem->match_count,
182
-                     12, elem->usecs, 9, (double)elem->usecs/elem->run_count);
182
+                     12, (long long unsigned)elem->usecs, 9, (double)elem->usecs/elem->run_count);
183 183
         elem++;
184 184
     }
185 185
 }
... ...
@@ -192,7 +192,8 @@ static inline int matcher_run(const struct cli_matcher *root,
192 192
                 if (rc != CL_SUCCESS)
193 193
                     return rc;
194 194
                 if (maxfilesize && (map->len > maxfilesize)) {
195
-                    cli_dbgmsg("matcher_run: pcre max filesize (map) exceeded (limit: %llu, needed: %llu)\n", maxfilesize, (long long unsigned)map->len);
195
+                    cli_dbgmsg("matcher_run: pcre max filesize (map) exceeded (limit: %llu, needed: %llu)\n",
196
+                               (long long unsigned)maxfilesize, (long long unsigned)map->len);
196 197
                     return CL_EMAXSIZE;
197 198
                 }
198 199
 
... ...
@@ -212,7 +213,7 @@ static inline int matcher_run(const struct cli_matcher *root,
212 212
             if (rc != CL_SUCCESS)
213 213
                 return rc;
214 214
             if (maxfilesize && (length > maxfilesize)) {
215
-                cli_dbgmsg("matcher_run: pcre max filesize (buf) exceeded (limit: %llu, needed: %u)\n", maxfilesize, length);
215
+                cli_dbgmsg("matcher_run: pcre max filesize (buf) exceeded (limit: %llu, needed: %u)\n", (long long unsigned)maxfilesize, length);
216 216
                 return CL_EMAXSIZE;
217 217
             }
218 218
 
... ...
@@ -1205,8 +1206,9 @@ int cli_matchmeta(cli_ctx *ctx, const char *fname, size_t fsizec, size_t fsizer,
1205 1205
 	const struct cli_cdb *cdb;
1206 1206
 	unsigned int viruses_found = 0;
1207 1207
 
1208
-    cli_dbgmsg("CDBNAME:%s:%lu:%s:%lu:%lu:%d:%u:%u:%p\n",
1209
-	       cli_ftname(ctx->container_type), fsizec, fname, fsizec, fsizer, encrypted, filepos, res1, res2);
1208
+    cli_dbgmsg("CDBNAME:%s:%llu:%s:%llu:%llu:%d:%u:%u:%p\n",
1209
+	       cli_ftname(ctx->container_type), (long long unsigned)fsizec, fname, (long long unsigned)fsizec, (long long unsigned)fsizer,
1210
+	       encrypted, filepos, res1, res2);
1210 1211
 
1211 1212
     if (ctx->engine && ctx->engine->cb_meta)
1212 1213
 	if (ctx->engine->cb_meta(cli_ftname(ctx->container_type), fsizec, fname, fsizer, encrypted, filepos, ctx->cb_ctx) == CL_VIRUS) {
... ...
@@ -2509,7 +2509,7 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c
2509 2509
 
2510 2510
 				buf = cli_malloc(strlen(ptr) + 1);
2511 2511
 				if(buf == NULL) {
2512
-                    cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %lu\n", strlen(ptr) + 1);
2512
+                    cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %llu\n", (long long unsigned)(strlen(ptr) + 1));
2513 2513
 					if(copy)
2514 2514
 						free(copy);
2515 2515
 					return -1;
... ...
@@ -2618,7 +2618,7 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c
2618 2618
 		case CONTENT_DISPOSITION:
2619 2619
 			buf = cli_malloc(strlen(ptr) + 1);
2620 2620
 			if(buf == NULL) {
2621
-                cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %lu\n", strlen(ptr) + 1);
2621
+                cli_errmsg("parseMimeHeader: Unable to allocate memory for buf %llu\n", (long long unsigned)(strlen(ptr) + 1));
2622 2622
 				if(copy)
2623 2623
 					free(copy);
2624 2624
 				return -1;
... ...
@@ -2696,7 +2696,7 @@ rfc822comments(const char *in, char *out)
2696 2696
 	if(out == NULL) {
2697 2697
 		out = cli_malloc(strlen(in) + 1);
2698 2698
 		if(out == NULL) {
2699
-            cli_errmsg("rfc822comments: Unable to allocate memory for out %lu\n", strlen(in) + 1);
2699
+            cli_errmsg("rfc822comments: Unable to allocate memory for out %llu\n", (long long unsigned)(strlen(in) + 1));
2700 2700
 			return NULL;
2701 2701
         }
2702 2702
 	}
... ...
@@ -2764,7 +2764,7 @@ rfc2047(const char *in)
2764 2764
 	out = cli_malloc(strlen(in) + 1);
2765 2765
 
2766 2766
 	if(out == NULL) {
2767
-        cli_errmsg("rfc2047: Unable to allocate memory for out %lu\n", strlen(in) + 1);
2767
+        cli_errmsg("rfc2047: Unable to allocate memory for out %llu\n", (long long unsigned)(strlen(in) + 1));
2768 2768
 		return NULL;
2769 2769
     }
2770 2770
 
... ...
@@ -1467,7 +1467,7 @@ int lzx_decompress(struct lzx_stream *lzx, uint32_t out_bytes) {
1467 1467
 
1468 1468
     /* check that we've used all of the previous frame first */
1469 1469
     if (lzx->o_ptr != lzx->o_end) {
1470
-      cli_dbgmsg("lzx_decompress: %ld avail bytes, new %d frame\n", lzx->o_end-lzx->o_ptr, frame_size);
1470
+      cli_dbgmsg("lzx_decompress: %d avail bytes, new %d frame\n", lzx->o_end-lzx->o_ptr, frame_size);
1471 1471
       return lzx->error = CL_EFORMAT;
1472 1472
     }
1473 1473
 
... ...
@@ -778,7 +778,8 @@ struct cl_settings *cl_engine_settings_copy(const struct cl_engine *engine)
778 778
 
779 779
     settings = (struct cl_settings *) malloc(sizeof(struct cl_settings));
780 780
     if(!settings) {
781
-        cli_errmsg("cl_engine_settings_copy: Unable to allocate memory for settings %u\n", sizeof(struct cl_settings));
781
+        cli_errmsg("cl_engine_settings_copy: Unable to allocate memory for settings %llu\n",
782
+                   (long long unsigned)sizeof(struct cl_settings));
782 783
         return NULL;
783 784
     }
784 785
 
... ...
@@ -1216,7 +1217,7 @@ int cli_rmdirs(const char *dirname)
1216 1216
 		    if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
1217 1217
 			path = cli_malloc(strlen(dirname) + strlen(dent->d_name) + 2);
1218 1218
 			if(!path) {
1219
-                cli_errmsg("cli_rmdirs: Unable to allocate memory for path %lu\n", strlen(dirname) + strlen(dent->d_name) + 2);
1219
+                cli_errmsg("cli_rmdirs: Unable to allocate memory for path %llu\n", (long long unsigned)(strlen(dirname) + strlen(dent->d_name) + 2));
1220 1220
 			    closedir(dd);
1221 1221
 			    return -1;
1222 1222
 			}
... ...
@@ -1288,7 +1289,7 @@ bitset_t *cli_bitset_init(void)
1288 1288
 	
1289 1289
 	bs = cli_malloc(sizeof(bitset_t));
1290 1290
 	if (!bs) {
1291
-        cli_errmsg("cli_bitset_init: Unable to allocate memory for bs %u\n", sizeof(bitset_t));
1291
+        cli_errmsg("cli_bitset_init: Unable to allocate memory for bs %llu\n", (long long unsigned)sizeof(bitset_t));
1292 1292
 		return NULL;
1293 1293
 	}
1294 1294
 	bs->length = BITSET_DEFAULT_SIZE;
... ...
@@ -1052,14 +1052,15 @@ int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags)
1052 1052
                     cli_dbgmsg("cli_pdf: calculated length %ld\n", length);
1053 1053
                 } else {
1054 1054
                     if (size > (size_t)length+2) {
1055
-                        cli_dbgmsg("cli_pdf: calculated length %ld < %ld\n",
1056
-                               length, size);
1055
+                        cli_dbgmsg("cli_pdf: calculated length %llu < %llu\n",
1056
+                                   (long long unsigned)length, (long long unsigned)size);
1057 1057
                         length = size;
1058 1058
                     }
1059 1059
                 }
1060 1060
 
1061 1061
                 if (orig_length && size > (size_t)orig_length + 20) {
1062
-                    cli_dbgmsg("cli_pdf: orig length: %ld, length: %ld, size: %ld\n", orig_length, length, size);
1062
+                    cli_dbgmsg("cli_pdf: orig length: %ld, length: %ld, size: %llu\n", orig_length, length,
1063
+                               (long long unsigned)size);
1063 1064
                     pdfobj_flag(pdf, obj, BAD_STREAMLEN);
1064 1065
                 }
1065 1066
 
... ...
@@ -2127,7 +2127,7 @@ int cli_scanpe(cli_ctx *ctx)
2127 2127
         }
2128 2128
 
2129 2129
         if((sections = (struct cli_exe_section *) cli_malloc((sectcnt + 1) * sizeof(struct cli_exe_section))) == NULL) {
2130
-            cli_errmsg("FSG: Unable to allocate memory for sections %lu\n", (sectcnt + 1) * sizeof(struct cli_exe_section));
2130
+            cli_errmsg("FSG: Unable to allocate memory for sections %llu\n", (long long unsigned)((sectcnt + 1) * sizeof(struct cli_exe_section)));
2131 2131
             free(exe_sections);
2132 2132
             return CL_EMEM;
2133 2133
         }
... ...
@@ -2229,7 +2229,7 @@ int cli_scanpe(cli_ctx *ctx)
2229 2229
             break;
2230 2230
 
2231 2231
         if((sections = (struct cli_exe_section *) cli_malloc((sectcnt + 1) * sizeof(struct cli_exe_section))) == NULL) {
2232
-            cli_errmsg("FSG: Unable to allocate memory for sections %lu\n", (sectcnt + 1) * sizeof(struct cli_exe_section));
2232
+            cli_errmsg("FSG: Unable to allocate memory for sections %llu\n", (long long unsigned)((sectcnt + 1) * sizeof(struct cli_exe_section)));
2233 2233
             free(exe_sections);
2234 2234
             return CL_EMEM;
2235 2235
         }
... ...
@@ -1051,7 +1051,7 @@ static int getmetrics(unsigned int side, unsigned int *imagedata, struct icomtr
1051 1051
 #ifdef USE_FLOATS
1052 1052
     sobel = cli_malloc(side * side * sizeof(double));
1053 1053
     if(!sobel) {
1054
-        cli_errmsg("getmetrics: Unable to allocate memory for edge detection %lu\n", (side * side * sizeof(double)));
1054
+        cli_errmsg("getmetrics: Unable to allocate memory for edge detection %llu\n", (long long unsigned)(side * side * sizeof(double)));
1055 1055
 	free(tmp);
1056 1056
 	return CL_EMEM;
1057 1057
     }
... ...
@@ -710,7 +710,7 @@ int cli_parsepng(cli_ctx *ctx)
710 710
             } else if (cur_y >= h) {
711 711
                 inflateEnd(&zstrm);
712 712
 		if(eod - p > 0) {
713
-		    cli_dbgmsg("PNG:  %li bytes remaining in buffer before inflateEnd()", eod-p);
713
+		    cli_dbgmsg("PNG:  %d bytes remaining in buffer before inflateEnd()", eod-p);
714 714
 		    return CL_EPARSE;
715 715
 		}
716 716
 		err = Z_STREAM_END;
... ...
@@ -85,7 +85,8 @@ static inline size_t get_char_at_pos_with_skip(const struct pre_fixup_info* info
85 85
 		return (pos <= strlen(buffer)) ? buffer[pos>0 ? pos-1:0] : '\0';
86 86
 	}
87 87
 	str = info->pre_displayLink.data;
88
-	cli_dbgmsg("calc_pos_with_skip: skip:%lu, %lu - %lu \"%s\",\"%s\"\n", pos, info->host_start, info->host_end, str, buffer);
88
+	cli_dbgmsg("calc_pos_with_skip: skip:%llu, %llu - %llu \"%s\",\"%s\"\n", (long long unsigned)pos, (long long unsigned)info->host_start,
89
+               (long long unsigned)info->host_end, str, buffer);
89 90
 	pos += info->host_start;
90 91
 	while(str[realpos] && !isalnum(str[realpos])) realpos++;
91 92
 	for(; str[realpos] && (pos>0); pos--) {
... ...
@@ -179,7 +179,7 @@ char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel)
179 179
                 if (!(buf))
180 180
                     return NULL;
181 181
 
182
-                snprintf(buf+curused, bufsz-curused, "\t\t\t\t\t\"size\": %u\n", sample->sections->sections[i].len);
182
+                snprintf(buf+curused, bufsz-curused, "\t\t\t\t\t\"size\": %llu\n", (long long unsigned)sample->sections->sections[i].len);
183 183
                 curused += strlen(buf+curused);
184 184
 
185 185
                 buf = ensure_bufsize(buf, &bufsz, curused, 30);
... ...
@@ -18,8 +18,8 @@ const char *fp_ident(void)
18 18
 "TomsFastMath (%s)\n"
19 19
 "\n"
20 20
 "Sizeofs\n"
21
-"\tfp_digit = %lu\n"
22
-"\tfp_word  = %lu\n"
21
+"\tfp_digit = %llu\n"
22
+"\tfp_word  = %llu\n"
23 23
 "\n"
24 24
 "FP_MAX_SIZE = %u\n"
25 25
 "\n"
... ...
@@ -70,7 +70,7 @@ const char *fp_ident(void)
70 70
 #ifdef TFM_HUGE
71 71
 " TFM_HUGE "
72 72
 #endif
73
-"\n", __DATE__, sizeof(fp_digit), sizeof(fp_word), FP_MAX_SIZE);
73
+            "\n", __DATE__, (long long unsigned)sizeof(fp_digit), (long long unsigned)sizeof(fp_word), FP_MAX_SIZE);
74 74
 
75 75
    if (sizeof(fp_digit) == sizeof(fp_word)) {
76 76
       strncat(buf, "WARNING: sizeof(fp_digit) == sizeof(fp_word), this build is likely to not work properly.\n", 
... ...
@@ -715,7 +715,8 @@ int cli_scanxar(cli_ctx *ctx)
715 715
                     
716 716
                     if (avail_out == 0)
717 717
                         cli_dbgmsg("cli_scanxar: cli_LzmaDecode() produces no output for "
718
-                                   "avail_in %lu, avail_out %lu.\n", avail_in, avail_out);
718
+                                   "avail_in %llu, avail_out %llu.\n",
719
+                                   (long long unsigned)avail_in, (long long unsigned)avail_out);
719 720
 
720 721
                     if (a_hash_ctx != NULL)
721 722
                         xar_hash_update(a_hash_ctx, next_in, in_consumed, a_hash);                    
... ...
@@ -728,8 +729,8 @@ int cli_scanxar(cli_ctx *ctx)
728 728
                     /*            avail_out, in_consumed, avail_in); */
729 729
 
730 730
                     if (cli_writen(fd, buff, avail_out) < 0) {
731
-                        cli_dbgmsg("cli_scanxar: cli_writen error writing lzma temp file for %li bytes.\n",
732
-                                   avail_out);
731
+                        cli_dbgmsg("cli_scanxar: cli_writen error writing lzma temp file for %llu bytes.\n",
732
+                                   (long long unsigned)avail_out);
733 733
                         __lzma_wrap_free(NULL, buff);
734 734
                         cli_LzmaShutdown(&lz);
735 735
                         rc = CL_EWRITE;
... ...
@@ -37,7 +37,7 @@ void *rar_malloc(size_t size)
37 37
     alloc = malloc(size);
38 38
 
39 39
     if(!alloc) {
40
-	fprintf(stderr, "UNRAR: rar_malloc(): Can't allocate memory (%lu bytes).\n", size);
40
+	fprintf(stderr, "UNRAR: rar_malloc(): Can't allocate memory (%llu bytes).\n", (long long unsigned)size);
41 41
 	return NULL;
42 42
     } else return alloc;
43 43
 }
... ...
@@ -55,7 +55,7 @@ void *rar_realloc2(void *ptr, size_t size)
55 55
     alloc = realloc(ptr, size);
56 56
 
57 57
     if(!alloc) {
58
-	fprintf(stderr, "UNRAR: rar_realloc2(): Can't allocate memory (%lu bytes).\n", size);
58
+	fprintf(stderr, "UNRAR: rar_realloc2(): Can't allocate memory (%llu bytes).\n", (long long unsigned)size);
59 59
 	if(ptr)
60 60
 	    free(ptr);
61 61
 	return NULL;
... ...
@@ -215,7 +215,7 @@ static int rename_logg(STATBUF *sb)
215 215
 
216 216
     if (!logg_rotate) {
217 217
         if (logg_fp) {
218
-            fprintf(logg_fp, "Log size = %zu, max = %zu\n", sb->st_size, logg_size);
218
+            fprintf(logg_fp, "Log size = %lld, max = %lld\n", (long long int)sb->st_size, (long long int)logg_size);
219 219
             fprintf(logg_fp, "WARNING: Log size limit met but log file rotation turned off. Forcing log file rotation anyways.\n");
220 220
         }
221 221