Browse code

eliminating format-string related warnings that appear on ubuntu 16.04 x64.

Micah Snyder authored on 2017/10/11 00:28:14
Showing 2 changed files
... ...
@@ -1497,7 +1497,7 @@ void cli_sigperf_print()
1497 1497
     cli_infomsg (NULL, "%-*s %*s %*s %*s %*s\n", max_name_len, "=============",
1498 1498
 	    8, "=====", 8, "========", 12, "===========", 9, "=========");
1499 1499
     while (elem->run_count) {
1500
-	cli_infomsg (NULL, "%-*s %*lu %*lu %*llu %*.2f\n", max_name_len, elem->bc_name,
1500
+	cli_infomsg (NULL, "%-*s %*lu %*lu %*" PRIu64 " %*.2f\n", max_name_len, elem->bc_name,
1501 1501
 		     8, elem->run_count, 8, elem->match_count, 
1502 1502
 		12, elem->usecs, 9, (double)elem->usecs/elem->run_count);
1503 1503
 	elem++;
... ...
@@ -3238,7 +3238,7 @@ void cli_bytevalue_describe(const struct cli_bc *bc, unsigned funcid)
3238 3238
     printf("CID  ID    VALUE\n");
3239 3239
     printf("------------------------------------------------------------------------\n");
3240 3240
     for (i = 0; i < func->numConstants; ++i) {
3241
-        printf("%3u [%3u]: %llu(0x%llx)\n", i, total++, func->constants[i], func->constants[i]);
3241
+        printf("%3u [%3u]: " STDu64 "(0x" STDx64 ")\n", i, total++, func->constants[i], func->constants[i]);
3242 3242
     }
3243 3243
     printf("------------------------------------------------------------------------\n");
3244 3244
     printf("found a total of %u total values\n", total);
... ...
@@ -3305,13 +3305,13 @@ void cli_byteinst_describe(const struct cli_bc_inst *inst, unsigned *bbnum)
3305 3305
 
3306 3306
         // casting operations
3307 3307
     case OP_BC_TRUNC:
3308
-        printf("%d = %d trunc %llx", inst->dest, inst->u.cast.source, inst->u.cast.mask);
3308
+        printf("%d = %d trunc " STDx64, inst->dest, inst->u.cast.source, inst->u.cast.mask);
3309 3309
         break;
3310 3310
     case OP_BC_SEXT:
3311
-        printf("%d = %d sext %llx", inst->dest, inst->u.cast.source, inst->u.cast.mask);
3311
+        printf("%d = %d sext " STDx64, inst->dest, inst->u.cast.source, inst->u.cast.mask);
3312 3312
         break;
3313 3313
     case OP_BC_ZEXT:
3314
-        printf("%d = %d zext %llx", inst->dest, inst->u.cast.source, inst->u.cast.mask);
3314
+        printf("%d = %d zext " STDx64, inst->dest, inst->u.cast.source, inst->u.cast.mask);
3315 3315
         break;
3316 3316
         
3317 3317
         // control operations (termination instructions)
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
2
+ *  Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3 3
  *  Copyright (C) 2007-2013 Sourcefire, Inc.
4 4
  *
5 5
  *  Authors: Tomasz Kojm
... ...
@@ -370,11 +370,11 @@ static int cli_elf_ph64(cli_ctx *ctx, fmap_t *map, struct cli_exe_info *elfinfo,
370 370
 
371 371
             if(ctx) {
372 372
                 cli_dbgmsg("ELF: Segment #%d\n", i);
373
-                cli_dbgmsg("ELF: Segment type: 0x%x\n", EC32(program_hdr[i].p_type, conv));
374
-                cli_dbgmsg("ELF: Segment offset: 0x" STDx64 "\n", EC64(program_hdr[i].p_offset, conv));
375
-                cli_dbgmsg("ELF: Segment virtual address: 0x" STDx64 "\n", EC64(program_hdr[i].p_vaddr, conv));
376
-                cli_dbgmsg("ELF: Segment real size: 0x" STDx64 "\n", EC64(program_hdr[i].p_filesz, conv));
377
-                cli_dbgmsg("ELF: Segment virtual size: 0x" STDx64 "\n", EC64(program_hdr[i].p_memsz, conv));
373
+                cli_dbgmsg("ELF: Segment type: 0x" STDx32 "\n", (uint32_t) EC32(program_hdr[i].p_type, conv));
374
+                cli_dbgmsg("ELF: Segment offset: 0x" STDx64 "\n", (uint64_t) EC64(program_hdr[i].p_offset, conv));
375
+                cli_dbgmsg("ELF: Segment virtual address: 0x" STDx64 "\n", (uint64_t) EC64(program_hdr[i].p_vaddr, conv));
376
+                cli_dbgmsg("ELF: Segment real size: 0x" STDx64 "\n", (uint64_t) EC64(program_hdr[i].p_filesz, conv));
377
+                cli_dbgmsg("ELF: Segment virtual size: 0x" STDx64 "\n", (uint64_t) EC64(program_hdr[i].p_memsz, conv));
378 378
                 cli_dbgmsg("------------------------------------\n");
379 379
             }
380 380
         }
... ...
@@ -605,9 +605,9 @@ static int cli_elf_sh64(cli_ctx *ctx, fmap_t *map, struct cli_exe_info *elfinfo,
605 605
             elfinfo->section[i].rsz = EC64(section_hdr[i].sh_size, conv);
606 606
         }
607 607
         if(ctx) {
608
-	    cli_dbgmsg("ELF: Section %u\n", i);
609
-	    cli_dbgmsg("ELF: Section offset: " STDu64 "\n", EC64(section_hdr[i].sh_offset, conv));
610
-	    cli_dbgmsg("ELF: Section size: " STDu64 "\n", EC64(section_hdr[i].sh_size, conv));
608
+	    cli_dbgmsg("ELF: Section " STDu32 "\n", (uint32_t) i);
609
+	    cli_dbgmsg("ELF: Section offset: " STDu64 "\n", (uint64_t) EC64(section_hdr[i].sh_offset, conv));
610
+	    cli_dbgmsg("ELF: Section size: " STDu64 "\n", (uint64_t) EC64(section_hdr[i].sh_size, conv));
611 611
 
612 612
             sh_type = EC32(section_hdr[i].sh_type, conv);
613 613
             sh_flags = (uint32_t)(EC64(section_hdr[i].sh_flags, conv) & ELF_SHF_MASK);