diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-31 23:48:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 23:48:16 +0200 |
commit | b777454097701595cb22a9e9249f76bec0e850d0 (patch) | |
tree | 4eacd63e1e5ab94b857050aa75e4e1d30604bb4d /platform/android/file_access_android.cpp | |
parent | d8b0a8cd29c1f67fe850d0df0ca09ffb4d73fe10 (diff) | |
parent | 2afef001e702046378a02fa887dbb361f39c7b6e (diff) |
Merge pull request #61573 from madmiraal/android-cleanup
Cleanup Android C++ code
Diffstat (limited to 'platform/android/file_access_android.cpp')
-rw-r--r-- | platform/android/file_access_android.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index d7ba31e3c9..4bb8a13bb6 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -49,11 +49,11 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) { } ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, ERR_UNAVAILABLE); //can't write on android.. - a = AAssetManager_open(asset_manager, path.utf8().get_data(), AASSET_MODE_STREAMING); - if (!a) { + asset = AAssetManager_open(asset_manager, path.utf8().get_data(), AASSET_MODE_STREAMING); + if (!asset) { return ERR_CANT_OPEN; } - len = AAsset_getLength(a); + len = AAsset_getLength(asset); pos = 0; eof = false; @@ -61,21 +61,21 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) { } void FileAccessAndroid::_close() { - if (!a) { + if (!asset) { return; } - AAsset_close(a); - a = nullptr; + AAsset_close(asset); + asset = nullptr; } bool FileAccessAndroid::is_open() const { - return a != nullptr; + return asset != nullptr; } void FileAccessAndroid::seek(uint64_t p_position) { - ERR_FAIL_COND(!a); + ERR_FAIL_NULL(asset); - AAsset_seek(a, p_position, SEEK_SET); + AAsset_seek(asset, p_position, SEEK_SET); pos = p_position; if (pos > len) { pos = len; @@ -86,8 +86,8 @@ void FileAccessAndroid::seek(uint64_t p_position) { } void FileAccessAndroid::seek_end(int64_t p_position) { - ERR_FAIL_COND(!a); - AAsset_seek(a, p_position, SEEK_END); + ERR_FAIL_NULL(asset); + AAsset_seek(asset, p_position, SEEK_END); pos = len + p_position; } @@ -110,7 +110,7 @@ uint8_t FileAccessAndroid::get_8() const { } uint8_t byte; - AAsset_read(a, &byte, 1); + AAsset_read(asset, &byte, 1); pos++; return byte; } @@ -118,7 +118,7 @@ uint8_t FileAccessAndroid::get_8() const { uint64_t FileAccessAndroid::get_buffer(uint8_t *p_dst, uint64_t p_length) const { ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); - int r = AAsset_read(a, p_dst, p_length); + int r = AAsset_read(asset, p_dst, p_length); if (pos + p_length > len) { eof = true; |