mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 14:09:10 +00:00
Removed mostly unused SDL_errorcode
This commit is contained in:
parent
afe7c7a644
commit
04be04c338
9 changed files with 41 additions and 60 deletions
|
@ -230,7 +230,7 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
|
|||
|
||||
if (total_need < READAHEAD_BUFFER_SIZE) {
|
||||
if (!ReadFile(iodata->h, iodata->data, READAHEAD_BUFFER_SIZE, &bytes, NULL)) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
SDL_SetError("Error reading from datastream");
|
||||
return 0;
|
||||
}
|
||||
read_ahead = SDL_min(total_need, bytes);
|
||||
|
@ -240,7 +240,7 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
|
|||
total_read += read_ahead;
|
||||
} else {
|
||||
if (!ReadFile(iodata->h, ptr, (DWORD)total_need, &bytes, NULL)) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
SDL_SetError("Error reading from datastream");
|
||||
return 0;
|
||||
}
|
||||
total_read += bytes;
|
||||
|
@ -256,7 +256,7 @@ static size_t SDLCALL windows_file_write(void *userdata, const void *ptr, size_t
|
|||
|
||||
if (iodata->left) {
|
||||
if (!SetFilePointer(iodata->h, -(LONG)iodata->left, NULL, FILE_CURRENT)) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
SDL_SetError("Error seeking in datastream");
|
||||
return 0;
|
||||
}
|
||||
iodata->left = 0;
|
||||
|
@ -267,13 +267,13 @@ static size_t SDLCALL windows_file_write(void *userdata, const void *ptr, size_t
|
|||
LARGE_INTEGER windowsoffset;
|
||||
windowsoffset.QuadPart = 0;
|
||||
if (!SetFilePointerEx(iodata->h, windowsoffset, &windowsoffset, FILE_END)) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
SDL_SetError("Error seeking in datastream");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!WriteFile(iodata->h, ptr, (DWORD)total_bytes, &bytes, NULL)) {
|
||||
SDL_Error(SDL_EFWRITE);
|
||||
SDL_SetError("Error writing to datastream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, int whence)
|
|||
}
|
||||
return pos;
|
||||
}
|
||||
return SDL_Error(SDL_EFSEEK);
|
||||
return SDL_SetError("Error seeking in datastream");
|
||||
}
|
||||
|
||||
static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size, SDL_IOStatus *status)
|
||||
|
@ -379,7 +379,7 @@ static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size, SDL_IOS
|
|||
IOStreamStdioData *iodata = (IOStreamStdioData *) userdata;
|
||||
const size_t bytes = fread(ptr, 1, size, iodata->fp);
|
||||
if (bytes == 0 && ferror(iodata->fp)) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
SDL_SetError("Error reading from datastream");
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size,
|
|||
IOStreamStdioData *iodata = (IOStreamStdioData *) userdata;
|
||||
const size_t bytes = fwrite(ptr, 1, size, iodata->fp);
|
||||
if (bytes == 0 && ferror(iodata->fp)) {
|
||||
SDL_Error(SDL_EFWRITE);
|
||||
SDL_SetError("Error writing to datastream");
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ static int SDLCALL stdio_close(void *userdata)
|
|||
int status = 0;
|
||||
if (iodata->autoclose) {
|
||||
if (fclose(iodata->fp) != 0) {
|
||||
status = SDL_Error(SDL_EFWRITE);
|
||||
status = SDL_SetError("Error writing to datastream");
|
||||
}
|
||||
}
|
||||
SDL_free(iodata);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue