Return error codes from SavedataParam::GetSizes().

Rather than true/false, makes things simpler.
This commit is contained in:
Unknown W. Brackets 2013-06-23 11:14:13 -07:00
parent 16752f57b6
commit 3672b591bb
3 changed files with 6 additions and 10 deletions

View File

@ -872,10 +872,7 @@ int PSPSaveDialog::Update()
status = SCE_UTILITY_STATUS_FINISHED;
break;
case SCE_UTILITY_SAVEDATA_TYPE_SIZES:
if (param.GetSizes(param.GetPspParam()))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA;
param.GetPspParam()->common.result = param.GetSizes(param.GetPspParam());
status = SCE_UTILITY_STATUS_FINISHED;
break;
case SCE_UTILITY_SAVEDATA_TYPE_LIST:

View File

@ -721,13 +721,13 @@ std::string SavedataParam::GetSpaceText(int size)
return std::string(text);
}
bool SavedataParam::GetSizes(SceUtilitySavedataParam *param)
int SavedataParam::GetSizes(SceUtilitySavedataParam *param)
{
if (!param) {
return false;
return SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA;
}
bool ret = true;
int ret = 0;
if (param->msFree.Valid())
{
@ -758,8 +758,7 @@ bool SavedataParam::GetSizes(SceUtilitySavedataParam *param)
strncpy(param->msData->info.usedSpaceStr, "", sizeof(param->msData->info.usedSpaceStr));
param->msData->info.usedSpace32KB = 0;
strncpy(param->msData->info.usedSpace32Str, "", sizeof(param->msData->info.usedSpace32Str));
ret = false;
// this should return SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA
ret = SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA;
}
}
if (param->utilityData.Valid())

View File

@ -258,7 +258,7 @@ public:
bool Delete(SceUtilitySavedataParam* param, int saveId = -1);
bool Save(SceUtilitySavedataParam* param, const std::string &saveDirName, bool secureMode = true);
bool Load(SceUtilitySavedataParam* param, const std::string &saveDirName, int saveId = -1, bool secureMode = true);
bool GetSizes(SceUtilitySavedataParam* param);
int GetSizes(SceUtilitySavedataParam* param);
bool GetList(SceUtilitySavedataParam* param);
int GetFilesList(SceUtilitySavedataParam* param);
bool GetSize(SceUtilitySavedataParam* param);