From 8709ada140ab8a7318d5fbd5ad92a6739a3ab327 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 16 Jan 2014 20:13:13 +0900 Subject: [PATCH] replace fpos_t with long since old versions of clang and gcc seem claim that fpos_t and long are not convertible --- include/picrin/port.h | 4 ++-- src/port.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/picrin/port.h b/include/picrin/port.h index f9359753..44f2299f 100644 --- a/include/picrin/port.h +++ b/include/picrin/port.h @@ -37,7 +37,7 @@ typedef struct { void *cookie; int (*read)(void *, char *, int); int (*write)(void *, const char *, int); - fpos_t (*seek)(void *, fpos_t, int); + long (*seek)(void *, long, int); int (*close)(void *); } vtable; } pic_file; @@ -62,7 +62,7 @@ int pic_setvbuf(pic_file *, char *, int, size_t); int pic_fflush(pic_file *); int pic_ffill(pic_file *); -pic_file *pic_funopen(void *cookie, int (*read)(void *, char *, int), int (*write)(void *, const char *, int), fpos_t (*seek)(void *, fpos_t, int), int (*close)(void *)); +pic_file *pic_funopen(void *cookie, int (*read)(void *, char *, int), int (*write)(void *, const char *, int), long (*seek)(void *, long, int), int (*close)(void *)); /* file access */ pic_file *pic_fopen(const char *, const char *); diff --git a/src/port.c b/src/port.c index 45f6cfdd..d6019ac9 100644 --- a/src/port.c +++ b/src/port.c @@ -95,7 +95,7 @@ pic_file * pic_funopen(void *cookie, int (*read)(void *, char *, int), int (*write)(void *, const char *, int), - fpos_t (*seek)(void *, fpos_t, int), + long (*seek)(void *, long, int), int (*close)(void *)) { pic_file *file; @@ -134,10 +134,10 @@ file_write(void *cookie, const char *ptr, int size) return fwrite(ptr, 1, size, (FILE *)cookie); } -static fpos_t -file_seek(void *cookie, fpos_t pos, int whence) +static long +file_seek(void *cookie, long pos, int whence) { - return fseek((FILE *)cookie, (long)pos, whence); + return fseek((FILE *)cookie, pos, whence); } static int