Skip to content

Commit ec1e112

Browse files
committed
fix: eliminate all warnings in AppleClang
1 parent 91f733c commit ec1e112

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/pdbparser/pdb_file.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool PDBFile::save_streams_to_files(void)
149149
for (unsigned int i = 0; i < num_streams;i++)
150150
{
151151
char stream_filename[MAX_PATH+4];
152-
sprintf(stream_filename,"%s.%03d",pdb_filename,i);
152+
snprintf(stream_filename,MAX_PATH+4,"%s.%03d",pdb_filename,i);
153153
FILE *fs = fopen(stream_filename,"wb");
154154
if (fs == nullptr)
155155
return false;
@@ -446,7 +446,6 @@ void PDBFile::parse_modules(void)
446446

447447
unsigned int position = sizeof(NewDBIHdr); //0x40
448448
unsigned int limit = sizeof(NewDBIHdr) + dbi_header_v700->cbGpModi;
449-
int cnt = 0;
450449
MODI * entry;
451450

452451
while (position < limit)
@@ -481,7 +480,6 @@ void PDBFile::parse_modules(void)
481480
s // stream
482481
};
483482
modules.push_back(new_module);
484-
cnt++;
485483
// Go to next entry
486484
position += sizeof(MODI) + len;
487485
}

src/pdbparser/pdb_symbols.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <cstdio>
99
#include <cstring>
1010
#include <sstream>
11+
#include <cinttypes> // Since C++11 for the macro of PRIx64
1112

1213
#include "retdec/pdbparser/pdb_symbols.h"
1314

@@ -58,7 +59,8 @@ void dump_local_variable(PDBLocalVariable &var)
5859

5960
void PDBFunction::dump(void)
6061
{
61-
printf("** Function [%s] at 0x%16lx\n", name, address);
62+
printf("** Function [%s] at 0x%" PRIx64 "\n", name, address);
63+
6264
if (overload_index > 0)
6365
printf("\tFunction is overloaded. Index: %d\n", overload_index);
6466
printf("\tOffset : %08x\n", offset);
@@ -100,12 +102,12 @@ void PDBFunction::dump(void)
100102
data[i].type_def->dump(true);
101103
size = data[i].type_def->size_bytes;
102104
}
103-
printf(" Size: %d bytes [%s] at 0x%16lx\n", size, data[i].name, data[i].address);
105+
printf(" Size: %d bytes [%s] at 0x%" PRIx64 "\n", size, data[i].name, data[i].address);
104106
}
105107
printf("\tLine number information:\n");
106108
for (unsigned int i = 0; i < lines.size(); i++)
107109
{
108-
printf("\t\tLine: %d Offset: %08x (%16lx)\n", lines[i].line, lines[i].offset, lines[i].offset + address);
110+
printf("\t\tLine: %d Offset: %08x (%" PRIx64 ")\n", lines[i].line, lines[i].offset, lines[i].offset + address);
109111
}
110112
puts("");
111113
}
@@ -297,7 +299,6 @@ void PDBSymbols::parse_symbols(void)
297299
continue;
298300
PDBStream *stream = modules[m].stream;
299301
position = 4;
300-
int cnt = 0;
301302
PDBFunction * new_function = nullptr;
302303
while (position < stream->size)
303304
{ // Process all symbols in module stream
@@ -371,11 +372,9 @@ void PDBSymbols::parse_symbols(void)
371372
break;
372373
}
373374
}
374-
cnt++;
375375
position += symbol->size + 2;
376376
}
377377

378-
cnt = 0;
379378
while (position < stream->size)
380379
{ // Process all big symbols in module stream
381380
PDBBigSymbol *symbol = reinterpret_cast<PDBBigSymbol *>(stream->data + position);
@@ -397,7 +396,6 @@ void PDBSymbols::parse_symbols(void)
397396
break;
398397
}
399398
position += symbol->size + 8;
400-
cnt++;
401399
}
402400
}
403401
parsed = true;
@@ -768,7 +766,7 @@ void PDBSymbols::print_global_variables(void)
768766
puts("******* SYM global variables list *******");
769767
for (PDBGlobalVarAddressMap::iterator it = global_variables.begin(); it != global_variables.end(); ++it)
770768
{
771-
printf("Global variable [%s] at 0x%16lx\n", it->second.name, it->second.address);
769+
printf("Global variable [%s] at 0x%" PRIx64 "\n", it->second.name, it->second.address);
772770
printf("\tOffset : %08x\n", it->second.offset);
773771
printf("\tSection: %04x\n", it->second.section);
774772
printf("\tModule : %d\n", it->second.module_index);

0 commit comments

Comments
 (0)