diff --git a/config.h.in b/config.h.in index 62c35f47..bf70b366 100644 --- a/config.h.in +++ b/config.h.in @@ -1,8 +1,29 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have the `alarm' function. */ +#undef HAVE_ALARM + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC @@ -50,6 +71,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -59,6 +83,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL @@ -81,9 +108,20 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME diff --git a/configure.ac b/configure.ac index 2f6f5af6..8ca09025 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PROG_RANLIB # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([malloc.h stdlib.h string.h unistd.h wchar.h libintl.h]) +AC_CHECK_HEADERS([libintl.h malloc.h stdint.h stdlib.h string.h unistd.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/src/canonmn.cpp b/src/canonmn.cpp index 1e95ae20..2a76ba8c 100644 --- a/src/canonmn.cpp +++ b/src/canonmn.cpp @@ -20,7 +20,7 @@ */ /* File: canonmn.cpp - Version: $Name: $ $Revision: 1.13 $ + Version: $Name: $ $Revision: 1.14 $ Author(s): Andreas Huggel (ahu) History: 18-Feb-04, ahu: created 07-Mar-04, ahu: isolated as a separate component @@ -30,7 +30,7 @@ */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: canonmn.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: canonmn.cpp,v $"); // ***************************************************************************** // included header files @@ -78,7 +78,7 @@ namespace Exiv2 { } std::ostream& CanonMakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { @@ -288,7 +288,7 @@ namespace Exiv2 { const Value& value) { std::istringstream is(value.toString()); - uint32 l; + uint32_t l; is >> l; return os << std::setw(4) << std::setfill('0') << std::hex << ((l & 0xffff0000) >> 16) diff --git a/src/canonmn.hpp b/src/canonmn.hpp index 3a15dc75..05c958b9 100644 --- a/src/canonmn.hpp +++ b/src/canonmn.hpp @@ -23,7 +23,7 @@ @brief Canon MakerNote implemented according to the specification EXIF MakerNote of Canon by David Burren - @version $Name: $ $Revision: 1.10 $ + @version $Name: $ $Revision: 1.11 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 18-Feb-04, ahu: created
@@ -101,7 +101,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Canon") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} diff --git a/src/datasets.cpp b/src/datasets.cpp index 65739fd4..fd7c22cd 100644 --- a/src/datasets.cpp +++ b/src/datasets.cpp @@ -20,13 +20,13 @@ */ /* File: datasets.cpp - Version: $Name: $ $Revision: 1.4 $ + Version: $Name: $ $Revision: 1.5 $ Author(s): Brad Schick (brad) History: 24-Jul-04, brad: created */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: datasets.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.5 $ $RCSfile: datasets.cpp,v $"); // ***************************************************************************** // included header files @@ -43,15 +43,15 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: datasets.cpp,v $"); namespace Exiv2 { DataSet::DataSet( - uint16 number, + uint16_t number, const char* name, const char* desc, bool mandatory, bool repeatable, - uint32 minbytes, - uint32 maxbytes, + uint32_t minbytes, + uint32_t maxbytes, TypeId type, - uint16 recordId, + uint16_t recordId, const char* photoshop ) : number_(number), name_(name), desc_(desc), mandatory_(mandatory), @@ -61,7 +61,7 @@ namespace Exiv2 { } RecordInfo::RecordInfo( - uint16 recordId, + uint16_t recordId, const char* name, const char* desc ) @@ -164,7 +164,7 @@ namespace Exiv2 { const char* IptcDataSets::familyName_ = "Iptc"; - int IptcDataSets::dataSetIdx(uint16 number, uint16 recordId) + int IptcDataSets::dataSetIdx(uint16_t number, uint16_t recordId) { if( recordId != envelope && recordId != application2 ) return -1; const DataSet* dataSet = records_[recordId]; @@ -176,7 +176,7 @@ namespace Exiv2 { return idx; } - int IptcDataSets::dataSetIdx(const std::string& dataSetName, uint16 recordId) + int IptcDataSets::dataSetIdx(const std::string& dataSetName, uint16_t recordId) { if( recordId != envelope && recordId != application2 ) return -1; const DataSet* dataSet = records_[recordId]; @@ -188,42 +188,42 @@ namespace Exiv2 { return idx; } - TypeId IptcDataSets::dataSetType(uint16 number, uint16 recordId) + TypeId IptcDataSets::dataSetType(uint16_t number, uint16_t recordId) { int idx = dataSetIdx(number, recordId); if (idx == -1) throw Error("No dataSet for record Id"); return records_[recordId][idx].type_; } - const char* IptcDataSets::dataSetName(uint16 number, uint16 recordId) + const char* IptcDataSets::dataSetName(uint16_t number, uint16_t recordId) { int idx = dataSetIdx(number, recordId); if (idx == -1) throw Error("No dataSet for record Id"); return records_[recordId][idx].name_; } - const char* IptcDataSets::dataSetDesc(uint16 number, uint16 recordId) + const char* IptcDataSets::dataSetDesc(uint16_t number, uint16_t recordId) { int idx = dataSetIdx(number, recordId); if (idx == -1) throw Error("No dataSet for record Id"); return records_[recordId][idx].desc_; } - const char* IptcDataSets::dataSetPsName(uint16 number, uint16 recordId) + const char* IptcDataSets::dataSetPsName(uint16_t number, uint16_t recordId) { int idx = dataSetIdx(number, recordId); if (idx == -1) throw Error("No dataSet for record Id"); return records_[recordId][idx].photoshop_; } - bool IptcDataSets::dataSetRepeatable(uint16 number, uint16 recordId) + bool IptcDataSets::dataSetRepeatable(uint16_t number, uint16_t recordId) { int idx = dataSetIdx(number, recordId); if (idx == -1) throw Error("No dataSet for record Id"); return records_[recordId][idx].repeatable_; } - const char* IptcDataSets::recordName(uint16 recordId) + const char* IptcDataSets::recordName(uint16_t recordId) { if( recordId != envelope && recordId != application2 ) { throw Error("Unknown record"); @@ -231,7 +231,7 @@ namespace Exiv2 { return recordInfo_[recordId].name_; } - const char* IptcDataSets::recordDesc(uint16 recordId) + const char* IptcDataSets::recordDesc(uint16_t recordId) { if( recordId != envelope && recordId != application2 ) { throw Error("Unknown record"); @@ -239,9 +239,9 @@ namespace Exiv2 { return recordInfo_[recordId].desc_; } - uint16 IptcDataSets::recordId(const std::string& recordName) + uint16_t IptcDataSets::recordId(const std::string& recordName) { - uint16 i; + uint16_t i; for (i = application2; i > 0; --i) { if (recordInfo_[i].name_ == recordName) break; } @@ -255,7 +255,7 @@ namespace Exiv2 { + "." + dataSet.name_; } - std::string IptcDataSets::makeKey(uint16 number, uint16 recordId) + std::string IptcDataSets::makeKey(uint16_t number, uint16_t recordId) { return std::string(familyName()) + "." + std::string(recordName(recordId)) @@ -263,7 +263,7 @@ namespace Exiv2 { } // This 'database lookup' function returns a match if it exists - std::pair IptcDataSets::decomposeKey(const std::string& key) + std::pair IptcDataSets::decomposeKey(const std::string& key) { // Get the type, record name and dataSet name parts of the key std::string::size_type pos1 = key.find('.'); @@ -279,11 +279,11 @@ namespace Exiv2 { if (dataSetName == "") throw Error("Invalid key"); // Use the parts of the key to find dataSet and recordInfo - uint16 recId = recordId(recordName); - if (recId == invalidRecord) return std::make_pair((uint16)0xffff, invalidRecord); + uint16_t recId = recordId(recordName); + if (recId == invalidRecord) return std::make_pair((uint16_t)0xffff, invalidRecord); int idx = dataSetIdx(dataSetName, recId); - if (idx == -1 ) return std::make_pair((uint16)0xffff, invalidRecord); + if (idx == -1 ) return std::make_pair((uint16_t)0xffff, invalidRecord); return std::make_pair(records_[recId][idx].number_, recId); } // IptcDataSets::decomposeKey diff --git a/src/datasets.hpp b/src/datasets.hpp index af746f28..0cd136bc 100644 --- a/src/datasets.hpp +++ b/src/datasets.hpp @@ -21,7 +21,7 @@ /*! @file datasets.hpp @brief Iptc dataSet and type information - @version $Name: $ $Revision: 1.3 $ + @version $Name: $ $Revision: 1.4 $ @author Brad Schick (brad) @date 24-Jul-04, brad: created */ @@ -47,8 +47,8 @@ namespace Exiv2 { //! Contains information about one record struct RecordInfo { //! Constructor - RecordInfo(uint16 recordId, const char* name, const char* desc); - uint16 recordId_; //!< Record id + RecordInfo(uint16_t recordId, const char* name, const char* desc); + uint16_t recordId_; //!< Record id const char* name_; //!< Record name (one word) const char* desc_; //!< Record description }; @@ -57,27 +57,27 @@ namespace Exiv2 { struct DataSet { //! Constructor DataSet( - uint16 number, + uint16_t number, const char* name, const char* desc, bool mandatory, bool repeatable, - uint32 minbytes, - uint32 maxbytes, + uint32_t minbytes, + uint32_t maxbytes, TypeId type, - uint16 recordId, + uint16_t recordId, const char* photoshop ); //@{ - uint16 number_; + uint16_t number_; const char* name_; const char* desc_; bool mandatory_; bool repeatable_; - uint32 minbytes_; - uint32 maxbytes_; + uint32_t minbytes_; + uint32_t maxbytes_; TypeId type_; - uint16 recordId_; + uint16_t recordId_; const char* photoshop_; //@} }; // struct DataSet @@ -92,84 +92,84 @@ namespace Exiv2 { IIM4 standard (and not commonly used in images). */ //@{ - static const uint16 invalidRecord = 0; - static const uint16 envelope = 1; - static const uint16 application2 = 2; + static const uint16_t invalidRecord = 0; + static const uint16_t envelope = 1; + static const uint16_t application2 = 2; //@} //! @name Dataset identifiers //@{ - static const uint16 ModelVersion = 0; - static const uint16 Destination = 5; - static const uint16 FileFormat = 20; - static const uint16 FileVersion = 22; - static const uint16 ServiceId = 30; - static const uint16 EnvelopeNumber = 40; - static const uint16 ProductId = 50; - static const uint16 EnvelopePriority = 60; - static const uint16 DateSent = 70; - static const uint16 TimeSent = 80; - static const uint16 CharacterSet = 90; - static const uint16 UNO = 100; - static const uint16 ARMId = 120; - static const uint16 ARMVersion = 122; - static const uint16 RecordVersion = 0; - static const uint16 ObjectType = 3; - static const uint16 ObjectAttribute = 4; - static const uint16 ObjectName = 5; - static const uint16 EditStatus = 7; - static const uint16 EditorialUpdate = 8; - static const uint16 Urgency = 10; - static const uint16 Subject = 12; - static const uint16 Category = 15; - static const uint16 SuppCategory = 20; - static const uint16 FixtureId = 22; - static const uint16 Keywords = 25; - static const uint16 LocationCode = 26; - static const uint16 LocationName = 27; - static const uint16 ReleaseDate = 30; - static const uint16 ReleaseTime = 35; - static const uint16 ExpirationDate = 37; - static const uint16 ExpirationTime = 38; - static const uint16 SpecialInstructions = 40; - static const uint16 ActionAdvised = 42; - static const uint16 ReferenceService = 45; - static const uint16 ReferenceDate = 47; - static const uint16 ReferenceNumber = 50; - static const uint16 DateCreated = 55; - static const uint16 TimeCreated = 60; - static const uint16 DigitizationDate = 62; - static const uint16 DigitizationTime = 63; - static const uint16 Program = 65; - static const uint16 ProgramVersion = 70; - static const uint16 ObjectCycle = 75; - static const uint16 Byline = 80; - static const uint16 BylineTitle = 85; - static const uint16 City = 90; - static const uint16 SubLocation = 92; - static const uint16 ProvinceState = 95; - static const uint16 CountryCode = 100; - static const uint16 CountryName = 101; - static const uint16 TransmissionReference = 103; - static const uint16 Headline = 105; - static const uint16 Credit = 110; - static const uint16 Source = 115; - static const uint16 Copyright = 116; - static const uint16 Contact = 118; - static const uint16 Caption = 120; - static const uint16 Writer = 122; - static const uint16 RasterizedCaption = 125; - static const uint16 ImageType = 130; - static const uint16 ImageOrientation = 131; - static const uint16 Language = 135; - static const uint16 AudioType = 150; - static const uint16 AudioRate = 151; - static const uint16 AudioResolution = 152; - static const uint16 AudioDuration = 153; - static const uint16 AudioOutcue = 154; - static const uint16 PreviewFormat = 200; - static const uint16 PreviewVersion = 201; - static const uint16 Preview = 202; + static const uint16_t ModelVersion = 0; + static const uint16_t Destination = 5; + static const uint16_t FileFormat = 20; + static const uint16_t FileVersion = 22; + static const uint16_t ServiceId = 30; + static const uint16_t EnvelopeNumber = 40; + static const uint16_t ProductId = 50; + static const uint16_t EnvelopePriority = 60; + static const uint16_t DateSent = 70; + static const uint16_t TimeSent = 80; + static const uint16_t CharacterSet = 90; + static const uint16_t UNO = 100; + static const uint16_t ARMId = 120; + static const uint16_t ARMVersion = 122; + static const uint16_t RecordVersion = 0; + static const uint16_t ObjectType = 3; + static const uint16_t ObjectAttribute = 4; + static const uint16_t ObjectName = 5; + static const uint16_t EditStatus = 7; + static const uint16_t EditorialUpdate = 8; + static const uint16_t Urgency = 10; + static const uint16_t Subject = 12; + static const uint16_t Category = 15; + static const uint16_t SuppCategory = 20; + static const uint16_t FixtureId = 22; + static const uint16_t Keywords = 25; + static const uint16_t LocationCode = 26; + static const uint16_t LocationName = 27; + static const uint16_t ReleaseDate = 30; + static const uint16_t ReleaseTime = 35; + static const uint16_t ExpirationDate = 37; + static const uint16_t ExpirationTime = 38; + static const uint16_t SpecialInstructions = 40; + static const uint16_t ActionAdvised = 42; + static const uint16_t ReferenceService = 45; + static const uint16_t ReferenceDate = 47; + static const uint16_t ReferenceNumber = 50; + static const uint16_t DateCreated = 55; + static const uint16_t TimeCreated = 60; + static const uint16_t DigitizationDate = 62; + static const uint16_t DigitizationTime = 63; + static const uint16_t Program = 65; + static const uint16_t ProgramVersion = 70; + static const uint16_t ObjectCycle = 75; + static const uint16_t Byline = 80; + static const uint16_t BylineTitle = 85; + static const uint16_t City = 90; + static const uint16_t SubLocation = 92; + static const uint16_t ProvinceState = 95; + static const uint16_t CountryCode = 100; + static const uint16_t CountryName = 101; + static const uint16_t TransmissionReference = 103; + static const uint16_t Headline = 105; + static const uint16_t Credit = 110; + static const uint16_t Source = 115; + static const uint16_t Copyright = 116; + static const uint16_t Contact = 118; + static const uint16_t Caption = 120; + static const uint16_t Writer = 122; + static const uint16_t RasterizedCaption = 125; + static const uint16_t ImageType = 130; + static const uint16_t ImageOrientation = 131; + static const uint16_t Language = 135; + static const uint16_t AudioType = 150; + static const uint16_t AudioRate = 151; + static const uint16_t AudioResolution = 152; + static const uint16_t AudioDuration = 153; + static const uint16_t AudioOutcue = 154; + static const uint16_t PreviewFormat = 200; + static const uint16_t PreviewVersion = 201; + static const uint16_t Preview = 202; //@} private: @@ -194,7 +194,7 @@ namespace Exiv2 { @throw Error ("No dataset for recordId") if there is no dataset info for the given record id in the lookup tables. */ - static const char* dataSetName(uint16 number, uint16 recordId); + static const char* dataSetName(uint16_t number, uint16_t recordId); /*! @brief Return the description of the dataset. @param number The dataset number @@ -203,7 +203,7 @@ namespace Exiv2 { @throw Error ("No dataset for recordId") if there is no dataset info for the given record id in the lookup tables. */ - static const char* dataSetDesc(uint16 number, uint16 recordId); + static const char* dataSetDesc(uint16_t number, uint16_t recordId); /*! @brief Return the photohsop name of a given dataset. @param number The dataset number @@ -213,7 +213,7 @@ namespace Exiv2 { @throw Error ("No dataset for recordId") if there is no dataset info for the given record id in the lookup tables. */ - static const char* dataSetPsName(uint16 number, uint16 recordId); + static const char* dataSetPsName(uint16_t number, uint16_t recordId); /*! @brief Check if a given dataset is repeatable @param number The dataset number @@ -222,32 +222,32 @@ namespace Exiv2 { @throw Error ("No dataset for recordId") if there is no dataset info for the given record id in the lookup tables. */ - static bool dataSetRepeatable(uint16 number, uint16 recordId); + static bool dataSetRepeatable(uint16_t number, uint16_t recordId); //! Return the dataSet number for dataset name and record id - static uint16 dataSet(const std::string& dataSetName, uint16 recordId); + static uint16_t dataSet(const std::string& dataSetName, uint16_t recordId); //! Return the type for dataSet number and Record id - static TypeId dataSetType(uint16 number, uint16 recordId); + static TypeId dataSetType(uint16_t number, uint16_t recordId); //! Return the name of the Record - static const char* recordName(uint16 recordId); + static const char* recordName(uint16_t recordId); /*! @brief Return the description of a record @param recordId Record Id number @return the description of the Record @throw Error("Unknown record"); */ - static const char* recordDesc(uint16 recordId); + static const char* recordDesc(uint16_t recordId); /*! @brief Return the Id number of a record @param recordName Name of a record type @return the Id number of a Record @throw Error("Unknown record"); */ - static uint16 recordId(const std::string& recordName); + static uint16_t recordId(const std::string& recordName); /*! @brief Return the key for the dataSet number and record id. The key is of the form 'Iptc.recordName.dataSetName'. */ - static std::string makeKey(uint16 number, uint16 recordId); + static std::string makeKey(uint16_t number, uint16_t recordId); /*! @brief Return the key for the dataSet. The key is of the form 'Iptc.recordName.dataSetName'. @@ -259,13 +259,13 @@ namespace Exiv2 { @throw Error ("Invalid key") if the key cannot be parsed into record name and dataSet name parts. */ - static std::pair decomposeKey(const std::string& key); + static std::pair decomposeKey(const std::string& key); //! Print a list of all dataSets to output stream static void dataSetList(std::ostream& os); private: - static int dataSetIdx(uint16 number, uint16 recordId); - static int dataSetIdx(const std::string& dataSetName, uint16 recordId); + static int dataSetIdx(uint16_t number, uint16_t recordId); + static int dataSetIdx(const std::string& dataSetName, uint16_t recordId); static const DataSet* records_[]; static const RecordInfo recordInfo_[]; diff --git a/src/exif.cpp b/src/exif.cpp index a5c4a324..1f23ad77 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -20,14 +20,14 @@ */ /* File: exif.cpp - Version: $Name: $ $Revision: 1.57 $ + Version: $Name: $ $Revision: 1.58 $ Author(s): Andreas Huggel (ahu) History: 26-Jan-04, ahu: created 11-Feb-04, ahu: isolated as a component */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.57 $ $RCSfile: exif.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.58 $ $RCSfile: exif.cpp,v $"); // Define DEBUG_MAKERNOTE to output debug information to std::cerr #undef DEBUG_MAKERNOTE @@ -63,8 +63,8 @@ namespace { */ void setOffsetTag(Exiv2::Ifd& ifd, int idx, - Exiv2::uint16 tag, - Exiv2::uint32 offset, + uint16_t tag, + uint32_t offset, Exiv2::ByteOrder byteOrder); } @@ -119,7 +119,7 @@ namespace Exiv2 { return ExifTags::tagName(tag(), ifdId()); } - uint16 ExifKey::tag() const + uint16_t ExifKey::tag() const { if (tag_ == 0xffff) throw Error("Invalid key"); return tag_; @@ -146,7 +146,7 @@ namespace Exiv2 { void ExifKey::decomposeKey() { - std::pair p; + std::pair p; if (ifdId_ == makerIfdId && pMakerNote_ != 0) { p.first = pMakerNote_->decomposeKey(key_); if (p.first == 0xffff) throw Error("Invalid key"); @@ -1160,7 +1160,7 @@ namespace Exiv2 { else { DataBuf buf(md->size()); md->copy(buf.pData_, byteOrder); - entry->setValue(static_cast(md->typeId()), md->count(), + entry->setValue(static_cast(md->typeId()), md->count(), buf.pData_, md->size()); } } @@ -1316,7 +1316,7 @@ namespace Exiv2 { DataBuf buf(md.size()); md.copy(buf.pData_, byteOrder); - e.setValue(static_cast(md.typeId()), md.count(), buf.pData_, md.size()); + e.setValue(static_cast(md.typeId()), md.count(), buf.pData_, md.size()); ifd.add(e); } // addToIfd @@ -1345,7 +1345,7 @@ namespace Exiv2 { DataBuf buf(md.size()); md.copy(buf.pData_, byteOrder); - e.setValue(static_cast(md.typeId()), md.count(), + e.setValue(static_cast(md.typeId()), md.count(), buf.pData_, md.size()); makerNote->add(e); } // addToMakerNote @@ -1363,10 +1363,10 @@ namespace Exiv2 { return ExifTags::makeKey(entry.tag(), entry.ifdId()); } - std::pair decomposeKey(const std::string& key, + std::pair decomposeKey(const std::string& key, const MakerNote* makerNote) { - std::pair p = ExifTags::decomposeKey(key); + std::pair p = ExifTags::decomposeKey(key); if (p.second == makerIfdId && makerNote != 0) { p.first = makerNote->decomposeKey(key); } @@ -1381,8 +1381,8 @@ namespace { void setOffsetTag(Exiv2::Ifd& ifd, int idx, - Exiv2::uint16 tag, - Exiv2::uint32 offset, + uint16_t tag, + uint32_t offset, Exiv2::ByteOrder byteOrder) { Exiv2::Ifd::iterator pos = ifd.findTag(tag); diff --git a/src/exif.hpp b/src/exif.hpp index 38d60c68..63071da8 100644 --- a/src/exif.hpp +++ b/src/exif.hpp @@ -21,7 +21,7 @@ /*! @file exif.hpp @brief Encoding and decoding of Exif data - @version $Name: $ $Revision: 1.50 $ + @version $Name: $ $Revision: 1.51 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 09-Jan-04, ahu: created @@ -104,7 +104,7 @@ namespace Exiv2 { @brief Return the tag. @throw Error ("Invalid key") if the tag is not set. */ - virtual uint16 tag() const; + virtual uint16_t tag() const; virtual ExifKey* clone() const; //! Interpret and print the value of an Exif tag @@ -144,7 +144,7 @@ namespace Exiv2 { private: // DATA - uint16 tag_; //!< Tag value + uint16_t tag_; //!< Tag value IfdId ifdId_; //!< The IFD associated with this tag int idx_; //!< Unique id of an entry within one IFD MakerNote* pMakerNote_; //!< Pointer to the associated MakerNote @@ -212,7 +212,7 @@ namespace Exiv2 { std::string tagName() const { return pKey_ == 0 ? "" : pKey_->tagName(); } //! Return the tag - uint16 tag() const + uint16_t tag() const { return pKey_ == 0 ? 0xffff : pKey_->tag(); } //! Return the IFD id IfdId ifdId() const @@ -965,7 +965,7 @@ namespace Exiv2 { @throw Error ("Invalid key") if the key cannot be parsed into item item, section name and tag name parts. */ - std::pair decomposeKey(const std::string& key, + std::pair decomposeKey(const std::string& key, const MakerNote* makerNote); } // namespace Exiv2 diff --git a/src/fujimn.cpp b/src/fujimn.cpp index cbf0d8b2..45aec012 100644 --- a/src/fujimn.cpp +++ b/src/fujimn.cpp @@ -20,7 +20,7 @@ */ /* File: fujimn.cpp - Version: $Name: $ $Revision: 1.10 $ + Version: $Name: $ $Revision: 1.11 $ Author(s): Andreas Huggel (ahu) History: 18-Feb-04, ahu: created 07-Mar-04, ahu: isolated as a separate component @@ -31,7 +31,7 @@ */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.10 $ $RCSfile: fujimn.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.11 $ $RCSfile: fujimn.cpp,v $"); // ***************************************************************************** // included header files @@ -119,7 +119,7 @@ namespace Exiv2 { } std::ostream& FujiMakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { diff --git a/src/fujimn.hpp b/src/fujimn.hpp index 1dd9cf9a..bacb7688 100644 --- a/src/fujimn.hpp +++ b/src/fujimn.hpp @@ -24,7 +24,7 @@ in Appendix 4: Makernote of Fujifilm of the document Exif file format by TsuruZoh Tachibanaya - @version $Name: $ $Revision: 1.7 $ + @version $Name: $ $Revision: 1.8 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 11-Feb-04, ahu: created @@ -109,7 +109,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Fujifilm") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} diff --git a/src/ifd.cpp b/src/ifd.cpp index 576d8492..0cedf0c2 100644 --- a/src/ifd.cpp +++ b/src/ifd.cpp @@ -20,14 +20,14 @@ */ /* File: ifd.cpp - Version: $Name: $ $Revision: 1.25 $ + Version: $Name: $ $Revision: 1.26 $ Author(s): Andreas Huggel (ahu) History: 26-Jan-04, ahu: created 11-Feb-04, ahu: isolated as a component */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.25 $ $RCSfile: ifd.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.26 $ $RCSfile: ifd.cpp,v $"); // ***************************************************************************** // included header files @@ -103,7 +103,7 @@ namespace Exiv2 { return *this; } // Entry::operator= - void Entry::setValue(uint32 data, ByteOrder byteOrder) + void Entry::setValue(uint32_t data, ByteOrder byteOrder) { if (pData_ == 0 || size_ < 4) { assert(alloc_); @@ -117,7 +117,7 @@ namespace Exiv2 { count_ = 1; } - void Entry::setValue(uint16 type, uint32 count, const byte* buf, long len) + void Entry::setValue(uint16_t type, uint32_t count, const byte* buf, long len) { long dataSize = count * TypeInfo::typeSize(TypeId(type)); // No minimum size requirement, but make sure the buffer can hold the data @@ -149,7 +149,7 @@ namespace Exiv2 { count_ = count; } // Entry::setValue - const byte* Entry::component(uint32 n) const + const byte* Entry::component(uint32_t n) const { if (n >= count()) return 0; return data() + n * typeSize(); @@ -163,7 +163,7 @@ namespace Exiv2 { memset(pNext_, 0x0, 4); } - Ifd::Ifd(IfdId ifdId, uint32 offset) + Ifd::Ifd(IfdId ifdId, uint32_t offset) : alloc_(true), ifdId_(ifdId), offset_(offset), dataOffset_(0), pNext_(0), next_(0) { @@ -171,7 +171,7 @@ namespace Exiv2 { memset(pNext_, 0x0, 4); } - Ifd::Ifd(IfdId ifdId, uint32 offset, bool alloc) + Ifd::Ifd(IfdId ifdId, uint32_t offset, bool alloc) : alloc_(alloc), ifdId_(ifdId), offset_(offset), dataOffset_(0), pNext_(0), next_(0) { @@ -294,7 +294,7 @@ namespace Exiv2 { e.setIfdId(ifdId_); e.setIdx(++idx); e.setTag(i->tag_); - uint32 tmpOffset = + uint32_t tmpOffset = i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_; if (static_cast(len) < tmpOffset + i->size_) { // Todo: How to handle debug output like this @@ -338,13 +338,13 @@ namespace Exiv2 { FindEntryByIdx(idx)); } - Ifd::const_iterator Ifd::findTag(uint16 tag) const + Ifd::const_iterator Ifd::findTag(uint16_t tag) const { return std::find_if(entries_.begin(), entries_.end(), FindEntryByTag(tag)); } - Ifd::iterator Ifd::findTag(uint16 tag) + Ifd::iterator Ifd::findTag(uint16_t tag) { return std::find_if(entries_.begin(), entries_.end(), FindEntryByTag(tag)); @@ -356,7 +356,7 @@ namespace Exiv2 { } int Ifd::readSubIfd( - Ifd& dest, const byte* buf, long len, ByteOrder byteOrder, uint16 tag + Ifd& dest, const byte* buf, long len, ByteOrder byteOrder, uint16_t tag ) const { int rc = 0; @@ -378,7 +378,7 @@ namespace Exiv2 { if (offset != 0) offset_ = offset; // Add the number of entries to the data buffer - us2Data(buf, static_cast(entries_.size()), byteOrder); + us2Data(buf, static_cast(entries_.size()), byteOrder); long o = 2; // Add all directory entries to the data buffer @@ -438,7 +438,7 @@ namespace Exiv2 { dataOffset_ = 0; } // Ifd::clear - void Ifd::setNext(uint32 next, ByteOrder byteOrder) + void Ifd::setNext(uint32_t next, ByteOrder byteOrder) { assert(pNext_); ul2Data(pNext_, next, byteOrder); @@ -453,7 +453,7 @@ namespace Exiv2 { entries_.push_back(entry); } - int Ifd::erase(uint16 tag) + int Ifd::erase(uint16_t tag) { int idx = 0; iterator pos = findTag(tag); diff --git a/src/ifd.hpp b/src/ifd.hpp index 6d01f16b..08364264 100644 --- a/src/ifd.hpp +++ b/src/ifd.hpp @@ -21,7 +21,7 @@ /*! @file ifd.hpp @brief Encoding and decoding of IFD (%Image File Directory) data - @version $Name: $ $Revision: 1.20 $ + @version $Name: $ $Revision: 1.21 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 09-Jan-04, ahu: created
@@ -77,7 +77,7 @@ namespace Exiv2 { //! Assignment operator Entry& operator=(const Entry& rhs); //! Set the tag - void setTag(uint16 tag) { tag_ = tag; } + void setTag(uint16_t tag) { tag_ = tag; } //! Set the IFD id void setIfdId(IfdId ifdId) { ifdId_ = ifdId; } //! Set the index (unique id of an entry within one IFD) @@ -85,7 +85,7 @@ namespace Exiv2 { //! Set the pointer to the MakerNote void setMakerNote(MakerNote* makerNote) { pMakerNote_ = makerNote; } //! Set the offset. The offset is relative to the start of the IFD. - void setOffset(uint32 offset) { offset_ = offset; } + void setOffset(uint32_t offset) { offset_ = offset; } /*! @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 @@ -99,7 +99,7 @@ namespace Exiv2 {
This method cannot be used to set the value of a newly created %Entry in non-alloc mode. */ - void setValue(uint32 data, ByteOrder byteOrder); + void setValue(uint32_t data, ByteOrder byteOrder); /*! @brief Set type, count, the data buffer and its size. @@ -126,15 +126,15 @@ namespace Exiv2 { @throw Error ("Size too small") if size is not large enough to hold count components of the given type. */ - void setValue(uint16 type, uint32 count, const byte* data, long size); + void setValue(uint16_t type, uint32_t count, const byte* data, long size); //@} //! @name Accessors //@{ //! Return the tag - uint16 tag() const { return tag_; } + uint16_t tag() const { return tag_; } //! Return the type id. - uint16 type() const { return type_; } + uint16_t type() const { return type_; } //! Return the name of the type const char* typeName() const { return TypeInfo::typeName(TypeId(type_)); } @@ -148,7 +148,7 @@ namespace Exiv2 { //! Return the pointer to the associated MakerNote MakerNote* makerNote() const { return pMakerNote_; } //! Return the number of components in the value - uint32 count() const { return count_; } + uint32_t count() const { return count_; } /*! @brief Return the size of the data buffer in bytes. @note There is no minimum size for the data buffer, except that it @@ -156,7 +156,7 @@ namespace Exiv2 { */ long size() const { return size_; } //! Return the offset from the start of the IFD to the data of the entry - uint32 offset() const { return offset_; } + uint32_t offset() const { return offset_; } /*! @brief Return a pointer to the data area. Do not attempt to write to this pointer. @@ -166,7 +166,7 @@ namespace Exiv2 { @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 n) const; + const byte* component(uint32_t n) const; //! Get the memory allocation mode bool alloc() const { return alloc_; } //@} @@ -185,13 +185,13 @@ namespace Exiv2 { //! Pointer to the associated MakerNote MakerNote* pMakerNote_; //! Tag - uint16 tag_; + uint16_t tag_; //! Type - uint16 type_; + uint16_t type_; //! Number of components - uint32 count_; + uint32_t count_; //! Offset from the start of the IFD to the data - uint32 offset_; + uint32_t offset_; /*! Size of the data buffer holding the value in bytes, there is no minimum size. @@ -226,7 +226,7 @@ namespace Exiv2 { class FindEntryByTag { public: //! Constructor, initializes the object with the tag to look for - FindEntryByTag(uint16 tag) : tag_(tag) {} + FindEntryByTag(uint16_t tag) : tag_(tag) {} /*! @brief Returns true if the tag of the argument entry is equal to that of the object. @@ -235,7 +235,7 @@ namespace Exiv2 { { return tag_ == entry.tag(); } private: - uint16 tag_; + uint16_t tag_; }; // class FindEntryByTag @@ -285,13 +285,13 @@ namespace Exiv2 { the IFD from the start of TIFF header. Memory management is enabled. */ - Ifd(IfdId ifdId, uint32 offset); + Ifd(IfdId ifdId, uint32_t offset); /*! @brief Constructor. Allows to set the IFD identifier, offset of the IFD from the start of TIFF header and choose whether or not memory management is required for the Entries. */ - Ifd(IfdId ifdId, uint32 offset, bool alloc); + Ifd(IfdId ifdId, uint32_t offset, bool alloc); //! Copy constructor Ifd(const Ifd& rhs); //! Destructor @@ -344,7 +344,7 @@ namespace Exiv2 { IFD. 0 is returned and no action is taken in this case. */ int readSubIfd( - Ifd& dest, const byte* buf, long len, ByteOrder byteOrder, uint16 tag + Ifd& dest, const byte* buf, long len, ByteOrder byteOrder, uint16_t tag ) const; /*! @brief Copy the IFD to a data array, update the offsets of the IFD and @@ -382,7 +382,7 @@ namespace Exiv2 { @brief Set the offset of the next IFD. Byte order is needed to update the underlying data buffer in non-alloc mode. */ - void setNext(uint32 next, ByteOrder byteOrder); + void setNext(uint32_t next, ByteOrder byteOrder); /*! @brief Add the entry to the IFD. No duplicate-check is performed, i.e., it is possible to add multiple entries with the same tag. @@ -395,7 +395,7 @@ namespace Exiv2 { @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 tag); + int erase(uint16_t tag); /*! @brief Delete the directory entry at iterator position pos, return the position of the next entry. Note that iterators into the @@ -412,7 +412,7 @@ namespace Exiv2 { //! Find an IFD entry by idx, return an iterator into the entries list iterator findIdx(int idx); //! Find an IFD entry by tag, return an iterator into the entries list - iterator findTag(uint16 tag); + iterator findTag(uint16_t tag); //@} //! @name Accessors @@ -426,7 +426,7 @@ namespace Exiv2 { //! Find an IFD entry by idx, return a const iterator into the entries list const_iterator findIdx(int idx) const; //! Find an IFD entry by tag, return a const iterator into the entries list - const_iterator findTag(uint16 tag) const; + const_iterator findTag(uint16_t tag) const; //! Get the IfdId of the IFD IfdId ifdId() const { return ifdId_; } //! Get the offset of the IFD from the start of the TIFF header @@ -438,7 +438,7 @@ namespace Exiv2 { */ long dataOffset() const { return dataOffset_; } //! Get the offset to the next IFD from the start of the TIFF header - uint32 next() const { return next_; } + uint32_t next() const { return next_; } //! Get the number of directory entries in the IFD long count() const { return static_cast(entries_.size()); } //! Get the size of this IFD in bytes (IFD only, without data) @@ -460,12 +460,12 @@ namespace Exiv2 { private: //! Helper structure to build IFD entries struct PreEntry { - uint16 tag_; - uint16 type_; - uint32 count_; + uint16_t tag_; + uint16_t type_; + uint32_t count_; long size_; long offsetLoc_; - uint32 offset_; + uint32_t offset_; }; //! cmpPreEntriesByOffset needs to know about PreEntry, that's all. @@ -491,7 +491,7 @@ namespace Exiv2 { //! Pointer to the offset of next IFD from the start of the TIFF header byte* pNext_; //! The offset of the next IFD as data value (always in sync with *pNext_) - uint32 next_; + uint32_t next_; }; // class Ifd diff --git a/src/image.cpp b/src/image.cpp index fd841af6..d5739c87 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -20,7 +20,7 @@ */ /* File: image.cpp - Version: $Name: $ $Revision: 1.25 $ + Version: $Name: $ $Revision: 1.26 $ Author(s): Andreas Huggel (ahu) Brad Schick (brad) History: 26-Jan-04, ahu: created @@ -29,7 +29,7 @@ */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.25 $ $RCSfile: image.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.26 $ $RCSfile: image.cpp,v $"); // ***************************************************************************** // included header files @@ -159,7 +159,7 @@ namespace Exiv2 { const byte JpegBase::app1_ = 0xe1; const byte JpegBase::app13_ = 0xed; const byte JpegBase::com_ = 0xfe; - const uint16 JpegBase::iptc_ = 0x0404; + const uint16_t JpegBase::iptc_ = 0x0404; const char JpegBase::exifId_[] = "Exif\0\0"; const char JpegBase::jfifId_[] = "JFIF\0"; const char JpegBase::ps3Id_[] = "Photoshop 3.0\0"; @@ -317,7 +317,7 @@ namespace Exiv2 { // Read size and signature (ok if this hits EOF) bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_); if (ferror(fp_)) return 1; - uint16 size = getUShort(buf.pData_, bigEndian); + uint16_t size = getUShort(buf.pData_, bigEndian); if (marker == app1_ && memcmp(buf.pData_ + 2, exifId_, 6) == 0) { if (size < 8) return 2; @@ -343,8 +343,8 @@ namespace Exiv2 { fread(psData.pData_, 1, psData.size_, fp_); if (ferror(fp_) || feof(fp_)) return 1; const byte *record = 0; - uint16 sizeIptc = 0; - uint16 sizeHdr = 0; + uint16_t sizeIptc = 0; + uint16_t sizeHdr = 0; // Find actual Iptc data within the APP13 segment if (!locateIptcData(psData.pData_, psData.size_, &record, &sizeHdr, &sizeIptc)) { @@ -389,8 +389,8 @@ namespace Exiv2 { int JpegBase::locateIptcData(const byte *pPsData, long sizePsData, const byte **record, - uint16 *const sizeHdr, - uint16 *const sizeIptc) const + uint16_t *const sizeHdr, + uint16_t *const sizeIptc) const { assert(record); assert(sizeHdr); @@ -403,7 +403,7 @@ namespace Exiv2 { memcmp(pPsData + position, bimId_, 4)==0) { const byte *hrd = pPsData + position; position += 4; - uint16 type = getUShort(pPsData+ position, bigEndian); + uint16_t type = getUShort(pPsData+ position, bigEndian); position += 2; // Pascal string is padded to have an even size (including size byte) @@ -418,7 +418,7 @@ namespace Exiv2 { if (dataSize > sizePsData - position) return -2; if (type == iptc_) { - *sizeIptc = static_cast(dataSize); + *sizeIptc = static_cast(dataSize); *sizeHdr = psSize + 10; *record = hrd; return 0; @@ -496,7 +496,7 @@ namespace Exiv2 { // Read size and signature (ok if this hits EOF) bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_); if (ferror(fp_)) return 1; - uint16 size = getUShort(buf.pData_, bigEndian); + uint16_t size = getUShort(buf.pData_, bigEndian); if (marker == app0_) { if (size < 2) return 2; @@ -556,7 +556,7 @@ namespace Exiv2 { if (ferror(fp_)) return 1; // Careful, this can be a meaningless number for empty // images with only an eoi_ marker - uint16 size = getUShort(buf.pData_, bigEndian); + uint16_t size = getUShort(buf.pData_, bigEndian); if (insertPos == count) { byte tmpBuf[18]; @@ -565,7 +565,7 @@ namespace Exiv2 { tmpBuf[0] = 0xff; tmpBuf[1] = com_; us2Data(tmpBuf + 2, - static_cast(comment_.length()+3), bigEndian); + static_cast(comment_.length()+3), bigEndian); if (fwrite(tmpBuf, 1, 4, ofp) != 4) return 4; if (fwrite(comment_.data(), 1, comment_.length(), ofp) != comment_.length()) return 4; if (fputc(0, ofp)==EOF) return 4; @@ -576,7 +576,7 @@ namespace Exiv2 { // Write APP1 marker, size of APP1 field, Exif id and Exif data tmpBuf[0] = 0xff; tmpBuf[1] = app1_; - us2Data(tmpBuf + 2, static_cast(sizeExifData_+8), bigEndian); + us2Data(tmpBuf + 2, static_cast(sizeExifData_+8), bigEndian); memcpy(tmpBuf + 4, exifId_, 6); if (fwrite(tmpBuf, 1, 10, ofp) != 10) return 4; if (fwrite(pExifData_, 1, sizeExifData_, ofp) != (size_t)sizeExifData_) return 4; @@ -585,8 +585,8 @@ namespace Exiv2 { } const byte *record = psData.pData_; - uint16 sizeIptc = 0; - uint16 sizeHdr = 0; + uint16_t sizeIptc = 0; + uint16_t sizeHdr = 0; // Safe to call with zero psData.size_ locateIptcData(psData.pData_, psData.size_, &record, &sizeHdr, &sizeIptc); @@ -599,7 +599,7 @@ namespace Exiv2 { const int sizeNewData = sizeIptcData_ ? sizeIptcData_+(sizeIptcData_&1)+12 : 0; us2Data(tmpBuf + 2, - static_cast(psData.size_-sizeOldData+sizeNewData+16), + static_cast(psData.size_-sizeOldData+sizeNewData+16), bigEndian); memcpy(tmpBuf + 4, ps3Id_, 14); if (fwrite(tmpBuf, 1, 18, ofp) != 18) return 4; diff --git a/src/image.hpp b/src/image.hpp index 9b0cffd3..1eeb19f2 100644 --- a/src/image.hpp +++ b/src/image.hpp @@ -21,7 +21,7 @@ /*! @file image.hpp @brief Class JpegImage to access JPEG images - @version $Name: $ $Revision: 1.19 $ + @version $Name: $ $Revision: 1.20 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @author Brad Schick (brad) @@ -405,7 +405,7 @@ namespace Exiv2 { static const char jfifId_[]; //!< JFIF identifier static const char ps3Id_[]; //!< Photoshop marker static const char bimId_[]; //!< Photoshop marker - static const uint16 iptc_; //!< Photoshop Iptc marker + static const uint16_t iptc_; //!< Photoshop Iptc marker private: // DATA @@ -447,8 +447,8 @@ namespace Exiv2 { int locateIptcData(const byte *pPsData, long sizePsData, const byte **record, - uint16 *const sizeHdr, - uint16 *const sizeIptc) const; + uint16_t *const sizeHdr, + uint16_t *const sizeIptc) const; /*! @brief Write to the associated file stream with the provided data. @param initData Data to be written to the associated file @@ -655,19 +655,19 @@ namespace Exiv2 { //! Return the byte order (little or big endian). ByteOrder byteOrder() const { return byteOrder_; } //! Return the tag value. - uint16 tag() const { return tag_; } + 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 TIFF header. */ - uint32 offset() const { return offset_; } + uint32_t offset() const { return offset_; } //@} private: ByteOrder byteOrder_; - uint16 tag_; - uint32 offset_; + uint16_t tag_; + uint32_t offset_; }; // class TiffHeader diff --git a/src/iptc.cpp b/src/iptc.cpp index 086f2eb0..5c6d70d8 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -20,13 +20,13 @@ */ /* File: iptc.cpp - Version: $Name: $ $Revision: 1.3 $ + Version: $Name: $ $Revision: 1.4 $ Author(s): Brad Schick (brad) History: 31-July-04, brad: created */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.3 $ $RCSfile: iptc.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: iptc.cpp,v $"); // Define DEBUG_MAKERNOTE to output debug information to std::cerr #undef DEBUG_MAKERNOTE @@ -54,7 +54,7 @@ namespace Exiv2 { decomposeKey(); } - IptcKey::IptcKey(uint16 tag, uint16 record) + IptcKey::IptcKey(uint16_t tag, uint16_t record) : tag_(tag), record_(record), key_(IptcDataSets::makeKey(tag, record)) { } @@ -81,7 +81,7 @@ namespace Exiv2 { void IptcKey::decomposeKey() { - std::pair p = IptcDataSets::decomposeKey(key_); + std::pair p = IptcDataSets::decomposeKey(key_); if (p.first == 0xffff) throw Error("Invalid key"); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key"); tag_ = p.first; @@ -183,9 +183,9 @@ namespace Exiv2 { iptcMetadata_.clear(); int rc = 0; - uint16 record = 0; - uint16 dataSet = 0; - uint32 sizeData = 0; + uint16_t record = 0; + uint16_t dataSet = 0; + uint32_t sizeData = 0; byte extTest = 0; while (pRead < pData_ + size_) { @@ -196,7 +196,7 @@ namespace Exiv2 { extTest = *pRead; if (extTest & 0x80) { // extended dataset - uint16 sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF); + uint16_t sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF); if (sizeOfSize > 4) return 5; pRead += 2; sizeData = 0; @@ -218,8 +218,8 @@ namespace Exiv2 { return rc; } // IptcData::read - int IptcData::readData(uint16 dataSet, uint16 record, - const byte* data, uint32 sizeData) + int IptcData::readData(uint16_t dataSet, uint16_t record, + const byte* data, uint32_t sizeData) { Value* val = 0; try { @@ -330,14 +330,14 @@ namespace Exiv2 { long dataSize = iter->size(); if (dataSize > 32767) { // always use 4 bytes for extended length - uint16 sizeOfSize = 4 | 0x8000; + uint16_t sizeOfSize = 4 | 0x8000; us2Data(pWrite, sizeOfSize, bigEndian); pWrite += 2; ul2Data(pWrite, dataSize, bigEndian); pWrite += 4; } else { - us2Data(pWrite, static_cast(dataSize), bigEndian); + us2Data(pWrite, static_cast(dataSize), bigEndian); pWrite += 2; } @@ -405,13 +405,13 @@ namespace Exiv2 { FindMetadatumByKey(key.key())); } - IptcData::const_iterator IptcData::findId(uint16 dataset, uint16 record) const + IptcData::const_iterator IptcData::findId(uint16_t dataset, uint16_t record) const { return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(), FindMetadatumById(dataset, record)); } - IptcData::iterator IptcData::findId(uint16 dataset, uint16 record) + IptcData::iterator IptcData::findId(uint16_t dataset, uint16_t record) { return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(), FindMetadatumById(dataset, record)); diff --git a/src/iptc.hpp b/src/iptc.hpp index 1e670bcc..36253d2c 100644 --- a/src/iptc.hpp +++ b/src/iptc.hpp @@ -21,7 +21,7 @@ /*! @file iptc.hpp @brief Encoding and decoding of Iptc data - @version $Name: $ $Revision: 1.4 $ + @version $Name: $ $Revision: 1.5 $ @author Brad Schick (brad) schick@robotbattle.com @date 31-Jul-04, brad: created @@ -67,7 +67,7 @@ namespace Exiv2 { @param tag Dataset id @param record Record id */ - IptcKey(uint16 tag, uint16 record); + IptcKey(uint16_t tag, uint16_t record); //! Copy constructor IptcKey(const IptcKey& rhs); //@} @@ -92,14 +92,14 @@ namespace Exiv2 { virtual std::string groupName() const { return recordName(); } virtual std::string tagName() const { return IptcDataSets::dataSetName(tag_, record_); } - virtual uint16 tag() const { return tag_; } + virtual uint16_t tag() const { return tag_; } virtual IptcKey* clone() const; //! Return the name of the record const char* recordName() const { return IptcDataSets::recordName(record_); } //! Return the record id - uint16 record() const { return record_; } + uint16_t record() const { return record_; } //@} protected: @@ -118,8 +118,8 @@ namespace Exiv2 { private: // DATA - uint16 tag_; //!< Tag value - uint16 record_; //!< Record value + uint16_t tag_; //!< Tag value + uint16_t record_; //!< Record value std::string key_; //!< Key }; // class IptcKey @@ -201,7 +201,7 @@ namespace Exiv2 { @brief Return the record id @return record id */ - uint16 record() const + uint16_t record() const { return pKey_ == 0 ? 0 : pKey_->record(); } /*! @brief Return the name of the tag (aka dataset) @@ -211,7 +211,7 @@ namespace Exiv2 { std::string tagName() const { return pKey_ == 0 ? "" : pKey_->tagName(); } //! Return the tag (aka dataset) number - uint16 tag() const + uint16_t tag() const { return pKey_ == 0 ? 0 : pKey_->tag(); } //! Return the type id of the value TypeId typeId() const @@ -316,7 +316,7 @@ namespace Exiv2 { class FindMetadatumById { public: //! Constructor, initializes the object with the record and dataset id - FindMetadatumById(uint16 dataset, uint16 record) + FindMetadatumById(uint16_t dataset, uint16_t record) : dataset_(dataset), record_(record) {} /*! @brief Returns true if the record and dataset id of the argument @@ -326,8 +326,8 @@ namespace Exiv2 { { return dataset_ == iptcdatum.tag() && record_ == iptcdatum.record(); } private: - uint16 dataset_; - uint16 record_; + uint16_t dataset_; + uint16_t record_; }; // class FindMetadatumById @@ -460,8 +460,8 @@ namespace Exiv2 { same Ids exists, it is undefined which of the matching metadata is found. */ - iterator findId(uint16 dataset, - uint16 record = IptcDataSets::application2); + iterator findId(uint16_t dataset, + uint16_t record = IptcDataSets::application2); //@} //! @name Accessors @@ -493,8 +493,8 @@ namespace Exiv2 { same Ids exist it is undefined which of the matching metadata is found. */ - const_iterator findId(uint16 dataset, - uint16 record = IptcDataSets::application2) const; + const_iterator findId(uint16_t dataset, + uint16_t record = IptcDataSets::application2) const; //! Get the number of metadata entries long count() const { return static_cast(iptcMetadata_.size()); } /*! @@ -525,8 +525,8 @@ namespace Exiv2 { @param sizeData Length in bytes of dataset payload @return 0 if successful. */ - int readData(uint16 dataSet, uint16 record, - const byte* data, uint32 sizeData); + int readData(uint16_t dataSet, uint16_t record, + const byte* data, uint32_t sizeData); //! Resets modified flag void clearModified(); diff --git a/src/iptctest.cpp b/src/iptctest.cpp index 8553eb0f..648c705e 100644 --- a/src/iptctest.cpp +++ b/src/iptctest.cpp @@ -4,7 +4,7 @@ This is not designed to be a robust application. File : iptctest.cpp - Version : $Name: $ $Revision: 1.2 $ + Version : $Name: $ $Revision: 1.3 $ Author(s): Brad Schick (brad) History : 01-Aug-04, brad: created */ @@ -105,7 +105,7 @@ void processAdd(const std::string& line, int num) } std::string key(line.substr(keyStart, keyEnd-keyStart)); - std::pair p = IptcDataSets::decomposeKey(key); + std::pair p = IptcDataSets::decomposeKey(key); if (p.first == 0xffff) throw Error("Invalid key " + key); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key " + key); @@ -137,7 +137,7 @@ void processRemove(const std::string& line, int num) } const std::string key( line.substr(keyStart) ); - std::pair p = IptcDataSets::decomposeKey(key); + std::pair p = IptcDataSets::decomposeKey(key); if (p.first == 0xffff) throw Error("Invalid key" + key); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key" + key); @@ -162,7 +162,7 @@ void processModify(const std::string& line, int num) } std::string key(line.substr(keyStart, keyEnd-keyStart)); - std::pair p = IptcDataSets::decomposeKey(key); + std::pair p = IptcDataSets::decomposeKey(key); if (p.first == 0xffff) throw Error("Invalid key" + key); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key" + key); diff --git a/src/makernote.cpp b/src/makernote.cpp index a87cfc25..8eb81968 100644 --- a/src/makernote.cpp +++ b/src/makernote.cpp @@ -20,13 +20,13 @@ */ /* File: makernote.cpp - Version: $Name: $ $Revision: 1.26 $ + Version: $Name: $ $Revision: 1.27 $ Author(s): Andreas Huggel (ahu) History: 18-Feb-04, ahu: created */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.26 $ $RCSfile: makernote.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.27 $ $RCSfile: makernote.cpp,v $"); // Define DEBUG_* to output debug information to std::cerr #undef DEBUG_MAKERNOTE @@ -57,14 +57,14 @@ namespace Exiv2 { { } - std::string MakerNote::makeKey(uint16 tag) const + std::string MakerNote::makeKey(uint16_t tag) const { return std::string(ExifTags::familyName()) + "." + std::string(ifdItem()) + "." + tagName(tag); } // MakerNote::makeKey - uint16 MakerNote::decomposeKey(const std::string& key) const + uint16_t MakerNote::decomposeKey(const std::string& key) const { // Get the family, item and tag name parts of the key std::string::size_type pos1 = key.find('.'); @@ -79,14 +79,14 @@ namespace Exiv2 { if (tagName == "") throw Error("Invalid key"); if (familyName != ExifTags::familyName()) return 0xffff; - uint16 tag = this->tag(tagName); + uint16_t tag = this->tag(tagName); if (tag == 0xffff) return tag; if (ifdItem != this->ifdItem()) return 0xffff; return tag; } // MakerNote::decomposeKey - std::string MakerNote::tagName(uint16 tag) const + std::string MakerNote::tagName(uint16_t tag) const { std::string tagName; if (pMnTagInfo_) { @@ -106,9 +106,9 @@ namespace Exiv2 { return tagName; } // MakerNote::tagName - uint16 MakerNote::tag(const std::string& tagName) const + uint16_t MakerNote::tag(const std::string& tagName) const { - uint16 tag = 0xffff; + uint16_t tag = 0xffff; if (pMnTagInfo_) { for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) { if (pMnTagInfo_[i].name_ == tagName) { @@ -124,7 +124,7 @@ namespace Exiv2 { return tag; } // MakerNote::tag - std::string MakerNote::tagDesc(uint16 tag) const + std::string MakerNote::tagDesc(uint16_t tag) const { std::string tagDesc; if (pMnTagInfo_) { @@ -147,7 +147,7 @@ namespace Exiv2 { } } // MakerNote::taglist - std::ostream& MakerNote::writeMnTagInfo(std::ostream& os, uint16 tag) const + std::ostream& MakerNote::writeMnTagInfo(std::ostream& os, uint16_t tag) const { return os << tagName(tag) << ", " << std::dec << tag << ", " diff --git a/src/makernote.hpp b/src/makernote.hpp index 074b582e..aef50307 100644 --- a/src/makernote.hpp +++ b/src/makernote.hpp @@ -22,7 +22,7 @@ @file makernote.hpp @brief Contains the Exif %MakerNote interface, IFD %MakerNote and a MakerNote factory - @version $Name: $ $Revision: 1.22 $ + @version $Name: $ $Revision: 1.23 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 18-Feb-04, ahu: created @@ -109,10 +109,10 @@ namespace Exiv2 { //! MakerNote Tag information struct MnTagInfo { //! Constructor - MnTagInfo(uint16 tag, const char* name, const char* desc) + MnTagInfo(uint16_t tag, const char* name, const char* desc) : tag_(tag), name_(name), desc_(desc) {} - uint16 tag_; //!< Tag + uint16_t tag_; //!< Tag const char* name_; //!< One word tag label const char* desc_; //!< Short tag description }; // struct MnTagInfo @@ -165,9 +165,9 @@ namespace Exiv2 { //! @name Accessors //@{ //! Return the key for the tag. - std::string makeKey(uint16 tag) const; + std::string makeKey(uint16_t tag) const; //! Return the associated tag for a makernote key. - uint16 decomposeKey(const std::string& key) const; + uint16_t decomposeKey(const std::string& key) const; //! Return the byte order (little or big endian). ByteOrder byteOrder() const { return byteOrder_; } //! Return the offset of the makernote from the start of the TIFF header @@ -178,19 +178,19 @@ namespace Exiv2 { it translates the tag to a string with the hexadecimal value of the tag. */ - virtual std::string tagName(uint16 tag) const; + virtual std::string tagName(uint16_t tag) const; /*! @brief Return the description of a makernote tag. The default implementation looks up the makernote info tag array if one is set, else it returns an empty string. */ - virtual uint16 tag(const std::string& tagName) const; + virtual uint16_t tag(const std::string& tagName) const; /*! @brief Print a list of all tags known by this MakerNote to the output stream os. The default implementation prints all tags in the makernote info tag array if one is set. */ - virtual std::string tagDesc(uint16 tag) const; + virtual std::string tagDesc(uint16_t tag) const; /*! @brief Return the tag associated with a makernote tag name. The default implementation looks up the makernote info tag array @@ -201,7 +201,7 @@ namespace Exiv2 { /*! @brief Write the makernote tag info of tag to the output stream os. */ - virtual std::ostream& writeMnTagInfo(std::ostream& os, uint16 tag) const; + virtual std::ostream& writeMnTagInfo(std::ostream& os, uint16_t tag) const; /*! @brief Return a pointer to an newly created, empty instance of the same type as this. The makernote entries are not copied. @@ -226,7 +226,7 @@ namespace Exiv2 { virtual std::string ifdItem() const =0; //! Interpret and print the value of a makernote tag virtual std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const =0; //@} @@ -329,7 +329,7 @@ namespace Exiv2 { virtual IfdMakerNote* clone(bool alloc =true) const =0; virtual std::string ifdItem() const =0; virtual std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const =0; //@} diff --git a/src/metadatum.hpp b/src/metadatum.hpp index 96c9c29e..511cdc53 100644 --- a/src/metadatum.hpp +++ b/src/metadatum.hpp @@ -21,7 +21,7 @@ /*! @file metadatum.hpp @brief Provides abstract base classes Metadatum and Key - @version $Name: $ $Revision: 1.2 $ + @version $Name: $ $Revision: 1.3 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @author Brad Schick (brad) @@ -76,7 +76,7 @@ namespace Exiv2 { //! Return the name of the tag (which is also the third part of the key) virtual std::string tagName() const =0; //! Return the tag number - virtual uint16 tag() const =0; + virtual uint16_t tag() const =0; /*! @brief Return a pointer to a copy of itself (deep copy). The caller owns this copy and is responsible to delete it! @@ -164,7 +164,7 @@ namespace Exiv2 { //! Return the name of the tag (which is also the third part of the key) virtual std::string tagName() const =0; //! Return the tag - virtual uint16 tag() const =0; + virtual uint16_t tag() const =0; //! Return the type id of the value virtual TypeId typeId() const =0; //! Return the name of the type diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp index beef3196..cc081b59 100644 --- a/src/nikonmn.cpp +++ b/src/nikonmn.cpp @@ -20,14 +20,14 @@ */ /* File: nikon1mn.cpp - Version: $Name: $ $Revision: 1.5 $ + Version: $Name: $ $Revision: 1.6 $ Author(s): Andreas Huggel (ahu) History: 17-May-04, ahu: created 25-May-04, ahu: combined all Nikon formats in one component */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.5 $ $RCSfile: nikonmn.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.6 $ $RCSfile: nikonmn.cpp,v $"); // ***************************************************************************** // included header files @@ -83,7 +83,7 @@ namespace Exiv2 { } std::ostream& Nikon1MakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { @@ -235,7 +235,7 @@ namespace Exiv2 { } std::ostream& Nikon2MakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { @@ -424,7 +424,7 @@ namespace Exiv2 { } std::ostream& Nikon3MakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { diff --git a/src/nikonmn.hpp b/src/nikonmn.hpp index ca129721..17f93b69 100644 --- a/src/nikonmn.hpp +++ b/src/nikonmn.hpp @@ -28,7 +28,7 @@ Exif file format by TsuruZoh Tachibanaya.
Format 3: "EXIFutils Field Reference Guide". - @version $Name: $ $Revision: 1.4 $ + @version $Name: $ $Revision: 1.5 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 17-May-04, ahu: created
@@ -106,7 +106,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Nikon1") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} @@ -185,7 +185,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Nikon2") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} @@ -239,7 +239,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Nikon3") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} diff --git a/src/sigmamn.cpp b/src/sigmamn.cpp index daa62e51..cd45a583 100644 --- a/src/sigmamn.cpp +++ b/src/sigmamn.cpp @@ -20,7 +20,7 @@ */ /* File: sigmamn.cpp - Version: $Name: $ $Revision: 1.9 $ + Version: $Name: $ $Revision: 1.10 $ Author(s): Andreas Huggel (ahu) History: 02-Apr-04, ahu: created Credits: Sigma and Foveon MakerNote implemented according to the specification @@ -29,7 +29,7 @@ */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.9 $ $RCSfile: sigmamn.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.10 $ $RCSfile: sigmamn.cpp,v $"); // ***************************************************************************** // included header files @@ -126,7 +126,7 @@ namespace Exiv2 { } std::ostream& SigmaMakerNote::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const { switch (tag) { diff --git a/src/sigmamn.hpp b/src/sigmamn.hpp index 0ae6d3d3..c6ff0883 100644 --- a/src/sigmamn.hpp +++ b/src/sigmamn.hpp @@ -23,7 +23,7 @@ @brief Sigma and Foveon MakerNote implemented according to the specification SIGMA and FOVEON EXIF MakerNote Documentation by Foveon. - @version $Name: $ $Revision: 1.7 $ + @version $Name: $ $Revision: 1.8 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 02-Apr-04, ahu: created @@ -108,7 +108,7 @@ namespace Exiv2 { //! Return the name of the makernote item ("Sigma") std::string ifdItem() const { return ifdItem_; } std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, const Value& value) const; //@} diff --git a/src/tags.cpp b/src/tags.cpp index f82688b1..fef2e227 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -20,13 +20,13 @@ */ /* File: tags.cpp - Version: $Name: $ $Revision: 1.34 $ + Version: $Name: $ $Revision: 1.35 $ Author(s): Andreas Huggel (ahu) History: 15-Jan-04, ahu: created */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.34 $ $RCSfile: tags.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.35 $ $RCSfile: tags.cpp,v $"); // ***************************************************************************** // included header files @@ -90,7 +90,7 @@ namespace Exiv2 { }; TagInfo::TagInfo( - uint16 tag, + uint16_t tag, const char* name, const char* desc, IfdId ifdId, @@ -268,7 +268,7 @@ namespace Exiv2 { const char* ExifTags::familyName_ = "Exif"; - int ExifTags::tagInfoIdx(uint16 tag, IfdId ifdId) + int ExifTags::tagInfoIdx(uint16_t tag, IfdId ifdId) { const TagInfo* tagInfo = tagInfos_[ifdId]; if (tagInfo == 0) return -1; @@ -279,21 +279,21 @@ namespace Exiv2 { return idx; } - const char* ExifTags::tagName(uint16 tag, IfdId ifdId) + const char* ExifTags::tagName(uint16_t tag, IfdId ifdId) { int idx = tagInfoIdx(tag, ifdId); if (idx == -1) throw Error("No taginfo for IFD"); return tagInfos_[ifdId][idx].name_; } - const char* ExifTags::tagDesc(uint16 tag, IfdId ifdId) + const char* ExifTags::tagDesc(uint16_t tag, IfdId ifdId) { int idx = tagInfoIdx(tag, ifdId); if (idx == -1) throw Error("No taginfo for IFD"); return tagInfos_[ifdId][idx].desc_; } - const char* ExifTags::sectionName(uint16 tag, IfdId ifdId) + const char* ExifTags::sectionName(uint16_t tag, IfdId ifdId) { int idx = tagInfoIdx(tag, ifdId); if (idx == -1) throw Error("No taginfo for IFD"); @@ -301,7 +301,7 @@ namespace Exiv2 { return sectionInfo_[tagInfo[idx].sectionId_].name_; } - const char* ExifTags::sectionDesc(uint16 tag, IfdId ifdId) + const char* ExifTags::sectionDesc(uint16_t tag, IfdId ifdId) { int idx = tagInfoIdx(tag, ifdId); if (idx == -1) throw Error("No taginfo for IFD"); @@ -309,7 +309,7 @@ namespace Exiv2 { return sectionInfo_[tagInfo[idx].sectionId_].desc_; } - uint16 ExifTags::tag(const std::string& tagName, IfdId ifdId) + uint16_t ExifTags::tag(const std::string& tagName, IfdId ifdId) { const TagInfo* tagInfo = tagInfos_[ifdId]; if (tagInfo == 0) return 0xffff; @@ -344,7 +344,7 @@ namespace Exiv2 { return SectionId(i); } - std::string ExifTags::makeKey(uint16 tag, IfdId ifdId) + std::string ExifTags::makeKey(uint16_t tag, IfdId ifdId) { return std::string(familyName()) + "." + std::string(ifdItem(ifdId)) @@ -353,7 +353,7 @@ namespace Exiv2 { // This 'database lookup' function returns the first match that // we find, it doesn't verify whether this is the only match. - std::pair ExifTags::decomposeKey(const std::string& key) + std::pair ExifTags::decomposeKey(const std::string& key) { // Get the family name, IFD name and tag name parts of the key std::string::size_type pos1 = key.find('.'); @@ -383,7 +383,7 @@ namespace Exiv2 { } // ExifTags::decomposeKey std::ostream& ExifTags::printTag(std::ostream& os, - uint16 tag, + uint16_t tag, IfdId ifdId, const Value& value) { @@ -430,8 +430,8 @@ namespace Exiv2 { std::istream& operator>>(std::istream& is, Rational& r) { - int32 nominator; - int32 denominator; + int32_t nominator; + int32_t denominator; char c; is >> nominator >> c >> denominator; if (is && c == '/') r = std::make_pair(nominator, denominator); @@ -445,8 +445,8 @@ namespace Exiv2 { std::istream& operator>>(std::istream& is, URational& r) { - uint32 nominator; - uint32 denominator; + uint32_t nominator; + uint32_t denominator; char c; is >> nominator >> c >> denominator; if (is && c == '/') r = std::make_pair(nominator, denominator); @@ -555,12 +555,12 @@ namespace Exiv2 { { Rational t = value.toRational(); if (t.first > 1 && t.second > 1 && t.second >= t.first) { - t.second = static_cast( + t.second = static_cast( static_cast(t.second) / t.first + 0.5); t.first = 1; } if (t.second > 1 && t.second < t.first) { - t.first = static_cast( + t.first = static_cast( static_cast(t.first) / t.second + 0.5); t.second = 1; } @@ -653,7 +653,7 @@ namespace Exiv2 { if (distance.first == 0) { os << "Unknown"; } - else if (static_cast(distance.first) == 0xffffffff) { + else if (static_cast(distance.first) == 0xffffffff) { os << "Infinity"; } else if (distance.second != 0) { diff --git a/src/tags.hpp b/src/tags.hpp index 3e5eec73..0a3a6593 100644 --- a/src/tags.hpp +++ b/src/tags.hpp @@ -21,7 +21,7 @@ /*! @file tags.hpp @brief Exif tag and type information - @version $Name: $ $Revision: 1.25 $ + @version $Name: $ $Revision: 1.26 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 15-Jan-04, ahu: created
@@ -89,14 +89,14 @@ namespace Exiv2 { struct TagInfo { //! Constructor TagInfo( - uint16 tag, + uint16_t tag, const char* name, const char* desc, IfdId ifdId, SectionId sectionId, PrintFct printFct ); - uint16 tag_; //!< Tag + uint16_t tag_; //!< Tag const char* name_; //!< One word tag label const char* desc_; //!< Short tag description IfdId ifdId_; //!< Link to the (prefered) IFD @@ -126,7 +126,7 @@ namespace Exiv2 { @throw Error ("No taginfo for IFD") if there is no tag info data for the given IFD id in the lookup tables. */ - static const char* tagName(uint16 tag, IfdId ifdId); + static const char* tagName(uint16_t tag, IfdId ifdId); /*! @brief Return the description of the tag. @param tag The tag @@ -136,9 +136,9 @@ namespace Exiv2 { @throw Error ("No taginfo for IFD") if there is no tag info data for the given IFD id in the lookup tables. */ - static const char* tagDesc(uint16 tag, IfdId ifdId); + static const char* tagDesc(uint16_t tag, IfdId ifdId); //! Return the tag for one combination of IFD id and tagName - static uint16 tag(const std::string& tagName, IfdId ifdId); + static uint16_t tag(const std::string& tagName, IfdId ifdId); //! Return the name of the IFD static const char* ifdName(IfdId ifdId); //! Return the related image item (image or thumbnail) @@ -155,7 +155,7 @@ namespace Exiv2 { @throw Error ("No taginfo for IFD") if there is no tag info data for the given IFD id in the lookup tables. */ - static const char* sectionName(uint16 tag, IfdId ifdId); + static const char* sectionName(uint16_t tag, IfdId ifdId); /*! @brief Return the description of the section for a combination of tag and IFD id. @@ -166,31 +166,31 @@ namespace Exiv2 { @throw Error ("No taginfo for IFD") if there is no tag info data for the given IFD id in the lookup tables. */ - static const char* sectionDesc(uint16 tag, IfdId ifdId); + static const char* sectionDesc(uint16_t tag, IfdId ifdId); //! Return the section id for a section name static SectionId sectionId(const std::string& sectionName); /*! @brief Return the key for the tag and IFD id. The key is of the form 'Exif.ifdItem.tagName'. */ - static std::string makeKey(uint16 tag, IfdId ifdId); + static std::string makeKey(uint16_t tag, IfdId ifdId); /*! @brief Return tag and IFD id pair for the key. @return A pair consisting of the tag and IFD id. @throw Error ("Invalid key") if the key cannot be parsed into item item, section name and tag name parts. */ - static std::pair decomposeKey(const std::string& key); + static std::pair decomposeKey(const std::string& key); //! Interpret and print the value of an Exif tag static std::ostream& printTag(std::ostream& os, - uint16 tag, + uint16_t tag, IfdId ifdId, const Value& value); //! Print a list of all tags to output stream static void taglist(std::ostream& os); private: - static int tagInfoIdx(uint16 tag, IfdId ifdId); + static int tagInfoIdx(uint16_t tag, IfdId ifdId); static const char* familyName_; diff --git a/src/types.cpp b/src/types.cpp index 1e20eeea..1845be66 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -20,14 +20,14 @@ */ /* File: types.cpp - Version: $Name: $ $Revision: 1.12 $ + Version: $Name: $ $Revision: 1.13 $ Author(s): Andreas Huggel (ahu) History: 26-Jan-04, ahu: created 11-Feb-04, ahu: isolated as a component */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.12 $ $RCSfile: types.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: types.cpp,v $"); // ***************************************************************************** // included header files @@ -80,7 +80,7 @@ namespace Exiv2 { // ************************************************************************* // free functions - uint16 getUShort(const byte* buf, ByteOrder byteOrder) + uint16_t getUShort(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { return (byte)buf[1] << 8 | (byte)buf[0]; @@ -90,7 +90,7 @@ namespace Exiv2 { } } - uint32 getULong(const byte* buf, ByteOrder byteOrder) + uint32_t getULong(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { return (byte)buf[3] << 24 | (byte)buf[2] << 16 @@ -104,12 +104,12 @@ namespace Exiv2 { URational getURational(const byte* buf, ByteOrder byteOrder) { - uint32 nominator = getULong(buf, byteOrder); - uint32 denominator = getULong(buf + 4, byteOrder); + uint32_t nominator = getULong(buf, byteOrder); + uint32_t denominator = getULong(buf + 4, byteOrder); return std::make_pair(nominator, denominator); } - int16 getShort(const byte* buf, ByteOrder byteOrder) + int16_t getShort(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { return (byte)buf[1] << 8 | (byte)buf[0]; @@ -119,7 +119,7 @@ namespace Exiv2 { } } - int32 getLong(const byte* buf, ByteOrder byteOrder) + int32_t getLong(const byte* buf, ByteOrder byteOrder) { if (byteOrder == littleEndian) { return (byte)buf[3] << 24 | (byte)buf[2] << 16 @@ -133,12 +133,12 @@ namespace Exiv2 { Rational getRational(const byte* buf, ByteOrder byteOrder) { - int32 nominator = getLong(buf, byteOrder); - int32 denominator = getLong(buf + 4, byteOrder); + int32_t nominator = getLong(buf, byteOrder); + int32_t denominator = getLong(buf + 4, byteOrder); return std::make_pair(nominator, denominator); } - long us2Data(byte* buf, uint16 s, ByteOrder byteOrder) + long us2Data(byte* buf, uint16_t s, ByteOrder byteOrder) { if (byteOrder == littleEndian) { buf[0] = (byte)(s & 0x00ff); @@ -151,7 +151,7 @@ namespace Exiv2 { return 2; } - long ul2Data(byte* buf, uint32 l, ByteOrder byteOrder) + long ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder) { if (byteOrder == littleEndian) { buf[0] = (byte)(l & 0x000000ff); @@ -175,7 +175,7 @@ namespace Exiv2 { return o; } - long s2Data(byte* buf, int16 s, ByteOrder byteOrder) + long s2Data(byte* buf, int16_t s, ByteOrder byteOrder) { if (byteOrder == littleEndian) { buf[0] = (byte)(s & 0x00ff); @@ -188,7 +188,7 @@ namespace Exiv2 { return 2; } - long l2Data(byte* buf, int32 l, ByteOrder byteOrder) + long l2Data(byte* buf, int32_t l, ByteOrder byteOrder) { if (byteOrder == littleEndian) { buf[0] = (byte)(l & 0x000000ff); diff --git a/src/types.hpp b/src/types.hpp index 9c40393d..b1469f5f 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -21,7 +21,7 @@ /*! @file types.hpp @brief Type definitions for %Exiv2 and related functionality - @version $Name: $ $Revision: 1.20 $ + @version $Name: $ $Revision: 1.21 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 09-Jan-04, ahu: created
@@ -33,13 +33,22 @@ // ***************************************************************************** // included header files +#ifdef HAVE_CONFIG_H +# include +#else +# ifdef _MSC_VER +# include +# endif +#endif // + standard includes #include #include #include #include - +#ifdef HAVE_STDINT_H +# include +#endif #ifdef _MSC_VER // disable unreferenced formal parameter warning C4100 @@ -56,22 +65,12 @@ namespace Exiv2 { // type definitions //! 1 byte unsigned integer type. - typedef unsigned char byte; - //! 2 byte unsigned integer type. - typedef unsigned short uint16; - //! 4 byte unsigned integer type. - typedef unsigned long uint32; - //! 2 byte signed integer type. - typedef short int16; - //! 4 byte signed integer type. - typedef long int32; - - + typedef uint8_t byte; //! 8 byte unsigned rational type. - typedef std::pair URational; + typedef std::pair URational; //! 8 byte signed rational type. - typedef std::pair Rational; + typedef std::pair Rational; //! Type to express the byte order (little or big endian) enum ByteOrder { invalidByteOrder, littleEndian, bigEndian }; @@ -152,15 +151,15 @@ namespace Exiv2 { // free functions //! Read a 2 byte unsigned short value from the data buffer - uint16 getUShort(const byte* buf, ByteOrder byteOrder); + uint16_t getUShort(const byte* buf, ByteOrder byteOrder); //! Read a 4 byte unsigned long value from the data buffer - uint32 getULong(const byte* buf, ByteOrder byteOrder); + uint32_t getULong(const byte* buf, ByteOrder byteOrder); //! Read an 8 byte unsigned rational value from the data buffer URational getURational(const byte* buf, ByteOrder byteOrder); //! Read a 2 byte signed short value from the data buffer - int16 getShort(const byte* buf, ByteOrder byteOrder); + int16_t getShort(const byte* buf, ByteOrder byteOrder); //! Read a 4 byte signed long value from the data buffer - int32 getLong(const byte* buf, ByteOrder byteOrder); + int32_t getLong(const byte* buf, ByteOrder byteOrder); //! Read an 8 byte signed rational value from the data buffer Rational getRational(const byte* buf, ByteOrder byteOrder); @@ -177,12 +176,12 @@ namespace Exiv2 { @brief Convert an unsigned short to data, write the data to the buffer, return number of bytes written. */ - long us2Data(byte* buf, uint16 s, ByteOrder byteOrder); + long us2Data(byte* buf, uint16_t s, ByteOrder byteOrder); /*! @brief Convert an unsigned long to data, write the data to the buffer, return number of bytes written. */ - long ul2Data(byte* buf, uint32 l, ByteOrder byteOrder); + long ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder); /*! @brief Convert an unsigned rational to data, write the data to the buffer, return number of bytes written. @@ -192,12 +191,12 @@ namespace Exiv2 { @brief Convert a signed short to data, write the data to the buffer, return number of bytes written. */ - long s2Data(byte* buf, int16 s, ByteOrder byteOrder); + long s2Data(byte* buf, int16_t s, ByteOrder byteOrder); /*! @brief Convert a signed long to data, write the data to the buffer, return number of bytes written. */ - long l2Data(byte* buf, int32 l, ByteOrder byteOrder); + long l2Data(byte* buf, int32_t l, ByteOrder byteOrder); /*! @brief Convert a signed rational to data, write the data to the buffer, return number of bytes written. diff --git a/src/value.cpp b/src/value.cpp index 2299018c..5a73b61b 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -20,7 +20,7 @@ */ /* File: value.cpp - Version: $Name: $ $Revision: 1.13 $ + Version: $Name: $ $Revision: 1.14 $ Author(s): Andreas Huggel (ahu) History: 26-Jan-04, ahu: created 11-Feb-04, ahu: isolated as a component @@ -28,7 +28,7 @@ */ // ***************************************************************************** #include "rcsid.hpp" -EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: value.cpp,v $"); +EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: value.cpp,v $"); // ***************************************************************************** // included header files @@ -68,10 +68,10 @@ namespace Exiv2 { value = new AsciiValue; break; case unsignedShort: - value = new ValueType; + value = new ValueType; break; case unsignedLong: - value = new ValueType; + value = new ValueType; break; case unsignedRational: value = new ValueType; @@ -83,10 +83,10 @@ namespace Exiv2 { value = new DataValue; break; case signedShort: - value = new ValueType; + value = new ValueType; break; case signedLong: - value = new ValueType; + value = new ValueType; break; case signedRational: value = new ValueType; diff --git a/src/value.hpp b/src/value.hpp index 9765223b..8b04befb 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -21,7 +21,7 @@ /*! @file value.hpp @brief Value interface and concrete subclasses - @version $Name: $ $Revision: 1.15 $ + @version $Name: $ $Revision: 1.16 $ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 09-Jan-04, ahu: created @@ -164,13 +164,13 @@ namespace Exiv2 { unsignedByte%DataValue(unsignedByte) asciiString%AsciiValue string%StringValue - unsignedShort%ValueType < uint16 > - unsignedLong%ValueType < uint32 > + unsignedShort%ValueType < uint16_t > + unsignedLong%ValueType < uint32_t > unsignedRational%ValueType < URational > invalid6%DataValue(invalid6) undefined%DataValue - signedShort%ValueType < int16 > - signedLong%ValueType < int32 > + signedShort%ValueType < int16_t > + signedLong%ValueType < int32_t > signedRational%ValueType < Rational > date%DateValue time%TimeValue @@ -628,15 +628,15 @@ namespace Exiv2 { template TypeId getType(); //! Specialization for an unsigned short - template<> inline TypeId getType() { return unsignedShort; } + template<> inline TypeId getType() { return unsignedShort; } //! Specialization for an unsigned long - template<> inline TypeId getType() { return unsignedLong; } + template<> inline TypeId getType() { return unsignedLong; } //! Specialization for an unsigned rational template<> inline TypeId getType() { return unsignedRational; } //! Specialization for a signed short - template<> inline TypeId getType() { return signedShort; } + template<> inline TypeId getType() { return signedShort; } //! Specialization for a signed long - template<> inline TypeId getType() { return signedLong; } + template<> inline TypeId getType() { return signedLong; } //! Specialization for a signed rational template<> inline TypeId getType() { return signedRational; } @@ -707,15 +707,15 @@ namespace Exiv2 { }; // class ValueType //! Unsigned short value type - typedef ValueType UShortValue; + typedef ValueType UShortValue; //! Unsigned long value type - typedef ValueType ULongValue; + typedef ValueType ULongValue; //! Unsigned rational value type typedef ValueType URationalValue; //! Signed short value type - typedef ValueType ShortValue; + typedef ValueType ShortValue; //! Signed long value type - typedef ValueType LongValue; + typedef ValueType LongValue; //! Signed rational value type typedef ValueType RationalValue; @@ -736,13 +736,13 @@ namespace Exiv2 { template T getValue(const byte* buf, ByteOrder byteOrder); // Specialization for a 2 byte unsigned short value. template<> - inline uint16 getValue(const byte* buf, ByteOrder byteOrder) + inline uint16_t getValue(const byte* buf, ByteOrder byteOrder) { return getUShort(buf, byteOrder); } // Specialization for a 4 byte unsigned long value. template<> - inline uint32 getValue(const byte* buf, ByteOrder byteOrder) + inline uint32_t getValue(const byte* buf, ByteOrder byteOrder) { return getULong(buf, byteOrder); } @@ -754,13 +754,13 @@ namespace Exiv2 { } // Specialization for a 2 byte signed short value. template<> - inline int16 getValue(const byte* buf, ByteOrder byteOrder) + inline int16_t getValue(const byte* buf, ByteOrder byteOrder) { return getShort(buf, byteOrder); } // Specialization for a 4 byte signed long value. template<> - inline int32 getValue(const byte* buf, ByteOrder byteOrder) + inline int32_t getValue(const byte* buf, ByteOrder byteOrder) { return getLong(buf, byteOrder); } @@ -789,7 +789,7 @@ namespace Exiv2 { Return the number of bytes written. */ template<> - inline long toData(byte* buf, uint16 t, ByteOrder byteOrder) + inline long toData(byte* buf, uint16_t t, ByteOrder byteOrder) { return us2Data(buf, t, byteOrder); } @@ -798,7 +798,7 @@ namespace Exiv2 { Return the number of bytes written. */ template<> - inline long toData(byte* buf, uint32 t, ByteOrder byteOrder) + inline long toData(byte* buf, uint32_t t, ByteOrder byteOrder) { return ul2Data(buf, t, byteOrder); } @@ -816,7 +816,7 @@ namespace Exiv2 { Return the number of bytes written. */ template<> - inline long toData(byte* buf, int16 t, ByteOrder byteOrder) + inline long toData(byte* buf, int16_t t, ByteOrder byteOrder) { return s2Data(buf, t, byteOrder); } @@ -825,7 +825,7 @@ namespace Exiv2 { Return the number of bytes written. */ template<> - inline long toData(byte* buf, int32 t, ByteOrder byteOrder) + inline long toData(byte* buf, int32_t t, ByteOrder byteOrder) { return l2Data(buf, t, byteOrder); }