Skip to content

Commit a777e43

Browse files
author
tyranid
committed
Some warnings fixes, properly scoped inter module links in case a module exports two different functions
with the same name.
1 parent 41564ba commit a777e43

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

ProcessPrx.C

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,14 @@ bool CProcessPrx::ReadString(u32 dwAddr, std::string &str, bool unicode, u32 *dw
14011401
{
14021402
if((ch >= 32) && (ch < 127))
14031403
{
1404-
curr += (unsigned char) ch;
1404+
if((m_blXmlDump) && (ch == '<'))
1405+
{
1406+
curr += "&lt;";
1407+
}
1408+
else
1409+
{
1410+
curr += (unsigned char) ch;
1411+
}
14051412
iRealLen++;
14061413
}
14071414
else
@@ -1533,21 +1540,30 @@ void CProcessPrx::Disasm(FILE *fp, u32 dwAddr, u32 iSize, unsigned char *pData,
15331540
}
15341541
if(s->exported.size() > 0)
15351542
{
1536-
int i;
1543+
unsigned int i;
15371544
for(i = 0; i < s->exported.size(); i++)
15381545
{
1539-
fprintf(fp, "; Exported in %s\n", s->exported[i]->name);
1546+
if(m_blXmlDump)
1547+
{
1548+
fprintf(fp, "<a name=\"%s_%s\"></a>; Exported in %s\n",
1549+
s->exported[i]->name, s->name.c_str(), s->exported[i]->name);
1550+
}
1551+
else
1552+
{
1553+
fprintf(fp, "; Exported in %s\n", s->exported[i]->name);
1554+
}
15401555
}
15411556
}
15421557
if(s->imported.size() > 0)
15431558
{
1544-
int i;
1559+
unsigned int i;
15451560
for(i = 0; i < s->imported.size(); i++)
15461561
{
15471562
if((m_blXmlDump) && (strlen(s->imported[i]->file) > 0))
15481563
{
1549-
fprintf(fp, "; Imported from <a href=\"%s.html#%s\">%s</a>\n",
1550-
s->imported[i]->file, s->name.c_str(), s->imported[i]->file);
1564+
fprintf(fp, "; Imported from <a href=\"%s.html#%s_%s\">%s</a>\n",
1565+
s->imported[i]->file, s->imported[i]->name,
1566+
s->name.c_str(), s->imported[i]->file);
15511567
}
15521568
else
15531569
{

disasm.C

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,10 +905,8 @@ static char *print_jumpr(int reg, char *output, unsigned int *realregs)
905905
{
906906
return print_jump(realregs[reg], output);
907907
}
908-
else
909-
{
910-
return print_cpureg(reg, output);
911-
}
908+
909+
return print_cpureg(reg, output);
912910
}
913911

914912
static char *print_syscall(unsigned int syscall, char *output)

getargs.C

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ char **GetArgs(int *argc, char **argv, struct ArgEntry *entry, int argcount)
109109
*argint = ent->val;
110110
}
111111
break;
112-
case ARG_TYPE_FUNC: ArgFunc argfunc = (ArgFunc) ent->argvoid;
112+
case ARG_TYPE_FUNC: { ArgFunc argfunc = (ArgFunc) ent->argvoid;
113113
if(argfunc(NULL) == 0)
114114
{
115115
fprintf(stderr, "Error processing argument for %s\n", arg);
116116
error = 1;
117117
}
118+
}
118119
break;
119120
default: fprintf(stderr, "Invalid type for option %s\n", arg);
120121
error = 1;
@@ -139,18 +140,21 @@ char **GetArgs(int *argc, char **argv, struct ArgEntry *entry, int argcount)
139140

140141
switch(ent->type)
141142
{
142-
case ARG_TYPE_INT: int *argint = (int*) ent->argvoid;
143+
case ARG_TYPE_INT: { int *argint = (int*) ent->argvoid;
143144
*argint = strtoul(argv[0], NULL, 0);
145+
}
144146
break;
145-
case ARG_TYPE_STR: const char **argstr = (const char **) ent->argvoid;
147+
case ARG_TYPE_STR: { const char **argstr = (const char **) ent->argvoid;
146148
*argstr = argv[0];
149+
}
147150
break;
148-
case ARG_TYPE_FUNC: ArgFunc argfunc = (ArgFunc) ent->argvoid;
151+
case ARG_TYPE_FUNC: { ArgFunc argfunc = (ArgFunc) ent->argvoid;
149152
if(argfunc(argv[0]) == 0)
150153
{
151154
fprintf(stderr, "Error processing argument for %s\n", arg);
152155
error = 1;
153156
}
157+
}
154158
break;
155159
default: fprintf(stderr, "Invalid type for option %s\n", arg);
156160
error = 1;

main.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ int process_args(int argc, char **argv)
197197

198198
void print_help()
199199
{
200-
int i;
200+
unsigned int i;
201201
COutput::Printf(LEVEL_INFO, "Usage: prxtool [options...] file\n");
202202
COutput::Printf(LEVEL_INFO, "Options:\n");
203203

@@ -332,7 +332,6 @@ void output_disasm(const char *file, FILE *out_fp, CNidMgr *nids)
332332
{
333333
CProcessPrx prx(g_dwBase);
334334
bool blRet;
335-
int i;
336335

337336
COutput::Printf(LEVEL_INFO, "Loading %s\n", file);
338337
prx.SetNidMgr(nids);

0 commit comments

Comments
 (0)