[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:45:05 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=4130292
The following commit has been merged in the master branch:
commit 41302921cc225f3d667972e1680b078000941e71
Author: tbeu <mail at tbeu.de>
Date: Tue Apr 14 21:48:55 2015 +0000
refs #442:
* Fix index out of bounds exception
* Make indents consistent
* Remove trailing white space
---
msvc2003/exivsimple/exivsimple.cpp | 113 +++++++++++++++++++------------------
msvc2003/exivsimple/exivsimple.h | 8 +--
2 files changed, 63 insertions(+), 58 deletions(-)
diff --git a/msvc2003/exivsimple/exivsimple.cpp b/msvc2003/exivsimple/exivsimple.cpp
index 4c7a9c7..4890d98 100644
--- a/msvc2003/exivsimple/exivsimple.cpp
+++ b/msvc2003/exivsimple/exivsimple.cpp
@@ -51,25 +51,25 @@ EXIVSIMPLE_API HIMAGE OpenFileImage(const char *file)
}
ImageWrapper *imgWrap = new ImageWrapper;
- try {
- imgWrap->image = Exiv2::ImageFactory::open(file);
- }
- catch(const Exiv2::AnyError&) {
- delete imgWrap;
- return 0;
- }
- if (imgWrap->image.get() == 0) {
- delete imgWrap;
- return 0;
- }
+ try {
+ imgWrap->image = Exiv2::ImageFactory::open(file);
+ }
+ catch(const Exiv2::AnyError&) {
+ delete imgWrap;
+ return 0;
+ }
+ if (imgWrap->image.get() == 0) {
+ delete imgWrap;
+ return 0;
+ }
// Load existing metadata
- try {
- imgWrap->image->readMetadata();
- }
- catch(const Exiv2::AnyError&) {
- delete imgWrap;
- return 0;
- }
+ try {
+ imgWrap->image->readMetadata();
+ }
+ catch(const Exiv2::AnyError&) {
+ delete imgWrap;
+ return 0;
+ }
return (HIMAGE)imgWrap;
}
@@ -79,25 +79,25 @@ EXIVSIMPLE_API HIMAGE OpenMemImage(const BYTE *data, unsigned int size)
assert(data);
ImageWrapper *imgWrap = new ImageWrapper;
- try {
- imgWrap->image = Exiv2::ImageFactory::open(data, size);
- }
- catch(const Exiv2::AnyError&) {
- delete imgWrap;
- return 0;
- }
- if (imgWrap->image.get() == 0) {
+ try {
+ imgWrap->image = Exiv2::ImageFactory::open(data, size);
+ }
+ catch(const Exiv2::AnyError&) {
delete imgWrap;
- return 0;
+ return 0;
+ }
+ if (imgWrap->image.get() == 0) {
+ delete imgWrap;
+ return 0;
}
// Load existing metadata
- try {
- imgWrap->image->readMetadata();
- }
- catch(const Exiv2::AnyError&) {
- delete imgWrap;
- return 0;
- }
+ try {
+ imgWrap->image->readMetadata();
+ }
+ catch(const Exiv2::AnyError&) {
+ delete imgWrap;
+ return 0;
+ }
return (HIMAGE)imgWrap;
}
@@ -115,12 +115,12 @@ EXIVSIMPLE_API int SaveImage(HIMAGE img)
{
assert(img);
ImageWrapper *imgWrap = (ImageWrapper*)img;
- try {
- imgWrap->image->writeMetadata();
- }
- catch(const Exiv2::AnyError&) {
- return 1;
- }
+ try {
+ imgWrap->image->writeMetadata();
+ }
+ catch(const Exiv2::AnyError&) {
+ return 1;
+ }
return 0;
}
@@ -204,7 +204,7 @@ EXIVSIMPLE_API int ReadMeta(HIMAGE img, const char *key, char *buff, int buffsiz
buff[buffsize-1] = 0;
rc = 0;
}
- }
+ }
catch(const Exiv2::AnyError&) {
}
@@ -242,9 +242,12 @@ EXIVSIMPLE_API int ModifyMeta(HIMAGE img, const char *key, const char *val, DllT
Exiv2::ExifData &exifData = imgWrap->image->exifData();
std::string data(val);
- // if data starts and ends with quotes, remove them
- if (data.at(0) == '\"' && data.at(data.size()-1) == '\"') {
- data = data.substr(1, data.size()-2);
+ {
+ size_t dataLen = data.length();
+ // if data starts and ends with quotes, remove them
+ if (dataLen > 1 && *(data.begin()) == '\"' && *(data.rbegin()) == '\"') {
+ data = data.substr(1, dataLen-2);
+ }
}
try {
@@ -264,7 +267,7 @@ EXIVSIMPLE_API int ModifyMeta(HIMAGE img, const char *key, const char *val, DllT
else {
rc = iptcData.add(iptcKey, value.get());
}
- }
+ }
catch(const Exiv2::AnyError&) {
}
@@ -312,9 +315,12 @@ EXIVSIMPLE_API int AddMeta(HIMAGE img, const char *key, const char *val, DllType
Exiv2::ExifData &exifData = imgWrap->image->exifData();
std::string data(val);
- // if data starts and ends with quotes, remove them
- if (data.at(0) == '\"' && data.at(data.size()-1) == '\"') {
- data = data.substr(1, data.size()-2);
+ {
+ size_t dataLen = data.length();
+ // if data starts and ends with quotes, remove them
+ if (dataLen > 1 && *(data.begin()) == '\"' && *(data.rbegin()) == '\"') {
+ data = data.substr(1, dataLen-2);
+ }
}
try {
@@ -327,7 +333,7 @@ EXIVSIMPLE_API int AddMeta(HIMAGE img, const char *key, const char *val, DllType
value->read(data);
rc = iptcData.add(iptcKey, value.get());
- }
+ }
catch(const Exiv2::AnyError&) {
}
@@ -374,7 +380,7 @@ EXIVSIMPLE_API int RemoveMeta(HIMAGE img, const char *key)
iptcData.erase(iter);
rc = 0;
}
- }
+ }
catch(const Exiv2::AnyError&) {
}
@@ -407,7 +413,7 @@ EXIVSIMPLE_API int EnumMeta(HIMAGE img, METAENUMPROC proc, void *user)
Exiv2::ExifData &exifData = imgWrap->image->exifData();
Exiv2::IptcData::const_iterator iend = iptcData.end();
- for (Exiv2::IptcData::const_iterator i = iptcData.begin();
+ for (Exiv2::IptcData::const_iterator i = iptcData.begin();
i != iend && more; ++i) {
more = proc(i->key().c_str(), i->value().toString().c_str(), user);
}
@@ -422,8 +428,8 @@ EXIVSIMPLE_API int EnumMeta(HIMAGE img, METAENUMPROC proc, void *user)
}
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
@@ -436,4 +442,3 @@ BOOL APIENTRY DllMain( HANDLE hModule,
}
return TRUE;
}
-
diff --git a/msvc2003/exivsimple/exivsimple.h b/msvc2003/exivsimple/exivsimple.h
index 980b928..bfed146 100644
--- a/msvc2003/exivsimple/exivsimple.h
+++ b/msvc2003/exivsimple/exivsimple.h
@@ -52,9 +52,9 @@ extern "C"
// For all of the functions
// that take a type, passing invalidTypeId causes the type to be guessed.
// Guessing types is accurate for IPTC but not for EXIF.
-enum DllTypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
- unsignedLong, unsignedRational, invalid6, undefined,
- signedShort, signedLong, signedRational,
+enum DllTypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
+ unsignedLong, unsignedRational, invalid6, undefined,
+ signedShort, signedLong, signedRational,
string, isoDate, isoTime,
lastTypeId };
@@ -86,7 +86,7 @@ EXIVSIMPLE_API void SetThumbnail(HIMAGE img, const BYTE *buffer, unsigned int si
@param buffer Pointer where the thumbnaildata is written to (large enough!)
@param size Size of buffer
- @return size of the thumbnail, 0 if failed to read the thumbnail,
+ @return size of the thumbnail, 0 if failed to read the thumbnail,
(unsigned int)-1 if buffer is too small.
*/
EXIVSIMPLE_API unsigned int GetThumbnail(HIMAGE img, BYTE *buffer, unsigned int size);
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list