From a71749a6b57d1db3cee871df664105478504e3ba Mon Sep 17 00:00:00 2001 From: Tsuda kageyu Date: Thu, 18 Apr 2013 19:52:52 +0900 Subject: [PATCH] Fix some GCC specific warnings --- taglib/toolkit/tfilestream.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 52252023..da9311e3 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -369,6 +369,9 @@ void FileStream::seek(long offset, Position p) case End: whence = FILE_END; break; + default: + debug("FileStream::seek() -- Invalid Position value."); + return; } SetFilePointer(d->file, offset, NULL, whence); @@ -386,6 +389,9 @@ void FileStream::seek(long offset, Position p) case End: whence = SEEK_END; break; + default: + debug("FileStream::seek() -- Invalid Position value."); + return; } fseek(d->file, offset, whence); @@ -429,10 +435,10 @@ long FileStream::length() if(!d->file) return 0; - long curpos = tell(); + const long curpos = tell(); seek(0, End); - long endpos = tell(); + const long endpos = tell(); seek(curpos, Beginning); @@ -448,7 +454,7 @@ void FileStream::truncate(long length) { #ifdef _WIN32 - long currentPos = tell(); + const long currentPos = tell(); seek(length); SetEndOfFile(d->file); @@ -457,7 +463,10 @@ void FileStream::truncate(long length) #else - ftruncate(fileno(d->file), length); + const int error = ftruncate(fileno(d->file), length); + if(error != 0) { + debug("FileStream::truncate() -- Coundn't truncate the file."); + } #endif }