platform dependent "sysEOF" const added
This commit is contained in:
parent
151cbe8739
commit
d8611e18ae
@ -9,13 +9,14 @@ package mpq
|
|||||||
// #define WINAPI
|
// #define WINAPI
|
||||||
// DWORD GetLastError();
|
// DWORD GetLastError();
|
||||||
// #endif
|
// #endif
|
||||||
|
//
|
||||||
// #define DWORD unsigned int
|
// #define DWORD unsigned int
|
||||||
// #define HANDLE void *
|
|
||||||
// #define LONG int
|
|
||||||
// #define LPDWORD unsigned int *
|
// #define LPDWORD unsigned int *
|
||||||
// #define LPOVERLAPPED void *
|
// #define LPOVERLAPPED void *
|
||||||
// #define TCHAR char
|
// #define TCHAR char
|
||||||
|
// #define HANDLE void *
|
||||||
// #define bool unsigned char
|
// #define bool unsigned char
|
||||||
|
// #define LONG int
|
||||||
//
|
//
|
||||||
// bool WINAPI SFileOpenArchive(const TCHAR * szMpqName, DWORD dwPriority, DWORD dwFlags, HANDLE * phMpq);
|
// bool WINAPI SFileOpenArchive(const TCHAR * szMpqName, DWORD dwPriority, DWORD dwFlags, HANDLE * phMpq);
|
||||||
// bool WINAPI SFileCloseArchive(HANDLE hMpq);
|
// bool WINAPI SFileCloseArchive(HANDLE hMpq);
|
||||||
@ -72,7 +73,7 @@ func (f *file) Read(data []byte) (int, error) {
|
|||||||
var bytesRead int
|
var bytesRead int
|
||||||
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 || lastError == 38 { // ERROR_HANDLE_EOF
|
if lastError == sysEOF { // ERROR_HANDLE_EOF
|
||||||
return bytesRead, io.EOF
|
return bytesRead, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
formats/mpq/mpq_linux.go
Normal file
7
formats/mpq/mpq_linux.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// +build linux
|
||||||
|
|
||||||
|
package mpq
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysEOF = 1002
|
||||||
|
)
|
7
formats/mpq/mpq_windows.go
Normal file
7
formats/mpq/mpq_windows.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// +build windows
|
||||||
|
|
||||||
|
package mpq
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysEOF = 38
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user