Fix warnings reported by MSVC
This commit is contained in:
parent
da24df0ba0
commit
4161099b91
@ -555,6 +555,8 @@ namespace Exiv2 {
|
||||
// IntType may be a user-defined type).
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4146 )
|
||||
#undef max
|
||||
#undef min
|
||||
#endif
|
||||
if (n < zero) {
|
||||
if (n == std::numeric_limits<IntType>::min()) {
|
||||
|
||||
@ -373,10 +373,11 @@ namespace Exiv2
|
||||
// tag is an embedded tiff
|
||||
std::vector<byte> nikon_bytes(count - jump);
|
||||
|
||||
io.read(&nikon_bytes.at(0),nikon_bytes.size());
|
||||
io.read(&nikon_bytes.at(0), (long)nikon_bytes.size());
|
||||
MemIo memIo(&nikon_bytes.at(0), (long)count - jump); // create a file
|
||||
std::cerr << "Nikon makernote" << std::endl;
|
||||
// printTiffStructure(memIo,out,option,depth); TODO: fix it
|
||||
// printTiffStructure(memIo,out,option,depth);
|
||||
// TODO: fix it
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1551,7 +1551,7 @@ namespace {
|
||||
&inbytesleft,
|
||||
&outptr,
|
||||
&outbytesleft);
|
||||
int outbytesProduced = sizeof(outbuf) - outbytesleft;
|
||||
const size_t outbytesProduced = sizeof(outbuf) - outbytesleft;
|
||||
if (rc == size_t(-1) && errno != E2BIG) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "iconv: " << strError()
|
||||
|
||||
@ -268,7 +268,7 @@ int Exiv2::http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::stri
|
||||
|
||||
////////////////////////////////////
|
||||
// open the socket
|
||||
int sockfd = socket(AF_INET , SOCK_STREAM,IPPROTO_TCP) ;
|
||||
int sockfd = (int) socket(AF_INET , SOCK_STREAM,IPPROTO_TCP) ;
|
||||
if ( sockfd < 0 ) return error(errors, "unable to create socket\n",NULL,NULL,0) ;
|
||||
|
||||
// connect the socket to the server
|
||||
|
||||
@ -152,7 +152,7 @@ namespace Exiv2 {
|
||||
|
||||
// compressed string after the compression technique spec
|
||||
const byte* compressedText = data.pData_ + keysize + 2;
|
||||
unsigned int compressedTextSize = data.size_ - keysize - 2;
|
||||
long compressedTextSize = data.size_ - keysize - 2;
|
||||
enforce(compressedTextSize < data.size_, kerCorruptedMetadata);
|
||||
|
||||
zlibUncompress(compressedText, compressedTextSize, arr);
|
||||
@ -171,7 +171,7 @@ namespace Exiv2 {
|
||||
else if(type == iTXt_Chunk)
|
||||
{
|
||||
enforce(data.size_ >= Safe::add(keysize, 3), Exiv2::kerCorruptedMetadata);
|
||||
const int nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_], '\0');
|
||||
const size_t nullSeparators = std::count(&data.pData_[keysize+3], &data.pData_[data.size_], '\0');
|
||||
enforce(nullSeparators >= 2, Exiv2::kerCorruptedMetadata);
|
||||
|
||||
// Extract a deflate compressed or uncompressed UTF-8 text chunk
|
||||
@ -188,9 +188,9 @@ namespace Exiv2 {
|
||||
const size_t languageTextMaxSize = data.size_ - keysize - 3;
|
||||
std::string languageText =
|
||||
string_from_unterminated((const char*)(data.pData_ + Safe::add(keysize, 3)), languageTextMaxSize);
|
||||
const unsigned int languageTextSize = static_cast<unsigned int>(languageText.size());
|
||||
const size_t languageTextSize = languageText.size();
|
||||
|
||||
enforce(data.size_ >= Safe::add(static_cast<unsigned int>(Safe::add(keysize, 4)), languageTextSize),
|
||||
enforce(data.size_ >= Safe::add(static_cast<size_t>(Safe::add(keysize, 4)), languageTextSize),
|
||||
Exiv2::kerCorruptedMetadata);
|
||||
// translated keyword string after the language description
|
||||
std::string translatedKeyText =
|
||||
@ -200,11 +200,11 @@ namespace Exiv2 {
|
||||
|
||||
if ((compressionFlag == 0x00) || (compressionFlag == 0x01 && compressionMethod == 0x00)) {
|
||||
enforce(Safe::add(static_cast<unsigned int>(keysize + 3 + languageTextSize + 1),
|
||||
Safe::add(translatedKeyTextSize, 1u)) <= data.size_,
|
||||
Safe::add(translatedKeyTextSize, 1u)) <= static_cast<unsigned int>(data.size_),
|
||||
Exiv2::kerCorruptedMetadata);
|
||||
|
||||
const byte* text = data.pData_ + keysize + 3 + languageTextSize + 1 + translatedKeyTextSize + 1;
|
||||
const long textsize = data.size_ - (keysize + 3 + languageTextSize + 1 + translatedKeyTextSize + 1);
|
||||
const long textsize = static_cast<long>(data.size_ - (keysize + 3 + languageTextSize + 1 + translatedKeyTextSize + 1));
|
||||
|
||||
if (compressionFlag == 0x00) {
|
||||
// then it's an uncompressed iTXt chunk
|
||||
|
||||
@ -930,7 +930,7 @@ namespace {
|
||||
|
||||
DataBuf decodeBase64(const std::string& src)
|
||||
{
|
||||
const unsigned long srcSize = src.size();
|
||||
const size_t srcSize = src.size();
|
||||
|
||||
// create decoding table
|
||||
unsigned long invalid = 64;
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
#include <gtest/gtest.h>
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@ -42,7 +42,7 @@ TEST(DataBuf, allocatesDataWithNonEmptyConstructor)
|
||||
|
||||
TEST(Rational, floatToRationalCast)
|
||||
{
|
||||
static const float floats[] = {0.5, 0.015, 0.0000625};
|
||||
static const float floats[] = {0.5f, 0.015f, 0.0000625f};
|
||||
|
||||
for (size_t i = 0; i < sizeof(floats) / sizeof(*floats); ++i) {
|
||||
const Rational r = floatToRationalCast(floats[i]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user