From 12e8e432368a300517a789bd6045502964ad95cf Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Mon, 9 May 2011 20:43:35 +0000 Subject: [PATCH] Use signed variable to check available buffer size. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29848 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/codecs.c b/apps/codecs.c index ec566dba06..249cd8f5c1 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -177,12 +177,14 @@ void codec_get_full_path(char *path, const char *codec_root_fn) void *codec_get_buffer_callback(size_t *size) { void *buf = &codecbuf[codec_size]; - *size = CODEC_SIZE - codec_size; - ALIGN_BUFFER(buf, *size, CACHEALIGN_SIZE); + ssize_t s = CODEC_SIZE - codec_size; - if (*size <= 0) + if (s <= 0) return NULL; + *size = s; + ALIGN_BUFFER(buf, *size, CACHEALIGN_SIZE); + return buf; }