Replaced custom integer types with C99 types

v0.27.3
Andreas Huggel 21 years ago
parent ff8f4c55ea
commit a25763d070

@ -1,8 +1,29 @@
/* config.h.in. Generated from configure.ac by autoheader. */ /* 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 <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */ to 0 otherwise. */
#undef HAVE_MALLOC #undef HAVE_MALLOC
@ -50,6 +71,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
@ -59,6 +83,9 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if the system has the type `_Bool'. */ /* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL #undef HAVE__BOOL
@ -81,9 +108,20 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #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. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME #undef TM_IN_SYS_TIME

@ -17,7 +17,7 @@ AC_PROG_RANLIB
# Checks for header files. # Checks for header files.
AC_HEADER_STDC 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. # Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL AC_HEADER_STDBOOL

@ -20,7 +20,7 @@
*/ */
/* /*
File: canonmn.cpp File: canonmn.cpp
Version: $Name: $ $Revision: 1.13 $ Version: $Name: $ $Revision: 1.14 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 18-Feb-04, ahu: created History: 18-Feb-04, ahu: created
07-Mar-04, ahu: isolated as a separate component 07-Mar-04, ahu: isolated as a separate component
@ -30,7 +30,7 @@
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -78,7 +78,7 @@ namespace Exiv2 {
} }
std::ostream& CanonMakerNote::printTag(std::ostream& os, std::ostream& CanonMakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {
@ -288,7 +288,7 @@ namespace Exiv2 {
const Value& value) const Value& value)
{ {
std::istringstream is(value.toString()); std::istringstream is(value.toString());
uint32 l; uint32_t l;
is >> 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) << ((l & 0xffff0000) >> 16)

@ -23,7 +23,7 @@
@brief Canon MakerNote implemented according to the specification @brief Canon MakerNote implemented according to the specification
<a href="http://www.burren.cx/david/canon.html"> <a href="http://www.burren.cx/david/canon.html">
EXIF MakerNote of Canon</a> by David Burren EXIF MakerNote of Canon</a> by David Burren
@version $Name: $ $Revision: 1.10 $ @version $Name: $ $Revision: 1.11 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 18-Feb-04, ahu: created<BR> @date 18-Feb-04, ahu: created<BR>
@ -101,7 +101,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Canon") //! Return the name of the makernote item ("Canon")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}

@ -20,13 +20,13 @@
*/ */
/* /*
File: datasets.cpp File: datasets.cpp
Version: $Name: $ $Revision: 1.4 $ Version: $Name: $ $Revision: 1.5 $
Author(s): Brad Schick (brad) <schick@robotbattle.com> Author(s): Brad Schick (brad) <schick@robotbattle.com>
History: 24-Jul-04, brad: created History: 24-Jul-04, brad: created
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -43,15 +43,15 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: datasets.cpp,v $");
namespace Exiv2 { namespace Exiv2 {
DataSet::DataSet( DataSet::DataSet(
uint16 number, uint16_t number,
const char* name, const char* name,
const char* desc, const char* desc,
bool mandatory, bool mandatory,
bool repeatable, bool repeatable,
uint32 minbytes, uint32_t minbytes,
uint32 maxbytes, uint32_t maxbytes,
TypeId type, TypeId type,
uint16 recordId, uint16_t recordId,
const char* photoshop const char* photoshop
) )
: number_(number), name_(name), desc_(desc), mandatory_(mandatory), : number_(number), name_(name), desc_(desc), mandatory_(mandatory),
@ -61,7 +61,7 @@ namespace Exiv2 {
} }
RecordInfo::RecordInfo( RecordInfo::RecordInfo(
uint16 recordId, uint16_t recordId,
const char* name, const char* name,
const char* desc const char* desc
) )
@ -164,7 +164,7 @@ namespace Exiv2 {
const char* IptcDataSets::familyName_ = "Iptc"; 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; if( recordId != envelope && recordId != application2 ) return -1;
const DataSet* dataSet = records_[recordId]; const DataSet* dataSet = records_[recordId];
@ -176,7 +176,7 @@ namespace Exiv2 {
return idx; 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; if( recordId != envelope && recordId != application2 ) return -1;
const DataSet* dataSet = records_[recordId]; const DataSet* dataSet = records_[recordId];
@ -188,42 +188,42 @@ namespace Exiv2 {
return idx; return idx;
} }
TypeId IptcDataSets::dataSetType(uint16 number, uint16 recordId) TypeId IptcDataSets::dataSetType(uint16_t number, uint16_t recordId)
{ {
int idx = dataSetIdx(number, recordId); int idx = dataSetIdx(number, recordId);
if (idx == -1) throw Error("No dataSet for record Id"); if (idx == -1) throw Error("No dataSet for record Id");
return records_[recordId][idx].type_; 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); int idx = dataSetIdx(number, recordId);
if (idx == -1) throw Error("No dataSet for record Id"); if (idx == -1) throw Error("No dataSet for record Id");
return records_[recordId][idx].name_; 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); int idx = dataSetIdx(number, recordId);
if (idx == -1) throw Error("No dataSet for record Id"); if (idx == -1) throw Error("No dataSet for record Id");
return records_[recordId][idx].desc_; 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); int idx = dataSetIdx(number, recordId);
if (idx == -1) throw Error("No dataSet for record Id"); if (idx == -1) throw Error("No dataSet for record Id");
return records_[recordId][idx].photoshop_; 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); int idx = dataSetIdx(number, recordId);
if (idx == -1) throw Error("No dataSet for record Id"); if (idx == -1) throw Error("No dataSet for record Id");
return records_[recordId][idx].repeatable_; return records_[recordId][idx].repeatable_;
} }
const char* IptcDataSets::recordName(uint16 recordId) const char* IptcDataSets::recordName(uint16_t recordId)
{ {
if( recordId != envelope && recordId != application2 ) { if( recordId != envelope && recordId != application2 ) {
throw Error("Unknown record"); throw Error("Unknown record");
@ -231,7 +231,7 @@ namespace Exiv2 {
return recordInfo_[recordId].name_; return recordInfo_[recordId].name_;
} }
const char* IptcDataSets::recordDesc(uint16 recordId) const char* IptcDataSets::recordDesc(uint16_t recordId)
{ {
if( recordId != envelope && recordId != application2 ) { if( recordId != envelope && recordId != application2 ) {
throw Error("Unknown record"); throw Error("Unknown record");
@ -239,9 +239,9 @@ namespace Exiv2 {
return recordInfo_[recordId].desc_; 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) { for (i = application2; i > 0; --i) {
if (recordInfo_[i].name_ == recordName) break; if (recordInfo_[i].name_ == recordName) break;
} }
@ -255,7 +255,7 @@ namespace Exiv2 {
+ "." + dataSet.name_; + "." + dataSet.name_;
} }
std::string IptcDataSets::makeKey(uint16 number, uint16 recordId) std::string IptcDataSets::makeKey(uint16_t number, uint16_t recordId)
{ {
return std::string(familyName()) return std::string(familyName())
+ "." + std::string(recordName(recordId)) + "." + std::string(recordName(recordId))
@ -263,7 +263,7 @@ namespace Exiv2 {
} }
// This 'database lookup' function returns a match if it exists // This 'database lookup' function returns a match if it exists
std::pair<uint16, uint16> IptcDataSets::decomposeKey(const std::string& key) std::pair<uint16_t, uint16_t> IptcDataSets::decomposeKey(const std::string& key)
{ {
// Get the type, record name and dataSet name parts of the key // Get the type, record name and dataSet name parts of the key
std::string::size_type pos1 = key.find('.'); std::string::size_type pos1 = key.find('.');
@ -279,11 +279,11 @@ namespace Exiv2 {
if (dataSetName == "") throw Error("Invalid key"); if (dataSetName == "") throw Error("Invalid key");
// Use the parts of the key to find dataSet and recordInfo // Use the parts of the key to find dataSet and recordInfo
uint16 recId = recordId(recordName); uint16_t recId = recordId(recordName);
if (recId == invalidRecord) return std::make_pair((uint16)0xffff, invalidRecord); if (recId == invalidRecord) return std::make_pair((uint16_t)0xffff, invalidRecord);
int idx = dataSetIdx(dataSetName, recId); 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); return std::make_pair(records_[recId][idx].number_, recId);
} // IptcDataSets::decomposeKey } // IptcDataSets::decomposeKey

@ -21,7 +21,7 @@
/*! /*!
@file datasets.hpp @file datasets.hpp
@brief Iptc dataSet and type information @brief Iptc dataSet and type information
@version $Name: $ $Revision: 1.3 $ @version $Name: $ $Revision: 1.4 $
@author Brad Schick (brad) <schick@robotbattle.com> @author Brad Schick (brad) <schick@robotbattle.com>
@date 24-Jul-04, brad: created @date 24-Jul-04, brad: created
*/ */
@ -47,8 +47,8 @@ namespace Exiv2 {
//! Contains information about one record //! Contains information about one record
struct RecordInfo { struct RecordInfo {
//! Constructor //! Constructor
RecordInfo(uint16 recordId, const char* name, const char* desc); RecordInfo(uint16_t recordId, const char* name, const char* desc);
uint16 recordId_; //!< Record id uint16_t recordId_; //!< Record id
const char* name_; //!< Record name (one word) const char* name_; //!< Record name (one word)
const char* desc_; //!< Record description const char* desc_; //!< Record description
}; };
@ -57,27 +57,27 @@ namespace Exiv2 {
struct DataSet { struct DataSet {
//! Constructor //! Constructor
DataSet( DataSet(
uint16 number, uint16_t number,
const char* name, const char* name,
const char* desc, const char* desc,
bool mandatory, bool mandatory,
bool repeatable, bool repeatable,
uint32 minbytes, uint32_t minbytes,
uint32 maxbytes, uint32_t maxbytes,
TypeId type, TypeId type,
uint16 recordId, uint16_t recordId,
const char* photoshop const char* photoshop
); );
//@{ //@{
uint16 number_; uint16_t number_;
const char* name_; const char* name_;
const char* desc_; const char* desc_;
bool mandatory_; bool mandatory_;
bool repeatable_; bool repeatable_;
uint32 minbytes_; uint32_t minbytes_;
uint32 maxbytes_; uint32_t maxbytes_;
TypeId type_; TypeId type_;
uint16 recordId_; uint16_t recordId_;
const char* photoshop_; const char* photoshop_;
//@} //@}
}; // struct DataSet }; // struct DataSet
@ -92,84 +92,84 @@ namespace Exiv2 {
IIM4 standard (and not commonly used in images). IIM4 standard (and not commonly used in images).
*/ */
//@{ //@{
static const uint16 invalidRecord = 0; static const uint16_t invalidRecord = 0;
static const uint16 envelope = 1; static const uint16_t envelope = 1;
static const uint16 application2 = 2; static const uint16_t application2 = 2;
//@} //@}
//! @name Dataset identifiers //! @name Dataset identifiers
//@{ //@{
static const uint16 ModelVersion = 0; static const uint16_t ModelVersion = 0;
static const uint16 Destination = 5; static const uint16_t Destination = 5;
static const uint16 FileFormat = 20; static const uint16_t FileFormat = 20;
static const uint16 FileVersion = 22; static const uint16_t FileVersion = 22;
static const uint16 ServiceId = 30; static const uint16_t ServiceId = 30;
static const uint16 EnvelopeNumber = 40; static const uint16_t EnvelopeNumber = 40;
static const uint16 ProductId = 50; static const uint16_t ProductId = 50;
static const uint16 EnvelopePriority = 60; static const uint16_t EnvelopePriority = 60;
static const uint16 DateSent = 70; static const uint16_t DateSent = 70;
static const uint16 TimeSent = 80; static const uint16_t TimeSent = 80;
static const uint16 CharacterSet = 90; static const uint16_t CharacterSet = 90;
static const uint16 UNO = 100; static const uint16_t UNO = 100;
static const uint16 ARMId = 120; static const uint16_t ARMId = 120;
static const uint16 ARMVersion = 122; static const uint16_t ARMVersion = 122;
static const uint16 RecordVersion = 0; static const uint16_t RecordVersion = 0;
static const uint16 ObjectType = 3; static const uint16_t ObjectType = 3;
static const uint16 ObjectAttribute = 4; static const uint16_t ObjectAttribute = 4;
static const uint16 ObjectName = 5; static const uint16_t ObjectName = 5;
static const uint16 EditStatus = 7; static const uint16_t EditStatus = 7;
static const uint16 EditorialUpdate = 8; static const uint16_t EditorialUpdate = 8;
static const uint16 Urgency = 10; static const uint16_t Urgency = 10;
static const uint16 Subject = 12; static const uint16_t Subject = 12;
static const uint16 Category = 15; static const uint16_t Category = 15;
static const uint16 SuppCategory = 20; static const uint16_t SuppCategory = 20;
static const uint16 FixtureId = 22; static const uint16_t FixtureId = 22;
static const uint16 Keywords = 25; static const uint16_t Keywords = 25;
static const uint16 LocationCode = 26; static const uint16_t LocationCode = 26;
static const uint16 LocationName = 27; static const uint16_t LocationName = 27;
static const uint16 ReleaseDate = 30; static const uint16_t ReleaseDate = 30;
static const uint16 ReleaseTime = 35; static const uint16_t ReleaseTime = 35;
static const uint16 ExpirationDate = 37; static const uint16_t ExpirationDate = 37;
static const uint16 ExpirationTime = 38; static const uint16_t ExpirationTime = 38;
static const uint16 SpecialInstructions = 40; static const uint16_t SpecialInstructions = 40;
static const uint16 ActionAdvised = 42; static const uint16_t ActionAdvised = 42;
static const uint16 ReferenceService = 45; static const uint16_t ReferenceService = 45;
static const uint16 ReferenceDate = 47; static const uint16_t ReferenceDate = 47;
static const uint16 ReferenceNumber = 50; static const uint16_t ReferenceNumber = 50;
static const uint16 DateCreated = 55; static const uint16_t DateCreated = 55;
static const uint16 TimeCreated = 60; static const uint16_t TimeCreated = 60;
static const uint16 DigitizationDate = 62; static const uint16_t DigitizationDate = 62;
static const uint16 DigitizationTime = 63; static const uint16_t DigitizationTime = 63;
static const uint16 Program = 65; static const uint16_t Program = 65;
static const uint16 ProgramVersion = 70; static const uint16_t ProgramVersion = 70;
static const uint16 ObjectCycle = 75; static const uint16_t ObjectCycle = 75;
static const uint16 Byline = 80; static const uint16_t Byline = 80;
static const uint16 BylineTitle = 85; static const uint16_t BylineTitle = 85;
static const uint16 City = 90; static const uint16_t City = 90;
static const uint16 SubLocation = 92; static const uint16_t SubLocation = 92;
static const uint16 ProvinceState = 95; static const uint16_t ProvinceState = 95;
static const uint16 CountryCode = 100; static const uint16_t CountryCode = 100;
static const uint16 CountryName = 101; static const uint16_t CountryName = 101;
static const uint16 TransmissionReference = 103; static const uint16_t TransmissionReference = 103;
static const uint16 Headline = 105; static const uint16_t Headline = 105;
static const uint16 Credit = 110; static const uint16_t Credit = 110;
static const uint16 Source = 115; static const uint16_t Source = 115;
static const uint16 Copyright = 116; static const uint16_t Copyright = 116;
static const uint16 Contact = 118; static const uint16_t Contact = 118;
static const uint16 Caption = 120; static const uint16_t Caption = 120;
static const uint16 Writer = 122; static const uint16_t Writer = 122;
static const uint16 RasterizedCaption = 125; static const uint16_t RasterizedCaption = 125;
static const uint16 ImageType = 130; static const uint16_t ImageType = 130;
static const uint16 ImageOrientation = 131; static const uint16_t ImageOrientation = 131;
static const uint16 Language = 135; static const uint16_t Language = 135;
static const uint16 AudioType = 150; static const uint16_t AudioType = 150;
static const uint16 AudioRate = 151; static const uint16_t AudioRate = 151;
static const uint16 AudioResolution = 152; static const uint16_t AudioResolution = 152;
static const uint16 AudioDuration = 153; static const uint16_t AudioDuration = 153;
static const uint16 AudioOutcue = 154; static const uint16_t AudioOutcue = 154;
static const uint16 PreviewFormat = 200; static const uint16_t PreviewFormat = 200;
static const uint16 PreviewVersion = 201; static const uint16_t PreviewVersion = 201;
static const uint16 Preview = 202; static const uint16_t Preview = 202;
//@} //@}
private: private:
@ -194,7 +194,7 @@ namespace Exiv2 {
@throw Error ("No dataset for recordId") if there is no dataset info @throw Error ("No dataset for recordId") if there is no dataset info
for the given record id in the lookup tables. 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. @brief Return the description of the dataset.
@param number The dataset number @param number The dataset number
@ -203,7 +203,7 @@ namespace Exiv2 {
@throw Error ("No dataset for recordId") if there is no dataset info @throw Error ("No dataset for recordId") if there is no dataset info
for the given record id in the lookup tables. 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. @brief Return the photohsop name of a given dataset.
@param number The dataset number @param number The dataset number
@ -213,7 +213,7 @@ namespace Exiv2 {
@throw Error ("No dataset for recordId") if there is no dataset info @throw Error ("No dataset for recordId") if there is no dataset info
for the given record id in the lookup tables. 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 @brief Check if a given dataset is repeatable
@param number The dataset number @param number The dataset number
@ -222,32 +222,32 @@ namespace Exiv2 {
@throw Error ("No dataset for recordId") if there is no dataset info @throw Error ("No dataset for recordId") if there is no dataset info
for the given record id in the lookup tables. 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 //! 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 //! 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 //! 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 @brief Return the description of a record
@param recordId Record Id number @param recordId Record Id number
@return the description of the Record @return the description of the Record
@throw Error("Unknown 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 @brief Return the Id number of a record
@param recordName Name of a record type @param recordName Name of a record type
@return the Id number of a Record @return the Id number of a Record
@throw Error("Unknown 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 @brief Return the key for the dataSet number and record id. The key is
of the form '<b>Iptc</b>.recordName.dataSetName'. of the form '<b>Iptc</b>.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 @brief Return the key for the dataSet. The key is of the form
'<b>Iptc</b>.recordName.dataSetName'. '<b>Iptc</b>.recordName.dataSetName'.
@ -259,13 +259,13 @@ namespace Exiv2 {
@throw Error ("Invalid key") if the key cannot be parsed into @throw Error ("Invalid key") if the key cannot be parsed into
record name and dataSet name parts. record name and dataSet name parts.
*/ */
static std::pair<uint16, uint16> decomposeKey(const std::string& key); static std::pair<uint16_t, uint16_t> decomposeKey(const std::string& key);
//! Print a list of all dataSets to output stream //! Print a list of all dataSets to output stream
static void dataSetList(std::ostream& os); static void dataSetList(std::ostream& os);
private: private:
static int dataSetIdx(uint16 number, uint16 recordId); static int dataSetIdx(uint16_t number, uint16_t recordId);
static int dataSetIdx(const std::string& dataSetName, uint16 recordId); static int dataSetIdx(const std::string& dataSetName, uint16_t recordId);
static const DataSet* records_[]; static const DataSet* records_[];
static const RecordInfo recordInfo_[]; static const RecordInfo recordInfo_[];

@ -20,14 +20,14 @@
*/ */
/* /*
File: exif.cpp File: exif.cpp
Version: $Name: $ $Revision: 1.57 $ Version: $Name: $ $Revision: 1.58 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component 11-Feb-04, ahu: isolated as a component
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.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 // Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE #undef DEBUG_MAKERNOTE
@ -63,8 +63,8 @@ namespace {
*/ */
void setOffsetTag(Exiv2::Ifd& ifd, void setOffsetTag(Exiv2::Ifd& ifd,
int idx, int idx,
Exiv2::uint16 tag, uint16_t tag,
Exiv2::uint32 offset, uint32_t offset,
Exiv2::ByteOrder byteOrder); Exiv2::ByteOrder byteOrder);
} }
@ -119,7 +119,7 @@ namespace Exiv2 {
return ExifTags::tagName(tag(), ifdId()); return ExifTags::tagName(tag(), ifdId());
} }
uint16 ExifKey::tag() const uint16_t ExifKey::tag() const
{ {
if (tag_ == 0xffff) throw Error("Invalid key"); if (tag_ == 0xffff) throw Error("Invalid key");
return tag_; return tag_;
@ -146,7 +146,7 @@ namespace Exiv2 {
void ExifKey::decomposeKey() void ExifKey::decomposeKey()
{ {
std::pair<uint16, IfdId> p; std::pair<uint16_t, IfdId> p;
if (ifdId_ == makerIfdId && pMakerNote_ != 0) { if (ifdId_ == makerIfdId && pMakerNote_ != 0) {
p.first = pMakerNote_->decomposeKey(key_); p.first = pMakerNote_->decomposeKey(key_);
if (p.first == 0xffff) throw Error("Invalid key"); if (p.first == 0xffff) throw Error("Invalid key");
@ -1160,7 +1160,7 @@ namespace Exiv2 {
else { else {
DataBuf buf(md->size()); DataBuf buf(md->size());
md->copy(buf.pData_, byteOrder); md->copy(buf.pData_, byteOrder);
entry->setValue(static_cast<uint16>(md->typeId()), md->count(), entry->setValue(static_cast<uint16_t>(md->typeId()), md->count(),
buf.pData_, md->size()); buf.pData_, md->size());
} }
} }
@ -1316,7 +1316,7 @@ namespace Exiv2 {
DataBuf buf(md.size()); DataBuf buf(md.size());
md.copy(buf.pData_, byteOrder); md.copy(buf.pData_, byteOrder);
e.setValue(static_cast<uint16>(md.typeId()), md.count(), buf.pData_, md.size()); e.setValue(static_cast<uint16_t>(md.typeId()), md.count(), buf.pData_, md.size());
ifd.add(e); ifd.add(e);
} // addToIfd } // addToIfd
@ -1345,7 +1345,7 @@ namespace Exiv2 {
DataBuf buf(md.size()); DataBuf buf(md.size());
md.copy(buf.pData_, byteOrder); md.copy(buf.pData_, byteOrder);
e.setValue(static_cast<uint16>(md.typeId()), md.count(), e.setValue(static_cast<uint16_t>(md.typeId()), md.count(),
buf.pData_, md.size()); buf.pData_, md.size());
makerNote->add(e); makerNote->add(e);
} // addToMakerNote } // addToMakerNote
@ -1363,10 +1363,10 @@ namespace Exiv2 {
return ExifTags::makeKey(entry.tag(), entry.ifdId()); return ExifTags::makeKey(entry.tag(), entry.ifdId());
} }
std::pair<uint16, IfdId> decomposeKey(const std::string& key, std::pair<uint16_t, IfdId> decomposeKey(const std::string& key,
const MakerNote* makerNote) const MakerNote* makerNote)
{ {
std::pair<uint16, IfdId> p = ExifTags::decomposeKey(key); std::pair<uint16_t, IfdId> p = ExifTags::decomposeKey(key);
if (p.second == makerIfdId && makerNote != 0) { if (p.second == makerIfdId && makerNote != 0) {
p.first = makerNote->decomposeKey(key); p.first = makerNote->decomposeKey(key);
} }
@ -1381,8 +1381,8 @@ namespace {
void setOffsetTag(Exiv2::Ifd& ifd, void setOffsetTag(Exiv2::Ifd& ifd,
int idx, int idx,
Exiv2::uint16 tag, uint16_t tag,
Exiv2::uint32 offset, uint32_t offset,
Exiv2::ByteOrder byteOrder) Exiv2::ByteOrder byteOrder)
{ {
Exiv2::Ifd::iterator pos = ifd.findTag(tag); Exiv2::Ifd::iterator pos = ifd.findTag(tag);

@ -21,7 +21,7 @@
/*! /*!
@file exif.hpp @file exif.hpp
@brief Encoding and decoding of Exif data @brief Encoding and decoding of Exif data
@version $Name: $ $Revision: 1.50 $ @version $Name: $ $Revision: 1.51 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created @date 09-Jan-04, ahu: created
@ -104,7 +104,7 @@ namespace Exiv2 {
@brief Return the tag. @brief Return the tag.
@throw Error ("Invalid key") if the tag is not set. @throw Error ("Invalid key") if the tag is not set.
*/ */
virtual uint16 tag() const; virtual uint16_t tag() const;
virtual ExifKey* clone() const; virtual ExifKey* clone() const;
//! Interpret and print the value of an Exif tag //! Interpret and print the value of an Exif tag
@ -144,7 +144,7 @@ namespace Exiv2 {
private: private:
// DATA // DATA
uint16 tag_; //!< Tag value uint16_t tag_; //!< Tag value
IfdId ifdId_; //!< The IFD associated with this tag IfdId ifdId_; //!< The IFD associated with this tag
int idx_; //!< Unique id of an entry within one IFD int idx_; //!< Unique id of an entry within one IFD
MakerNote* pMakerNote_; //!< Pointer to the associated MakerNote MakerNote* pMakerNote_; //!< Pointer to the associated MakerNote
@ -212,7 +212,7 @@ namespace Exiv2 {
std::string tagName() const std::string tagName() const
{ return pKey_ == 0 ? "" : pKey_->tagName(); } { return pKey_ == 0 ? "" : pKey_->tagName(); }
//! Return the tag //! Return the tag
uint16 tag() const uint16_t tag() const
{ return pKey_ == 0 ? 0xffff : pKey_->tag(); } { return pKey_ == 0 ? 0xffff : pKey_->tag(); }
//! Return the IFD id //! Return the IFD id
IfdId ifdId() const IfdId ifdId() const
@ -965,7 +965,7 @@ namespace Exiv2 {
@throw Error ("Invalid key") if the key cannot be parsed into @throw Error ("Invalid key") if the key cannot be parsed into
item item, section name and tag name parts. item item, section name and tag name parts.
*/ */
std::pair<uint16, IfdId> decomposeKey(const std::string& key, std::pair<uint16_t, IfdId> decomposeKey(const std::string& key,
const MakerNote* makerNote); const MakerNote* makerNote);
} // namespace Exiv2 } // namespace Exiv2

@ -20,7 +20,7 @@
*/ */
/* /*
File: fujimn.cpp File: fujimn.cpp
Version: $Name: $ $Revision: 1.10 $ Version: $Name: $ $Revision: 1.11 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 18-Feb-04, ahu: created History: 18-Feb-04, ahu: created
07-Mar-04, ahu: isolated as a separate component 07-Mar-04, ahu: isolated as a separate component
@ -31,7 +31,7 @@
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -119,7 +119,7 @@ namespace Exiv2 {
} }
std::ostream& FujiMakerNote::printTag(std::ostream& os, std::ostream& FujiMakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {

@ -24,7 +24,7 @@
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"> <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html">
Exif file format</a> by TsuruZoh Tachibanaya Exif file format</a> by TsuruZoh Tachibanaya
@version $Name: $ $Revision: 1.7 $ @version $Name: $ $Revision: 1.8 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 11-Feb-04, ahu: created @date 11-Feb-04, ahu: created
@ -109,7 +109,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Fujifilm") //! Return the name of the makernote item ("Fujifilm")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}

@ -20,14 +20,14 @@
*/ */
/* /*
File: ifd.cpp File: ifd.cpp
Version: $Name: $ $Revision: 1.25 $ Version: $Name: $ $Revision: 1.26 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component 11-Feb-04, ahu: isolated as a component
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.25 $ $RCSfile: ifd.cpp,v $"); EXIV2_RCSID("@(#) $Name: $ $Revision: 1.26 $ $RCSfile: ifd.cpp,v $");
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
@ -103,7 +103,7 @@ namespace Exiv2 {
return *this; return *this;
} // Entry::operator= } // Entry::operator=
void Entry::setValue(uint32 data, ByteOrder byteOrder) void Entry::setValue(uint32_t data, ByteOrder byteOrder)
{ {
if (pData_ == 0 || size_ < 4) { if (pData_ == 0 || size_ < 4) {
assert(alloc_); assert(alloc_);
@ -117,7 +117,7 @@ namespace Exiv2 {
count_ = 1; 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)); long dataSize = count * TypeInfo::typeSize(TypeId(type));
// No minimum size requirement, but make sure the buffer can hold the data // No minimum size requirement, but make sure the buffer can hold the data
@ -149,7 +149,7 @@ namespace Exiv2 {
count_ = count; count_ = count;
} // Entry::setValue } // Entry::setValue
const byte* Entry::component(uint32 n) const const byte* Entry::component(uint32_t n) const
{ {
if (n >= count()) return 0; if (n >= count()) return 0;
return data() + n * typeSize(); return data() + n * typeSize();
@ -163,7 +163,7 @@ namespace Exiv2 {
memset(pNext_, 0x0, 4); 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), : alloc_(true), ifdId_(ifdId), offset_(offset), dataOffset_(0),
pNext_(0), next_(0) pNext_(0), next_(0)
{ {
@ -171,7 +171,7 @@ namespace Exiv2 {
memset(pNext_, 0x0, 4); 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), : alloc_(alloc), ifdId_(ifdId), offset_(offset), dataOffset_(0),
pNext_(0), next_(0) pNext_(0), next_(0)
{ {
@ -294,7 +294,7 @@ namespace Exiv2 {
e.setIfdId(ifdId_); e.setIfdId(ifdId_);
e.setIdx(++idx); e.setIdx(++idx);
e.setTag(i->tag_); e.setTag(i->tag_);
uint32 tmpOffset = uint32_t tmpOffset =
i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_; i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_;
if (static_cast<unsigned long>(len) < tmpOffset + i->size_) { if (static_cast<unsigned long>(len) < tmpOffset + i->size_) {
// Todo: How to handle debug output like this // Todo: How to handle debug output like this
@ -338,13 +338,13 @@ namespace Exiv2 {
FindEntryByIdx(idx)); 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(), return std::find_if(entries_.begin(), entries_.end(),
FindEntryByTag(tag)); FindEntryByTag(tag));
} }
Ifd::iterator Ifd::findTag(uint16 tag) Ifd::iterator Ifd::findTag(uint16_t tag)
{ {
return std::find_if(entries_.begin(), entries_.end(), return std::find_if(entries_.begin(), entries_.end(),
FindEntryByTag(tag)); FindEntryByTag(tag));
@ -356,7 +356,7 @@ namespace Exiv2 {
} }
int Ifd::readSubIfd( 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 ) const
{ {
int rc = 0; int rc = 0;
@ -378,7 +378,7 @@ namespace Exiv2 {
if (offset != 0) offset_ = offset; if (offset != 0) offset_ = offset;
// Add the number of entries to the data buffer // Add the number of entries to the data buffer
us2Data(buf, static_cast<uint16>(entries_.size()), byteOrder); us2Data(buf, static_cast<uint16_t>(entries_.size()), byteOrder);
long o = 2; long o = 2;
// Add all directory entries to the data buffer // Add all directory entries to the data buffer
@ -438,7 +438,7 @@ namespace Exiv2 {
dataOffset_ = 0; dataOffset_ = 0;
} // Ifd::clear } // Ifd::clear
void Ifd::setNext(uint32 next, ByteOrder byteOrder) void Ifd::setNext(uint32_t next, ByteOrder byteOrder)
{ {
assert(pNext_); assert(pNext_);
ul2Data(pNext_, next, byteOrder); ul2Data(pNext_, next, byteOrder);
@ -453,7 +453,7 @@ namespace Exiv2 {
entries_.push_back(entry); entries_.push_back(entry);
} }
int Ifd::erase(uint16 tag) int Ifd::erase(uint16_t tag)
{ {
int idx = 0; int idx = 0;
iterator pos = findTag(tag); iterator pos = findTag(tag);

@ -21,7 +21,7 @@
/*! /*!
@file ifd.hpp @file ifd.hpp
@brief Encoding and decoding of IFD (%Image File Directory) data @brief Encoding and decoding of IFD (%Image File Directory) data
@version $Name: $ $Revision: 1.20 $ @version $Name: $ $Revision: 1.21 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created<BR> @date 09-Jan-04, ahu: created<BR>
@ -77,7 +77,7 @@ namespace Exiv2 {
//! Assignment operator //! Assignment operator
Entry& operator=(const Entry& rhs); Entry& operator=(const Entry& rhs);
//! Set the tag //! Set the tag
void setTag(uint16 tag) { tag_ = tag; } void setTag(uint16_t tag) { tag_ = tag; }
//! Set the IFD id //! Set the IFD id
void setIfdId(IfdId ifdId) { ifdId_ = ifdId; } void setIfdId(IfdId ifdId) { ifdId_ = ifdId; }
//! Set the index (unique id of an entry within one IFD) //! Set the index (unique id of an entry within one IFD)
@ -85,7 +85,7 @@ namespace Exiv2 {
//! Set the pointer to the MakerNote //! Set the pointer to the MakerNote
void setMakerNote(MakerNote* makerNote) { pMakerNote_ = makerNote; } void setMakerNote(MakerNote* makerNote) { pMakerNote_ = makerNote; }
//! Set the offset. The offset is relative to the start of the IFD. //! 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, @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 i.e., set the type of the entry to unsigned long, number of
@ -99,7 +99,7 @@ namespace Exiv2 {
<BR>This method cannot be used to set the value of a newly created <BR>This method cannot be used to set the value of a newly created
%Entry in non-alloc mode. %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. @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 @throw Error ("Size too small") if size is not large enough to hold
count components of the given type. 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 //! @name Accessors
//@{ //@{
//! Return the tag //! Return the tag
uint16 tag() const { return tag_; } uint16_t tag() const { return tag_; }
//! Return the type id. //! Return the type id.
uint16 type() const { return type_; } uint16_t type() const { return type_; }
//! Return the name of the type //! Return the name of the type
const char* typeName() const const char* typeName() const
{ return TypeInfo::typeName(TypeId(type_)); } { return TypeInfo::typeName(TypeId(type_)); }
@ -148,7 +148,7 @@ namespace Exiv2 {
//! Return the pointer to the associated MakerNote //! Return the pointer to the associated MakerNote
MakerNote* makerNote() const { return pMakerNote_; } MakerNote* makerNote() const { return pMakerNote_; }
//! Return the number of components in the value //! 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. @brief Return the size of the data buffer in bytes.
@note There is no minimum size for the data buffer, except that it @note There is no minimum size for the data buffer, except that it
@ -156,7 +156,7 @@ namespace Exiv2 {
*/ */
long size() const { return size_; } long size() const { return size_; }
//! Return the offset from the start of the IFD to the data of the entry //! 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 @brief Return a pointer to the data area. Do not attempt to write
to this pointer. to this pointer.
@ -166,7 +166,7 @@ namespace Exiv2 {
@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. 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 //! Get the memory allocation mode
bool alloc() const { return alloc_; } bool alloc() const { return alloc_; }
//@} //@}
@ -185,13 +185,13 @@ namespace Exiv2 {
//! Pointer to the associated MakerNote //! Pointer to the associated MakerNote
MakerNote* pMakerNote_; MakerNote* pMakerNote_;
//! Tag //! Tag
uint16 tag_; uint16_t tag_;
//! Type //! Type
uint16 type_; uint16_t type_;
//! Number of components //! Number of components
uint32 count_; uint32_t count_;
//! Offset from the start of the IFD to the data //! 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 Size of the data buffer holding the value in bytes, there is
no minimum size. no minimum size.
@ -226,7 +226,7 @@ namespace Exiv2 {
class FindEntryByTag { class FindEntryByTag {
public: public:
//! Constructor, initializes the object with the tag to look for //! 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 @brief Returns true if the tag of the argument entry is equal
to that of the object. to that of the object.
@ -235,7 +235,7 @@ namespace Exiv2 {
{ return tag_ == entry.tag(); } { return tag_ == entry.tag(); }
private: private:
uint16 tag_; uint16_t tag_;
}; // class FindEntryByTag }; // class FindEntryByTag
@ -285,13 +285,13 @@ namespace Exiv2 {
the IFD from the start of TIFF header. Memory management is the IFD from the start of TIFF header. Memory management is
enabled. enabled.
*/ */
Ifd(IfdId ifdId, uint32 offset); Ifd(IfdId ifdId, uint32_t offset);
/*! /*!
@brief Constructor. Allows to set the IFD identifier, offset of the @brief Constructor. Allows to set the IFD identifier, offset of the
IFD from the start of TIFF header and choose whether or not IFD from the start of TIFF header and choose whether or not
memory management is required for the Entries. memory management is required for the Entries.
*/ */
Ifd(IfdId ifdId, uint32 offset, bool alloc); Ifd(IfdId ifdId, uint32_t offset, bool alloc);
//! Copy constructor //! Copy constructor
Ifd(const Ifd& rhs); Ifd(const Ifd& rhs);
//! Destructor //! Destructor
@ -344,7 +344,7 @@ namespace Exiv2 {
IFD. 0 is returned and no action is taken in this case. IFD. 0 is returned and no action is taken in this case.
*/ */
int readSubIfd( 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; ) const;
/*! /*!
@brief Copy the IFD to a data array, update the offsets of the IFD and @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 @brief Set the offset of the next IFD. Byte order is needed to update
the underlying data buffer in non-alloc mode. 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, @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. 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 @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. 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 @brief Delete the directory entry at iterator position pos, return the
position of the next entry. Note that iterators into 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 //! Find an IFD entry by idx, return an iterator into the entries list
iterator findIdx(int idx); iterator findIdx(int idx);
//! Find an IFD entry by tag, return an iterator into the entries list //! Find an IFD entry by tag, return an iterator into the entries list
iterator findTag(uint16 tag); iterator findTag(uint16_t tag);
//@} //@}
//! @name Accessors //! @name Accessors
@ -426,7 +426,7 @@ namespace Exiv2 {
//! Find an IFD entry by idx, return a const iterator into the entries list //! Find an IFD entry by idx, return a const iterator into the entries list
const_iterator findIdx(int idx) const; const_iterator findIdx(int idx) const;
//! Find an IFD entry by tag, return a const iterator into the entries list //! 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 //! Get the IfdId of the IFD
IfdId ifdId() const { return ifdId_; } IfdId ifdId() const { return ifdId_; }
//! Get the offset of the IFD from the start of the TIFF header //! Get the offset of the IFD from the start of the TIFF header
@ -438,7 +438,7 @@ namespace Exiv2 {
*/ */
long dataOffset() const { return dataOffset_; } long dataOffset() const { return dataOffset_; }
//! Get the offset to the next IFD from the start of the TIFF header //! 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 //! Get the number of directory entries in the IFD
long count() const { return static_cast<long>(entries_.size()); } long count() const { return static_cast<long>(entries_.size()); }
//! Get the size of this IFD in bytes (IFD only, without data) //! Get the size of this IFD in bytes (IFD only, without data)
@ -460,12 +460,12 @@ namespace Exiv2 {
private: private:
//! Helper structure to build IFD entries //! Helper structure to build IFD entries
struct PreEntry { struct PreEntry {
uint16 tag_; uint16_t tag_;
uint16 type_; uint16_t type_;
uint32 count_; uint32_t count_;
long size_; long size_;
long offsetLoc_; long offsetLoc_;
uint32 offset_; uint32_t offset_;
}; };
//! cmpPreEntriesByOffset needs to know about PreEntry, that's all. //! 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 //! Pointer to the offset of next IFD from the start of the TIFF header
byte* pNext_; byte* pNext_;
//! The offset of the next IFD as data value (always in sync with *pNext_) //! The offset of the next IFD as data value (always in sync with *pNext_)
uint32 next_; uint32_t next_;
}; // class Ifd }; // class Ifd

@ -20,7 +20,7 @@
*/ */
/* /*
File: image.cpp File: image.cpp
Version: $Name: $ $Revision: 1.25 $ Version: $Name: $ $Revision: 1.26 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
Brad Schick (brad) <schick@robotbattle.com> Brad Schick (brad) <schick@robotbattle.com>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
@ -29,7 +29,7 @@
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -159,7 +159,7 @@ namespace Exiv2 {
const byte JpegBase::app1_ = 0xe1; const byte JpegBase::app1_ = 0xe1;
const byte JpegBase::app13_ = 0xed; const byte JpegBase::app13_ = 0xed;
const byte JpegBase::com_ = 0xfe; 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::exifId_[] = "Exif\0\0";
const char JpegBase::jfifId_[] = "JFIF\0"; const char JpegBase::jfifId_[] = "JFIF\0";
const char JpegBase::ps3Id_[] = "Photoshop 3.0\0"; const char JpegBase::ps3Id_[] = "Photoshop 3.0\0";
@ -317,7 +317,7 @@ namespace Exiv2 {
// Read size and signature (ok if this hits EOF) // Read size and signature (ok if this hits EOF)
bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_); bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_);
if (ferror(fp_)) return 1; 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 (marker == app1_ && memcmp(buf.pData_ + 2, exifId_, 6) == 0) {
if (size < 8) return 2; if (size < 8) return 2;
@ -343,8 +343,8 @@ namespace Exiv2 {
fread(psData.pData_, 1, psData.size_, fp_); fread(psData.pData_, 1, psData.size_, fp_);
if (ferror(fp_) || feof(fp_)) return 1; if (ferror(fp_) || feof(fp_)) return 1;
const byte *record = 0; const byte *record = 0;
uint16 sizeIptc = 0; uint16_t sizeIptc = 0;
uint16 sizeHdr = 0; uint16_t sizeHdr = 0;
// Find actual Iptc data within the APP13 segment // Find actual Iptc data within the APP13 segment
if (!locateIptcData(psData.pData_, psData.size_, &record, if (!locateIptcData(psData.pData_, psData.size_, &record,
&sizeHdr, &sizeIptc)) { &sizeHdr, &sizeIptc)) {
@ -389,8 +389,8 @@ namespace Exiv2 {
int JpegBase::locateIptcData(const byte *pPsData, int JpegBase::locateIptcData(const byte *pPsData,
long sizePsData, long sizePsData,
const byte **record, const byte **record,
uint16 *const sizeHdr, uint16_t *const sizeHdr,
uint16 *const sizeIptc) const uint16_t *const sizeIptc) const
{ {
assert(record); assert(record);
assert(sizeHdr); assert(sizeHdr);
@ -403,7 +403,7 @@ namespace Exiv2 {
memcmp(pPsData + position, bimId_, 4)==0) { memcmp(pPsData + position, bimId_, 4)==0) {
const byte *hrd = pPsData + position; const byte *hrd = pPsData + position;
position += 4; position += 4;
uint16 type = getUShort(pPsData+ position, bigEndian); uint16_t type = getUShort(pPsData+ position, bigEndian);
position += 2; position += 2;
// Pascal string is padded to have an even size (including size byte) // 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 (dataSize > sizePsData - position) return -2;
if (type == iptc_) { if (type == iptc_) {
*sizeIptc = static_cast<uint16>(dataSize); *sizeIptc = static_cast<uint16_t>(dataSize);
*sizeHdr = psSize + 10; *sizeHdr = psSize + 10;
*record = hrd; *record = hrd;
return 0; return 0;
@ -496,7 +496,7 @@ namespace Exiv2 {
// Read size and signature (ok if this hits EOF) // Read size and signature (ok if this hits EOF)
bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_); bufRead = (long)fread(buf.pData_, 1, bufMinSize, fp_);
if (ferror(fp_)) return 1; if (ferror(fp_)) return 1;
uint16 size = getUShort(buf.pData_, bigEndian); uint16_t size = getUShort(buf.pData_, bigEndian);
if (marker == app0_) { if (marker == app0_) {
if (size < 2) return 2; if (size < 2) return 2;
@ -556,7 +556,7 @@ namespace Exiv2 {
if (ferror(fp_)) return 1; if (ferror(fp_)) return 1;
// Careful, this can be a meaningless number for empty // Careful, this can be a meaningless number for empty
// images with only an eoi_ marker // images with only an eoi_ marker
uint16 size = getUShort(buf.pData_, bigEndian); uint16_t size = getUShort(buf.pData_, bigEndian);
if (insertPos == count) { if (insertPos == count) {
byte tmpBuf[18]; byte tmpBuf[18];
@ -565,7 +565,7 @@ namespace Exiv2 {
tmpBuf[0] = 0xff; tmpBuf[0] = 0xff;
tmpBuf[1] = com_; tmpBuf[1] = com_;
us2Data(tmpBuf + 2, us2Data(tmpBuf + 2,
static_cast<uint16>(comment_.length()+3), bigEndian); static_cast<uint16_t>(comment_.length()+3), bigEndian);
if (fwrite(tmpBuf, 1, 4, ofp) != 4) return 4; if (fwrite(tmpBuf, 1, 4, ofp) != 4) return 4;
if (fwrite(comment_.data(), 1, comment_.length(), ofp) != comment_.length()) return 4; if (fwrite(comment_.data(), 1, comment_.length(), ofp) != comment_.length()) return 4;
if (fputc(0, ofp)==EOF) 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 // Write APP1 marker, size of APP1 field, Exif id and Exif data
tmpBuf[0] = 0xff; tmpBuf[0] = 0xff;
tmpBuf[1] = app1_; tmpBuf[1] = app1_;
us2Data(tmpBuf + 2, static_cast<uint16>(sizeExifData_+8), bigEndian); us2Data(tmpBuf + 2, static_cast<uint16_t>(sizeExifData_+8), bigEndian);
memcpy(tmpBuf + 4, exifId_, 6); memcpy(tmpBuf + 4, exifId_, 6);
if (fwrite(tmpBuf, 1, 10, ofp) != 10) return 4; if (fwrite(tmpBuf, 1, 10, ofp) != 10) return 4;
if (fwrite(pExifData_, 1, sizeExifData_, ofp) != (size_t)sizeExifData_) return 4; if (fwrite(pExifData_, 1, sizeExifData_, ofp) != (size_t)sizeExifData_) return 4;
@ -585,8 +585,8 @@ namespace Exiv2 {
} }
const byte *record = psData.pData_; const byte *record = psData.pData_;
uint16 sizeIptc = 0; uint16_t sizeIptc = 0;
uint16 sizeHdr = 0; uint16_t sizeHdr = 0;
// Safe to call with zero psData.size_ // Safe to call with zero psData.size_
locateIptcData(psData.pData_, psData.size_, &record, &sizeHdr, &sizeIptc); locateIptcData(psData.pData_, psData.size_, &record, &sizeHdr, &sizeIptc);
@ -599,7 +599,7 @@ namespace Exiv2 {
const int sizeNewData = sizeIptcData_ ? const int sizeNewData = sizeIptcData_ ?
sizeIptcData_+(sizeIptcData_&1)+12 : 0; sizeIptcData_+(sizeIptcData_&1)+12 : 0;
us2Data(tmpBuf + 2, us2Data(tmpBuf + 2,
static_cast<uint16>(psData.size_-sizeOldData+sizeNewData+16), static_cast<uint16_t>(psData.size_-sizeOldData+sizeNewData+16),
bigEndian); bigEndian);
memcpy(tmpBuf + 4, ps3Id_, 14); memcpy(tmpBuf + 4, ps3Id_, 14);
if (fwrite(tmpBuf, 1, 18, ofp) != 18) return 4; if (fwrite(tmpBuf, 1, 18, ofp) != 18) return 4;

@ -21,7 +21,7 @@
/*! /*!
@file image.hpp @file image.hpp
@brief Class JpegImage to access JPEG images @brief Class JpegImage to access JPEG images
@version $Name: $ $Revision: 1.19 $ @version $Name: $ $Revision: 1.20 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@author Brad Schick (brad) @author Brad Schick (brad)
@ -405,7 +405,7 @@ namespace Exiv2 {
static const char jfifId_[]; //!< JFIF identifier static const char jfifId_[]; //!< JFIF identifier
static const char ps3Id_[]; //!< Photoshop marker static const char ps3Id_[]; //!< Photoshop marker
static const char bimId_[]; //!< Photoshop marker static const char bimId_[]; //!< Photoshop marker
static const uint16 iptc_; //!< Photoshop Iptc marker static const uint16_t iptc_; //!< Photoshop Iptc marker
private: private:
// DATA // DATA
@ -447,8 +447,8 @@ namespace Exiv2 {
int locateIptcData(const byte *pPsData, int locateIptcData(const byte *pPsData,
long sizePsData, long sizePsData,
const byte **record, const byte **record,
uint16 *const sizeHdr, uint16_t *const sizeHdr,
uint16 *const sizeIptc) const; uint16_t *const sizeIptc) const;
/*! /*!
@brief Write to the associated file stream with the provided data. @brief Write to the associated file stream with the provided data.
@param initData Data to be written to the associated file @param initData Data to be written to the associated file
@ -655,19 +655,19 @@ namespace Exiv2 {
//! Return the byte order (little or big endian). //! Return the byte order (little or big endian).
ByteOrder byteOrder() const { return byteOrder_; } ByteOrder byteOrder() const { return byteOrder_; }
//! Return the tag value. //! 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. @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. TIFF header.
*/ */
uint32 offset() const { return offset_; } uint32_t offset() const { return offset_; }
//@} //@}
private: private:
ByteOrder byteOrder_; ByteOrder byteOrder_;
uint16 tag_; uint16_t tag_;
uint32 offset_; uint32_t offset_;
}; // class TiffHeader }; // class TiffHeader

@ -20,13 +20,13 @@
*/ */
/* /*
File: iptc.cpp File: iptc.cpp
Version: $Name: $ $Revision: 1.3 $ Version: $Name: $ $Revision: 1.4 $
Author(s): Brad Schick (brad) <schick@robotbattle.com> Author(s): Brad Schick (brad) <schick@robotbattle.com>
History: 31-July-04, brad: created History: 31-July-04, brad: created
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE #undef DEBUG_MAKERNOTE
@ -54,7 +54,7 @@ namespace Exiv2 {
decomposeKey(); decomposeKey();
} }
IptcKey::IptcKey(uint16 tag, uint16 record) IptcKey::IptcKey(uint16_t tag, uint16_t record)
: tag_(tag), record_(record), key_(IptcDataSets::makeKey(tag, record)) : tag_(tag), record_(record), key_(IptcDataSets::makeKey(tag, record))
{ {
} }
@ -81,7 +81,7 @@ namespace Exiv2 {
void IptcKey::decomposeKey() void IptcKey::decomposeKey()
{ {
std::pair<uint16, uint16> p = IptcDataSets::decomposeKey(key_); std::pair<uint16_t, uint16_t> p = IptcDataSets::decomposeKey(key_);
if (p.first == 0xffff) throw Error("Invalid key"); if (p.first == 0xffff) throw Error("Invalid key");
if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key"); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key");
tag_ = p.first; tag_ = p.first;
@ -183,9 +183,9 @@ namespace Exiv2 {
iptcMetadata_.clear(); iptcMetadata_.clear();
int rc = 0; int rc = 0;
uint16 record = 0; uint16_t record = 0;
uint16 dataSet = 0; uint16_t dataSet = 0;
uint32 sizeData = 0; uint32_t sizeData = 0;
byte extTest = 0; byte extTest = 0;
while (pRead < pData_ + size_) { while (pRead < pData_ + size_) {
@ -196,7 +196,7 @@ namespace Exiv2 {
extTest = *pRead; extTest = *pRead;
if (extTest & 0x80) { if (extTest & 0x80) {
// extended dataset // extended dataset
uint16 sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF); uint16_t sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF);
if (sizeOfSize > 4) return 5; if (sizeOfSize > 4) return 5;
pRead += 2; pRead += 2;
sizeData = 0; sizeData = 0;
@ -218,8 +218,8 @@ namespace Exiv2 {
return rc; return rc;
} // IptcData::read } // IptcData::read
int IptcData::readData(uint16 dataSet, uint16 record, int IptcData::readData(uint16_t dataSet, uint16_t record,
const byte* data, uint32 sizeData) const byte* data, uint32_t sizeData)
{ {
Value* val = 0; Value* val = 0;
try { try {
@ -330,14 +330,14 @@ namespace Exiv2 {
long dataSize = iter->size(); long dataSize = iter->size();
if (dataSize > 32767) { if (dataSize > 32767) {
// always use 4 bytes for extended length // always use 4 bytes for extended length
uint16 sizeOfSize = 4 | 0x8000; uint16_t sizeOfSize = 4 | 0x8000;
us2Data(pWrite, sizeOfSize, bigEndian); us2Data(pWrite, sizeOfSize, bigEndian);
pWrite += 2; pWrite += 2;
ul2Data(pWrite, dataSize, bigEndian); ul2Data(pWrite, dataSize, bigEndian);
pWrite += 4; pWrite += 4;
} }
else { else {
us2Data(pWrite, static_cast<uint16>(dataSize), bigEndian); us2Data(pWrite, static_cast<uint16_t>(dataSize), bigEndian);
pWrite += 2; pWrite += 2;
} }
@ -405,13 +405,13 @@ namespace Exiv2 {
FindMetadatumByKey(key.key())); 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(), return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(),
FindMetadatumById(dataset, record)); 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(), return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(),
FindMetadatumById(dataset, record)); FindMetadatumById(dataset, record));

@ -21,7 +21,7 @@
/*! /*!
@file iptc.hpp @file iptc.hpp
@brief Encoding and decoding of Iptc data @brief Encoding and decoding of Iptc data
@version $Name: $ $Revision: 1.4 $ @version $Name: $ $Revision: 1.5 $
@author Brad Schick (brad) @author Brad Schick (brad)
<a href="mailto:schick@robotbattle.com">schick@robotbattle.com</a> <a href="mailto:schick@robotbattle.com">schick@robotbattle.com</a>
@date 31-Jul-04, brad: created @date 31-Jul-04, brad: created
@ -67,7 +67,7 @@ namespace Exiv2 {
@param tag Dataset id @param tag Dataset id
@param record Record id @param record Record id
*/ */
IptcKey(uint16 tag, uint16 record); IptcKey(uint16_t tag, uint16_t record);
//! Copy constructor //! Copy constructor
IptcKey(const IptcKey& rhs); IptcKey(const IptcKey& rhs);
//@} //@}
@ -92,14 +92,14 @@ namespace Exiv2 {
virtual std::string groupName() const { return recordName(); } virtual std::string groupName() const { return recordName(); }
virtual std::string tagName() const virtual std::string tagName() const
{ return IptcDataSets::dataSetName(tag_, record_); } { return IptcDataSets::dataSetName(tag_, record_); }
virtual uint16 tag() const { return tag_; } virtual uint16_t tag() const { return tag_; }
virtual IptcKey* clone() const; virtual IptcKey* clone() const;
//! Return the name of the record //! Return the name of the record
const char* recordName() const const char* recordName() const
{ return IptcDataSets::recordName(record_); } { return IptcDataSets::recordName(record_); }
//! Return the record id //! Return the record id
uint16 record() const { return record_; } uint16_t record() const { return record_; }
//@} //@}
protected: protected:
@ -118,8 +118,8 @@ namespace Exiv2 {
private: private:
// DATA // DATA
uint16 tag_; //!< Tag value uint16_t tag_; //!< Tag value
uint16 record_; //!< Record value uint16_t record_; //!< Record value
std::string key_; //!< Key std::string key_; //!< Key
}; // class IptcKey }; // class IptcKey
@ -201,7 +201,7 @@ namespace Exiv2 {
@brief Return the record id @brief Return the record id
@return record id @return record id
*/ */
uint16 record() const uint16_t record() const
{ return pKey_ == 0 ? 0 : pKey_->record(); } { return pKey_ == 0 ? 0 : pKey_->record(); }
/*! /*!
@brief Return the name of the tag (aka dataset) @brief Return the name of the tag (aka dataset)
@ -211,7 +211,7 @@ namespace Exiv2 {
std::string tagName() const std::string tagName() const
{ return pKey_ == 0 ? "" : pKey_->tagName(); } { return pKey_ == 0 ? "" : pKey_->tagName(); }
//! Return the tag (aka dataset) number //! Return the tag (aka dataset) number
uint16 tag() const uint16_t tag() const
{ return pKey_ == 0 ? 0 : pKey_->tag(); } { return pKey_ == 0 ? 0 : pKey_->tag(); }
//! Return the type id of the value //! Return the type id of the value
TypeId typeId() const TypeId typeId() const
@ -316,7 +316,7 @@ namespace Exiv2 {
class FindMetadatumById { class FindMetadatumById {
public: public:
//! Constructor, initializes the object with the record and dataset id //! 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) {} : dataset_(dataset), record_(record) {}
/*! /*!
@brief Returns true if the record and dataset id of the argument @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(); } { return dataset_ == iptcdatum.tag() && record_ == iptcdatum.record(); }
private: private:
uint16 dataset_; uint16_t dataset_;
uint16 record_; uint16_t record_;
}; // class FindMetadatumById }; // class FindMetadatumById
@ -460,8 +460,8 @@ namespace Exiv2 {
same Ids exists, it is undefined which of the matching same Ids exists, it is undefined which of the matching
metadata is found. metadata is found.
*/ */
iterator findId(uint16 dataset, iterator findId(uint16_t dataset,
uint16 record = IptcDataSets::application2); uint16_t record = IptcDataSets::application2);
//@} //@}
//! @name Accessors //! @name Accessors
@ -493,8 +493,8 @@ namespace Exiv2 {
same Ids exist it is undefined which of the matching same Ids exist it is undefined which of the matching
metadata is found. metadata is found.
*/ */
const_iterator findId(uint16 dataset, const_iterator findId(uint16_t dataset,
uint16 record = IptcDataSets::application2) const; uint16_t record = IptcDataSets::application2) const;
//! Get the number of metadata entries //! Get the number of metadata entries
long count() const { return static_cast<long>(iptcMetadata_.size()); } long count() const { return static_cast<long>(iptcMetadata_.size()); }
/*! /*!
@ -525,8 +525,8 @@ namespace Exiv2 {
@param sizeData Length in bytes of dataset payload @param sizeData Length in bytes of dataset payload
@return 0 if successful. @return 0 if successful.
*/ */
int readData(uint16 dataSet, uint16 record, int readData(uint16_t dataSet, uint16_t record,
const byte* data, uint32 sizeData); const byte* data, uint32_t sizeData);
//! Resets modified flag //! Resets modified flag
void clearModified(); void clearModified();

@ -4,7 +4,7 @@
This is not designed to be a robust application. This is not designed to be a robust application.
File : iptctest.cpp File : iptctest.cpp
Version : $Name: $ $Revision: 1.2 $ Version : $Name: $ $Revision: 1.3 $
Author(s): Brad Schick (brad) <schick@robotbattle.com> Author(s): Brad Schick (brad) <schick@robotbattle.com>
History : 01-Aug-04, brad: created 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::string key(line.substr(keyStart, keyEnd-keyStart));
std::pair<uint16, uint16> p = IptcDataSets::decomposeKey(key); std::pair<uint16_t, uint16_t> p = IptcDataSets::decomposeKey(key);
if (p.first == 0xffff) throw Error("Invalid key " + key); if (p.first == 0xffff) throw Error("Invalid key " + key);
if (p.second == IptcDataSets::invalidRecord) 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) ); const std::string key( line.substr(keyStart) );
std::pair<uint16, uint16> p = IptcDataSets::decomposeKey(key); std::pair<uint16_t, uint16_t> p = IptcDataSets::decomposeKey(key);
if (p.first == 0xffff) throw Error("Invalid key" + key); if (p.first == 0xffff) throw Error("Invalid key" + key);
if (p.second == IptcDataSets::invalidRecord) 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::string key(line.substr(keyStart, keyEnd-keyStart));
std::pair<uint16, uint16> p = IptcDataSets::decomposeKey(key); std::pair<uint16_t, uint16_t> p = IptcDataSets::decomposeKey(key);
if (p.first == 0xffff) throw Error("Invalid key" + key); if (p.first == 0xffff) throw Error("Invalid key" + key);
if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key" + key); if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key" + key);

@ -20,13 +20,13 @@
*/ */
/* /*
File: makernote.cpp File: makernote.cpp
Version: $Name: $ $Revision: 1.26 $ Version: $Name: $ $Revision: 1.27 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 18-Feb-04, ahu: created History: 18-Feb-04, ahu: created
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // Define DEBUG_* to output debug information to std::cerr
#undef DEBUG_MAKERNOTE #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()) return std::string(ExifTags::familyName())
+ "." + std::string(ifdItem()) + "." + std::string(ifdItem())
+ "." + tagName(tag); + "." + tagName(tag);
} // MakerNote::makeKey } // 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 // Get the family, item and tag name parts of the key
std::string::size_type pos1 = key.find('.'); std::string::size_type pos1 = key.find('.');
@ -79,14 +79,14 @@ namespace Exiv2 {
if (tagName == "") throw Error("Invalid key"); if (tagName == "") throw Error("Invalid key");
if (familyName != ExifTags::familyName()) return 0xffff; if (familyName != ExifTags::familyName()) return 0xffff;
uint16 tag = this->tag(tagName); uint16_t tag = this->tag(tagName);
if (tag == 0xffff) return tag; if (tag == 0xffff) return tag;
if (ifdItem != this->ifdItem()) return 0xffff; if (ifdItem != this->ifdItem()) return 0xffff;
return tag; return tag;
} // MakerNote::decomposeKey } // MakerNote::decomposeKey
std::string MakerNote::tagName(uint16 tag) const std::string MakerNote::tagName(uint16_t tag) const
{ {
std::string tagName; std::string tagName;
if (pMnTagInfo_) { if (pMnTagInfo_) {
@ -106,9 +106,9 @@ namespace Exiv2 {
return tagName; return tagName;
} // MakerNote::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_) { if (pMnTagInfo_) {
for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) { for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) {
if (pMnTagInfo_[i].name_ == tagName) { if (pMnTagInfo_[i].name_ == tagName) {
@ -124,7 +124,7 @@ namespace Exiv2 {
return tag; return tag;
} // MakerNote::tag } // MakerNote::tag
std::string MakerNote::tagDesc(uint16 tag) const std::string MakerNote::tagDesc(uint16_t tag) const
{ {
std::string tagDesc; std::string tagDesc;
if (pMnTagInfo_) { if (pMnTagInfo_) {
@ -147,7 +147,7 @@ namespace Exiv2 {
} }
} // MakerNote::taglist } // 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) << ", " return os << tagName(tag) << ", "
<< std::dec << tag << ", " << std::dec << tag << ", "

@ -22,7 +22,7 @@
@file makernote.hpp @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 MakerNote factory
@version $Name: $ $Revision: 1.22 $ @version $Name: $ $Revision: 1.23 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 18-Feb-04, ahu: created @date 18-Feb-04, ahu: created
@ -109,10 +109,10 @@ namespace Exiv2 {
//! MakerNote Tag information //! MakerNote Tag information
struct MnTagInfo { struct MnTagInfo {
//! Constructor //! 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) {} : tag_(tag), name_(name), desc_(desc) {}
uint16 tag_; //!< Tag uint16_t tag_; //!< Tag
const char* name_; //!< One word tag label const char* name_; //!< One word tag label
const char* desc_; //!< Short tag description const char* desc_; //!< Short tag description
}; // struct MnTagInfo }; // struct MnTagInfo
@ -165,9 +165,9 @@ namespace Exiv2 {
//! @name Accessors //! @name Accessors
//@{ //@{
//! Return the key for the tag. //! 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. //! 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). //! Return the byte order (little or big endian).
ByteOrder byteOrder() const { return byteOrder_; } ByteOrder byteOrder() const { return byteOrder_; }
//! Return the offset of the makernote from the start of the TIFF header //! 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 it translates the tag to a string with the hexadecimal value of
the tag. 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 @brief Return the description of a makernote tag. The default
implementation looks up the makernote info tag array if one is implementation looks up the makernote info tag array if one is
set, else it returns an empty string. 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 @brief Print a list of all tags known by this MakerNote to the output
stream os. The default implementation prints all tags in the stream os. The default implementation prints all tags in the
makernote info tag array if one is set. 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 @brief Return the tag associated with a makernote tag name. The
default implementation looks up the makernote info tag array 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. @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 @brief Return a pointer to an newly created, empty instance of the
same type as this. The makernote entries are <B>not</B> copied. same type as this. The makernote entries are <B>not</B> copied.
@ -226,7 +226,7 @@ namespace Exiv2 {
virtual std::string ifdItem() const =0; virtual std::string ifdItem() const =0;
//! Interpret and print the value of a makernote tag //! Interpret and print the value of a makernote tag
virtual std::ostream& printTag(std::ostream& os, virtual std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const =0; const Value& value) const =0;
//@} //@}
@ -329,7 +329,7 @@ namespace Exiv2 {
virtual IfdMakerNote* clone(bool alloc =true) const =0; virtual IfdMakerNote* clone(bool alloc =true) const =0;
virtual std::string ifdItem() const =0; virtual std::string ifdItem() const =0;
virtual std::ostream& printTag(std::ostream& os, virtual std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const =0; const Value& value) const =0;
//@} //@}

@ -21,7 +21,7 @@
/*! /*!
@file metadatum.hpp @file metadatum.hpp
@brief Provides abstract base classes Metadatum and Key @brief Provides abstract base classes Metadatum and Key
@version $Name: $ $Revision: 1.2 $ @version $Name: $ $Revision: 1.3 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@author Brad Schick (brad) @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) //! Return the name of the tag (which is also the third part of the key)
virtual std::string tagName() const =0; virtual std::string tagName() const =0;
//! Return the tag number //! 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). @brief Return a pointer to a copy of itself (deep copy).
The caller owns this copy and is responsible to delete it! 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) //! Return the name of the tag (which is also the third part of the key)
virtual std::string tagName() const =0; virtual std::string tagName() const =0;
//! Return the tag //! Return the tag
virtual uint16 tag() const =0; virtual uint16_t tag() const =0;
//! Return the type id of the value //! Return the type id of the value
virtual TypeId typeId() const =0; virtual TypeId typeId() const =0;
//! Return the name of the type //! Return the name of the type

@ -20,14 +20,14 @@
*/ */
/* /*
File: nikon1mn.cpp File: nikon1mn.cpp
Version: $Name: $ $Revision: 1.5 $ Version: $Name: $ $Revision: 1.6 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 17-May-04, ahu: created History: 17-May-04, ahu: created
25-May-04, ahu: combined all Nikon formats in one component 25-May-04, ahu: combined all Nikon formats in one component
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -83,7 +83,7 @@ namespace Exiv2 {
} }
std::ostream& Nikon1MakerNote::printTag(std::ostream& os, std::ostream& Nikon1MakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {
@ -235,7 +235,7 @@ namespace Exiv2 {
} }
std::ostream& Nikon2MakerNote::printTag(std::ostream& os, std::ostream& Nikon2MakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {
@ -424,7 +424,7 @@ namespace Exiv2 {
} }
std::ostream& Nikon3MakerNote::printTag(std::ostream& os, std::ostream& Nikon3MakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {

@ -28,7 +28,7 @@
<a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html"> <a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html">
Exif file format</a> by TsuruZoh Tachibanaya.<BR> Exif file format</a> by TsuruZoh Tachibanaya.<BR>
Format 3: "EXIFutils Field Reference Guide". Format 3: "EXIFutils Field Reference Guide".
@version $Name: $ $Revision: 1.4 $ @version $Name: $ $Revision: 1.5 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 17-May-04, ahu: created<BR> @date 17-May-04, ahu: created<BR>
@ -106,7 +106,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Nikon1") //! Return the name of the makernote item ("Nikon1")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}
@ -185,7 +185,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Nikon2") //! Return the name of the makernote item ("Nikon2")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}
@ -239,7 +239,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Nikon3") //! Return the name of the makernote item ("Nikon3")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}

@ -20,7 +20,7 @@
*/ */
/* /*
File: sigmamn.cpp File: sigmamn.cpp
Version: $Name: $ $Revision: 1.9 $ Version: $Name: $ $Revision: 1.10 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 02-Apr-04, ahu: created History: 02-Apr-04, ahu: created
Credits: Sigma and Foveon MakerNote implemented according to the specification Credits: Sigma and Foveon MakerNote implemented according to the specification
@ -29,7 +29,7 @@
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -126,7 +126,7 @@ namespace Exiv2 {
} }
std::ostream& SigmaMakerNote::printTag(std::ostream& os, std::ostream& SigmaMakerNote::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const const Value& value) const
{ {
switch (tag) { switch (tag) {

@ -23,7 +23,7 @@
@brief Sigma and Foveon MakerNote implemented according to the specification @brief Sigma and Foveon MakerNote implemented according to the specification
<a href="http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html"> <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 $Name: $ $Revision: 1.7 $ @version $Name: $ $Revision: 1.8 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 02-Apr-04, ahu: created @date 02-Apr-04, ahu: created
@ -108,7 +108,7 @@ namespace Exiv2 {
//! Return the name of the makernote item ("Sigma") //! Return the name of the makernote item ("Sigma")
std::string ifdItem() const { return ifdItem_; } std::string ifdItem() const { return ifdItem_; }
std::ostream& printTag(std::ostream& os, std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
const Value& value) const; const Value& value) const;
//@} //@}

@ -20,13 +20,13 @@
*/ */
/* /*
File: tags.cpp File: tags.cpp
Version: $Name: $ $Revision: 1.34 $ Version: $Name: $ $Revision: 1.35 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 15-Jan-04, ahu: created History: 15-Jan-04, ahu: created
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -90,7 +90,7 @@ namespace Exiv2 {
}; };
TagInfo::TagInfo( TagInfo::TagInfo(
uint16 tag, uint16_t tag,
const char* name, const char* name,
const char* desc, const char* desc,
IfdId ifdId, IfdId ifdId,
@ -268,7 +268,7 @@ namespace Exiv2 {
const char* ExifTags::familyName_ = "Exif"; 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]; const TagInfo* tagInfo = tagInfos_[ifdId];
if (tagInfo == 0) return -1; if (tagInfo == 0) return -1;
@ -279,21 +279,21 @@ namespace Exiv2 {
return idx; return idx;
} }
const char* ExifTags::tagName(uint16 tag, IfdId ifdId) const char* ExifTags::tagName(uint16_t tag, IfdId ifdId)
{ {
int idx = tagInfoIdx(tag, ifdId); int idx = tagInfoIdx(tag, ifdId);
if (idx == -1) throw Error("No taginfo for IFD"); if (idx == -1) throw Error("No taginfo for IFD");
return tagInfos_[ifdId][idx].name_; 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); int idx = tagInfoIdx(tag, ifdId);
if (idx == -1) throw Error("No taginfo for IFD"); if (idx == -1) throw Error("No taginfo for IFD");
return tagInfos_[ifdId][idx].desc_; 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); int idx = tagInfoIdx(tag, ifdId);
if (idx == -1) throw Error("No taginfo for IFD"); if (idx == -1) throw Error("No taginfo for IFD");
@ -301,7 +301,7 @@ namespace Exiv2 {
return sectionInfo_[tagInfo[idx].sectionId_].name_; 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); int idx = tagInfoIdx(tag, ifdId);
if (idx == -1) throw Error("No taginfo for IFD"); if (idx == -1) throw Error("No taginfo for IFD");
@ -309,7 +309,7 @@ namespace Exiv2 {
return sectionInfo_[tagInfo[idx].sectionId_].desc_; 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]; const TagInfo* tagInfo = tagInfos_[ifdId];
if (tagInfo == 0) return 0xffff; if (tagInfo == 0) return 0xffff;
@ -344,7 +344,7 @@ namespace Exiv2 {
return SectionId(i); return SectionId(i);
} }
std::string ExifTags::makeKey(uint16 tag, IfdId ifdId) std::string ExifTags::makeKey(uint16_t tag, IfdId ifdId)
{ {
return std::string(familyName()) return std::string(familyName())
+ "." + std::string(ifdItem(ifdId)) + "." + std::string(ifdItem(ifdId))
@ -353,7 +353,7 @@ namespace Exiv2 {
// This 'database lookup' function returns the first match that // This 'database lookup' function returns the first match that
// we find, it doesn't verify whether this is the only match. // we find, it doesn't verify whether this is the only match.
std::pair<uint16, IfdId> ExifTags::decomposeKey(const std::string& key) std::pair<uint16_t, IfdId> ExifTags::decomposeKey(const std::string& key)
{ {
// Get the family name, IFD name and tag name parts of the key // Get the family name, IFD name and tag name parts of the key
std::string::size_type pos1 = key.find('.'); std::string::size_type pos1 = key.find('.');
@ -383,7 +383,7 @@ namespace Exiv2 {
} // ExifTags::decomposeKey } // ExifTags::decomposeKey
std::ostream& ExifTags::printTag(std::ostream& os, std::ostream& ExifTags::printTag(std::ostream& os,
uint16 tag, uint16_t tag,
IfdId ifdId, IfdId ifdId,
const Value& value) const Value& value)
{ {
@ -430,8 +430,8 @@ namespace Exiv2 {
std::istream& operator>>(std::istream& is, Rational& r) std::istream& operator>>(std::istream& is, Rational& r)
{ {
int32 nominator; int32_t nominator;
int32 denominator; int32_t denominator;
char c; char c;
is >> nominator >> c >> denominator; is >> nominator >> c >> denominator;
if (is && c == '/') r = std::make_pair(nominator, denominator); if (is && c == '/') r = std::make_pair(nominator, denominator);
@ -445,8 +445,8 @@ namespace Exiv2 {
std::istream& operator>>(std::istream& is, URational& r) std::istream& operator>>(std::istream& is, URational& r)
{ {
uint32 nominator; uint32_t nominator;
uint32 denominator; uint32_t denominator;
char c; char c;
is >> nominator >> c >> denominator; is >> nominator >> c >> denominator;
if (is && c == '/') r = std::make_pair(nominator, denominator); if (is && c == '/') r = std::make_pair(nominator, denominator);
@ -555,12 +555,12 @@ namespace Exiv2 {
{ {
Rational t = value.toRational(); Rational t = value.toRational();
if (t.first > 1 && t.second > 1 && t.second >= t.first) { if (t.first > 1 && t.second > 1 && t.second >= t.first) {
t.second = static_cast<uint32>( t.second = static_cast<uint32_t>(
static_cast<float>(t.second) / t.first + 0.5); static_cast<float>(t.second) / t.first + 0.5);
t.first = 1; t.first = 1;
} }
if (t.second > 1 && t.second < t.first) { if (t.second > 1 && t.second < t.first) {
t.first = static_cast<uint32>( t.first = static_cast<uint32_t>(
static_cast<float>(t.first) / t.second + 0.5); static_cast<float>(t.first) / t.second + 0.5);
t.second = 1; t.second = 1;
} }
@ -653,7 +653,7 @@ namespace Exiv2 {
if (distance.first == 0) { if (distance.first == 0) {
os << "Unknown"; os << "Unknown";
} }
else if (static_cast<uint32>(distance.first) == 0xffffffff) { else if (static_cast<uint32_t>(distance.first) == 0xffffffff) {
os << "Infinity"; os << "Infinity";
} }
else if (distance.second != 0) { else if (distance.second != 0) {

@ -21,7 +21,7 @@
/*! /*!
@file tags.hpp @file tags.hpp
@brief Exif tag and type information @brief Exif tag and type information
@version $Name: $ $Revision: 1.25 $ @version $Name: $ $Revision: 1.26 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 15-Jan-04, ahu: created<BR> @date 15-Jan-04, ahu: created<BR>
@ -89,14 +89,14 @@ namespace Exiv2 {
struct TagInfo { struct TagInfo {
//! Constructor //! Constructor
TagInfo( TagInfo(
uint16 tag, uint16_t tag,
const char* name, const char* name,
const char* desc, const char* desc,
IfdId ifdId, IfdId ifdId,
SectionId sectionId, SectionId sectionId,
PrintFct printFct PrintFct printFct
); );
uint16 tag_; //!< Tag uint16_t tag_; //!< Tag
const char* name_; //!< One word tag label const char* name_; //!< One word tag label
const char* desc_; //!< Short tag description const char* desc_; //!< Short tag description
IfdId ifdId_; //!< Link to the (prefered) IFD 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 @throw Error ("No taginfo for IFD") if there is no tag info
data for the given IFD id in the lookup tables. 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. @brief Return the description of the tag.
@param tag The tag @param tag The tag
@ -136,9 +136,9 @@ namespace Exiv2 {
@throw Error ("No taginfo for IFD") if there is no tag info @throw Error ("No taginfo for IFD") if there is no tag info
data for the given IFD id in the lookup tables. 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 //! 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 //! Return the name of the IFD
static const char* ifdName(IfdId ifdId); static const char* ifdName(IfdId ifdId);
//! Return the related image item (image or thumbnail) //! 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 @throw Error ("No taginfo for IFD") if there is no tag info
data for the given IFD id in the lookup tables. 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 @brief Return the description of the section for a combination of
tag and IFD id. tag and IFD id.
@ -166,31 +166,31 @@ namespace Exiv2 {
@throw Error ("No taginfo for IFD") if there is no tag info @throw Error ("No taginfo for IFD") if there is no tag info
data for the given IFD id in the lookup tables. 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 //! Return the section id for a section name
static SectionId sectionId(const std::string& sectionName); static SectionId sectionId(const std::string& sectionName);
/*! /*!
@brief Return the key for the tag and IFD id. The key is of the form @brief Return the key for the tag and IFD id. The key is of the form
'<b>Exif</b>.ifdItem.tagName'. '<b>Exif</b>.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. @brief Return tag and IFD id pair for the key.
@return A pair consisting of the tag and IFD id. @return A pair consisting of the tag and IFD id.
@throw Error ("Invalid key") if the key cannot be parsed into @throw Error ("Invalid key") if the key cannot be parsed into
item item, section name and tag name parts. item item, section name and tag name parts.
*/ */
static std::pair<uint16, IfdId> decomposeKey(const std::string& key); static std::pair<uint16_t, IfdId> decomposeKey(const std::string& key);
//! Interpret and print the value of an Exif tag //! Interpret and print the value of an Exif tag
static std::ostream& printTag(std::ostream& os, static std::ostream& printTag(std::ostream& os,
uint16 tag, uint16_t tag,
IfdId ifdId, IfdId ifdId,
const Value& value); const Value& value);
//! Print a list of all tags to output stream //! Print a list of all tags to output stream
static void taglist(std::ostream& os); static void taglist(std::ostream& os);
private: private:
static int tagInfoIdx(uint16 tag, IfdId ifdId); static int tagInfoIdx(uint16_t tag, IfdId ifdId);
static const char* familyName_; static const char* familyName_;

@ -20,14 +20,14 @@
*/ */
/* /*
File: types.cpp File: types.cpp
Version: $Name: $ $Revision: 1.12 $ Version: $Name: $ $Revision: 1.13 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component 11-Feb-04, ahu: isolated as a component
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.12 $ $RCSfile: types.cpp,v $"); EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: types.cpp,v $");
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
@ -80,7 +80,7 @@ namespace Exiv2 {
// ************************************************************************* // *************************************************************************
// free functions // free functions
uint16 getUShort(const byte* buf, ByteOrder byteOrder) uint16_t getUShort(const byte* buf, ByteOrder byteOrder)
{ {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
return (byte)buf[1] << 8 | (byte)buf[0]; 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) { if (byteOrder == littleEndian) {
return (byte)buf[3] << 24 | (byte)buf[2] << 16 return (byte)buf[3] << 24 | (byte)buf[2] << 16
@ -104,12 +104,12 @@ namespace Exiv2 {
URational getURational(const byte* buf, ByteOrder byteOrder) URational getURational(const byte* buf, ByteOrder byteOrder)
{ {
uint32 nominator = getULong(buf, byteOrder); uint32_t nominator = getULong(buf, byteOrder);
uint32 denominator = getULong(buf + 4, byteOrder); uint32_t denominator = getULong(buf + 4, byteOrder);
return std::make_pair(nominator, denominator); return std::make_pair(nominator, denominator);
} }
int16 getShort(const byte* buf, ByteOrder byteOrder) int16_t getShort(const byte* buf, ByteOrder byteOrder)
{ {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
return (byte)buf[1] << 8 | (byte)buf[0]; 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) { if (byteOrder == littleEndian) {
return (byte)buf[3] << 24 | (byte)buf[2] << 16 return (byte)buf[3] << 24 | (byte)buf[2] << 16
@ -133,12 +133,12 @@ namespace Exiv2 {
Rational getRational(const byte* buf, ByteOrder byteOrder) Rational getRational(const byte* buf, ByteOrder byteOrder)
{ {
int32 nominator = getLong(buf, byteOrder); int32_t nominator = getLong(buf, byteOrder);
int32 denominator = getLong(buf + 4, byteOrder); int32_t denominator = getLong(buf + 4, byteOrder);
return std::make_pair(nominator, denominator); 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) { if (byteOrder == littleEndian) {
buf[0] = (byte)(s & 0x00ff); buf[0] = (byte)(s & 0x00ff);
@ -151,7 +151,7 @@ namespace Exiv2 {
return 2; return 2;
} }
long ul2Data(byte* buf, uint32 l, ByteOrder byteOrder) long ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder)
{ {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
buf[0] = (byte)(l & 0x000000ff); buf[0] = (byte)(l & 0x000000ff);
@ -175,7 +175,7 @@ namespace Exiv2 {
return o; return o;
} }
long s2Data(byte* buf, int16 s, ByteOrder byteOrder) long s2Data(byte* buf, int16_t s, ByteOrder byteOrder)
{ {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
buf[0] = (byte)(s & 0x00ff); buf[0] = (byte)(s & 0x00ff);
@ -188,7 +188,7 @@ namespace Exiv2 {
return 2; return 2;
} }
long l2Data(byte* buf, int32 l, ByteOrder byteOrder) long l2Data(byte* buf, int32_t l, ByteOrder byteOrder)
{ {
if (byteOrder == littleEndian) { if (byteOrder == littleEndian) {
buf[0] = (byte)(l & 0x000000ff); buf[0] = (byte)(l & 0x000000ff);

@ -21,7 +21,7 @@
/*! /*!
@file types.hpp @file types.hpp
@brief Type definitions for %Exiv2 and related functionality @brief Type definitions for %Exiv2 and related functionality
@version $Name: $ $Revision: 1.20 $ @version $Name: $ $Revision: 1.21 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created<BR> @date 09-Jan-04, ahu: created<BR>
@ -33,13 +33,22 @@
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
#ifdef HAVE_CONFIG_H
# include <config.h>
#else
# ifdef _MSC_VER
# include <config_win32.h>
# endif
#endif
// + standard includes // + standard includes
#include <string> #include <string>
#include <iosfwd> #include <iosfwd>
#include <utility> #include <utility>
#include <sstream> #include <sstream>
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
// disable unreferenced formal parameter warning C4100 // disable unreferenced formal parameter warning C4100
@ -56,22 +65,12 @@ namespace Exiv2 {
// type definitions // type definitions
//! 1 byte unsigned integer type. //! 1 byte unsigned integer type.
typedef unsigned char byte; typedef uint8_t 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;
//! 8 byte unsigned rational type. //! 8 byte unsigned rational type.
typedef std::pair<uint32, uint32> URational; typedef std::pair<uint32_t, uint32_t> URational;
//! 8 byte signed rational type. //! 8 byte signed rational type.
typedef std::pair<int32, int32> Rational; typedef std::pair<int32_t, int32_t> Rational;
//! Type to express the byte order (little or big endian) //! Type to express the byte order (little or big endian)
enum ByteOrder { invalidByteOrder, littleEndian, bigEndian }; enum ByteOrder { invalidByteOrder, littleEndian, bigEndian };
@ -152,15 +151,15 @@ namespace Exiv2 {
// free functions // free functions
//! Read a 2 byte unsigned short value from the data buffer //! 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 //! 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 //! Read an 8 byte unsigned rational value from the data buffer
URational getURational(const byte* buf, ByteOrder byteOrder); URational getURational(const byte* buf, ByteOrder byteOrder);
//! Read a 2 byte signed short value from the data buffer //! 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 //! 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 //! Read an 8 byte signed rational value from the data buffer
Rational getRational(const byte* buf, ByteOrder byteOrder); 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, @brief Convert an unsigned short to data, write the data to the buffer,
return number of bytes written. 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, @brief Convert an unsigned long to data, write the data to the buffer,
return number of bytes written. 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, @brief Convert an unsigned rational to data, write the data to the buffer,
return number of bytes written. return number of bytes written.
@ -192,12 +191,12 @@ namespace Exiv2 {
@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. 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, @brief Convert a signed long to data, write the data to the buffer,
return number of bytes written. 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, @brief Convert a signed rational to data, write the data to the buffer,
return number of bytes written. return number of bytes written.

@ -20,7 +20,7 @@
*/ */
/* /*
File: value.cpp File: value.cpp
Version: $Name: $ $Revision: 1.13 $ Version: $Name: $ $Revision: 1.14 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net> Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component 11-Feb-04, ahu: isolated as a component
@ -28,7 +28,7 @@
*/ */
// ***************************************************************************** // *****************************************************************************
#include "rcsid.hpp" #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 // included header files
@ -68,10 +68,10 @@ namespace Exiv2 {
value = new AsciiValue; value = new AsciiValue;
break; break;
case unsignedShort: case unsignedShort:
value = new ValueType<uint16>; value = new ValueType<uint16_t>;
break; break;
case unsignedLong: case unsignedLong:
value = new ValueType<uint32>; value = new ValueType<uint32_t>;
break; break;
case unsignedRational: case unsignedRational:
value = new ValueType<URational>; value = new ValueType<URational>;
@ -83,10 +83,10 @@ namespace Exiv2 {
value = new DataValue; value = new DataValue;
break; break;
case signedShort: case signedShort:
value = new ValueType<int16>; value = new ValueType<int16_t>;
break; break;
case signedLong: case signedLong:
value = new ValueType<int32>; value = new ValueType<int32_t>;
break; break;
case signedRational: case signedRational:
value = new ValueType<Rational>; value = new ValueType<Rational>;

@ -21,7 +21,7 @@
/*! /*!
@file value.hpp @file value.hpp
@brief Value interface and concrete subclasses @brief Value interface and concrete subclasses
@version $Name: $ $Revision: 1.15 $ @version $Name: $ $Revision: 1.16 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a> <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created @date 09-Jan-04, ahu: created
@ -164,13 +164,13 @@ namespace Exiv2 {
<TR><TD>unsignedByte</TD><TD>%DataValue(unsignedByte)</TD></TR> <TR><TD>unsignedByte</TD><TD>%DataValue(unsignedByte)</TD></TR>
<TR><TD>asciiString</TD><TD>%AsciiValue</TD></TR> <TR><TD>asciiString</TD><TD>%AsciiValue</TD></TR>
<TR><TD>string</TD><TD>%StringValue</TD></TR> <TR><TD>string</TD><TD>%StringValue</TD></TR>
<TR><TD>unsignedShort</TD><TD>%ValueType &lt; uint16 &gt;</TD></TR> <TR><TD>unsignedShort</TD><TD>%ValueType &lt; uint16_t &gt;</TD></TR>
<TR><TD>unsignedLong</TD><TD>%ValueType &lt; uint32 &gt;</TD></TR> <TR><TD>unsignedLong</TD><TD>%ValueType &lt; uint32_t &gt;</TD></TR>
<TR><TD>unsignedRational</TD><TD>%ValueType &lt; URational &gt;</TD></TR> <TR><TD>unsignedRational</TD><TD>%ValueType &lt; URational &gt;</TD></TR>
<TR><TD>invalid6</TD><TD>%DataValue(invalid6)</TD></TR> <TR><TD>invalid6</TD><TD>%DataValue(invalid6)</TD></TR>
<TR><TD>undefined</TD><TD>%DataValue</TD></TR> <TR><TD>undefined</TD><TD>%DataValue</TD></TR>
<TR><TD>signedShort</TD><TD>%ValueType &lt; int16 &gt;</TD></TR> <TR><TD>signedShort</TD><TD>%ValueType &lt; int16_t &gt;</TD></TR>
<TR><TD>signedLong</TD><TD>%ValueType &lt; int32 &gt;</TD></TR> <TR><TD>signedLong</TD><TD>%ValueType &lt; int32_t &gt;</TD></TR>
<TR><TD>signedRational</TD><TD>%ValueType &lt; Rational &gt;</TD></TR> <TR><TD>signedRational</TD><TD>%ValueType &lt; Rational &gt;</TD></TR>
<TR><TD>date</TD><TD>%DateValue</TD></TR> <TR><TD>date</TD><TD>%DateValue</TD></TR>
<TR><TD>time</TD><TD>%TimeValue</TD></TR> <TR><TD>time</TD><TD>%TimeValue</TD></TR>
@ -628,15 +628,15 @@ namespace Exiv2 {
template<typename T> TypeId getType(); template<typename T> TypeId getType();
//! Specialization for an unsigned short //! Specialization for an unsigned short
template<> inline TypeId getType<uint16>() { return unsignedShort; } template<> inline TypeId getType<uint16_t>() { return unsignedShort; }
//! Specialization for an unsigned long //! Specialization for an unsigned long
template<> inline TypeId getType<uint32>() { return unsignedLong; } template<> inline TypeId getType<uint32_t>() { return unsignedLong; }
//! Specialization for an unsigned rational //! Specialization for an unsigned rational
template<> inline TypeId getType<URational>() { return unsignedRational; } template<> inline TypeId getType<URational>() { return unsignedRational; }
//! Specialization for a signed short //! Specialization for a signed short
template<> inline TypeId getType<int16>() { return signedShort; } template<> inline TypeId getType<int16_t>() { return signedShort; }
//! Specialization for a signed long //! Specialization for a signed long
template<> inline TypeId getType<int32>() { return signedLong; } template<> inline TypeId getType<int32_t>() { return signedLong; }
//! Specialization for a signed rational //! Specialization for a signed rational
template<> inline TypeId getType<Rational>() { return signedRational; } template<> inline TypeId getType<Rational>() { return signedRational; }
@ -707,15 +707,15 @@ namespace Exiv2 {
}; // class ValueType }; // class ValueType
//! Unsigned short value type //! Unsigned short value type
typedef ValueType<uint16> UShortValue; typedef ValueType<uint16_t> UShortValue;
//! Unsigned long value type //! Unsigned long value type
typedef ValueType<uint32> ULongValue; typedef ValueType<uint32_t> ULongValue;
//! Unsigned rational value type //! Unsigned rational value type
typedef ValueType<URational> URationalValue; typedef ValueType<URational> URationalValue;
//! Signed short value type //! Signed short value type
typedef ValueType<int16> ShortValue; typedef ValueType<int16_t> ShortValue;
//! Signed long value type //! Signed long value type
typedef ValueType<int32> LongValue; typedef ValueType<int32_t> LongValue;
//! Signed rational value type //! Signed rational value type
typedef ValueType<Rational> RationalValue; typedef ValueType<Rational> RationalValue;
@ -736,13 +736,13 @@ namespace Exiv2 {
template<typename T> T getValue(const byte* buf, ByteOrder byteOrder); template<typename T> T getValue(const byte* buf, ByteOrder byteOrder);
// Specialization for a 2 byte unsigned short value. // Specialization for a 2 byte unsigned short value.
template<> template<>
inline uint16 getValue(const byte* buf, ByteOrder byteOrder) inline uint16_t getValue(const byte* buf, ByteOrder byteOrder)
{ {
return getUShort(buf, byteOrder); return getUShort(buf, byteOrder);
} }
// Specialization for a 4 byte unsigned long value. // Specialization for a 4 byte unsigned long value.
template<> template<>
inline uint32 getValue(const byte* buf, ByteOrder byteOrder) inline uint32_t getValue(const byte* buf, ByteOrder byteOrder)
{ {
return getULong(buf, byteOrder); return getULong(buf, byteOrder);
} }
@ -754,13 +754,13 @@ namespace Exiv2 {
} }
// Specialization for a 2 byte signed short value. // Specialization for a 2 byte signed short value.
template<> template<>
inline int16 getValue(const byte* buf, ByteOrder byteOrder) inline int16_t getValue(const byte* buf, ByteOrder byteOrder)
{ {
return getShort(buf, byteOrder); return getShort(buf, byteOrder);
} }
// Specialization for a 4 byte signed long value. // Specialization for a 4 byte signed long value.
template<> template<>
inline int32 getValue(const byte* buf, ByteOrder byteOrder) inline int32_t getValue(const byte* buf, ByteOrder byteOrder)
{ {
return getLong(buf, byteOrder); return getLong(buf, byteOrder);
} }
@ -789,7 +789,7 @@ namespace Exiv2 {
Return the number of bytes written. Return the number of bytes written.
*/ */
template<> 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); return us2Data(buf, t, byteOrder);
} }
@ -798,7 +798,7 @@ namespace Exiv2 {
Return the number of bytes written. Return the number of bytes written.
*/ */
template<> 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); return ul2Data(buf, t, byteOrder);
} }
@ -816,7 +816,7 @@ namespace Exiv2 {
Return the number of bytes written. Return the number of bytes written.
*/ */
template<> 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); return s2Data(buf, t, byteOrder);
} }
@ -825,7 +825,7 @@ namespace Exiv2 {
Return the number of bytes written. Return the number of bytes written.
*/ */
template<> 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); return l2Data(buf, t, byteOrder);
} }

Loading…
Cancel
Save