Fix several gcc warnings occurring with -Wextra

Warnings fixed are:

- warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
- warning: unused parameter ... [-Wunused-parameter]
- warning: comparison is always true due to limited range of data type [-Wtype-limits]



git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@822 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
Moritz Bunkus 2011-11-25 21:01:45 +00:00
parent ffeea955a0
commit 88cdc30938
16 changed files with 172 additions and 172 deletions

View File

@ -109,14 +109,14 @@ private:
class EBML_DLL_API ADbg class EBML_DLL_API ADbg
{ {
public: public:
ADbg(int level = 0){} ADbg(int /* level */ = 0){}
virtual ~ADbg() {} virtual ~ADbg() {}
inline int OutPut(int level, const char * format,...) const { inline int OutPut(int /* level */, const char * /* format */,...) const {
return 0; return 0;
} }
inline int OutPut(const char * format,...) const { inline int OutPut(const char * /* format */,...) const {
return 0; return 0;
} }
@ -124,11 +124,11 @@ public:
return level; return level;
} }
inline bool setIncludeTime(const bool included = true) { inline bool setIncludeTime(const bool /* included */ = true) {
return true; return true;
} }
inline bool setDebugFile(const char * NewFilename) { inline bool setDebugFile(const char * /* NewFilename */) {
return true; return true;
} }
@ -136,7 +136,7 @@ public:
return true; return true;
} }
inline bool setUseFile(const bool usefile = true) { inline bool setUseFile(const bool /* usefile */ = true) {
return true; return true;
} }

View File

@ -101,7 +101,7 @@ DECLARE_EBML_BINARY(EbmlCrc32)
}; };
template <class T> template <class T>
inline unsigned int GetAlignment(T *dummy=NULL) // VC60 workaround inline unsigned int GetAlignment(T */* dummy */=NULL) // VC60 workaround
{ {
#if defined(_MSC_VER) && (_MSC_VER >= 1300) #if defined(_MSC_VER) && (_MSC_VER >= 1300)
return __alignof(T); return __alignof(T);
@ -131,7 +131,7 @@ inline bool IsAlignedOn(const void *p, unsigned int alignment)
} }
template <class T> template <class T>
inline bool IsAligned(const void *p, T *dummy=NULL) // VC60 workaround inline bool IsAligned(const void *p, T */* dummy */=NULL) // VC60 workaround
{ {
return IsAlignedOn(p, GetAlignment<T>()); return IsAlignedOn(p, GetAlignment<T>());
} }

View File

@ -65,7 +65,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
/*! /*!
\note no Default date handled \note no Default date handled
*/ */
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false) { filepos_t UpdateSize(bool /* bWithDefault = false */, bool /* bForceRender = false */) {
if(!ValueIsSet()) if(!ValueIsSet())
SetSize_(0); SetSize_(0);
else else

View File

@ -79,12 +79,12 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
virtual bool IsSmallerThan(const EbmlElement *Cmp) const; virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
operator const float() const; operator float() const;
operator const double() const; operator double() const;
void SetDefaultValue(double); void SetDefaultValue(double);
const double DefaultVal() const; double DefaultVal() const;
bool IsDefaultValue() const { bool IsDefaultValue() const {
return (DefaultISset() && Value == DefaultValue); return (DefaultISset() && Value == DefaultValue);

View File

@ -66,7 +66,7 @@ EbmlBinary::~EbmlBinary(void) {
EbmlBinary::operator const binary &() const {return *Data;} EbmlBinary::operator const binary &() const {return *Data;}
filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlBinary::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
output.writeFully(Data,GetSize()); output.writeFully(Data,GetSize());
@ -76,7 +76,7 @@ filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bW
/*! /*!
\note no Default binary value handled \note no Default binary value handled
*/ */
uint64 EbmlBinary::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlBinary::UpdateSize(bool /* bWithDefault */, bool /* bForceRender */)
{ {
return GetSize(); return GetSize();
} }

View File

@ -207,7 +207,7 @@ bool EbmlCrc32::CheckElementCRC32(EbmlElement &ElementToCRC)
return CheckCRC(m_crc_final, memoryBuffer.GetDataBuffer(), memoryBuffer.GetDataBufferSize()); return CheckCRC(m_crc_final, memoryBuffer.GetDataBuffer(), memoryBuffer.GetDataBufferSize());
}; };
filepos_t EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlCrc32::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
filepos_t Result = 4; filepos_t Result = 4;

View File

@ -65,7 +65,7 @@ filepos_t EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
return GetSize(); return GetSize();
} }
filepos_t EbmlDate::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlDate::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
if (GetSize() != 0) { if (GetSize() != 0) {
assert(GetSize() == 8); assert(GetSize() == 8);

View File

@ -655,7 +655,7 @@ bool EbmlElement::CompareElements(const EbmlElement *A, const EbmlElement *B)
return false; return false;
} }
void EbmlElement::Read(EbmlStream & inDataStream, const EbmlSemanticContext & Context, int & UpperEltFound, EbmlElement * & FoundElt, bool AllowDummyElt, ScopeMode ReadFully) void EbmlElement::Read(EbmlStream & inDataStream, const EbmlSemanticContext & /* Context */, int & /* UpperEltFound */, EbmlElement * & /* FoundElt */, bool /* AllowDummyElt */, ScopeMode ReadFully)
{ {
ReadData(inDataStream.I_O(), ReadFully); ReadData(inDataStream.I_O(), ReadFully);
} }

View File

@ -67,21 +67,21 @@ void EbmlFloat::SetDefaultValue(double aValue)
SetDefaultIsSet(); SetDefaultIsSet();
} }
const double EbmlFloat::DefaultVal() const double EbmlFloat::DefaultVal() const
{ {
assert(DefaultISset()); assert(DefaultISset());
return DefaultValue; return DefaultValue;
} }
EbmlFloat::operator const float() const {return float(Value);} EbmlFloat::operator float() const {return float(Value);}
EbmlFloat::operator const double() const {return double(Value);} EbmlFloat::operator double() const {return double(Value);}
/*! /*!
\todo handle exception on errors \todo handle exception on errors
\todo handle 10 bits precision \todo handle 10 bits precision
*/ */
filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlFloat::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
assert(GetSize() == 4 || GetSize() == 8); assert(GetSize() == 4 || GetSize() == 8);
@ -102,7 +102,7 @@ filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bWi
return GetSize(); return GetSize();
} }
uint64 EbmlFloat::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlFloat::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{ {
if (!bWithDefault && IsDefaultValue()) if (!bWithDefault && IsDefaultValue())
return 0; return 0;

View File

@ -167,7 +167,7 @@ filepos_t EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bWith
/*! /*!
\todo this code is very suspicious ! \todo this code is very suspicious !
*/ */
filepos_t EbmlMaster::ReadData(IOCallback & input, ScopeMode ReadFully) filepos_t EbmlMaster::ReadData(IOCallback & input, ScopeMode /* ReadFully */)
{ {
input.setFilePointer(GetSize(), seek_current); input.setFilePointer(GetSize(), seek_current);
return GetSize(); return GetSize();

View File

@ -63,7 +63,7 @@ EbmlSInteger::operator int64() {return Value;}
/*! /*!
\todo handle exception on errors \todo handle exception on errors
*/ */
filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlSInteger::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
binary FinalData[8]; // we don't handle more than 64 bits integers binary FinalData[8]; // we don't handle more than 64 bits integers
unsigned int i; unsigned int i;
@ -82,7 +82,7 @@ filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool
return GetSize(); return GetSize();
} }
uint64 EbmlSInteger::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlSInteger::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{ {
if (!bWithDefault && IsDefaultValue()) if (!bWithDefault && IsDefaultValue())
return 0; return 0;

View File

@ -87,7 +87,7 @@ const std::string & EbmlString::DefaultVal() const
/*! /*!
\todo handle exception on errors \todo handle exception on errors
*/ */
filepos_t EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlString::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
filepos_t Result; filepos_t Result;
output.writeFully(Value.c_str(), Value.length()); output.writeFully(Value.c_str(), Value.length());
@ -122,7 +122,7 @@ EbmlString & EbmlString::operator=(const std::string & NewString)
return *this; return *this;
} }
uint64 EbmlString::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlString::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{ {
if (!bWithDefault && IsDefaultValue()) if (!bWithDefault && IsDefaultValue())
return 0; return 0;

View File

@ -79,7 +79,7 @@ EbmlUInteger::operator uint64() const {return Value;}
/*! /*!
\todo handle exception on errors \todo handle exception on errors
*/ */
filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlUInteger::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
binary FinalData[8]; // we don't handle more than 64 bits integers binary FinalData[8]; // we don't handle more than 64 bits integers
@ -97,7 +97,7 @@ filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool
return GetSize(); return GetSize();
} }
uint64 EbmlUInteger::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlUInteger::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{ {
if (!bWithDefault && IsDefaultValue()) if (!bWithDefault && IsDefaultValue())
return 0; return 0;

View File

@ -183,7 +183,7 @@ void UTFstring::UpdateFromUCS2()
Size++; Size++;
} else if (_Data[i] < 0x800) { } else if (_Data[i] < 0x800) {
Size += 2; Size += 2;
} else if (_Data[i] < 0x10000) { } else {
Size += 3; Size += 3;
} }
} }
@ -195,7 +195,7 @@ void UTFstring::UpdateFromUCS2()
} else if (_Data[i] < 0x800) { } else if (_Data[i] < 0x800) {
tmpStr[Size++] = 0xC0 | (_Data[i] >> 6); tmpStr[Size++] = 0xC0 | (_Data[i] >> 6);
tmpStr[Size++] = 0x80 | (_Data[i] & 0x3F); tmpStr[Size++] = 0x80 | (_Data[i] & 0x3F);
} else if (_Data[i] < 0x10000) { } else {
tmpStr[Size++] = 0xE0 | (_Data[i] >> 12); tmpStr[Size++] = 0xE0 | (_Data[i] >> 12);
tmpStr[Size++] = 0x80 | ((_Data[i] >> 6) & 0x3F); tmpStr[Size++] = 0x80 | ((_Data[i] >> 6) & 0x3F);
tmpStr[Size++] = 0x80 | (_Data[i] & 0x3F); tmpStr[Size++] = 0x80 | (_Data[i] & 0x3F);
@ -256,7 +256,7 @@ const UTFstring & EbmlUnicodeString::DefaultVal() const
\note limited to UCS-2 \note limited to UCS-2
\todo handle exception on errors \todo handle exception on errors
*/ */
filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
uint32 Result = Value.GetUTF8().length(); uint32 Result = Value.GetUTF8().length();
@ -291,7 +291,7 @@ EbmlUnicodeString & EbmlUnicodeString::operator=(const UTFstring & NewString)
/*! /*!
\note limited to UCS-2 \note limited to UCS-2
*/ */
uint64 EbmlUnicodeString::UpdateSize(bool bWithDefault, bool bForceRender) uint64 EbmlUnicodeString::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{ {
if (!bWithDefault && IsDefaultValue()) if (!bWithDefault && IsDefaultValue())
return 0; return 0;

View File

@ -45,7 +45,7 @@ EbmlVoid::EbmlVoid()
SetValueIsSet(); SetValueIsSet();
} }
filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault) filepos_t EbmlVoid::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{ {
// write dummy data by 4KB chunks // write dummy data by 4KB chunks
static binary DummyBuf[4*1024]; static binary DummyBuf[4*1024];