From: Marten Richter Date: Sun, 23 Nov 2014 14:33:34 +0000 (+0100) Subject: Fix support for large recordings X-Git-Tag: 0-5-0~6^2~3 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=36bb23909798d610115a9aa9aa902eebd4237c24;p=vompserver.git Fix support for large recordings --- diff --git a/recplayer.c b/recplayer.c index 9fac759..8827ba5 100644 --- a/recplayer.c +++ b/recplayer.c @@ -76,7 +76,7 @@ void RecPlayer::scan() segments[i] = new Segment(); segments[i]->start = totalLength; fseek(file, 0, SEEK_END); - totalLength += ftell(file); + totalLength += ftello(file); totalFrames = indexFile->Last(); log->log("RecPlayer", Log::DEBUG, "File %i found, totalLength now %llu, numFrames = %lu", i, totalLength, totalFrames); segments[i]->end = totalLength; @@ -168,7 +168,7 @@ unsigned long RecPlayer::getBlock(unsigned char* buffer, ULLONG position, unsign ULONG yetToGet = amount; ULONG got = 0; ULONG getFromThisSegment = 0; - ULONG filePosition; + ULLONG filePosition; while(got < amount) { @@ -186,7 +186,7 @@ unsigned long RecPlayer::getBlock(unsigned char* buffer, ULLONG position, unsign getFromThisSegment = segments[segmentNumber]->end - currentPosition; filePosition = currentPosition - segments[segmentNumber]->start; - fseek(file, filePosition, SEEK_SET); + fseeko(file, filePosition, SEEK_SET); if (fread(&buffer[got], getFromThisSegment, 1, file) != 1) return 0; // umm, big problem. // Tell linux not to bother keeping the data in the FS cache