Ver Fonte

[File] Fix FileAccessCompressed::get_buffer return value.

It used to return the write index instead of the written bytes (i.e.
index + 1) when reading until last block.
Fabio Alessandrelli há 3 anos atrás
pai
commit
e8f7b79bb0
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      core/io/file_access_compressed.cpp

+ 2 - 2
core/io/file_access_compressed.cpp

@@ -312,10 +312,10 @@ uint64_t FileAccessCompressed::get_buffer(uint8_t *p_dst, uint64_t p_length) con
 			} else {
 				read_block--;
 				at_end = true;
-				if (i < p_length - 1) {
+				if (i + 1 < p_length) {
 					read_eof = true;
 				}
-				return i;
+				return i + 1;
 			}
 		}
 	}