You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Cleanup Android C++ code
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user