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 /apps | |
parent | 75eff7af5e23bb86b376746c1216b553d1efbc35 (diff) | |
download | rockbox-d400e23e38daeed71e0cabcf065b55c1d15023d7.tar.gz rockbox-d400e23e38daeed71e0cabcf065b55c1d15023d7.zip |
Prefix the error constants with ERR_
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15359 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-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. | |||
803 | int bufopen(const char *file, size_t offset, enum data_type type) | 803 | int bufopen(const char *file, size_t offset, enum data_type type) |
804 | { | 804 | { |
805 | if (!can_add_handle()) | 805 | if (!can_add_handle()) |
806 | return BUFFER_FULL; | 806 | return ERR_BUFFER_FULL; |
807 | 807 | ||
808 | int fd = open(file, O_RDONLY); | 808 | int fd = open(file, O_RDONLY); |
809 | if (fd < 0) | 809 | if (fd < 0) |
810 | return FILE_ERROR; | 810 | return ERR_FILE_ERROR; |
811 | 811 | ||
812 | size_t size = filesize(fd); | 812 | size_t size = filesize(fd); |
813 | 813 | ||
@@ -816,7 +816,7 @@ int bufopen(const char *file, size_t offset, enum data_type type) | |||
816 | { | 816 | { |
817 | DEBUGF("bufopen: failed to add handle\n"); | 817 | DEBUGF("bufopen: failed to add handle\n"); |
818 | close(fd); | 818 | close(fd); |
819 | return BUFFER_FULL; | 819 | return ERR_BUFFER_FULL; |
820 | } | 820 | } |
821 | 821 | ||
822 | strncpy(h->path, file, MAX_PATH); | 822 | strncpy(h->path, file, MAX_PATH); |
@@ -854,12 +854,12 @@ int bufopen(const char *file, size_t offset, enum data_type type) | |||
854 | int bufalloc(const void *src, size_t size, enum data_type type) | 854 | int bufalloc(const void *src, size_t size, enum data_type type) |
855 | { | 855 | { |
856 | if (!can_add_handle()) | 856 | if (!can_add_handle()) |
857 | return BUFFER_FULL; | 857 | return ERR_BUFFER_FULL; |
858 | 858 | ||
859 | struct memory_handle *h = add_handle(size, false, true); | 859 | struct memory_handle *h = add_handle(size, false, true); |
860 | 860 | ||
861 | if (!h) | 861 | if (!h) |
862 | return BUFFER_FULL; | 862 | return ERR_BUFFER_FULL; |
863 | 863 | ||
864 | if (src) { | 864 | if (src) { |
865 | if (type == TYPE_ID3 && size == sizeof(struct mp3entry)) { | 865 | if (type == TYPE_ID3 && size == sizeof(struct mp3entry)) { |
@@ -907,11 +907,11 @@ int bufseek(int handle_id, size_t newpos) | |||
907 | { | 907 | { |
908 | struct memory_handle *h = find_handle(handle_id); | 908 | struct memory_handle *h = find_handle(handle_id); |
909 | if (!h) | 909 | if (!h) |
910 | return HANDLE_NOT_FOUND; | 910 | return ERR_HANDLE_NOT_FOUND; |
911 | 911 | ||
912 | if (newpos > h->filesize) { | 912 | if (newpos > h->filesize) { |
913 | /* access beyond the end of the file */ | 913 | /* access beyond the end of the file */ |
914 | return INVALID_VALUE; | 914 | return ERR_INVALID_VALUE; |
915 | } | 915 | } |
916 | else if (newpos < h->offset || h->offset + h->available < newpos) { | 916 | else if (newpos < h->offset || h->offset + h->available < newpos) { |
917 | /* access before or after buffered data. A rebuffer is needed. */ | 917 | /* access before or after buffered data. A rebuffer is needed. */ |
@@ -929,7 +929,7 @@ int bufadvance(int handle_id, off_t offset) | |||
929 | { | 929 | { |
930 | const struct memory_handle *h = find_handle(handle_id); | 930 | const struct memory_handle *h = find_handle(handle_id); |
931 | if (!h) | 931 | if (!h) |
932 | return HANDLE_NOT_FOUND; | 932 | return ERR_HANDLE_NOT_FOUND; |
933 | 933 | ||
934 | size_t newpos = h->offset + RINGBUF_SUB(h->ridx, h->data) + offset; | 934 | size_t newpos = h->offset + RINGBUF_SUB(h->ridx, h->data) + offset; |
935 | return bufseek(handle_id, newpos); | 935 | return bufseek(handle_id, newpos); |
@@ -941,18 +941,18 @@ ssize_t bufread(int handle_id, size_t size, void *dest) | |||
941 | { | 941 | { |
942 | const struct memory_handle *h = find_handle(handle_id); | 942 | const struct memory_handle *h = find_handle(handle_id); |
943 | if (!h) | 943 | if (!h) |
944 | return HANDLE_NOT_FOUND; | 944 | return ERR_HANDLE_NOT_FOUND; |
945 | 945 | ||
946 | size_t ret; | 946 | size_t ret; |
947 | size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); | 947 | size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); |
948 | 948 | ||
949 | if (size == 0 && h->filerem > 0 && copy_n == 0) | 949 | if (size == 0 && h->filerem > 0 && copy_n == 0) |
950 | /* Data isn't ready */ | 950 | /* Data isn't ready */ |
951 | return DATA_NOT_READY; | 951 | return ERR_DATA_NOT_READY; |
952 | 952 | ||
953 | if (copy_n < size && h->filerem > 0) | 953 | if (copy_n < size && h->filerem > 0) |
954 | /* Data isn't ready */ | 954 | /* Data isn't ready */ |
955 | return DATA_NOT_READY; | 955 | return ERR_DATA_NOT_READY; |
956 | 956 | ||
957 | if (copy_n == 0 && h->filerem == 0) | 957 | if (copy_n == 0 && h->filerem == 0) |
958 | /* File is finished reading */ | 958 | /* File is finished reading */ |
@@ -984,18 +984,18 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) | |||
984 | { | 984 | { |
985 | const struct memory_handle *h = find_handle(handle_id); | 985 | const struct memory_handle *h = find_handle(handle_id); |
986 | if (!h) | 986 | if (!h) |
987 | return HANDLE_NOT_FOUND; | 987 | return ERR_HANDLE_NOT_FOUND; |
988 | 988 | ||
989 | ssize_t ret; | 989 | ssize_t ret; |
990 | size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); | 990 | size_t copy_n = RINGBUF_SUB(h->widx, h->ridx); |
991 | 991 | ||
992 | if (size == 0 && h->filerem > 0 && copy_n == 0) | 992 | if (size == 0 && h->filerem > 0 && copy_n == 0) |
993 | /* Data isn't ready */ | 993 | /* Data isn't ready */ |
994 | return DATA_NOT_READY; | 994 | return ERR_DATA_NOT_READY; |
995 | 995 | ||
996 | if (copy_n < size && h->filerem > 0) | 996 | if (copy_n < size && h->filerem > 0) |
997 | /* Data isn't ready */ | 997 | /* Data isn't ready */ |
998 | return DATA_NOT_READY; | 998 | return ERR_DATA_NOT_READY; |
999 | 999 | ||
1000 | if (copy_n == 0 && h->filerem == 0) | 1000 | if (copy_n == 0 && h->filerem == 0) |
1001 | /* File is finished reading */ | 1001 | /* File is finished reading */ |
@@ -1040,7 +1040,7 @@ ssize_t buf_get_offset(int handle_id, void *ptr) | |||
1040 | { | 1040 | { |
1041 | const struct memory_handle *h = find_handle(handle_id); | 1041 | const struct memory_handle *h = find_handle(handle_id); |
1042 | if (!h) | 1042 | if (!h) |
1043 | return HANDLE_NOT_FOUND; | 1043 | return ERR_HANDLE_NOT_FOUND; |
1044 | 1044 | ||
1045 | return (size_t)ptr - (size_t)&buffer[h->ridx]; | 1045 | return (size_t)ptr - (size_t)&buffer[h->ridx]; |
1046 | } | 1046 | } |
@@ -1049,7 +1049,7 @@ ssize_t buf_handle_offset(int handle_id) | |||
1049 | { | 1049 | { |
1050 | const struct memory_handle *h = find_handle(handle_id); | 1050 | const struct memory_handle *h = find_handle(handle_id); |
1051 | if (!h) | 1051 | if (!h) |
1052 | return HANDLE_NOT_FOUND; | 1052 | return ERR_HANDLE_NOT_FOUND; |
1053 | return h->offset; | 1053 | return h->offset; |
1054 | } | 1054 | } |
1055 | 1055 | ||
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 { | |||
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* Error return values */ | 38 | /* Error return values */ |
39 | #define HANDLE_NOT_FOUND -1 | 39 | #define ERR_HANDLE_NOT_FOUND -1 |
40 | #define BUFFER_FULL -2 | 40 | #define ERR_BUFFER_FULL -2 |
41 | #define INVALID_VALUE -3 | 41 | #define ERR_INVALID_VALUE -3 |
42 | #define FILE_ERROR -4 | 42 | #define ERR_FILE_ERROR -4 |
43 | #define DATA_NOT_READY -5 | 43 | #define ERR_DATA_NOT_READY -5 |
44 | 44 | ||
45 | 45 | ||
46 | /* Initialise the buffering subsystem */ | 46 | /* 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) | |||
366 | void *ptr; | 366 | void *ptr; |
367 | ssize_t ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); | 367 | ssize_t ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); |
368 | 368 | ||
369 | if (ret == DATA_NOT_READY) { | 369 | if (ret == ERR_DATA_NOT_READY) { |
370 | buf_request_buffer_handle(track->codec_hid); | 370 | buf_request_buffer_handle(track->codec_hid); |
371 | } | 371 | } |
372 | 372 | ||
373 | while (ret == DATA_NOT_READY) { | 373 | while (ret == ERR_DATA_NOT_READY) { |
374 | sleep(1); | 374 | sleep(1); |
375 | ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); | 375 | ret = bufgetdata(track->codec_hid, track->codecsize, &ptr); |
376 | } | 376 | } |
@@ -1516,13 +1516,13 @@ static size_t codec_filebuf_callback(void *ptr, size_t size) | |||
1516 | return 0; | 1516 | return 0; |
1517 | 1517 | ||
1518 | 1518 | ||
1519 | if (copy_n == DATA_NOT_READY) | 1519 | if (copy_n == ERR_DATA_NOT_READY) |
1520 | { | 1520 | { |
1521 | buf_request_buffer_handle(CUR_TI->audio_hid); | 1521 | buf_request_buffer_handle(CUR_TI->audio_hid); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | /* Let the disk buffer catch fill until enough data is available */ | 1524 | /* Let the disk buffer catch fill until enough data is available */ |
1525 | while (copy_n == DATA_NOT_READY) | 1525 | while (copy_n == ERR_DATA_NOT_READY) |
1526 | { | 1526 | { |
1527 | sleep(1); | 1527 | sleep(1); |
1528 | 1528 | ||
@@ -1561,13 +1561,13 @@ static void* codec_request_buffer_callback(size_t *realsize, size_t reqsize) | |||
1561 | return NULL; | 1561 | return NULL; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | if (ret == DATA_NOT_READY) | 1564 | if (ret == ERR_DATA_NOT_READY) |
1565 | { | 1565 | { |
1566 | buf_request_buffer_handle(CUR_TI->audio_hid); | 1566 | buf_request_buffer_handle(CUR_TI->audio_hid); |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | /* Let the disk buffer catch fill until enough data is available */ | 1569 | /* Let the disk buffer catch fill until enough data is available */ |
1570 | while (ret == DATA_NOT_READY) | 1570 | while (ret == ERR_DATA_NOT_READY) |
1571 | { | 1571 | { |
1572 | sleep(1); | 1572 | sleep(1); |
1573 | 1573 | ||