You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #108329 from m4gr3d/fix_android_eof_detection
Android: Fix the EOF detection logic
This commit is contained in:
@@ -138,7 +138,6 @@ internal class AssetData(context: Context, private val filePath: String, accessF
|
||||
0
|
||||
} else {
|
||||
position += readBytes
|
||||
endOfFile = position() >= size()
|
||||
readBytes
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
|
||||
@@ -216,7 +216,6 @@ internal abstract class DataAccess {
|
||||
override fun seek(position: Long) {
|
||||
try {
|
||||
fileChannel.position(position)
|
||||
endOfFile = position >= fileChannel.size()
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Exception when seeking file $filePath.", e)
|
||||
}
|
||||
@@ -260,8 +259,8 @@ internal abstract class DataAccess {
|
||||
override fun read(buffer: ByteBuffer): Int {
|
||||
return try {
|
||||
val readBytes = fileChannel.read(buffer)
|
||||
endOfFile = readBytes == -1 || (fileChannel.position() >= fileChannel.size())
|
||||
if (readBytes == -1) {
|
||||
endOfFile = true
|
||||
0
|
||||
} else {
|
||||
readBytes
|
||||
|
||||
Reference in New Issue
Block a user