Skip to content

Commit

Permalink
fix: eliminate all warnings in AppleClang
Browse files Browse the repository at this point in the history
  • Loading branch information
25077667 committed Jun 23, 2023
1 parent b7676df commit e51a874
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/pdbparser/pdb_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool PDBFile::save_streams_to_files(void)
for (unsigned int i = 0; i < num_streams;i++)
{
char stream_filename[MAX_PATH+4];
sprintf(stream_filename,"%s.%03d",pdb_filename,i);
snprintf(stream_filename,MAX_PATH+4,"%s.%03d",pdb_filename,i);
FILE *fs = fopen(stream_filename,"wb");
if (fs == nullptr)
return false;
Expand Down Expand Up @@ -446,7 +446,6 @@ void PDBFile::parse_modules(void)

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

while (position < limit)
Expand Down Expand Up @@ -481,7 +480,6 @@ void PDBFile::parse_modules(void)
s // stream
};
modules.push_back(new_module);
cnt++;
// Go to next entry
position += sizeof(MODI) + len;
}
Expand Down
14 changes: 6 additions & 8 deletions src/pdbparser/pdb_symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstdio>
#include <cstring>
#include <sstream>
#include <cinttypes> // Since C++11 for the macro of PRIx64

#include "retdec/pdbparser/pdb_symbols.h"

Expand Down Expand Up @@ -58,7 +59,8 @@ void dump_local_variable(PDBLocalVariable &var)

void PDBFunction::dump(void)
{
printf("** Function [%s] at 0x%16lx\n", name, address);
printf("** Function [%s] at 0x%" PRIx64 "\n", name, address);

if (overload_index > 0)
printf("\tFunction is overloaded. Index: %d\n", overload_index);
printf("\tOffset : %08x\n", offset);
Expand Down Expand Up @@ -100,12 +102,12 @@ void PDBFunction::dump(void)
data[i].type_def->dump(true);
size = data[i].type_def->size_bytes;
}
printf(" Size: %d bytes [%s] at 0x%16lx\n", size, data[i].name, data[i].address);
printf(" Size: %d bytes [%s] at 0x%" PRIx64 "\n", size, data[i].name, data[i].address);
}
printf("\tLine number information:\n");
for (unsigned int i = 0; i < lines.size(); i++)
{
printf("\t\tLine: %d Offset: %08x (%16lx)\n", lines[i].line, lines[i].offset, lines[i].offset + address);
printf("\t\tLine: %d Offset: %08x (%" PRIx64 ")\n", lines[i].line, lines[i].offset, lines[i].offset + address);
}
puts("");
}
Expand Down Expand Up @@ -297,7 +299,6 @@ void PDBSymbols::parse_symbols(void)
continue;
PDBStream *stream = modules[m].stream;
position = 4;
int cnt = 0;
PDBFunction * new_function = nullptr;
while (position < stream->size)
{ // Process all symbols in module stream
Expand Down Expand Up @@ -371,11 +372,9 @@ void PDBSymbols::parse_symbols(void)
break;
}
}
cnt++;
position += symbol->size + 2;
}

cnt = 0;
while (position < stream->size)
{ // Process all big symbols in module stream
PDBBigSymbol *symbol = reinterpret_cast<PDBBigSymbol *>(stream->data + position);
Expand All @@ -397,7 +396,6 @@ void PDBSymbols::parse_symbols(void)
break;
}
position += symbol->size + 8;
cnt++;
}
}
parsed = true;
Expand Down Expand Up @@ -768,7 +766,7 @@ void PDBSymbols::print_global_variables(void)
puts("******* SYM global variables list *******");
for (PDBGlobalVarAddressMap::iterator it = global_variables.begin(); it != global_variables.end(); ++it)
{
printf("Global variable [%s] at 0x%16lx\n", it->second.name, it->second.address);
printf("Global variable [%s] at 0x%" PRIx64 "\n", it->second.name, it->second.address);
printf("\tOffset : %08x\n", it->second.offset);
printf("\tSection: %04x\n", it->second.section);
printf("\tModule : %d\n", it->second.module_index);
Expand Down

0 comments on commit e51a874

Please sign in to comment.