diff options
| author | 2015-01-23 03:44:52 -0200 | |
|---|---|---|
| committer | 2015-01-30 11:49:45 -0200 | |
| commit | 09ae6e1fa38bbf75dcb2796e96575fdba32ec69c (patch) | |
| tree | e760cb36500849a65931a2f0ad0d6174be617601 /src/core/hle/service | |
| parent | SVC: Change return type of handlers to ResultCode (diff) | |
| download | yuzu-09ae6e1fa38bbf75dcb2796e96575fdba32ec69c.tar.gz yuzu-09ae6e1fa38bbf75dcb2796e96575fdba32ec69c.tar.xz yuzu-09ae6e1fa38bbf75dcb2796e96575fdba32ec69c.zip | |
Remove result.h InvalidHandle
It was only being used in two places, where it was replaced by a local
constant.
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/fs/archive.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 1bb4e4b23..6682f6590 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp | |||
| @@ -43,6 +43,11 @@ const std::string SDCARD_ID = "00000000000000000000000000000000"; | |||
| 43 | namespace Service { | 43 | namespace Service { |
| 44 | namespace FS { | 44 | namespace FS { |
| 45 | 45 | ||
| 46 | // TODO: Verify code | ||
| 47 | /// Returned when a function is passed an invalid handle. | ||
| 48 | const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::FS, | ||
| 49 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | ||
| 50 | |||
| 46 | // Command to access archive file | 51 | // Command to access archive file |
| 47 | enum class FileCommand : u32 { | 52 | enum class FileCommand : u32 { |
| 48 | Dummy1 = 0x000100C6, | 53 | Dummy1 = 0x000100C6, |
| @@ -280,7 +285,7 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi | |||
| 280 | 285 | ||
| 281 | ResultCode CloseArchive(ArchiveHandle handle) { | 286 | ResultCode CloseArchive(ArchiveHandle handle) { |
| 282 | if (handle_map.erase(handle) == 0) | 287 | if (handle_map.erase(handle) == 0) |
| 283 | return InvalidHandle(ErrorModule::FS); | 288 | return ERR_INVALID_HANDLE; |
| 284 | else | 289 | else |
| 285 | return RESULT_SUCCESS; | 290 | return RESULT_SUCCESS; |
| 286 | } | 291 | } |
| @@ -301,7 +306,7 @@ ResultCode CreateArchive(std::unique_ptr<FileSys::ArchiveBackend>&& backend, Arc | |||
| 301 | ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path, const FileSys::Mode mode) { | 306 | ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path, const FileSys::Mode mode) { |
| 302 | Archive* archive = GetArchive(archive_handle); | 307 | Archive* archive = GetArchive(archive_handle); |
| 303 | if (archive == nullptr) | 308 | if (archive == nullptr) |
| 304 | return InvalidHandle(ErrorModule::FS); | 309 | return ERR_INVALID_HANDLE; |
| 305 | 310 | ||
| 306 | std::unique_ptr<FileSys::FileBackend> backend = archive->backend->OpenFile(path, mode); | 311 | std::unique_ptr<FileSys::FileBackend> backend = archive->backend->OpenFile(path, mode); |
| 307 | if (backend == nullptr) { | 312 | if (backend == nullptr) { |
| @@ -318,7 +323,7 @@ ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 318 | ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 323 | ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| 319 | Archive* archive = GetArchive(archive_handle); | 324 | Archive* archive = GetArchive(archive_handle); |
| 320 | if (archive == nullptr) | 325 | if (archive == nullptr) |
| 321 | return InvalidHandle(ErrorModule::FS); | 326 | return ERR_INVALID_HANDLE; |
| 322 | 327 | ||
| 323 | if (archive->backend->DeleteFile(path)) | 328 | if (archive->backend->DeleteFile(path)) |
| 324 | return RESULT_SUCCESS; | 329 | return RESULT_SUCCESS; |
| @@ -331,7 +336,7 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const Fil | |||
| 331 | Archive* src_archive = GetArchive(src_archive_handle); | 336 | Archive* src_archive = GetArchive(src_archive_handle); |
| 332 | Archive* dest_archive = GetArchive(dest_archive_handle); | 337 | Archive* dest_archive = GetArchive(dest_archive_handle); |
| 333 | if (src_archive == nullptr || dest_archive == nullptr) | 338 | if (src_archive == nullptr || dest_archive == nullptr) |
| 334 | return InvalidHandle(ErrorModule::FS); | 339 | return ERR_INVALID_HANDLE; |
| 335 | 340 | ||
| 336 | if (src_archive == dest_archive) { | 341 | if (src_archive == dest_archive) { |
| 337 | if (src_archive->backend->RenameFile(src_path, dest_path)) | 342 | if (src_archive->backend->RenameFile(src_path, dest_path)) |
| @@ -350,7 +355,7 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const Fil | |||
| 350 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 355 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| 351 | Archive* archive = GetArchive(archive_handle); | 356 | Archive* archive = GetArchive(archive_handle); |
| 352 | if (archive == nullptr) | 357 | if (archive == nullptr) |
| 353 | return InvalidHandle(ErrorModule::FS); | 358 | return ERR_INVALID_HANDLE; |
| 354 | 359 | ||
| 355 | if (archive->backend->DeleteDirectory(path)) | 360 | if (archive->backend->DeleteDirectory(path)) |
| 356 | return RESULT_SUCCESS; | 361 | return RESULT_SUCCESS; |
| @@ -361,7 +366,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 361 | ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size) { | 366 | ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u32 file_size) { |
| 362 | Archive* archive = GetArchive(archive_handle); | 367 | Archive* archive = GetArchive(archive_handle); |
| 363 | if (archive == nullptr) | 368 | if (archive == nullptr) |
| 364 | return InvalidHandle(ErrorModule::FS); | 369 | return ERR_INVALID_HANDLE; |
| 365 | 370 | ||
| 366 | return archive->backend->CreateFile(path, file_size); | 371 | return archive->backend->CreateFile(path, file_size); |
| 367 | } | 372 | } |
| @@ -369,7 +374,7 @@ ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path | |||
| 369 | ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 374 | ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| 370 | Archive* archive = GetArchive(archive_handle); | 375 | Archive* archive = GetArchive(archive_handle); |
| 371 | if (archive == nullptr) | 376 | if (archive == nullptr) |
| 372 | return InvalidHandle(ErrorModule::FS); | 377 | return ERR_INVALID_HANDLE; |
| 373 | 378 | ||
| 374 | if (archive->backend->CreateDirectory(path)) | 379 | if (archive->backend->CreateDirectory(path)) |
| 375 | return RESULT_SUCCESS; | 380 | return RESULT_SUCCESS; |
| @@ -382,7 +387,7 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, cons | |||
| 382 | Archive* src_archive = GetArchive(src_archive_handle); | 387 | Archive* src_archive = GetArchive(src_archive_handle); |
| 383 | Archive* dest_archive = GetArchive(dest_archive_handle); | 388 | Archive* dest_archive = GetArchive(dest_archive_handle); |
| 384 | if (src_archive == nullptr || dest_archive == nullptr) | 389 | if (src_archive == nullptr || dest_archive == nullptr) |
| 385 | return InvalidHandle(ErrorModule::FS); | 390 | return ERR_INVALID_HANDLE; |
| 386 | 391 | ||
| 387 | if (src_archive == dest_archive) { | 392 | if (src_archive == dest_archive) { |
| 388 | if (src_archive->backend->RenameDirectory(src_path, dest_path)) | 393 | if (src_archive->backend->RenameDirectory(src_path, dest_path)) |
| @@ -407,7 +412,7 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, cons | |||
| 407 | ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 412 | ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| 408 | Archive* archive = GetArchive(archive_handle); | 413 | Archive* archive = GetArchive(archive_handle); |
| 409 | if (archive == nullptr) | 414 | if (archive == nullptr) |
| 410 | return InvalidHandle(ErrorModule::FS); | 415 | return ERR_INVALID_HANDLE; |
| 411 | 416 | ||
| 412 | std::unique_ptr<FileSys::DirectoryBackend> backend = archive->backend->OpenDirectory(path); | 417 | std::unique_ptr<FileSys::DirectoryBackend> backend = archive->backend->OpenDirectory(path); |
| 413 | if (backend == nullptr) { | 418 | if (backend == nullptr) { |