fix EOF handling bug in mpq decoder
This commit is contained in:
parent
1c667c7b8d
commit
feeff0796e
@ -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 {
|
if result := C.SFileReadFile(f.handle, unsafe.Pointer(&data[0]), C.uint(len(data)), (*C.uint)(unsafe.Pointer(&bytesRead)), nil); result == 0 {
|
||||||
lastError := getLastError()
|
lastError := getLastError()
|
||||||
if lastError == 1002 { // ERROR_HANDLE_EOF
|
if lastError == 1002 { // ERROR_HANDLE_EOF
|
||||||
return 0, io.EOF
|
return bytesRead, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, fmt.Errorf("failed to read file (%d)", lastError)
|
return 0, fmt.Errorf("failed to read file (%d)", lastError)
|
||||||
|
Loading…
Reference in New Issue
Block a user