libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit b4c3dc327f3f13eccf3ad7626844196eaa792045
parent d35e05c87ad4298cb99eaebd38eb8099b1738e45
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 31 Aug 2005 21:39:47 +0000

removing whitespace

Diffstat:
Mdoc/flacfile.c | 4++--
Msrc/include/extractor.h | 14+++++++-------
Msrc/main/extractor.c | 12++++++------
Msrc/main/test_binary.c | 2+-
Msrc/plugins/convert.c | 2+-
Msrc/plugins/exiv2/basicio.cpp | 56++++++++++++++++++++++++++++----------------------------
Msrc/plugins/exiv2/basicio.hpp | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
Msrc/plugins/exiv2/canonmn.cpp | 60++++++++++++++++++++++++++++++------------------------------
Msrc/plugins/exiv2/canonmn.hpp | 38+++++++++++++++++++-------------------
Msrc/plugins/exiv2/datasets.cpp | 34+++++++++++++++++-----------------
Msrc/plugins/exiv2/datasets.hpp | 28++++++++++++++--------------
Msrc/plugins/exiv2/error.cpp | 8++++----
Msrc/plugins/exiv2/error.hpp | 24++++++++++++------------
Msrc/plugins/exiv2/exif.cpp | 172++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/exif.hpp | 138++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/exifcomment.cpp | 10+++++-----
Msrc/plugins/exiv2/exiv2extractor.cc | 122++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/fujimn.cpp | 30+++++++++++++++---------------
Msrc/plugins/exiv2/fujimn.hpp | 30+++++++++++++++---------------
Msrc/plugins/exiv2/futils.cpp | 8++++----
Msrc/plugins/exiv2/futils.hpp | 14+++++++-------
Msrc/plugins/exiv2/ifd.cpp | 78+++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc/plugins/exiv2/ifd.hpp | 86++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/image.cpp | 16++++++++--------
Msrc/plugins/exiv2/image.hpp | 80++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/iptc.cpp | 18+++++++++---------
Msrc/plugins/exiv2/iptc.hpp | 74+++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/plugins/exiv2/jpgimage.cpp | 78+++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc/plugins/exiv2/jpgimage.hpp | 46+++++++++++++++++++++++-----------------------
Msrc/plugins/exiv2/makernote.cpp | 56++++++++++++++++++++++++++++----------------------------
Msrc/plugins/exiv2/makernote.hpp | 122++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/exiv2/metadatum.cpp | 12++++++------
Msrc/plugins/exiv2/metadatum.hpp | 28++++++++++++++--------------
Msrc/plugins/exiv2/mn.hpp | 6+++---
Msrc/plugins/exiv2/nikonmn.cpp | 68++++++++++++++++++++++++++++++++++----------------------------------
Msrc/plugins/exiv2/nikonmn.hpp | 48++++++++++++++++++++++++------------------------
Msrc/plugins/exiv2/olympusmn.cpp | 36++++++++++++++++++------------------
Msrc/plugins/exiv2/olympusmn.hpp | 34+++++++++++++++++-----------------
Msrc/plugins/exiv2/panasonicmn.cpp | 46+++++++++++++++++++++++-----------------------
Msrc/plugins/exiv2/panasonicmn.hpp | 32++++++++++++++++----------------
Msrc/plugins/exiv2/rcsid.hpp | 12++++++------
Msrc/plugins/exiv2/sigmamn.cpp | 20++++++++++----------
Msrc/plugins/exiv2/sigmamn.hpp | 30+++++++++++++++---------------
Msrc/plugins/exiv2/sonymn.cpp | 20++++++++++----------
Msrc/plugins/exiv2/sonymn.hpp | 26+++++++++++++-------------
Msrc/plugins/exiv2/tags.cpp | 68++++++++++++++++++++++++++++++++++----------------------------------
Msrc/plugins/exiv2/tags.hpp | 70+++++++++++++++++++++++++++++++++++-----------------------------------
Msrc/plugins/exiv2/types.cpp | 46+++++++++++++++++++++++-----------------------
Msrc/plugins/exiv2/types.hpp | 48++++++++++++++++++++++++------------------------
Msrc/plugins/exiv2/value.cpp | 66+++++++++++++++++++++++++++++++++---------------------------------
Msrc/plugins/exiv2/value.hpp | 228++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/filenameextractor.c | 2+-
Msrc/plugins/manextractor.c | 12++++++------
Msrc/plugins/ole2/gsf-infile-msole.c | 14+++++++-------
Msrc/plugins/ole2/gsf-infile-msole.h | 2+-
Msrc/plugins/ole2/gsf-input.c | 8++++----
Msrc/plugins/ole2/gsf-input.h | 8++++----
Msrc/plugins/ole2/ole2extractor.c | 12++++++------
Msrc/plugins/oo/ooextractor.c | 40++++++++++++++++++++--------------------
Msrc/plugins/splitextractor.c | 4++--
Msrc/plugins/tarextractor.c | 8++++----
Msrc/plugins/thumbnail/thumbnailextractor.c | 2+-
62 files changed, 1296 insertions(+), 1296 deletions(-)

diff --git a/doc/flacfile.c b/doc/flacfile.c @@ -208,7 +208,7 @@ int extract(FLAC__Metadata_SimpleIterator *iter, char *description, char *filena continue; } - if (mime != NULL && + if (mime != NULL && (meta->data.application.data[pos] != strlen(mime) || memcmp(&meta->data.application.data[pos+1],mime,meta->data.application.data[pos]) != 0)) { if (FLAC__metadata_simple_iterator_next(iter) == false) return 1; @@ -272,7 +272,7 @@ int my_remove(FLAC__Metadata_SimpleIterator *iter, char *description, char *mime continue; } - if (mime != NULL && + if (mime != NULL && (meta->data.application.data[pos] != strlen(mime) || memcmp(&meta->data.application.data[pos+1],mime,meta->data.application.data[pos]) != 0)) { if (FLAC__metadata_simple_iterator_next(iter) == false) return 1; diff --git a/src/include/extractor.h b/src/include/extractor.h @@ -166,17 +166,17 @@ typedef struct EXTRACTOR_Keywords { /** * Signature of the extract method that each plugin * must provide. - * + * * @param filename MAYBE NULL (!) * @param data must not be modified (!) */ -typedef EXTRACTOR_KeywordList * +typedef EXTRACTOR_KeywordList * (*ExtractMethod)(const char * filename, char * data, size_t filesize, EXTRACTOR_KeywordList * next, const char * options); - + /** * Linked list of extractor helper-libraries. An application * builds this list by telling libextractor to load various @@ -204,13 +204,13 @@ EXTRACTOR_ExtractorList * EXTRACTOR_loadDefaultLibraries(void); * Get the textual name of the keyword. * @return NULL if the type is not known */ -const char * +const char * EXTRACTOR_getKeywordTypeAsString(EXTRACTOR_KeywordType type); /** * Return the highest type number, exclusive as in [0,highest). */ -EXTRACTOR_KeywordType +EXTRACTOR_KeywordType EXTRACTOR_getHighestKeywordTypeNumber(void); /** @@ -324,7 +324,7 @@ EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list); EXTRACTOR_KeywordList * EXTRACTOR_removeKeywordsOfType(EXTRACTOR_KeywordList * list, EXTRACTOR_KeywordType type); - + /** * Print a keyword list to a file. * For debugging. @@ -371,7 +371,7 @@ const char * EXTRACTOR_extractLastByString(const char * type, * @return the number of keywords in the list */ unsigned int EXTRACTOR_countKeywords(EXTRACTOR_KeywordList * keywords); - + /** * This function can be used to decode the binary data diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -206,7 +206,7 @@ static char * old_dlsearchpath = NULL; void __attribute__ ((constructor)) le_ltdl_init(void) { int err; -#if ENABLE_NLS +#if ENABLE_NLS setlocale(LC_ALL, ""); BINDTEXTDOMAIN(PACKAGE, LOCALEDIR); #endif @@ -655,7 +655,7 @@ EXTRACTOR_getKeywords (EXTRACTOR_ExtractorList * extractor, result = NULL; while (extractor != NULL) { result = extractor->extractMethod(filename, - buffer, + buffer, size, result, extractor->options); @@ -686,12 +686,12 @@ EXTRACTOR_getKeywords2(EXTRACTOR_ExtractorList * extractor, size_t size) { EXTRACTOR_KeywordList * result; - if (data == NULL) + if (data == NULL) return NULL; result = NULL; while (extractor != NULL) { result = extractor->extractMethod(NULL, - (char*)data, + (char*)data, size, result, extractor->options); @@ -1012,8 +1012,8 @@ char * EXTRACTOR_binaryEncode(const char * data, break; /* integer overflow! */ if (end > size) end = size; - memset(markers, - 0, + memset(markers, + 0, sizeof(markers)); for (i=pos;i<end;i++) markers[data[i]&7] |= 1 << (data[i] >> 3); diff --git a/src/main/test_binary.c b/src/main/test_binary.c @@ -59,7 +59,7 @@ int main(int argc, for (i=0;i<MAX;i++) { buf[i] = (char) rand(); - if (! test(buf, i)) + if (! test(buf, i)) return -1; } return 0; diff --git a/src/plugins/convert.c b/src/plugins/convert.c @@ -43,7 +43,7 @@ char * convertToUtf8(const char * input, i = input; cd = iconv_open("UTF-8", charset); - if (cd == (iconv_t) -1) + if (cd == (iconv_t) -1) return strdup(i); tmpSize = 3 * len + 4; tmp = malloc(tmpSize); diff --git a/src/plugins/exiv2/basicio.cpp b/src/plugins/exiv2/basicio.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -62,11 +62,11 @@ EXIV2_RCSID("@(#) $Id: basicio.cpp 566 2005-04-26 15:27:41Z ahuggel $"); // class member definitions namespace Exiv2 { - FileIo::FileIo(const std::string& path) : + FileIo::FileIo(const std::string& path) : path_(path), fp_(0), opMode_(opSeek) { } - + FileIo::~FileIo() { close(); @@ -75,10 +75,10 @@ namespace Exiv2 { BasicIo::AutoPtr FileIo::temporary() const { BasicIo::AutoPtr basicIo; - + struct stat buf; int ret = stat(path_.c_str(), &buf); - + // If file is > 1MB then use a file, otherwise use memory buffer if (ret != 0 || buf.st_size > 1048576) { pid_t pid = getpid(); @@ -110,13 +110,13 @@ namespace Exiv2 { case opRead: // Flush if current mode allows reading, else reopen (in mode "r+b" // as in this case we know that we can write to the file) - if ( openMode_[0] == 'r' - || openMode_.substr(0, 2) == "w+" + if ( openMode_[0] == 'r' + || openMode_.substr(0, 2) == "w+" || openMode_.substr(0, 2) == "a+") reopen = false; break; case opWrite: // Flush if current mode allows writing, else reopen - if ( openMode_.substr(0, 2) == "r+" + if ( openMode_.substr(0, 2) == "r+" || openMode_[0] == 'w' || openMode_[0] == 'a') reopen = false; break; @@ -176,7 +176,7 @@ namespace Exiv2 { { const bool wasOpen = (fp_ != 0); const std::string lastMode(openMode_); - + FileIo *fileIo = dynamic_cast<FileIo*>(&src); if (fileIo) { // Optimization if this is another instance of FileIo @@ -219,7 +219,7 @@ namespace Exiv2 { if (switchMode(opWrite) != 0) return EOF; return putc(data, fp_); } - + int FileIo::seek(long offset, Position pos) { assert(fp_ != 0); @@ -238,7 +238,7 @@ namespace Exiv2 { if (switchMode(opSeek) != 0) return 1; return fseek(fp_, offset, fileSeek); } - + long FileIo::tell() const { assert(fp_ != 0); @@ -258,9 +258,9 @@ namespace Exiv2 { struct stat buf; int ret = stat(path_.c_str(), &buf); - + if (ret != 0) return -1; - return buf.st_size; + return buf.st_size; } int FileIo::open() @@ -286,7 +286,7 @@ namespace Exiv2 { { return fp_ != 0; } - + int FileIo::close() { if (fp_ != 0) { @@ -295,7 +295,7 @@ namespace Exiv2 { } return 0; } - + DataBuf FileIo::read(long rcount) { assert(fp_ != 0); @@ -323,7 +323,7 @@ namespace Exiv2 { { return fp_ != 0 ? ferror(fp_) : 0; } - + bool FileIo::eof() const { assert(fp_ != 0); @@ -348,7 +348,7 @@ namespace Exiv2 { { return BasicIo::AutoPtr(new MemIo); } - + void MemIo::checkSize(long wcount) { ByteVector::size_type need = wcount + idx_; @@ -382,7 +382,7 @@ namespace Exiv2 { throw Error(9, src.path(), strError()); } write(src); - src.close(); + src.close(); } if (error() || src.error()) throw Error(19, strError()); } @@ -391,7 +391,7 @@ namespace Exiv2 { { if (static_cast<BasicIo*>(this)==&src) return 0; if (!src.isopen()) return 0; - + byte buf[4096]; long readCount = 0; long writeTotal = 0; @@ -409,11 +409,11 @@ namespace Exiv2 { data_[idx_++] = data; return data; } - + int MemIo::seek(long offset, Position pos) { ByteVector::size_type newIdx; - + if (pos == BasicIo::cur ) { newIdx = idx_ + offset; } @@ -439,7 +439,7 @@ namespace Exiv2 { { return (long)data_.size(); } - + int MemIo::open() { idx_ = 0; @@ -450,12 +450,12 @@ namespace Exiv2 { { return true; } - + int MemIo::close() { return 0; } - + DataBuf MemIo::read(long rcount) { DataBuf buf(rcount); @@ -468,7 +468,7 @@ namespace Exiv2 { { long avail = (long)(data_.size() - idx_); long allow = std::min(rcount, avail); - + // According to Josuttis 6.2.3 this is safe memcpy(buf, &data_[idx_], allow); idx_ += allow; @@ -486,7 +486,7 @@ namespace Exiv2 { { return 0; } - + bool MemIo::eof() const { return idx_ == data_.size(); diff --git a/src/plugins/exiv2/basicio.hpp b/src/plugins/exiv2/basicio.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,7 +22,7 @@ @file basicio.hpp @brief Simple binary IO abstraction @version $Rev: 565 $ - @author Brad Schick (brad) + @author Brad Schick (brad) <a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a> @date 04-Dec-04, brad: created */ @@ -60,7 +60,7 @@ namespace Exiv2 { //! Seek starting positions enum Position { beg, cur, end }; - + //! @name Creators //@{ //! Destructor @@ -71,13 +71,13 @@ namespace Exiv2 { //@{ /*! @brief Open the IO source using the default access mode. The - default mode should allow for reading and writing. + default mode should allow for reading and writing. This method can also be used to "reopen" an IO source which will flush any unwritten data and reset the IO position to the start. Subclasses may provide custom methods to allow for - opening IO sources differently. - + opening IO sources differently. + @return 0 if successful;<BR> Nonzero if failure. */ @@ -93,7 +93,7 @@ namespace Exiv2 { /*! @brief Write data to the IO source. Current IO position is advanced by the number of bytes written. - @param data Pointer to data. Data must be at least \em wcount + @param data Pointer to data. Data must be at least \em wcount bytes long @param wcount Number of bytes to be written. @return Number of bytes written to IO source successfully;<BR> @@ -151,12 +151,12 @@ namespace Exiv2 { virtual int getb() = 0; /*! @brief Remove all data from this object's IO source and then transfer - data from the \em src BasicIo object into this object. + data from the \em src BasicIo object into this object. The source object is invalidated by this operation and should not be used after this method returns. This method exists primarily to be used with the BasicIo::temporary() method. - + @param src Reference to another BasicIo instance. The entire contents of src are transferred to this object. The \em src object is invalidated by the method. @@ -164,7 +164,7 @@ namespace Exiv2 { */ virtual void transfer(BasicIo& src) = 0; /*! - @brief Move the current IO position. + @brief Move the current IO position. @param offset Number of bytes to move the position relative to the starting position specified by \em pos @param pos Position from which the seek should start @@ -177,7 +177,7 @@ namespace Exiv2 { //! @name Accessors //@{ /*! - @brief Get the current IO position. + @brief Get the current IO position. @return Offset from the start of IO if successful;<BR> -1 if failure; */ @@ -202,14 +202,14 @@ namespace Exiv2 { virtual std::string path() const =0; /*! @brief Returns a temporary data storage location. This is often - needed to rewrite an IO source. + needed to rewrite an IO source. For example, data may be read from the original IO source, modified in some way, and then saved to the temporary instance. After the operation is complete, the BasicIo::transfer method can be used to replace the original IO source with the modified version. Subclasses are free to return any class that derives from BasicIo. - + @return An instance of BasicIo on success @throw Error In case of failure */ @@ -234,7 +234,7 @@ namespace Exiv2 { public: //! @name Creators //@{ - //! Constructor, takes a BasicIo reference + //! Constructor, takes a BasicIo reference IoCloser(BasicIo &bio) : bio_(bio) {} //! Destructor, closes the BasicIo reference ~IoCloser() { close(); } @@ -248,7 +248,7 @@ namespace Exiv2 { // DATA //! The BasicIo reference - BasicIo &bio_; + BasicIo &bio_; private: // Not implemented //! Copy constructor @@ -287,7 +287,7 @@ namespace Exiv2 { unwritten data and reset the IO position to the start. Although files can be opened in binary or text mode, this class has only been tested carefully in binary mode. - + @param mode Specified that type of access allowed on the file. Valid values match those of the C fopen command exactly. @return 0 if successful;<BR> @@ -300,7 +300,7 @@ namespace Exiv2 { any unwritten data and reset the IO position to the start. @return 0 if successful;<BR> Nonzero if failure. - */ + */ virtual int open(); /*! @brief Flush and unwritten data and close the file . It is @@ -312,7 +312,7 @@ namespace Exiv2 { /*! @brief Write data to the file. The file position is advanced by the number of bytes written. - @param data Pointer to data. Data must be at least \em wcount + @param data Pointer to data. Data must be at least \em wcount bytes long @param wcount Number of bytes to be written. @return Number of bytes written to the file successfully;<BR> @@ -377,7 +377,7 @@ namespace Exiv2 { is invalidated by this operation and should not be used after this method returns. This method exists primarily to be used with the BasicIo::temporary() method. - + @param src Reference to another BasicIo instance. The entire contents of src are transferred to this object. The \em src object is invalidated by the method. @@ -385,7 +385,7 @@ namespace Exiv2 { */ virtual void transfer(BasicIo& src); /*! - @brief Move the current file position. + @brief Move the current file position. @param offset Number of bytes to move the file position relative to the starting position specified by \em pos @param pos Position from which the seek should start @@ -398,14 +398,14 @@ namespace Exiv2 { //! @name Accessors //@{ /*! - @brief Get the current file position. + @brief Get the current file position. @return Offset from the start of the file if successful;<BR> -1 if failure; */ virtual long tell() const; /*! @brief Flush any buffered writes and get the current file size - in bytes. + in bytes. @note On Win32 systems the file must be closed prior to calling this function. @return Size of the file in bytes;<BR> @@ -431,7 +431,7 @@ namespace Exiv2 { */ virtual BasicIo::AutoPtr temporary() const; //@} - + private: // NOT IMPLEMENTED //! Copy constructor @@ -452,7 +452,7 @@ namespace Exiv2 { /*! @brief Switch to a new access mode, reopening the file if needed. Optimized to only reopen the file when it is really necessary. - @param opMode The mode to switch to. + @param opMode The mode to switch to. @return 0 if successful */ int switchMode(OpMode opMode); @@ -465,7 +465,7 @@ namespace Exiv2 { any data passed to its constructors. If writes are performed, the changed data can be retrieved using the read methods (since the data used in construction is never modified). - + @note If read only usage of this class is common, it might be worth creating a specialized readonly class or changing this one to have a readonly mode. @@ -480,7 +480,7 @@ namespace Exiv2 { /*! @brief Constructor that accepts a block of memory to be copied. IO operations are performed on the copied memory. - @param data Pointer to data. Data must be at least \em size + @param data Pointer to data. Data must be at least \em size bytes long @param size Number of bytes to copy. */ @@ -496,18 +496,18 @@ namespace Exiv2 { therefore only resets the IO position to the start. @return 0 - */ + */ virtual int open(); /*! @brief Does nothing on MemIo objects. - @return 0 + @return 0 */ virtual int close(); /*! @brief Write data to the memory block. If needed, the size of the internal memory block is expanded. The IO position is advanced - by the number of bytes written. - @param data Pointer to data. Data must be at least \em wcount + by the number of bytes written. + @param data Pointer to data. Data must be at least \em wcount bytes long @param wcount Number of bytes to be written. @return Number of bytes written to the memory block successfully;<BR> @@ -573,7 +573,7 @@ namespace Exiv2 { is invalidated by this operation and should not be used after this method returns. This method exists primarily to be used with the BasicIo::temporary() method. - + @param src Reference to another BasicIo instance. The entire contents of src are transferred to this object. The \em src object is invalidated by the method. @@ -581,7 +581,7 @@ namespace Exiv2 { */ virtual void transfer(BasicIo& src); /*! - @brief Move the current IO position. + @brief Move the current IO position. @param offset Number of bytes to move the IO position relative to the starting position specified by \em pos @param pos Position from which the seek should start @@ -594,12 +594,12 @@ namespace Exiv2 { //! @name Accessors //@{ /*! - @brief Get the current IO position. + @brief Get the current IO position. @return Offset from the start of the memory block */ virtual long tell() const; /*! - @brief Get the current memory buffer size in bytes. + @brief Get the current memory buffer size in bytes. @return Size of the in memory data in bytes;<BR> -1 if failure; */ @@ -629,14 +629,14 @@ namespace Exiv2 { // Typedefs typedef std::vector<byte> ByteVector; - + // DATA ByteVector data_; ByteVector::size_type idx_; // METHODS void checkSize(long wcount); - }; // class MemIo + }; // class MemIo } // namespace Exiv2 #endif // #ifndef BASICIO_HPP_ diff --git a/src/plugins/exiv2/canonmn.cpp b/src/plugins/exiv2/canonmn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -52,16 +52,16 @@ EXIV2_RCSID("@(#) $Id: canonmn.cpp 600 2005-07-09 10:38:09Z ahuggel $"); // ***************************************************************************** // local declarations namespace { - /* + /* @brief Convert Canon hex-based EV (modulo 0x20) to real number - Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv + Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv by Will Stokes 0x00 -> 0 0x0c -> 0.33333 0x10 -> 0.5 0x14 -> 0.66666 - 0x20 -> 1 + 0x20 -> 1 .. 160 -> 5 128 -> 4 @@ -77,8 +77,8 @@ namespace Exiv2 { //! @cond IGNORE CanonMakerNote::RegisterMn::RegisterMn() { - MakerNoteFactory::registerMakerNote("Canon", "*", createCanonMakerNote); - + MakerNoteFactory::registerMakerNote("Canon", "*", createCanonMakerNote); + MakerNoteFactory::registerMakerNote( canonIfdId, MakerNote::AutoPtr(new CanonMakerNote)); MakerNoteFactory::registerMakerNote( @@ -212,8 +212,8 @@ namespace Exiv2 { }; int CanonMakerNote::read(const byte* buf, - long len, - ByteOrder byteOrder, + long len, + ByteOrder byteOrder, long offset) { int rc = IfdMakerNote::read(buf, len, byteOrder, offset); @@ -225,7 +225,7 @@ namespace Exiv2 { for (uint16_t c = 1; cs->count() > c; ++c) { if (c == 23 && cs->count() > 25) { // Pack related lens info into one tag - addCsEntry(canonCs1IfdId, c, cs->offset() + c*2, + addCsEntry(canonCs1IfdId, c, cs->offset() + c*2, cs->data() + c*2, 3); c += 2; } @@ -273,9 +273,9 @@ namespace Exiv2 { return 0; } - void CanonMakerNote::addCsEntry(IfdId ifdId, - uint16_t tag, - long offset, + void CanonMakerNote::addCsEntry(IfdId ifdId, + uint16_t tag, + long offset, const byte* data, int count) { @@ -290,7 +290,7 @@ namespace Exiv2 { void CanonMakerNote::add(const Entry& entry) { assert(alloc_ == entry.alloc()); - assert( entry.ifdId() == canonIfdId + assert( entry.ifdId() == canonIfdId || entry.ifdId() == canonCs1IfdId || entry.ifdId() == canonCs2IfdId || entry.ifdId() == canonCfIfdId); @@ -302,7 +302,7 @@ namespace Exiv2 { { if (byteOrder_ == invalidByteOrder) byteOrder_ = byteOrder; - assert(ifd_.alloc()); + assert(ifd_.alloc()); ifd_.clear(); // Add all standard Canon entries to the IFD @@ -378,7 +378,7 @@ namespace Exiv2 { return headerSize() + ifd.size() + ifd.dataSize(); } // CanonMakerNote::size - long CanonMakerNote::assemble(Entry& e, + long CanonMakerNote::assemble(Entry& e, IfdId ifdId, uint16_t tag, ByteOrder byteOrder) const @@ -410,7 +410,7 @@ namespace Exiv2 { return len; } // CanonMakerNote::assemble - Entries::const_iterator CanonMakerNote::findIdx(int idx) const + Entries::const_iterator CanonMakerNote::findIdx(int idx) const { return std::find_if(entries_.begin(), entries_.end(), FindEntryByIdx(idx)); @@ -432,9 +432,9 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - CanonMakerNote* CanonMakerNote::create_(bool alloc) const + CanonMakerNote* CanonMakerNote::create_(bool alloc) const { - return new CanonMakerNote(alloc); + return new CanonMakerNote(alloc); } CanonMakerNote::AutoPtr CanonMakerNote::clone() const @@ -442,16 +442,16 @@ namespace Exiv2 { return AutoPtr(clone_()); } - CanonMakerNote* CanonMakerNote::clone_() const + CanonMakerNote* CanonMakerNote::clone_() const { - return new CanonMakerNote(*this); + return new CanonMakerNote(*this); } std::ostream& CanonMakerNote::print0x0008(std::ostream& os, const Value& value) { std::string n = value.toString(); - return os << n.substr(0, n.length() - 4) << "-" + return os << n.substr(0, n.length() - 4) << "-" << n.substr(n.length() - 4); } @@ -461,13 +461,13 @@ namespace Exiv2 { std::istringstream is(value.toString()); uint32_t l; is >> l; - return os << std::setw(4) << std::setfill('0') << std::hex + return os << std::setw(4) << std::setfill('0') << std::hex << ((l & 0xffff0000) >> 16) << std::setw(5) << std::setfill('0') << std::dec << (l & 0x0000ffff); } - std::ostream& CanonMakerNote::printCs10x0001(std::ostream& os, + std::ostream& CanonMakerNote::printCs10x0001(std::ostream& os, const Value& value) { if (value.typeId() != unsignedShort) return os << value; @@ -488,7 +488,7 @@ namespace Exiv2 { if (l == 0) { os << "Off"; } - else { + else { os << l / 10.0 << " s"; } return os; @@ -530,7 +530,7 @@ namespace Exiv2 { std::ostream& CanonMakerNote::printCs10x0005(std::ostream& os, const Value& value) { - if (value.typeId() != unsignedShort) return os << value; + if (value.typeId() != unsignedShort) return os << value; long l = value.toLong(); switch (l) { case 0: os << "Single / timer"; break; @@ -893,9 +893,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createCanonMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new CanonMakerNote(alloc)); diff --git a/src/plugins/exiv2/canonmn.hpp b/src/plugins/exiv2/canonmn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -62,27 +62,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createCanonMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -110,8 +110,8 @@ namespace Exiv2 { //! @name Manipulators //@{ int read(const byte* buf, - long len, - ByteOrder byteOrder, + long len, + ByteOrder byteOrder, long offset); long copy(byte* buf, ByteOrder byteOrder, long offset); void add(const Entry& entry); @@ -130,7 +130,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Canon %MakerNote tags + //! @name Print functions for Canon %MakerNote tags //@{ //! Print the image number static std::ostream& print0x0008(std::ostream& os, const Value& value); @@ -167,7 +167,7 @@ namespace Exiv2 { static std::ostream& printCs10x0014(std::ostream& os, const Value& value); //! Flash activity static std::ostream& printCs10x001c(std::ostream& os, const Value& value); - //! Flash details + //! Flash details static std::ostream& printCs10x001d(std::ostream& os, const Value& value); //! Focus mode (G1 seems to use this in preference to field 7) static std::ostream& printCs10x0020(std::ostream& os, const Value& value); @@ -200,8 +200,8 @@ namespace Exiv2 { //! @name Manipulators //@{ //! Add a camera settings entry to the makernote entries - void addCsEntry(IfdId ifdId, - uint16_t tag, + void addCsEntry(IfdId ifdId, + uint16_t tag, long offset, const byte* data, int count); @@ -210,8 +210,8 @@ namespace Exiv2 { //! @name Accessors //@{ //! Assemble special Canon entries into an entry with the original tag - long assemble(Entry& e, - IfdId ifdId, + long assemble(Entry& e, + IfdId ifdId, uint16_t tag, ByteOrder byteOrder) const; //! Internal virtual create function. diff --git a/src/plugins/exiv2/datasets.cpp b/src/plugins/exiv2/datasets.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -45,18 +45,18 @@ EXIV2_RCSID("@(#) $Id: datasets.cpp 560 2005-04-17 11:51:32Z ahuggel $"); namespace Exiv2 { DataSet::DataSet( - uint16_t number, + uint16_t number, const char* name, const char* desc, bool mandatory, bool repeatable, - uint32_t minbytes, + uint32_t minbytes, uint32_t maxbytes, TypeId type, uint16_t recordId, const char* photoshop ) - : number_(number), name_(name), desc_(desc), mandatory_(mandatory), + : number_(number), name_(name), desc_(desc), mandatory_(mandatory), repeatable_(repeatable), minbytes_(minbytes), maxbytes_(maxbytes), type_(type), recordId_(recordId), photoshop_(photoshop) { @@ -76,7 +76,7 @@ namespace Exiv2 { RecordInfo(IptcDataSets::envelope, "Envelope", "IIM envelope record"), RecordInfo(IptcDataSets::application2, "Application2", "IIM application record 2"), }; - + static const DataSet envelopeRecord[] = { DataSet(IptcDataSets::ModelVersion, "ModelVersion", "Version of IIM part 1", true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""), DataSet(IptcDataSets::Destination, "Destination", "Routing information", false, true, 0, 1024, Exiv2::string, IptcDataSets::envelope, ""), @@ -158,11 +158,11 @@ namespace Exiv2 { static const DataSet unknownDataSet(0xffff, "Unknown dataset", "Unknown dataset", false, true, 0, 0xffffffff, Exiv2::string, IptcDataSets::invalidRecord, "Unknown dataset"); - // Dataset lookup lists.This is an array with pointers to one list per IIM4 Record. + // Dataset lookup lists.This is an array with pointers to one list per IIM4 Record. // The record id is used as the index into the array. const DataSet* IptcDataSets::records_[] = { - 0, - envelopeRecord, application2Record, + 0, + envelopeRecord, application2Record, 0 }; @@ -229,7 +229,7 @@ namespace Exiv2 { return records_[recordId][idx].repeatable_; } - uint16_t IptcDataSets::dataSet(const std::string& dataSetName, + uint16_t IptcDataSets::dataSet(const std::string& dataSetName, uint16_t recordId) { uint16_t dataSet; @@ -249,7 +249,7 @@ namespace Exiv2 { std::string IptcDataSets::recordName(uint16_t recordId) { if (recordId == envelope || recordId == application2) { - return recordInfo_[recordId].name_; + return recordInfo_[recordId].name_; } std::ostringstream os; @@ -290,7 +290,7 @@ namespace Exiv2 { } } } // IptcDataSets::dataSetList - + const char* IptcKey::familyName_ = "Iptc"; IptcKey::IptcKey(const std::string& key) @@ -351,7 +351,7 @@ namespace Exiv2 { uint16_t recId = IptcDataSets::recordId(recordName); uint16_t dataSet = IptcDataSets::dataSet(dataSetName, recId); - // Possibly translate hex name parts (0xabcd) to real names + // Possibly translate hex name parts (0xabcd) to real names recordName = IptcDataSets::recordName(recId); dataSetName = IptcDataSets::dataSetName(dataSet, recId); @@ -370,12 +370,12 @@ namespace Exiv2 { // ************************************************************************* // free functions - std::ostream& operator<<(std::ostream& os, const DataSet& dataSet) + std::ostream& operator<<(std::ostream& os, const DataSet& dataSet) { IptcKey iptcKey(dataSet.number_, dataSet.recordId_); return os << dataSet.name_ << ", " << std::dec << dataSet.number_ << ", " - << "0x" << std::setw(4) << std::setfill('0') + << "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << dataSet.number_ << ", " << IptcDataSets::recordName(dataSet.recordId_) << ", " << std::boolalpha << dataSet.mandatory_ << ", " @@ -384,7 +384,7 @@ namespace Exiv2 { << dataSet.maxbytes_ << ", " << iptcKey.key() << ", " << TypeInfo::typeName( - IptcDataSets::dataSetType(dataSet.number_, + IptcDataSets::dataSetType(dataSet.number_, dataSet.recordId_)) << ", " << dataSet.desc_; } diff --git a/src/plugins/exiv2/datasets.hpp b/src/plugins/exiv2/datasets.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -59,12 +59,12 @@ namespace Exiv2 { struct DataSet { //! Constructor DataSet( - uint16_t number, + uint16_t number, const char* name, const char* desc, bool mandatory, bool repeatable, - uint32_t minbytes, + uint32_t minbytes, uint32_t maxbytes, TypeId type, uint16_t recordId, @@ -184,23 +184,23 @@ namespace Exiv2 { /*! @brief Return the name of the dataset. @param number The dataset number - @param recordId The Iptc record Id + @param recordId The Iptc record Id @return The name of the dataset or a string containing the hexadecimal - value of the dataset in the form "0x01ff", if this is an unknown + value of the dataset in the form "0x01ff", if this is an unknown dataset. */ static std::string dataSetName(uint16_t number, uint16_t recordId); /*! @brief Return the description of the dataset. @param number The dataset number - @param recordId The Iptc record Id + @param recordId The Iptc record Id @return The description of the dataset */ static const char* dataSetDesc(uint16_t number, uint16_t recordId); /*! @brief Return the photohsop name of a given dataset. @param number The dataset number - @param recordId The Iptc record Id + @param recordId The Iptc record Id @return The name used by photoshop for a dataset or an empty string if photoshop does not use the dataset. */ @@ -208,7 +208,7 @@ namespace Exiv2 { /*! @brief Check if a given dataset is repeatable @param number The dataset number - @param recordId The Iptc record Id + @param recordId The Iptc record Id @return true if the given dataset is repeatable otherwise false */ static bool dataSetRepeatable(uint16_t number, uint16_t recordId); @@ -269,10 +269,10 @@ namespace Exiv2 { //! @name Creators //@{ /*! - @brief Constructor to create an Iptc key from a key string. + @brief Constructor to create an Iptc key from a key string. @param key The key string. - @throw Error if the first part of the key is not '<b>Iptc</b>' or + @throw Error if the first part of the key is not '<b>Iptc</b>' or the remaining parts of the key cannot be parsed and converted to a record name and a dataset name. */ @@ -320,7 +320,7 @@ namespace Exiv2 { //! @name Manipulators //@{ /*! - @brief Set the key corresponding to the dataset and record id. + @brief Set the key corresponding to the dataset and record id. The key is of the form '<b>Iptc</b>.recordName.dataSetName'. */ void makeKey(); @@ -342,7 +342,7 @@ namespace Exiv2 { static const char* familyName_; uint16_t tag_; //!< Tag value - uint16_t record_; //!< Record value + uint16_t record_; //!< Record value std::string key_; //!< Key }; // class IptcKey diff --git a/src/plugins/exiv2/error.cpp b/src/plugins/exiv2/error.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -51,7 +51,7 @@ namespace Exiv2 { ErrMsg( 5, "Invalid record name `%1'"), // %1=record name ErrMsg( 6, "Invalid key `%1'"), // %1=key ErrMsg( 7, "Invalid tag name or ifdId `%1', ifdId %2"), // %1=tag name, %2=ifdId - ErrMsg( 8, "Value not set"), + ErrMsg( 8, "Value not set"), ErrMsg( 9, "%1: Failed to open the data source: %2"), // %1=path, %2=strerror ErrMsg( 10, "%1: Failed to open file (%2): %3"), // %1=path, %2=mode, %3=strerror ErrMsg( 11, "%1: The file contains data of an unknown image type"), // %1=path diff --git a/src/plugins/exiv2/error.hpp b/src/plugins/exiv2/error.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -57,15 +57,15 @@ namespace Exiv2 { }; /*! - @brief Error class interface. Allows the definition and use of a hierarchy + @brief Error class interface. Allows the definition and use of a hierarchy of error classes which can all be handled in one catch block. */ class AnyError { public: //! @name Creators - //@{ + //@{ //! Virtual destructor. - virtual ~AnyError() + virtual ~AnyError() { } //@} @@ -77,8 +77,8 @@ namespace Exiv2 { /*! @brief Return the error message. Consider using the output operator operator<<(std::ostream &os, const AnyError& error) instead. - @note Unlike std::exception::what(), this function returns an - std::string. + @note Unlike std::exception::what(), this function returns an + std::string. */ virtual std::string what() const =0; }; // AnyError @@ -90,13 +90,13 @@ namespace Exiv2 { } /*! - @brief Simple error class used for exceptions. An output operator is + @brief Simple error class used for exceptions. An output operator is provided to print errors to a stream. */ class Error : public AnyError { public: //! @name Creators - //@{ + //@{ //! Constructor taking only an error code explicit Error(int code) : code_(code), count_(0) @@ -117,9 +117,9 @@ namespace Exiv2 { } //! Constructor taking an error code and three arguments template<typename A, typename B, typename C> - Error(int code, const A& arg1, const B& arg2, const C& arg3) + Error(int code, const A& arg1, const B& arg2, const C& arg3) : code_(code), count_(3), - arg1_(toString(arg1)), arg2_(toString(arg2)), arg3_(toString(arg3)) + arg1_(toString(arg1)), arg2_(toString(arg2)), arg3_(toString(arg3)) { } //@} diff --git a/src/plugins/exiv2/exif.cpp b/src/plugins/exiv2/exif.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -29,8 +29,8 @@ #include "rcsid.hpp" EXIV2_RCSID("@(#) $Id: exif.cpp 600 2005-07-09 10:38:09Z ahuggel $"); -// Define DEBUG_MAKERNOTE to output debug information to std::cerr, e.g, by -// calling make like this: make DEFS=-DDEBUG_MAKERNOTE exif.o +// Define DEBUG_MAKERNOTE to output debug information to std::cerr, e.g, by +// calling make like this: make DEFS=-DDEBUG_MAKERNOTE exif.o //#define DEBUG_MAKERNOTE // ***************************************************************************** @@ -79,7 +79,7 @@ namespace { void setOffsetTag(Exiv2::Ifd& ifd, int idx, uint16_t tag, - uint32_t offset, + uint32_t offset, Exiv2::ByteOrder byteOrder); // Read file path into a DataBuf, which is returned. @@ -97,7 +97,7 @@ namespace Exiv2 { setValue(e, byteOrder); } - Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue) + Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue) : key_(key.clone()) { if (pValue) value_ = pValue->clone(); @@ -114,10 +114,10 @@ namespace Exiv2 { if (rhs.value_.get() != 0) value_ = rhs.value_->clone(); // deep copy } - const Value& Exifdatum::value() const + const Value& Exifdatum::value() const { - if (value_.get() == 0) throw Error(8); - return *value_; + if (value_.get() == 0) throw Error(8); + return *value_; } Exifdatum& Exifdatum::operator=(const Exifdatum& rhs) @@ -133,41 +133,41 @@ namespace Exiv2 { return *this; } // Exifdatum::operator= - + Exifdatum& Exifdatum::operator=(const std::string& value) - { - setValue(value); - return *this; + { + setValue(value); + return *this; } - Exifdatum& Exifdatum::operator=(const uint16_t& value) + Exifdatum& Exifdatum::operator=(const uint16_t& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const uint32_t& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const URational& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const int16_t& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const int32_t& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const Rational& value) { - return Exiv2::setValue(*this, value); + return Exiv2::setValue(*this, value); } Exifdatum& Exifdatum::operator=(const Value& value) @@ -213,7 +213,7 @@ namespace Exiv2 { } DataBuf stripsBuf(totalSize); - // Copy all strips into the data buffer. For each strip remember its + // Copy all strips into the data buffer. For each strip remember its // offset from the start of the data buffer ExifData::iterator stripOffsets; key = ExifKey("Exif.Thumbnail.StripOffsets"); @@ -238,7 +238,7 @@ namespace Exiv2 { currentOffset += size; } - // Set StripOffsets data area and relative offsets + // Set StripOffsets data area and relative offsets stripOffsets->setDataArea(stripsBuf.pData_, stripsBuf.size_); stripOffsets->setValue(os.str()); @@ -322,16 +322,16 @@ namespace Exiv2 { return format->dataArea(); } - ExifData::ExifData() - : pTiffHeader_(0), - pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), + ExifData::ExifData() + : pTiffHeader_(0), + pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), pMakerNote_(0), size_(0), pData_(0), compatible_(true) { } ExifData::ExifData(const ExifData& rhs) : exifMetadata_(rhs.exifMetadata_), pTiffHeader_(0), - pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), + pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), pMakerNote_(0), size_(0), pData_(0), compatible_(rhs.compatible_) { pData_ = new byte[rhs.size_]; @@ -465,11 +465,11 @@ namespace Exiv2 { // Read IFD0 delete pIfd0_; - pIfd0_ = new Ifd(ifd0Id, 0, false); + pIfd0_ = new Ifd(ifd0Id, 0, false); assert(pIfd0_ != 0); - rc = pIfd0_->read(pData_ + pTiffHeader_->offset(), - size_ - pTiffHeader_->offset(), - byteOrder(), + rc = pIfd0_->read(pData_ + pTiffHeader_->offset(), + size_ - pTiffHeader_->offset(), + byteOrder(), pTiffHeader_->offset()); if (rc) return rc; @@ -479,11 +479,11 @@ namespace Exiv2 { // Find and read ExifIFD sub-IFD of IFD0 rc = pIfd0_->readSubIfd(*pExifIfd_, pData_, size_, byteOrder(), 0x8769); if (rc) return rc; - // Find MakerNote in ExifIFD, create a MakerNote class + // Find MakerNote in ExifIFD, create a MakerNote class Ifd::iterator pos = pExifIfd_->findTag(0x927c); Ifd::iterator make = pIfd0_->findTag(0x010f); Ifd::iterator model = pIfd0_->findTag(0x0110); - if ( pos != pExifIfd_->end() + if ( pos != pExifIfd_->end() && make != pIfd0_->end() && model != pIfd0_->end()) { // Todo: The conversion to string assumes that there is a \0 at the end // Todo: How to avoid the cast (is that a MSVC thing?) @@ -491,14 +491,14 @@ namespace Exiv2 { reinterpret_cast<const char*>(make->data()), reinterpret_cast<const char*>(model->data()), false, - pos->data(), + pos->data(), pos->size(), byteOrder(), pExifIfd_->offset() + pos->offset()).release(); } // Read the MakerNote if (pMakerNote_) { - rc = pMakerNote_->read(pos->data(), + rc = pMakerNote_->read(pos->data(), pos->size(), byteOrder(), pExifIfd_->offset() + pos->offset()); @@ -536,9 +536,9 @@ namespace Exiv2 { assert(pIfd1_ != 0); // Read IFD1 if (pIfd0_->next()) { - rc = pIfd1_->read(pData_ + pIfd0_->next(), - size_ - pIfd0_->next(), - byteOrder(), + rc = pIfd1_->read(pData_ + pIfd0_->next(), + size_ - pIfd0_->next(), + byteOrder(), pIfd0_->next()); if (rc) return rc; } @@ -559,11 +559,11 @@ namespace Exiv2 { add(pIfd0_->begin(), pIfd0_->end(), byteOrder()); add(pExifIfd_->begin(), pExifIfd_->end(), byteOrder()); if (pMakerNote_) { - add(pMakerNote_->begin(), pMakerNote_->end(), + add(pMakerNote_->begin(), pMakerNote_->end(), (pMakerNote_->byteOrder() == invalidByteOrder ? byteOrder() : pMakerNote_->byteOrder())); } - add(pIopIfd_->begin(), pIopIfd_->end(), byteOrder()); + add(pIopIfd_->begin(), pIopIfd_->end(), byteOrder()); add(pGpsIfd_->begin(), pGpsIfd_->end(), byteOrder()); add(pIfd1_->begin(), pIfd1_->end(), byteOrder()); // Read the thumbnail (but don't worry whether it was successful or not) @@ -609,8 +609,8 @@ namespace Exiv2 { if (pMakerNote_) { // Build MakerNote from metadata makerNote = pMakerNote_->create(); - addToMakerNote(makerNote.get(), - begin(), end(), + addToMakerNote(makerNote.get(), + begin(), end(), (pMakerNote_->byteOrder() == invalidByteOrder ? byteOrder() : pMakerNote_->byteOrder())); // Create a placeholder MakerNote entry of the correct size and @@ -651,21 +651,21 @@ namespace Exiv2 { bool addOffsetTag = false; long exifIfdOffset = ifd0Offset + ifd0.size() + ifd0.dataSize(); if (exifIfd.size() > 0 || iopIfd.size() > 0) { - exifIfdOffset += 12; - addOffsetTag = true; + exifIfdOffset += 12; + addOffsetTag = true; } if (gpsIfd.size() > 0) { - exifIfdOffset += 12; - addOffsetTag = true; + exifIfdOffset += 12; + addOffsetTag = true; } if (ifd0.size() == 0 && addOffsetTag) { - exifIfdOffset += 6; + exifIfdOffset += 6; } addOffsetTag = false; - long iopIfdOffset = exifIfdOffset + exifIfd.size() + exifIfd.dataSize(); + long iopIfdOffset = exifIfdOffset + exifIfd.size() + exifIfd.dataSize(); if (iopIfd.size() > 0) { iopIfdOffset += 12; - addOffsetTag = true; + addOffsetTag = true; } if (exifIfd.size() == 0 && addOffsetTag) { iopIfdOffset += 6; @@ -726,7 +726,7 @@ namespace Exiv2 { return buf; } // ExifData::copyFromMetadata - void ExifData::add(Entries::const_iterator begin, + void ExifData::add(Entries::const_iterator begin, Entries::const_iterator end, ByteOrder byteOrder) { @@ -746,7 +746,7 @@ namespace Exiv2 { if (ExifTags::isMakerIfd(exifdatum.ifdId())) { if (pMakerNote_ == 0) { pMakerNote_ = MakerNoteFactory::create(exifdatum.ifdId()).release(); - } + } if (pMakerNote_ == 0) throw Error(23, exifdatum.ifdId()); } // allow duplicates @@ -801,7 +801,7 @@ namespace Exiv2 { (*this)["Exif.Thumbnail.JPEGInterchangeFormatLength"] = uint32_t(size); } - void ExifData::setJpegThumbnail(const byte* buf, long size, + void ExifData::setJpegThumbnail(const byte* buf, long size, URational xres, URational yres, uint16_t unit) { setJpegThumbnail(buf, size); @@ -816,7 +816,7 @@ namespace Exiv2 { setJpegThumbnail(thumb.pData_, thumb.size_); } - void ExifData::setJpegThumbnail(const std::string& path, + void ExifData::setJpegThumbnail(const std::string& path, URational xres, URational yres, uint16_t unit) { DataBuf thumb = readFile(path); // may throw @@ -827,8 +827,8 @@ namespace Exiv2 { { // First, determine if the thumbnail is at the end of the Exif data bool stp = stdThumbPosition(); - // Delete all Exif.Thumbnail.* (IFD1) metadata - ExifMetadata::iterator i = begin(); + // Delete all Exif.Thumbnail.* (IFD1) metadata + ExifMetadata::iterator i = begin(); while (i != end()) { if (i->ifdId() == ifd1Id) { i = erase(i); @@ -858,7 +858,7 @@ namespace Exiv2 { bool ExifData::stdThumbPosition() const { - if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0 + if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0 || pGpsIfd_ == 0 || pIfd1_ == 0) return true; // Todo: There is still an invalid assumption here: The data of an IFD @@ -872,7 +872,7 @@ namespace Exiv2 { long maxOffset; maxOffset = std::max(pIfd0_->offset(), pIfd0_->dataOffset()); maxOffset = std::max(maxOffset, pExifIfd_->offset()); - maxOffset = std::max(maxOffset, pExifIfd_->dataOffset() + maxOffset = std::max(maxOffset, pExifIfd_->dataOffset() + pExifIfd_->dataSize()); if (pMakerNote_) { maxOffset = std::max(maxOffset, pMakerNote_->offset() @@ -897,12 +897,12 @@ namespace Exiv2 { } // ExifData::stdThumbPosition ByteOrder ExifData::byteOrder() const - { + { if (pTiffHeader_) return pTiffHeader_->byteOrder(); return littleEndian; } - int ExifData::writeThumbnail(const std::string& path) const + int ExifData::writeThumbnail(const std::string& path) const { Thumbnail::AutoPtr thumbnail = getThumbnail(); if (thumbnail.get() == 0) return 8; @@ -935,7 +935,7 @@ namespace Exiv2 { return thumbnail->format(); } - const char* ExifData::thumbnailExtension() const + const char* ExifData::thumbnailExtension() const { Thumbnail::AutoPtr thumbnail = getThumbnail(); if (thumbnail.get() == 0) return ""; @@ -972,7 +972,7 @@ namespace Exiv2 { bool ExifData::updateEntries() { - if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0 + if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0 || pGpsIfd_ == 0 || pIfd1_ == 0) return false; if (!this->compatible()) return false; @@ -980,8 +980,8 @@ namespace Exiv2 { compatible &= updateRange(pIfd0_->begin(), pIfd0_->end(), byteOrder()); compatible &= updateRange(pExifIfd_->begin(), pExifIfd_->end(), byteOrder()); if (pMakerNote_) { - compatible &= updateRange(pMakerNote_->begin(), - pMakerNote_->end(), + compatible &= updateRange(pMakerNote_->begin(), + pMakerNote_->end(), (pMakerNote_->byteOrder() == invalidByteOrder ? byteOrder() : pMakerNote_->byteOrder())); } @@ -992,7 +992,7 @@ namespace Exiv2 { return compatible; } // ExifData::updateEntries - bool ExifData::updateRange(const Entries::iterator& begin, + bool ExifData::updateRange(const Entries::iterator& begin, const Entries::iterator& end, ByteOrder byteOrder) { @@ -1007,7 +1007,7 @@ namespace Exiv2 { continue; } if (entry->count() == 0 && md->count() == 0) { - // Special case: don't do anything if both the entry and + // Special case: don't do anything if both the entry and // Exifdatum have no data. This is to preserve the original // data in the offset field of an IFD entry with count 0, // if the Exifdatum was not changed. @@ -1025,13 +1025,13 @@ namespace Exiv2 { // header and that is currently only done in intrusive write // mode). On the other hand, it is thus now not possible to // change the offsets of an entry with a data area in - // non-intrusive mode. This can be considered a bug. + // non-intrusive mode. This can be considered a bug. // Todo: Fix me! if (md->sizeDataArea() == 0) { DataBuf buf(md->size()); md->copy(buf.pData_, byteOrder); - entry->setValue(static_cast<uint16_t>(md->typeId()), - md->count(), + entry->setValue(static_cast<uint16_t>(md->typeId()), + md->count(), buf.pData_, md->size()); } // Always set the data area @@ -1057,7 +1057,7 @@ namespace Exiv2 { } // Make sure that the size of the Exifdatum fits the available size // of the entry - if ( md->size() > rc.second->size() + if ( md->size() > rc.second->size() || md->sizeDataArea() > rc.second->sizeDataArea()) { compatible = false; break; @@ -1066,7 +1066,7 @@ namespace Exiv2 { return compatible; } // ExifData::compatible - std::pair<bool, Entries::const_iterator> + std::pair<bool, Entries::const_iterator> ExifData::findEntry(IfdId ifdId, int idx) const { Entries::const_iterator entry; @@ -1095,19 +1095,19 @@ namespace Exiv2 { { const Ifd* ifd = 0; switch (ifdId) { - case ifd0Id: + case ifd0Id: ifd = pIfd0_; break; - case exifIfdId: + case exifIfdId: ifd = pExifIfd_; break; - case iopIfdId: + case iopIfdId: ifd = pIopIfd_; break; - case gpsIfdId: + case gpsIfdId: ifd = pGpsIfd_; break; - case ifd1Id: + case ifd1Id: ifd = pIfd1_; break; default: @@ -1120,9 +1120,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - void addToIfd(Ifd& ifd, - ExifMetadata::const_iterator begin, - ExifMetadata::const_iterator end, + void addToIfd(Ifd& ifd, + ExifMetadata::const_iterator begin, + ExifMetadata::const_iterator end, ByteOrder byteOrder) { for (ExifMetadata::const_iterator i = begin; i != end; ++i) { @@ -1145,8 +1145,8 @@ namespace Exiv2 { DataBuf buf(md.size()); md.copy(buf.pData_, byteOrder); - e.setValue(static_cast<uint16_t>(md.typeId()), md.count(), - buf.pData_, buf.size_); + e.setValue(static_cast<uint16_t>(md.typeId()), md.count(), + buf.pData_, buf.size_); DataBuf dataArea(md.dataArea()); e.setDataArea(dataArea.pData_, dataArea.size_); @@ -1156,7 +1156,7 @@ namespace Exiv2 { void addToMakerNote(MakerNote* makerNote, ExifMetadata::const_iterator begin, - ExifMetadata::const_iterator end, + ExifMetadata::const_iterator end, ByteOrder byteOrder) { for (ExifMetadata::const_iterator i = begin; i != end; ++i) { @@ -1166,8 +1166,8 @@ namespace Exiv2 { } } // addToMakerNote - void addToMakerNote(MakerNote* makerNote, - const Exifdatum& md, + void addToMakerNote(MakerNote* makerNote, + const Exifdatum& md, ByteOrder byteOrder) { Entry e; @@ -1179,7 +1179,7 @@ namespace Exiv2 { DataBuf buf(md.size()); md.copy(buf.pData_, byteOrder); e.setValue(static_cast<uint16_t>(md.typeId()), md.count(), - buf.pData_, md.size()); + buf.pData_, md.size()); DataBuf dataArea(md.dataArea()); e.setDataArea(dataArea.pData_, dataArea.size_); @@ -1200,7 +1200,7 @@ namespace { void setOffsetTag(Exiv2::Ifd& ifd, int idx, uint16_t tag, - uint32_t offset, + uint32_t offset, Exiv2::ByteOrder byteOrder) { Exiv2::Ifd::iterator pos = ifd.findTag(tag); @@ -1231,7 +1231,7 @@ namespace { if (len != buf.size_) { throw Exiv2::Error(2, path, Exiv2::strError(), "FileIo::read"); } - return buf; + return buf; } } diff --git a/src/plugins/exiv2/exif.hpp b/src/plugins/exiv2/exif.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -47,7 +47,7 @@ // namespace extensions /*! @brief Provides classes and functions to encode and decode Exif and Iptc data. - This namespace corresponds to the <b>libexiv2</b> library. + This namespace corresponds to the <b>libexiv2</b> library. */ namespace Exiv2 { @@ -74,7 +74,7 @@ namespace Exiv2 { /*! @brief Constructor for new tags created by an application. The %Exifdatum is created from a \em key / value pair. %Exifdatum copies - (clones) the \em key and value if one is provided. Alternatively, + (clones) the \em key and value if one is provided. Alternatively, a program can create an 'empty' %Exifdatum with only a key and set the value using setValue(). @@ -99,7 +99,7 @@ namespace Exiv2 { @brief Assign \em value to the %Exifdatum. The type of the new Value is set to UShortValue. */ - Exifdatum& operator=(const uint16_t& value); + Exifdatum& operator=(const uint16_t& value); /*! @brief Assign \em value to the %Exifdatum. The type of the new Value is set to ULongValue. @@ -127,7 +127,7 @@ namespace Exiv2 { Exifdatum& operator=(const Rational& value); /*! @brief Assign \em value to the %Exifdatum. - Calls setValue(const std::string&). + Calls setValue(const std::string&). */ Exifdatum& operator=(const std::string& value); /*! @@ -152,7 +152,7 @@ namespace Exiv2 { */ void setValue(const Entry& e, ByteOrder byteOrder); /*! - @brief Set the data area by copying (cloning) the buffer pointed to + @brief Set the data area by copying (cloning) the buffer pointed to by \em buf. Values may have a data area, which can contain additional @@ -164,14 +164,14 @@ namespace Exiv2 { @return Return -1 if the %Exifdatum does not have a value yet or the value has no data area, else 0. */ - int setDataArea(const byte* buf, long len) + int setDataArea(const byte* buf, long len) { return value_.get() == 0 ? -1 : value_->setDataArea(buf, len); } //@} //! @name Accessors //@{ - //! Return the key of the %Exifdatum. - std::string key() const + //! Return the key of the %Exifdatum. + std::string key() const { return key_.get() == 0 ? "" : key_->key(); } //! Return the name of the group (the second part of the key) std::string groupName() const @@ -183,13 +183,13 @@ namespace Exiv2 { uint16_t tag() const { return key_.get() == 0 ? 0xffff : key_->tag(); } //! Return the IFD id - IfdId ifdId() const + IfdId ifdId() const { return key_.get() == 0 ? ifdIdNotSet : key_->ifdId(); } //! Return the name of the IFD const char* ifdName() const { return key_.get() == 0 ? "" : key_->ifdName(); } //! Return the related image item (deprecated) - std::string ifdItem() const + std::string ifdItem() const { return key_.get() == 0 ? "" : key_->ifdItem(); } //! Return the index (unique id of this key within the original IFD) int idx() const @@ -205,25 +205,25 @@ namespace Exiv2 { @param byteOrder Applicable byte order (little or big endian). @return Number of characters written. */ - long copy(byte* buf, ByteOrder byteOrder) const + long copy(byte* buf, ByteOrder byteOrder) const { return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); } //! Return the type id of the value - TypeId typeId() const + TypeId typeId() const { return value_.get() == 0 ? invalidTypeId : value_->typeId(); } //! Return the name of the type - const char* typeName() const + const char* typeName() const { return TypeInfo::typeName(typeId()); } //! Return the size in bytes of one component of this type - long typeSize() const + long typeSize() const { return TypeInfo::typeSize(typeId()); } //! Return the number of components in the value - long count() const + long count() const { return value_.get() == 0 ? 0 : value_->count(); } //! Return the size of the value in bytes - long size() const + long size() const { return value_.get() == 0 ? 0 : value_->size(); } //! Return the value as a string. - std::string toString() const + std::string toString() const { return value_.get() == 0 ? "" : value_->toString(); } /*! @brief Return the <EM>n</EM>-th component of the value converted to @@ -231,7 +231,7 @@ namespace Exiv2 { not set and the behaviour of the method is undefined if there is no n-th component. */ - long toLong(long n =0) const + long toLong(long n =0) const { return value_.get() == 0 ? -1 : value_->toLong(n); } /*! @brief Return the <EM>n</EM>-th component of the value converted to @@ -239,7 +239,7 @@ namespace Exiv2 { not set and the behaviour of the method is undefined if there is no n-th component. */ - float toFloat(long n =0) const + float toFloat(long n =0) const { return value_.get() == 0 ? -1 : value_->toFloat(n); } /*! @brief Return the <EM>n</EM>-th component of the value converted to @@ -247,30 +247,30 @@ namespace Exiv2 { Exifdatum is not set and the behaviour of the method is undefined if there is no n-th component. */ - Rational toRational(long n =0) const + Rational toRational(long n =0) const { return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); } /*! @brief Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-pointer ensures that it will be deleted. - This method is provided for users who need full control over the + This method is provided for users who need full control over the value. A caller may, e.g., downcast the pointer to the appropriate subclass of Value to make use of the interface of the subclass to set or modify its contents. - + @return An auto-pointer to a copy (clone) of the value, 0 if the value is not set. */ - Value::AutoPtr getValue() const + Value::AutoPtr getValue() const { return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); } /*! - @brief Return a constant reference to the value. + @brief Return a constant reference to the value. This method is provided mostly for convenient and versatile output of the value which can (to some extent) be formatted through standard stream manipulators. Do not attempt to write to the value through - this reference. + this reference. <b>Example:</b> <br> @code @@ -283,9 +283,9 @@ namespace Exiv2 { @return A constant reference to the value. @throw Error if the value is not set. */ - const Value& value() const; + const Value& value() const; //! Return the size of the data area. - long sizeDataArea() const + long sizeDataArea() const { return value_.get() == 0 ? 0 : value_->sizeDataArea(); } /*! @brief Return a copy of the data area of the value. The caller owns @@ -306,7 +306,7 @@ namespace Exiv2 { private: // DATA - ExifKey::AutoPtr key_; //!< Key + ExifKey::AutoPtr key_; //!< Key Value::AutoPtr value_; //!< Value }; // class Exifdatum @@ -320,7 +320,7 @@ namespace Exiv2 { /*! @brief Set the value of \em exifDatum to \em value. If the object already has a value, it is replaced. Otherwise a new ValueType\<T\> value - is created and set to \em value. + is created and set to \em value. This is a helper function, called from Exifdatum members. It is meant to be used with T = (u)int16_t, (u)int32_t or (U)Rational. Do not use directly. @@ -350,7 +350,7 @@ namespace Exiv2 { //@{ /*! @brief Set the image data as data area of the appropriate Exif - metadatum. Read the thumbnail image data from data buffer + metadatum. Read the thumbnail image data from data buffer \em buf. Return 0 if successful. @param exifData Exif data corresponding to the data buffer. @@ -362,7 +362,7 @@ namespace Exiv2 { 1 in case of inconsistent thumbnail Exif data; or<BR> 2 if the data area is outside of the data buffer */ - virtual int setDataArea(ExifData& exifData, + virtual int setDataArea(ExifData& exifData, Ifd* pIfd1, const byte* buf, long len) const =0; @@ -372,12 +372,12 @@ namespace Exiv2 { */ virtual DataBuf copy(const ExifData& exifData) const =0; /*! - @brief Return a short string for the format of the thumbnail + @brief Return a short string for the format of the thumbnail ("TIFF", "JPEG"). */ virtual const char* format() const =0; /*! - @brief Return the file extension for the format of the thumbnail + @brief Return the file extension for the format of the thumbnail (".tif", ".jpg"). */ virtual const char* extension() const =0; @@ -409,8 +409,8 @@ namespace Exiv2 { //! @name Accessors //@{ - int setDataArea(ExifData& exifData, - Ifd* pIfd1, + int setDataArea(ExifData& exifData, + Ifd* pIfd1, const byte* buf, long len) const; DataBuf copy(const ExifData& exifData) const; @@ -434,8 +434,8 @@ namespace Exiv2 { //! @name Accessors //@{ - int setDataArea(ExifData& exifData, - Ifd* pIfd1, + int setDataArea(ExifData& exifData, + Ifd* pIfd1, const byte* buf, long len) const; DataBuf copy(const ExifData& exifData) const; @@ -464,7 +464,7 @@ namespace Exiv2 { private: IfdId ifdId_; int idx_; - + }; // class FindMetadatumByIfdIdIdx /*! @@ -474,7 +474,7 @@ namespace Exiv2 { Provide high-level access to the Exif data of an image: - read Exif information from JPEG files - access metadata through keys and standard C++ iterators - - add, modify and delete metadata + - add, modify and delete metadata - write Exif data to JPEG files - extract Exif metadata to files, insert from these files - extract and delete Exif thumbnail (JPEG and TIFF thumbnails) @@ -504,7 +504,7 @@ namespace Exiv2 { @brief Load the Exif data from a byte buffer. The data buffer must start with the TIFF header. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @return 0 if successful. */ int load(const byte* buf, long len); @@ -544,7 +544,7 @@ namespace Exiv2 { checks are performed, i.e., it is possible to add multiple metadata with the same key. */ - void add(Entries::const_iterator begin, + void add(Entries::const_iterator begin, Entries::const_iterator end, ByteOrder byteOrder); /*! @@ -563,9 +563,9 @@ namespace Exiv2 { */ void add(const Exifdatum& exifdatum); /*! - @brief Delete the Exifdatum at iterator position \em pos, return the + @brief Delete the Exifdatum at iterator position \em pos, return the position of the next exifdatum. Note that iterators into - the metadata, including \em pos, are potentially invalidated + the metadata, including \em pos, are potentially invalidated by this call. */ iterator erase(iterator pos); @@ -590,7 +590,7 @@ namespace Exiv2 { iterator findKey(const ExifKey& key); /*! @brief Find the Exifdatum with the given \em ifdId and \em idx, - return an iterator to it. + return an iterator to it. This method can be used to uniquely identify an exifdatum that was created from an IFD or from the makernote (with idx greater than @@ -613,12 +613,12 @@ namespace Exiv2 { @note No checks on the file format or size are performed. @note Additional existing Exif thumbnail tags are not modified. - @note The Jpeg image inserted as thumbnail image should not + @note The Jpeg image inserted as thumbnail image should not itself contain Exif data (or other metadata), as existing - applications may have problems with that. (The preview + applications may have problems with that. (The preview application that comes with OS X for one.) - David Harvey. */ - void setJpegThumbnail(const std::string& path, + void setJpegThumbnail(const std::string& path, URational xres, URational yres, uint16_t unit); /*! @brief Set the Exif thumbnail to the Jpeg image pointed to by \em buf, @@ -632,15 +632,15 @@ namespace Exiv2 { @note No checks on the image format or size are performed. @note Additional existing Exif thumbnail tags are not modified. - @note The Jpeg image inserted as thumbnail image should not + @note The Jpeg image inserted as thumbnail image should not itself contain Exif data (or other metadata), as existing - applications may have problems with that. (The preview + applications may have problems with that. (The preview application that comes with OS X for one.) - David Harvey. */ - void setJpegThumbnail(const byte* buf, long size, + void setJpegThumbnail(const byte* buf, long size, URational xres, URational yres, uint16_t unit); /*! - @brief Set the Exif thumbnail to the Jpeg image \em path. + @brief Set the Exif thumbnail to the Jpeg image \em path. This sets only the Compression, JPEGInterchangeFormat and JPEGInterchangeFormatLength tags, which is not all the thumbnail @@ -655,7 +655,7 @@ namespace Exiv2 { void setJpegThumbnail(const std::string& path); /*! @brief Set the Exif thumbnail to the Jpeg image pointed to by \em buf, - and size \em size. + and size \em size. This sets only the Compression, JPEGInterchangeFormat and JPEGInterchangeFormatLength tags, which is not all the thumbnail @@ -698,7 +698,7 @@ namespace Exiv2 { const_iterator findKey(const ExifKey& key) const; /*! @brief Find the exifdatum with the given \em ifdId and \em idx, - return an iterator to it. + return an iterator to it. This method can be used to uniquely identify a Exifdatum that was created from an IFD or from the makernote (with idx greater than @@ -730,14 +730,14 @@ namespace Exiv2 { @return 0 if successful;<BR> 8 if the Exif data does not contain a thumbnail. */ - int writeThumbnail(const std::string& path) const; + int writeThumbnail(const std::string& path) const; /*! @brief Return the thumbnail image in a %DataBuf. The caller owns the data buffer and %DataBuf ensures that it will be deleted. */ DataBuf copyThumbnail() const; /*! - @brief Return a short string describing the format of the Exif + @brief Return a short string describing the format of the Exif thumbnail ("TIFF", "JPEG"). */ const char* thumbnailFormat() const; @@ -766,7 +766,7 @@ namespace Exiv2 { /*! @brief Check if the metadata changed and update the internal IFDs and the MakerNote if the changes are compatible with the existing - data (non-intrusive write support). + data (non-intrusive write support). @return True if only compatible changes were detected in the metadata and the internal IFDs and MakerNote (and thus the data buffer) @@ -787,7 +787,7 @@ namespace Exiv2 { /*! @brief Write the Exif data to a data buffer the hard way, return the data buffer. The caller owns this data buffer and %DataBuf - ensures that it will be deleted. + ensures that it will be deleted. Rebuilds the Exif data from scratch, using the TIFF header, metadata container and thumbnail. In particular, the internal IFDs and the @@ -817,12 +817,12 @@ namespace Exiv2 { @return A pair of which the first part determines if a match was found and, if true, the second contains an iterator to the entry. */ - std::pair<bool, Entries::const_iterator> + std::pair<bool, Entries::const_iterator> findEntry(IfdId ifdId, int idx) const; //! Return a pointer to the internal IFD identified by its IFD id const Ifd* getIfd(IfdId ifdId) const; - /*! - @brief Check if IFD1, the IFD1 data and thumbnail data are located at + /*! + @brief Check if IFD1, the IFD1 data and thumbnail data are located at the end of the Exif data. Return true, if they are or if there is no thumbnail at all, else return false. */ @@ -833,7 +833,7 @@ namespace Exiv2 { ExifMetadata exifMetadata_; // The pointers below are used only if Exif data is read from a - // raw data buffer + // raw data buffer TiffHeader* pTiffHeader_; //! Pointer to the TIFF header Ifd* pIfd0_; //! Pointer to Ifd0 Ifd* pExifIfd_; //! Pointer to ExifIfd @@ -856,11 +856,11 @@ namespace Exiv2 { // ***************************************************************************** // template, inline and free functions - + template<typename T> Exifdatum& setValue(Exifdatum& exifDatum, const T& value) { - std::auto_ptr<ValueType<T> > v + std::auto_ptr<ValueType<T> > v = std::auto_ptr<ValueType<T> >(new ValueType<T>); v->value_.push_back(value); exifDatum.value_ = v; @@ -874,8 +874,8 @@ namespace Exiv2 { the same key to an IFD. */ void addToIfd(Ifd& ifd, - ExifMetadata::const_iterator begin, - ExifMetadata::const_iterator end, + ExifMetadata::const_iterator begin, + ExifMetadata::const_iterator end, ByteOrder byteOrder); /*! @brief Add the Exifdatum to the IFD. No duplicate checks are performed, @@ -892,7 +892,7 @@ namespace Exiv2 { */ void addToMakerNote(MakerNote* makerNote, ExifMetadata::const_iterator begin, - ExifMetadata::const_iterator end, + ExifMetadata::const_iterator end, ByteOrder byteOrder); /*! @brief Add the Exifdatum to makerNote, encoded in byte order byteOrder. diff --git a/src/plugins/exiv2/exifcomment.cpp b/src/plugins/exiv2/exifcomment.cpp @@ -34,7 +34,7 @@ try { Exiv2::ExifData &exifData = image->exifData(); /* - Exiv2 uses a CommentValue for Exif user comments. The format of the + Exiv2 uses a CommentValue for Exif user comments. The format of the comment string includes an optional charset specification at the beginning: [charset=["]Ascii|Jis|Unicode|Undefined["] ]comment @@ -45,13 +45,13 @@ try { Following are a few examples of valid comments. The last one is written to the file. */ - exifData["Exif.Photo.UserComment"] + exifData["Exif.Photo.UserComment"] = "charset=\"Unicode\" An Unicode Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] + exifData["Exif.Photo.UserComment"] = "charset=\"Undefined\" An undefined Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] + exifData["Exif.Photo.UserComment"] = "Another undefined Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] + exifData["Exif.Photo.UserComment"] = "charset=Ascii An ASCII Exif comment added with Exiv2"; std::cout << "Writing user comment '" diff --git a/src/plugins/exiv2/exiv2extractor.cc b/src/plugins/exiv2/exiv2extractor.cc @@ -4,19 +4,19 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*! @file exiv2extractor.cc - @brief Prototype libextractor plugin for Exif using exiv2 + @brief Prototype libextractor plugin for Exif using exiv2 @version $Rev$ @author Andreas Huggel (ahu) <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> @@ -67,7 +67,7 @@ struct EXTRACTOR_Keywords * addExiv2Tag(const Exiv2::ExifData& exifData, struct EXTRACTOR_Keywords * result) { const char * str; - + Exiv2::ExifKey ek(key); Exiv2::ExifData::const_iterator md = exifData.findKey(ek); if (md != exifData.end()) { @@ -75,12 +75,12 @@ struct EXTRACTOR_Keywords * addExiv2Tag(const Exiv2::ExifData& exifData, str = ccstr.c_str(); while ( (strlen(str) > 0) && isspace(str[0])) str++; if (strlen(str) > 0) - result = addKeyword(type, + result = addKeyword(type, strdup(str), result); } return result; -} +} extern "C" { @@ -88,12 +88,12 @@ extern "C" { static struct EXTRACTOR_Keywords * extract(const char * filename, unsigned char * data, size_t size, - struct EXTRACTOR_Keywords * prev) + struct EXTRACTOR_Keywords * prev) #else struct EXTRACTOR_Keywords * libextractor_exiv2_extract(const char * filename, unsigned char * data, size_t size, - struct EXTRACTOR_Keywords * prev) + struct EXTRACTOR_Keywords * prev) #endif { struct EXTRACTOR_Keywords * result = prev; @@ -107,33 +107,33 @@ extern "C" { if (exifData.empty()) return result; // Camera make - result = addExiv2Tag(exifData, - "Exif.Image.Make", - EXTRACTOR_CAMERA_MAKE, + result = addExiv2Tag(exifData, + "Exif.Image.Make", + EXTRACTOR_CAMERA_MAKE, result); // Camera model - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Image.Model", EXTRACTOR_CAMERA_MODEL, result); // Camera model - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Image.Orientation", EXTRACTOR_ORIENTATION, result); // Image Timestamp - result = addExiv2Tag(exifData, - "Exif.Photo.DateTimeOriginal", + result = addExiv2Tag(exifData, + "Exif.Photo.DateTimeOriginal", EXTRACTOR_DATE, result); // Exposure time // From ExposureTime, failing that, try ShutterSpeedValue struct EXTRACTOR_Keywords * newResult; - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Photo.ExposureTime", EXTRACTOR_EXPOSURE, result); @@ -158,7 +158,7 @@ extern "C" { // Aperture // Get if from FNumber and, failing that, try ApertureValue - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Photo.FNumber", EXTRACTOR_APERTURE, result); @@ -176,31 +176,31 @@ extern "C" { result = newResult; // Exposure bias - result = addExiv2Tag(exifData, - "Exif.Photo.ExposureBiasValue", + result = addExiv2Tag(exifData, + "Exif.Photo.ExposureBiasValue", EXTRACTOR_EXPOSURE_BIAS, result); // Flash - result = addExiv2Tag(exifData, - "Exif.Photo.Flash", + result = addExiv2Tag(exifData, + "Exif.Photo.Flash", EXTRACTOR_FLASH, result); // Flash bias // Todo: Implement this for other cameras - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs2.FlashBias", EXTRACTOR_FLASH_BIAS, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Panasonic.FlashBias", EXTRACTOR_FLASH_BIAS, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Olympus.FlashBias", EXTRACTOR_FLASH_BIAS, result); @@ -209,56 +209,56 @@ extern "C" { // Actual focal length and 35 mm equivalent // Todo: Calculate 35 mm equivalent a la jhead - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Photo.FocalLength", EXTRACTOR_FOCAL_LENGTH, result); - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Photo.FocalLengthIn35mmFilm", EXTRACTOR_FOCAL_LENGTH_35MM, result); // ISO speed // from ISOSpeedRatings or the Makernote - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Photo.ISOSpeedRatings", EXTRACTOR_ISO_SPEED, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs1.ISOSpeed", EXTRACTOR_ISO_SPEED, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon1.ISOSpeed", EXTRACTOR_ISO_SPEED, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon2.ISOSpeed", EXTRACTOR_ISO_SPEED, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon3.ISOSpeed", EXTRACTOR_ISO_SPEED, result); } result = newResult; - // Exposure mode + // Exposure mode // From ExposureProgram or Canon Makernote - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Photo.ExposureProgram", EXTRACTOR_EXPOSURE_MODE, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs1.ExposureProgram", EXTRACTOR_EXPOSURE_MODE, result); @@ -266,31 +266,31 @@ extern "C" { result = newResult; // Metering mode - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Photo.MeteringMode", EXTRACTOR_METERING_MODE, result); // Macro mode // Todo: Implement this for other cameras - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs1.Macro", EXTRACTOR_MACRO_MODE, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Fujifilm.Macro", EXTRACTOR_MACRO_MODE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Olympus.Macro", EXTRACTOR_MACRO_MODE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Panasonic.Macro", EXTRACTOR_MACRO_MODE, result); @@ -299,48 +299,48 @@ extern "C" { // Image quality setting (compression) // Todo: Implement this for other cameras - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs1.Quality", EXTRACTOR_IMAGE_QUALITY, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Fujifilm.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Sigma.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon1.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon2.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon3.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Olympus.Quality", EXTRACTOR_IMAGE_QUALITY, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Panasonic.Quality", EXTRACTOR_IMAGE_QUALITY, result); @@ -365,48 +365,48 @@ extern "C" { // White balance // Todo: Implement this for other cameras - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.CanonCs2.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Fujifilm.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Sigma.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon1.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon2.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Nikon3.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Olympus.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); } if (newResult == result) { - newResult = addExiv2Tag(exifData, + newResult = addExiv2Tag(exifData, "Exif.Panasonic.WhiteBalance", EXTRACTOR_WHITE_BALANCE, result); @@ -414,13 +414,13 @@ extern "C" { result = newResult; // Copyright - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Image.Copyright", EXTRACTOR_COPYRIGHT, result); // Exif Comment - result = addExiv2Tag(exifData, + result = addExiv2Tag(exifData, "Exif.Photo.UserComment", EXTRACTOR_COMMENT, result); @@ -437,14 +437,14 @@ extern "C" { #if WORKAROUND_905 - + struct X { unsigned char * data; size_t size; struct EXTRACTOR_Keywords * prev; }; - - + + static void * run(void * arg) { struct X * x = (struct X*) arg; return extract(NULL, x->data, x->size, x->prev); @@ -453,7 +453,7 @@ extern "C" { struct EXTRACTOR_Keywords * libextractor_exiv2_extract(const char * filename, unsigned char * data, size_t size, - struct EXTRACTOR_Keywords * prev) { + struct EXTRACTOR_Keywords * prev) { pthread_t pt; struct X cls; void * ret; diff --git a/src/plugins/exiv2/fujimn.cpp b/src/plugins/exiv2/fujimn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -25,7 +25,7 @@ History: 18-Feb-04, ahu: created 07-Mar-04, ahu: isolated as a separate component Credits: Fujifilm MakerNote implemented according to the specification - in "Appendix 4: Makernote of Fujifilm" of the document + in "Appendix 4: Makernote of Fujifilm" of the document "Exif file format" by TsuruZoh Tachibanaya <http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html> */ @@ -104,7 +104,7 @@ namespace Exiv2 { } int FujiMakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 12) return 1; @@ -122,7 +122,7 @@ namespace Exiv2 { int rc = 0; // Check the FUJIFILM prefix if ( header_.size_ < 12 - || std::string(reinterpret_cast<char*>(header_.pData_), 8) + || std::string(reinterpret_cast<char*>(header_.pData_), 8) != std::string("FUJIFILM", 8)) { rc = 2; } @@ -134,7 +134,7 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - FujiMakerNote* FujiMakerNote::create_(bool alloc) const + FujiMakerNote* FujiMakerNote::create_(bool alloc) const { AutoPtr makerNote = AutoPtr(new FujiMakerNote(alloc)); assert(makerNote.get() != 0); @@ -147,7 +147,7 @@ namespace Exiv2 { return AutoPtr(clone_()); } - FujiMakerNote* FujiMakerNote::clone_() const + FujiMakerNote* FujiMakerNote::clone_() const { return new FujiMakerNote(*this); } @@ -163,7 +163,7 @@ namespace Exiv2 { return os; } - std::ostream& FujiMakerNote::print0x1001(std::ostream& os, + std::ostream& FujiMakerNote::print0x1001(std::ostream& os, const Value& value) { switch (value.toLong()) { @@ -173,7 +173,7 @@ namespace Exiv2 { case 4: // fallthrough case 5: os << "Hard"; break; default: os << "(" << value << ")"; break; - } + } return os; } @@ -206,7 +206,7 @@ namespace Exiv2 { return os; } - std::ostream& FujiMakerNote::print0x1004(std::ostream& os, + std::ostream& FujiMakerNote::print0x1004(std::ostream& os, const Value& value) { switch (value.toLong()) { @@ -218,7 +218,7 @@ namespace Exiv2 { return os; } - std::ostream& FujiMakerNote::print0x1010(std::ostream& os, + std::ostream& FujiMakerNote::print0x1010(std::ostream& os, const Value& value) { switch (value.toLong()) { @@ -264,9 +264,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createFujiMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new FujiMakerNote(alloc)); diff --git a/src/plugins/exiv2/fujimn.hpp b/src/plugins/exiv2/fujimn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -21,7 +21,7 @@ /*! @file fujimn.hpp @brief Fujifilm MakerNote implemented according to the specification - in Appendix 4: Makernote of Fujifilm of the document + in Appendix 4: Makernote of Fujifilm of the document <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html"> Exif file format</a> by TsuruZoh Tachibanaya @version $Rev: 569 $ @@ -59,27 +59,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createFujiMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -105,8 +105,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -118,7 +118,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Fujifilm %MakerNote tags + //! @name Print functions for Fujifilm %MakerNote tags //@{ //! Print Off or On status static std::ostream& printOffOn(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/futils.cpp b/src/plugins/exiv2/futils.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -70,7 +70,7 @@ namespace Exiv2 { std::string strError() { int error = errno; - std::ostringstream os; + std::ostringstream os; os << strerror(error) << " (" << error << ")"; return os.str(); } // strError diff --git a/src/plugins/exiv2/futils.hpp b/src/plugins/exiv2/futils.hpp @@ -1,19 +1,19 @@ // ********************************************************* -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -44,19 +44,19 @@ namespace Exiv2 { /*! @brief Test if a file exists. - + @param path Name of file to verify. @param ct Flag to check if <i>path</i> is a regular file. @return true if <i>path</i> exists and, if <i>ct</i> is set, is a regular file, else false. - + @note The function calls <b>stat()</b> test for <i>path</i> - and its type, see stat(2). <b>errno</b> is left unchanged + and its type, see stat(2). <b>errno</b> is left unchanged in case of an error. */ bool fileExists(const std::string& path, bool ct =false); /*! - @brief Return a system error message and the error code (errno). + @brief Return a system error message and the error code (errno). See %strerror(3). */ std::string strError(); diff --git a/src/plugins/exiv2/ifd.cpp b/src/plugins/exiv2/ifd.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -50,7 +50,7 @@ EXIV2_RCSID("@(#) $Id: ifd.cpp 600 2005-07-09 10:38:09Z ahuggel $"); namespace Exiv2 { Entry::Entry(bool alloc) - : alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0), + : alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0), tag_(0), type_(0), count_(0), offset_(0), size_(0), pData_(0), sizeDataArea_(0), pDataArea_(0) { @@ -66,7 +66,7 @@ namespace Exiv2 { Entry::Entry(const Entry& rhs) : alloc_(rhs.alloc_), ifdId_(rhs.ifdId_), idx_(rhs.idx_), - tag_(rhs.tag_), type_(rhs.type_), + tag_(rhs.tag_), type_(rhs.type_), count_(rhs.count_), offset_(rhs.offset_), size_(rhs.size_), pData_(0), sizeDataArea_(rhs.sizeDataArea_), pDataArea_(0) { @@ -201,7 +201,7 @@ namespace Exiv2 { break; } case unsignedLong: { - ul2Data(buf, getULong(buf, byteOrder) + offset, byteOrder); + ul2Data(buf, getULong(buf, byteOrder) + offset, byteOrder); break; } case unsignedRational: { @@ -253,7 +253,7 @@ namespace Exiv2 { } // Entry::component Ifd::Ifd(IfdId ifdId) - : alloc_(true), ifdId_(ifdId), pBase_(0), offset_(0), + : alloc_(true), ifdId_(ifdId), pBase_(0), offset_(0), dataOffset_(0), hasNext_(true), pNext_(0), next_(0) { pNext_ = new byte[4]; @@ -261,7 +261,7 @@ namespace Exiv2 { } Ifd::Ifd(IfdId ifdId, long offset) - : alloc_(true), ifdId_(ifdId), pBase_(0), offset_(offset), + : alloc_(true), ifdId_(ifdId), pBase_(0), offset_(offset), dataOffset_(0), hasNext_(true), pNext_(0), next_(0) { pNext_ = new byte[4]; @@ -269,7 +269,7 @@ namespace Exiv2 { } Ifd::Ifd(IfdId ifdId, long offset, bool alloc, bool hasNext) - : alloc_(alloc), ifdId_(ifdId), pBase_(0), offset_(offset), + : alloc_(alloc), ifdId_(ifdId), pBase_(0), offset_(offset), dataOffset_(0), hasNext_(hasNext), pNext_(0), next_(0) { if (alloc_ && hasNext_) { @@ -286,13 +286,13 @@ namespace Exiv2 { Ifd::Ifd(const Ifd& rhs) : alloc_(rhs.alloc_), entries_(rhs.entries_), ifdId_(rhs.ifdId_), - pBase_(rhs.pBase_), offset_(rhs.offset_), dataOffset_(rhs.dataOffset_), + pBase_(rhs.pBase_), offset_(rhs.offset_), dataOffset_(rhs.dataOffset_), hasNext_(rhs.hasNext_), pNext_(rhs.pNext_), next_(rhs.next_) { if (alloc_ && hasNext_) { pNext_ = new byte[4]; memset(pNext_, 0x0, 4); - if (rhs.pNext_) memcpy(pNext_, rhs.pNext_, 4); + if (rhs.pNext_) memcpy(pNext_, rhs.pNext_, 4); } } @@ -314,7 +314,7 @@ namespace Exiv2 { for (int i = 0; i < n; ++i) { if (len < o + 12) { #ifndef SUPPRESS_WARNINGS - std::cerr << "Error: " << ExifTags::ifdName(ifdId_) + std::cerr << "Error: " << ExifTags::ifdName(ifdId_) << " entry " << i << " lies outside of the IFD memory buffer.\n"; #endif @@ -335,7 +335,7 @@ namespace Exiv2 { if (rc == 0 && hasNext_) { if (len < o + 4) { #ifndef SUPPRESS_WARNINGS - std::cerr << "Error: " << ExifTags::ifdName(ifdId_) + std::cerr << "Error: " << ExifTags::ifdName(ifdId_) << " memory of the pointer to the next IFD" << " lies outside of the IFD memory buffer.\n"; #endif @@ -365,18 +365,18 @@ namespace Exiv2 { if (i->size_ > 4) { if (offset_ == 0) { // Set the 'guessed' IFD offset - offset_ = i->offset_ - - (2 + 12 * static_cast<long>(preEntries.size()) + offset_ = i->offset_ + - (2 + 12 * static_cast<long>(preEntries.size()) + (hasNext_ ? 4 : 0)); } // Set the offset of the first data entry outside of the IFD if (i->offset_ - offset_ >= len) { #ifndef SUPPRESS_WARNINGS - std::cerr << "Error: Offset of the 1st data entry of " - << ExifTags::ifdName(ifdId_) + std::cerr << "Error: Offset of the 1st data entry of " + << ExifTags::ifdName(ifdId_) << " is out of bounds:\n" - << " Offset = 0x" << std::setw(8) - << std::setfill('0') << std::hex + << " Offset = 0x" << std::setw(8) + << std::setfill('0') << std::hex << i->offset_ - offset_ << ", exceeds buffer size by " << std::dec << i->offset_ - len @@ -402,18 +402,18 @@ namespace Exiv2 { e.setIfdId(ifdId_); e.setIdx(++idx); e.setTag(i->tag_); - long tmpOffset = + long tmpOffset = i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_; if (tmpOffset + i->size_ > len) { #ifndef SUPPRESS_WARNINGS - std::cerr << "Warning: Upper boundary of data for " - << ExifTags::ifdName(ifdId_) - << " entry " << static_cast<int>(i - begin) + std::cerr << "Warning: Upper boundary of data for " + << ExifTags::ifdName(ifdId_) + << " entry " << static_cast<int>(i - begin) << " is out of bounds:\n" - << " Offset = 0x" << std::setw(8) - << std::setfill('0') << std::hex + << " Offset = 0x" << std::setw(8) + << std::setfill('0') << std::hex << tmpOffset - << ", size = " << std::dec << i->size_ + << ", size = " << std::dec << i->size_ << ", exceeds buffer size by " << tmpOffset + i->size_ - len << " Bytes; Truncating the data.\n"; @@ -426,7 +426,7 @@ namespace Exiv2 { // Set the offset to the data, relative to start of IFD e.setOffset(tmpOffset); // Set the size to at least for bytes to accomodate offset-data - e.setValue(i->type_, i->count_, buf + e.offset(), + e.setValue(i->type_, i->count_, buf + e.offset(), std::max(long(4), i->size_)); this->add(e); } @@ -437,7 +437,7 @@ namespace Exiv2 { return rc; } // Ifd::read - Ifd::const_iterator Ifd::findIdx(int idx) const + Ifd::const_iterator Ifd::findIdx(int idx) const { return std::find_if(entries_.begin(), entries_.end(), FindEntryByIdx(idx)); @@ -449,7 +449,7 @@ namespace Exiv2 { FindEntryByIdx(idx)); } - Ifd::const_iterator Ifd::findTag(uint16_t tag) const + Ifd::const_iterator Ifd::findTag(uint16_t tag) const { return std::find_if(entries_.begin(), entries_.end(), FindEntryByTag(tag)); @@ -509,7 +509,7 @@ namespace Exiv2 { us2Data(buf + o, i->tag(), byteOrder); us2Data(buf + o + 2, i->type(), byteOrder); ul2Data(buf + o + 4, i->count(), byteOrder); - if (i->sizeDataArea() > 0) { + if (i->sizeDataArea() > 0) { long dataAreaOffset = offset_+size()+totalDataSize+dataAreaSize; i->setDataAreaOffsets(dataAreaOffset, byteOrder); dataAreaSize += i->sizeDataArea(); @@ -628,7 +628,7 @@ namespace Exiv2 { long Ifd::size() const { if (entries_.size() == 0 && next_ == 0) return 0; - return static_cast<long>(2 + 12 * entries_.size() + (hasNext_ ? 4 : 0)); + return static_cast<long>(2 + 12 * entries_.size() + (hasNext_ ? 4 : 0)); } long Ifd::dataSize() const @@ -647,9 +647,9 @@ namespace Exiv2 { if (entries_.size() == 0) return; // Print a header os << prefix << "IFD Offset: 0x" - << std::setw(8) << std::setfill('0') << std::hex << std::right - << offset_ - << ", IFD Entries: " + << std::setw(8) << std::setfill('0') << std::hex << std::right + << offset_ + << ", IFD Entries: " << std::setfill(' ') << std::dec << std::right << static_cast<unsigned int>(entries_.size()) << "\n" << prefix << "Entry Tag Format (Bytes each) Number Offset\n" @@ -673,10 +673,10 @@ namespace Exiv2 { } os << prefix << std::setw(5) << std::setfill(' ') << std::dec << std::right << static_cast<int>(i - b) - << " 0x" << std::setw(4) << std::setfill('0') << std::hex + << " 0x" << std::setw(4) << std::setfill('0') << std::hex << std::right << i->tag() - << " " << std::setw(17) << std::setfill(' ') - << std::left << i->typeName() + << " " << std::setw(17) << std::setfill(' ') + << std::left << i->typeName() << " (" << std::dec << i->typeSize() << ")" << " " << std::setw(6) << std::setfill(' ') << std::dec << std::right << i->count() @@ -684,11 +684,11 @@ namespace Exiv2 { << "\n"; } if (hasNext_) { - os << prefix << "Next IFD: 0x" + os << prefix << "Next IFD: 0x" << std::setw(8) << std::setfill('0') << std::hex << std::right << next() << "\n"; } - // Print data of IFD entries + // Print data of IFD entries for (i = b; i != e; ++i) { if (i->size() > 4) { os << "Data of entry " << static_cast<int>(i - b) << ":\n"; diff --git a/src/plugins/exiv2/ifd.hpp b/src/plugins/exiv2/ifd.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -60,11 +60,11 @@ namespace Exiv2 { //! @name Creators //@{ /*! - @brief Default constructor. The entry allocates memory for its + @brief Default constructor. The entry allocates memory for its data if alloc is true (the default), otherwise it remembers just the pointers into a read and writeable data buffer which it doesn't allocate or delete. - */ + */ explicit Entry(bool alloc =true); //! Destructor ~Entry(); @@ -87,13 +87,13 @@ namespace Exiv2 { /*! @brief Set the value of the entry to a single unsigned long component, i.e., set the type of the entry to unsigned long, number of - components to one and the value according to the data provided. + components to one and the value according to the data provided. The size of the data buffer is set to at least four bytes, but is left unchanged if it can accomodate the pointer. This method can be used to set the value of a tag which contains a pointer (offset) to a location in the Exif data (like e.g., ExifTag, 0x8769 in IFD0, which - contains a pointer to the Exif IFD). + contains a pointer to the Exif IFD). <BR>This method cannot be used to set the value of a newly created %Entry in non-alloc mode. @@ -110,9 +110,9 @@ namespace Exiv2 { copied, i.e., the buffer must remain valid throughout the life of the %Entry. Subsequent calls in non-alloc mode will overwrite the data pointed to by this pointer with the data provided, i.e., the buffer - provided in subsequent calls can be deleted after the call. + provided in subsequent calls can be deleted after the call. <BR>In either memory allocation mode, the data buffer provided must be - large enough to hold count components of type. The size of the buffer + large enough to hold count components of type. The size of the buffer will be as indicated in the size argument. I.e., it is possible to allocate (set) a data buffer larger than required to hold count components of the given type. @@ -121,14 +121,14 @@ namespace Exiv2 { @param count Number of components in the buffer. @param data Pointer to the data buffer. @param size Size of the desired data buffer in bytes. - @throw Error if no memory allocation is allowed - and the size of the data buffer is larger than the existing + @throw Error if no memory allocation is allowed + and the size of the data buffer is larger than the existing data buffer of the entry or if size is not large enough to hold count components of the given type. */ void setValue(uint16_t type, uint32_t count, const byte* data, long size); /*! - @brief Set the data area. Memory management as for + @brief Set the data area. Memory management as for setValue(uint16_t, uint32_t, const byte*, long) For certain tags the regular value of an IFD entry is an offset to a @@ -136,36 +136,36 @@ namespace Exiv2 { (Exif.Image.ExifTag) or tag 0x0201 in IFD1 (Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points to a data area containing the Exif IFD. That of JPEGInterchangeFormat - contains the JPEG thumbnail image. + contains the JPEG thumbnail image. This method sets the data area of a tag in accordance with the memory allocation mode. @param buf Pointer to the data area. @param len Size of the data area. - - @throw Error in non-alloc mode, if there already is a dataarea but the - size of the existing dataarea is not large enough for the + + @throw Error in non-alloc mode, if there already is a dataarea but the + size of the existing dataarea is not large enough for the new buffer. */ void setDataArea(const byte* buf, long len); /*! - @brief Set the offset(s) to the data area of an entry. + @brief Set the offset(s) to the data area of an entry. Add @em offset to each data component of the entry. This is used by Ifd::copy to convert the data components of an entry containing offsets relative to the data area to become offsets from the start of - the TIFF header. Usually, entries with a data area have exactly one + the TIFF header. Usually, entries with a data area have exactly one unsigned long data component, which is 0. - @param offset Offset + @param offset Offset @param byteOrder Byte order - @throw Error if the offset is out of range for the data type of the + @throw Error if the offset is out of range for the data type of the tag or the data type is not supported. */ void setDataAreaOffsets(uint32_t offset, ByteOrder byteOrder); /*! - @brief Update the base pointer of the Entry from \em pOldBase + @brief Update the base pointer of the Entry from \em pOldBase to \em pNewBase. Allows to re-locate the underlying data buffer to a new location @@ -184,7 +184,7 @@ namespace Exiv2 { //! Return the type id. uint16_t type() const { return type_; } //! Return the name of the type - const char* typeName() const + const char* typeName() const { return TypeInfo::typeName(TypeId(type_)); } //! Return the size in bytes of one element of this type long typeSize() const @@ -209,7 +209,7 @@ namespace Exiv2 { */ const byte* data() const { return pData_; } /*! - @brief Return a pointer to the n-th component, 0 if there is no + @brief Return a pointer to the n-th component, 0 if there is no n-th component. Do not attempt to write to this pointer. */ const byte* component(uint32_t n) const; @@ -227,7 +227,7 @@ namespace Exiv2 { (Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points to a data area containing the Exif IFD. That of JPEGInterchangeFormat contains the JPEG thumbnail image. - Use this method to access (read-only) the data area of a tag. Use + Use this method to access (read-only) the data area of a tag. Use setDataArea() to write to the data area. @return Return a pointer to the data area. @@ -255,7 +255,7 @@ namespace Exiv2 { //! Offset from the start of the IFD to the data long offset_; /*! - Size of the data buffer holding the value in bytes, there is + Size of the data buffer holding the value in bytes, there is no minimum size. */ long size_; @@ -302,13 +302,13 @@ namespace Exiv2 { private: uint16_t tag_; - + }; // class FindEntryByTag /*! @brief Models an IFD (%Image File Directory) - This class models an IFD as described in the TIFF 6.0 specification. + This class models an IFD as described in the TIFF 6.0 specification. An instance of class %Ifd can operate in two modes, one that allocates and deallocates the memory required to store data, and one that doesn't @@ -322,8 +322,8 @@ namespace Exiv2 { that tag data, which the Exif reader may not understand (e.g., the Makernote) remains valid. A "non-intrusive write operation" is the modification of tag data without increasing the data size. - - @note Use the mode with memory management (the default) if you are unsure + + @note Use the mode with memory management (the default) if you are unsure or if these memory management considerations are of no concern to you. @note The two different modes imply completely different copy and @@ -375,9 +375,9 @@ namespace Exiv2 { /*! @brief Read a complete IFD and its data from a data buffer - @param buf Pointer to the data to decode. The buffer must start with the + @param buf Pointer to the data to decode. The buffer must start with the IFD data (unlike the readSubIfd() method). - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Applicable byte order (little or big endian). @param offset (Optional) offset of the IFD from the start of the TIFF header, if known. If not given, the offset will be guessed @@ -386,8 +386,8 @@ namespace Exiv2 { the IFD. @return 0 if successful;<BR> - 6 if the data buffer is too small, e.g., if an offset points - beyond the provided buffer. The IFD is cleared in this + 6 if the data buffer is too small, e.g., if an offset points + beyond the provided buffer. The IFD is cleared in this case. */ int read(const byte* buf, long len, ByteOrder byteOrder, long offset =0); @@ -438,7 +438,7 @@ namespace Exiv2 { */ void add(const Entry& entry); /*! - @brief Delete the directory entry with the given tag. Return the index + @brief Delete the directory entry with the given tag. Return the index of the deleted entry or 0 if no entry with tag was found. */ int erase(uint16_t tag); @@ -475,22 +475,22 @@ namespace Exiv2 { //! @name Accessors //@{ /*! - @brief Read a sub-IFD from the location pointed to by the directory entry + @brief Read a sub-IFD from the location pointed to by the directory entry with the given tag. @param dest References the destination IFD. - @param buf The data buffer to read from. The buffer must contain all Exif + @param buf The data buffer to read from. The buffer must contain all Exif data starting from the TIFF header (unlike the read() method). - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Applicable byte order (little or big endian). @param tag Tag to look for. @return 0 if successful;<BR> 6 if reading the sub-IFD failed (see read() above) or - the location pointed to by the directory entry with the + the location pointed to by the directory entry with the given tag is outside of the data buffer. - @note It is not considered an error if the tag cannot be found in the + @note It is not considered an error if the tag cannot be found in the IFD. 0 is returned and no action is taken in this case. */ int readSubIfd( @@ -512,7 +512,7 @@ namespace Exiv2 { long offset() const { return offset_; } /*! @brief Get the offset of the first data entry outside of the IFD from - the start of the TIFF header, return 0 if there is none. The + the start of the TIFF header, return 0 if there is none. The data offset is determined when the IFD is read. */ long dataOffset() const { return dataOffset_; } @@ -540,7 +540,7 @@ namespace Exiv2 { //! Helper structure to build IFD entries struct PreEntry { uint16_t tag_; - uint16_t type_; + uint16_t type_; uint32_t count_; long size_; long offsetLoc_; @@ -549,7 +549,7 @@ namespace Exiv2 { //! cmpPreEntriesByOffset needs to know about PreEntry, that's all. friend bool cmpPreEntriesByOffset(const PreEntry&, const PreEntry&); - + //! Container for 'pre-entries' typedef std::vector<PreEntry> PreEntries; @@ -595,7 +595,7 @@ namespace Exiv2 { than those with an offset. */ bool cmpPreEntriesByOffset(const Ifd::PreEntry& lhs, const Ifd::PreEntry& rhs); - + } // namespace Exiv2 #endif // #ifndef IFD_HPP_ diff --git a/src/plugins/exiv2/image.cpp b/src/plugins/exiv2/image.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -95,7 +95,7 @@ namespace Exiv2 { } } - void ImageFactory::registerImage(Image::Type type, + void ImageFactory::registerImage(Image::Type type, NewInstanceFct newInst, IsThisTypeFct isType) { init(); @@ -117,7 +117,7 @@ namespace Exiv2 { Image::Type ImageFactory::getType(BasicIo& io) { - if (io.open() != 0) return Image::none; + if (io.open() != 0) return Image::none; IoCloser closer(io); Image::Type type = Image::none; Registry::const_iterator b = registry_->begin(); @@ -165,7 +165,7 @@ namespace Exiv2 { return image; } // ImageFactory::open - Image::AutoPtr ImageFactory::create(Image::Type type, + Image::AutoPtr ImageFactory::create(Image::Type type, const std::string& path) { std::auto_ptr<FileIo> fileIo(new FileIo(path)); @@ -188,7 +188,7 @@ namespace Exiv2 { return image; } - Image::AutoPtr ImageFactory::create(Image::Type type, + Image::AutoPtr ImageFactory::create(Image::Type type, BasicIo::AutoPtr io) { // BasicIo instance does not need to be open @@ -199,7 +199,7 @@ namespace Exiv2 { return Image::AutoPtr(); } // ImageFactory::create - TiffHeader::TiffHeader(ByteOrder byteOrder) + TiffHeader::TiffHeader(ByteOrder byteOrder) : byteOrder_(byteOrder), tag_(0x002a), offset_(0x00000008) { } diff --git a/src/plugins/exiv2/image.hpp b/src/plugins/exiv2/image.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -24,7 +24,7 @@ @version $Rev: 598 $ @author Andreas Huggel (ahu) <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> - @author Brad Schick (brad) + @author Brad Schick (brad) <a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a> @date 09-Jan-04, ahu: created<BR> 11-Feb-04, ahu: isolated as a component<BR> @@ -60,13 +60,13 @@ namespace Exiv2 { Most client apps will obtain an Image instance by calling a static ImageFactory method. The Image class can then be used to to - read, write, and save metadata. + read, write, and save metadata. */ class Image { public: //! Supported image formats enum Type { none, jpeg, exv }; - + //! Image auto_ptr type typedef std::auto_ptr<Image> AutoPtr; @@ -85,7 +85,7 @@ namespace Exiv2 { */ virtual void readMetadata() =0; /*! - @brief Write metadata back to the image. + @brief Write metadata back to the image. All existing metadata sections in the image are either created, replaced, or erased. If values for a given metadata type have been @@ -93,7 +93,7 @@ namespace Exiv2 { replaced. If no values have been assigned to a given metadata type, any exists section for that metadata type will be removed from the image. - + @throw Error if the operation fails */ virtual void writeMetadata() =0; @@ -147,7 +147,7 @@ namespace Exiv2 { //! @name Accessors //@{ /*! - @brief Check if the Image instance is valid. Use after object + @brief Check if the Image instance is valid. Use after object construction. @return true if the Image is in a valid state. */ @@ -160,7 +160,7 @@ namespace Exiv2 { a previous call to readMetadata() or added directly. The exif data in the returned instance will be written to the image when writeMetadata() is called. - + @return read only ExifData instance containing exif values */ virtual const ExifData& exifData() const =0; @@ -172,7 +172,7 @@ namespace Exiv2 { a previous call to readMetadata() or added directly. The exif data in the returned instance will be written to the image when writeMetadata() is called. - + @return modifiable ExifData instance containing exif values */ virtual ExifData& exifData() =0; @@ -184,7 +184,7 @@ namespace Exiv2 { a previous call to readMetadata() or added directly. The iptc data in the returned instance will be written to the image when writeMetadata() is called. - + @return modifiable IptcData instance containing iptc values */ virtual const IptcData& iptcData() const =0; @@ -196,7 +196,7 @@ namespace Exiv2 { a previous call to readMetadata() or added directly. The iptc data in the returned instance will be written to the image when writeMetadata() is called. - + @return modifiable IptcData instance containing iptc values */ virtual IptcData& iptcData() =0; @@ -206,12 +206,12 @@ namespace Exiv2 { virtual std::string comment() const =0; /*! @brief Return a reference to the BasicIo instance being used for Io. - + This refence is particularly useful to reading the results of operations on a MemIo instance. For example after metadata has been modified and the writeMetadata() method has been called, - this method can be used to get access to the modified image. - + this method can be used to get access to the modified image. + @return BasicIo instance that can be used to read or write image data directly. @note If the returned BasicIo is used to write to the image, the @@ -266,8 +266,8 @@ namespace Exiv2 { @param newInst Function pointer for creating image instances. @param isType Function pointer to test for matching image types. */ - static void registerImage(Image::Type type, - NewInstanceFct newInst, + static void registerImage(Image::Type type, + NewInstanceFct newInst, IsThisTypeFct isType); //@} @@ -276,11 +276,11 @@ namespace Exiv2 { /*! @brief Create an Image subclass of the appropriate type by reading the specified file. %Image type is derived from the file - contents. + contents. @param path %Image file. The contents of the file are tested to determine the image type. File extension is ignored. - @return An auto-pointer that owns an Image instance whose type - matches that of the file. + @return An auto-pointer that owns an Image instance whose type + matches that of the file. @throw Error If opening the file fails or it contains data of an unknown image type. */ @@ -288,11 +288,11 @@ namespace Exiv2 { /*! @brief Create an Image subclass of the appropriate type by reading the provided memory. %Image type is derived from the memory - contents. + contents. @param data Pointer to a data buffer containing an image. The contents of the memory are tested to determine the image type. @param size Number of bytes pointed to by \em data. - @return An auto-pointer that owns an Image instance whose type + @return An auto-pointer that owns an Image instance whose type matches that of the data buffer. @throw Error If the memory contains data of an unknown image type. */ @@ -301,15 +301,15 @@ namespace Exiv2 { @brief Create an Image subclass of the appropriate type by reading the provided BasicIo instance. %Image type is derived from the data provided by \em io. The passed in \em io instance is - (re)opened by this method. + (re)opened by this method. @param io An auto-pointer that owns a BasicIo instance that provides image data. The contents of the image data are tested to determine - the type. + the type. @note This method takes ownership of the passed in BasicIo instance through the auto-pointer. Callers should not continue to use the BasicIo instance after it is passed to this method. Use the Image::io() method to get a temporary reference. - @return An auto-pointer that owns an Image instance whose type + @return An auto-pointer that owns an Image instance whose type matches that of the \em io data. If no image type could be determined, the pointer is 0. @throw Error If opening the BasicIo fails @@ -321,7 +321,7 @@ namespace Exiv2 { @param type Type of the image to be created. @param path %Image file to create. File extension is ignored. @return An auto-pointer that owns an Image instance of the requested - type. + type. @throw Error If the image type is not supported. */ static Image::AutoPtr create(Image::Type type, const std::string& path); @@ -330,7 +330,7 @@ namespace Exiv2 { new image in memory. @param type Type of the image to be created. @return An auto-pointer that owns an Image instance of the requested - type. + type. @throw Error If the image type is not supported */ static Image::AutoPtr create(Image::Type type); @@ -340,24 +340,24 @@ namespace Exiv2 { contains data, it will be overwritten. @param type Type of the image to be created. @param io An auto-pointer that owns a BasicIo instance that will - be written to when creating a new image. + be written to when creating a new image. @note This method takes ownership of the passed in BasicIo instance - through the auto-pointer. Callers should not continue to use the - BasicIo instance after it is passed to this method. Use the + through the auto-pointer. Callers should not continue to use the + BasicIo instance after it is passed to this method. Use the Image::io() method to get a temporary reference. @return An auto-pointer that owns an Image instance of the requested type. If the image type is not supported, the pointer is 0. */ static Image::AutoPtr create(Image::Type type, BasicIo::AutoPtr io); /*! - @brief Returns the image type of the provided file. + @brief Returns the image type of the provided file. @param path %Image file. The contents of the file are tested to determine the image type. File extension is ignored. @return %Image type or Image::none if the type is not recognized. */ static Image::Type getType(const std::string& path); /*! - @brief Returns the image type of the provided data buffer. + @brief Returns the image type of the provided data buffer. @param data Pointer to a data buffer containing an image. The contents of the memory are tested to determine the image type. @param size Number of bytes pointed to by \em data. @@ -375,7 +375,7 @@ namespace Exiv2 { //@} /*! - @brief Class Init is used to execute initialisation and termination + @brief Class Init is used to execute initialisation and termination code exactly once, at the begin and end of the program. See Bjarne Stroustrup, 'The C++ Programming Language 3rd @@ -385,7 +385,7 @@ namespace Exiv2 { static int count; //!< Counts calls to constructor public: //! @name Creators - //@{ + //@{ //! Perform one-time initialisations. Init(); //! Perform one-time cleanup operations. @@ -409,7 +409,7 @@ namespace Exiv2 { { NewInstanceFct newInstance; IsThisTypeFct isThisType; - ImageFcts(NewInstanceFct newInst, IsThisTypeFct isType) + ImageFcts(NewInstanceFct newInst, IsThisTypeFct isType) : newInstance(newInst), isThisType(isType) {} ImageFcts() : newInstance(0), isThisType(0) {} }; @@ -428,7 +428,7 @@ namespace Exiv2 { //! @name Creators //@{ /*! - @brief Default constructor. Optionally sets the byte order + @brief Default constructor. Optionally sets the byte order (default: little endian). */ explicit TiffHeader(ByteOrder byteOrder =littleEndian); @@ -442,7 +442,7 @@ namespace Exiv2 { //! @name Accessors //@{ - /*! + /*! @brief Write a standard TIFF header into buf as a data string, return number of bytes copied. @@ -463,7 +463,7 @@ namespace Exiv2 { uint16_t tag() const { return tag_; } /*! @brief Return the offset to IFD0 from the start of the TIFF header. - The offset is 0x00000008 if IFD0 begins immediately after the + The offset is 0x00000008 if IFD0 begins immediately after the TIFF header. */ uint32_t offset() const { return offset_; } @@ -474,7 +474,7 @@ namespace Exiv2 { uint16_t tag_; uint32_t offset_; - }; // class TiffHeader + }; // class TiffHeader } // namespace Exiv2 diff --git a/src/plugins/exiv2/iptc.cpp b/src/plugins/exiv2/iptc.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -45,7 +45,7 @@ EXIV2_RCSID("@(#) $Id: iptc.cpp 600 2005-07-09 10:38:09Z ahuggel $"); // class member definitions namespace Exiv2 { - Iptcdatum::Iptcdatum(const IptcKey& key, + Iptcdatum::Iptcdatum(const IptcKey& key, const Value* pValue) : key_(key.clone()) { @@ -66,7 +66,7 @@ namespace Exiv2 { const Value& Iptcdatum::value() const { if (value_.get() == 0) throw Error(8); - return *value_; + return *value_; } Iptcdatum& Iptcdatum::operator=(const Iptcdatum& rhs) @@ -82,7 +82,7 @@ namespace Exiv2 { return *this; } // Iptcdatum::operator= - + Iptcdatum& Iptcdatum::operator=(const uint16_t& value) { UShortValue::AutoPtr v = UShortValue::AutoPtr(new UShortValue); @@ -146,7 +146,7 @@ namespace Exiv2 { if (*pRead++ != marker_) return 5; record = *pRead++; dataSet = *pRead++; - + extTest = *pRead; if (extTest & 0x80) { // extended dataset @@ -171,7 +171,7 @@ namespace Exiv2 { return rc; } // IptcData::read - int IptcData::readData(uint16_t dataSet, uint16_t record, + int IptcData::readData(uint16_t dataSet, uint16_t record, const byte* data, uint32_t sizeData) { Value::AutoPtr value; @@ -243,7 +243,7 @@ namespace Exiv2 { int IptcData::add(const Iptcdatum& iptcDatum) { if (!IptcDataSets::dataSetRepeatable( - iptcDatum.tag(), iptcDatum.record()) && + iptcDatum.tag(), iptcDatum.record()) && findId(iptcDatum.tag(), iptcDatum.record()) != end()) { return 6; } diff --git a/src/plugins/exiv2/iptc.hpp b/src/plugins/exiv2/iptc.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,7 +22,7 @@ @file iptc.hpp @brief Encoding and decoding of Iptc data @version $Rev: 599 $ - @author Brad Schick (brad) + @author Brad Schick (brad) <a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a> @date 31-Jul-04, brad: created */ @@ -49,7 +49,7 @@ namespace Exiv2 { // class definitions /*! - @brief Information related to one Iptc dataset. An Iptc metadatum consists + @brief Information related to one Iptc dataset. An Iptc metadatum consists of an IptcKey and a Value and provides methods to manipulate these. */ class Iptcdatum : public Metadatum { @@ -68,7 +68,7 @@ namespace Exiv2 { @throw Error if the key cannot be parsed and converted to a tag number and record id. */ - explicit Iptcdatum(const IptcKey& key, + explicit Iptcdatum(const IptcKey& key, const Value* pValue =0); //! Copy constructor Iptcdatum(const Iptcdatum& rhs); @@ -86,7 +86,7 @@ namespace Exiv2 { */ Iptcdatum& operator=(const uint16_t& value); /*! - @brief Assign \em value to the %Iptcdatum. + @brief Assign \em value to the %Iptcdatum. Calls setValue(const std::string&). */ Iptcdatum& operator=(const std::string& value); @@ -101,11 +101,11 @@ namespace Exiv2 { */ void setValue(const Value* pValue); /*! - @brief Set the value to the string \em value, using - Value::read(const std::string&). + @brief Set the value to the string \em value, using + Value::read(const std::string&). If the %Iptcdatum does not have a Value yet, then a %Value of the correct type for this %Iptcdatum is created. If that - fails (because of an unknown dataset), a StringValue is + fails (because of an unknown dataset), a StringValue is created. */ void setValue(const std::string& value); @@ -124,7 +124,7 @@ namespace Exiv2 { @param byteOrder Applicable byte order (little or big endian). @return Number of characters written. */ - long copy(byte* buf, ByteOrder byteOrder) const + long copy(byte* buf, ByteOrder byteOrder) const { return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); } /*! @brief Return the key of the Iptcdatum. The key is of the form @@ -140,10 +140,10 @@ namespace Exiv2 { std::string recordName() const { return key_.get() == 0 ? "" : key_->recordName(); } /*! - @brief Return the record id + @brief Return the record id @return record id */ - uint16_t record() const + uint16_t record() const { return key_.get() == 0 ? 0 : key_->record(); } /*! @brief Return the name of the tag (aka dataset) @@ -155,7 +155,7 @@ namespace Exiv2 { uint16_t tag() const { return key_.get() == 0 ? 0 : key_->tag(); } //! Return the type id of the value - TypeId typeId() const + TypeId typeId() const { return value_.get() == 0 ? invalidTypeId : value_->typeId(); } //! Return the name of the type const char* typeName() const { return TypeInfo::typeName(typeId()); } @@ -166,7 +166,7 @@ namespace Exiv2 { //! Return the size of the value in bytes long size() const { return value_.get() == 0 ? 0 : value_->size(); } //! Return the value as a string. - std::string toString() const + std::string toString() const { return value_.get() == 0 ? "" : value_->toString(); } /*! @brief Return the n-th component of the value converted to long. The @@ -174,7 +174,7 @@ namespace Exiv2 { the behaviour of the method is undefined if there is no n-th component. */ - long toLong(long n =0) const + long toLong(long n =0) const { return value_.get() == 0 ? -1 : value_->toLong(n); } /*! @brief Return the n-th component of the value converted to float. The @@ -182,7 +182,7 @@ namespace Exiv2 { the behaviour of the method is undefined if there is no n-th component. */ - float toFloat(long n =0) const + float toFloat(long n =0) const { return value_.get() == 0 ? -1 : value_->toFloat(n); } /*! @brief Return the n-th component of the value converted to @@ -190,30 +190,30 @@ namespace Exiv2 { Iptcdatum is not set and the behaviour of the method is undefined if there is no n-th component. */ - Rational toRational(long n =0) const + Rational toRational(long n =0) const { return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); } /*! @brief Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-pointer ensures that it will be deleted. - This method is provided for users who need full control over the + This method is provided for users who need full control over the value. A caller may, e.g., downcast the pointer to the appropriate subclass of Value to make use of the interface of the subclass to set or modify its contents. - + @return An auto-pointer to a copy (clone) of the value, 0 if the value is not set. */ - Value::AutoPtr getValue() const + Value::AutoPtr getValue() const { return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); } /*! - @brief Return a constant reference to the value. + @brief Return a constant reference to the value. This method is provided mostly for convenient and versatile output of the value which can (to some extent) be formatted through standard stream manipulators. Do not attempt to write to the value through - this reference. + this reference. <b>Example:</b> <br> @code @@ -261,17 +261,17 @@ namespace Exiv2 { private: uint16_t dataset_; uint16_t record_; - + }; // class FindMetadatumById /*! - @brief A container for Iptc data. This is a top-level class of + @brief A container for Iptc data. This is a top-level class of the %Exiv2 library. Provide high-level access to the Iptc data of an image: - read Iptc information from JPEG files - access metadata through keys and standard C++ iterators - - add, modify and delete metadata + - add, modify and delete metadata - write Iptc data to JPEG files - extract Iptc metadata to files, insert from these files */ @@ -290,7 +290,7 @@ namespace Exiv2 { @brief Load the Iptc data from a byte buffer. The format must follow the IPTC IIM4 standard. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @return 0 if successful;<BR> 5 if Iptc data is invalid or corrupt;<BR> */ @@ -319,7 +319,7 @@ namespace Exiv2 { 6 if the dataset already exists and is not repeatable */ int add(const IptcKey& key, Value* value); - /*! + /*! @brief Add a copy of the Iptcdatum to the Iptc metadata. A check for non-repeatable datasets is performed. @return 0 if successful;<BR> @@ -327,9 +327,9 @@ namespace Exiv2 { */ int add(const Iptcdatum& iptcdatum); /*! - @brief Delete the Iptcdatum at iterator position pos, return the + @brief Delete the Iptcdatum at iterator position pos, return the position of the next Iptcdatum. Note that iterators into - the metadata, including pos, are potentially invalidated + the metadata, including pos, are potentially invalidated by this call. */ iterator erase(iterator pos); @@ -347,17 +347,17 @@ namespace Exiv2 { iterator end() { return iptcMetadata_.end(); } /*! @brief Find a Iptcdatum with the given key, return an iterator to it. - If multiple entries with the same key exist, it is undefined + If multiple entries with the same key exist, it is undefined which of the matching metadata is found. */ iterator findKey(const IptcKey& key); /*! - @brief Find a Iptcdatum with the given record and dataset it, + @brief Find a Iptcdatum with the given record and dataset it, return a const iterator to it. If multiple entries with the same Ids exists, it is undefined which of the matching metadata is found. */ - iterator findId(uint16_t dataset, + iterator findId(uint16_t dataset, uint16_t record = IptcDataSets::application2); //@} @@ -374,12 +374,12 @@ namespace Exiv2 { */ const_iterator findKey(const IptcKey& key) const; /*! - @brief Find a Iptcdatum with the given record and dataset number, + @brief Find a Iptcdatum with the given record and dataset number, return a const iterator to it. If multiple metadata with the same Ids exist it is undefined which of the matching metadata is found. */ - const_iterator findId(uint16_t dataset, + const_iterator findId(uint16_t dataset, uint16_t record = IptcDataSets::application2) const; //! Return true if there is no Iptc metadata bool empty() const { return count() == 0; } @@ -400,12 +400,12 @@ namespace Exiv2 { @param sizeData Length in bytes of dataset payload @return 0 if successful. */ - int readData(uint16_t dataSet, uint16_t record, + int readData(uint16_t dataSet, uint16_t record, const byte* data, uint32_t sizeData); // Constant data static const byte marker_; // Dataset marker - + // DATA IptcMetadata iptcMetadata_; }; // class IptcData diff --git a/src/plugins/exiv2/jpgimage.cpp b/src/plugins/exiv2/jpgimage.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -24,7 +24,7 @@ Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Brad Schick (brad) <brad@robotbattle.com> History: 15-Jan-05, brad: split out from image.cpp - + */ // ***************************************************************************** #include "rcsid.hpp" @@ -51,10 +51,10 @@ EXIV2_RCSID("@(#) $Id: jpgimage.cpp 563 2005-04-21 07:21:53Z ahuggel $"); namespace Exiv2 { // Local functions. These could be static private functions on Image - // subclasses but then ImageFactory needs to be made a friend. + // subclasses but then ImageFactory needs to be made a friend. /*! - @brief Create a new ExvImage instance and return an auto-pointer to it. - Caller owns the returned object and the auto-pointer ensures that + @brief Create a new ExvImage instance and return an auto-pointer to it. + Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create); @@ -62,13 +62,13 @@ namespace Exiv2 { bool isExvType(BasicIo& iIo, bool advance); /*! @brief Create a new JpegImage instance and return an auto-pointer to it. - Caller owns the returned object and the auto-pointer ensures that + Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create); //! Check if the file iIo is a JPEG image. bool isJpegType(BasicIo& iIo, bool advance); - + const byte JpegBase::sos_ = 0xda; const byte JpegBase::eoi_ = 0xd9; const byte JpegBase::app0_ = 0xe0; @@ -81,8 +81,8 @@ namespace Exiv2 { const char JpegBase::ps3Id_[] = "Photoshop 3.0\0"; const char JpegBase::bimId_[] = "8BIM"; - JpegBase::JpegBase(BasicIo::AutoPtr io, bool create, - const byte initData[], long dataSize) + JpegBase::JpegBase(BasicIo::AutoPtr io, bool create, + const byte initData[], long dataSize) : io_(io) { if (create) { @@ -115,7 +115,7 @@ namespace Exiv2 { clearExifData(); clearComment(); } - + void JpegBase::clearIptcData() { iptcData_.clear(); @@ -142,8 +142,8 @@ namespace Exiv2 { } void JpegBase::setComment(const std::string& comment) - { - comment_ = comment; + { + comment_ = comment; } void JpegBase::setMetadata(const Image& image) @@ -160,7 +160,7 @@ namespace Exiv2 { while ((c=io_->getb()) != 0xff) { if (c == EOF) return -1; } - + // Markers can start with any number of 0xff while ((c=io_->getb()) == 0xff) { if (c == EOF) return -1; @@ -188,7 +188,7 @@ namespace Exiv2 { // Read section marker int marker = advanceToMarker(); if (marker < 0) throw Error(15); - + while (marker != sos_ && marker != eoi_ && search > 0) { // Read size and signature (ok if this hits EOF) bufRead = io_->read(buf.pData_, bufMinSize); @@ -198,7 +198,7 @@ namespace Exiv2 { if (marker == app1_ && memcmp(buf.pData_ + 2, exifId_, 6) == 0) { if (size < 8) throw Error(15); // Seek to begining and read the Exif data - io_->seek(8-bufRead, BasicIo::cur); + io_->seek(8-bufRead, BasicIo::cur); long sizeExifData = size - 8; DataBuf rawExif(sizeExifData); io_->read(rawExif.pData_, sizeExifData); @@ -254,9 +254,9 @@ namespace Exiv2 { // Operates on raw data (rather than file streams) to simplify reuse - int JpegBase::locateIptcData(const byte *pPsData, + int JpegBase::locateIptcData(const byte *pPsData, long sizePsData, - const byte **record, + const byte **record, uint16_t *const sizeHdr, uint16_t *const sizeIptc) const { @@ -273,7 +273,7 @@ namespace Exiv2 { position += 4; uint16_t type = getUShort(pPsData+ position, bigEndian); position += 2; - + // Pascal string is padded to have an even size (including size byte) byte psSize = pPsData[position] + 1; psSize += (psSize & 1); @@ -284,7 +284,7 @@ namespace Exiv2 { long dataSize = getULong(pPsData + position, bigEndian); position += 4; if (dataSize > sizePsData - position) return -2; - + if (type == iptc_) { *sizeIptc = static_cast<uint16_t>(dataSize); *sizeHdr = psSize + 10; @@ -320,7 +320,7 @@ namespace Exiv2 { if (io_->error() || io_->eof()) throw Error(20); throw Error(22); } - + const long bufMinSize = 16; long bufRead = 0; DataBuf buf(bufMinSize); @@ -339,7 +339,7 @@ namespace Exiv2 { // Read section marker int marker = advanceToMarker(); if (marker < 0) throw Error(22); - + // First find segments of interest. Normally app0 is first and we want // to insert after it. But if app0 comes after com, app1 and app13 then // don't bother. @@ -395,7 +395,7 @@ namespace Exiv2 { count = 0; marker = advanceToMarker(); if (marker < 0) throw Error(22); - + // To simplify this a bit, new segments are inserts at either the start // or right after app0. This is standard in most jpegs, but has the // potential to change segment ordering (which is allowed). @@ -414,7 +414,7 @@ namespace Exiv2 { // Write COM marker, size of comment, and string tmpBuf[0] = 0xff; tmpBuf[1] = com_; - us2Data(tmpBuf + 2, + us2Data(tmpBuf + 2, static_cast<uint16_t>(comment_.length()+3), bigEndian); if (outIo.write(tmpBuf, 4) != 4) throw Error(21); if (outIo.write((byte*)comment_.data(), (long)comment_.length()) @@ -428,17 +428,17 @@ namespace Exiv2 { DataBuf rawExif(exifData_.copy()); tmpBuf[0] = 0xff; tmpBuf[1] = app1_; - us2Data(tmpBuf + 2, - static_cast<uint16_t>(rawExif.size_+8), + us2Data(tmpBuf + 2, + static_cast<uint16_t>(rawExif.size_+8), bigEndian); memcpy(tmpBuf + 4, exifId_, 6); if (outIo.write(tmpBuf, 10) != 10) throw Error(21); - if (outIo.write(rawExif.pData_, rawExif.size_) + if (outIo.write(rawExif.pData_, rawExif.size_) != rawExif.size_) throw Error(21); if (outIo.error()) throw Error(21); --search; } - + const byte *record = psData.pData_; uint16_t sizeIptc = 0; uint16_t sizeHdr = 0; @@ -453,9 +453,9 @@ namespace Exiv2 { // write app13 marker, new size, and ps3Id tmpBuf[0] = 0xff; tmpBuf[1] = app13_; - const int sizeNewData = rawIptc.size_ ? + const int sizeNewData = rawIptc.size_ ? rawIptc.size_ + (rawIptc.size_ & 1) + 12 : 0; - us2Data(tmpBuf + 2, + us2Data(tmpBuf + 2, static_cast<uint16_t>(psData.size_-sizeOldData+sizeNewData+16), bigEndian); memcpy(tmpBuf + 4, ps3Id_, 14); @@ -475,7 +475,7 @@ namespace Exiv2 { tmpBuf[7] = 0; ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian); if (outIo.write(tmpBuf, 12) != 12) throw Error(21); - if (outIo.write(rawIptc.pData_, rawIptc.size_) + if (outIo.write(rawIptc.pData_, rawIptc.size_) != rawIptc.size_) throw Error(21); // data is padded to be even (but not included in size) if (rawIptc.size_ & 1) { @@ -484,9 +484,9 @@ namespace Exiv2 { if (outIo.error()) throw Error(21); --search; } - + // write existing stuff after record - if (outIo.write(record+sizeOldData, sizeEnd) + if (outIo.write(record+sizeOldData, sizeEnd) != sizeEnd) throw Error(21); if (outIo.error()) throw Error(21); } @@ -545,7 +545,7 @@ namespace Exiv2 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xDA,0x00,0x0C,0x03,0x01,0x00,0x02, 0x11,0x03,0x11,0x00,0x3F,0x00,0xA0,0x00,0x0F,0xFF,0xD9 }; - JpegImage::JpegImage(BasicIo::AutoPtr io, bool create) + JpegImage::JpegImage(BasicIo::AutoPtr io, bool create) : JpegBase(io, create, blank_, sizeof(blank_)) { } @@ -557,7 +557,7 @@ namespace Exiv2 { Image::jpeg, newJpegInstance, isJpegType); } //! @endcond - + int JpegImage::writeHeader(BasicIo& outIo) const { // Jpeg header @@ -596,11 +596,11 @@ namespace Exiv2 { if (!advance || !result ) iIo.seek(-2, BasicIo::cur); return result; } - + const char ExvImage::exiv2Id_[] = "Exiv2"; const byte ExvImage::blank_[] = { 0xff,0x01,'E','x','i','v','2',0xff,0xd9 }; - ExvImage::ExvImage(BasicIo::AutoPtr io, bool create) + ExvImage::ExvImage(BasicIo::AutoPtr io, bool create) : JpegBase(io, create, blank_, sizeof(blank_)) { } @@ -650,7 +650,7 @@ namespace Exiv2 { iIo.read(tmpBuf, 7); if (iIo.error() || iIo.eof()) return false; - if ( 0xff != tmpBuf[0] || 0x01 != tmpBuf[1] + if ( 0xff != tmpBuf[0] || 0x01 != tmpBuf[1] || memcmp(tmpBuf + 2, ExvImage::exiv2Id_, 5) != 0) { result = false; } diff --git a/src/plugins/exiv2/jpgimage.hpp b/src/plugins/exiv2/jpgimage.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -24,7 +24,7 @@ @version $Rev: 563 $ @author Andreas Huggel (ahu) <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> - @author Brad Schick (brad) + @author Brad Schick (brad) <a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a> @date 15-Jan-05, brad: split out from image.cpp */ @@ -50,7 +50,7 @@ namespace Exiv2 { // ***************************************************************************** // class definitions - /*! + /*! @brief Abstract helper base class to access JPEG images. */ class JpegBase : public Image { @@ -65,17 +65,17 @@ namespace Exiv2 { /*! @brief Read all metadata from the image. Before this method is called, the various metadata types (Iptc, Exif) will be empty. - + This method returns success even when no metadata is found in the image. Callers must therefore check the size of individual metadata types before accessing the data. - + @throw Error if opening or reading of the file fails or the image data is not valid (does not look like JPEG data). */ void readMetadata(); /*! - @brief Write metadata back to the image. + @brief Write metadata back to the image. All existing metadata sections in the image are either created, replaced, or erased. If values for a given metadata type have been @@ -83,7 +83,7 @@ namespace Exiv2 { replaced. If no values have been assigned to a given metadata type, any exists section for that metadata type will be removed from the image. - + @throw Error if the operation fails */ void writeMetadata(); @@ -111,11 +111,11 @@ namespace Exiv2 { IptcData& iptcData() { return iptcData_; } std::string comment() const { return comment_; } BasicIo& io() const { return *io_; } - //@} + //@} protected: //! @name Creators //@{ - /*! + /*! @brief Constructor that can either open an existing image or create a new image from scratch. If a new image is to be created, any existing data is overwritten. @@ -155,9 +155,9 @@ namespace Exiv2 { moved (see below). This applies only if the type matches and the function returns true. If the type does not match, the stream position is not changed. However, if reading from the stream fails, - the stream position is undefined. Consult the stream state to obtain + the stream position is undefined. Consult the stream state to obtain more information in this case. - + @param iIo BasicIo instance to read from. @param advance Flag indicating whether the position of the io should be advanced by the number of characters read to @@ -202,7 +202,7 @@ namespace Exiv2 { /*! @brief Locates Photoshop formated Iptc data in a memory buffer. Operates on raw data to simplify reuse. - @param pPsData Pointer to buffer containing entire payload of + @param pPsData Pointer to buffer containing entire payload of Photoshop formated APP13 Jpeg segment. @param sizePsData Size in bytes of pPsData. @param record Output value that is set to the start of the Iptc @@ -217,9 +217,9 @@ namespace Exiv2 { 3 if no Iptc data was found in pPsData;<BR> -2 if the pPsData buffer does not contain valid data. */ - int locateIptcData(const byte *pPsData, + int locateIptcData(const byte *pPsData, long sizePsData, - const byte **record, + const byte **record, uint16_t *const sizeHdr, uint16_t *const sizeIptc) const; /*! @@ -231,8 +231,8 @@ namespace Exiv2 { */ int initImage(const byte initData[], long dataSize); /*! - @brief Provides the main implementation of writeMetadata() by - writing all buffered metadata to the provided BasicIo. + @brief Provides the main implementation of writeMetadata() by + writing all buffered metadata to the provided BasicIo. @param oIo BasicIo instance to write to (a temporary location). @return 4 if opening or writing to the associated BasicIo fails @@ -248,7 +248,7 @@ namespace Exiv2 { JpegBase& operator=(const JpegBase& rhs); }; // class JpegBase - /*! + /*! @brief Class to access JPEG images */ class JpegImage : public JpegBase { @@ -256,7 +256,7 @@ namespace Exiv2 { public: //! @name Creators //@{ - /*! + /*! @brief Constructor that can either open an existing Jpeg image or create a new image from scratch. If a new image is to be created, any existing data is overwritten. Since the constructor can not return @@ -275,7 +275,7 @@ namespace Exiv2 { //! Destructor ~JpegImage() {} //@} - + //! @cond IGNORE // Public only so that we can create a static instance struct JpegRegister{ @@ -332,7 +332,7 @@ namespace Exiv2 { public: //! @name Creators //@{ - /*! + /*! @brief Constructor that can either open an existing Exv image or create a new image from scratch. If a new image is to be created, any existing data is overwritten. Since the constructor can not return @@ -351,7 +351,7 @@ namespace Exiv2 { //! Destructor ~ExvImage() {} //@} - + //! @cond IGNORE // Public only so that we can create a static instance struct ExvRegister{ diff --git a/src/plugins/exiv2/makernote.cpp b/src/plugins/exiv2/makernote.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -29,7 +29,7 @@ EXIV2_RCSID("@(#) $Id: makernote.cpp 600 2005-07-09 10:38:09Z ahuggel $"); // Define DEBUG_* to output debug information to std::cerr, e.g, by calling -// make like this: make DEFS=-DDEBUG_MAKERNOTE makernote.o +// make like this: make DEFS=-DDEBUG_MAKERNOTE makernote.o //#define DEBUG_MAKERNOTE //#define DEBUG_REGISTRY @@ -49,7 +49,7 @@ EXIV2_RCSID("@(#) $Id: makernote.cpp 600 2005-07-09 10:38:09Z ahuggel $"); // class member definitions namespace Exiv2 { - MakerNote::MakerNote(bool alloc) + MakerNote::MakerNote(bool alloc) : alloc_(alloc), offset_(0), byteOrder_(invalidByteOrder) { } @@ -65,7 +65,7 @@ namespace Exiv2 { } IfdMakerNote::IfdMakerNote(IfdId ifdId, bool alloc, bool hasNext) - : MakerNote(alloc), + : MakerNote(alloc), absOffset_(true), adjOffset_(0), ifd_(ifdId, 0, alloc, hasNext) { } @@ -78,8 +78,8 @@ namespace Exiv2 { } int IfdMakerNote::read(const byte* buf, - long len, - ByteOrder byteOrder, + long len, + ByteOrder byteOrder, long offset) { // Remember the offset @@ -95,7 +95,7 @@ namespace Exiv2 { offset = absOffset_ ? offset + adjOffset_ : adjOffset_; // Read the makernote IFD if (rc == 0) { - rc = ifd_.read(buf + headerSize(), + rc = ifd_.read(buf + headerSize(), len - headerSize(), byteOrder_, offset); @@ -134,7 +134,7 @@ namespace Exiv2 { return len; } // IfdMakerNote::copy - int IfdMakerNote::readHeader(const byte* buf, + int IfdMakerNote::readHeader(const byte* buf, long len, ByteOrder byteOrder) { @@ -143,7 +143,7 @@ namespace Exiv2 { } void IfdMakerNote::updateBase(byte* pNewBase) - { + { if (absOffset_) { ifd_.updateBase(pNewBase); } @@ -166,9 +166,9 @@ namespace Exiv2 { return header_.size_; } - Entries::const_iterator IfdMakerNote::findIdx(int idx) const + Entries::const_iterator IfdMakerNote::findIdx(int idx) const { - return ifd_.findIdx(idx); + return ifd_.findIdx(idx); } long IfdMakerNote::size() const @@ -255,12 +255,12 @@ namespace Exiv2 { return i->second->create(alloc); } // MakerNoteFactory::create - void MakerNoteFactory::registerMakerNote(const std::string& make, - const std::string& model, + void MakerNoteFactory::registerMakerNote(const std::string& make, + const std::string& model, CreateFct createMakerNote) { #ifdef DEBUG_REGISTRY - std::cerr << "Registering MakerNote create function for \"" + std::cerr << "Registering MakerNote create function for \"" << make << "\" and \"" << model << "\".\n"; #endif init(); @@ -295,16 +295,16 @@ namespace Exiv2 { } } // MakerNoteFactory::registerMakerNote - MakerNote::AutoPtr MakerNoteFactory::create(const std::string& make, + MakerNote::AutoPtr MakerNoteFactory::create(const std::string& make, const std::string& model, bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { #ifdef DEBUG_REGISTRY - std::cerr << "Entering MakerNoteFactory::create(\"" + std::cerr << "Entering MakerNoteFactory::create(\"" << make << "\", \"" << model << "\", " << (alloc == true ? "true" : "false") << ")\n"; #endif @@ -313,7 +313,7 @@ namespace Exiv2 { ModelRegistry* pModelRegistry = 0; #ifdef DEBUG_REGISTRY std::string makeMatch; - std::cerr << "Searching make registry...\n"; + std::cerr << "Searching make registry...\n"; #endif assert(pRegistry_ != 0); Registry::const_iterator end1 = pRegistry_->end(); @@ -364,7 +364,7 @@ namespace Exiv2 { const std::string& key) { #ifdef DEBUG_REGISTRY - std::cerr << " Matching registry entry \"" << regEntry << "\" (" + std::cerr << " Matching registry entry \"" << regEntry << "\" (" << (int)regEntry.size() << ") with key \"" << key << "\" (" << (int)key.size() << "): "; #endif @@ -400,11 +400,11 @@ namespace Exiv2 { } bool found = false; - // Find the substr ss in the key starting from index ki. + // Find the substr ss in the key starting from index ki. // Take care of the special cases // + where the substr must match the key from beg to end, // + from beg, - // + to end + // + to end // + and where it can be anywhere in the key. // If found, ki is adjusted to the position in the key after ss. if (ei == 0 && pos == std::string::npos) { // ei == 0 => ki == 0 @@ -420,7 +420,7 @@ namespace Exiv2 { } } else if (pos == std::string::npos) { - if ( ss.size() <= uKey.size() + if ( ss.size() <= uKey.size() && ki <= uKey.size() - ss.size()) { if (0 == uKey.compare( uKey.size() - ss.size(), ss.size(), ss)) { @@ -430,7 +430,7 @@ namespace Exiv2 { } } else { - std::string::size_type idx = uKey.find(ss, ki); + std::string::size_type idx = uKey.find(ss, ki); if (idx != std::string::npos) { found = true; ki = idx + ss.size(); @@ -456,7 +456,7 @@ namespace Exiv2 { std::cerr << "Match (score: " << count + 1 << ")\n"; #endif return count + 1; - + } // MakerNoteFactory::match } // namespace Exiv2 diff --git a/src/plugins/exiv2/makernote.hpp b/src/plugins/exiv2/makernote.hpp @@ -1,26 +1,26 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*! @file makernote.hpp - @brief Contains the Exif %MakerNote interface, IFD %MakerNote and a + @brief Contains the Exif %MakerNote interface, IFD %MakerNote and a MakerNote factory @version $Rev: 598 $ @author Andreas Huggel (ahu) @@ -68,7 +68,7 @@ namespace Exiv2 { MakerNote holds methods and functionality to - read the makernote from a character buffer - copy the makernote to a character buffer - - maintain a list of makernote entries (similar to IFD entries) + - maintain a list of makernote entries (similar to IFD entries) - interpret (print) the values of makernote tags Makernotes can be added to the system by subclassing %MakerNote and @@ -78,18 +78,18 @@ namespace Exiv2 { subclass IfdMakerNote is provided. It contains an IFD container and implements all interface methods related to the makernote entries. <BR> - To implement a new IFD makernote, all that you need to do is - - subclass %IfdMakerNote, + To implement a new IFD makernote, all that you need to do is + - subclass %IfdMakerNote, - implement methods to read and check the header (if any) as well as clone and create functions, - - add a list of tag descriptions and appropriate print functions and - - register the camera make/model and create function in the makernote factory. + - add a list of tag descriptions and appropriate print functions and + - register the camera make/model and create function in the makernote factory. . See existing makernote implementations for examples, e.g., CanonMakerNote or FujiMakerNote. - Finally, the header file which defines the static variable - \em register*MakerNote needs to be included from mn.hpp, to ensure that + Finally, the header file which defines the static variable + \em register*MakerNote needs to be included from mn.hpp, to ensure that the makernote is automatically registered in the factory. */ class MakerNote { @@ -106,7 +106,7 @@ namespace Exiv2 { //! @name Creators //@{ /*! - @brief Constructor. Allows to choose whether or not memory management + @brief Constructor. Allows to choose whether or not memory management is required for the Entries. */ explicit MakerNote(bool alloc =true); @@ -122,12 +122,12 @@ namespace Exiv2 { start of the TIFF header) and encoded in byte order byteOrder. Return 0 if successful. */ - virtual int read(const byte* buf, - long len, + virtual int read(const byte* buf, + long len, ByteOrder byteOrder, long offset) =0; /*! - @brief Copy (write) the makerNote to the character buffer buf at + @brief Copy (write) the makerNote to the character buffer buf at position offset (from the start of the TIFF header), encoded in byte order byteOrder. Update internal offsets if necessary. Return the number of bytes written. @@ -136,7 +136,7 @@ namespace Exiv2 { /*! @brief Add the entry to the makernote. No duplicate-check is performed, i.e., it is possible to add multiple entries with the same tag. - The memory allocation mode of the entry to be added must be the + The memory allocation mode of the entry to be added must be the same as that of the makernote and the IFD id of the entry must be set to 'makerIfd'. */ @@ -146,7 +146,7 @@ namespace Exiv2 { //! End of the makernote entries virtual Entries::iterator end() =0; /*! - @brief Update the base pointer of the %MakerNote and all its entries + @brief Update the base pointer of the %MakerNote and all its entries to \em pNewBase. Allows to re-locate the underlying data buffer to a new location @@ -167,7 +167,7 @@ namespace Exiv2 { copied. The caller owns the new object and the auto-pointer ensures that it will be deleted. - @param alloc Memory management model for the newly created object. + @param alloc Memory management model for the newly created object. Indicates if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more @@ -179,8 +179,8 @@ namespace Exiv2 { owns the new object and the auto-pointer ensures that it will be deleted. - @note In non-alloc mode the clone potentially contains pointers to - the same data buffer as the original. + @note In non-alloc mode the clone potentially contains pointers to + the same data buffer as the original. Use updateBase(byte* pNewBase) to adjust them. */ AutoPtr clone() const; @@ -201,9 +201,9 @@ namespace Exiv2 { True: requires memory allocation and deallocation, <BR> False: no memory management needed. */ - const bool alloc_; - /*! - @brief Offset of the makernote from the start of the TIFF header + const bool alloc_; + /*! + @brief Offset of the makernote from the start of the TIFF header (for offset()). */ long offset_; @@ -239,9 +239,9 @@ namespace Exiv2 { typedef std::auto_ptr<IfdMakerNote> AutoPtr; //! @name Creators - //@{ + //@{ /*! - @brief Constructor. Requires an %Ifd id and allows to choose whether + @brief Constructor. Requires an %Ifd id and allows to choose whether or not memory management is needed for the Entries and whether the IFD has a next pointer. */ @@ -254,19 +254,19 @@ namespace Exiv2 { //! @name Manipulators //@{ - virtual int read(const byte* buf, - long len, - ByteOrder byteOrder, + virtual int read(const byte* buf, + long len, + ByteOrder byteOrder, long offset); /*! @brief Read the makernote header from the makernote databuffer. This method must set the offset adjustment (adjOffset_), if needed (assuming that the required information is in the header). - Return 0 if successful. + Return 0 if successful. @note The default implementation does nothing, assuming there is no header */ - virtual int readHeader(const byte* buf, + virtual int readHeader(const byte* buf, long len, ByteOrder byteOrder); virtual long copy(byte* buf, ByteOrder byteOrder, long offset); @@ -293,14 +293,14 @@ namespace Exiv2 { */ virtual int checkHeader() const; /*! - @brief Write the makernote header to a character buffer, return the + @brief Write the makernote header to a character buffer, return the number of characters written. @note The default implementation copies the header_ buffer. */ virtual long copyHeader(byte* buf) const; - /*! + /*! @brief Return the size of the makernote header in bytes. - @note The default implementation returns the size of the header_ + @note The default implementation returns the size of the header_ buffer. */ virtual long headerSize() const; @@ -312,14 +312,14 @@ namespace Exiv2 { @brief True: Adjustment of the IFD offsets is to be added to the offset from the start of the TIFF header (i.e., the start of the Exif data section), - False: Adjustment of the IFD offsets is a suitable absolute - value. Ignore the offset from the start of the TIFF + False: Adjustment of the IFD offsets is a suitable absolute + value. Ignore the offset from the start of the TIFF header. */ bool absOffset_; /*! - @brief Adjustment of the IFD offsets relative to the start of the - TIFF header or to the start of the makernote, depending on + @brief Adjustment of the IFD offsets relative to the start of the + TIFF header or to the start of the makernote, depending on the setting of absOffset_. */ long adjOffset_; @@ -361,13 +361,13 @@ namespace Exiv2 { make tag.) @param model Camera model. (Typically the string from the Exif model tag.) - @param createMakerNote Pointer to a function to create a new + @param createMakerNote Pointer to a function to create a new %MakerNote of a particular type. */ - static void registerMakerNote(const std::string& make, - const std::string& model, + static void registerMakerNote(const std::string& make, + const std::string& model, CreateFct createMakerNote); - + //! Register a %MakerNote prototype in the IFD id registry. static void registerMakerNote(IfdId ifdId, MakerNote::AutoPtr makerNote); @@ -403,24 +403,24 @@ namespace Exiv2 { if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more - background on this concept. - @param buf Pointer to the makernote character buffer. - @param len Length of the makernote character buffer. - @param byteOrder Byte order in which the Exif data (and possibly the + background on this concept. + @param buf Pointer to the makernote character buffer. + @param len Length of the makernote character buffer. + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded. @param offset Offset from the start of the TIFF header of the makernote buffer. - @return An auto-pointer that owns a %MakerNote for the camera model. + @return An auto-pointer that owns a %MakerNote for the camera model. If the camera is not supported, the pointer is 0. */ - static MakerNote::AutoPtr create(const std::string& make, - const std::string& model, - bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, - long offset); + static MakerNote::AutoPtr create(const std::string& make, + const std::string& model, + bool alloc, + const byte* buf, + long len, + ByteOrder byteOrder, + long offset); //! Create a %MakerNote for an IFD id. static MakerNote::AutoPtr create(IfdId ifdId, bool alloc =true); @@ -432,20 +432,20 @@ namespace Exiv2 { registry entry are supported. The best match is an exact match, then a match is rated according to the number of matching characters. - @return A score value indicating how good the key and registry entry + @return A score value indicating how good the key and registry entry match. 0 means no match, values greater than 0 indicate a match, larger values are better matches:<BR> 0: key and registry entry do not match<BR> - 1: a pure wildcard match, i.e., the registry entry is just + 1: a pure wildcard match, i.e., the registry entry is just a wildcard.<BR> - Score values greater than 1 are computed by adding 1 to the - number of matching characters, except for an exact match, + Score values greater than 1 are computed by adding 1 to the + number of matching characters, except for an exact match, which scores 2 plus the number of matching characters. */ static int match(const std::string& regEntry, const std::string& key); /*! - @brief Class Init is used to execute initialisation and termination + @brief Class Init is used to execute initialisation and termination code exactly once, at the begin and end of the program. See Bjarne Stroustrup, 'The C++ Programming Language 3rd @@ -455,7 +455,7 @@ namespace Exiv2 { static int count; //!< Counts calls to constructor public: //! @name Creators - //@{ + //@{ //! Perform one-time initialisations. Init(); //! Perform one-time cleanup operations. @@ -465,7 +465,7 @@ namespace Exiv2 { private: //! @name Creators - //@{ + //@{ //! Prevent construction: not implemented. MakerNoteFactory() {} //! Prevent copy construction: not implemented. @@ -489,7 +489,7 @@ namespace Exiv2 { static IfdIdRegistry* pIfdIdRegistry_; }; // class MakerNoteFactory - + } // namespace Exiv2 namespace { diff --git a/src/plugins/exiv2/metadatum.cpp b/src/plugins/exiv2/metadatum.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -42,7 +42,7 @@ EXIV2_RCSID("@(#) $Id: metadatum.cpp 538 2005-03-12 16:43:06Z ahuggel $"); // ***************************************************************************** // class member definitions namespace Exiv2 { - + Key::AutoPtr Key::clone() const { return AutoPtr(clone_()); @@ -51,12 +51,12 @@ namespace Exiv2 { std::ostream& operator<<(std::ostream& os, const Metadatum& md) { os << "0x" << std::setw(4) << std::setfill('0') << std::right - << std::hex << md.tag() << " " + << std::hex << md.tag() << " " << std::setw(40) << std::setfill(' ') << std::left << md.key() << " " << std::setw(9) << std::setfill(' ') << std::left << md.typeName() << " " - << std::dec << md.value() + << std::dec << md.value() << "\n"; return os; } diff --git a/src/plugins/exiv2/metadatum.hpp b/src/plugins/exiv2/metadatum.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -24,7 +24,7 @@ @version $Rev: 560 $ @author Andreas Huggel (ahu) <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> - @author Brad Schick (brad) + @author Brad Schick (brad) <a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a> @date 09-Jan-04, ahu: created<BR> 31-Jul-04, brad: isolated as a component<BR> @@ -87,10 +87,10 @@ namespace Exiv2 { will be deleted. */ AutoPtr clone() const; - /*! + /*! @brief Write the key to an output stream. You do not usually have - to use this function; it is used for the implementation of - the output operator for %Key, + to use this function; it is used for the implementation of + the output operator for %Key, operator<<(std::ostream &os, const Key &key). */ std::ostream& write(std::ostream& os) const { return os << key(); } @@ -142,7 +142,7 @@ namespace Exiv2 { */ virtual void setValue(const Value* pValue) =0; /*! - @brief Set the value to the string buf. + @brief Set the value to the string buf. Uses Value::read(const std::string& buf). If the metadatum does not have a value yet, then an AsciiValue is created. */ @@ -212,22 +212,22 @@ namespace Exiv2 { caller owns this copy and the auto-poiner ensures that it will be deleted. - This method is provided for users who need full control over the + This method is provided for users who need full control over the value. A caller may, e.g., downcast the pointer to the appropriate subclass of Value to make use of the interface of the subclass to set or modify its contents. - - @return An auto-pointer containing a pointer to a copy (clone) of the + + @return An auto-pointer containing a pointer to a copy (clone) of the value, 0 if the value is not set. */ virtual Value::AutoPtr getValue() const =0; /*! - @brief Return a constant reference to the value. + @brief Return a constant reference to the value. This method is provided mostly for convenient and versatile output of the value which can (to some extent) be formatted through standard stream manipulators. Do not attempt to write to the value through - this reference. + this reference. <b>Example:</b> <br> @code @@ -269,7 +269,7 @@ namespace Exiv2 { private: std::string key_; - + }; // class FindMetadatumByTag diff --git a/src/plugins/exiv2/mn.hpp b/src/plugins/exiv2/mn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/src/plugins/exiv2/nikonmn.cpp b/src/plugins/exiv2/nikonmn.cpp @@ -2,21 +2,21 @@ /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> * - * Lens database to decode Exif.Nikon3.LensData + * Lens database to decode Exif.Nikon3.LensData * Copyright (C) 2005 Robert Rottmerhusen <email@rottmerhusen.com> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -103,7 +103,7 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - Nikon1MakerNote* Nikon1MakerNote::create_(bool alloc) const + Nikon1MakerNote* Nikon1MakerNote::create_(bool alloc) const { return new Nikon1MakerNote(alloc); } @@ -113,7 +113,7 @@ namespace Exiv2 { return AutoPtr(clone_()); } - Nikon1MakerNote* Nikon1MakerNote::clone_() const + Nikon1MakerNote* Nikon1MakerNote::clone_() const { return new Nikon1MakerNote(*this); } @@ -125,7 +125,7 @@ namespace Exiv2 { os << value.toLong(1); } else { - os << "(" << value << ")"; + os << "(" << value << ")"; } return os; } @@ -133,7 +133,7 @@ namespace Exiv2 { std::ostream& Nikon1MakerNote::print0x0007(std::ostream& os, const Value& value) { - std::string focus = value.toString(); + std::string focus = value.toString(); if (focus == "AF-C ") os << "Continuous autofocus"; else if (focus == "AF-S ") os << "Single autofocus"; else os << "(" << value << ")"; @@ -196,7 +196,7 @@ namespace Exiv2 { } } else { - os << "(" << value << ")"; + os << "(" << value << ")"; } return os; } @@ -243,7 +243,7 @@ namespace Exiv2 { } int Nikon2MakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 8) return 1; @@ -259,7 +259,7 @@ namespace Exiv2 { int rc = 0; // Check the Nikon prefix if ( header_.size_ < 8 - || std::string(reinterpret_cast<char*>(header_.pData_), 6) + || std::string(reinterpret_cast<char*>(header_.pData_), 6) != std::string("Nikon\0", 6)) { rc = 2; } @@ -271,9 +271,9 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - Nikon2MakerNote* Nikon2MakerNote::create_(bool alloc) const + Nikon2MakerNote* Nikon2MakerNote::create_(bool alloc) const { - AutoPtr makerNote(new Nikon2MakerNote(alloc)); + AutoPtr makerNote(new Nikon2MakerNote(alloc)); assert(makerNote.get() != 0); makerNote->readHeader(header_.pData_, header_.size_, byteOrder_); return makerNote.release(); @@ -284,7 +284,7 @@ namespace Exiv2 { return AutoPtr(clone_()); } - Nikon2MakerNote* Nikon2MakerNote::clone_() const + Nikon2MakerNote* Nikon2MakerNote::clone_() const { return new Nikon2MakerNote(*this); } @@ -465,7 +465,7 @@ namespace Exiv2 { { absOffset_ = false; byte buf[] = { - 'N', 'i', 'k', 'o', 'n', '\0', + 'N', 'i', 'k', 'o', 'n', '\0', 0x02, 0x10, 0x00, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08 }; readHeader(buf, 18, byteOrder_); @@ -477,7 +477,7 @@ namespace Exiv2 { } int Nikon3MakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 18) return 1; @@ -496,7 +496,7 @@ namespace Exiv2 { int rc = 0; // Check the Nikon prefix if ( header_.size_ < 18 - || std::string(reinterpret_cast<char*>(header_.pData_), 6) + || std::string(reinterpret_cast<char*>(header_.pData_), 6) != std::string("Nikon\0", 6)) { rc = 2; } @@ -508,9 +508,9 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - Nikon3MakerNote* Nikon3MakerNote::create_(bool alloc) const + Nikon3MakerNote* Nikon3MakerNote::create_(bool alloc) const { - AutoPtr makerNote(new Nikon3MakerNote(alloc)); + AutoPtr makerNote(new Nikon3MakerNote(alloc)); assert(makerNote.get() != 0); makerNote->readHeader(header_.pData_, header_.size_, byteOrder_); return makerNote.release(); @@ -521,7 +521,7 @@ namespace Exiv2 { return AutoPtr(clone_()); } - Nikon3MakerNote* Nikon3MakerNote::clone_() const + Nikon3MakerNote* Nikon3MakerNote::clone_() const { return new Nikon3MakerNote(*this); } @@ -533,12 +533,12 @@ namespace Exiv2 { os << value.toLong(1); } else { - os << "(" << value << ")"; + os << "(" << value << ")"; } return os; } - std::ostream& Nikon3MakerNote::print0x0012(std::ostream& os, + std::ostream& Nikon3MakerNote::print0x0012(std::ostream& os, const Value& value) { // From the PHP JPEG Metadata Toolkit @@ -578,7 +578,7 @@ namespace Exiv2 { if (len2 != len1) { os << "-" << len2; } - os << "mm " + os << "mm " << "F" << (float)fno1.first / fno1.second; if (fno2 != fno1) { os << "-" << (float)fno2.first / fno2.second; @@ -607,7 +607,7 @@ namespace Exiv2 { std::ostream& Nikon3MakerNote::print0x0088(std::ostream& os, const Value& value) { - // Mappings taken from Exiftool + // Mappings taken from Exiftool long afpos = value.toLong(); switch (afpos) { case 0x0000: os << "Center"; break; @@ -615,7 +615,7 @@ namespace Exiv2 { case 0x0200: os << "Bottom"; break; case 0x0300: os << "Left"; break; case 0x0400: os << "Right"; break; - + // D70 case 0x00001: os << "Single area, center"; break; case 0x10002: os << "Single area, top"; break; @@ -811,7 +811,7 @@ namespace Exiv2 { idx = 6; } else if (0 == memcmp(lens.pData_, "0101", 4)) { - idx = 11; + idx = 11; } else if (0 == memcmp(lens.pData_, "0201", 4)) { // Here we should decrypt(lens.pData_ + 4, lens.size_ - 4); @@ -837,7 +837,7 @@ namespace Exiv2 { } // Lens not found in database return os << value; -#else +#else return os << value; #endif // EXV_HAVE_LENSDATA } @@ -846,25 +846,25 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createNikonMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { // If there is no "Nikon" string it must be Nikon1 format - if (len < 6 || std::string(reinterpret_cast<const char*>(buf), 6) + if (len < 6 || std::string(reinterpret_cast<const char*>(buf), 6) != std::string("Nikon\0", 6)) { return MakerNote::AutoPtr(new Nikon1MakerNote(alloc)); } // If the "Nikon" string is not followed by a TIFF header, we assume // Nikon2 format TiffHeader tiffHeader; - if ( len < 18 + if ( len < 18 || tiffHeader.read(buf + 10) != 0 || tiffHeader.tag() != 0x002a) { - return MakerNote::AutoPtr(new Nikon2MakerNote(alloc)); + return MakerNote::AutoPtr(new Nikon2MakerNote(alloc)); } // Else we have a Nikon3 makernote - return MakerNote::AutoPtr(new Nikon3MakerNote(alloc)); + return MakerNote::AutoPtr(new Nikon3MakerNote(alloc)); } } // namespace Exiv2 diff --git a/src/plugins/exiv2/nikonmn.hpp b/src/plugins/exiv2/nikonmn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,16 +23,16 @@ @brief Nikon MakerNote formats. The Nikon MakerNote formats are implemented according to the following references<BR> - Format 1: + Format 1: <ul> <li><a href="http://www.tawbaware.com/990exif.htm">MakerNote EXIF Tag of the Nikon 990</a> by Max Lyons</li></ul> - Format 2: - <ul><li>"Appendix 2: Makernote of Nikon" of the document + Format 2: + <ul><li>"Appendix 2: Makernote of Nikon" of the document <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html"> Exif file format</a> by TsuruZoh Tachibanaya</li></ul> - Format 3: + Format 3: <ul><li>"EXIFutils Field Reference Guide"</li> - <li><a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/nikon_mn.html#Nikon_Type_3_Tags">Nikon Type 3 Makernote Tags Definition</a> + <li><a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/nikon_mn.html#Nikon_Type_3_Tags">Nikon Type 3 Makernote Tags Definition</a> of the PHP JPEG Metadata Toolkit by Evan Hunter</li> <li>Nikon tag information from <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey</li> <li>Email communication with Robert Rottmerhusen</li> @@ -74,27 +74,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createNikonMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -125,7 +125,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Nikon1 %MakerNote tags + //! @name Print functions for Nikon1 %MakerNote tags //@{ //! Print ISO setting static std::ostream& print0x0002(std::ostream& os, const Value& value); @@ -160,9 +160,9 @@ namespace Exiv2 { static Nikon1MakerNote::RegisterMn registerNikon1MakerNote; /*! - @brief A second MakerNote format used by Nikon cameras, including the + @brief A second MakerNote format used by Nikon cameras, including the E700, E800, E900, E900S, E910, E950 - */ + */ class Nikon2MakerNote : public IfdMakerNote { public: //! Shortcut for a %Nikon2MakerNote auto pointer. @@ -182,8 +182,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -195,7 +195,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Nikon2 %MakerNote tags + //! @name Print functions for Nikon2 %MakerNote tags //@{ //! Print quality setting static std::ostream& print0x0003(std::ostream& os, const Value& value); @@ -252,7 +252,7 @@ namespace Exiv2 { //! @name Manipulators //@{ - int readHeader(const byte* buf, + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -264,7 +264,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Nikon3 %MakerNote tags + //! @name Print functions for Nikon3 %MakerNote tags //@{ //! Print ISO setting static std::ostream& print0x0002(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/olympusmn.cpp b/src/plugins/exiv2/olympusmn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -52,7 +52,7 @@ namespace Exiv2 { OlympusMakerNote::RegisterMn::RegisterMn() { MakerNoteFactory::registerMakerNote( - "OLYMPUS*", "*", createOlympusMakerNote); + "OLYMPUS*", "*", createOlympusMakerNote); MakerNoteFactory::registerMakerNote( olympusIfdId, MakerNote::AutoPtr(new OlympusMakerNote)); @@ -149,11 +149,11 @@ namespace Exiv2 { } int OlympusMakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 8) return 1; - + // Copy the header header_.alloc(8); memcpy(header_.pData_, buf, header_.size_); @@ -168,7 +168,7 @@ namespace Exiv2 { int rc = 0; // Check the OLYMPUS prefix if ( header_.size_ < 8 - || std::string(reinterpret_cast<char*>(header_.pData_), 5) + || std::string(reinterpret_cast<char*>(header_.pData_), 5) != std::string("OLYMP", 5)) { rc = 2; } @@ -193,12 +193,12 @@ namespace Exiv2 { return AutoPtr(clone_()); } - OlympusMakerNote* OlympusMakerNote::clone_() const + OlympusMakerNote* OlympusMakerNote::clone_() const { - return new OlympusMakerNote(*this); + return new OlympusMakerNote(*this); } - std::ostream& OlympusMakerNote::print0x0200(std::ostream& os, + std::ostream& OlympusMakerNote::print0x0200(std::ostream& os, const Value& value) { if (value.count() != 3 || value.typeId() != unsignedLong) { @@ -240,7 +240,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& OlympusMakerNote::print0x0201(std::ostream& os, + std::ostream& OlympusMakerNote::print0x0201(std::ostream& os, const Value& value) { return TagTranslator(quality).print(os, value); @@ -255,13 +255,13 @@ namespace Exiv2 { { -1, "(end)" } }; - std::ostream& OlympusMakerNote::print0x0202(std::ostream& os, + std::ostream& OlympusMakerNote::print0x0202(std::ostream& os, const Value& value) { return TagTranslator(macro).print(os, value); } // OlympusMakerNote::print0x0202 - std::ostream& OlympusMakerNote::print0x0204(std::ostream& os, + std::ostream& OlympusMakerNote::print0x0204(std::ostream& os, const Value& value) { float f = value.toFloat(); @@ -278,7 +278,7 @@ namespace Exiv2 { { -1, "(end)" } }; - std::ostream& OlympusMakerNote::print0x0302(std::ostream& os, + std::ostream& OlympusMakerNote::print0x0302(std::ostream& os, const Value& value) { return TagTranslator(oneTouchWb).print(os, value); @@ -294,7 +294,7 @@ namespace Exiv2 { { -1, "(end)" } }; - std::ostream& OlympusMakerNote::print0x1005(std::ostream& os, + std::ostream& OlympusMakerNote::print0x1005(std::ostream& os, const Value& value) { return TagTranslator(flashDevice).print(os, value); @@ -304,9 +304,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createOlympusMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new OlympusMakerNote(alloc)); diff --git a/src/plugins/exiv2/olympusmn.hpp b/src/plugins/exiv2/olympusmn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -21,9 +21,9 @@ /*! @file olympusmn.hpp @brief Olympus MakerNote implemented using the following references: - <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html#APP1">Exif file format, Appendix 1: MakerNote of Olympus Digicams</a> by TsuruZoh Tachibanaya, - Olympus.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey, - <a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html">Olympus Makernote Format Specification</a> by Evan Hunter, + <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html#APP1">Exif file format, Appendix 1: MakerNote of Olympus Digicams</a> by TsuruZoh Tachibanaya, + Olympus.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey, + <a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html">Olympus Makernote Format Specification</a> by Evan Hunter, email communication with <a href="mailto:wstokes@gmail.com">Will Stokes</a> @version $Rev: 580 $ @author Andreas Huggel (ahu) @@ -62,27 +62,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createOlympusMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -108,8 +108,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -121,7 +121,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Olympus %MakerNote tags + //! @name Print functions for Olympus %MakerNote tags //@{ //! Print 'Special Mode' static std::ostream& print0x0200(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/panasonicmn.cpp b/src/plugins/exiv2/panasonicmn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -107,7 +107,7 @@ namespace Exiv2 { } int PanasonicMakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 12) return 1; @@ -124,7 +124,7 @@ namespace Exiv2 { int rc = 0; // Check the Panasonic prefix if ( header_.size_ < 12 - || std::string(reinterpret_cast<char*>(header_.pData_), 9) + || std::string(reinterpret_cast<char*>(header_.pData_), 9) != std::string("Panasonic", 9)) { rc = 2; } @@ -136,7 +136,7 @@ namespace Exiv2 { return AutoPtr(create_(alloc)); } - PanasonicMakerNote* PanasonicMakerNote::create_(bool alloc) const + PanasonicMakerNote* PanasonicMakerNote::create_(bool alloc) const { AutoPtr makerNote = AutoPtr(new PanasonicMakerNote(alloc)); assert(makerNote.get() != 0); @@ -149,7 +149,7 @@ namespace Exiv2 { return AutoPtr(clone_()); } - PanasonicMakerNote* PanasonicMakerNote::clone_() const + PanasonicMakerNote* PanasonicMakerNote::clone_() const { return new PanasonicMakerNote(*this); } @@ -164,7 +164,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x0001(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0001(std::ostream& os, const Value& value) { return TagTranslator(quality).print(os, value); @@ -183,7 +183,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x0003(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0003(std::ostream& os, const Value& value) { return TagTranslator(whiteBalance).print(os, value); @@ -197,13 +197,13 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x0007(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0007(std::ostream& os, const Value& value) { return TagTranslator(focusMode).print(os, value); } // PanasonicMakerNote::print0x0007 - std::ostream& PanasonicMakerNote::print0x000f(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x000f(std::ostream& os, const Value& value) { if (value.count() < 2 || value.typeId() != unsignedByte) { @@ -225,7 +225,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x001a(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x001a(std::ostream& os, const Value& value) { return TagTranslator(imageStabilizer).print(os, value); @@ -239,7 +239,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x001c(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x001c(std::ostream& os, const Value& value) { return TagTranslator(macro).print(os, value); @@ -266,7 +266,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x001f(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x001f(std::ostream& os, const Value& value) { return TagTranslator(shootingMode).print(os, value); @@ -280,16 +280,16 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x0020(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0020(std::ostream& os, const Value& value) { return TagTranslator(Audio).print(os, value); } // PanasonicMakerNote::print0x0020 - std::ostream& PanasonicMakerNote::print0x0023(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0023(std::ostream& os, const Value& value) { - return os << std::fixed << std::setprecision(1) + return os << std::fixed << std::setprecision(1) << value.toLong() / 3 << " EV"; } // PanasonicMakerNote::print0x0023 @@ -304,7 +304,7 @@ namespace Exiv2 { { 0, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x0028(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x0028(std::ostream& os, const Value& value) { return TagTranslator(colorEffect).print(os, value); @@ -322,7 +322,7 @@ namespace Exiv2 { { -1, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x002c(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x002c(std::ostream& os, const Value& value) { return TagTranslator(contrast).print(os, value); @@ -337,7 +337,7 @@ namespace Exiv2 { { -1, "(end)" } }; - std::ostream& PanasonicMakerNote::print0x002d(std::ostream& os, + std::ostream& PanasonicMakerNote::print0x002d(std::ostream& os, const Value& value) { return TagTranslator(noiseReduction).print(os, value); @@ -347,9 +347,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createPanasonicMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new PanasonicMakerNote(alloc)); diff --git a/src/plugins/exiv2/panasonicmn.hpp b/src/plugins/exiv2/panasonicmn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -21,8 +21,8 @@ /*! @file panasonicmn.hpp @brief Panasonic MakerNote implemented using the following references: - <a href="http://www.compton.nu/panasonic.html">Panasonic MakerNote Information</a> by Tom Hughes, - Panasonic.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey, + <a href="http://www.compton.nu/panasonic.html">Panasonic MakerNote Information</a> by Tom Hughes, + Panasonic.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey, <a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html">Panasonic Makernote Format Specification</a> by Evan Hunter. @version $Rev: 581 $ @author Andreas Huggel (ahu) @@ -59,27 +59,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createPanasonicMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -105,8 +105,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -118,7 +118,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Panasonic %MakerNote tags + //! @name Print functions for Panasonic %MakerNote tags //@{ //! Print Quality static std::ostream& print0x0001(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/rcsid.hpp b/src/plugins/exiv2/rcsid.hpp @@ -1,29 +1,29 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*! @file rcsid.hpp - @brief Define an RCS id string in every object file compiled from a source + @brief Define an RCS id string in every object file compiled from a source file that includes rcsid.hpp. - This is a simplified version of the ACE_RCSID macro that is used in the + This is a simplified version of the ACE_RCSID macro that is used in the <a href="http://www.cs.wustl.edu/~schmidt/ACE.html">ACE(TM)</a> distribution. @version $Rev: 538 $ @@ -36,7 +36,7 @@ #if !defined (EXIV2_RCSID) /*! - @brief Macro to store version information in each object file. + @brief Macro to store version information in each object file. Use this macro by including the following two lines at the beginning of each *.cpp file. See the ident(1) manual pages for more information. diff --git a/src/plugins/exiv2/sigmamn.cpp b/src/plugins/exiv2/sigmamn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -51,7 +51,7 @@ namespace Exiv2 { //! @cond IGNORE SigmaMakerNote::RegisterMn::RegisterMn() { - MakerNoteFactory::registerMakerNote("SIGMA", "*", createSigmaMakerNote); + MakerNoteFactory::registerMakerNote("SIGMA", "*", createSigmaMakerNote); MakerNoteFactory::registerMakerNote("FOVEON", "*", createSigmaMakerNote); MakerNoteFactory::registerMakerNote( sigmaIfdId, MakerNote::AutoPtr(new SigmaMakerNote)); @@ -104,7 +104,7 @@ namespace Exiv2 { } int SigmaMakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 10) return 1; @@ -124,9 +124,9 @@ namespace Exiv2 { int rc = 0; // Check the SIGMA or FOVEON prefix if ( header_.size_ < 10 - || std::string(reinterpret_cast<char*>(header_.pData_), 8) + || std::string(reinterpret_cast<char*>(header_.pData_), 8) != std::string("SIGMA\0\0\0", 8) - && std::string(reinterpret_cast<char*>(header_.pData_), 8) + && std::string(reinterpret_cast<char*>(header_.pData_), 8) != std::string("FOVEON\0\0", 8)) { rc = 2; } @@ -197,9 +197,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createSigmaMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new SigmaMakerNote(alloc)); diff --git a/src/plugins/exiv2/sigmamn.hpp b/src/plugins/exiv2/sigmamn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,7 +22,7 @@ @file sigmamn.hpp @brief Sigma and Foveon MakerNote implemented according to the specification <a href="http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html"> - SIGMA and FOVEON EXIF MakerNote Documentation</a> by Foveon. + SIGMA and FOVEON EXIF MakerNote Documentation</a> by Foveon. @version $Rev: 569 $ @author Andreas Huggel (ahu) <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> @@ -58,27 +58,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createSigmaMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -104,8 +104,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} @@ -117,7 +117,7 @@ namespace Exiv2 { AutoPtr clone() const; //@} - //! @name Print functions for Sigma (Foveon) %MakerNote tags + //! @name Print functions for Sigma (Foveon) %MakerNote tags //@{ //! Strip the label from the value and print the remainder static std::ostream& printStripLabel(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/sonymn.cpp b/src/plugins/exiv2/sonymn.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -48,10 +48,10 @@ namespace Exiv2 { //! @cond IGNORE SonyMakerNote::RegisterMn::RegisterMn() { - MakerNoteFactory::registerMakerNote("SONY", "*", createSonyMakerNote); + MakerNoteFactory::registerMakerNote("SONY", "*", createSonyMakerNote); MakerNoteFactory::registerMakerNote( sonyIfdId, MakerNote::AutoPtr(new SonyMakerNote)); - + ExifTags::registerMakerTagInfo(sonyIfdId, tagInfo_); } //! @endcond @@ -86,7 +86,7 @@ namespace Exiv2 { } int SonyMakerNote::readHeader(const byte* buf, - long len, + long len, ByteOrder byteOrder) { if (len < 12) return 1; @@ -102,7 +102,7 @@ namespace Exiv2 { int rc = 0; // Check the SONY prefix if ( header_.size_ < 12 - || std::string(reinterpret_cast<char*>(header_.pData_), 12) + || std::string(reinterpret_cast<char*>(header_.pData_), 12) != std::string("SONY DSC \0\0\0", 12)) { rc = 2; } @@ -136,9 +136,9 @@ namespace Exiv2 { // free functions MakerNote::AutoPtr createSonyMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset) { return MakerNote::AutoPtr(new SonyMakerNote(alloc)); diff --git a/src/plugins/exiv2/sonymn.hpp b/src/plugins/exiv2/sonymn.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -56,27 +56,27 @@ namespace Exiv2 { initialized to operate in the memory management model indicated. The caller owns this copy and the auto-pointer ensures that it will be deleted. - + @param alloc Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. - @param buf Pointer to the makernote character buffer (not used). - @param len Length of the makernote character buffer (not used). - @param byteOrder Byte order in which the Exif data (and possibly the + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the makernote) is encoded (not used). @param offset Offset from the start of the TIFF header of the makernote buffer (not used). - + @return An auto-pointer to a newly created empty MakerNote. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ MakerNote::AutoPtr createSonyMakerNote(bool alloc, - const byte* buf, - long len, - ByteOrder byteOrder, + const byte* buf, + long len, + ByteOrder byteOrder, long offset); // ***************************************************************************** @@ -102,8 +102,8 @@ namespace Exiv2 { //@} //! @name Manipulators - //@{ - int readHeader(const byte* buf, + //@{ + int readHeader(const byte* buf, long len, ByteOrder byteOrder); //@} diff --git a/src/plugins/exiv2/tags.cpp b/src/plugins/exiv2/tags.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -108,13 +108,13 @@ namespace Exiv2 { }; TagInfo::TagInfo( - uint16_t tag, - const char* name, - const char* desc, - IfdId ifdId, + uint16_t tag, + const char* name, + const char* desc, + IfdId ifdId, SectionId sectionId, TypeId typeId, - PrintFct printFct + PrintFct printFct ) : tag_(tag), name_(name), desc_(desc), ifdId_(ifdId), sectionId_(sectionId), typeId_(typeId), printFct_(printFct) @@ -258,7 +258,7 @@ namespace Exiv2 { // End of list marker TagInfo(0xffff, "(UnknownGpsTag)", "Unknown GPSInfo tag", ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue) }; - + // Exif Interoperability IFD Tags static const TagInfo iopTagInfo[] = { TagInfo(0x0001, "InteroperabilityIndex", "Interoperability Identification", iopIfdId, iopTags, asciiString, printValue), @@ -295,8 +295,8 @@ namespace Exiv2 { // this is an array with pointers to one list per IFD. The IfdId is used as the // index into the array. const TagInfo* ExifTags::tagInfos_[] = { - 0, - ifdTagInfo, exifTagInfo, gpsTagInfo, iopTagInfo, ifdTagInfo, + 0, + ifdTagInfo, exifTagInfo, gpsTagInfo, iopTagInfo, ifdTagInfo, 0 }; @@ -348,7 +348,7 @@ namespace Exiv2 { return 0; } // ExifTags::makerTagInfo - const TagInfo* ExifTags::makerTagInfo(const std::string& tagName, + const TagInfo* ExifTags::makerTagInfo(const std::string& tagName, IfdId ifdId) { int i = 0; @@ -503,13 +503,13 @@ namespace Exiv2 { } std::ostream& ExifTags::printTag(std::ostream& os, - uint16_t tag, + uint16_t tag, IfdId ifdId, const Value& value) { if (value.count() == 0) return os; PrintFct fct = printValue; - if (isExifIfd(ifdId)) { + if (isExifIfd(ifdId)) { int idx = tagInfoIdx(tag, ifdId); if (idx != -1) { fct = tagInfos_[ifdId][idx].printFct_; @@ -575,7 +575,7 @@ namespace Exiv2 { } ExifKey::ExifKey(const Entry& e) - : tag_(e.tag()), ifdId_(e.ifdId()), + : tag_(e.tag()), ifdId_(e.ifdId()), ifdItem_(ExifTags::ifdItem(e.ifdId())), idx_(e.idx()), key_("") { @@ -606,9 +606,9 @@ namespace Exiv2 { std::string ExifKey::tagName() const { - return ExifTags::tagName(tag_, ifdId_); + return ExifTags::tagName(tag_, ifdId_); } - + ExifKey::AutoPtr ExifKey::clone() const { return AutoPtr(clone_()); @@ -619,9 +619,9 @@ namespace Exiv2 { return new ExifKey(*this); } - std::string ExifKey::sectionName() const + std::string ExifKey::sectionName() const { - return ExifTags::sectionName(tag(), ifdId()); + return ExifTags::sectionName(tag(), ifdId()); } void ExifKey::decomposeKey() @@ -650,7 +650,7 @@ namespace Exiv2 { } // Convert tag uint16_t tag = ExifTags::tag(tagName, ifdId); - + // Translate hex tag name (0xabcd) to a real tag name if there is one tagName = ExifTags::tagName(tag, ifdId); @@ -662,11 +662,11 @@ namespace Exiv2 { void ExifKey::makeKey() { - key_ = std::string(familyName_) + key_ = std::string(familyName_) + "." + ifdItem_ + "." + ExifTags::tagName(tag_, ifdId_); } - + // ************************************************************************* // free functions @@ -684,46 +684,46 @@ namespace Exiv2 { return rc; } // isExifIfd - std::ostream& operator<<(std::ostream& os, const TagInfo& ti) + std::ostream& operator<<(std::ostream& os, const TagInfo& ti) { ExifKey exifKey(ti.tag_, ExifTags::ifdItem(ti.ifdId_)); return os << ExifTags::tagName(ti.tag_, ti.ifdId_) << ", " << std::dec << ti.tag_ << ", " - << "0x" << std::setw(4) << std::setfill('0') + << "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << ti.tag_ << ", " << ExifTags::ifdName(ti.ifdId_) << ", " - << exifKey.key() << ", " + << exifKey.key() << ", " << TypeInfo::typeName( ExifTags::tagType(ti.tag_, ti.ifdId_)) << ", " << ExifTags::tagDesc(ti.tag_, ti.ifdId_); } - std::ostream& operator<<(std::ostream& os, const Rational& r) + std::ostream& operator<<(std::ostream& os, const Rational& r) { return os << r.first << "/" << r.second; } - std::istream& operator>>(std::istream& is, Rational& r) - { + std::istream& operator>>(std::istream& is, Rational& r) + { int32_t nominator; int32_t denominator; char c; - is >> nominator >> c >> denominator; + is >> nominator >> c >> denominator; if (is && c == '/') r = std::make_pair(nominator, denominator); return is; } - std::ostream& operator<<(std::ostream& os, const URational& r) - { + std::ostream& operator<<(std::ostream& os, const URational& r) + { return os << r.first << "/" << r.second; } - std::istream& operator>>(std::istream& is, URational& r) + std::istream& operator>>(std::istream& is, URational& r) { uint32_t nominator; uint32_t denominator; char c; - is >> nominator >> c >> denominator; + is >> nominator >> c >> denominator; if (is && c == '/') r = std::make_pair(nominator, denominator); return is; } @@ -944,7 +944,7 @@ namespace Exiv2 { else { os << "(" << value << ")"; } - return os; + return os; } std::ostream& print0x9207(std::ostream& os, const Value& value) diff --git a/src/plugins/exiv2/tags.hpp b/src/plugins/exiv2/tags.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -60,8 +60,8 @@ namespace Exiv2 { @brief Section identifiers to logically group tags. A section consists of nothing more than a name, based on the Exif standard. */ - enum SectionId { sectionIdNotSet, - imgStruct, recOffset, imgCharacter, otherTags, exifFormat, + enum SectionId { sectionIdNotSet, + imgStruct, recOffset, imgCharacter, otherTags, exifFormat, exifVersion, imgConfig, userInfo, relatedFile, dateTime, captureCond, gpsTags, iopTags, makerTags, lastSectionId }; @@ -76,7 +76,7 @@ namespace Exiv2 { IfdId ifdId_; //!< IFD id const char* name_; //!< IFD name //! Related IFD item. This is also an IFD name, unique for each IFD. - const char* item_; + const char* item_; }; //! Contains information pertaining to one section @@ -92,9 +92,9 @@ namespace Exiv2 { struct TagInfo { //! Constructor TagInfo( - uint16_t tag, + uint16_t tag, const char* name, - const char* desc, + const char* desc, IfdId ifdId, SectionId sectionId, TypeId typeId, @@ -110,7 +110,7 @@ namespace Exiv2 { }; // struct TagInfo /*! - @brief Helper structure for lookup tables for translations of numeric + @brief Helper structure for lookup tables for translations of numeric tag values to human readable labels. */ struct TagDetails { @@ -152,14 +152,14 @@ namespace Exiv2 { public: /*! - @brief Return the name of the tag or a string with the hexadecimal - value of the tag in the form "0x01ff", if the tag is not - a known Exif tag. + @brief Return the name of the tag or a string with the hexadecimal + value of the tag in the form "0x01ff", if the tag is not + a known Exif tag. @param tag The tag @param ifdId IFD id @return The name of the tag or a string containing the hexadecimal - value of the tag in the form "0x01ff", if this is an unknown + value of the tag in the form "0x01ff", if this is an unknown tag. */ static std::string tagName(uint16_t tag, IfdId ifdId); @@ -168,12 +168,12 @@ namespace Exiv2 { @param tag The tag @param ifdId IFD id @return The description of the tag or a string indicating that - the tag is unknown. + the tag is unknown. */ static const char* tagDesc(uint16_t tag, IfdId ifdId); /*! - @brief Return the tag for one combination of IFD id and tagName. - If the tagName is not known, it expects tag names in the + @brief Return the tag for one combination of IFD id and tagName. + If the tagName is not known, it expects tag names in the form "0x01ff" and converts them to unsigned integer. @throw Error if the tagname or ifdId is invalid @@ -188,21 +188,21 @@ namespace Exiv2 { //! Return the name of the section static const char* sectionName(SectionId sectionId); /*! - @brief Return the name of the section for a combination of + @brief Return the name of the section for a combination of tag and IFD id. @param tag The tag @param ifdId IFD id - @return The name of the section or a string indicating that the - section or the tag is unknown. + @return The name of the section or a string indicating that the + section or the tag is unknown. */ static const char* sectionName(uint16_t tag, IfdId ifdId); /*! - @brief Return the description of the section for a combination of + @brief Return the description of the section for a combination of tag and IFD id. @param tag The tag @param ifdId IFD id @return The description of the section or a string indicating that - the section or the tag is unknown. + the section or the tag is unknown. */ static const char* sectionDesc(uint16_t tag, IfdId ifdId); //! Return the section id for a section name @@ -211,7 +211,7 @@ namespace Exiv2 { static TypeId tagType(uint16_t tag, IfdId ifdId); //! Interpret and print the value of an Exif tag static std::ostream& printTag(std::ostream& os, - uint16_t tag, + uint16_t tag, IfdId ifdId, const Value& value); //! Print a list of all standard Exif tags to output stream @@ -228,7 +228,7 @@ namespace Exiv2 { static void registerMakerTagInfo(IfdId ifdId, const TagInfo* tagInfo); /*! @brief Return true if \em ifdId is an %Ifd Id which is registered - as a makernote %Ifd id. Note: Calling this function with + as a makernote %Ifd id. Note: Calling this function with makerIfd returns false. */ static bool isMakerIfd(IfdId ifdId); @@ -236,7 +236,7 @@ namespace Exiv2 { private: static int tagInfoIdx(uint16_t tag, IfdId ifdId); static const TagInfo* makerTagInfo(uint16_t tag, IfdId ifdId); - static const TagInfo* makerTagInfo(const std::string& tagName, + static const TagInfo* makerTagInfo(const std::string& tagName, IfdId ifdId); static const IfdInfo ifdInfo_[]; @@ -266,14 +266,14 @@ namespace Exiv2 { @param key The key string. @throw Error if the first part of the key is not '<b>Exif</b>' or the remainin parts of the key cannot be parsed and - converted to an ifd-item and tag name. + converted to an ifd-item and tag name. */ explicit ExifKey(const std::string& key); /*! - @brief Constructor to create an Exif key from a tag and IFD item + @brief Constructor to create an Exif key from a tag and IFD item string. @param tag The tag value - @param ifdItem The IFD string. For MakerNote tags, this must be the + @param ifdItem The IFD string. For MakerNote tags, this must be the IFD item of the specific MakerNote. "MakerNote" is not allowed. @throw Error if the key cannot be constructed from the tag and IFD item parameters. @@ -301,7 +301,7 @@ namespace Exiv2 { /*! @brief Return the name of the group (the second part of the key). For Exif keys, the group name is the IFD item. - */ + */ virtual std::string groupName() const { return ifdItem(); } virtual std::string tagName() const; virtual uint16_t tag() const { return tag_; } @@ -313,7 +313,7 @@ namespace Exiv2 { const char* ifdName() const { return ExifTags::ifdName(ifdId()); } //! Return the related image item std::string ifdItem() const { return ifdItem_; } - //! Return the name of the Exif section (deprecated) + //! Return the name of the Exif section (deprecated) std::string sectionName() const; //! Return the index (unique id of this key within the original IFD) int idx() const { return idx_; } @@ -323,12 +323,12 @@ namespace Exiv2 { //! @name Manipulators //@{ /*! - @brief Set the key corresponding to the tag and IFD id. + @brief Set the key corresponding to the tag and IFD id. The key is of the form '<b>Exif</b>.ifdItem.tagName'. */ void makeKey(); /*! - @brief Parse and convert the key string into tag and IFD Id. + @brief Parse and convert the key string into tag and IFD Id. Updates data members if the string can be decomposed, or throws \em Error . @@ -338,7 +338,7 @@ namespace Exiv2 { //@} private: - //! Internal virtual copy constructor. + //! Internal virtual copy constructor. virtual ExifKey* clone_() const; // DATA @@ -346,7 +346,7 @@ namespace Exiv2 { uint16_t tag_; //!< Tag value IfdId ifdId_; //!< The IFD associated with this tag - std::string ifdItem_; //!< The IFD item + std::string ifdItem_; //!< The IFD item int idx_; //!< Unique id of an entry within one IFD std::string key_; //!< Key }; // class ExifKey @@ -384,7 +384,7 @@ namespace Exiv2 { std::ostream& print0x0112(std::ostream& os, const Value& value); //! Print the YCbCrPositioning std::ostream& print0x0213(std::ostream& os, const Value& value); - //! Print the Copyright + //! Print the Copyright std::ostream& print0x8298(std::ostream& os, const Value& value); //! Print the Exposure time std::ostream& print0x829a(std::ostream& os, const Value& value); @@ -424,7 +424,7 @@ namespace Exiv2 { std::ostream& print0xa403(std::ostream& os, const Value& value); //! Print digital zoom ratio std::ostream& print0xa404(std::ostream& os, const Value& value); - //! Print 35mm equivalent focal length + //! Print 35mm equivalent focal length std::ostream& print0xa405(std::ostream& os, const Value& value); //! Print scene capture type std::ostream& print0xa406(std::ostream& os, const Value& value); diff --git a/src/plugins/exiv2/types.cpp b/src/plugins/exiv2/types.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -89,14 +89,14 @@ namespace Exiv2 { { return typeInfoTable_[ typeId < lastTypeId ? typeId : 0 ].size_; } - + DataBuf::DataBuf(DataBuf& rhs) : pData_(rhs.pData_), size_(rhs.size_) { rhs.release(); } - DataBuf::DataBuf(byte* pData, long size) + DataBuf::DataBuf(byte* pData, long size) : pData_(0), size_(0) { if (size > 0) { @@ -114,12 +114,12 @@ namespace Exiv2 { } void DataBuf::alloc(long size) - { + { if (size > size_) { - delete[] pData_; - size_ = size; + delete[] pData_; + size_ = size; pData_ = new byte[size]; - } + } } std::pair<byte*, long> DataBuf::release() @@ -155,11 +155,11 @@ namespace Exiv2 { uint32_t getULong(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { - return (byte)buf[3] << 24 | (byte)buf[2] << 16 + return (byte)buf[3] << 24 | (byte)buf[2] << 16 | (byte)buf[1] << 8 | (byte)buf[0]; } else { - return (byte)buf[0] << 24 | (byte)buf[1] << 16 + return (byte)buf[0] << 24 | (byte)buf[1] << 16 | (byte)buf[2] << 8 | (byte)buf[3]; } } @@ -184,11 +184,11 @@ namespace Exiv2 { int32_t getLong(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { - return (byte)buf[3] << 24 | (byte)buf[2] << 16 + return (byte)buf[3] << 24 | (byte)buf[2] << 16 | (byte)buf[1] << 8 | (byte)buf[0]; } else { - return (byte)buf[0] << 24 | (byte)buf[1] << 16 + return (byte)buf[0] << 24 | (byte)buf[1] << 16 | (byte)buf[2] << 8 | (byte)buf[3]; } } @@ -276,13 +276,13 @@ namespace Exiv2 { void hexdump(std::ostream& os, const byte* buf, long len, long offset) { - const std::string::size_type pos = 8 + 16 * 3 + 2; - const std::string align(pos, ' '); + const std::string::size_type pos = 8 + 16 * 3 + 2; + const std::string align(pos, ' '); long i = 0; while (i < len) { - os << " " - << std::setw(4) << std::setfill('0') << std::hex + os << " " + << std::setw(4) << std::setfill('0') << std::hex << i + offset << " "; std::ostringstream ss; do { @@ -302,8 +302,8 @@ namespace Exiv2 { int temp; if (a < b) { temp = a; - a = b; - b = temp; + a = b; + b = temp; } while ((temp = a % b) != 0) { a = b; @@ -317,8 +317,8 @@ namespace Exiv2 { long temp; if (a < b) { temp = a; - a = b; - b = temp; + a = b; + b = temp; } while ((temp = a % b) != 0) { a = b; @@ -329,11 +329,11 @@ namespace Exiv2 { bool isHex(const std::string& str, size_t size, const std::string& prefix) { - if ( str.size() <= prefix.size() + if ( str.size() <= prefix.size() || str.substr(0, prefix.size()) != prefix) return false; if ( size > 0 && str.size() != size + prefix.size()) return false; - + for (size_t i = prefix.size(); i < str.size(); ++i) { if (!isxdigit(str[i])) return false; } diff --git a/src/plugins/exiv2/types.hpp b/src/plugins/exiv2/types.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -77,19 +77,19 @@ namespace Exiv2 { enum ByteOrder { invalidByteOrder, littleEndian, bigEndian }; //! Type identifiers for IFD format types - enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort, - unsignedLong, unsignedRational, invalid6, undefined, - signedShort, signedLong, signedRational, - string, date, time, + enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort, + unsignedLong, unsignedRational, invalid6, undefined, + signedShort, signedLong, signedRational, + string, date, time, comment, lastTypeId }; // Todo: decentralize IfdId, so that new ids can be defined elsewhere //! Type to specify the IFD to which a metadata belongs - enum IfdId { ifdIdNotSet, - ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id, + enum IfdId { ifdIdNotSet, + ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id, canonIfdId, canonCs1IfdId, canonCs2IfdId, canonCfIfdId, - fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId, + fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId, olympusIfdId, panasonicIfdId, sigmaIfdId, sonyIfdId, lastIfdId }; @@ -102,7 +102,7 @@ namespace Exiv2 { TypeInfoTable(TypeId typeId, const char* name, long size); TypeId typeId_; //!< Type id const char* name_; //!< Name of the type - long size_; //!< Bytes per data entry + long size_; //!< Bytes per data entry }; // struct TypeInfoTable //! Type information lookup functions. Implemented as a static class. @@ -151,12 +151,12 @@ namespace Exiv2 { //@{ //! Default constructor DataBuf() : pData_(0), size_(0) {} - //! Constructor with an initial buffer size + //! Constructor with an initial buffer size explicit DataBuf(long size) : pData_(new byte[size]), size_(size) {} //! Constructor, copies an existing buffer DataBuf(byte* pData, long size); - /*! - @brief Copy constructor. Transfers the buffer to the newly created + /*! + @brief Copy constructor. Transfers the buffer to the newly created object similar to std::auto_ptr, i.e., the original object is modified. */ @@ -169,14 +169,14 @@ namespace Exiv2 { //@{ /*! @brief Assignment operator. Transfers the buffer and releases the - buffer at the original object similar to std::auto_ptr, i.e., + buffer at the original object similar to std::auto_ptr, i.e., the original object is modified. */ DataBuf& operator=(DataBuf& rhs); //! Allocate a data buffer of the given size void alloc(long size); /*! - @brief Release ownership of the buffer to the caller. Returns the + @brief Release ownership of the buffer to the caller. Returns the buffer as a data pointer and size pair, resets the internal buffer. */ @@ -188,7 +188,7 @@ namespace Exiv2 { /*! @name Conversions - Special conversions with auxiliary type to enable copies + Special conversions with auxiliary type to enable copies and assignments, similar to those used for std::auto_ptr. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion. */ @@ -202,7 +202,7 @@ namespace Exiv2 { //! Pointer to the buffer, 0 if none has been allocated byte* pData_; //! The current size of the buffer - long size_; + long size_; }; // class DataBuf @@ -232,7 +232,7 @@ namespace Exiv2 { std::istream& operator>>(std::istream& is, URational& r); /*! - @brief Convert an unsigned short to data, write the data to the buffer, + @brief Convert an unsigned short to data, write the data to the buffer, return number of bytes written. */ long us2Data(byte* buf, uint16_t s, ByteOrder byteOrder); @@ -247,7 +247,7 @@ namespace Exiv2 { */ long ur2Data(byte* buf, URational l, ByteOrder byteOrder); /*! - @brief Convert a signed short to data, write the data to the buffer, + @brief Convert a signed short to data, write the data to the buffer, return number of bytes written. */ long s2Data(byte* buf, int16_t s, ByteOrder byteOrder); @@ -276,17 +276,17 @@ namespace Exiv2 { int gcd(int a, int b); /*! - @brief Return the greatest common denominator of long values a and b. + @brief Return the greatest common denominator of long values a and b. Both parameters must be greater than 0. */ long lgcd(long a, long b); /*! @brief Return true if str is a hex number starting with prefix followed - by size hex digits, false otherwise. If size is 0, any number of + by size hex digits, false otherwise. If size is 0, any number of digits is allowed and all are checked. */ - bool isHex(const std::string& str, + bool isHex(const std::string& str, size_t size =0, const std::string& prefix =""); @@ -294,7 +294,7 @@ namespace Exiv2 { // template and inline definitions //! Utility function to convert the argument of any type to a string - template<typename T> + template<typename T> std::string toString(const T& arg) { std::ostringstream os; diff --git a/src/plugins/exiv2/value.cpp b/src/plugins/exiv2/value.cpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -183,7 +183,7 @@ namespace Exiv2 { void StringValueBase::read(const byte* buf, long len, ByteOrder byteOrder) { - // byteOrder not needed + // byteOrder not needed value_ = std::string(reinterpret_cast<const char*>(buf), len); } @@ -243,7 +243,7 @@ namespace Exiv2 { } CommentValue::CharsetTable::CharsetTable(CharsetId charsetId, - const char* name, + const char* name, const char* code) : charsetId_(charsetId), name_(name), code_(code) { @@ -343,15 +343,15 @@ namespace Exiv2 { const std::string code = value_.substr(0, 8); charsetId = CharsetInfo::charsetIdByCode(code); } - return charsetId; + return charsetId; } CommentValue* CommentValue::clone_() const { - return new CommentValue(*this); + return new CommentValue(*this); } - DateValue::DateValue(int year, int month, int day) + DateValue::DateValue(int year, int month, int day) : Value(date) { date_.year = year; @@ -371,22 +371,22 @@ namespace Exiv2 { void DateValue::read(const byte* buf, long len, ByteOrder byteOrder) { - // byteOrder not needed + // byteOrder not needed // Hard coded to read Iptc style dates if (len != 8) throw Error(29); - int scanned = sscanf(reinterpret_cast<const char*>(buf), - "%4d%2d%2d", + int scanned = sscanf(reinterpret_cast<const char*>(buf), + "%4d%2d%2d", &date_.year, &date_.month, &date_.day); if (scanned != 3) throw Error(29); } void DateValue::read(const std::string& buf) { - // byteOrder not needed + // byteOrder not needed // Hard coded to read Iptc style dates if (buf.length() < 8) throw Error(29); - int scanned = sscanf(buf.data(), - "%4d-%d-%d", + int scanned = sscanf(buf.data(), + "%4d-%d-%d", &date_.year, &date_.month, &date_.day); if (scanned != 3) throw Error(29); } @@ -397,14 +397,14 @@ namespace Exiv2 { date_.month = src.month; date_.day = src.day; } - + long DateValue::copy(byte* buf, ByteOrder byteOrder) const { // byteOrder not needed // sprintf wants to add the null terminator, so use oversized buffer char temp[9]; - int wrote = sprintf( temp, "%04d%02d%02d", + int wrote = sprintf( temp, "%04d%02d%02d", date_.year, date_.month, date_.day); assert(wrote == 8); memcpy(buf, temp, 8); @@ -428,7 +428,7 @@ namespace Exiv2 { << std::setw(2) << std::setfill('0') << date_.day; } - long DateValue::toLong(long n) const + long DateValue::toLong(long n) const { // Range of tm struct is limited to about 1970 to 2038 // This will return -1 if outside that range @@ -440,8 +440,8 @@ namespace Exiv2 { return static_cast<long>(std::mktime(&tms)); } - TimeValue::TimeValue(int hour, int minute, - int second, int tzHour, + TimeValue::TimeValue(int hour, int minute, + int second, int tzHour, int tzMinute) : Value(date) { @@ -462,13 +462,13 @@ namespace Exiv2 { void TimeValue::read(const byte* buf, long len, ByteOrder byteOrder) { - // byteOrder not needed + // byteOrder not needed // Hard coded to read Iptc style times if (len != 11) throw Error(30); char plusMinus; - int scanned = sscanf(reinterpret_cast<const char*>(buf), - "%2d%2d%2d%1c%2d%2d", - &time_.hour, &time_.minute, &time_.second, + int scanned = sscanf(reinterpret_cast<const char*>(buf), + "%2d%2d%2d%1c%2d%2d", + &time_.hour, &time_.minute, &time_.second, &plusMinus, &time_.tzHour, &time_.tzMinute ); if (scanned != 6) throw Error(30); @@ -480,13 +480,13 @@ namespace Exiv2 { void TimeValue::read(const std::string& buf) { - // byteOrder not needed + // byteOrder not needed // Hard coded to read Iptc style times if (buf.length() < 9) throw Error(30); char plusMinus; int scanned = sscanf(buf.data(), - "%d:%d:%d%1c%d:%d", - &time_.hour, &time_.minute, &time_.second, + "%d:%d:%d%1c%d:%d", + &time_.hour, &time_.minute, &time_.second, &plusMinus, &time_.tzHour, &time_.tzMinute ); if (scanned != 6) throw Error(30); @@ -500,7 +500,7 @@ namespace Exiv2 { { memcpy(&time_, &src, sizeof(time_)); } - + long TimeValue::copy(byte* buf, ByteOrder byteOrder) const { // byteOrder not needed @@ -509,9 +509,9 @@ namespace Exiv2 { char plusMinus = '+'; if (time_.tzHour < 0 || time_.tzMinute < 0) plusMinus = '-'; - int wrote = sprintf(temp, - "%02d%02d%02d%1c%02d%02d", - time_.hour, time_.minute, time_.second, + int wrote = sprintf(temp, + "%02d%02d%02d%1c%02d%02d", + time_.hour, time_.minute, time_.second, plusMinus, abs(time_.tzHour), abs(time_.tzMinute)); assert(wrote == 11); @@ -533,7 +533,7 @@ namespace Exiv2 { { char plusMinus = '+'; if (time_.tzHour < 0 || time_.tzMinute < 0) plusMinus = '-'; - + return os << std::right << std::setw(2) << std::setfill('0') << time_.hour << ':' << std::setw(2) << std::setfill('0') << time_.minute << ':' @@ -542,9 +542,9 @@ namespace Exiv2 { << std::setw(2) << std::setfill('0') << abs(time_.tzMinute); } - long TimeValue::toLong(long n) const + long TimeValue::toLong(long n) const { - // Returns number of seconds in the day in UTC. + // Returns number of seconds in the day in UTC. long result = (time_.hour - time_.tzHour) * 60 * 60; result += (time_.minute - time_.tzMinute) * 60; result += time_.second; diff --git a/src/plugins/exiv2/value.hpp b/src/plugins/exiv2/value.hpp @@ -1,19 +1,19 @@ // ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net> - * + * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -50,7 +50,7 @@ namespace Exiv2 { // class definitions /*! - @brief Common interface for all types of values used with metadata. + @brief Common interface for all types of values used with metadata. The interface provides a uniform way to access values independent from their actual C++ type for simple tasks like reading the values from a @@ -66,7 +66,7 @@ namespace Exiv2 { //! @name Creators //@{ //! Constructor, taking a type id to initialize the base class with - explicit Value(TypeId typeId) + explicit Value(TypeId typeId) : type_(typeId) {} //! Copy constructor Value(const Value& rhs) @@ -81,14 +81,14 @@ namespace Exiv2 { @brief Read the value from a character buffer. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Applicable byte order (little or big endian). */ virtual void read(const byte* buf, long len, ByteOrder byteOrder) =0; - /*! + /*! @brief Set the value from a string buffer. The format of the string corresponds to that of the write() method, i.e., a string - obtained through the write() method can be read by this + obtained through the write() method can be read by this function. @param buf The string to read from. @@ -115,12 +115,12 @@ namespace Exiv2 { TypeId typeId() const { return type_; } /*! @brief Return the value as a string. Implemented in terms of - write(std::ostream& os) const of the concrete class. + write(std::ostream& os) const of the concrete class. */ std::string toString() const; /*! @brief Return an auto-pointer to a copy of itself (deep copy). - The caller owns this copy and the auto-pointer ensures that + The caller owns this copy and the auto-pointer ensures that it will be deleted. */ AutoPtr clone() const { return AutoPtr(clone_()); } @@ -139,10 +139,10 @@ namespace Exiv2 { virtual long count() const =0; //! Return the size of the value in bytes virtual long size() const =0; - /*! + /*! @brief Write the value to an output stream. You do not usually have - to use this function; it is used for the implementation of - the output operator for %Value, + to use this function; it is used for the implementation of + the output operator for %Value, operator<<(std::ostream &os, const Value &value). */ virtual std::ostream& write(std::ostream& os) const =0; @@ -151,7 +151,7 @@ namespace Exiv2 { behaviour of this method may be undefined if there is no n-th component. - @return The converted value. + @return The converted value. */ virtual long toLong(long n =0) const =0; /*! @@ -159,7 +159,7 @@ namespace Exiv2 { behaviour of this method may be undefined if there is no n-th component. - @return The converted value. + @return The converted value. */ virtual float toFloat(long n =0) const =0; /*! @@ -167,7 +167,7 @@ namespace Exiv2 { behaviour of this method may be undefined if there is no n-th component. - @return The converted value. + @return The converted value. */ virtual Rational toRational(long n =0) const =0; //! Return the size of the data area, 0 if there is none. @@ -175,7 +175,7 @@ namespace Exiv2 { /*! @brief Return a copy of the data area if the value has one. The caller owns this copy and DataBuf ensures that it will be - deleted. + deleted. Values may have a data area, which can contain additional information besides the actual value. This method is used to access @@ -251,7 +251,7 @@ namespace Exiv2 { //! Constructor DataValue(const byte* buf, long len, ByteOrder byteOrder =invalidByteOrder, - TypeId typeId =undefined) + TypeId typeId =undefined) : Value(typeId) { read(buf, len, byteOrder); } //! Virtual destructor. virtual ~DataValue() {} @@ -262,17 +262,17 @@ namespace Exiv2 { //! Assignment operator. DataValue& operator=(const DataValue& rhs); /*! - @brief Read the value from a character buffer. + @brief Read the value from a character buffer. - @note The byte order is required by the interface but not + @note The byte order is required by the interface but not used by this method, so just use the default. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Byte order. Not needed. */ virtual void read(const byte* buf, - long len, + long len, ByteOrder byteOrder =invalidByteOrder); //! Set the data from a string of integer values (e.g., "0 1 2 3") virtual void read(const std::string& buf); @@ -282,7 +282,7 @@ namespace Exiv2 { //@{ AutoPtr clone() const { return AutoPtr(clone_()); } /*! - @brief Write value to a character data buffer. + @brief Write value to a character data buffer. @note The byte order is required by the interface but not used by this method, so just use the default. @@ -313,9 +313,9 @@ namespace Exiv2 { }; // class DataValue /*! - @brief Abstract base class for a string based %Value type. + @brief Abstract base class for a string based %Value type. - Uses a std::string to store the value and implements defaults for + Uses a std::string to store the value and implements defaults for most operations. */ class StringValueBase : public Value { @@ -334,7 +334,7 @@ namespace Exiv2 { //! Copy constructor StringValueBase(const StringValueBase& rhs) : Value(rhs), value_(rhs.value_) {} - + //! Virtual destructor. virtual ~StringValueBase() {} //@} @@ -352,11 +352,11 @@ namespace Exiv2 { method, so just use the default. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Byte order. Not needed. */ - virtual void read(const byte* buf, - long len, + virtual void read(const byte* buf, + long len, ByteOrder byteOrder =invalidByteOrder); //@} @@ -390,7 +390,7 @@ namespace Exiv2 { //! Internal virtual copy constructor. virtual StringValueBase* clone_() const =0; // DATA - std::string value_; //!< Stores the string value. + std::string value_; //!< Stores the string value. }; // class StringValueBase @@ -409,12 +409,12 @@ namespace Exiv2 { //! @name Creators //@{ //! Default constructor. - StringValue() + StringValue() : StringValueBase(string) {} //! Constructor - StringValue(const std::string& buf) + StringValue(const std::string& buf) : StringValueBase(string, buf) {} - //! Copy constructor + //! Copy constructor StringValue(const StringValue& rhs) : StringValueBase(rhs) {} //! Virtual destructor. @@ -438,9 +438,9 @@ namespace Exiv2 { }; // class StringValue /*! - @brief %Value for an Ascii string type. + @brief %Value for an Ascii string type. - This class is for null terminated single byte Ascii strings. + This class is for null terminated single byte Ascii strings. This class also ensures that the string is null terminated. */ class AsciiValue : public StringValueBase { @@ -451,10 +451,10 @@ namespace Exiv2 { //! @name Creators //@{ //! Default constructor. - AsciiValue() + AsciiValue() : StringValueBase(asciiString) {} //! Constructor - AsciiValue(const std::string &buf) + AsciiValue(const std::string &buf) : StringValueBase(asciiString, buf) {} //! Copy constructor AsciiValue(const AsciiValue& rhs) @@ -478,7 +478,7 @@ namespace Exiv2 { //! @name Accessors //@{ AutoPtr clone() const { return AutoPtr(clone_()); } - /*! + /*! @brief Write the value to an output stream. Any trailing '\\0' characters of the ASCII value are stripped and not written to the output stream. @@ -508,12 +508,12 @@ namespace Exiv2 { //! Information pertaining to the defined character sets struct CharsetTable { //! Constructor - CharsetTable(CharsetId charsetId, - const char* name, + CharsetTable(CharsetId charsetId, + const char* name, const char* code); CharsetId charsetId_; //!< Charset id const char* name_; //!< Name of the charset - const char* code_; //!< Code of the charset + const char* code_; //!< Code of the charset }; // struct CharsetTable //! Charset information lookup functions. Implemented as a static class. class CharsetInfo { @@ -523,7 +523,7 @@ namespace Exiv2 { CharsetInfo(const CharsetInfo&); //! Prevent assignment: not implemented. CharsetInfo& operator=(const CharsetInfo&); - + public: //! Return the name for a charset id static const char* name(CharsetId charsetId); @@ -533,7 +533,7 @@ namespace Exiv2 { static CharsetId charsetIdByName(const std::string& name); //! Return the charset id for a code static CharsetId charsetIdByCode(const std::string& code); - + private: static const CharsetTable charsetTable_[]; }; // class CharsetInfo @@ -548,7 +548,7 @@ namespace Exiv2 { : StringValueBase(Exiv2::undefined) {} //! Constructor, uses read(const std::string& comment) CommentValue(const std::string& comment); - //! Copy constructor + //! Copy constructor CommentValue(const CommentValue& rhs) : StringValueBase(rhs) {} //! Virtual destructor. @@ -561,10 +561,10 @@ namespace Exiv2 { CommentValue& operator=(const CommentValue& rhs); /*! @brief Read the value from a comment - + The format of \em comment is: <BR> - <CODE>[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment</CODE> + <CODE>[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment</CODE> <BR> The default charset is Undefined. @@ -577,7 +577,7 @@ namespace Exiv2 { //@{ AutoPtr clone() const { return AutoPtr(clone_()); } /*! - @brief Write the comment in a format which can be read by + @brief Write the comment in a format which can be read by read(const std::string& comment). */ std::ostream& write(std::ostream& os) const; @@ -593,7 +593,7 @@ namespace Exiv2 { }; // class CommentValue - /*! + /*! @brief %Value for simple ISO 8601 dates This class is limited to parsing simple date strings in the ISO 8601 @@ -615,7 +615,7 @@ namespace Exiv2 { //@} //! Simple Date helper structure - struct Date + struct Date { int year; //!< Year int month; //!< Month @@ -633,16 +633,16 @@ namespace Exiv2 { method, so just use the default. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Byte order. Not needed. @throw Error in case of an unsupported date format */ - virtual void read(const byte* buf, - long len, + virtual void read(const byte* buf, + long len, ByteOrder byteOrder =invalidByteOrder); /*! - @brief Set the value to that of the string buf. + @brief Set the value to that of the string buf. @param buf String containing the date @@ -674,12 +674,12 @@ namespace Exiv2 { virtual const Date& getDate() const { return date_; } virtual long count() const { return size(); } virtual long size() const; - /*! + /*! @brief Write the value to an output stream. . */ virtual std::ostream& write(std::ostream& os) const; virtual long toLong(long n =0) const; - virtual float toFloat(long n =0) const + virtual float toFloat(long n =0) const { return static_cast<float>(toLong(n)); } virtual Rational toRational(long n =0) const { return Rational(toLong(n), 1); } @@ -691,7 +691,7 @@ namespace Exiv2 { // DATA Date date_; - }; // class DateValue + }; // class DateValue /*! @brief %Value for simple ISO 8601 times. @@ -711,7 +711,7 @@ namespace Exiv2 { //! Default constructor. TimeValue() : Value(time) { memset(&time_, 0, sizeof(time_)); } //! Constructor - TimeValue(int hour, int minute, int second =0, + TimeValue(int hour, int minute, int second =0, int tzHour =0, int tzMinute =0); //! Virtual destructor. @@ -719,7 +719,7 @@ namespace Exiv2 { //@} //! Simple Time helper structure - struct Time + struct Time { int hour; //!< Hour int minute; //!< Minute @@ -739,16 +739,16 @@ namespace Exiv2 { method, so just use the default. @param buf Pointer to the data buffer to read from - @param len Number of bytes in the data buffer + @param len Number of bytes in the data buffer @param byteOrder Byte order. Not needed. @throw Error in case of an unsupported time format */ - virtual void read(const byte* buf, - long len, + virtual void read(const byte* buf, + long len, ByteOrder byteOrder =invalidByteOrder); /*! - @brief Set the value to that of the string buf. + @brief Set the value to that of the string buf. @param buf String containing the time. @@ -780,12 +780,12 @@ namespace Exiv2 { virtual const Time& getTime() const { return time_; } virtual long count() const { return size(); } virtual long size() const; - /*! + /*! @brief Write the value to an output stream. . */ virtual std::ostream& write(std::ostream& os) const; virtual long toLong(long n =0) const; - virtual float toFloat(long n =0) const + virtual float toFloat(long n =0) const { return static_cast<float>(toLong(n)); } virtual Rational toRational(long n =0) const { return Rational(toLong(n), 1); } @@ -797,7 +797,7 @@ namespace Exiv2 { // DATA Time time_; - }; // class TimeValue + }; // class TimeValue //! Template to determine the TypeId for a type T template<typename T> TypeId getType(); @@ -818,9 +818,9 @@ namespace Exiv2 { // template<typename T> inline TypeId getType() { return invalid; } /*! - @brief Template for a %Value of a basic type. This is used for unsigned + @brief Template for a %Value of a basic type. This is used for unsigned and signed short, long and rationals. - */ + */ template<typename T> class ValueType : public Value { public: @@ -847,9 +847,9 @@ namespace Exiv2 { ValueType<T>& operator=(const ValueType<T>& rhs); virtual void read(const byte* buf, long len, ByteOrder byteOrder); /*! - @brief Set the data from a string of values of type T (e.g., - "0 1 2 3" or "1/2 1/3 1/4" depending on what T is). - Generally, the accepted input format is the same as that + @brief Set the data from a string of values of type T (e.g., + "0 1 2 3" or "1/2 1/3 1/4" depending on what T is). + Generally, the accepted input format is the same as that produced by the write() method. */ virtual void read(const std::string& buf); @@ -879,7 +879,7 @@ namespace Exiv2 { virtual DataBuf dataArea() const; //@} - //! Container for values + //! Container for values typedef std::vector<T> ValueList; //! Iterator type defined for convenience. typedef typename std::vector<T>::iterator iterator; @@ -888,9 +888,9 @@ namespace Exiv2 { // DATA /*! - @brief The container for all values. In your application, if you know + @brief The container for all values. In your application, if you know what subclass of Value you're dealing with (and possibly the T) - then you can access this STL container through the usual + then you can access this STL container through the usual standard library functions. */ ValueList value_; @@ -903,7 +903,7 @@ namespace Exiv2 { //! Pointer to the buffer, 0 if none has been allocated byte* pDataArea_; //! The current size of the buffer - long sizeDataArea_; + long sizeDataArea_; }; // class ValueType //! Unsigned short value type @@ -925,7 +925,7 @@ namespace Exiv2 { /*! @brief Read a value of type T from the data buffer. - We need this template function for the ValueType template classes. + We need this template function for the ValueType template classes. There are only specializations of this function available; no default implementation is provided. @@ -935,37 +935,37 @@ namespace Exiv2 { */ template<typename T> T getValue(const byte* buf, ByteOrder byteOrder); // Specialization for a 2 byte unsigned short value. - template<> + template<> inline uint16_t getValue(const byte* buf, ByteOrder byteOrder) { return getUShort(buf, byteOrder); } // Specialization for a 4 byte unsigned long value. - template<> + template<> inline uint32_t getValue(const byte* buf, ByteOrder byteOrder) { return getULong(buf, byteOrder); } // Specialization for an 8 byte unsigned rational value. - template<> + template<> inline URational getValue(const byte* buf, ByteOrder byteOrder) { return getURational(buf, byteOrder); } // Specialization for a 2 byte signed short value. - template<> + template<> inline int16_t getValue(const byte* buf, ByteOrder byteOrder) { return getShort(buf, byteOrder); } // Specialization for a 4 byte signed long value. - template<> + template<> inline int32_t getValue(const byte* buf, ByteOrder byteOrder) { return getLong(buf, byteOrder); } // Specialization for an 8 byte signed rational value. - template<> + template<> inline Rational getValue(const byte* buf, ByteOrder byteOrder) { return getRational(buf, byteOrder); @@ -974,7 +974,7 @@ namespace Exiv2 { /*! @brief Convert a value of type T to data, write the data to the data buffer. - We need this template function for the ValueType template classes. + We need this template function for the ValueType template classes. There are only specializations of this function available; no default implementation is provided. @@ -984,20 +984,20 @@ namespace Exiv2 { @return The number of bytes written to the buffer. */ template<typename T> long toData(byte* buf, T t, ByteOrder byteOrder); - /*! + /*! @brief Specialization to write an unsigned short to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, uint16_t t, ByteOrder byteOrder) { return us2Data(buf, t, byteOrder); } - /*! + /*! @brief Specialization to write an unsigned long to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, uint32_t t, ByteOrder byteOrder) { return ul2Data(buf, t, byteOrder); @@ -1006,25 +1006,25 @@ namespace Exiv2 { @brief Specialization to write an unsigned rational to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, URational t, ByteOrder byteOrder) { return ur2Data(buf, t, byteOrder); } - /*! + /*! @brief Specialization to write a signed short to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, int16_t t, ByteOrder byteOrder) { return s2Data(buf, t, byteOrder); } - /*! + /*! @brief Specialization to write a signed long to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, int32_t t, ByteOrder byteOrder) { return l2Data(buf, t, byteOrder); @@ -1033,14 +1033,14 @@ namespace Exiv2 { @brief Specialization to write a signed rational to the data buffer. Return the number of bytes written. */ - template<> + template<> inline long toData(byte* buf, Rational t, ByteOrder byteOrder) { return r2Data(buf, t, byteOrder); } template<typename T> - ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder) + ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder) : Value(getType<T>()), pDataArea_(0), sizeDataArea_(0) { read(buf, len, byteOrder); @@ -1048,11 +1048,11 @@ namespace Exiv2 { template<typename T> ValueType<T>::ValueType(const T& val, ByteOrder byteOrder) - : Value(getType<T>()), pDataArea_(0), sizeDataArea_(0) + : Value(getType<T>()), pDataArea_(0), sizeDataArea_(0) { - read(reinterpret_cast<const byte*>(&val), - TypeInfo::typeSize(typeId()), - byteOrder); + read(reinterpret_cast<const byte*>(&val), + TypeInfo::typeSize(typeId()), + byteOrder); } template<typename T> @@ -1061,8 +1061,8 @@ namespace Exiv2 { { if (rhs.sizeDataArea_ > 0) { pDataArea_ = new byte[rhs.sizeDataArea_]; - memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_); - sizeDataArea_ = rhs.sizeDataArea_; + memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_); + sizeDataArea_ = rhs.sizeDataArea_; } } @@ -1082,7 +1082,7 @@ namespace Exiv2 { byte* tmp = 0; if (rhs.sizeDataArea_ > 0) { tmp = new byte[rhs.sizeDataArea_]; - memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_); + memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_); } delete[] pDataArea_; pDataArea_ = tmp; @@ -1148,38 +1148,38 @@ namespace Exiv2 { // Default implementation template<typename T> inline long ValueType<T>::toLong(long n) const - { - return value_[n]; + { + return value_[n]; } // Specialization for rational template<> - inline long ValueType<Rational>::toLong(long n) const + inline long ValueType<Rational>::toLong(long n) const { - return value_[n].first / value_[n].second; + return value_[n].first / value_[n].second; } // Specialization for unsigned rational template<> - inline long ValueType<URational>::toLong(long n) const + inline long ValueType<URational>::toLong(long n) const { - return value_[n].first / value_[n].second; + return value_[n].first / value_[n].second; } // Default implementation template<typename T> inline float ValueType<T>::toFloat(long n) const - { - return static_cast<float>(value_[n]); + { + return static_cast<float>(value_[n]); } // Specialization for rational template<> - inline float ValueType<Rational>::toFloat(long n) const + inline float ValueType<Rational>::toFloat(long n) const { - return static_cast<float>(value_[n].first) / value_[n].second; + return static_cast<float>(value_[n].first) / value_[n].second; } // Specialization for unsigned rational template<> - inline float ValueType<URational>::toFloat(long n) const + inline float ValueType<URational>::toFloat(long n) const { - return static_cast<float>(value_[n].first) / value_[n].second; + return static_cast<float>(value_[n].first) / value_[n].second; } // Default implementation template<typename T> @@ -1189,13 +1189,13 @@ namespace Exiv2 { } // Specialization for rational template<> - inline Rational ValueType<Rational>::toRational(long n) const + inline Rational ValueType<Rational>::toRational(long n) const { return Rational(value_[n].first, value_[n].second); } // Specialization for unsigned rational template<> - inline Rational ValueType<URational>::toRational(long n) const + inline Rational ValueType<URational>::toRational(long n) const { return Rational(value_[n].first, value_[n].second); } diff --git a/src/plugins/filenameextractor.c b/src/plugins/filenameextractor.c @@ -24,7 +24,7 @@ /* "extract" the 'filename' as a keyword */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_filename_extract(const char * filename, char * date, size_t size, diff --git a/src/plugins/manextractor.c b/src/plugins/manextractor.c @@ -217,7 +217,7 @@ static void Efree(voidpf opaque, voidpf ptr) { */ #define MAX_READ 2048 -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_man_extract(const char * filename, char * data, size_t size, @@ -225,8 +225,8 @@ libextractor_man_extract(const char * filename, z_stream strm; char * buf; - memset(&strm, - 0, + memset(&strm, + 0, sizeof(z_stream)); strm.next_in = (char*) data; strm.avail_in = size; @@ -247,7 +247,7 @@ libextractor_man_extract(const char * filename, Z_FINISH); if (strm.total_out > 0) { prev = tryParse(buf, - strm.total_out, + strm.total_out, prev); inflateEnd(&strm); free(buf); @@ -255,8 +255,8 @@ libextractor_man_extract(const char * filename, } free(buf); inflateEnd(&strm); - } - return tryParse(data, + } + return tryParse(data, size, prev); } diff --git a/src/plugins/ole2/gsf-infile-msole.c b/src/plugins/ole2/gsf-infile-msole.c @@ -288,8 +288,8 @@ ole_info_get_sb_file (GsfInfileMSOle *parent) g_return_val_if_fail (parent->info->sb.bat.block == NULL, NULL); if (ole_make_bat (&parent->info->bb.bat, - parent->info->num_sbat, - parent->info->sbat_start, + parent->info->num_sbat, + parent->info->sbat_start, &meta_sbat)) { return NULL; } @@ -405,9 +405,9 @@ ole_dirent_new (GsfInfileMSOle *ole, guint32 entry, MSOleDirent *parent) dirent, (GCompareFunc)ole_dirent_cmp); /* NOTE : These links are a tree, not a linked list */ - if (prev != entry) + if (prev != entry) ole_dirent_new (ole, prev, parent); - if (next != entry) + if (next != entry) ole_dirent_new (ole, next, parent); if (dirent->is_directory) @@ -513,7 +513,7 @@ ole_dup (GsfInfileMSOle const * src) * Read an OLE header and do some sanity checking * along the way. * - * Return value: TRUE on error + * Return value: TRUE on error **/ static gboolean ole_init_info (GsfInfileMSOle *ole) @@ -746,7 +746,7 @@ gsf_infile_msole_new_child (GsfInfileMSOle *parent, 0); } child = ole_dup (parent); - if (child == NULL) + if (child == NULL) return NULL; child->dirent = dirent; child->size = (off_t) dirent->size; @@ -880,7 +880,7 @@ gsf_infile_msole_new (struct GsfInput *source) * Returns TRUE on success **/ int -gsf_infile_msole_get_class_id (const GsfInfileMSOle *ole, +gsf_infile_msole_get_class_id (const GsfInfileMSOle *ole, unsigned char * res) { g_return_val_if_fail (ole != NULL && ole->dirent != NULL, 0); diff --git a/src/plugins/ole2/gsf-infile-msole.h b/src/plugins/ole2/gsf-infile-msole.h @@ -54,7 +54,7 @@ gsf_infile_msole_finalize (struct GsfInfileMSOle * ole); * Returns TRUE on success **/ int -gsf_infile_msole_get_class_id (const struct GsfInfileMSOle *ole, +gsf_infile_msole_get_class_id (const struct GsfInfileMSOle *ole, unsigned char *res); #endif /* GSF_INFILE_MSOLE_H */ diff --git a/src/plugins/ole2/gsf-input.c b/src/plugins/ole2/gsf-input.c @@ -51,9 +51,9 @@ gsf_input_init (GsfInput * input) * Returns: A new #GsfInputMemory */ GsfInput * -gsf_input_new (const unsigned char * buf, - off_t length, - int needs_free) +gsf_input_new (const unsigned char * buf, + off_t length, + int needs_free) { GsfInput *mem = malloc(sizeof(GsfInput)); if (mem == NULL) @@ -82,7 +82,7 @@ gsf_input_dup (GsfInput *src) { GsfInput * dst = malloc(sizeof(GsfInput)); if (dst == NULL) - return NULL; + return NULL; gsf_input_init(dst); dst->buf = src->buf; dst->needs_free = 0; diff --git a/src/plugins/ole2/gsf-input.h b/src/plugins/ole2/gsf-input.h @@ -36,8 +36,8 @@ struct GsfInput; * Returns: A new #GsfInputMemory */ struct GsfInput * -gsf_input_new (const unsigned char *buf, - off_t length, +gsf_input_new (const unsigned char *buf, + off_t length, int needs_free); char const * gsf_input_name (struct GsfInput *input); @@ -46,13 +46,13 @@ void gsf_input_finalize (struct GsfInput *input); struct GsfInput * gsf_input_sibling (const struct GsfInput *input, char const *name); off_t gsf_input_size (struct GsfInput *input); int gsf_input_eof (struct GsfInput *input); -const unsigned char * gsf_input_read (struct GsfInput *input, +const unsigned char * gsf_input_read (struct GsfInput *input, size_t num_bytes, unsigned char * optional_buffer); off_t gsf_input_remaining (struct GsfInput *input); off_t gsf_input_tell (struct GsfInput *input); int gsf_input_seek (struct GsfInput *input, - off_t offset, + off_t offset, int whence); int gsf_input_set_name (struct GsfInput *input, char const *name); int gsf_input_set_size (struct GsfInput *input, off_t size); diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -38,10 +38,10 @@ /* using libgobject, needs init! */ void __attribute__ ((constructor)) ole_gobject_init(void) { - g_type_init(); + g_type_init(); } -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { @@ -913,7 +913,7 @@ static struct EXTRACTOR_Keywords * processSO(struct GsfInput * src, return prev; } -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_ole2_extract(const char * filename, char * date, size_t size, @@ -937,14 +937,14 @@ libextractor_ole2_extract(const char * filename, for (i=0;i<gsf_infile_msole_num_children(infile);i++) { name = gsf_infile_msole_name_by_index (infile, i); src = NULL; - if (name == NULL) + if (name == NULL) continue; if ( (0 == strcmp(name, "\005SummaryInformation")) || (0 == strcmp(name, "\005DocumentSummaryInformation")) ) { src = gsf_infile_msole_child_by_index (infile, i); if (src != NULL) prev = process(src, - prev); + prev); } if (0 == strcmp(name, "SfxDocumentInfo")) { src = gsf_infile_msole_child_by_index (infile, i); @@ -954,7 +954,7 @@ libextractor_ole2_extract(const char * filename, } if (src != NULL) gsf_input_finalize(src); - } + } gsf_infile_msole_finalize(infile); return prev; } diff --git a/src/plugins/oo/ooextractor.c b/src/plugins/oo/ooextractor.c @@ -81,17 +81,17 @@ static char *libextractor_oo_getmimetype(unzFile uf) { char * buf = NULL; size_t buf_size = 0; - if (UNZ_OK == unzLocateFile(uf, - "mimetype", + if (UNZ_OK == unzLocateFile(uf, + "mimetype", CASESENSITIVITY)) { if ( (UNZ_OK == unzGetCurrentFileInfo(uf, - &file_info, + &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, - 0) && + 0) && (UNZ_OK == unzOpenCurrentFilePassword(uf,NULL)) ) ) { buf_size = file_info.uncompressed_size; @@ -103,11 +103,11 @@ static char *libextractor_oo_getmimetype(unzFile uf) { free(buf); buf = NULL; } else { - /* found something */ + /* found something */ buf[buf_size] = '\0'; - while ( (0 > buf_size) && - isspace(buf[buf_size - 1])) - buf[--buf_size] = '\0'; + while ( (0 > buf_size) && + isspace(buf[buf_size - 1])) + buf[--buf_size] = '\0'; if('\0' == buf[0]) { free(buf); buf = NULL; @@ -136,8 +136,8 @@ static voidpf Eopen_file_func (voidpf opaque, return NULL; } -static uLong Eread_file_func(voidpf opaque, - voidpf stream, +static uLong Eread_file_func(voidpf opaque, + voidpf stream, void* buf, uLong size) { Ecls * e = opaque; @@ -146,7 +146,7 @@ static uLong Eread_file_func(voidpf opaque, ret = e->size - e->pos; if (ret > size) ret = size; - memcpy(buf, + memcpy(buf, &e->data[e->pos], ret); e->pos += ret; @@ -160,14 +160,14 @@ static long Etell_file_func(voidpf opaque, } static long Eseek_file_func(voidpf opaque, - voidpf stream, - uLong offset, + voidpf stream, + uLong offset, int origin) { Ecls * e = opaque; switch (origin) { case ZLIB_FILEFUNC_SEEK_SET: - e->pos = offset; + e->pos = offset; break; case ZLIB_FILEFUNC_SEEK_END: if (offset > e->size) @@ -185,18 +185,18 @@ static long Eseek_file_func(voidpf opaque, return 0; } -static int Eclose_file_func(voidpf opaque, +static int Eclose_file_func(voidpf opaque, voidpf stream) { return 0; } -static int Etesterror_file_func(voidpf opaque, +static int Etesterror_file_func(voidpf opaque, voidpf stream) { return 0; } -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, char * data, size_t size, @@ -234,11 +234,11 @@ libextractor_oo_extract(const char * filename, return prev; mimetype = libextractor_oo_getmimetype(uf); if (NULL != mimetype) - prev = addKeyword(EXTRACTOR_MIMETYPE, - mimetype, + prev = addKeyword(EXTRACTOR_MIMETYPE, + mimetype, EXTRACTOR_removeKeywordsOfType(prev, EXTRACTOR_MIMETYPE)); - + if (unzLocateFile(uf, METAFILE, diff --git a/src/plugins/splitextractor.c b/src/plugins/splitextractor.c @@ -61,7 +61,7 @@ static void splitKeywords(char * keyword, pos = 0; last = 0; while (pos < len) { - while ((!token(dp[pos], + while ((!token(dp[pos], options)) && (pos < len)) pos++; dp[pos++] = 0; @@ -74,7 +74,7 @@ static void splitKeywords(char * keyword, } /* split other keywords into multiple keywords */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_split_extract(char * filename, char * data, size_t size, diff --git a/src/plugins/tarextractor.c b/src/plugins/tarextractor.c @@ -147,11 +147,11 @@ static void Efree(voidpf opaque, voidpf ptr) { /* do not decompress tar.gz files > 16 MB */ #define MAX_TGZ_SIZE 16 * 1024 * 1024 -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_tar_extract(const char * filename, const unsigned char * data, size_t size, - struct EXTRACTOR_Keywords * prev) { + struct EXTRACTOR_Keywords * prev) { if ( (data[0] == 0x1f) && (data[1] == 0x8b) && (data[2] == 0x08) ) { @@ -182,8 +182,8 @@ libextractor_tar_extract(const char * filename, return prev; } - memset(&strm, - 0, + memset(&strm, + 0, sizeof(z_stream)); strm.next_in = (char*) data; strm.avail_in = size; diff --git a/src/plugins/thumbnail/thumbnailextractor.c b/src/plugins/thumbnail/thumbnailextractor.c @@ -110,7 +110,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename gdk_pixbuf_loader_write(loader, data, size, - NULL); + NULL); in = gdk_pixbuf_loader_get_pixbuf(loader); gdk_pixbuf_loader_close(loader, NULL);