[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:36:15 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=ab9ee9d
The following commit has been merged in the master branch:
commit ab9ee9da21eeaf7e9f3d9c64d2b601f84e6e50ae
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Fri Apr 2 09:56:20 2004 +0000
Added class ExvFile, fixed JpegImage::writeExifData
---
src/image.cpp | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
src/image.hpp | 99 +++++++++++++++++++++++++++----
2 files changed, 257 insertions(+), 25 deletions(-)
diff --git a/src/image.cpp b/src/image.cpp
index 27c4e05..6047aab 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -20,14 +20,14 @@
*/
/*
File: image.cpp
- Version: $Name: $ $Revision: 1.9 $
+ Version: $Name: $ $Revision: 1.10 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.9 $ $RCSfile: image.cpp,v $")
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.10 $ $RCSfile: image.cpp,v $")
// *****************************************************************************
// included header files
@@ -225,7 +225,7 @@ namespace Exif {
return 2;
}
// Read and check section marker and size
- char tmpbuf[10];
+ char tmpbuf[11];
is.read(tmpbuf, 10);
if (!is.good()) return 1;
uint16 marker = getUShort(tmpbuf, bigEndian);
@@ -325,28 +325,68 @@ namespace Exif {
}
// Read and check section marker and size
- char tmpbuf[12];
+ char tmpbuf[10];
is.read(tmpbuf, 10);
if (!is.good()) return 1;
uint16 marker = getUShort(tmpbuf, bigEndian);
uint16 size = getUShort(tmpbuf + 2, bigEndian);
if (size < 8) return 3;
- if (!( (marker == app0_ && memcmp(tmpbuf + 4, jfifId_, 5) == 0)
- || (marker == app1_ && memcmp(tmpbuf + 4, exifId_, 6) == 0))) {
- return 3;
+
+ bool validFile = false;
+ long sizeJfifData = 0;
+ char* pJfifData = 0; // Todo: Memory Leak! Use an auto pointer
+ if (marker == app0_ && memcmp(tmpbuf + 4, jfifId_, 5) == 0) {
+ // Read the remainder of the JFIF APP0 segment
+ is.seekg(-1, std::ios::cur);
+ sizeJfifData = size - 7;
+ pJfifData = new char[sizeJfifData];
+ is.read(pJfifData, sizeJfifData);
+ if (!is.good()) {
+ delete[] pJfifData;
+ pJfifData = 0;
+ return 1;
+ }
+ // Read the beginning of the next segment
+ is.read(tmpbuf, 10);
+ if (!is.good()) return 1;
+ marker = getUShort(tmpbuf, bigEndian);
+ size = getUShort(tmpbuf + 2, bigEndian);
+ validFile = true;
}
+ if (marker == app1_ && memcmp(tmpbuf + 4, exifId_, 6) == 0) {
+ // Skip the rest of the Exif APP1 segment
+ is.seekg(size - 8, std::ios::cur);
+ if (!is.good()) return 1;
+ validFile = true;
+ }
+ else {
+ is.seekg(-10, std::ios::cur);
+ }
+ if (!validFile) return 3;
- // Write SOI and APP1 markers, size of APP1 field, Exif id and Exif data
+ // Write SOI marker
us2Data(tmpbuf, soi_, bigEndian);
- us2Data(tmpbuf + 2, app1_, bigEndian);
- us2Data(tmpbuf + 4, sizeExifData_ + 8, bigEndian);
- memcpy(tmpbuf + 6, exifId_, 6);
- os.write(tmpbuf, 12);
+ os.write(tmpbuf, 2);
+ if (!os.good()) return 4;
+ if (pJfifData) {
+ // Write APP0 marker, size of APP0 field and JFIF data
+ us2Data(tmpbuf, app0_, bigEndian);
+ us2Data(tmpbuf + 2, 7 + sizeJfifData, bigEndian);
+ memcpy(tmpbuf + 4, jfifId_, 5);
+ os.write(tmpbuf, 9);
+ os.write(pJfifData, sizeJfifData);
+ if (!os.good()) return 4;
+ delete pJfifData;
+ pJfifData = 0;
+ }
+ // Write APP1 marker, size of APP1 field, Exif id and Exif data
+ us2Data(tmpbuf, app1_, bigEndian);
+ us2Data(tmpbuf + 2, sizeExifData_ + 8, bigEndian);
+ memcpy(tmpbuf + 4, exifId_, 6);
+ os.write(tmpbuf, 10);
os.write(pExifData_, sizeExifData_);
if (!os.good()) return 4;
// Copy rest of the stream
- is.ignore(size - 8);
- if (!is.good()) return 1;
os.flush();
is >> os.rdbuf();
if (!os.good()) return 4;
@@ -425,6 +465,119 @@ namespace Exif {
us2Data(buf+2, 0x002a, byteOrder_);
ul2Data(buf+4, 0x00000008, byteOrder_);
return size();
- }
+ } // TiffHeader::copy
+
+ const uint16 ExvFile::app1_ = 0xffe1;
+ const char ExvFile::exifId_[] = "Exif
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list