Different solution than the one suggested in http://code.google.com/p/webrtc/issues/detail?id=56 however, should solve the same problem.
Review URL: http://webrtc-codereview.appspot.com/126003
git-svn-id: http://webrtc.googlecode.com/svn/trunk@427 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/media_file/source/avi_file.cc b/src/modules/media_file/source/avi_file.cc
index 810c846..1544b2b 100644
--- a/src/modules/media_file/source/avi_file.cc
+++ b/src/modules/media_file/source/avi_file.cc
@@ -10,6 +10,7 @@
#include "avi_file.h"
+#include <assert.h>
#include <string.h>
#ifdef _WIN32
@@ -1138,10 +1139,20 @@
long AviFile::PutLE32LengthFromCurrent(long startPos)
{
const long endPos = ftell(_aviFile);
- WebRtc_Word32 error = fseek(_aviFile, startPos - 4, SEEK_SET);
+ bool success = (0 == fseek(_aviFile, startPos - 4, SEEK_SET));
+ if (!success) {
+ assert(false);
+ return 0;
+ }
const long len = endPos - startPos;
- PutLE32(len);
- error = fseek(_aviFile, endPos, SEEK_SET);
+ if (endPos > startPos) {
+ PutLE32(len);
+ }
+ else {
+ assert(false);
+ }
+ success = (0 == fseek(_aviFile, endPos, SEEK_SET));
+ assert(success);
return len;
}