Fix warnings in VS

This commit is contained in:
Luis Díaz Más 2021-04-18 20:08:34 +02:00
parent 75bf666d3b
commit 01a3bc716d
6 changed files with 13 additions and 13 deletions

View File

@ -299,7 +299,7 @@ namespace Exiv2
bLF = false;
}
io_->seek(skip, BasicIo::cur);
while (io_->tell() < (address + box.length)) {
while (io_->tell() < static_cast<long>((address + box.length))) {
io_->seek(boxHandler(out,option,depth + 1), BasicIo::beg);
}
// post-process meta box to recover Exif and XMP
@ -417,7 +417,7 @@ namespace Exiv2
bLF = false;
}
if (name == "cano") {
while (io_->tell() < (address + box.length)) {
while (io_->tell() < static_cast<long>(address + box.length)) {
io_->seek(boxHandler(out,option,depth + 1), BasicIo::beg);
}
} else if ( name == "xmp" ) {

View File

@ -252,7 +252,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 = static_cast<int>(socket(AF_INET , SOCK_STREAM,IPPROTO_TCP));
if (sockfd < 0)
return error(errors, "unable to create socket\n", NULL, NULL, 0);

View File

@ -126,7 +126,7 @@ namespace Exiv2 {
const byte* pEnd = pPsData + sizePsData;
int ret = 0;
while (pCur < pEnd
&& 0 == (ret = Photoshop::locateIptcIrb(pCur, pEnd - pCur,
&& 0 == (ret = Photoshop::locateIptcIrb(pCur, static_cast<long>(pEnd - pCur),
&record, &sizeHdr, &sizeIptc))) {
pCur = record + sizeHdr + sizeIptc + (sizeIptc & 1);
}
@ -539,7 +539,7 @@ namespace Exiv2 {
const byte* pCur = &psBlob[0];
const byte* pEnd = pCur + psBlob.size();
while ( pCur < pEnd
&& 0 == Photoshop::locateIptcIrb(pCur, pEnd - pCur,
&& 0 == Photoshop::locateIptcIrb(pCur, static_cast<long>(pEnd - pCur),
&record, &sizeHdr, &sizeIptc)) {
#ifdef EXIV2_DEBUG_MESSAGES
std::cerr << "Found IPTC IRB, size = " << sizeIptc << "\n";
@ -1200,11 +1200,11 @@ namespace Exiv2 {
const byte* chunkEnd = chunkStart + newPsData.size_;
while (chunkStart < chunkEnd) {
// Determine size of next chunk
long chunkSize = chunkEnd - chunkStart;
long chunkSize = static_cast<long>(chunkEnd - chunkStart);
if (chunkSize > maxChunkSize) {
chunkSize = maxChunkSize;
// Don't break at a valid IRB boundary
const long writtenSize = chunkStart - newPsData.pData_;
const long writtenSize = static_cast<long>(chunkStart - newPsData.pData_);
if (Photoshop::valid(newPsData.pData_, writtenSize + chunkSize)) {
// Since an IRB has minimum size 12,
// (chunkSize - 8) can't be also a IRB boundary

View File

@ -312,7 +312,7 @@ namespace Exiv2 {
const byte* pCur = psData.pData_;
while ( pCur < pEnd
&& 0 == Photoshop::locateIptcIrb(pCur,
pEnd - pCur,
static_cast<long>(pEnd - pCur),
&record,
&sizeHdr,
&sizeIptc)) {
@ -490,14 +490,14 @@ namespace Exiv2 {
std::string PngChunk::zlibCompress(const std::string& text)
{
uLongf compressedLen = (text.size() * 2); // just a starting point
uLongf compressedLen = static_cast<uLongf>(text.size() * 2); // just a starting point
int zlibResult;
DataBuf arr;
do {
arr.alloc(compressedLen);
zlibResult = compress2(arr.pData_, &compressedLen,
(const Bytef*)text.data(), text.size(),
(const Bytef*)text.data(), static_cast<uLong>(text.size()),
Z_BEST_COMPRESSION);
switch (zlibResult) {

View File

@ -221,7 +221,7 @@ namespace Exiv2 {
long DataValue::copy(byte* buf, ByteOrder /*byteOrder*/) const
{
// byteOrder not needed
return std::copy(value_.begin(), value_.end(), buf) - buf;
return static_cast<long>(std::copy(value_.begin(), value_.end(), buf) - buf);
}
long DataValue::size() const
@ -1055,7 +1055,7 @@ namespace Exiv2 {
tms.tm_mday = date_.day;
tms.tm_mon = date_.month - 1;
tms.tm_year = date_.year - 1900;
auto l = std::mktime(&tms);
long l = static_cast<long>(std::mktime(&tms));
ok_ = (l != -1);
return l;
}

View File

@ -597,7 +597,7 @@ namespace Exiv2 {
return 2;
}
SXMPMeta meta(xmpPacket.data(), xmpPacket.size());
SXMPMeta meta(xmpPacket.data(), static_cast<XMP_StringLen>(xmpPacket.size()));
SXMPIterator iter(meta);
std::string schemaNs, propPath, propValue;
XMP_OptionBits opt;