changeset 219:faeeac291a6c

Oops, using "errno" as io_ctx struct member causes problems on some platforms. Switching to "status".
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Feb 2016 06:05:42 +0200
parents e20fdeee6bdf
children 099a1a156fd7
files th_ioctx.c th_ioctx.h
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/th_ioctx.c	Sun Feb 14 07:53:18 2016 +0200
+++ b/th_ioctx.c	Mon Feb 15 06:05:42 2016 +0200
@@ -32,9 +32,9 @@
     ctx->mode = th_strdup(mode);
 
     if (ctx->fops->fopen != NULL)
-        ctx->errno = ctx->fops->fopen(ctx);
+        ctx->status = ctx->fops->fopen(ctx);
 
-    return ctx->errno;
+    return ctx->status;
 }
 
 
@@ -335,7 +335,7 @@
 static int th_stdio_fopen(th_ioctx *ctx)
 {
     ctx->data = (void *) fopen(ctx->filename, ctx->mode);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return (ctx->data != NULL) ? THERR_OK : THERR_FOPEN;
 }
 
@@ -352,7 +352,7 @@
 
 static int th_stdio_ferror(th_ioctx *ctx)
 {
-    return ctx->errno;
+    return ctx->status;
 }
 
 
@@ -365,7 +365,7 @@
 static int th_stdio_fseek(th_ioctx *ctx, const off_t pos, const int whence)
 {
     int ret = fseeko(CTX_FH, pos, whence);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -414,7 +414,7 @@
 static int th_stdio_fgetc(th_ioctx *ctx)
 {
     int ret = fgetc(CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -422,7 +422,7 @@
 static int th_stdio_fputc(int v, th_ioctx *ctx)
 {
     int ret = fputc(v, CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -430,7 +430,7 @@
 static size_t th_stdio_fread(void *ptr, size_t size, size_t nmemb, th_ioctx *ctx)
 {
     size_t ret = fread(ptr, size, nmemb, CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -438,7 +438,7 @@
 static size_t th_stdio_fwrite(const void *ptr, size_t size, size_t nmemb, th_ioctx *ctx)
 {
     size_t ret = fwrite(ptr, size, nmemb, CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -446,7 +446,7 @@
 static char * th_stdio_fgets(char *str, int size, th_ioctx *ctx)
 {
     char *ret = fgets(str, size, CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -454,7 +454,7 @@
 static int th_stdio_fputs(const char *str, th_ioctx *ctx)
 {
     int ret = fputs(str, CTX_FH);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
@@ -462,7 +462,7 @@
 static int th_stdio_vfprintf(th_ioctx *ctx, const char *fmt, va_list ap)
 {
     int ret = vfprintf(CTX_FH, fmt, ap);
-    ctx->errno = th_get_error();
+    ctx->status = th_get_error();
     return ret;
 }
 
--- a/th_ioctx.h	Sun Feb 14 07:53:18 2016 +0200
+++ b/th_ioctx.h	Mon Feb 15 06:05:42 2016 +0200
@@ -30,7 +30,7 @@
     void *data;
     time_t atime;
     int64_t size;
-    int errno;
+    int status;
     size_t line;
 
     void (*error)(struct th_ioctx *, const int err, const char *msg);