Mercurial > hg > th-libs
diff th_ioctx_stdio.c @ 771:c17eadc60c3d
Rename th_ioctx struct to th_ioctx_t, for consistency. Breaks API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 20 Feb 2023 23:33:45 +0200 |
parents | 6b778871f770 |
children | 1959ba53e9dc |
line wrap: on
line diff
--- a/th_ioctx_stdio.c Sun Feb 12 14:08:09 2023 +0200 +++ b/th_ioctx_stdio.c Mon Feb 20 23:33:45 2023 +0200 @@ -11,7 +11,7 @@ #define CTX_FH ((FILE *) ctx->data) -static int th_stdio_fopen(th_ioctx *ctx) +static int th_stdio_fopen(th_ioctx_t *ctx) { ctx->data = (void *) fopen(ctx->filename, ctx->mode); ctx->status = th_get_error(); @@ -19,7 +19,7 @@ } -static void th_stdio_fclose(th_ioctx *ctx) +static void th_stdio_fclose(th_ioctx_t *ctx) { if (CTX_FH != NULL) { @@ -29,19 +29,19 @@ } -static int th_stdio_ferror(th_ioctx *ctx) +static int th_stdio_ferror(th_ioctx_t *ctx) { return ctx->status; } -static off_t th_stdio_ftell(th_ioctx *ctx) +static off_t th_stdio_ftell(th_ioctx_t *ctx) { return ftello(CTX_FH); } -static int th_stdio_fseek(th_ioctx *ctx, const off_t pos, const int whence) +static int th_stdio_fseek(th_ioctx_t *ctx, const off_t pos, const int whence) { int ret = fseeko(CTX_FH, pos, whence); ctx->status = th_get_error(); @@ -49,13 +49,13 @@ } -static int th_stdio_freset(th_ioctx *ctx) +static int th_stdio_freset(th_ioctx_t *ctx) { return th_stdio_fseek(ctx, 0, SEEK_SET); } -static off_t th_stdio_fsize(th_ioctx *ctx) +static off_t th_stdio_fsize(th_ioctx_t *ctx) { off_t savePos, fileSize; @@ -81,13 +81,13 @@ } -static bool th_stdio_feof(th_ioctx *ctx) +static bool th_stdio_feof(th_ioctx_t *ctx) { return feof(CTX_FH); } -static int th_stdio_fgetc(th_ioctx *ctx) +static int th_stdio_fgetc(th_ioctx_t *ctx) { int ret = fgetc(CTX_FH); ctx->status = th_get_error(); @@ -95,7 +95,7 @@ } -static int th_stdio_fputc(int v, th_ioctx *ctx) +static int th_stdio_fputc(int v, th_ioctx_t *ctx) { int ret = fputc(v, CTX_FH); ctx->status = th_get_error(); @@ -103,7 +103,7 @@ } -static size_t th_stdio_fread(void *ptr, size_t size, size_t nmemb, th_ioctx *ctx) +static size_t th_stdio_fread(void *ptr, size_t size, size_t nmemb, th_ioctx_t *ctx) { size_t ret = fread(ptr, size, nmemb, CTX_FH); ctx->status = th_get_error(); @@ -111,7 +111,7 @@ } -static size_t th_stdio_fwrite(const void *ptr, size_t size, size_t nmemb, th_ioctx *ctx) +static size_t th_stdio_fwrite(const void *ptr, size_t size, size_t nmemb, th_ioctx_t *ctx) { size_t ret = fwrite(ptr, size, nmemb, CTX_FH); ctx->status = th_get_error(); @@ -119,7 +119,7 @@ } -static char * th_stdio_fgets(char *str, int size, th_ioctx *ctx) +static char * th_stdio_fgets(char *str, int size, th_ioctx_t *ctx) { char *ret = fgets(str, size, CTX_FH); ctx->status = th_get_error(); @@ -127,7 +127,7 @@ } -static int th_stdio_fputs(const char *str, th_ioctx *ctx) +static int th_stdio_fputs(const char *str, th_ioctx_t *ctx) { int ret = fputs(str, CTX_FH); ctx->status = th_get_error(); @@ -135,7 +135,7 @@ } -static int th_stdio_vfprintf(th_ioctx *ctx, const char *fmt, va_list ap) +static int th_stdio_vfprintf(th_ioctx_t *ctx, const char *fmt, va_list ap) { int ret = vfprintf(CTX_FH, fmt, ap); ctx->status = th_get_error(); @@ -143,7 +143,7 @@ } -const th_ioctx_ops th_stdio_io_ops = +const th_ioctx_t_ops th_stdio_io_ops = { "stdio",