diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-10-29 14:15:59 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-10-29 14:15:59 +0000 |
commit | d400e23e38daeed71e0cabcf065b55c1d15023d7 (patch) | |
tree | d7dd2193b73d6f8e5be2087dc6ff79c7f62f2b53 | |
parent | 75eff7af5e23bb86b376746c1216b553d1efbc35 (diff) |
Prefix the error constants with ERR_
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15359 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/buffering.c | 32 | ||||
-rw-r--r-- | apps/buffering.h | 10 | ||||
-rw-r--r-- | apps/playback.c | 12 |
3 files changed, 27 insertions, 27 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 35e47fe51e..0600202717 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -803,11 +803,11 @@ management functions for all the actual handle management work. int bufopen(const char *file, size_t offset, enum data_type type) { if (!can_add_handle()) - return BUFFER_FULL; + return ERR_BUFFER_FULL; int fd = open(file, O_RDONLY); if (fd < 0) - return FILE_ERROR; + return ERR_FILE_ERROR; size_t size = filesize(fd); @@ -816,7 +816,7 @@ int bufopen(const char *file, size_t offset, enum data_type type) { DEBUGF("bufopen: failed to add handle\n"); close(fd); - return BUFFER_FULL; + return ERR_BUFFER_FULL; } strncpy(h->path, file, MAX_PATH); @@ -854,12 +854,12 @@ int bufopen(const char *file, size_t offset, enum data_type type) int bufalloc(const void *src, size_t size, enum data_type type) { if (!can_add_handle()) - return BUFFER_FULL; + return ERR_BUFFER_FULL; struct memory_handle *h = add_handle(size, false, true); if (!h) - return BUFFER_FULL; + return ERR_BUFFER_FULL; if (src) { if (type == TYPE_ID3 && size == sizeof(struct mp3entry)) { @@ -907,11 +907,11 @@ int bufseek(int handle_id, size_t newpos) { struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; if (newpos > h->filesize) { /* access beyond the end of the file */ - return INVALID_VALUE; + return ERR_INVALID_VALUE; } else if (newpos < h->offset || h->offset + h->available < newpos) { /* access before or after buffered data. A rebuffer is needed. */ @@ -929,7 +929,7 @@ int bufadvance(int handle_id, off_t offset) { const struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; size_t newpos = h->offset + RINGBUF_SUB(h->ridx, h->data) + offset; return bufseek(handle_id, newpos); @@ -941,18 +941,18 @@ ssize_t bufread(int handle_id, size_t size, void *dest) { const struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; size_t ret; size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); if (size == 0 && h->filerem > 0 && copy_n == 0) /* Data isn't ready */ - return DATA_NOT_READY; + return ERR_DATA_NOT_READY; if (copy_n < size && h->filerem > 0) /* Data isn't ready */ - return DATA_NOT_READY; + return ERR_DATA_NOT_READY; if (copy_n == 0 && h->filerem == 0) /* File is finished reading */ @@ -984,18 +984,18 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) { const struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; ssize_t ret; size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); if (size == 0 && h->filerem > 0 && copy_n == 0) /* Data isn't ready */ - return DATA_NOT_READY; + return ERR_DATA_NOT_READY; if (copy_n < size && h->filerem > 0) /* Data isn't ready */ - return DATA_NOT_READY; + return ERR_DATA_NOT_READY; if (copy_n == 0 && h->filerem == 0) /* File is finished reading */ @@ -1040,7 +1040,7 @@ ssize_t buf_get_offset(int handle_id, void *ptr) { const struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; return (size_t)ptr - (size_t)&buffer[h->ridx]; } @@ -1049,7 +1049,7 @@ ssize_t buf_handle_offset(int handle_id) { const struct memory_handle *h = find_handle(handle_id); if (!h) - return HANDLE_NOT_FOUND; + return ERR_HANDLE_NOT_FOUND; return h->offset; } diff --git a/apps/buffering.h b/apps/buffering.h index 7dc07f5881..f7e298f72c 100644 --- a/apps/buffering.h +++ b/apps/buffering.h @@ -36,11 +36,11 @@ enum data_type { }; /* Error return values */ -#define HANDLE_NOT_FOUND -1 -#define BUFFER_FULL -2 -#define INVALID_VALUE -3 -#define FILE_ERROR -4 -#define DATA_NOT_READY -5 +#define ERR_HANDLE_NOT_FOUND -1 +#define ERR_BUFFER_FULL -2 +#define ERR_INVALID_VALUE -3 +#define ERR_FILE_ERROR -4 +#define ERR_DATA_NOT_READY -5 /* Initialise the buffering subsystem */ diff --git a/apps/playback.c b/apps/playback.c index 23e8da30e1..e42f9b172d 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -366,11 +366,11 @@ static void *bufgetcodec(struct track_info *track) void *ptr; ssize_t ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); - if (ret == DATA_NOT_READY) { + if (ret == ERR_DATA_NOT_READY) { buf_request_buffer_handle(track->codec_hid); } - while (ret == DATA_NOT_READY) { + while (ret == ERR_DATA_NOT_READY) { sleep(1); ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); } @@ -1516,13 +1516,13 @@ static size_t codec_filebuf_callback(void *ptr, size_t size) return 0; - if (copy_n == DATA_NOT_READY) + if (copy_n == ERR_DATA_NOT_READY) { buf_request_buffer_handle(CUR_TI->audio_hid); } /* Let the disk buffer catch fill until enough data is available */ - while (copy_n == DATA_NOT_READY) + while (copy_n == ERR_DATA_NOT_READY) { sleep(1); @@ -1561,13 +1561,13 @@ static void* codec_request_buffer_callback(size_t *realsize, size_t reqsize) return NULL; } - if (ret == DATA_NOT_READY) + if (ret == ERR_DATA_NOT_READY) { buf_request_buffer_handle(CUR_TI->audio_hid); } /* Let the disk buffer catch fill until enough data is available */ - while (ret == DATA_NOT_READY) + while (ret == ERR_DATA_NOT_READY) { sleep(1); |