More verbose error reporting.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1474 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-01-21 17:25:12 +00:00
parent 413ef31f94
commit d77b299a9f
+11 -4
View File
@@ -7,6 +7,9 @@
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_rwops.h" #include "SDL_rwops.h"
#include "libs/misc.h" #include "libs/misc.h"
#include <errno.h>
#include <string.h>
static SDL_RWops *sdluio_makeRWops (uio_Stream *stream); static SDL_RWops *sdluio_makeRWops (uio_Stream *stream);
@@ -30,7 +33,8 @@ sdluio_loadImage (uio_DirHandle *dir, const char *fileName) {
stream = uio_fopen (dir, fileName, "rb"); stream = uio_fopen (dir, fileName, "rb");
if (stream == NULL) if (stream == NULL)
{ {
SDL_SetError ("Couldn't open %s", fileName); SDL_SetError ("Couldn't open '%s': %s", fileName,
strerror(errno));
return NULL; return NULL;
} }
rwops = sdluio_makeRWops (stream); rwops = sdluio_makeRWops (stream);
@@ -44,7 +48,8 @@ sdluio_seek (SDL_RWops *context, int offset, int whence) {
if (uio_fseek ((uio_Stream *) context->hidden.unknown.data1, offset, if (uio_fseek ((uio_Stream *) context->hidden.unknown.data1, offset,
whence) == -1) whence) == -1)
{ {
SDL_SetError ("Error seeking in uio_Stream"); SDL_SetError ("Error seeking in uio_Stream: %s",
strerror(errno));
return -1; return -1;
} }
return uio_ftell ((uio_Stream *) context->hidden.unknown.data1); return uio_ftell ((uio_Stream *) context->hidden.unknown.data1);
@@ -59,7 +64,8 @@ sdluio_read (SDL_RWops *context, void *ptr, int size, int maxnum) {
if (numRead == 0 && uio_ferror ((uio_Stream *) if (numRead == 0 && uio_ferror ((uio_Stream *)
context->hidden.unknown.data1)) context->hidden.unknown.data1))
{ {
SDL_SetError ("Error reading from uio_Stream"); SDL_SetError ("Error reading from uio_Stream: %s",
strerror(errno));
return 0; return 0;
} }
return (int) numRead; return (int) numRead;
@@ -74,7 +80,8 @@ sdluio_write (SDL_RWops *context, const void *ptr, int size, int num) {
if (numWritten == 0 && uio_ferror ((uio_Stream *) if (numWritten == 0 && uio_ferror ((uio_Stream *)
context->hidden.unknown.data1)) context->hidden.unknown.data1))
{ {
SDL_SetError ("Error writing to uio_Stream"); SDL_SetError ("Error writing to uio_Stream: %s",
strerror(errno));
return 0; return 0;
} }
return (size_t) numWritten; return (size_t) numWritten;