summaryrefslogtreecommitdiff
path: root/src/codec/ffmpeg
diff options
context:
space:
mode:
Diffstat (limited to 'src/codec/ffmpeg')
-rw-r--r--src/codec/ffmpeg/common.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/codec/ffmpeg/common.c b/src/codec/ffmpeg/common.c
index b2e727d..95bf247 100644
--- a/src/codec/ffmpeg/common.c
+++ b/src/codec/ffmpeg/common.c
@@ -10,18 +10,20 @@ void camu_ff_set_log_callback(void (*callback)(void *, s32, const char *, va_lis
}
static char *buf = NULL;
-static s32 pos = 0;
+static size_t pos = 0;
// If a line takes more than 2 steps to print, make sure we stay within AL_LOG_MESSAGE_SIZE.
-#define CHUNK_SIZE (AL_LOG_MESSAGE_SIZE / 2)
+#define CHUNK_SIZE (AL_LOG_MESSAGE_SIZE / 2u)
static void av_log_callback(void *userdata, s32 level, const char *fmt, va_list args)
{
(void)userdata;
al_assert(buf);
if (level < AV_LOG_DEBUG) {
- pos += al_vsnprintf(&buf[pos], CHUNK_SIZE, fmt, args);
- if (buf[pos - 1] == '\n' || pos >= CHUNK_SIZE) {
+ s32 ret = al_vsnprintf(&buf[pos], CHUNK_SIZE, fmt, args);
+ al_assert(ret > 0);
+ pos += ret;
+ if ((pos > 0 && buf[pos - 1] == '\n') || pos >= CHUNK_SIZE) {
if (level <= AV_LOG_INFO) {
al_log_info("ff", buf);
} else {