From 51862bb98c26e9b3f03d46ae0f8ceb434f0743d0 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Fri, 13 Nov 2009 14:44:53 -0800 Subject: fileio: improve API types Use size_t instead of uint32_t when specifying file sizes. Update all consumers up through the layers to use size_t when required. These changes should be safe, but the higher-levels will need to be updated further to receive the intended benefits (i.e. large file support). Add error checking for fileio_read and file_write. Previously, all errors were being silently ignored, so this change might cause some problems for some people in some cases. However, it gives us the chance to handle any errors that do occur at higher-levels, rather than burying our heads in the sand. --- src/helper/fileio.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/helper/fileio.h') diff --git a/src/helper/fileio.h b/src/helper/fileio.h index 6ed6fe45..325b441f 100644 --- a/src/helper/fileio.h +++ b/src/helper/fileio.h @@ -58,13 +58,13 @@ int fileio_open(struct fileio *fileio, const char *url, enum fileio_access access, enum fileio_type type); int fileio_close(struct fileio *fileio); -int fileio_seek(struct fileio *fileio, uint32_t position); -int fileio_fgets(struct fileio *fileio, uint32_t size, char *buffer); +int fileio_seek(struct fileio *fileio, size_t position); +int fileio_fgets(struct fileio *fileio, size_t size, void *buffer); int fileio_read(struct fileio *fileio, - uint32_t size, uint8_t *buffer, uint32_t *size_read); + size_t size, void *buffer, size_t *size_read); int fileio_write(struct fileio *fileio, - uint32_t size, const uint8_t *buffer, uint32_t *size_written); + size_t size, const void *buffer, size_t *size_written); int fileio_read_u32(struct fileio *fileio, uint32_t *data); int fileio_write_u32(struct fileio *fileio, uint32_t data); -- cgit v1.2.3