fix EOF handling bug in mpq decoder

This commit is contained in:
Alex Yatskov 2018-12-17 17:26:10 -08:00
parent 1c667c7b8d
commit feeff0796e

View File

@ -66,7 +66,7 @@ func (f *file) Read(data []byte) (int, error) {
if result := C.SFileReadFile(f.handle, unsafe.Pointer(&data[0]), C.uint(len(data)), (*C.uint)(unsafe.Pointer(&bytesRead)), nil); result == 0 {
lastError := getLastError()
if lastError == 1002 { // ERROR_HANDLE_EOF
return 0, io.EOF
return bytesRead, io.EOF
}
return 0, fmt.Errorf("failed to read file (%d)", lastError)