Fixed MSVC and MinGW warnings

v0.27.3
Andreas Huggel 20 years ago
parent d7c80de351
commit e65f3fef98

@ -124,6 +124,21 @@
ObjectFile="$(IntDir)/$(InputName)1.obj"/> ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\src\crwimage.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File <File
RelativePath="..\..\src\datasets.cpp"> RelativePath="..\..\src\datasets.cpp">
</File> </File>
@ -363,6 +378,9 @@
<File <File
RelativePath="..\..\config.h"> RelativePath="..\..\config.h">
</File> </File>
<File
RelativePath="..\..\src\crwimage.hpp">
</File>
<File <File
RelativePath="..\..\src\datasets.hpp"> RelativePath="..\..\src\datasets.hpp">
</File> </File>

@ -314,8 +314,8 @@ namespace Action {
private: private:
virtual Modify* clone_() const; virtual Modify* clone_() const;
//! Copy contructor needed because of AutoPtr memeber //! Copy contructor needed because of AutoPtr member
Modify(const Modify& src) {} Modify(const Modify& /*src*/) {}
//! Add a metadatum according to \em modifyCmd //! Add a metadatum according to \em modifyCmd
void addMetadatum(const ModifyCmd& modifyCmd); void addMetadatum(const ModifyCmd& modifyCmd);

@ -84,13 +84,13 @@ namespace Exiv2 {
} }
} // CrwImage::CrwImage } // CrwImage::CrwImage
int CrwImage::initImage(const byte initData[], size_t dataSize) int CrwImage::initImage(const byte initData[], long dataSize)
{ {
if (io_->open() != 0) { if (io_->open() != 0) {
return 4; return 4;
} }
IoCloser closer(*io_); IoCloser closer(*io_);
if (static_cast<size_t>(io_->write(initData, dataSize)) != dataSize) { if (io_->write(initData, dataSize) != dataSize) {
return 4; return 4;
} }
return 0; return 0;
@ -162,7 +162,7 @@ namespace Exiv2 {
clearMetadata(); clearMetadata();
// Read the image into a memory buffer // Read the image into a memory buffer
size_t imageSize = io_->size(); long imageSize = io_->size();
DataBuf image(imageSize); DataBuf image(imageSize);
io_->read(image.pData_, imageSize); io_->read(image.pData_, imageSize);
if (io_->error() || io_->eof()) throw Error(14); if (io_->error() || io_->eof()) throw Error(14);
@ -196,10 +196,10 @@ namespace Exiv2 {
} }
void CiffComponent::read(const byte* buf, void CiffComponent::read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long /*shift*/) int32_t /*shift*/)
{ {
if (len < 10) throw Error(33); if (len < 10) throw Error(33);
tag_ = getUShort(buf + start, byteOrder); tag_ = getUShort(buf + start, byteOrder);
@ -293,10 +293,10 @@ namespace Exiv2 {
} // CiffDirectory::add } // CiffDirectory::add
void CiffDirectory::read(const byte* buf, void CiffDirectory::read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long /*shift*/) int32_t /*shift*/)
{ {
CiffComponent::read(buf, len, start, byteOrder); CiffComponent::read(buf, len, start, byteOrder);
readDirectory(buf + offset(), size(), 0, byteOrder, 0); readDirectory(buf + offset(), size(), 0, byteOrder, 0);
@ -324,10 +324,10 @@ namespace Exiv2 {
} // CiffDirectory::print } // CiffDirectory::print
void CiffDirectory::readDirectory(const byte* buf, void CiffDirectory::readDirectory(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long /*shift*/) int32_t /*shift*/)
{ {
uint32_t dataSize = getULong(buf + len - 4, byteOrder); uint32_t dataSize = getULong(buf + len - 4, byteOrder);
uint32_t o = start + dataSize; uint32_t o = start + dataSize;
@ -363,10 +363,10 @@ namespace Exiv2 {
} // CiffHeader::add } // CiffHeader::add
void CiffHeader::read(const byte* buf, void CiffHeader::read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long /*shift*/) int32_t /*shift*/)
{ {
if (len < 14) throw Error(33); if (len < 14) throw Error(33);
@ -580,7 +580,7 @@ namespace Exiv2 {
// Todo: use _r version // Todo: use _r version
struct tm* tm = std::gmtime(&t); struct tm* tm = std::gmtime(&t);
size_t m = 20; const size_t m = 20;
char s[m]; char s[m];
std::strftime(s, m, "%Y:%m:%d %T", tm); std::strftime(s, m, "%Y:%m:%d %T", tm);

@ -166,9 +166,7 @@ namespace Exiv2 {
//! @name Manipulators //! @name Manipulators
//@{ //@{
int initImage(const byte initData[], long dataSize);
int initImage(const byte initData[], size_t dataSize);
//@} //@}
//! @name Accessors //! @name Accessors
@ -248,10 +246,10 @@ namespace Exiv2 {
@throw Error If the component cannot be parsed. @throw Error If the component cannot be parsed.
*/ */
virtual void read(const byte* buf, virtual void read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long shift =0) =0; int32_t shift =0) =0;
//@} //@}
//! @name Accessors //! @name Accessors
@ -304,10 +302,10 @@ namespace Exiv2 {
// See base class comment // See base class comment
virtual void read(const byte* buf, virtual void read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long shift =0); int32_t shift =0);
//! Set the directory tag for this component. //! Set the directory tag for this component.
void setDir(uint16_t dir) { dir_ = dir; } void setDir(uint16_t dir) { dir_ = dir; }
@ -421,10 +419,10 @@ namespace Exiv2 {
// See base class comment // See base class comment
virtual void read(const byte* buf, virtual void read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long shift =0); int32_t shift =0);
/*! /*!
@brief Parse a CIFF directory from a memory buffer @brief Parse a CIFF directory from a memory buffer
@ -436,10 +434,10 @@ namespace Exiv2 {
@param shift Not used @param shift Not used
*/ */
void readDirectory(const byte* buf, void readDirectory(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long shift =0); int32_t shift =0);
//@} //@}
//! @name Accessors //! @name Accessors
@ -482,10 +480,10 @@ namespace Exiv2 {
// See base class comment // See base class comment
virtual void read(const byte* buf, virtual void read(const byte* buf,
size_t len, uint32_t len,
size_t start, uint32_t start,
ByteOrder byteOrder, ByteOrder byteOrder,
long shift =0); int32_t shift =0);
//@} //@}
//! @name Accessors //! @name Accessors

@ -580,7 +580,7 @@ int Params::getopt(int argc, char* const argv[])
<< ": -l option can only be used with extract or insert actions\n"; << ": -l option can only be used with extract or insert actions\n";
rc = 1; rc = 1;
} }
if (!suffix_.empty() && !action_ == Action::insert) { if (!suffix_.empty() && !(action_ == Action::insert)) {
std::cerr << progname() std::cerr << progname()
<< ": -s option can only be used with insert action\n"; << ": -s option can only be used with insert action\n";
rc = 1; rc = 1;

@ -1286,7 +1286,7 @@ namespace Exiv2 {
float fnumber(float apertureValue) float fnumber(float apertureValue)
{ {
return std::exp(std::log(2.0) * apertureValue / 2); return static_cast<float>(std::exp(std::log(2.0) * apertureValue / 2));
} }
URational exposureTime(float shutterSpeedValue) URational exposureTime(float shutterSpeedValue)

@ -313,10 +313,16 @@ namespace Exiv2 {
// This is abs() - given the existence of broken compilers with Koenig // This is abs() - given the existence of broken compilers with Koenig
// lookup issues and other problems, I code this explicitly. (Remember, // lookup issues and other problems, I code this explicitly. (Remember,
// IntType may be a user-defined type). // IntType may be a user-defined type).
#ifdef _MSC_VER
#pragma warning( disable : 4146 )
#endif
if (n < zero) if (n < zero)
n = -n; n = -n;
if (m < zero) if (m < zero)
m = -m; m = -m;
#ifdef _MSC_VER
#pragma warning( default : 4146 )
#endif
// As n and m are now positive, we can be sure that %= returns a // As n and m are now positive, we can be sure that %= returns a
// positive value (the standard guarantees this for built-in types, // positive value (the standard guarantees this for built-in types,

@ -75,6 +75,11 @@ int Getopt::getopt(int argc, char* const argv[], const std::string& optstring)
return errcnt_; return errcnt_;
} }
int Getopt::nonoption(const std::string& /*argv*/)
{
return 0;
}
// ***************************************************************************** // *****************************************************************************
// free functions // free functions

@ -111,7 +111,7 @@ public:
@return 0 if successful, 1 in case of an error. @return 0 if successful, 1 in case of an error.
*/ */
virtual int nonoption(const std::string& argv) { return 0; } virtual int nonoption(const std::string& argv);
//! Program name (argv[0]) //! Program name (argv[0])
const std::string& progname() const { return progname_; } const std::string& progname() const { return progname_; }

Loading…
Cancel
Save