Random bits of cleanup

This commit is contained in:
TMaul 2012-12-26 21:25:10 +00:00
parent bb99fe8fa7
commit 515b9f5c05
7 changed files with 42 additions and 38 deletions

View File

@ -335,6 +335,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
fclose(input);
fclose(output);
return false;
}
}
@ -346,6 +348,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
fclose(input);
fclose(output);
return false;
}
}

View File

@ -220,7 +220,7 @@ u32 sceKernelStderr() {
}
void __IoCompleteAsyncIO(SceUID id) {
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
if (f->callbackID) {
@ -267,7 +267,7 @@ u32 sceIoRead(int id, u32 data_addr, int size) {
return 0; //stdin
}
u32 error;
u32 error = 0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
if (data_addr) {
@ -303,7 +303,7 @@ u32 sceIoWrite(int id, void *data_ptr, int size) //(int fd, void *data, int size
str[size] = temp;
return size;
}
u32 error;
u32 error = 0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
u8 *data = (u8*) data_ptr;
@ -316,7 +316,7 @@ u32 sceIoWrite(int id, void *data_ptr, int size) //(int fd, void *data, int size
}
s64 sceIoLseek(int id, s64 offset, int whence) {
u32 error;
u32 error = 0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
FileMove seek = FILEMOVE_BEGIN;
@ -344,7 +344,7 @@ s64 sceIoLseek(int id, s64 offset, int whence) {
}
u32 sceIoLseek32(int id, int offset, int whence) {
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
DEBUG_LOG(HLE, "sceIoLseek32(%d,%08x,%i)", id, (int) offset, whence);
@ -708,7 +708,7 @@ u32 sceIoSetAsyncCallback(int id, u32 clbckId, u32 clbckArg)
DEBUG_LOG(HLE, "sceIoSetAsyncCallback(%d, %i, %08x)", id, clbckId,
clbckArg);
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f)
{
@ -751,7 +751,7 @@ u32 sceIoReadAsync(int id, u32 data_addr, int size)
u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
{
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f)
{
@ -770,7 +770,7 @@ u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
}
int sceIoWaitAsync(int id, u32 address) {
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
u64 res = f->asyncResult;
@ -791,7 +791,7 @@ int sceIoWaitAsync(int id, u32 address) {
int sceIoWaitAsyncCB(int id, u32 address) {
// Should process callbacks here
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
u64 res = f->asyncResult;
@ -813,7 +813,7 @@ int sceIoWaitAsyncCB(int id, u32 address) {
}
u32 sceIoPollAsync(int id, u32 address) {
u32 error;
u32 error=0;
FileNode *f = kernelObjects.Get < FileNode > (id, error);
if (f) {
u64 res = f->asyncResult;
@ -859,7 +859,7 @@ u32 sceIoDopen(const char *path) {
}
u32 sceIoDread(int id, u32 dirent_addr) {
u32 error;
u32 error=0;
DirListing *dir = kernelObjects.Get<DirListing>(id, error);
if (dir) {
if (dir->index == (int) dir->listing.size()) {

View File

@ -84,7 +84,7 @@ void __KernelTriggerAlarm(u64 userdata, int cyclesLate)
{
int uid = (int) userdata;
u32 error;
u32 error=0;
Alarm *alarm = kernelObjects.Get<Alarm>(uid, error);
if (alarm)
__TriggerInterrupt(PSP_INTR_IMMEDIATE, PSP_SYSTIMER0_INTR, uid);
@ -152,7 +152,7 @@ int sceKernelCancelAlarm(SceUID uid)
int sceKernelReferAlarmStatus(SceUID uid, u32 infoPtr)
{
u32 error;
u32 error=0;
Alarm *alarm = kernelObjects.Get<Alarm>(uid, error);
if (!alarm)
{

View File

@ -204,7 +204,7 @@ u32 sceKernelCancelEventFlag(SceUID uid, u32 pattern, u32 numWaitThreadsPtr)
{
DEBUG_LOG(HLE, "sceKernelCancelEventFlag(%i, %08X, %08X)", uid, pattern, numWaitThreadsPtr);
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(uid, error);
if (e)
{
@ -225,7 +225,7 @@ u32 sceKernelCancelEventFlag(SceUID uid, u32 pattern, u32 numWaitThreadsPtr)
u32 sceKernelClearEventFlag(SceUID id, u32 bits)
{
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
{
@ -245,7 +245,7 @@ u32 sceKernelDeleteEventFlag(SceUID uid)
{
DEBUG_LOG(HLE, "sceKernelDeleteEventFlag(%i)", uid);
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(uid, error);
if (e)
{
@ -261,7 +261,7 @@ u32 sceKernelDeleteEventFlag(SceUID uid)
u32 sceKernelSetEventFlag(SceUID id, u32 bitsToSet)
{
u32 error;
u32 error=0;
DEBUG_LOG(HLE, "sceKernelSetEventFlag(%i, %08x)", id, bitsToSet);
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
@ -367,7 +367,7 @@ int sceKernelWaitEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti
if (bits == 0)
return SCE_KERNEL_ERROR_EVF_ILPAT;
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
{
@ -420,7 +420,7 @@ int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32
if (bits == 0)
return SCE_KERNEL_ERROR_EVF_ILPAT;
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
{
@ -481,7 +481,7 @@ int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti
if (bits == 0)
return SCE_KERNEL_ERROR_EVF_ILPAT;
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
{
@ -511,7 +511,7 @@ int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti
u32 sceKernelReferEventFlagStatus(SceUID id, u32 statusPtr)
{
DEBUG_LOG(HLE, "sceKernelReferEventFlagStatus(%i, %08x)", id, statusPtr);
u32 error;
u32 error=0;
EventFlag *e = kernelObjects.Get<EventFlag>(id, error);
if (e)
{

View File

@ -295,7 +295,7 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr)
int sceKernelDeleteMbx(SceUID id)
{
u32 error;
u32 error=0;
Mbx *m = kernelObjects.Get<Mbx>(id, error);
if (m)
{
@ -318,7 +318,7 @@ int sceKernelDeleteMbx(SceUID id)
int sceKernelSendMbx(SceUID id, u32 packetAddr)
{
u32 error;
u32 error=0;
Mbx *m = kernelObjects.Get<Mbx>(id, error);
if (!m)
{

View File

@ -186,7 +186,7 @@ void sceKernelCreateMsgPipe()
void sceKernelDeleteMsgPipe()
{
SceUID uid = PARAM(0);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m)
{
@ -320,7 +320,7 @@ void sceKernelSendMsgPipe()
u32 resultAddr = PARAM(4);
u32 timeoutPtr = PARAM(5);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelSendMsgPipe(%i) - ERROR %08x", uid, error);
@ -341,7 +341,7 @@ void sceKernelSendMsgPipeCB()
u32 resultAddr = PARAM(4);
u32 timeoutPtr = PARAM(5);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelSendMsgPipeCB(%i) - ERROR %08x", uid, error);
@ -362,7 +362,7 @@ void sceKernelTrySendMsgPipe()
int waitMode = PARAM(3);
u32 resultAddr = PARAM(4);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelTrySendMsgPipe(%i) - ERROR %08x", uid, error);
@ -496,7 +496,7 @@ void sceKernelReceiveMsgPipe()
u32 resultAddr = PARAM(4);
u32 timeoutPtr = PARAM(5);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelReceiveMsgPipe(%i) - ERROR %08x", uid, error);
@ -517,7 +517,7 @@ void sceKernelReceiveMsgPipeCB()
u32 resultAddr = PARAM(4);
u32 timeoutPtr = PARAM(5);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelReceiveMsgPipeCB(%i) - ERROR %08x", uid, error);
@ -537,7 +537,7 @@ void sceKernelTryReceiveMsgPipe()
int waitMode = PARAM(3);
u32 resultAddr = PARAM(4);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m) {
ERROR_LOG(HLE, "sceKernelTryReceiveMsgPipe(%i) - ERROR %08x", uid, error);
@ -555,7 +555,7 @@ void sceKernelCancelMsgPipe()
u32 numSendThreadsAddr = PARAM(1);
u32 numReceiveThreadsAddr = PARAM(2);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (!m)
{
@ -588,7 +588,7 @@ void sceKernelReferMsgPipeStatus()
u32 msgPipeStatusAddr = PARAM(1);
DEBUG_LOG(HLE,"sceKernelReferMsgPipeStatus(%i, %08x)", uid, msgPipeStatusAddr);
u32 error;
u32 error=0;
MsgPipe *m = kernelObjects.Get<MsgPipe>(uid, error);
if (m)
{

View File

@ -139,7 +139,7 @@ int sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr)
{
DEBUG_LOG(HLE, "sceKernelCancelSema(%i)", id);
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{
@ -206,7 +206,7 @@ int sceKernelDeleteSema(SceUID id)
{
DEBUG_LOG(HLE, "sceKernelDeleteSema(%i)", id);
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{
@ -225,7 +225,7 @@ int sceKernelDeleteSema(SceUID id)
int sceKernelReferSemaStatus(SceUID id, u32 infoPtr)
{
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{
@ -242,7 +242,7 @@ int sceKernelReferSemaStatus(SceUID id, u32 infoPtr)
int sceKernelSignalSema(SceUID id, int signal)
{
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{
@ -324,7 +324,7 @@ void __KernelSetSemaTimeout(Semaphore *s, u32 timeoutPtr)
int __KernelWaitSema(SceUID id, int wantedCount, u32 timeoutPtr, const char *badSemaMessage, bool processCallbacks)
{
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{
@ -376,7 +376,7 @@ int sceKernelPollSema(SceUID id, int wantedCount)
if (wantedCount <= 0)
return SCE_KERNEL_ERROR_ILLEGAL_COUNT;
u32 error;
u32 error=0;
Semaphore *s = kernelObjects.Get<Semaphore>(id, error);
if (s)
{