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"/>
</FileConfiguration>
</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
RelativePath="..\..\src\datasets.cpp">
</File>
@ -363,6 +378,9 @@
<File
RelativePath="..\..\config.h">
</File>
<File
RelativePath="..\..\src\crwimage.hpp">
</File>
<File
RelativePath="..\..\src\datasets.hpp">
</File>

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

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

@ -166,9 +166,7 @@ namespace Exiv2 {
//! @name Manipulators
//@{
int initImage(const byte initData[], size_t dataSize);
int initImage(const byte initData[], long dataSize);
//@}
//! @name Accessors
@ -248,10 +246,10 @@ namespace Exiv2 {
@throw Error If the component cannot be parsed.
*/
virtual void read(const byte* buf,
size_t len,
size_t start,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
long shift =0) =0;
int32_t shift =0) =0;
//@}
//! @name Accessors
@ -304,10 +302,10 @@ namespace Exiv2 {
// See base class comment
virtual void read(const byte* buf,
size_t len,
size_t start,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
long shift =0);
int32_t shift =0);
//! Set the directory tag for this component.
void setDir(uint16_t dir) { dir_ = dir; }
@ -421,10 +419,10 @@ namespace Exiv2 {
// See base class comment
virtual void read(const byte* buf,
size_t len,
size_t start,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
long shift =0);
int32_t shift =0);
/*!
@brief Parse a CIFF directory from a memory buffer
@ -436,10 +434,10 @@ namespace Exiv2 {
@param shift Not used
*/
void readDirectory(const byte* buf,
size_t len,
size_t start,
ByteOrder byteOrder,
long shift =0);
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0);
//@}
//! @name Accessors
@ -482,10 +480,10 @@ namespace Exiv2 {
// See base class comment
virtual void read(const byte* buf,
size_t len,
size_t start,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
long shift =0);
int32_t shift =0);
//@}
//! @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";
rc = 1;
}
if (!suffix_.empty() && !action_ == Action::insert) {
if (!suffix_.empty() && !(action_ == Action::insert)) {
std::cerr << progname()
<< ": -s option can only be used with insert action\n";
rc = 1;

@ -1286,7 +1286,7 @@ namespace Exiv2 {
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)

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

@ -60,20 +60,25 @@ namespace Util {
// *****************************************************************************
// class Getopt
int Getopt::getopt(int argc, char* const argv[], const std::string& optstring)
{
progname_ = Util::basename(argv[0]);
int Getopt::getopt(int argc, char* const argv[], const std::string& optstring)
{
progname_ = Util::basename(argv[0]);
for (;;) {
int c = ::getopt(argc, argv, optstring.c_str());
if (c == -1) break;
errcnt_ += option(c, ::optarg == 0 ? "" : ::optarg, ::optopt);
for (;;) {
int c = ::getopt(argc, argv, optstring.c_str());
if (c == -1) break;
errcnt_ += option(c, ::optarg == 0 ? "" : ::optarg, ::optopt);
}
for (int i = ::optind; i < argc; i++) {
errcnt_ += nonoption(argv[i]);
}
return errcnt_;
}
for (int i = ::optind; i < argc; i++) {
errcnt_ += nonoption(argv[i]);
int Getopt::nonoption(const std::string& /*argv*/)
{
return 0;
}
return errcnt_;
}
// *****************************************************************************
// free functions

@ -111,7 +111,7 @@ public:
@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])
const std::string& progname() const { return progname_; }

Loading…
Cancel
Save