From e9efaeaca9993e32c32e24de925f6a25378a694d Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Thu, 1 Apr 2004 00:33:35 +0000 Subject: [PATCH] use 16-bit signed ints for storing positions in the ring buffer git-svn-id: https://svn.musicpd.org/mpd/trunk@576 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playerData.c | 5 +++++ src/playerData.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/playerData.c b/src/playerData.c index 3f22483d1..07b0dfb3c 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -51,6 +51,11 @@ void initPlayerData() { buffered_chunks = bufferSize/CHUNK_SIZE; + if(buffered_chunks >= 1<<15) { + ERROR("buffer size \"%i\" is too big\n",bufferSize); + exit(-1); + } + perc = strtod((getConf())[CONF_BUFFER_BEFORE_PLAY],&test); if(*test!='%' || perc<0 || perc>100) { ERROR("buffered before play \"%s\" is not a positive " diff --git a/src/playerData.h b/src/playerData.h index 7da51e7b3..52cbba1be 100644 --- a/src/playerData.h +++ b/src/playerData.h @@ -37,10 +37,10 @@ typedef struct _Buffer { mpd_uint16 * chunkSize; mpd_uint16 * bitRate; float * times; - int begin; - int end; - int next; - int wrap; + mpd_sint16 begin; + mpd_sint16 end; + mpd_sint16 next; + mpd_sint8 wrap; float totalTime; } Buffer;