From c9852501a4e1c92dafb35f81f337cb653f8bf501 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 9 Jan 2016 19:43:34 -0300 Subject: [PATCH] Fix bug related to EOF in Android FileAccess --- platform/android/file_access_android.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index 885c0f38068..7a038cca648 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -132,12 +132,18 @@ int FileAccessAndroid::get_buffer(uint8_t *p_dst, int p_length) const { off_t r = AAsset_read(a,p_dst,p_length); + + if (pos+p_length >len ) { + eof=true; + } + if (r>=0) { + pos+=r; if (pos>len) { pos=len; - eof=true; } + } return r;