Fix some pointer silliness that clang fortunately caught

This commit is contained in:
Henrik Rydgård 2013-07-15 18:18:03 +02:00
parent c5e8de540f
commit f528774b39
5 changed files with 27 additions and 28 deletions

View File

@ -348,10 +348,10 @@ typedef u64 SceIores;
struct SceKernelLoadExecParam
{
SceSize size; // Size of the structure
SceSize args; // Size of the arg string
void *argp; // Pointer to the arg string
const char *key; // Encryption key? Not yet used
SceSize size; // Size of the structure
SceSize args; // Size of the arg string
u32 argp; // Pointer to the arg string
u32 keyp; // Encryption key? Not yet used
};
void __KernelInit();

View File

@ -909,18 +909,20 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
else
memset(&param, 0, sizeof(SceKernelLoadExecParam));
u8 *param_argp = 0;
u8 *param_key = 0;
if (param.args > 0) {
u32 argpAddr = (u32)param.argp;
param.argp = new u8[param.args];
Memory::Memcpy(param.argp, argpAddr, param.args);
u32 argpAddr = param.argp;
param_argp = new u8[param.args];
Memory::Memcpy(param_argp, argpAddr, param.args);
} else {
param.argp = NULL;
}
if (param.key) {
u32 keyAddr = (u32) param.key;
if (param.keyp != 0) {
u32 keyAddr = param.keyp;
int keylen = strlen(Memory::GetCharPointer(keyAddr))+1;
param.key = new char[keylen];
Memory::Memcpy((void*)param.key, keyAddr, keylen);
param_key = new u8[keylen];
Memory::Memcpy(param_key, keyAddr, keylen);
}
// Wipe kernel here, loadexec should reset the entire system
@ -934,14 +936,14 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
__KernelModuleInit();
__KernelInit();
PSPFileInfo info = pspFileSystem.GetFileInfo(filename);
if (!info.exists) {
ERROR_LOG(LOADER, "Failed to load executable %s - file doesn't exist", filename);
*error_string = "Could not find executable";
if (paramPtr) {
if (param.argp) delete[] param.argp;
if (param.key) delete[] param.key;
if (param_argp) delete[] param_argp;
if (param_key) delete[] param_key;
}
return false;
}
@ -954,16 +956,15 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
Module *module = __KernelLoadModule(temp, 0, error_string);
if (!module || module->isFake)
{
if (!module || module->isFake) {
if (module)
kernelObjects.Destroy<Module>(module->GetUID());
ERROR_LOG(LOADER, "Failed to load module %s", filename);
*error_string = "Failed to load executable: " + *error_string;
delete [] temp;
if (paramPtr) {
if (param.argp) delete[] param.argp;
if (param.key) delete[] param.key;
if (param_argp) delete[] param_argp;
if (param_key) delete[] param_key;
}
return false;
}
@ -998,10 +999,8 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
__KernelStartIdleThreads(module->GetUID());
if (paramPtr) {
if (param.argp) delete[] param.argp;
if (param.key) delete[] param.key;
}
if (param_argp) delete[] param_argp;
if (param_key) delete[] param_key;
return true;
}

View File

@ -1750,7 +1750,7 @@ void KeyMappingScreen::render() {
currentMap_ = 0;
}
char temp[256];
sprintf(temp, "%s (%i/%i)", controllerMaps[currentMap_].name.c_str(), currentMap_ + 1, controllerMaps.size());
sprintf(temp, "%s (%i/%i)", controllerMaps[currentMap_].name.c_str(), currentMap_ + 1, (int)controllerMaps.size());
UIText(0, Pos(10, dp_yres-170), temp, 0xFFFFFFFF, 1.0f, ALIGN_BOTTOMLEFT);
UICheckBox(GEN_ID,10, dp_yres - 80, "Mapping Active", ALIGN_BOTTOMLEFT, &controllerMaps[currentMap_].active);
UIEnd();
@ -1760,7 +1760,7 @@ void KeyMappingNewKeyDialog::render() {
UIShader_Prepare();
UIBegin(UIShader_Get());
DrawBackground(1.0f);
UIContext *ctx = screenManager()->getUIContext();
UIFlush();
GameInfo *ginfo = g_gameInfoCache.GetInfo(PSP_CoreParameter().fileToStart, true);
@ -1771,8 +1771,8 @@ void KeyMappingNewKeyDialog::render() {
ui_draw2d.DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color);
ui_draw2d.Flush();
ctx->RebindTexture();
}
}
I18NCategory *keyI18N = GetI18NCategory("KeyMapping");
I18NCategory *generalI18N = GetI18NCategory("General");

2
lang

@ -1 +1 @@
Subproject commit 955d9cde6c01a0950f76b1a6e92e2d972ca5c737
Subproject commit 718470d56aa6bc1ad656b3cf765d37c09e0c877c

2
native

@ -1 +1 @@
Subproject commit 7151e4c06e5d782ef7da8e853f57ddbbb339ea60
Subproject commit d34495a23fefaf6630c3e8a7603853a9ee96e46f