mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-23 13:04:28 +00:00
Pass format sizes to scanf string arguments in codesighs.c. (Bug 533647) r=bsmedberg
This commit is contained in:
parent
0d65365453
commit
544fa1d874
@ -227,7 +227,6 @@ void trimWhite(char* inString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int codesighs(Options* inOptions)
|
||||
/*
|
||||
** Output a simplistic report based on our options.
|
||||
@ -237,11 +236,16 @@ int codesighs(Options* inOptions)
|
||||
char lineBuffer[0x1000];
|
||||
int scanRes = 0;
|
||||
unsigned long size;
|
||||
char segClass[0x10];
|
||||
char scope[0x10];
|
||||
char module[0x100];
|
||||
char segment[0x40];
|
||||
char object[0x100];
|
||||
#define SEGCLASS_CHARS 15
|
||||
char segClass[SEGCLASS_CHARS + 1];
|
||||
#define SCOPE_CHARS 15
|
||||
char scope[SCOPE_CHARS + 1];
|
||||
#define MODULE_CHARS 255
|
||||
char module[MODULE_CHARS + 1];
|
||||
#define SEGMENT_CHARS 63
|
||||
char segment[SEGMENT_CHARS + 1];
|
||||
#define OBJECT_CHARS 255
|
||||
char object[OBJECT_CHARS + 1];
|
||||
char* symbol;
|
||||
SizeStats overall;
|
||||
ModuleStats* modules = NULL;
|
||||
@ -258,8 +262,14 @@ int codesighs(Options* inOptions)
|
||||
{
|
||||
trimWhite(lineBuffer);
|
||||
|
||||
#define STRINGIFY(s_) STRINGIFY2(s_)
|
||||
#define STRINGIFY2(s_) #s_
|
||||
|
||||
scanRes = sscanf(lineBuffer,
|
||||
"%x\t%s\t%s\t%s\t%s\t%s\t",
|
||||
"%x\t%" STRINGIFY(SEGCLASS_CHARS) "s\t%"
|
||||
STRINGIFY(SCOPE_CHARS) "s\t%" STRINGIFY(MODULE_CHARS)
|
||||
"s\t%" STRINGIFY(SEGMENT_CHARS) "s\t%"
|
||||
STRINGIFY(OBJECT_CHARS) "s\t",
|
||||
(unsigned*)&size,
|
||||
segClass,
|
||||
scope,
|
||||
|
@ -386,11 +386,16 @@ int difftool(Options* inOptions)
|
||||
char* theLine = &lineBuffer[2];
|
||||
int scanRes = 0;
|
||||
int size;
|
||||
char segClass[0x10];
|
||||
char scope[0x10];
|
||||
char module[0x100];
|
||||
char segment[0x40];
|
||||
char object[0x100];
|
||||
#define SEGCLASS_CHARS 15
|
||||
char segClass[SEGCLASS_CHARS + 1];
|
||||
#define SCOPE_CHARS 15
|
||||
char scope[SCOPE_CHARS + 1];
|
||||
#define MODULE_CHARS 255
|
||||
char module[MODULE_CHARS + 1];
|
||||
#define SEGMENT_CHARS 63
|
||||
char segment[SEGMENT_CHARS + 1];
|
||||
#define OBJECT_CHARS 255
|
||||
char object[OBJECT_CHARS + 1];
|
||||
char* symbol = NULL;
|
||||
|
||||
/*
|
||||
@ -405,8 +410,15 @@ int difftool(Options* inOptions)
|
||||
/*
|
||||
** Scan the line for information.
|
||||
*/
|
||||
|
||||
#define STRINGIFY(s_) STRINGIFY2(s_)
|
||||
#define STRINGIFY2(s_) #s_
|
||||
|
||||
scanRes = sscanf(theLine,
|
||||
"%x\t%s\t%s\t%s\t%s\t%s\t",
|
||||
"%x\t%" STRINGIFY(SEGCLASS_CHARS) "s\t%"
|
||||
STRINGIFY(SCOPE_CHARS) "s\t%" STRINGIFY(MODULE_CHARS)
|
||||
"s\t%" STRINGIFY(SEGMENT_CHARS) "s\t%"
|
||||
STRINGIFY(OBJECT_CHARS) "s\t",
|
||||
(unsigned*)&size,
|
||||
segClass,
|
||||
scope,
|
||||
|
@ -68,6 +68,9 @@
|
||||
#define F_DEMANGLE 0
|
||||
#endif /* WIN32 */
|
||||
|
||||
#define STRINGIFY(s_) STRINGIFY2(s_)
|
||||
#define STRINGIFY2(s_) #s_
|
||||
#define SYMBOL_BUF_CHARS 511
|
||||
|
||||
#define ERROR_REPORT(num, val, msg) fprintf(stderr, "error(%d):\t\"%s\"\t%s\n", (num), (val), (msg));
|
||||
#define CLEANUP(ptr) do { if(NULL != ptr) { free(ptr); ptr = NULL; } } while(0)
|
||||
@ -1196,7 +1199,7 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
MSMap_Symbol* theSymbol = NULL;
|
||||
unsigned index = 0;
|
||||
int scanRes = 0;
|
||||
char symbolBuf[0x200];
|
||||
char symbolBuf[SYMBOL_BUF_CHARS + 1];
|
||||
|
||||
index = inModule->mSymbolCount;
|
||||
inModule->mSymbolCount++;
|
||||
@ -1205,7 +1208,7 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
memset(theSymbol, 0, sizeof(MSMap_Symbol));
|
||||
theSymbol->mScope = STATIC;
|
||||
|
||||
scanRes = sscanf(current, "%x:%x %s %x", (unsigned*)&(theSymbol->mPrefix), (unsigned*)&(theSymbol->mOffset), symbolBuf, (unsigned*)&(theSymbol->mRVABase));
|
||||
scanRes = sscanf(current, "%x:%x %" STRINGIFY(SYMBOL_BUF_CHARS) "s %x", (unsigned*)&(theSymbol->mPrefix), (unsigned*)&(theSymbol->mOffset), symbolBuf, (unsigned*)&(theSymbol->mRVABase));
|
||||
if(4 == scanRes)
|
||||
{
|
||||
theSymbol->mSymbol = symdup(symbolBuf);
|
||||
@ -1321,7 +1324,7 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
MSMap_Symbol* theSymbol = NULL;
|
||||
unsigned index = 0;
|
||||
int scanRes = 0;
|
||||
char symbolBuf[0x200];
|
||||
char symbolBuf[SYMBOL_BUF_CHARS + 1];
|
||||
|
||||
index = inModule->mSymbolCount;
|
||||
inModule->mSymbolCount++;
|
||||
@ -1330,7 +1333,7 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
memset(theSymbol, 0, sizeof(MSMap_Symbol));
|
||||
theSymbol->mScope = PUBLIC;
|
||||
|
||||
scanRes = sscanf(current, "%x:%x %s %x", (unsigned*)&(theSymbol->mPrefix), (unsigned*)&(theSymbol->mOffset), symbolBuf, (unsigned *)&(theSymbol->mRVABase));
|
||||
scanRes = sscanf(current, "%x:%x %" STRINGIFY(SYMBOL_BUF_CHARS) "s %x", (unsigned*)&(theSymbol->mPrefix), (unsigned*)&(theSymbol->mOffset), symbolBuf, (unsigned *)&(theSymbol->mRVABase));
|
||||
if(4 == scanRes)
|
||||
{
|
||||
theSymbol->mSymbol = symdup(symbolBuf);
|
||||
@ -1416,8 +1419,10 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
{
|
||||
MSMap_Segment* theSegment = NULL;
|
||||
unsigned index = 0;
|
||||
char classBuf[0x10];
|
||||
char nameBuf[0x20];
|
||||
#define CLASS_BUF_CHARS 15
|
||||
char classBuf[CLASS_BUF_CHARS + 1];
|
||||
#define NAME_BUF_CHARS 31
|
||||
char nameBuf[NAME_BUF_CHARS + 1];
|
||||
int scanRes = 0;
|
||||
|
||||
index = inModule->mSegmentCount;
|
||||
@ -1426,7 +1431,7 @@ int readmap(Options* inOptions, MSMap_Module* inModule)
|
||||
|
||||
memset(theSegment, 0, sizeof(MSMap_Segment));
|
||||
|
||||
scanRes = sscanf(current, "%x:%x %xH %s %s", (unsigned*)&(theSegment->mPrefix), (unsigned*)&(theSegment->mOffset), (unsigned*)&(theSegment->mLength), nameBuf, classBuf);
|
||||
scanRes = sscanf(current, "%x:%x %xH %" STRINGIFY(NAME_BUF_CHARS) "s %" STRINGIFY(CLASS_BUF_CHARS) "s", (unsigned*)&(theSegment->mPrefix), (unsigned*)&(theSegment->mOffset), (unsigned*)&(theSegment->mLength), nameBuf, classBuf);
|
||||
if(5 == scanRes)
|
||||
{
|
||||
if('.' == nameBuf[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user