Fixed MSVC errors and warnings (Steve, sking_2.patch, parts thereof)

v0.27.3
Andreas Huggel 21 years ago
parent 3478419f13
commit 4cbecc7a47

@ -20,14 +20,14 @@
*/ */
/* /*
File: image.cpp File: image.cpp
Version: $Name: $ $Revision: 1.14 $ Version: $Name: $ $Revision: 1.15 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component 11-Feb-04, ahu: isolated as a component
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: image.cpp,v $") EXIV2_RCSID("@(#) $Name: $ $Revision: 1.15 $ $RCSfile: image.cpp,v $")
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
@ -38,9 +38,7 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: image.cpp,v $")
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <cstring> #include <cstring>
#include <cstdio> // for rename, remove #include <cstdio> // for rename, remove, tmpnam
#include <sys/types.h> // for getpid
#include <unistd.h> // for getpid
// ***************************************************************************** // *****************************************************************************
// class member definitions // class member definitions
@ -194,8 +192,7 @@ namespace Exiv2 {
if (!is) return -1; if (!is) return -1;
// Write the output to a temporary file // Write the output to a temporary file
pid_t pid = getpid(); std::string tmpname = tmpnam(NULL);
std::string tmpname = path + toString(pid);
std::ofstream os(tmpname.c_str(), std::ios::binary); std::ofstream os(tmpname.c_str(), std::ios::binary);
if (!os) return -3; if (!os) return -3;
@ -261,10 +258,10 @@ namespace Exiv2 {
us2Data(tmpbuf, soi_, bigEndian); us2Data(tmpbuf, soi_, bigEndian);
us2Data(tmpbuf + 2, app0_, bigEndian); us2Data(tmpbuf + 2, app0_, bigEndian);
if (jfif.pData_) { if (jfif.pData_) {
us2Data(tmpbuf + 4, 7 + jfif.size_, bigEndian); us2Data(tmpbuf + 4, static_cast<uint16>(7 + jfif.size_), bigEndian);
} }
else { else {
us2Data(tmpbuf + 4, 7 + defaultJfifSize, bigEndian); us2Data(tmpbuf + 4, static_cast<uint16>(7 + defaultJfifSize), bigEndian);
} }
memcpy(tmpbuf + 6, jfifId_, 5); memcpy(tmpbuf + 6, jfifId_, 5);
os.write(tmpbuf, 11); os.write(tmpbuf, 11);
@ -292,8 +289,7 @@ namespace Exiv2 {
if (!is) return -1; if (!is) return -1;
// Write the output to a temporary file // Write the output to a temporary file
pid_t pid = getpid(); std::string tmpname = tmpnam(NULL);
std::string tmpname = path + toString(pid);
std::ofstream os(tmpname.c_str(), std::ios::binary); std::ofstream os(tmpname.c_str(), std::ios::binary);
if (!os) return -3; if (!os) return -3;
@ -365,7 +361,7 @@ namespace Exiv2 {
if (jfif.pData_) { if (jfif.pData_) {
// Write APP0 marker, size of APP0 field and JFIF data // Write APP0 marker, size of APP0 field and JFIF data
us2Data(tmpbuf, app0_, bigEndian); us2Data(tmpbuf, app0_, bigEndian);
us2Data(tmpbuf + 2, 7 + jfif.size_, bigEndian); us2Data(tmpbuf + 2, static_cast<uint16>(7 + jfif.size_), bigEndian);
memcpy(tmpbuf + 4, jfifId_, 5); memcpy(tmpbuf + 4, jfifId_, 5);
os.write(tmpbuf, 9); os.write(tmpbuf, 9);
os.write(jfif.pData_, jfif.size_); os.write(jfif.pData_, jfif.size_);
@ -375,7 +371,7 @@ namespace Exiv2 {
} }
// Write APP1 marker, size of APP1 field, Exif id and Exif data // Write APP1 marker, size of APP1 field, Exif id and Exif data
us2Data(tmpbuf, app1_, bigEndian); us2Data(tmpbuf, app1_, bigEndian);
us2Data(tmpbuf + 2, sizeExifData_ + 8, bigEndian); us2Data(tmpbuf + 2, static_cast<uint16>(sizeExifData_ + 8), bigEndian);
memcpy(tmpbuf + 4, exifId_, 6); memcpy(tmpbuf + 4, exifId_, 6);
os.write(tmpbuf, 10); os.write(tmpbuf, 10);
os.write(pExifData_, sizeExifData_); os.write(pExifData_, sizeExifData_);
@ -566,7 +562,7 @@ namespace Exiv2 {
// Write APP1 marker, size of APP1 field, Exif id and Exif data // Write APP1 marker, size of APP1 field, Exif id and Exif data
char tmpbuf[10]; char tmpbuf[10];
us2Data(tmpbuf, app1_, bigEndian); us2Data(tmpbuf, app1_, bigEndian);
us2Data(tmpbuf + 2, sizeExifData_ + 8, bigEndian); us2Data(tmpbuf + 2, static_cast<uint16>(sizeExifData_ + 8), bigEndian);
memcpy(tmpbuf + 4, exifId_, 6); memcpy(tmpbuf + 4, exifId_, 6);
os.write(tmpbuf, 10); os.write(tmpbuf, 10);
os.write(pExifData_, sizeExifData_); os.write(pExifData_, sizeExifData_);

Loading…
Cancel
Save