Minor fixes in dll_load()

The test for p != NULL is pointless, it has already been dereferenced and modified.

The argument to tolower() and toupper() must be in the range of unsigned char.

Fix some spelling errors in user-visible messages.
This commit is contained in:
Kevin Easton
2017-04-24 17:34:07 +10:00
parent afc4793cd8
commit 7ee8799b8e

View File

@@ -774,11 +774,11 @@ BUILT_IN_COMMAND(dll_load)
void *handle = NULL; void *handle = NULL;
#endif #endif
char *filename = NULL; char *filename = NULL;
Irc_PackageInitProc *proc1Ptr; Irc_PackageInitProc *proc1Ptr;
Irc_PackageVersionProc *proc2Ptr; Irc_PackageVersionProc *proc2Ptr;
char *f, *p, *procname = NULL; char *f, *p, *procname = NULL;
int code = 0; int code = 0;
if (command) if (command)
{ {
@@ -834,11 +834,11 @@ int code = 0;
*p = 0; *p = 0;
p = procname; p = procname;
*p = toupper(*p); *p = toupper((unsigned char)*p);
p++; p++;
while (p && *p) while (*p)
{ {
*p = tolower(*p); *p = tolower((unsigned char)*p);
p++; p++;
} }
@@ -893,7 +893,7 @@ int code = 0;
#else #else
if (!(proc1Ptr = (Irc_PackageInitProc *) dlsym(handle, (char *) procname))) if (!(proc1Ptr = (Irc_PackageInitProc *) dlsym(handle, (char *) procname)))
#endif #endif
bitchsay("UnSuccessful module load"); bitchsay("Unsuccessful module load [%s]", procname);
else else
code = (proc1Ptr)(&dll_commands, global_table); code = (proc1Ptr)(&dll_commands, global_table);
@@ -957,7 +957,7 @@ int code = 0;
if (code == INVALID_MODVERSION) if (code == INVALID_MODVERSION)
bitchsay("Error module version is wrong for [%s]", procname); bitchsay("Error module version is wrong for [%s]", procname);
else else
bitchsay("Error initiliziing module [%s:%d]", procname, code); bitchsay("Error initializing module [%s:%d]", procname, code);
if (handle) if (handle)
#if defined(__EMX__) #if defined(__EMX__)
DosFreeModule(handle); DosFreeModule(handle);