mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Cleanup and warning fix in the new sysclib functions
This commit is contained in:
parent
97bef89486
commit
027edd6f59
@ -831,11 +831,9 @@ static u32 sysclib_strtol(u32 strPtr, u32 endPtrPtr, int base) {
|
||||
if (!Memory::IsValidAddress(strPtr)) {
|
||||
return hleLogError(SCEKERNEL, 0, "invalid address");
|
||||
}
|
||||
const char* str;
|
||||
str = Memory::GetCharPointer(strPtr);
|
||||
const char* str = Memory::GetCharPointer(strPtr);
|
||||
char* end = nullptr;
|
||||
int result = (int)strtol(str, &end, base);
|
||||
ERROR_LOG(SCEKERNEL, "Untested %d = sysclib_strtol(%c, %08x, %d)",result, str, endPtrPtr, base);
|
||||
if (Memory::IsValidRange(endPtrPtr, 4))
|
||||
Memory::WriteUnchecked_U32(strPtr + (end - str), endPtrPtr);
|
||||
return result;
|
||||
@ -846,12 +844,11 @@ static u32 sysclib_strchr(u32 src, int c) {
|
||||
return hleLogError(SCEKERNEL, 0, "invalid address");
|
||||
}
|
||||
const std::string str = Memory::GetCharPointer(src);
|
||||
ERROR_LOG(SCEKERNEL, "Untested sysclib_strchr(%c, %d)", str.c_str(), c);
|
||||
int index = (int)(str.find(str, c));
|
||||
if (index < 0) {
|
||||
size_t cpos = str.find(str, c);
|
||||
if (cpos == std::string::npos) {
|
||||
return 0;
|
||||
}
|
||||
return src + index;
|
||||
return src + (int)cpos;
|
||||
}
|
||||
|
||||
static u32 sysclib_strrchr(u32 src, int c) {
|
||||
@ -859,18 +856,15 @@ static u32 sysclib_strrchr(u32 src, int c) {
|
||||
return hleLogError(SCEKERNEL, 0, "invalid address");
|
||||
}
|
||||
const std::string str = Memory::GetCharPointer(src);
|
||||
ERROR_LOG(SCEKERNEL, "Untested sysclib_strchr(%c, %d)", str.c_str(), c);
|
||||
int index = (int)(str.rfind(str, c));
|
||||
if (index < 0) {
|
||||
size_t cpos = str.rfind(str, c);
|
||||
if (cpos == std::string::npos) {
|
||||
return 0;
|
||||
}
|
||||
return src + index;
|
||||
return src + (int)cpos;
|
||||
}
|
||||
|
||||
static u32 sysclib_toupper(u32 c) {
|
||||
ERROR_LOG(SCEKERNEL, "Untested sysclib_toupper(%d)",c);
|
||||
int ctype = toupper(c);
|
||||
return c;
|
||||
return toupper(c);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user