From f528774b390e0a8e2068b0b24804c251ee06963f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 15 Jul 2013 18:18:03 +0200 Subject: [PATCH] Fix some pointer silliness that clang fortunately caught --- Core/HLE/sceKernel.h | 8 ++++---- Core/HLE/sceKernelModule.cpp | 35 +++++++++++++++++------------------ UI/MenuScreens.cpp | 8 ++++---- lang | 2 +- native | 2 +- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 7c0c1e270d..9c60df2ce2 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -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(); diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 4a48c204d5..76ea3a3a35 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -909,18 +909,20 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str else memset(¶m, 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->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; } diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 6c0f76ce46..f71f59e965 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -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"); diff --git a/lang b/lang index 955d9cde6c..718470d56a 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 955d9cde6c01a0950f76b1a6e92e2d972ca5c737 +Subproject commit 718470d56aa6bc1ad656b3cf765d37c09e0c877c diff --git a/native b/native index 7151e4c06e..d34495a23f 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 7151e4c06e5d782ef7da8e853f57ddbbb339ea60 +Subproject commit d34495a23fefaf6630c3e8a7603853a9ee96e46f