libwhb: Use FS_ERROR_FLAG_ALL instead of -1

This commit is contained in:
Maschell 2020-12-29 09:43:22 +01:00 committed by fincs
parent 510409db7a
commit af99d5acbd
2 changed files with 12 additions and 12 deletions

View File

@ -16,7 +16,7 @@ InitFileSystem()
if (!sInitialised) { if (!sInitialised) {
FSInit(); FSInit();
if (FSAddClient(&sClient, -1) != FS_STATUS_OK) { if (FSAddClient(&sClient, FS_ERROR_FLAG_ALL) != FS_STATUS_OK) {
return FALSE; return FALSE;
} }
@ -30,7 +30,7 @@ BOOL
WHBDeInitFileSystem() WHBDeInitFileSystem()
{ {
if (sInitialised) { if (sInitialised) {
if (FSDelClient(&sClient, -1) != FS_STATUS_OK) { if (FSDelClient(&sClient, FS_ERROR_FLAG_ALL) != FS_STATUS_OK) {
return FALSE; return FALSE;
} }
@ -62,7 +62,7 @@ WHBOpenFile(const char *path,
} }
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSOpenFile(&sClient, &cmd, tmp, mode, &handle, -1); result = FSOpenFile(&sClient, &cmd, tmp, mode, &handle, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSOpenFile error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSOpenFile error %d", __FUNCTION__, result);
return WHB_FILE_FATAL_ERROR; return WHB_FILE_FATAL_ERROR;
@ -78,7 +78,7 @@ WHBGetFileSize(int32_t handle)
FSStatus result; FSStatus result;
FSStat stat; FSStat stat;
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSGetStatFile(&sClient, &cmd, (FSFileHandle)handle, &stat, -1); result = FSGetStatFile(&sClient, &cmd, (FSFileHandle)handle, &stat, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSGetStatFile error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSGetStatFile error %d", __FUNCTION__, result);
return 0; return 0;
@ -96,7 +96,7 @@ WHBReadFile(int32_t handle,
FSCmdBlock cmd; FSCmdBlock cmd;
FSStatus result; FSStatus result;
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSReadFile(&sClient, &cmd, buf, size, count, (FSFileHandle)handle, 0, -1); result = FSReadFile(&sClient, &cmd, buf, size, count, (FSFileHandle)handle, 0, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSReadFile error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSReadFile error %d", __FUNCTION__, result);
return 0; return 0;
@ -111,7 +111,7 @@ WHBCloseFile(int32_t handle)
FSCmdBlock cmd; FSCmdBlock cmd;
FSStatus result; FSStatus result;
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSCloseFile(&sClient, &cmd, (FSFileHandle)handle, -1); result = FSCloseFile(&sClient, &cmd, (FSFileHandle)handle, FS_ERROR_FLAG_ALL);
if (result != FS_STATUS_OK) { if (result != FS_STATUS_OK) {
WHBLogPrintf("%s: FSCloseFile error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSCloseFile error %d", __FUNCTION__, result);
return WHB_FILE_FATAL_ERROR; return WHB_FILE_FATAL_ERROR;

View File

@ -24,20 +24,20 @@ WHBMountSdCard()
FSInit(); FSInit();
result = FSAddClient(&sClient, -1); result = FSAddClient(&sClient, FS_ERROR_FLAG_ALL);
if (result != FS_STATUS_OK) { if (result != FS_STATUS_OK) {
WHBLogPrintf("%s: FSAddClient error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSAddClient error %d", __FUNCTION__, result);
return FALSE; return FALSE;
} }
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSGetMountSource(&sClient, &cmd, FS_MOUNT_SOURCE_SD, &mountSource, -1); result = FSGetMountSource(&sClient, &cmd, FS_MOUNT_SOURCE_SD, &mountSource, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSGetMountSource error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSGetMountSource error %d", __FUNCTION__, result);
goto fail; goto fail;
} }
result = FSMount(&sClient, &cmd, &mountSource, sMountPath, sizeof(sMountPath), -1); result = FSMount(&sClient, &cmd, &mountSource, sMountPath, sizeof(sMountPath), FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSMount error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSMount error %d", __FUNCTION__, result);
goto fail; goto fail;
@ -47,7 +47,7 @@ WHBMountSdCard()
return TRUE; return TRUE;
fail: fail:
FSDelClient(&sClient, -1); FSDelClient(&sClient, FS_ERROR_FLAG_ALL);
return FALSE; return FALSE;
} }
@ -69,13 +69,13 @@ WHBUnmountSdCard()
FSInitCmdBlock(&cmd); FSInitCmdBlock(&cmd);
result = FSUnmount(&sClient, &cmd, sMountPath, -1); result = FSUnmount(&sClient, &cmd, sMountPath, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSUnmount error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSUnmount error %d", __FUNCTION__, result);
return FALSE; return FALSE;
} }
result = FSDelClient(&sClient, -1); result = FSDelClient(&sClient, FS_ERROR_FLAG_ALL);
if (result < 0) { if (result < 0) {
WHBLogPrintf("%s: FSDelClient error %d", __FUNCTION__, result); WHBLogPrintf("%s: FSDelClient error %d", __FUNCTION__, result);
return FALSE; return FALSE;