diff options
Diffstat (limited to 'apps/buffering.c')
-rw-r--r-- | apps/buffering.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 2949a81a87..0cd81df93a 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -950,8 +950,8 @@ int bufopen(const char *file, size_t offset, enum data_type type, | |||
950 | h->type = type; | 950 | h->type = type; |
951 | strlcpy(h->path, file, MAX_PATH); | 951 | strlcpy(h->path, file, MAX_PATH); |
952 | 952 | ||
953 | buf_widx += sizeof(struct mp3entry); /* safe because the handle | 953 | buf_widx = ringbuf_add(buf_widx, sizeof(struct mp3entry)); |
954 | can't wrap */ | 954 | |
955 | h->filerem = sizeof(struct mp3entry); | 955 | h->filerem = sizeof(struct mp3entry); |
956 | 956 | ||
957 | /* Inform the buffering thread that we added a handle */ | 957 | /* Inform the buffering thread that we added a handle */ |
@@ -1037,8 +1037,8 @@ int bufopen(const char *file, size_t offset, enum data_type type, | |||
1037 | } else { | 1037 | } else { |
1038 | h->filesize = rc; | 1038 | h->filesize = rc; |
1039 | h->available = rc; | 1039 | h->available = rc; |
1040 | h->widx = buf_widx + rc; /* safe because the data doesn't wrap */ | 1040 | buf_widx = ringbuf_add(buf_widx, rc); |
1041 | buf_widx += rc; /* safe too */ | 1041 | h->widx = buf_widx; |
1042 | } | 1042 | } |
1043 | } | 1043 | } |
1044 | else | 1044 | else |
@@ -1107,12 +1107,11 @@ int bufalloc(const void *src, size_t size, enum data_type type) | |||
1107 | h->filesize = size; | 1107 | h->filesize = size; |
1108 | h->offset = 0; | 1108 | h->offset = 0; |
1109 | h->ridx = buf_widx; | 1109 | h->ridx = buf_widx; |
1110 | h->widx = buf_widx + size; /* safe because the data doesn't wrap */ | ||
1111 | h->data = buf_widx; | 1110 | h->data = buf_widx; |
1111 | buf_widx = ringbuf_add(buf_widx, size); | ||
1112 | h->widx = buf_widx; | ||
1112 | h->available = size; | 1113 | h->available = size; |
1113 | h->type = type; | 1114 | h->type = type; |
1114 | |||
1115 | buf_widx += size; /* safe too */ | ||
1116 | } | 1115 | } |
1117 | 1116 | ||
1118 | mutex_unlock(&llist_mutex); | 1117 | mutex_unlock(&llist_mutex); |