Issue: #940. Fix compilation warnings.

This commit is contained in:
Robin Mills 2013-12-28 03:41:01 +00:00
parent 716f053b46
commit 89c796a3ab
11 changed files with 31 additions and 27 deletions

View File

@ -231,7 +231,7 @@ lib: $(OBJ)
@touch lib
$(EXIV2BIN): lib $(EXIV2OBJ) $(EXIV2COBJ)
-mkdir ../bin >/dev/null 2>&1
-mkdir -p ../bin >/dev/null 2>&1
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir)
install-header:

View File

@ -86,23 +86,25 @@ namespace Exiv2 {
} // fileExists
#endif
#define UNUSED(x) (void)(x)
std::string strError()
{
int error = errno;
int error = errno;
std::ostringstream os;
#ifdef EXV_HAVE_STRERROR_R
#ifdef EXV_HAVE_STRERROR_R
const size_t n = 1024;
// _GNU_SOURCE: See Debian bug #485135
# if defined EXV_STRERROR_R_CHAR_P && defined _GNU_SOURCE
char *buf = 0;
char buf2[n];
std::memset(buf2, 0x0, n);
buf = strerror_r(error, buf2, n);
# else
char buf[n];
std::memset(buf, 0x0, n);
strerror_r(error, buf, n);
# endif
char buff[n];
std::memset(buff, 0x0, n);
// _GNU_SOURCE: See Debian bug #485135
#ifdef STRERROR_R_CHAR_P
char* buf = strerror_r(error, buff, n);
#else
char* buf = buff;
int dummy = strerror_r(error, buff, n);
UNUSED(dummy);
#endif
os << buf;
// Issue# 908.
// report strerror() if strerror_r() returns empty

View File

@ -1026,10 +1026,10 @@ namespace Exiv2 {
TiffComponent* newCasioMn(uint16_t tag,
IfdId group,
IfdId mnGroup,
IfdId /* mnGroup*/,
const byte* pData,
uint32_t size,
ByteOrder byteOrder)
ByteOrder/* byteOrder */ )
{
if (size > 6 && std::string(reinterpret_cast<const char*>(pData), 6)
== std::string("QVC\0\0\0", 6)) {

View File

@ -101,13 +101,13 @@ namespace Exiv2 {
void TiffVisitor::setGo(GoEvent event, bool go)
{
assert(event >= 0 && event < events_);
assert(event >= 0 && static_cast<int>(event) < events_);
go_[event] = go;
}
bool TiffVisitor::go(GoEvent event) const
{
assert(event >= 0 && event < events_);
assert(event >= 0 && static_cast<int>(event) < events_);
return go_[event];
}

View File

@ -128,6 +128,8 @@
#endif
#endif
#define UNUSED(x) (void)(x)
// =================================================================================================
// Macintosh Specific Settings
// ===========================

View File

@ -130,7 +130,7 @@ MD5Final(md5byte digest[16], struct MD5_CTX *ctx)
byteSwap(ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */

View File

@ -46,7 +46,7 @@ static XMP_Node * sDummySchema = 0; // ! Used for some ugliness with aliases.
static void
AddSchemaProps ( IterInfo & info, IterNode & iterSchema, const XMP_Node * xmpSchema )
{
info = info; // Avoid unused parameter warning.
UNUSED(info);
#if TraceIterators
printf ( " Adding properties of %s\n", xmpSchema->name.c_str() );
#endif
@ -399,7 +399,7 @@ XMPIterator::Terminate() RELEASE_NO_THROW
void
XMPIterator::Unlock ( XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning.
UNUSED(options);
XMPMeta::Unlock ( 0 );
@ -727,7 +727,7 @@ XMPIterator::Skip ( XMP_OptionBits iterOptions )
void
XMPIterator::UnlockIter ( XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning.
UNUSED(options);
XMPMeta::Unlock ( 0 );

View File

@ -840,7 +840,7 @@ XMPMeta::SetLocalizedText ( XMP_StringPtr schemaNS,
XMP_StringPtr itemValue,
XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning.
UNUSED(options); // Avoid unused parameter warning.
XMP_Assert ( (schemaNS != 0) && (arrayName != 0) && (_genericLang != 0) && (_specificLang != 0) ); // Enforced by wrapper.

View File

@ -838,7 +838,7 @@ XMPMeta::Terminate() RELEASE_NO_THROW
/* class-static */ void
XMPMeta::Unlock ( XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning. // *** Need IgnoreParam macro.
UNUSED(options);
#if TraceXMPLocking
fprintf ( xmpOut, " Unlocking XMP toolkit, count = %d\n", sLockCount ); fflush ( xmpOut );
@ -857,7 +857,7 @@ XMPMeta::Unlock ( XMP_OptionBits options )
void
XMPMeta::UnlockObject ( XMP_OptionBits options ) const
{
options = options; // Avoid unused parameter warning.
UNUSED(options);
XMPMeta::Unlock ( 0 );

View File

@ -1202,7 +1202,7 @@ XMPUtils::DuplicateSubtree ( const XMPMeta & source,
XMP_StringPtr destRoot,
XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning.
UNUSED(options);
bool fullSourceTree = false;
bool fullDestTree = false;

View File

@ -670,7 +670,7 @@ XMPUtils::Terminate() RELEASE_NO_THROW
/* class static */ void
XMPUtils::Unlock ( XMP_OptionBits options )
{
options = options; // Avoid unused parameter warning.
UNUSED(options);
XMPMeta::Unlock ( 0 );