Removed trailing whitespace from source files

v0.27.3
Andreas Huggel 20 years ago
parent 277edf23fb
commit 06e5c0719e

@ -30,7 +30,7 @@
#
# This makefile contains (supposedly) generic build rules to build the
# library and applications. It includes all system specific settings
# from config.mk. The idea is that configuring and porting the
# from config.mk. The idea is that configuring and porting the
# software to a new platform should only require changes in config.mk.
#
# Restrictions:
@ -48,13 +48,13 @@ include $(top_srcdir)/config/config.mk
# Source files
# Add standalone C++ header files to this list
CCHDR = exv_conf.h exv_msvc.h mn.hpp rcsid.hpp
CCHDR = exv_conf.h exv_msvc.h mn.hpp rcsid.hpp
# Add library C++ source files to this list
CCSRC = basicio.cpp canonmn.cpp crwimage.cpp datasets.cpp error.cpp exif.cpp \
futils.cpp fujimn.cpp ifd.cpp image.cpp imgreg.cpp iptc.cpp jpgimage.cpp \
makernote.cpp metadatum.cpp nikonmn.cpp olympusmn.cpp panasonicmn.cpp \
sigmamn.cpp sonymn.cpp tags.cpp types.cpp value.cpp
sigmamn.cpp sonymn.cpp tags.cpp types.cpp value.cpp
# Add source files of simple applications to this list
BINSRC = addmoddel.cpp dataarea-test.cpp exifcomment.cpp exifdata-test.cpp \
@ -66,7 +66,7 @@ BINSRC = addmoddel.cpp dataarea-test.cpp exifcomment.cpp exifdata-test.cpp \
EXIV2MAIN = exiv2.cpp
# Add additional source files of the Exiv2 application to this list
EXIV2SRC = actions.cpp utils.cpp
EXIV2SRC = actions.cpp utils.cpp
# C source files of the Exiv2 application
ifndef HAVE_TIMEGM
EXIVCSRC = localtime.c
@ -121,7 +121,7 @@ BINOBJ = $(BINSRC:.cpp=.o)
BINARY = $(BINSRC:.cpp=)
EXECUTABLE = $(BINSRC:.cpp=$(EXEEXT))
EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o)
EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o)
EXIV2COBJ = $(EXIVCSRC:.c=.o)
EXIV2BIN = $(EXIV2MAIN:.cpp=)
EXIV2EXE = $(EXIV2MAIN:.cpp=$(EXEEXT))
@ -130,17 +130,17 @@ MCOBJ = $(MCMAIN:.cpp=.o) $(MCSRC:.cpp=.o)
MCBIN = $(MCMAIN:.cpp=)
MCEXE = $(MCMAIN:.cpp=$(EXEEXT))
# Dependency files post-process commands
# Dependency files post-process commands
POSTDEPEND = if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi; \
if test -e $*.d; then cp $*.d $(DEPDIR)/$*.d; \
sed -e 's/^\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(DEPDIR)/$*.d; \
$(RM) $*.d; fi
# Compilation shortcuts
# Compilation shortcuts
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CXXDEFS) $(CXXINCS) -c
COMPILE.c = $(CC) $(CFLAGS) $(DEFS) $(INCS) -c
LINK.cc = $(CXX) $(CXXFLAGS) $(LDLIBS) $(LDFLAGS) -rpath $(libdir)
LINK.cc = $(CXX) $(CXXFLAGS) $(LDLIBS) $(LDFLAGS) -rpath $(libdir)
# ******************************************************************************
# Rules
@ -184,20 +184,20 @@ $(LIBTOOL): $(LIBTOOL_DEPS)
bin: lib $(BINARY) $(EXIV2BIN) $(MCBIN) path-test
lib: $(OBJ)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) $(LOBJ) -o $(LIBRARY) -rpath $(libdir) -release $(EXIV2_VERSION)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) $(LOBJ) -o $(LIBRARY) -rpath $(libdir) -release $(EXIV2_VERSION)
@touch lib
path-test: path-test.o utils.o
$(CXX) $(CXXFLAGS) path-test.o utils.o -o $@
$(BINARY): %: %.o lib
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $@.o
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $@.o
$(EXIV2BIN): lib $(EXIV2OBJ) $(EXIV2COBJ)
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(EXIV2OBJ) $(EXIV2COBJ)
$(MCBIN): lib $(MCOBJ)
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(MCOBJ)
@$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(MCOBJ)
install-header:
$(INSTALL_DIRS) $(incdir)
@ -213,7 +213,7 @@ install-lib: lib install-header
@$(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIBRARY) $(libdir)/$(LIBRARY)
install: $(EXIV2BIN) install-lib
$(INSTALL_DIRS) $(bindir)
$(INSTALL_DIRS) $(bindir)
@$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(EXIV2EXE) $(bindir)/$(EXIV2EXE)
uninstall-header:

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -71,7 +71,7 @@ EXIV2_RCSID("@(#) $Id$");
// local declarations
namespace {
// Convert a string "YYYY:MM:DD HH:MI:SS" to a struct tm type,
// Convert a string "YYYY:MM:DD HH:MI:SS" to a struct tm type,
// returns 0 if successful
int str2Tm(const std::string& timeStr, struct tm* tm);
@ -87,12 +87,12 @@ namespace {
@param source Source file path
@param target Target file path. An *.exv file is created if target doesn't
exist.
@param preserve Indicates if existing metadata in the target file should
@param preserve Indicates if existing metadata in the target file should
be kept.
@return 0 if successful, else an error code
*/
int metacopy(const std::string& source,
const std::string& target,
int metacopy(const std::string& source,
const std::string& target,
bool preserve);
}
@ -173,7 +173,7 @@ namespace Action {
return rc;
}
catch(const Exiv2::AnyError& e) {
std::cerr << "Exiv2 exception in print action for file "
std::cerr << "Exiv2 exception in print action for file "
<< path << ":\n" << e << "\n";
return 1;
} // Print::run
@ -310,7 +310,7 @@ namespace Action {
}
std::cout << std::endl;
// Exposure mode
// Exposure mode
// From ExposureProgram or Canon Makernote
printLabel("Exposure mode");
done = false;
@ -334,13 +334,13 @@ namespace Action {
}
if (!done) {
done = 0 != printTag(exifData, "Exif.Fujifilm.Macro");
}
}
if (!done) {
done = 0 != printTag(exifData, "Exif.Olympus.Macro");
}
}
if (!done) {
done = 0 != printTag(exifData, "Exif.Panasonic.Macro");
}
}
std::cout << std::endl;
// Image quality setting (compression)
@ -421,10 +421,10 @@ namespace Action {
std::string thumbExt = exifData.thumbnailExtension();
if (thumbExt.empty()) {
std::cout << "None";
}
}
else {
Exiv2::DataBuf buf = exifData.copyThumbnail();
std::cout << exifData.thumbnailFormat() << ", "
std::cout << exifData.thumbnailFormat() << ", "
<< buf.size_ << " Bytes";
}
std::cout << std::endl;
@ -485,10 +485,10 @@ namespace Action {
<< md->key() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->count() << " "
<< std::dec << *md
<< std::dec << *md
<< std::endl;
}
@ -515,17 +515,17 @@ namespace Action {
Exiv2::ExifData::const_iterator md;
for (md = exifData.begin(); md != end; ++md) {
std::cout << "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << md->tag() << " "
<< std::hex << md->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->ifdName() << " "
<< std::setw(27) << std::setfill(' ') << std::left
<< md->tagName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->count() << " "
<< std::dec << md->value()
<< std::dec << md->value()
<< std::endl;
}
@ -555,12 +555,12 @@ namespace Action {
<< md->key() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->count() << " "
<< std::dec << md->value()
<< std::dec << md->value()
<< std::endl;
}
}
return 0;
} // Print::printIptc
@ -586,13 +586,13 @@ namespace Action {
std::cout << std::setw(4) << std::setfill(' ') << std::left
<< md->ifdName() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << md->tag() << " "
<< std::hex << md->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->count() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->size() << " "
<< std::setw(27) << std::setfill(' ') << std::left
@ -608,7 +608,7 @@ namespace Action {
int Print::printComment()
{
if (!Exiv2::fileExists(path_, true)) {
std::cerr << path_
std::cerr << path_
<< ": Failed to open the file\n";
return -1;
}
@ -657,7 +657,7 @@ namespace Action {
}
std::string v = md->toString();
if (v.length() == 0 || v[0] == ' ') {
std::cerr << "Image file creation timestamp not set in the file "
std::cerr << "Image file creation timestamp not set in the file "
<< path << "\n";
return 1;
}
@ -676,7 +676,7 @@ namespace Action {
<< path << "\n";
return 1;
}
std::string newPath
std::string newPath
= Util::dirname(path) + EXV_SEPERATOR_STR + basename + Util::suffix(path);
if ( Util::dirname(newPath) == Util::dirname(path)
&& Util::basename(newPath) == Util::basename(path)) {
@ -689,7 +689,7 @@ namespace Action {
bool go = true;
int seq = 1;
std::string s;
Params::FileExistsPolicy fileExistsPolicy
Params::FileExistsPolicy fileExistsPolicy
= Params::instance().fileExistsPolicy_;
while (go) {
if (Exiv2::fileExists(newPath)) {
@ -698,14 +698,14 @@ namespace Action {
go = false;
break;
case Params::renamePolicy:
newPath = Util::dirname(path)
+ EXV_SEPERATOR_STR + basename
newPath = Util::dirname(path)
+ EXV_SEPERATOR_STR + basename
+ "_" + Exiv2::toString(seq++)
+ Util::suffix(path);
break;
case Params::askPolicy:
std::cout << Params::instance().progname()
<< ": File `" << newPath
case Params::askPolicy:
std::cout << Params::instance().progname()
<< ": File `" << newPath
<< "' exists. [O]verwrite, [r]ename or [s]kip? ";
std::cin >> s;
switch (s[0]) {
@ -715,9 +715,9 @@ namespace Action {
break;
case 'r':
case 'R':
fileExistsPolicy = Params::renamePolicy;
newPath = Util::dirname(path)
+ EXV_SEPERATOR_STR + basename
fileExistsPolicy = Params::renamePolicy;
newPath = Util::dirname(path)
+ EXV_SEPERATOR_STR + basename
+ "_" + Exiv2::toString(seq++)
+ Util::suffix(path);
break;
@ -812,7 +812,7 @@ namespace Action {
}
long delta = exifData.eraseThumbnail();
if (Params::instance().verbose_) {
std::cout << "Erasing " << delta
std::cout << "Erasing " << delta
<< " Bytes of thumbnail data" << std::endl;
}
return 0;
@ -821,7 +821,7 @@ namespace Action {
int Erase::eraseExifData(Exiv2::Image* image) const
{
if (Params::instance().verbose_ && image->exifData().count() > 0) {
std::cout << "Erasing Exif data from the file" << std::endl;
std::cout << "Erasing Exif data from the file" << std::endl;
}
image->clearExifData();
return 0;
@ -830,7 +830,7 @@ namespace Action {
int Erase::eraseIptcData(Exiv2::Image* image) const
{
if (Params::instance().verbose_ && image->iptcData().count() > 0) {
std::cout << "Erasing Iptc data from the file" << std::endl;
std::cout << "Erasing Iptc data from the file" << std::endl;
}
image->clearIptcData();
return 0;
@ -839,7 +839,7 @@ namespace Action {
int Erase::eraseComment(Exiv2::Image* image) const
{
if (Params::instance().verbose_ && image->comment().size() > 0) {
std::cout << "Erasing Jpeg comment from the file" << std::endl;
std::cout << "Erasing Jpeg comment from the file" << std::endl;
}
image->clearComment();
return 0;
@ -860,7 +860,7 @@ namespace Action {
path_ = path;
int rc = 0;
if (Params::instance().target_ & Params::ctThumb) {
rc = writeThumbnail();
rc = writeThumbnail();
}
if (Params::instance().target_ & ~Params::ctThumb) {
std::string directory = Params::instance().directory_;
@ -868,7 +868,7 @@ namespace Action {
std::string exvPath = directory + EXV_SEPERATOR_STR
+ Util::basename(path_, true) + ".exv";
if (!Params::instance().force_ && Exiv2::fileExists(exvPath)) {
std::cout << Params::instance().progname()
std::cout << Params::instance().progname()
<< ": Overwrite `" << exvPath << "'? ";
std::string s;
std::cin >> s;
@ -909,18 +909,18 @@ namespace Action {
std::string thumbExt = exifData.thumbnailExtension();
int rc = 0;
if (thumbExt.empty()) {
std::cerr << path_ << ": Image does not contain an Exif thumbnail\n";
std::cerr << path_ << ": Image does not contain an Exif thumbnail\n";
}
else {
if (Params::instance().verbose_) {
Exiv2::DataBuf buf = exifData.copyThumbnail();
std::cout << "Writing "
<< exifData.thumbnailFormat() << " thumbnail ("
<< exifData.thumbnailFormat() << " thumbnail ("
<< buf.size_ << " Bytes) to file "
<< thumb << thumbExt << std::endl;
}
if (!Params::instance().force_ && Exiv2::fileExists(thumb + thumbExt)) {
std::cout << Params::instance().progname()
std::cout << Params::instance().progname()
<< ": Overwrite `" << thumb + thumbExt << "'? ";
std::string s;
std::cin >> s;
@ -998,7 +998,7 @@ namespace Action {
Exiv2::ExifData &exifData = image->exifData();
exifData.setJpegThumbnail(thumbPath);
image->writeMetadata();
return 0;
} // Insert::insertThumbnail
@ -1060,9 +1060,9 @@ namespace Action {
{
if (Params::instance().verbose_) {
std::cout << "Add " << modifyCmd.key_ << " \""
<< modifyCmd.value_ << "\" ("
<< Exiv2::TypeInfo::typeName(modifyCmd.typeId_)
<< ")" << std::endl;
<< modifyCmd.value_ << "\" ("
<< Exiv2::TypeInfo::typeName(modifyCmd.typeId_)
<< ")" << std::endl;
}
Exiv2::Value::AutoPtr value = Exiv2::Value::create(modifyCmd.typeId_);
value->read(modifyCmd.value_);
@ -1078,9 +1078,9 @@ namespace Action {
{
if (Params::instance().verbose_) {
std::cout << "Set " << modifyCmd.key_ << " \""
<< modifyCmd.value_ << "\" ("
<< Exiv2::TypeInfo::typeName(modifyCmd.typeId_)
<< ")" << std::endl;
<< modifyCmd.value_ << "\" ("
<< Exiv2::TypeInfo::typeName(modifyCmd.typeId_)
<< ")" << std::endl;
}
Exiv2::ExifData &exifData = image_->exifData();
@ -1107,7 +1107,7 @@ namespace Action {
void Modify::delMetadatum(const ModifyCmd& modifyCmd)
{
if (Params::instance().verbose_) {
std::cout << "Del " << modifyCmd.key_ << std::endl;
std::cout << "Del " << modifyCmd.key_ << std::endl;
}
Exiv2::ExifData &exifData = image_->exifData();
@ -1177,7 +1177,7 @@ namespace Action {
}
int Adjust::adjustDateTime(Exiv2::ExifData& exifData,
const std::string& key,
const std::string& key,
const std::string& path) const
{
Exiv2::ExifKey ek(key);
@ -1188,18 +1188,18 @@ namespace Action {
}
std::string timeStr = md->toString();
if (timeStr == "" || timeStr[0] == ' ') {
std::cerr << path << ": Timestamp of metadatum with key `"
std::cerr << path << ": Timestamp of metadatum with key `"
<< ek << "' not set\n";
return 1;
}
time_t time = str2Time(timeStr);
if (time == (time_t)-1) {
std::cerr << path << ": Failed to parse or convert timestamp `"
std::cerr << path << ": Failed to parse or convert timestamp `"
<< timeStr << "'\n";
return 1;
}
if (Params::instance().verbose_) {
std::cout << "Adjusting `" << ek << "' by"
std::cout << "Adjusting `" << ek << "' by"
<< (adjustment_ < 0 ? " " : " +")
<< adjustment_ << " s to ";
}
@ -1258,7 +1258,7 @@ namespace {
if (0 == tm) return "";
std::ostringstream os;
os << std::setfill('0')
os << std::setfill('0')
<< tm->tm_year + 1900 << ":"
<< std::setw(2) << tm->tm_mon + 1 << ":"
<< std::setw(2) << tm->tm_mday << " "
@ -1269,9 +1269,9 @@ namespace {
return os.str();
} // time2Str
int metacopy(const std::string& source,
const std::string& target,
bool preserve)
int metacopy(const std::string& source,
const std::string& target,
bool preserve)
{
if (!Exiv2::fileExists(source, true)) {
std::cerr << source
@ -1289,14 +1289,14 @@ namespace {
if (preserve) targetImage->readMetadata();
}
else {
targetImage
targetImage
= Exiv2::ImageFactory::create(Exiv2::ImageType::exv, target);
assert(targetImage.get() != 0);
}
if ( Params::instance().target_ & Params::ctExif
&& !sourceImage->exifData().empty()) {
if (Params::instance().verbose_) {
std::cout << "Writing Exif data from " << source
std::cout << "Writing Exif data from " << source
<< " to " << target << std::endl;
}
targetImage->setExifData(sourceImage->exifData());
@ -1304,7 +1304,7 @@ namespace {
if ( Params::instance().target_ & Params::ctIptc
&& !sourceImage->iptcData().empty()) {
if (Params::instance().verbose_) {
std::cout << "Writing Iptc data from " << source
std::cout << "Writing Iptc data from " << source
<< " to " << target << std::endl;
}
targetImage->setIptcData(sourceImage->iptcData());
@ -1312,7 +1312,7 @@ namespace {
if ( Params::instance().target_ & Params::ctComment
&& !sourceImage->comment().empty()) {
if (Params::instance().verbose_) {
std::cout << "Writing Jpeg comment from " << source
std::cout << "Writing Jpeg comment from " << source
<< " to " << target << std::endl;
}
targetImage->setComment(sourceImage->comment());

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -161,10 +161,10 @@ namespace Action {
//! Print the Jpeg comment
int printComment();
//! Print uninterpreted Iptc information
//! Print uninterpreted Iptc information
int printIptc();
//! Print Exif summary information
int printSummary();
int printSummary();
//! Print the interpreted value for each Exif tag
int printInterpreted();
//! Print uninterpreted Exif information
@ -179,7 +179,7 @@ namespace Action {
@return 1 if a line was written, 0 if the key was not found.
*/
int printTag(const Exiv2::ExifData& exifData,
const std::string& key,
const std::string& key,
const std::string& label ="") const;
private:
@ -190,7 +190,7 @@ namespace Action {
}; // class Print
/*!
@brief %Rename a file to its metadate creation timestamp,
@brief %Rename a file to its metadate creation timestamp,
in the specified format.
*/
class Rename : public Task {
@ -215,7 +215,7 @@ namespace Action {
private:
virtual Adjust* clone_() const;
int adjustDateTime(Exiv2::ExifData& exifData,
const std::string& key,
const std::string& key,
const std::string& path) const;
long adjustment_;
@ -232,9 +232,9 @@ namespace Action {
AutoPtr clone() const;
/*!
@brief Delete the thumbnail image, incl IFD1 metadata from the file.
@brief Delete the thumbnail image, incl IFD1 metadata from the file.
*/
int eraseThumbnail(Exiv2::Image* image) const;
int eraseThumbnail(Exiv2::Image* image) const;
/*!
@brief Erase the complete Exif data block from the file.
*/
@ -270,7 +270,7 @@ namespace Action {
"-thumb" and the appropriate suffix (".jpg" or ".tif"), depending
on the format of the Exif thumbnail image.
*/
int writeThumbnail() const;
int writeThumbnail() const;
private:
virtual Extract* clone_() const;
@ -301,7 +301,7 @@ namespace Action {
}; // class Insert
/*!
@brief %Modify the Exif data according to the commands in the
@brief %Modify the Exif data according to the commands in the
modification table.
*/
class Modify : public Task {
@ -310,23 +310,23 @@ namespace Action {
virtual int run(const std::string& path);
typedef std::auto_ptr<Modify> AutoPtr;
AutoPtr clone() const;
Modify() {}
Modify() {}
private:
virtual Modify* clone_() const;
//! Copy contructor needed because of AutoPtr member
Modify(const Modify& /*src*/) {}
//! Copy contructor needed because of AutoPtr member
Modify(const Modify& /*src*/) {}
//! Add a metadatum according to \em modifyCmd
//! Add a metadatum according to \em modifyCmd
void addMetadatum(const ModifyCmd& modifyCmd);
//! Set a metadatum according to \em modifyCmd
//! Set a metadatum according to \em modifyCmd
void setMetadatum(const ModifyCmd& modifyCmd);
//! Delete a metadatum according to \em modifyCmd
//! Delete a metadatum according to \em modifyCmd
void delMetadatum(const ModifyCmd& modifyCmd);
Exiv2::Image::AutoPtr image_; //!< Image to modify
Exiv2::Image::AutoPtr image_; //!< Image to modify
}; // class Modify
} // namespace Action
} // namespace Action
#endif // #ifndef ACTIONS_HPP_

@ -25,7 +25,7 @@ try {
// Add to the Exif data
// This is the quickest way to add (simple) Exif data. If a metadatum for
// a given key already exists, its value is overwritten. Otherwise a new
// a given key already exists, its value is overwritten. Otherwise a new
// tag is added.
exifData["Exif.Image.Model"] = "Test 1"; // AsciiValue
exifData["Exif.Image.SamplesPerPixel"] = uint16_t(162); // UShortValue
@ -46,7 +46,7 @@ try {
Exiv2::URationalValue::AutoPtr rv(new Exiv2::URationalValue);
// Set two rational components from a string
rv->read("1/2 1/3");
// Add more elements through the extended interface of rational value
// Add more elements through the extended interface of rational value
rv->value_.push_back(std::make_pair(2,3));
rv->value_.push_back(std::make_pair(3,4));
// Add the key and value pair to the Exif data
@ -63,7 +63,7 @@ try {
std::string date = tag.toString();
date.replace(0, 4, "2000");
tag.setValue(date);
std::cout << "Modified key \"" << key
std::cout << "Modified key \"" << key
<< "\", new value \"" << tag.value() << "\"\n";
// Alternatively, we can use findKey()
@ -80,7 +80,7 @@ try {
rv->value_[2] = std::make_pair(88,77);
// Copy the modified value back to the metadatum
pos->setValue(rv.get());
std::cout << "Modified key \"" << key
std::cout << "Modified key \"" << key
<< "\", new value \"" << pos->value() << "\"\n";
// *************************************************************************

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -63,11 +63,11 @@ EXIV2_RCSID("@(#) $Id$");
// class member definitions
namespace Exiv2 {
FileIo::FileIo(const std::string& path)
FileIo::FileIo(const std::string& path)
: path_(path), fp_(0), opMode_(opSeek)
{
}
FileIo::~FileIo()
{
close();
@ -76,10 +76,10 @@ namespace Exiv2 {
BasicIo::AutoPtr FileIo::temporary() const
{
BasicIo::AutoPtr basicIo;
struct stat buf;
int ret = stat(path_.c_str(), &buf);
// If file is > 1MB then use a file, otherwise use memory buffer
if (ret != 0 || buf.st_size > 1048576) {
pid_t pid = getpid();
@ -111,13 +111,13 @@ namespace Exiv2 {
case opRead:
// Flush if current mode allows reading, else reopen (in mode "r+b"
// as in this case we know that we can write to the file)
if ( openMode_[0] == 'r'
|| openMode_.substr(0, 2) == "w+"
if ( openMode_[0] == 'r'
|| openMode_.substr(0, 2) == "w+"
|| openMode_.substr(0, 2) == "a+") reopen = false;
break;
case opWrite:
// Flush if current mode allows writing, else reopen
if ( openMode_.substr(0, 2) == "r+"
if ( openMode_.substr(0, 2) == "r+"
|| openMode_[0] == 'w'
|| openMode_[0] == 'a') reopen = false;
break;
@ -177,7 +177,7 @@ namespace Exiv2 {
{
const bool wasOpen = (fp_ != 0);
const std::string lastMode(openMode_);
FileIo *fileIo = dynamic_cast<FileIo*>(&src);
if (fileIo) {
// Optimization if this is another instance of FileIo
@ -220,7 +220,7 @@ namespace Exiv2 {
if (switchMode(opWrite) != 0) return EOF;
return putc(data, fp_);
}
int FileIo::seek(long offset, Position pos)
{
assert(fp_ != 0);
@ -255,9 +255,9 @@ namespace Exiv2 {
struct stat buf;
int ret = stat(path_.c_str(), &buf);
if (ret != 0) return -1;
return buf.st_size;
return buf.st_size;
}
int FileIo::open()
@ -283,7 +283,7 @@ namespace Exiv2 {
{
return fp_ != 0;
}
int FileIo::close()
{
if (fp_ != 0) {
@ -292,7 +292,7 @@ namespace Exiv2 {
}
return 0;
}
DataBuf FileIo::read(long rcount)
{
assert(fp_ != 0);
@ -320,7 +320,7 @@ namespace Exiv2 {
{
return fp_ != 0 ? ferror(fp_) : 0;
}
bool FileIo::eof() const
{
assert(fp_ != 0);
@ -332,11 +332,11 @@ namespace Exiv2 {
return path_;
}
MemIo::MemIo()
MemIo::MemIo()
: data_(0),
idx_(0),
size_(0),
sizeAlloced_(0),
idx_(0),
size_(0),
sizeAlloced_(0),
isMalloced_(false)
{
}
@ -350,10 +350,10 @@ namespace Exiv2 {
{
}
MemIo::~MemIo()
{
MemIo::~MemIo()
{
if (isMalloced_) {
std::free(data_);
std::free(data_);
}
}
@ -361,14 +361,14 @@ namespace Exiv2 {
{
return BasicIo::AutoPtr(new MemIo);
}
void MemIo::checkSize(long wcount)
{
long need = wcount + idx_;
if (need > size_) {
if (need > sizeAlloced_) {
// Allocate in blocks of 32kB
long want = 32768 * (1 + need / 32768);
long want = 32768 * (1 + need / 32768);
if (size_ > 0) {
if (!isMalloced_) {
// "copy-on-expand"
@ -422,7 +422,7 @@ namespace Exiv2 {
}
idx_ = 0;
write(src);
src.close();
src.close();
}
if (error() || src.error()) throw Error(19, strError());
}
@ -431,7 +431,7 @@ namespace Exiv2 {
{
if (static_cast<BasicIo*>(this) == &src) return 0;
if (!src.isopen()) return 0;
byte buf[4096];
long readCount = 0;
long writeTotal = 0;
@ -449,11 +449,11 @@ namespace Exiv2 {
data_[idx_++] = data;
return data;
}
int MemIo::seek(long offset, Position pos)
{
long newIdx = 0;
switch (pos) {
case BasicIo::cur: newIdx = idx_ + offset; break;
case BasicIo::beg: newIdx = offset; break;
@ -474,7 +474,7 @@ namespace Exiv2 {
{
return size_;
}
int MemIo::open()
{
idx_ = 0;
@ -485,12 +485,12 @@ namespace Exiv2 {
{
return true;
}
int MemIo::close()
{
return 0;
}
DataBuf MemIo::read(long rcount)
{
DataBuf buf(rcount);
@ -519,7 +519,7 @@ namespace Exiv2 {
{
return 0;
}
bool MemIo::eof() const
{
return idx_ == size_;

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -22,7 +22,7 @@
@file basicio.hpp
@brief Simple binary IO abstraction
@version $Rev$
@author Brad Schick (brad)
@author Brad Schick (brad)
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
@date 04-Dec-04, brad: created
*/
@ -60,7 +60,7 @@ namespace Exiv2 {
//! Seek starting positions
enum Position { beg, cur, end };
//! @name Creators
//@{
//! Destructor
@ -71,13 +71,13 @@ namespace Exiv2 {
//@{
/*!
@brief Open the IO source using the default access mode. The
default mode should allow for reading and writing.
default mode should allow for reading and writing.
This method can also be used to "reopen" an IO source which will
flush any unwritten data and reset the IO position to the start.
Subclasses may provide custom methods to allow for
opening IO sources differently.
opening IO sources differently.
@return 0 if successful;<BR>
Nonzero if failure.
*/
@ -93,7 +93,7 @@ namespace Exiv2 {
/*!
@brief Write data to the IO source. Current IO position is advanced
by the number of bytes written.
@param data Pointer to data. Data must be at least \em wcount
@param data Pointer to data. Data must be at least \em wcount
bytes long
@param wcount Number of bytes to be written.
@return Number of bytes written to IO source successfully;<BR>
@ -151,12 +151,12 @@ namespace Exiv2 {
virtual int getb() = 0;
/*!
@brief Remove all data from this object's IO source and then transfer
data from the \em src BasicIo object into this object.
data from the \em src BasicIo object into this object.
The source object is invalidated by this operation and should not be
used after this method returns. This method exists primarily to
be used with the BasicIo::temporary() method.
@param src Reference to another BasicIo instance. The entire contents
of src are transferred to this object. The \em src object is
invalidated by the method.
@ -164,7 +164,7 @@ namespace Exiv2 {
*/
virtual void transfer(BasicIo& src) = 0;
/*!
@brief Move the current IO position.
@brief Move the current IO position.
@param offset Number of bytes to move the position relative
to the starting position specified by \em pos
@param pos Position from which the seek should start
@ -177,7 +177,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
@brief Get the current IO position.
@brief Get the current IO position.
@return Offset from the start of IO if successful;<BR>
-1 if failure;
*/
@ -202,14 +202,14 @@ namespace Exiv2 {
virtual std::string path() const =0;
/*!
@brief Returns a temporary data storage location. This is often
needed to rewrite an IO source.
needed to rewrite an IO source.
For example, data may be read from the original IO source, modified
in some way, and then saved to the temporary instance. After the
operation is complete, the BasicIo::transfer method can be used to
replace the original IO source with the modified version. Subclasses
are free to return any class that derives from BasicIo.
@return An instance of BasicIo on success
@throw Error In case of failure
*/
@ -234,7 +234,7 @@ namespace Exiv2 {
public:
//! @name Creators
//@{
//! Constructor, takes a BasicIo reference
//! Constructor, takes a BasicIo reference
IoCloser(BasicIo &bio) : bio_(bio) {}
//! Destructor, closes the BasicIo reference
~IoCloser() { close(); }
@ -248,7 +248,7 @@ namespace Exiv2 {
// DATA
//! The BasicIo reference
BasicIo &bio_;
BasicIo &bio_;
private:
// Not implemented
//! Copy constructor
@ -287,7 +287,7 @@ namespace Exiv2 {
unwritten data and reset the IO position to the start. Although
files can be opened in binary or text mode, this class has
only been tested carefully in binary mode.
@param mode Specified that type of access allowed on the file.
Valid values match those of the C fopen command exactly.
@return 0 if successful;<BR>
@ -300,7 +300,7 @@ namespace Exiv2 {
any unwritten data and reset the IO position to the start.
@return 0 if successful;<BR>
Nonzero if failure.
*/
*/
virtual int open();
/*!
@brief Flush and unwritten data and close the file . It is
@ -312,7 +312,7 @@ namespace Exiv2 {
/*!
@brief Write data to the file. The file position is advanced
by the number of bytes written.
@param data Pointer to data. Data must be at least \em wcount
@param data Pointer to data. Data must be at least \em wcount
bytes long
@param wcount Number of bytes to be written.
@return Number of bytes written to the file successfully;<BR>
@ -377,7 +377,7 @@ namespace Exiv2 {
is invalidated by this operation and should not be used after this
method returns. This method exists primarily to be used with
the BasicIo::temporary() method.
@param src Reference to another BasicIo instance. The entire contents
of src are transferred to this object. The \em src object is
invalidated by the method.
@ -385,7 +385,7 @@ namespace Exiv2 {
*/
virtual void transfer(BasicIo& src);
/*!
@brief Move the current file position.
@brief Move the current file position.
@param offset Number of bytes to move the file position
relative to the starting position specified by \em pos
@param pos Position from which the seek should start
@ -398,14 +398,14 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
@brief Get the current file position.
@brief Get the current file position.
@return Offset from the start of the file if successful;<BR>
-1 if failure;
*/
virtual long tell() const;
/*!
@brief Flush any buffered writes and get the current file size
in bytes.
in bytes.
@return Size of the file in bytes;<BR>
-1 if failure;
*/
@ -429,7 +429,7 @@ namespace Exiv2 {
*/
virtual BasicIo::AutoPtr temporary() const;
//@}
private:
// NOT IMPLEMENTED
//! Copy constructor
@ -450,7 +450,7 @@ namespace Exiv2 {
/*!
@brief Switch to a new access mode, reopening the file if needed.
Optimized to only reopen the file when it is really necessary.
@param opMode The mode to switch to.
@param opMode The mode to switch to.
@return 0 if successful
*/
int switchMode(OpMode opMode);
@ -463,7 +463,7 @@ namespace Exiv2 {
any data passed to its constructors. If writes are performed, the
changed data can be retrieved using the read methods (since the
data used in construction is never modified).
@note If read only usage of this class is common, it might be worth
creating a specialized readonly class or changing this one to
have a readonly mode.
@ -478,7 +478,7 @@ namespace Exiv2 {
/*!
@brief Constructor that accepts a block of memory to be copied.
IO operations are performed on the copied memory.
@param data Pointer to data. Data must be at least \em size
@param data Pointer to data. Data must be at least \em size
bytes long
@param size Number of bytes to copy.
*/
@ -494,18 +494,18 @@ namespace Exiv2 {
therefore only resets the IO position to the start.
@return 0
*/
*/
virtual int open();
/*!
@brief Does nothing on MemIo objects.
@return 0
@return 0
*/
virtual int close();
/*!
@brief Write data to the memory block. If needed, the size of the
internal memory block is expanded. The IO position is advanced
by the number of bytes written.
@param data Pointer to data. Data must be at least \em wcount
by the number of bytes written.
@param data Pointer to data. Data must be at least \em wcount
bytes long
@param wcount Number of bytes to be written.
@return Number of bytes written to the memory block successfully;<BR>
@ -571,7 +571,7 @@ namespace Exiv2 {
is invalidated by this operation and should not be used after this
method returns. This method exists primarily to be used with
the BasicIo::temporary() method.
@param src Reference to another BasicIo instance. The entire contents
of src are transferred to this object. The \em src object is
invalidated by the method.
@ -579,7 +579,7 @@ namespace Exiv2 {
*/
virtual void transfer(BasicIo& src);
/*!
@brief Move the current IO position.
@brief Move the current IO position.
@param offset Number of bytes to move the IO position
relative to the starting position specified by \em pos
@param pos Position from which the seek should start
@ -592,12 +592,12 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
@brief Get the current IO position.
@brief Get the current IO position.
@return Offset from the start of the memory block
*/
virtual long tell() const;
/*!
@brief Get the current memory buffer size in bytes.
@brief Get the current memory buffer size in bytes.
@return Size of the in memory data in bytes;<BR>
-1 if failure;
*/
@ -634,7 +634,7 @@ namespace Exiv2 {
// METHODS
void checkSize(long wcount);
}; // class MemIo
}; // class MemIo
} // namespace Exiv2
#endif // #ifndef BASICIO_HPP_

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -56,8 +56,8 @@ namespace Exiv2 {
//! @cond IGNORE
CanonMakerNote::RegisterMn::RegisterMn()
{
MakerNoteFactory::registerMakerNote("Canon", "*", createCanonMakerNote);
MakerNoteFactory::registerMakerNote("Canon", "*", createCanonMakerNote);
MakerNoteFactory::registerMakerNote(
canonIfdId, MakerNote::AutoPtr(new CanonMakerNote));
MakerNoteFactory::registerMakerNote(
@ -191,7 +191,7 @@ namespace Exiv2 {
};
int CanonMakerNote::read(const byte* buf,
long len,
long len,
long start,
ByteOrder byteOrder,
long shift)
@ -205,7 +205,7 @@ namespace Exiv2 {
for (uint16_t c = 1; cs->count() > c; ++c) {
if (c == 23 && cs->count() > 25) {
// Pack related lens info into one tag
addCsEntry(canonCs1IfdId, c, cs->offset() + c*2,
addCsEntry(canonCs1IfdId, c, cs->offset() + c*2,
cs->data() + c*2, 3);
c += 2;
}
@ -253,9 +253,9 @@ namespace Exiv2 {
return 0;
}
void CanonMakerNote::addCsEntry(IfdId ifdId,
uint16_t tag,
long offset,
void CanonMakerNote::addCsEntry(IfdId ifdId,
uint16_t tag,
long offset,
const byte* data,
int count)
{
@ -270,7 +270,7 @@ namespace Exiv2 {
void CanonMakerNote::add(const Entry& entry)
{
assert(alloc_ == entry.alloc());
assert( entry.ifdId() == canonIfdId
assert( entry.ifdId() == canonIfdId
|| entry.ifdId() == canonCs1IfdId
|| entry.ifdId() == canonCs2IfdId
|| entry.ifdId() == canonCfIfdId);
@ -282,7 +282,7 @@ namespace Exiv2 {
{
if (byteOrder_ == invalidByteOrder) byteOrder_ = byteOrder;
assert(ifd_.alloc());
assert(ifd_.alloc());
ifd_.clear();
// Add all standard Canon entries to the IFD
@ -358,7 +358,7 @@ namespace Exiv2 {
return headerSize() + ifd.size() + ifd.dataSize();
} // CanonMakerNote::size
long CanonMakerNote::assemble(Entry& e,
long CanonMakerNote::assemble(Entry& e,
IfdId ifdId,
uint16_t tag,
ByteOrder byteOrder) const
@ -390,7 +390,7 @@ namespace Exiv2 {
return len;
} // CanonMakerNote::assemble
Entries::const_iterator CanonMakerNote::findIdx(int idx) const
Entries::const_iterator CanonMakerNote::findIdx(int idx) const
{
return std::find_if(entries_.begin(), entries_.end(),
FindEntryByIdx(idx));
@ -412,9 +412,9 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
CanonMakerNote* CanonMakerNote::create_(bool alloc) const
CanonMakerNote* CanonMakerNote::create_(bool alloc) const
{
return new CanonMakerNote(alloc);
return new CanonMakerNote(alloc);
}
CanonMakerNote::AutoPtr CanonMakerNote::clone() const
@ -422,9 +422,9 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
CanonMakerNote* CanonMakerNote::clone_() const
CanonMakerNote* CanonMakerNote::clone_() const
{
return new CanonMakerNote(*this);
return new CanonMakerNote(*this);
}
std::ostream& CanonMakerNote::print0x0008(std::ostream& os,
@ -432,7 +432,7 @@ namespace Exiv2 {
{
std::string n = value.toString();
if (n.length() < 4) return os << "(" << n << ")";
return os << n.substr(0, n.length() - 4) << "-"
return os << n.substr(0, n.length() - 4) << "-"
<< n.substr(n.length() - 4);
}
@ -442,13 +442,13 @@ namespace Exiv2 {
std::istringstream is(value.toString());
uint32_t l;
is >> l;
return os << std::setw(4) << std::setfill('0') << std::hex
return os << std::setw(4) << std::setfill('0') << std::hex
<< ((l & 0xffff0000) >> 16)
<< std::setw(5) << std::setfill('0') << std::dec
<< (l & 0x0000ffff);
}
std::ostream& CanonMakerNote::printCs10x0001(std::ostream& os,
std::ostream& CanonMakerNote::printCs10x0001(std::ostream& os,
const Value& value)
{
if (value.typeId() != unsignedShort) return os << value;
@ -469,7 +469,7 @@ namespace Exiv2 {
if (l == 0) {
os << "Off";
}
else {
else {
os << l / 10.0 << " s";
}
return os;
@ -512,7 +512,7 @@ namespace Exiv2 {
std::ostream& CanonMakerNote::printCs10x0005(std::ostream& os,
const Value& value)
{
if (value.typeId() != unsignedShort) return os << value;
if (value.typeId() != unsignedShort) return os << value;
long l = value.toLong();
switch (l) {
case 0: os << "Single / timer"; break;
@ -903,9 +903,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createCanonMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new CanonMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -62,27 +62,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createCanonMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -110,8 +110,8 @@ namespace Exiv2 {
//! @name Manipulators
//@{
int read(const byte* buf,
long len,
long start,
long len,
long start,
ByteOrder byteOrder,
long shift);
long copy(byte* buf, ByteOrder byteOrder, long offset);
@ -131,7 +131,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Canon %MakerNote tags
//! @name Print functions for Canon %MakerNote tags
//@{
//! Print the image number
static std::ostream& print0x0008(std::ostream& os, const Value& value);
@ -168,7 +168,7 @@ namespace Exiv2 {
static std::ostream& printCs10x0014(std::ostream& os, const Value& value);
//! Flash activity
static std::ostream& printCs10x001c(std::ostream& os, const Value& value);
//! Flash details
//! Flash details
static std::ostream& printCs10x001d(std::ostream& os, const Value& value);
//! Focus mode (G1 seems to use this in preference to field 7)
static std::ostream& printCs10x0020(std::ostream& os, const Value& value);
@ -205,8 +205,8 @@ namespace Exiv2 {
//! @name Manipulators
//@{
//! Add a camera settings entry to the makernote entries
void addCsEntry(IfdId ifdId,
uint16_t tag,
void addCsEntry(IfdId ifdId,
uint16_t tag,
long offset,
const byte* data,
int count);
@ -215,8 +215,8 @@ namespace Exiv2 {
//! @name Accessors
//@{
//! Assemble special Canon entries into an entry with the original tag
long assemble(Entry& e,
IfdId ifdId,
long assemble(Entry& e,
IfdId ifdId,
uint16_t tag,
ByteOrder byteOrder) const;
//! Internal virtual create function.
@ -244,14 +244,14 @@ namespace Exiv2 {
/*!
@brief Convert Canon hex-based EV (modulo 0x20) to real number
Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv
Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv
by Will Stokes
0x00 -> 0
0x0c -> 0.33333
0x10 -> 0.5
0x14 -> 0.66666
0x20 -> 1
0x20 -> 1
..
160 -> 5
128 -> 4

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -23,7 +23,7 @@
Version: $Rev$
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 28-Aug-05, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
@ -61,7 +61,7 @@ EXIV2_RCSID("@(#) $Id$");
namespace Exiv2 {
const byte CrwImage::blank_[] = {
0x00
0x00
};
CrwImage::CrwImage(BasicIo::AutoPtr io, bool create)
@ -96,7 +96,7 @@ namespace Exiv2 {
clearExifData();
clearComment();
}
void CrwImage::setMetadata(const Image& image)
{
setExifData(image.exifData());
@ -129,7 +129,7 @@ namespace Exiv2 {
}
void CrwImage::setComment(const std::string& comment)
{
{
comment_ = comment;
}
@ -175,9 +175,9 @@ namespace Exiv2 {
return isCrwType(iIo, advance);
}
void CiffComponent::read(const byte* buf,
uint32_t len,
uint32_t start,
void CiffComponent::read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t /*shift*/)
{
@ -200,11 +200,11 @@ namespace Exiv2 {
pData_ = buf + offset_;
} // CiffComponent::read
void CiffComponent::print(std::ostream& os,
void CiffComponent::print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix) const
{
os << prefix
os << prefix
<< "tag = 0x" << std::setw(4) << std::setfill('0')
<< std::hex << std::right << tagId()
<< ", dir = 0x" << std::setw(4) << std::setfill('0')
@ -252,7 +252,7 @@ namespace Exiv2 {
{
CrwMap::extract(*this, image, byteOrder);
} // CiffEntry::extract
void CiffEntry::add(RawMetadata::AutoPtr component)
{
throw Error(34, "CiffEntry::add");
@ -272,9 +272,9 @@ namespace Exiv2 {
components_.push_back(component.release());
} // CiffDirectory::add
void CiffDirectory::read(const byte* buf,
uint32_t len,
uint32_t start,
void CiffDirectory::read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t /*shift*/)
{
@ -291,7 +291,7 @@ namespace Exiv2 {
}
} // CiffDirectory::extract
void CiffDirectory::print(std::ostream& os,
void CiffDirectory::print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix) const
{
@ -303,10 +303,10 @@ namespace Exiv2 {
}
} // CiffDirectory::print
void CiffDirectory::readDirectory(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
void CiffDirectory::readDirectory(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t /*shift*/)
{
uint32_t dataSize = getULong(buf + len - 4, byteOrder);
@ -342,9 +342,9 @@ namespace Exiv2 {
throw Error(34, "CiffHeader::add");
} // CiffHeader::add
void CiffHeader::read(const byte* buf,
uint32_t len,
uint32_t start,
void CiffHeader::read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t /*shift*/)
{
@ -374,18 +374,18 @@ namespace Exiv2 {
if (rootDirectory_) rootDirectory_->extract(image, byteOrder_);
} // CiffHeader::extract
void CiffHeader::print(std::ostream& os,
void CiffHeader::print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix) const
{
os << prefix
os << prefix
<< "Header, offset = 0x" << std::setw(8) << std::setfill('0')
<< std::hex << std::right << offset_ << "\n";
if (rootDirectory_) rootDirectory_->print(os, byteOrder_, prefix);
} // CiffHeader::print
const CrwMapInfo CrwMap::crwMapInfos_[] = {
CrwMapInfo(0x0805, 0x300a, 0, 0x9286, exifIfdId, extract0x0805, 0),
CrwMapInfo(0x0805, 0x300a, 0, 0x9286, exifIfdId, extract0x0805, 0),
CrwMapInfo(0x080a, 0x2807, 0, 0x010f, ifd0Id, extract0x080a, 0),
CrwMapInfo(0x080a, 0x2807, 0, 0x0110, ifd0Id, 0, 0),
CrwMapInfo(0x080b, 0x3004, 0, 0x0007, canonIfdId, extractBasic, 0),
@ -416,7 +416,7 @@ namespace Exiv2 {
CrwMapInfo(0x0000, 0x0000, 0, 0x0000, ifdIdNotSet, extractBasic, 0)
}; // CrwMap::crwMapInfos_[]
void CrwMap::extract(const CiffComponent& ciffComponent,
void CrwMap::extract(const CiffComponent& ciffComponent,
Image& image,
ByteOrder byteOrder)
{
@ -430,7 +430,7 @@ namespace Exiv2 {
const CrwMapInfo* CrwMap::crwMapInfo(uint16_t dir, uint16_t tagId)
{
for (int i = 0; crwMapInfos_[i].ifdId_ != ifdIdNotSet; ++i) {
if ( crwMapInfos_[i].crwDir_ == dir
if ( crwMapInfos_[i].crwDir_ == dir
&& crwMapInfos_[i].crwTagId_ == tagId) {
return &(crwMapInfos_[i]);
}
@ -439,7 +439,7 @@ namespace Exiv2 {
} // CrwMap::crwMapInfo
void CrwMap::extract0x0805(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder /*byteOrder*/)
{
@ -448,7 +448,7 @@ namespace Exiv2 {
} // CrwMap::extract0x0805
void CrwMap::extract0x080a(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -460,7 +460,7 @@ namespace Exiv2 {
ExifKey key1("Exif.Image.Make");
Value::AutoPtr value1 = Value::create(ciffComponent.typeId());
uint32_t i = 0;
for (; i < ciffComponent.size()
for (; i < ciffComponent.size()
&& ciffComponent.pData()[i] != '\0'; ++i) {
// empty
}
@ -471,7 +471,7 @@ namespace Exiv2 {
ExifKey key2("Exif.Image.Model");
Value::AutoPtr value2 = Value::create(ciffComponent.typeId());
uint32_t j = i;
for (; i < ciffComponent.size()
for (; i < ciffComponent.size()
&& ciffComponent.pData()[i] != '\0'; ++i) {
// empty
}
@ -480,7 +480,7 @@ namespace Exiv2 {
} // CrwMap::extract0x080a
void CrwMap::extract0x102a(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -524,7 +524,7 @@ namespace Exiv2 {
} // CrwMap::extract0x102a
void CrwMap::extract0x102d(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -546,7 +546,7 @@ namespace Exiv2 {
} // CrwMap::extract0x102d
void CrwMap::extract0x180e(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -577,7 +577,7 @@ namespace Exiv2 {
} // CrwMap::extract0x180e
void CrwMap::extract0x1810(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -598,16 +598,16 @@ namespace Exiv2 {
} // CrwMap::extract0x1810
void CrwMap::extract0x2008(const CiffComponent& ciffComponent,
const CrwMapInfo* /*crwMapInfo*/,
const CrwMapInfo* /*crwMapInfo*/,
Image& image,
ByteOrder /*byteOrder*/)
{
image.exifData().setJpegThumbnail(ciffComponent.pData(),
image.exifData().setJpegThumbnail(ciffComponent.pData(),
ciffComponent.size());
} // CrwMap::extract0x2008
void CrwMap::extractBasic(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder)
{
@ -623,8 +623,8 @@ namespace Exiv2 {
}
else if (ciffComponent.typeId() == asciiString) {
// determine size from the data, by looking for the first 0
uint32_t i = 0;
for (; i < ciffComponent.size()
uint32_t i = 0;
for (; i < ciffComponent.size()
&& ciffComponent.pData()[i] != '\0'; ++i) {
// empty
}
@ -665,7 +665,7 @@ namespace Exiv2 {
|| ('M' == tmpBuf[0] && 'M' == tmpBuf[1]))) {
result = false;
}
if ( true == result
if ( true == result
&& std::memcmp(tmpBuf + 6, CiffHeader::signature_, 8) != 0) {
result = false;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -56,9 +56,9 @@ namespace Exiv2 {
// *****************************************************************************
// type definitions
//! Function pointer for functions to extract Exif tags from a Crw entry
//! Function pointer for functions to extract Exif tags from a Crw entry
typedef void (*CrwExtractFct)(const CiffComponent&,
const CrwMapInfo*,
const CrwMapInfo*,
Image&,
ByteOrder);
@ -69,12 +69,12 @@ namespace Exiv2 {
// class definitions
// Add Crw to the supported image formats
namespace ImageType {
namespace ImageType {
const int crw = 3; //!< Crw image type (see class CrwImage)
}
/*!
@brief Class to access raw Canon Crw images. Only Exif metadata and a
@brief Class to access raw Canon Crw images. Only Exif metadata and a
comment are supported. Crw format does not contain Iptc metadata.
*/
class CrwImage : public Image {
@ -91,7 +91,7 @@ namespace Exiv2 {
public:
//! @name Creators
//@{
/*!
/*!
@brief Constructor that can either open an existing Crw image or create
a new image from scratch. If a new image is to be created, any
existing data is overwritten. Since the constructor can not return
@ -110,24 +110,24 @@ namespace Exiv2 {
//! Destructor
~CrwImage() {}
//@}
//! @name Manipulators
//@{
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
/*!
@brief Not supported. Crw format does not contain Iptc metadata.
@brief Not supported. Crw format does not contain Iptc metadata.
Calling this function will raise an exception (Error).
*/
void setIptcData(const IptcData& iptcData);
/*!
@brief Not supported. Crw format does not contain Iptc metadata.
@brief Not supported. Crw format does not contain Iptc metadata.
Calling this function will raise an exception (Error).
*/
void clearIptcData();
@ -164,9 +164,9 @@ namespace Exiv2 {
moved (see below). This applies only if the type matches and the
function returns true. If the type does not match, the stream
position is not changed. However, if reading from the stream fails,
the stream position is undefined. Consult the stream state to obtain
the stream position is undefined. Consult the stream state to obtain
more information in this case.
@param iIo BasicIo instance to read from.
@param advance Flag indicating whether the position of the io
should be advanced by the number of characters read to
@ -224,9 +224,9 @@ namespace Exiv2 {
@throw Error If the component cannot be parsed.
*/
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0) =0;
//@}
@ -236,11 +236,11 @@ namespace Exiv2 {
/*!
@brief Extract metadata from the component and add it to
\em image.
@param image Image to add metadata to
@param byteOrder Byte order
*/
virtual void extract(Image& image,
virtual void extract(Image& image,
ByteOrder byteOrder) const =0;
/*!
@ -250,7 +250,7 @@ namespace Exiv2 {
@param byteOrder Byte order
@param prefix Prefix to be written before each line of output
*/
virtual void print(std::ostream& os,
virtual void print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix ="") const =0;
//@}
@ -280,9 +280,9 @@ namespace Exiv2 {
virtual void add(RawMetadata::AutoPtr component) =0;
// See base class comment
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0);
@ -298,11 +298,11 @@ namespace Exiv2 {
//! @name Accessors
//@{
// See base class comment
virtual void extract(Image& image,
virtual void extract(Image& image,
ByteOrder byteOrder) const =0;
// See base class comment
virtual void print(std::ostream& os,
virtual void print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix ="") const;
@ -352,7 +352,7 @@ namespace Exiv2 {
@brief This class models one directory entry of a CIFF directory of
a Crw (Canon Raw data) image.
*/
class CiffEntry : public CiffComponent {
class CiffEntry : public CiffComponent {
public:
//! @name Creators
//@{
@ -397,9 +397,9 @@ namespace Exiv2 {
virtual void add(RawMetadata::AutoPtr component);
// See base class comment
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0);
@ -412,9 +412,9 @@ namespace Exiv2 {
@param byteOrder Applicable byte order (little or big endian)
@param shift Not used
*/
void readDirectory(const byte* buf,
uint32_t len,
uint32_t start,
void readDirectory(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0);
//@}
@ -422,11 +422,11 @@ namespace Exiv2 {
//! @name Accessors
//@{
// See base class comment
virtual void extract(Image& image,
virtual void extract(Image& image,
ByteOrder byteOrder) const;
// See base class comment
virtual void print(std::ostream& os,
virtual void print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix ="") const;
//@}
@ -439,14 +439,14 @@ namespace Exiv2 {
//! This class models the header of a Crw (Canon Raw data) image.
class CiffHeader : public RawMetadata {
public:
public:
//! @name Creators
//@{
//! Default constructor
CiffHeader()
: rootDirectory_ (0),
byteOrder_ (littleEndian),
offset_ (0x0000001a)
CiffHeader()
: rootDirectory_ (0),
byteOrder_ (littleEndian),
offset_ (0x0000001a)
{}
//! Virtual destructor
virtual ~CiffHeader();
@ -458,9 +458,9 @@ namespace Exiv2 {
virtual void add(RawMetadata::AutoPtr component);
// See base class comment
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
virtual void read(const byte* buf,
uint32_t len,
uint32_t start,
ByteOrder byteOrder,
int32_t shift =0);
//@}
@ -472,7 +472,7 @@ namespace Exiv2 {
ByteOrder byteOrder) const;
// See base class comment
virtual void print(std::ostream& os,
virtual void print(std::ostream& os,
ByteOrder byteOrder,
const std::string& prefix ="") const;
//@}
@ -501,13 +501,13 @@ namespace Exiv2 {
IfdId ifdId,
CrwExtractFct toExif,
CrwInsertFct fromExif)
: crwTagId_ (crwTagId),
crwDir_ (crwDir),
size_ (size),
tag_ (tag),
: crwTagId_ (crwTagId),
crwDir_ (crwDir),
size_ (size),
tag_ (tag),
ifdId_ (ifdId),
toExif_ (toExif),
fromExif_ (fromExif)
fromExif_ (fromExif)
{}
//@}
@ -517,13 +517,13 @@ namespace Exiv2 {
uint32_t size_; //!< Data size (overwrites the size from the entry)
uint16_t tag_; //!< Exif tag to map to
IfdId ifdId_; //!< Exif Ifd id to map to
CrwExtractFct toExif_; //!< Conversion function
CrwExtractFct toExif_; //!< Conversion function
CrwInsertFct fromExif_; //!< Reverse conversion function
}; // struct CrwMapInfo
/*!
@brief Static class providing mapping functionality from Crw entries
/*!
@brief Static class providing mapping functionality from Crw entries
to image metadata and vice versa
*/
class CrwMap {
@ -540,11 +540,11 @@ namespace Exiv2 {
@param ciffComponent Source CIFF entry
@param image Destination image for the metadata
@param byteOrder Byte order in which the data of the entry
@param byteOrder Byte order in which the data of the entry
is encoded
*/
static void extract(const CiffComponent& ciffComponent,
Image& image,
static void extract(const CiffComponent& ciffComponent,
Image& image,
ByteOrder byteOrder);
private:
@ -552,74 +552,74 @@ namespace Exiv2 {
static const CrwMapInfo* crwMapInfo(uint16_t dir, uint16_t tagId);
/*!
@brief Standard extraction function to convert Crw entries to
@brief Standard extraction function to convert Crw entries to
Exif metadata.
Uses the mapping defined in the conversion structure \em crwMapInfo
to convert the data. If the \em size field in the conversion structure
is not 0, then it is used instead of the \em size provided by the
is not 0, then it is used instead of the \em size provided by the
entry itself.
*/
static void extractBasic(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract the user comment
static void extract0x0805(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract camera Make and Model information
static void extract0x080a(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract Canon Camera Settings 2
static void extract0x102a(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract Canon Camera Settings 1
static void extract0x102d(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract the date when the picture was taken
static void extract0x180e(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract image width and height
static void extract0x1810(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
//! Extract the thumbnail image
static void extract0x2008(const CiffComponent& ciffComponent,
const CrwMapInfo* crwMapInfo,
Image& image,
const CrwMapInfo* crwMapInfo,
Image& image,
ByteOrder byteOrder);
// DATA
static const CrwMapInfo crwMapInfos_[]; //!< Metadata conversion table
static const CrwMapInfo crwMapInfos_[]; //!< Metadata conversion table
}; // class CrwMap
// *****************************************************************************
// template, inline and free functions
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
// ImageFactory needs to be made a friend.
/*!
@brief Create a new CrwImage instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create);

@ -29,7 +29,7 @@ using namespace Exiv2;
int main(int argc, char* const argv[])
{
try {
byte da1[]
byte da1[]
= { 0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,
0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,
0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,0xaa,0xbb,
@ -38,7 +38,7 @@ try {
long len1 = 32;
byte da2[]
byte da2[]
= { 0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,
0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc
};
@ -99,15 +99,15 @@ void print(const std::string& file)
std::cout << std::setw(35) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< std::dec << i->value()
<< "\n";
}
}
@ -117,11 +117,11 @@ int read(const std::string& path)
Image::AutoPtr image = ImageFactory::open(path);
assert(image.get() != 0);
image->readMetadata();
if (!image->exifData().empty()) {
DataBuf exifData = image->exifData().copy();
long size = exifData.size_;
// Read the TIFF header
TiffHeader tiffHeader;
int rc = tiffHeader.read(exifData.pData_);
@ -143,13 +143,13 @@ int read(const std::string& path)
v->read(i->data(), i->count() * i->typeSize(), tiffHeader.byteOrder());
v->setDataArea(exifData.pData_ + v->toLong(), 32);
std::cout << "Value of tag 0x8298: " << std::hex;
std::cout << "Value of tag 0x8298: " << std::hex;
v->write(std::cout);
std::cout << std::endl;
DataBuf buf = v->dataArea();
for (int i = 0; i< buf.size_; ++i) {
std::cout << std::hex << (int)buf.pData_[i] << " ";
std::cout << std::hex << (int)buf.pData_[i] << " ";
}
std::cout << std::endl;
@ -162,13 +162,13 @@ int read(const std::string& path)
v->read(i->data(), i->count() * i->typeSize(), tiffHeader.byteOrder());
v->setDataArea(exifData.pData_ + v->toLong(), 16);
std::cout << "Value of tag 0x013b: ";
std::cout << "Value of tag 0x013b: ";
v->write(std::cout);
std::cout << std::endl;
buf = v->dataArea();
for (int i = 0; i< buf.size_; ++i) {
std::cout << std::hex << (int)buf.pData_[i] << " ";
std::cout << std::hex << (int)buf.pData_[i] << " ";
}
std::cout << std::endl;

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -45,21 +45,21 @@ EXIV2_RCSID("@(#) $Id$");
namespace Exiv2 {
DataSet::DataSet(
uint16_t number,
uint16_t number,
const char* name,
const char* title,
const char* desc,
bool mandatory,
bool repeatable,
uint32_t minbytes,
uint32_t minbytes,
uint32_t maxbytes,
TypeId type,
uint16_t recordId,
const char* photoshop
)
: number_(number), name_(name), title_(title), desc_(desc),
mandatory_(mandatory), repeatable_(repeatable), minbytes_(minbytes),
maxbytes_(maxbytes), type_(type), recordId_(recordId),
: number_(number), name_(name), title_(title), desc_(desc),
mandatory_(mandatory), repeatable_(repeatable), minbytes_(minbytes),
maxbytes_(maxbytes), type_(type), recordId_(recordId),
photoshop_(photoshop)
{
}
@ -78,7 +78,7 @@ namespace Exiv2 {
RecordInfo(IptcDataSets::envelope, "Envelope", "IIM envelope record"),
RecordInfo(IptcDataSets::application2, "Application2", "IIM application record 2"),
};
static const DataSet envelopeRecord[] = {
DataSet(IptcDataSets::ModelVersion, "ModelVersion", "ModelVersion", "Version of IIM part 1", true, false, 2, 2, Exiv2::unsignedShort, IptcDataSets::envelope, ""),
DataSet(IptcDataSets::Destination, "Destination", "Destination", "Routing information", false, true, 0, 1024, Exiv2::string, IptcDataSets::envelope, ""),
@ -160,11 +160,11 @@ namespace Exiv2 {
static const DataSet unknownDataSet(0xffff, "Unknown dataset", "Unknown dataset", "Unknown dataset", false, true, 0, 0xffffffff, Exiv2::string, IptcDataSets::invalidRecord, "Unknown dataset");
// Dataset lookup lists.This is an array with pointers to one list per IIM4 Record.
// Dataset lookup lists.This is an array with pointers to one list per IIM4 Record.
// The record id is used as the index into the array.
const DataSet* IptcDataSets::records_[] = {
0,
envelopeRecord, application2Record,
0,
envelopeRecord, application2Record,
0
};
@ -238,7 +238,7 @@ namespace Exiv2 {
return records_[recordId][idx].repeatable_;
}
uint16_t IptcDataSets::dataSet(const std::string& dataSetName,
uint16_t IptcDataSets::dataSet(const std::string& dataSetName,
uint16_t recordId)
{
uint16_t dataSet;
@ -258,7 +258,7 @@ namespace Exiv2 {
std::string IptcDataSets::recordName(uint16_t recordId)
{
if (recordId == envelope || recordId == application2) {
return recordInfo_[recordId].name_;
return recordInfo_[recordId].name_;
}
std::ostringstream os;
@ -299,7 +299,7 @@ namespace Exiv2 {
}
}
} // IptcDataSets::dataSetList
const char* IptcKey::familyName_ = "Iptc";
IptcKey::IptcKey(const std::string& key)
@ -360,7 +360,7 @@ namespace Exiv2 {
uint16_t recId = IptcDataSets::recordId(recordName);
uint16_t dataSet = IptcDataSets::dataSet(dataSetName, recId);
// Possibly translate hex name parts (0xabcd) to real names
// Possibly translate hex name parts (0xabcd) to real names
recordName = IptcDataSets::recordName(recId);
dataSetName = IptcDataSets::dataSetName(dataSet, recId);
@ -379,12 +379,12 @@ namespace Exiv2 {
// *************************************************************************
// free functions
std::ostream& operator<<(std::ostream& os, const DataSet& dataSet)
std::ostream& operator<<(std::ostream& os, const DataSet& dataSet)
{
IptcKey iptcKey(dataSet.number_, dataSet.recordId_);
return os << dataSet.name_ << ", "
<< std::dec << dataSet.number_ << ", "
<< "0x" << std::setw(4) << std::setfill('0')
<< "0x" << std::setw(4) << std::setfill('0')
<< std::right << std::hex << dataSet.number_ << ", "
<< IptcDataSets::recordName(dataSet.recordId_) << ", "
<< std::boolalpha << dataSet.mandatory_ << ", "
@ -393,7 +393,7 @@ namespace Exiv2 {
<< dataSet.maxbytes_ << ", "
<< iptcKey.key() << ", "
<< TypeInfo::typeName(
IptcDataSets::dataSetType(dataSet.number_,
IptcDataSets::dataSetType(dataSet.number_,
dataSet.recordId_)) << ", "
<< dataSet.desc_;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -59,13 +59,13 @@ namespace Exiv2 {
struct DataSet {
//! Constructor
DataSet(
uint16_t number,
uint16_t number,
const char* name,
const char* title,
const char* desc,
bool mandatory,
bool repeatable,
uint32_t minbytes,
uint32_t minbytes,
uint32_t maxbytes,
TypeId type,
uint16_t recordId,
@ -186,30 +186,30 @@ namespace Exiv2 {
/*!
@brief Return the name of the dataset.
@param number The dataset number
@param recordId The Iptc record Id
@param recordId The Iptc record Id
@return The name of the dataset or a string containing the hexadecimal
value of the dataset in the form "0x01ff", if this is an unknown
value of the dataset in the form "0x01ff", if this is an unknown
dataset.
*/
static std::string dataSetName(uint16_t number, uint16_t recordId);
/*!
@brief Return the title (label) of the dataset.
@param number The dataset number
@param recordId The Iptc record Id
@param recordId The Iptc record Id
@return The title (label) of the dataset
*/
static const char* dataSetTitle(uint16_t number, uint16_t recordId);
/*!
@brief Return the description of the dataset.
@param number The dataset number
@param recordId The Iptc record Id
@param recordId The Iptc record Id
@return The description of the dataset
*/
static const char* dataSetDesc(uint16_t number, uint16_t recordId);
/*!
@brief Return the photohsop name of a given dataset.
@param number The dataset number
@param recordId The Iptc record Id
@param recordId The Iptc record Id
@return The name used by photoshop for a dataset or an empty
string if photoshop does not use the dataset.
*/
@ -217,7 +217,7 @@ namespace Exiv2 {
/*!
@brief Check if a given dataset is repeatable
@param number The dataset number
@param recordId The Iptc record Id
@param recordId The Iptc record Id
@return true if the given dataset is repeatable otherwise false
*/
static bool dataSetRepeatable(uint16_t number, uint16_t recordId);
@ -278,10 +278,10 @@ namespace Exiv2 {
//! @name Creators
//@{
/*!
@brief Constructor to create an Iptc key from a key string.
@brief Constructor to create an Iptc key from a key string.
@param key The key string.
@throw Error if the first part of the key is not '<b>Iptc</b>' or
@throw Error if the first part of the key is not '<b>Iptc</b>' or
the remaining parts of the key cannot be parsed and
converted to a record name and a dataset name.
*/
@ -329,7 +329,7 @@ namespace Exiv2 {
//! @name Manipulators
//@{
/*!
@brief Set the key corresponding to the dataset and record id.
@brief Set the key corresponding to the dataset and record id.
The key is of the form '<b>Iptc</b>.recordName.dataSetName'.
*/
void makeKey();
@ -351,7 +351,7 @@ namespace Exiv2 {
static const char* familyName_;
uint16_t tag_; //!< Tag value
uint16_t record_; //!< Record value
uint16_t record_; //!< Record value
std::string key_; //!< Key
}; // class IptcKey

@ -12,28 +12,28 @@
@section overview Exiv2 Overview
%Exiv2 comprises of a C++ library and a command line utility to access image
%Exiv2 comprises of a C++ library and a command line utility to access image
metadata. %Exiv2 is free software. The homepage of %Exiv2 is at
<A HREF="http://home.arcor.de/ahuggel/exiv2">http://home.arcor.de/ahuggel/exiv2</A>.
The %Exiv2 library provides
- full read and write access to the Exif and Iptc metadata of an image through
%Exiv2 keys and standard C++ iterators
- a smart Iptc implementation that does not effect data that programs like
- full read and write access to the Exif and Iptc metadata of an image through
%Exiv2 keys and standard C++ iterators
- a smart Iptc implementation that does not effect data that programs like
Photoshop store in the same image segment
- Exif %MakerNote support:
- %MakerNote tags can be accessed just like any other Exif metadata
- a sophisticated write algorithm avoids corrupting the %MakerNote:
<br>&nbsp;&nbsp;1) the %MakerNote is not re-located if possible at all, and
<br>&nbsp;&nbsp;2) %MakerNote %Ifd offsets are re-calculated if the
- a sophisticated write algorithm avoids corrupting the %MakerNote:
<br>&nbsp;&nbsp;1) the %MakerNote is not re-located if possible at all, and
<br>&nbsp;&nbsp;2) %MakerNote %Ifd offsets are re-calculated if the
%MakerNote needs to be moved (for known %Ifd %MakerNotes)
- new camera make/model specific %MakerNotes can be added to the library with
- new camera make/model specific %MakerNotes can be added to the library with
minimum effort in OO-fashion (by subclassing %MakerNote or %IfdMakerNote)
- extract and delete methods for Exif thumbnails (both, Jpeg and Tiff thumbnails)
- set methods for Exif thumbnails (Jpeg only, Tiff thumbnails can be set from
- set methods for Exif thumbnails (Jpeg only, Tiff thumbnails can be set from
individual tags)
- complete API documentation (by Doxygen)
- generic lower-level classes to access %Ifd (%Image File Directory) data
- generic lower-level classes to access %Ifd (%Image File Directory) data
structures
@section getting-started Getting started
@ -55,39 +55,39 @@
@section makernote MakerNote Formats and Specifications
A summary of <A HREF="makernote.html">MakerNote structures</A> with links to
A summary of <A HREF="makernote.html">MakerNote structures</A> with links to
publicly available specifications.
@section supp Support
<p>There is now a
<a title="Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2">Yahoo! group for Exiv2 help and discussions</a>.</p>
<p><a title="Join the Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2/join">Join the group</a> to post and receive messages or use <em><a title="Post to the Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2/post">exiv2user/password</a></em> to post anonymously. Bug reports can be submitted directly to the
<p>There is now a
<a title="Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2">Yahoo! group for Exiv2 help and discussions</a>.</p>
<p><a title="Join the Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2/join">Join the group</a> to post and receive messages or use <em><a title="Post to the Exiv2 forum" href="http://uk.groups.yahoo.com/group/exiv2/post">exiv2user/password</a></em> to post anonymously. Bug reports can be submitted directly to the
<a title="Issue tracker" href="http://dev.robotbattle.com/bugs/main_page.php"
onclick="document.images['tracker'].src='http://www.whatcounter.com/dlcount.php?id=ahu&amp;url='+this.href">
bug tracking system</a>.</p>
@section devel Development
<p>%Exiv2 is maintained in a publicly available subversion repository.
<p>%Exiv2 is maintained in a publicly available subversion repository.
There is a <a title="Last 50 commits" href="http://dev.robotbattle.com/cmtinfo_svn.php?r=10">
live list with the latest commits</a> to the repository, and you can
live list with the latest commits</a> to the repository, and you can
<a title="Online source code repository" href="http://dev.robotbattle.com/~cvsuser/cgi-bin/ns_viewcvs.cgi/exiv2/trunk/">
browse the source code</a> online.
</p>
<p>To check-out the current source code from the repository, you need a
<p>To check-out the current source code from the repository, you need a
<a title="Get Subversion!"
href="http://subversion.tigris.org/project_packages.html">subversion client</a>.
If you use a command line client, change to the directory where you want to keep
href="http://subversion.tigris.org/project_packages.html">subversion client</a>.
If you use a command line client, change to the directory where you want to keep
the source code and type:</p>
@verbatim $ svn checkout svn://dev.robotbattle.com/exiv2/trunk . @endverbatim
<p>To download the test data and test drivers for version 0.7 from
the repository, change to your local exiv2-0.7 directory and use the
following command:
</p>
@verbatim $ svn export svn://dev.robotbattle.com/exiv2/tags/0.7/test @endverbatim
<P>If you'd like to contribute code, please <A HREF="mailto:ahuggel@gmx.net">contact me</A>.
@ -100,12 +100,12 @@ bug tracking system</a>.</p>
terms of the <a href="gpl-license.html">GNU General Public License</a> as
published by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.</P>
<P>%Exiv2 is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more
details.</P>
<P>You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.</P>

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -51,7 +51,7 @@ namespace Exiv2 {
ErrMsg( 5, "Invalid record name `%1'"), // %1=record name
ErrMsg( 6, "Invalid key `%1'"), // %1=key
ErrMsg( 7, "Invalid tag name or ifdId `%1', ifdId %2"), // %1=tag name, %2=ifdId
ErrMsg( 8, "Value not set"),
ErrMsg( 8, "Value not set"),
ErrMsg( 9, "%1: Failed to open the data source: %2"), // %1=path, %2=strerror
ErrMsg( 10, "%1: Failed to open file (%2): %3"), // %1=path, %2=mode, %3=strerror
ErrMsg( 11, "%1: The file contains data of an unknown image type"), // %1=path

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -57,15 +57,15 @@ namespace Exiv2 {
};
/*!
@brief Error class interface. Allows the definition and use of a hierarchy
@brief Error class interface. Allows the definition and use of a hierarchy
of error classes which can all be handled in one catch block.
*/
class AnyError {
public:
//! @name Creators
//@{
//@{
//! Virtual destructor.
virtual ~AnyError()
virtual ~AnyError()
{
}
//@}
@ -77,8 +77,8 @@ namespace Exiv2 {
/*!
@brief Return the error message. Consider using the output operator
operator<<(std::ostream &os, const AnyError& error) instead.
@note Unlike std::exception::what(), this function returns an
std::string.
@note Unlike std::exception::what(), this function returns an
std::string.
*/
virtual std::string what() const =0;
}; // AnyError
@ -90,13 +90,13 @@ namespace Exiv2 {
}
/*!
@brief Simple error class used for exceptions. An output operator is
@brief Simple error class used for exceptions. An output operator is
provided to print errors to a stream.
*/
class Error : public AnyError {
public:
//! @name Creators
//@{
//@{
//! Constructor taking only an error code
explicit Error(int code)
: code_(code), count_(0)
@ -117,9 +117,9 @@ namespace Exiv2 {
}
//! Constructor taking an error code and three arguments
template<typename A, typename B, typename C>
Error(int code, const A& arg1, const B& arg2, const C& arg3)
Error(int code, const A& arg1, const B& arg2, const C& arg3)
: code_(code), count_(3),
arg1_(toString(arg1)), arg2_(toString(arg2)), arg3_(toString(arg3))
arg1_(toString(arg1)), arg2_(toString(arg2)), arg3_(toString(arg3))
{
}
//@}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -29,8 +29,8 @@
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Id$");
// Define DEBUG_MAKERNOTE to output debug information to std::cerr, e.g, by
// calling make like this: make DEFS=-DDEBUG_MAKERNOTE exif.o
// Define DEBUG_MAKERNOTE to output debug information to std::cerr, e.g, by
// calling make like this: make DEFS=-DDEBUG_MAKERNOTE exif.o
//#define DEBUG_MAKERNOTE
// *****************************************************************************
@ -79,7 +79,7 @@ namespace {
void setOffsetTag(Exiv2::Ifd& ifd,
int idx,
uint16_t tag,
uint32_t offset,
uint32_t offset,
Exiv2::ByteOrder byteOrder);
// Read file path into a DataBuf, which is returned.
@ -97,7 +97,7 @@ namespace Exiv2 {
setValue(e, byteOrder);
}
Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue)
Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue)
: key_(key.clone())
{
if (pValue) value_ = pValue->clone();
@ -114,10 +114,10 @@ namespace Exiv2 {
if (rhs.value_.get() != 0) value_ = rhs.value_->clone(); // deep copy
}
const Value& Exifdatum::value() const
const Value& Exifdatum::value() const
{
if (value_.get() == 0) throw Error(8);
return *value_;
if (value_.get() == 0) throw Error(8);
return *value_;
}
Exifdatum& Exifdatum::operator=(const Exifdatum& rhs)
@ -133,41 +133,41 @@ namespace Exiv2 {
return *this;
} // Exifdatum::operator=
Exifdatum& Exifdatum::operator=(const std::string& value)
{
setValue(value);
return *this;
{
setValue(value);
return *this;
}
Exifdatum& Exifdatum::operator=(const uint16_t& value)
Exifdatum& Exifdatum::operator=(const uint16_t& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const uint32_t& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const URational& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const int16_t& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const int32_t& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const Rational& value)
{
return Exiv2::setValue(*this, value);
return Exiv2::setValue(*this, value);
}
Exifdatum& Exifdatum::operator=(const Value& value)
@ -200,7 +200,7 @@ namespace Exiv2 {
TiffThumbnail& TiffThumbnail::operator=(const TiffThumbnail& /*rhs*/)
{
return *this;
return *this;
}
int TiffThumbnail::setDataArea(ExifData& exifData, Ifd* pIfd1,
@ -218,7 +218,7 @@ namespace Exiv2 {
}
DataBuf stripsBuf(totalSize);
// Copy all strips into the data buffer. For each strip remember its
// Copy all strips into the data buffer. For each strip remember its
// offset from the start of the data buffer
ExifData::iterator stripOffsets;
key = ExifKey("Exif.Thumbnail.StripOffsets");
@ -243,7 +243,7 @@ namespace Exiv2 {
currentOffset += size;
}
// Set StripOffsets data area and relative offsets
// Set StripOffsets data area and relative offsets
stripOffsets->setDataArea(stripsBuf.pData_, stripsBuf.size_);
stripOffsets->setValue(os.str());
@ -287,9 +287,9 @@ namespace Exiv2 {
return buf;
}
JpegThumbnail& JpegThumbnail::operator=(const JpegThumbnail& /*rhs*/)
JpegThumbnail& JpegThumbnail::operator=(const JpegThumbnail& /*rhs*/)
{
return *this;
return *this;
}
int JpegThumbnail::setDataArea(ExifData& exifData, Ifd* pIfd1,
@ -332,16 +332,16 @@ namespace Exiv2 {
return format->dataArea();
}
ExifData::ExifData()
: pTiffHeader_(0),
pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0),
ExifData::ExifData()
: pTiffHeader_(0),
pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0),
pMakerNote_(0), size_(0), pData_(0), compatible_(true)
{
}
ExifData::ExifData(const ExifData& rhs)
: exifMetadata_(rhs.exifMetadata_), pTiffHeader_(0),
pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0),
pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0),
pMakerNote_(0), size_(0), pData_(0), compatible_(rhs.compatible_)
{
pData_ = new byte[rhs.size_];
@ -475,7 +475,7 @@ namespace Exiv2 {
// Read IFD0
delete pIfd0_;
pIfd0_ = new Ifd(ifd0Id, 0, false);
pIfd0_ = new Ifd(ifd0Id, 0, false);
assert(pIfd0_ != 0);
rc = pIfd0_->read(pData_, size_, pTiffHeader_->offset(), byteOrder());
if (rc) return rc;
@ -486,11 +486,11 @@ namespace Exiv2 {
// Find and read ExifIFD sub-IFD of IFD0
rc = pIfd0_->readSubIfd(*pExifIfd_, pData_, size_, byteOrder(), 0x8769);
if (rc) return rc;
// Find MakerNote in ExifIFD, create a MakerNote class
// Find MakerNote in ExifIFD, create a MakerNote class
Ifd::iterator pos = pExifIfd_->findTag(0x927c);
Ifd::iterator make = pIfd0_->findTag(0x010f);
Ifd::iterator model = pIfd0_->findTag(0x0110);
if ( pos != pExifIfd_->end()
if ( pos != pExifIfd_->end()
&& make != pIfd0_->end() && model != pIfd0_->end()) {
// Todo: The conversion to string assumes that there is a \0 at the end
// Todo: How to avoid the cast (is that a MSVC thing?)
@ -498,14 +498,14 @@ namespace Exiv2 {
reinterpret_cast<const char*>(make->data()),
reinterpret_cast<const char*>(model->data()),
false,
pos->data(),
pos->data(),
pos->size(),
byteOrder(),
pExifIfd_->offset() + pos->offset()).release();
}
// Read the MakerNote
if (pMakerNote_) {
rc = pMakerNote_->read(pData_, size_,
rc = pMakerNote_->read(pData_, size_,
pExifIfd_->offset() + pos->offset(),
byteOrder());
if (rc) {
@ -562,11 +562,11 @@ namespace Exiv2 {
add(pIfd0_->begin(), pIfd0_->end(), byteOrder());
add(pExifIfd_->begin(), pExifIfd_->end(), byteOrder());
if (pMakerNote_) {
add(pMakerNote_->begin(), pMakerNote_->end(),
add(pMakerNote_->begin(), pMakerNote_->end(),
(pMakerNote_->byteOrder() == invalidByteOrder ?
byteOrder() : pMakerNote_->byteOrder()));
}
add(pIopIfd_->begin(), pIopIfd_->end(), byteOrder());
add(pIopIfd_->begin(), pIopIfd_->end(), byteOrder());
add(pGpsIfd_->begin(), pGpsIfd_->end(), byteOrder());
add(pIfd1_->begin(), pIfd1_->end(), byteOrder());
// Read the thumbnail (but don't worry whether it was successful or not)
@ -612,8 +612,8 @@ namespace Exiv2 {
if (pMakerNote_) {
// Build MakerNote from metadata
makerNote = pMakerNote_->create();
addToMakerNote(makerNote.get(),
begin(), end(),
addToMakerNote(makerNote.get(),
begin(), end(),
(pMakerNote_->byteOrder() == invalidByteOrder ?
byteOrder() : pMakerNote_->byteOrder()));
// Create a placeholder MakerNote entry of the correct size and
@ -654,21 +654,21 @@ namespace Exiv2 {
bool addOffsetTag = false;
long exifIfdOffset = ifd0Offset + ifd0.size() + ifd0.dataSize();
if (exifIfd.size() > 0 || iopIfd.size() > 0) {
exifIfdOffset += 12;
addOffsetTag = true;
exifIfdOffset += 12;
addOffsetTag = true;
}
if (gpsIfd.size() > 0) {
exifIfdOffset += 12;
addOffsetTag = true;
exifIfdOffset += 12;
addOffsetTag = true;
}
if (ifd0.size() == 0 && addOffsetTag) {
exifIfdOffset += 6;
exifIfdOffset += 6;
}
addOffsetTag = false;
long iopIfdOffset = exifIfdOffset + exifIfd.size() + exifIfd.dataSize();
long iopIfdOffset = exifIfdOffset + exifIfd.size() + exifIfd.dataSize();
if (iopIfd.size() > 0) {
iopIfdOffset += 12;
addOffsetTag = true;
addOffsetTag = true;
}
if (exifIfd.size() == 0 && addOffsetTag) {
iopIfdOffset += 6;
@ -729,7 +729,7 @@ namespace Exiv2 {
return buf;
} // ExifData::copyFromMetadata
void ExifData::add(Entries::const_iterator begin,
void ExifData::add(Entries::const_iterator begin,
Entries::const_iterator end,
ByteOrder byteOrder)
{
@ -749,7 +749,7 @@ namespace Exiv2 {
if (ExifTags::isMakerIfd(exifdatum.ifdId())) {
if (pMakerNote_ == 0) {
pMakerNote_ = MakerNoteFactory::create(exifdatum.ifdId()).release();
}
}
if (pMakerNote_ == 0) throw Error(23, exifdatum.ifdId());
}
// allow duplicates
@ -804,7 +804,7 @@ namespace Exiv2 {
(*this)["Exif.Thumbnail.JPEGInterchangeFormatLength"] = uint32_t(size);
}
void ExifData::setJpegThumbnail(const byte* buf, long size,
void ExifData::setJpegThumbnail(const byte* buf, long size,
URational xres, URational yres, uint16_t unit)
{
setJpegThumbnail(buf, size);
@ -819,7 +819,7 @@ namespace Exiv2 {
setJpegThumbnail(thumb.pData_, thumb.size_);
}
void ExifData::setJpegThumbnail(const std::string& path,
void ExifData::setJpegThumbnail(const std::string& path,
URational xres, URational yres, uint16_t unit)
{
DataBuf thumb = readFile(path); // may throw
@ -830,8 +830,8 @@ namespace Exiv2 {
{
// First, determine if the thumbnail is at the end of the Exif data
bool stp = stdThumbPosition();
// Delete all Exif.Thumbnail.* (IFD1) metadata
ExifMetadata::iterator i = begin();
// Delete all Exif.Thumbnail.* (IFD1) metadata
ExifMetadata::iterator i = begin();
while (i != end()) {
if (i->ifdId() == ifd1Id) {
i = erase(i);
@ -861,7 +861,7 @@ namespace Exiv2 {
bool ExifData::stdThumbPosition() const
{
if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0
if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0
|| pGpsIfd_ == 0 || pIfd1_ == 0) return true;
// Todo: There is still an invalid assumption here: The data of an IFD
@ -875,7 +875,7 @@ namespace Exiv2 {
long maxOffset;
maxOffset = std::max(pIfd0_->offset(), pIfd0_->dataOffset());
maxOffset = std::max(maxOffset, pExifIfd_->offset());
maxOffset = std::max(maxOffset, pExifIfd_->dataOffset()
maxOffset = std::max(maxOffset, pExifIfd_->dataOffset()
+ pExifIfd_->dataSize());
if (pMakerNote_) {
maxOffset = std::max(maxOffset, pMakerNote_->offset()
@ -909,12 +909,12 @@ namespace Exiv2 {
} // ExifData::hasMakerNote
ByteOrder ExifData::byteOrder() const
{
{
if (pTiffHeader_) return pTiffHeader_->byteOrder();
return littleEndian;
}
int ExifData::writeThumbnail(const std::string& path) const
int ExifData::writeThumbnail(const std::string& path) const
{
Thumbnail::AutoPtr thumbnail = getThumbnail();
if (thumbnail.get() == 0) return 8;
@ -947,7 +947,7 @@ namespace Exiv2 {
return thumbnail->format();
}
const char* ExifData::thumbnailExtension() const
const char* ExifData::thumbnailExtension() const
{
Thumbnail::AutoPtr thumbnail = getThumbnail();
if (thumbnail.get() == 0) return "";
@ -984,7 +984,7 @@ namespace Exiv2 {
bool ExifData::updateEntries()
{
if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0
if ( pIfd0_ == 0 || pExifIfd_ == 0 || pIopIfd_ == 0
|| pGpsIfd_ == 0 || pIfd1_ == 0) return false;
if (!this->compatible()) return false;
@ -992,8 +992,8 @@ namespace Exiv2 {
compatible &= updateRange(pIfd0_->begin(), pIfd0_->end(), byteOrder());
compatible &= updateRange(pExifIfd_->begin(), pExifIfd_->end(), byteOrder());
if (pMakerNote_) {
compatible &= updateRange(pMakerNote_->begin(),
pMakerNote_->end(),
compatible &= updateRange(pMakerNote_->begin(),
pMakerNote_->end(),
(pMakerNote_->byteOrder() == invalidByteOrder ?
byteOrder() : pMakerNote_->byteOrder()));
}
@ -1004,7 +1004,7 @@ namespace Exiv2 {
return compatible;
} // ExifData::updateEntries
bool ExifData::updateRange(const Entries::iterator& begin,
bool ExifData::updateRange(const Entries::iterator& begin,
const Entries::iterator& end,
ByteOrder byteOrder)
{
@ -1019,7 +1019,7 @@ namespace Exiv2 {
continue;
}
if (entry->count() == 0 && md->count() == 0) {
// Special case: don't do anything if both the entry and
// Special case: don't do anything if both the entry and
// Exifdatum have no data. This is to preserve the original
// data in the offset field of an IFD entry with count 0,
// if the Exifdatum was not changed.
@ -1037,13 +1037,13 @@ namespace Exiv2 {
// header and that is currently only done in intrusive write
// mode). On the other hand, it is thus now not possible to
// change the offsets of an entry with a data area in
// non-intrusive mode. This can be considered a bug.
// non-intrusive mode. This can be considered a bug.
// Todo: Fix me!
if (md->sizeDataArea() == 0) {
DataBuf buf(md->size());
md->copy(buf.pData_, byteOrder);
entry->setValue(static_cast<uint16_t>(md->typeId()),
md->count(),
entry->setValue(static_cast<uint16_t>(md->typeId()),
md->count(),
buf.pData_, md->size());
}
// Always set the data area
@ -1069,7 +1069,7 @@ namespace Exiv2 {
}
// Make sure that the size of the Exifdatum fits the available size
// of the entry
if ( md->size() > rc.second->size()
if ( md->size() > rc.second->size()
|| md->sizeDataArea() > rc.second->sizeDataArea()) {
compatible = false;
break;
@ -1078,7 +1078,7 @@ namespace Exiv2 {
return compatible;
} // ExifData::compatible
std::pair<bool, Entries::const_iterator>
std::pair<bool, Entries::const_iterator>
ExifData::findEntry(IfdId ifdId, int idx) const
{
Entries::const_iterator entry;
@ -1107,19 +1107,19 @@ namespace Exiv2 {
{
const Ifd* ifd = 0;
switch (ifdId) {
case ifd0Id:
case ifd0Id:
ifd = pIfd0_;
break;
case exifIfdId:
case exifIfdId:
ifd = pExifIfd_;
break;
case iopIfdId:
case iopIfdId:
ifd = pIopIfd_;
break;
case gpsIfdId:
case gpsIfdId:
ifd = pGpsIfd_;
break;
case ifd1Id:
case ifd1Id:
ifd = pIfd1_;
break;
default:
@ -1132,9 +1132,9 @@ namespace Exiv2 {
// *************************************************************************
// free functions
void addToIfd(Ifd& ifd,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
void addToIfd(Ifd& ifd,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
ByteOrder byteOrder)
{
for (ExifMetadata::const_iterator i = begin; i != end; ++i) {
@ -1157,8 +1157,8 @@ namespace Exiv2 {
DataBuf buf(md.size());
md.copy(buf.pData_, byteOrder);
e.setValue(static_cast<uint16_t>(md.typeId()), md.count(),
buf.pData_, buf.size_);
e.setValue(static_cast<uint16_t>(md.typeId()), md.count(),
buf.pData_, buf.size_);
DataBuf dataArea(md.dataArea());
e.setDataArea(dataArea.pData_, dataArea.size_);
@ -1168,7 +1168,7 @@ namespace Exiv2 {
void addToMakerNote(MakerNote* makerNote,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
ExifMetadata::const_iterator end,
ByteOrder byteOrder)
{
for (ExifMetadata::const_iterator i = begin; i != end; ++i) {
@ -1178,8 +1178,8 @@ namespace Exiv2 {
}
} // addToMakerNote
void addToMakerNote(MakerNote* makerNote,
const Exifdatum& md,
void addToMakerNote(MakerNote* makerNote,
const Exifdatum& md,
ByteOrder byteOrder)
{
Entry e;
@ -1191,7 +1191,7 @@ namespace Exiv2 {
DataBuf buf(md.size());
md.copy(buf.pData_, byteOrder);
e.setValue(static_cast<uint16_t>(md.typeId()), md.count(),
buf.pData_, md.size());
buf.pData_, md.size());
DataBuf dataArea(md.dataArea());
e.setDataArea(dataArea.pData_, dataArea.size_);
@ -1212,7 +1212,7 @@ namespace {
void setOffsetTag(Exiv2::Ifd& ifd,
int idx,
uint16_t tag,
uint32_t offset,
uint32_t offset,
Exiv2::ByteOrder byteOrder)
{
Exiv2::Ifd::iterator pos = ifd.findTag(tag);
@ -1243,7 +1243,7 @@ namespace {
if (len != buf.size_) {
throw Exiv2::Error(2, path, Exiv2::strError(), "FileIo::read");
}
return buf;
return buf;
}
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -47,7 +47,7 @@
// namespace extensions
/*!
@brief Provides classes and functions to encode and decode Exif and Iptc data.
This namespace corresponds to the <b>libexiv2</b> library.
This namespace corresponds to the <b>libexiv2</b> library.
*/
namespace Exiv2 {
@ -74,7 +74,7 @@ namespace Exiv2 {
/*!
@brief Constructor for new tags created by an application. The
%Exifdatum is created from a \em key / value pair. %Exifdatum copies
(clones) the \em key and value if one is provided. Alternatively,
(clones) the \em key and value if one is provided. Alternatively,
a program can create an 'empty' %Exifdatum with only a key
and set the value using setValue().
@ -99,7 +99,7 @@ namespace Exiv2 {
@brief Assign \em value to the %Exifdatum. The type of the new Value
is set to UShortValue.
*/
Exifdatum& operator=(const uint16_t& value);
Exifdatum& operator=(const uint16_t& value);
/*!
@brief Assign \em value to the %Exifdatum. The type of the new Value
is set to ULongValue.
@ -127,7 +127,7 @@ namespace Exiv2 {
Exifdatum& operator=(const Rational& value);
/*!
@brief Assign \em value to the %Exifdatum.
Calls setValue(const std::string&).
Calls setValue(const std::string&).
*/
Exifdatum& operator=(const std::string& value);
/*!
@ -152,7 +152,7 @@ namespace Exiv2 {
*/
void setValue(const Entry& e, ByteOrder byteOrder);
/*!
@brief Set the data area by copying (cloning) the buffer pointed to
@brief Set the data area by copying (cloning) the buffer pointed to
by \em buf.
Values may have a data area, which can contain additional
@ -164,14 +164,14 @@ namespace Exiv2 {
@return Return -1 if the %Exifdatum does not have a value yet or the
value has no data area, else 0.
*/
int setDataArea(const byte* buf, long len)
int setDataArea(const byte* buf, long len)
{ return value_.get() == 0 ? -1 : value_->setDataArea(buf, len); }
//@}
//! @name Accessors
//@{
//! Return the key of the %Exifdatum.
std::string key() const
//! Return the key of the %Exifdatum.
std::string key() const
{ return key_.get() == 0 ? "" : key_->key(); }
//! Return the name of the group (the second part of the key)
std::string groupName() const
@ -183,13 +183,13 @@ namespace Exiv2 {
uint16_t tag() const
{ return key_.get() == 0 ? 0xffff : key_->tag(); }
//! Return the IFD id
IfdId ifdId() const
IfdId ifdId() const
{ return key_.get() == 0 ? ifdIdNotSet : key_->ifdId(); }
//! Return the name of the IFD
const char* ifdName() const
{ return key_.get() == 0 ? "" : key_->ifdName(); }
//! Return the related image item (deprecated)
std::string ifdItem() const
std::string ifdItem() const
{ return key_.get() == 0 ? "" : key_->ifdItem(); }
//! Return the index (unique id of this key within the original IFD)
int idx() const
@ -205,25 +205,25 @@ namespace Exiv2 {
@param byteOrder Applicable byte order (little or big endian).
@return Number of characters written.
*/
long copy(byte* buf, ByteOrder byteOrder) const
long copy(byte* buf, ByteOrder byteOrder) const
{ return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); }
//! Return the type id of the value
TypeId typeId() const
TypeId typeId() const
{ return value_.get() == 0 ? invalidTypeId : value_->typeId(); }
//! Return the name of the type
const char* typeName() const
const char* typeName() const
{ return TypeInfo::typeName(typeId()); }
//! Return the size in bytes of one component of this type
long typeSize() const
long typeSize() const
{ return TypeInfo::typeSize(typeId()); }
//! Return the number of components in the value
long count() const
long count() const
{ return value_.get() == 0 ? 0 : value_->count(); }
//! Return the size of the value in bytes
long size() const
long size() const
{ return value_.get() == 0 ? 0 : value_->size(); }
//! Return the value as a string.
std::string toString() const
std::string toString() const
{ return value_.get() == 0 ? "" : value_->toString(); }
/*!
@brief Return the <EM>n</EM>-th component of the value converted to
@ -231,7 +231,7 @@ namespace Exiv2 {
not set and the behaviour of the method is undefined if there
is no n-th component.
*/
long toLong(long n =0) const
long toLong(long n =0) const
{ return value_.get() == 0 ? -1 : value_->toLong(n); }
/*!
@brief Return the <EM>n</EM>-th component of the value converted to
@ -239,7 +239,7 @@ namespace Exiv2 {
not set and the behaviour of the method is undefined if there
is no n-th component.
*/
float toFloat(long n =0) const
float toFloat(long n =0) const
{ return value_.get() == 0 ? -1 : value_->toFloat(n); }
/*!
@brief Return the <EM>n</EM>-th component of the value converted to
@ -247,30 +247,30 @@ namespace Exiv2 {
Exifdatum is not set and the behaviour of the method is
undefined if there is no n-th component.
*/
Rational toRational(long n =0) const
Rational toRational(long n =0) const
{ return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); }
/*!
@brief Return an auto-pointer to a copy (clone) of the value. The
caller owns this copy and the auto-pointer ensures that it will
be deleted.
This method is provided for users who need full control over the
This method is provided for users who need full control over the
value. A caller may, e.g., downcast the pointer to the appropriate
subclass of Value to make use of the interface of the subclass to set
or modify its contents.
@return An auto-pointer to a copy (clone) of the value, 0 if the value
is not set.
*/
Value::AutoPtr getValue() const
Value::AutoPtr getValue() const
{ return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); }
/*!
@brief Return a constant reference to the value.
@brief Return a constant reference to the value.
This method is provided mostly for convenient and versatile output of
the value which can (to some extent) be formatted through standard
stream manipulators. Do not attempt to write to the value through
this reference.
this reference.
<b>Example:</b> <br>
@code
@ -283,9 +283,9 @@ namespace Exiv2 {
@return A constant reference to the value.
@throw Error if the value is not set.
*/
const Value& value() const;
const Value& value() const;
//! Return the size of the data area.
long sizeDataArea() const
long sizeDataArea() const
{ return value_.get() == 0 ? 0 : value_->sizeDataArea(); }
/*!
@brief Return a copy of the data area of the value. The caller owns
@ -306,7 +306,7 @@ namespace Exiv2 {
private:
// DATA
ExifKey::AutoPtr key_; //!< Key
ExifKey::AutoPtr key_; //!< Key
Value::AutoPtr value_; //!< Value
}; // class Exifdatum
@ -320,7 +320,7 @@ namespace Exiv2 {
/*!
@brief Set the value of \em exifDatum to \em value. If the object already
has a value, it is replaced. Otherwise a new ValueType\<T\> value
is created and set to \em value.
is created and set to \em value.
This is a helper function, called from Exifdatum members. It is meant to
be used with T = (u)int16_t, (u)int32_t or (U)Rational. Do not use directly.
@ -350,7 +350,7 @@ namespace Exiv2 {
//@{
/*!
@brief Set the image data as data area of the appropriate Exif
metadatum. Read the thumbnail image data from data buffer
metadatum. Read the thumbnail image data from data buffer
\em buf. Return 0 if successful.
@param exifData Exif data corresponding to the data buffer.
@ -362,7 +362,7 @@ namespace Exiv2 {
1 in case of inconsistent thumbnail Exif data; or<BR>
2 if the data area is outside of the data buffer
*/
virtual int setDataArea(ExifData& exifData,
virtual int setDataArea(ExifData& exifData,
Ifd* pIfd1,
const byte* buf,
long len) const =0;
@ -372,12 +372,12 @@ namespace Exiv2 {
*/
virtual DataBuf copy(const ExifData& exifData) const =0;
/*!
@brief Return a short string for the format of the thumbnail
@brief Return a short string for the format of the thumbnail
("TIFF", "JPEG").
*/
virtual const char* format() const =0;
/*!
@brief Return the file extension for the format of the thumbnail
@brief Return the file extension for the format of the thumbnail
(".tif", ".jpg").
*/
virtual const char* extension() const =0;
@ -409,8 +409,8 @@ namespace Exiv2 {
//! @name Accessors
//@{
int setDataArea(ExifData& exifData,
Ifd* pIfd1,
int setDataArea(ExifData& exifData,
Ifd* pIfd1,
const byte* buf,
long len) const;
DataBuf copy(const ExifData& exifData) const;
@ -434,8 +434,8 @@ namespace Exiv2 {
//! @name Accessors
//@{
int setDataArea(ExifData& exifData,
Ifd* pIfd1,
int setDataArea(ExifData& exifData,
Ifd* pIfd1,
const byte* buf,
long len) const;
DataBuf copy(const ExifData& exifData) const;
@ -464,7 +464,7 @@ namespace Exiv2 {
private:
IfdId ifdId_;
int idx_;
}; // class FindMetadatumByIfdIdIdx
/*!
@ -474,7 +474,7 @@ namespace Exiv2 {
Provide high-level access to the Exif data of an image:
- read Exif information from JPEG files
- access metadata through keys and standard C++ iterators
- add, modify and delete metadata
- add, modify and delete metadata
- write Exif data to JPEG files
- extract Exif metadata to files, insert from these files
- extract and delete Exif thumbnail (JPEG and TIFF thumbnails)
@ -504,7 +504,7 @@ namespace Exiv2 {
@brief Load the Exif data from a byte buffer. The data buffer
must start with the TIFF header.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@return 0 if successful.
*/
int load(const byte* buf, long len);
@ -544,7 +544,7 @@ namespace Exiv2 {
checks are performed, i.e., it is possible to add multiple
metadata with the same key.
*/
void add(Entries::const_iterator begin,
void add(Entries::const_iterator begin,
Entries::const_iterator end,
ByteOrder byteOrder);
/*!
@ -563,9 +563,9 @@ namespace Exiv2 {
*/
void add(const Exifdatum& exifdatum);
/*!
@brief Delete the Exifdatum at iterator position \em pos, return the
@brief Delete the Exifdatum at iterator position \em pos, return the
position of the next exifdatum. Note that iterators into
the metadata, including \em pos, are potentially invalidated
the metadata, including \em pos, are potentially invalidated
by this call.
*/
iterator erase(iterator pos);
@ -590,7 +590,7 @@ namespace Exiv2 {
iterator findKey(const ExifKey& key);
/*!
@brief Find the Exifdatum with the given \em ifdId and \em idx,
return an iterator to it.
return an iterator to it.
This method can be used to uniquely identify an exifdatum that was
created from an IFD or from the makernote (with idx greater than
@ -613,12 +613,12 @@ namespace Exiv2 {
@note No checks on the file format or size are performed.
@note Additional existing Exif thumbnail tags are not modified.
@note The Jpeg image inserted as thumbnail image should not
@note The Jpeg image inserted as thumbnail image should not
itself contain Exif data (or other metadata), as existing
applications may have problems with that. (The preview
applications may have problems with that. (The preview
application that comes with OS X for one.) - David Harvey.
*/
void setJpegThumbnail(const std::string& path,
void setJpegThumbnail(const std::string& path,
URational xres, URational yres, uint16_t unit);
/*!
@brief Set the Exif thumbnail to the Jpeg image pointed to by \em buf,
@ -632,15 +632,15 @@ namespace Exiv2 {
@note No checks on the image format or size are performed.
@note Additional existing Exif thumbnail tags are not modified.
@note The Jpeg image inserted as thumbnail image should not
@note The Jpeg image inserted as thumbnail image should not
itself contain Exif data (or other metadata), as existing
applications may have problems with that. (The preview
applications may have problems with that. (The preview
application that comes with OS X for one.) - David Harvey.
*/
void setJpegThumbnail(const byte* buf, long size,
void setJpegThumbnail(const byte* buf, long size,
URational xres, URational yres, uint16_t unit);
/*!
@brief Set the Exif thumbnail to the Jpeg image \em path.
@brief Set the Exif thumbnail to the Jpeg image \em path.
This sets only the Compression, JPEGInterchangeFormat and
JPEGInterchangeFormatLength tags, which is not all the thumbnail
@ -655,7 +655,7 @@ namespace Exiv2 {
void setJpegThumbnail(const std::string& path);
/*!
@brief Set the Exif thumbnail to the Jpeg image pointed to by \em buf,
and size \em size.
and size \em size.
This sets only the Compression, JPEGInterchangeFormat and
JPEGInterchangeFormatLength tags, which is not all the thumbnail
@ -698,7 +698,7 @@ namespace Exiv2 {
const_iterator findKey(const ExifKey& key) const;
/*!
@brief Find the exifdatum with the given \em ifdId and \em idx,
return an iterator to it.
return an iterator to it.
This method can be used to uniquely identify a Exifdatum that was
created from an IFD or from the makernote (with idx greater than
@ -734,14 +734,14 @@ namespace Exiv2 {
@return 0 if successful;<BR>
8 if the Exif data does not contain a thumbnail.
*/
int writeThumbnail(const std::string& path) const;
int writeThumbnail(const std::string& path) const;
/*!
@brief Return the thumbnail image in a %DataBuf. The caller owns the
data buffer and %DataBuf ensures that it will be deleted.
*/
DataBuf copyThumbnail() const;
/*!
@brief Return a short string describing the format of the Exif
@brief Return a short string describing the format of the Exif
thumbnail ("TIFF", "JPEG").
*/
const char* thumbnailFormat() const;
@ -770,7 +770,7 @@ namespace Exiv2 {
/*!
@brief Check if the metadata changed and update the internal IFDs and
the MakerNote if the changes are compatible with the existing
data (non-intrusive write support).
data (non-intrusive write support).
@return True if only compatible changes were detected in the metadata
and the internal IFDs and MakerNote (and thus the data buffer)
@ -791,7 +791,7 @@ namespace Exiv2 {
/*!
@brief Write the Exif data to a data buffer the hard way, return the
data buffer. The caller owns this data buffer and %DataBuf
ensures that it will be deleted.
ensures that it will be deleted.
Rebuilds the Exif data from scratch, using the TIFF header, metadata
container and thumbnail. In particular, the internal IFDs and the
@ -821,12 +821,12 @@ namespace Exiv2 {
@return A pair of which the first part determines if a match was found
and, if true, the second contains an iterator to the entry.
*/
std::pair<bool, Entries::const_iterator>
std::pair<bool, Entries::const_iterator>
findEntry(IfdId ifdId, int idx) const;
//! Return a pointer to the internal IFD identified by its IFD id
const Ifd* getIfd(IfdId ifdId) const;
/*!
@brief Check if IFD1, the IFD1 data and thumbnail data are located at
/*!
@brief Check if IFD1, the IFD1 data and thumbnail data are located at
the end of the Exif data. Return true, if they are or if there
is no thumbnail at all, else return false.
*/
@ -837,7 +837,7 @@ namespace Exiv2 {
ExifMetadata exifMetadata_;
// The pointers below are used only if Exif data is read from a
// raw data buffer
// raw data buffer
TiffHeader* pTiffHeader_; //! Pointer to the TIFF header
Ifd* pIfd0_; //! Pointer to Ifd0
Ifd* pExifIfd_; //! Pointer to ExifIfd
@ -860,11 +860,11 @@ namespace Exiv2 {
// *****************************************************************************
// template, inline and free functions
template<typename T>
Exifdatum& setValue(Exifdatum& exifDatum, const T& value)
{
std::auto_ptr<ValueType<T> > v
std::auto_ptr<ValueType<T> > v
= std::auto_ptr<ValueType<T> >(new ValueType<T>);
v->value_.push_back(value);
exifDatum.value_ = v;
@ -878,8 +878,8 @@ namespace Exiv2 {
the same key to an IFD.
*/
void addToIfd(Ifd& ifd,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
ByteOrder byteOrder);
/*!
@brief Add the Exifdatum to the IFD. No duplicate checks are performed,
@ -896,7 +896,7 @@ namespace Exiv2 {
*/
void addToMakerNote(MakerNote* makerNote,
ExifMetadata::const_iterator begin,
ExifMetadata::const_iterator end,
ExifMetadata::const_iterator end,
ByteOrder byteOrder);
/*!
@brief Add the Exifdatum to makerNote, encoded in byte order byteOrder.

@ -32,7 +32,7 @@ try {
Exiv2::ExifData &exifData = image->exifData();
/*
Exiv2 uses a CommentValue for Exif user comments. The format of the
Exiv2 uses a CommentValue for Exif user comments. The format of the
comment string includes an optional charset specification at the beginning:
[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment
@ -43,13 +43,13 @@ try {
Following are a few examples of valid comments. The last one is written to
the file.
*/
exifData["Exif.Photo.UserComment"]
exifData["Exif.Photo.UserComment"]
= "charset=\"Unicode\" An Unicode Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
exifData["Exif.Photo.UserComment"]
= "charset=\"Undefined\" An undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
exifData["Exif.Photo.UserComment"]
= "Another undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
exifData["Exif.Photo.UserComment"]
= "charset=Ascii An ASCII Exif comment added with Exiv2";
std::cout << "Writing user comment '"

@ -122,15 +122,15 @@ void print(const std::string& file)
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< std::dec << i->value()
<< "\n";
}
}

@ -31,13 +31,13 @@ try {
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::hex << i->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< std::dec << i->value()
<< "\n";
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -56,12 +56,12 @@ namespace {
//! List of all command identifiers and corresponding strings
static const CmdIdAndString cmdIdAndString[] = {
{ add, "add" },
{ set, "set" },
{ del, "del" },
{ set, "set" },
{ del, "del" },
{ invalidCmdId, "invalidCmd" } // End of list marker
};
// Return a command Id for a command string
// Return a command Id for a command string
CmdId commandId(const std::string& cmdString);
// Evaluate [-]HH[:MM[:SS]], returns true and sets time to the value
@ -72,7 +72,7 @@ namespace {
@brief Parse the oparg string into a bitmap of common targets.
@param optarg Option arguments
@param action Action being processed
@return A bitmap of common targets or -1 in case of a parse error
@return A bitmap of common targets or -1 in case of a parse error
*/
int parseCommonTargets(const std::string& optarg,
const std::string& action);
@ -82,7 +82,7 @@ namespace {
@param modifyCmds Reference to a structure to store the parsed commands
@param cmdFiles Container with the file names
*/
bool parseCmdFiles(ModifyCmds& modifyCmds,
bool parseCmdFiles(ModifyCmds& modifyCmds,
const Params::CmdFiles& cmdFiles);
/*!
@ -90,12 +90,12 @@ namespace {
@param modifyCmds Reference to a structure to store the parsed commands
@param cmdLines Container with the commands
*/
bool parseCmdLines(ModifyCmds& modifyCmds,
bool parseCmdLines(ModifyCmds& modifyCmds,
const Params::CmdLines& cmdLines);
/*!
@brief Parse one line of the command file
@param modifyCmd Reference to a command structure to store the parsed
@param modifyCmd Reference to a command structure to store the parsed
command
@param line Input line
@param num Line number (used for error output)
@ -126,7 +126,7 @@ int main(int argc, char* const argv[])
// Create the required action class
Action::TaskFactory& taskFactory = Action::TaskFactory::instance();
Action::Task::AutoPtr task
Action::Task::AutoPtr task
= taskFactory.create(Action::TaskType(params.action_));
assert(task.get());
@ -137,7 +137,7 @@ int main(int argc, char* const argv[])
Params::Files::const_iterator e = params.files_.end();
for (Params::Files::const_iterator i = params.files_.begin(); i != e; ++i) {
if (params.verbose_) {
std::cout << "File " << std::setw(w) << n++ << "/" << s << ": "
std::cout << "File " << std::setw(w) << n++ << "/" << s << ": "
<< *i << std::endl;
}
task->run(*i);
@ -169,7 +169,7 @@ void Params::cleanup()
void Params::version(std::ostream& os) const
{
os << EXV_PACKAGE_STRING << ", "
os << EXV_PACKAGE_STRING << ", "
<< "Copyright (C) 2004, 2005 Andreas Huggel.\n\n"
<< "This is free software; see the source for copying conditions. "
<< "There is NO \nwarranty; not even for MERCHANTABILITY or FITNESS FOR "
@ -178,7 +178,7 @@ void Params::version(std::ostream& os) const
void Params::usage(std::ostream& os) const
{
os << "Usage: " << progname()
os << "Usage: " << progname()
<< " [ options ] [ action ] file ...\n\n"
<< "Manipulate the Exif metadata of images.\n";
}
@ -225,7 +225,7 @@ void Params::help(std::ostream& os) const
<< " -e tgt Extract target(s) for the `extract' action. Possible targets\n"
<< " are the same as those for the -d option.\n"
<< " -r fmt Filename format for the `rename' action. The format string\n"
<< " follows strftime(3). Default filename format is "
<< " follows strftime(3). Default filename format is "
<< format_ << ".\n"
<< " -m file Command file for the modify action. The format for commands is\n"
<< " set|add|del <key> [[<type>] <value>].\n"
@ -255,18 +255,18 @@ int Params::option(int opt, const std::string& optarg, int optopt)
case 'l': directory_ = optarg; break;
case 'S': suffix_ = optarg; break;
case ':':
std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
<< " requires an argument\n";
rc = 1;
break;
case '?':
std::cerr << progname() << ": Unrecognized option -"
std::cerr << progname() << ": Unrecognized option -"
<< static_cast<char>(optopt) << "\n";
rc = 1;
break;
default:
std::cerr << progname()
<< ": getopt returned unexpected character code "
std::cerr << progname()
<< ": getopt returned unexpected character code "
<< std::hex << opt << "\n";
rc = 1;
break;
@ -280,14 +280,14 @@ int Params::evalRename(const std::string& optarg)
switch (action_) {
case Action::none:
action_ = Action::rename;
format_ = optarg;
format_ = optarg;
break;
case Action::rename:
std::cerr << progname()
std::cerr << progname()
<< ": Ignoring surplus option -r \"" << optarg << "\"\n";
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -r is not compatible with a previous option\n";
rc = 1;
break;
@ -303,17 +303,17 @@ int Params::evalAdjust(const std::string& optarg)
action_ = Action::adjust;
adjust_ = parseTime(optarg, adjustment_);
if (!adjust_) {
std::cerr << progname() << ": Error parsing -a option argument `"
std::cerr << progname() << ": Error parsing -a option argument `"
<< optarg << "'\n";
rc = 1;
}
break;
case Action::adjust:
std::cerr << progname()
std::cerr << progname()
<< ": Ignoring surplus option -a " << optarg << "\n";
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -a is not compatible with a previous option\n";
rc = 1;
break;
@ -342,11 +342,11 @@ int Params::evalPrint(const std::string& optarg)
}
break;
case Action::print:
std::cerr << progname()
std::cerr << progname()
<< ": Ignoring surplus option -p" << optarg << "\n";
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -p is not compatible with a previous option\n";
rc = 1;
break;
@ -368,12 +368,12 @@ int Params::evalDelete(const std::string& optarg)
target_ |= rc;
rc = 0;
}
else {
else {
rc = 1;
}
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -d is not compatible with a previous option\n";
rc = 1;
break;
@ -395,12 +395,12 @@ int Params::evalExtract(const std::string& optarg)
target_ |= rc;
rc = 0;
}
else {
else {
rc = 1;
}
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -e is not compatible with a previous option\n";
rc = 1;
break;
@ -422,12 +422,12 @@ int Params::evalInsert(const std::string& optarg)
target_ |= rc;
rc = 0;
}
else {
else {
rc = 1;
}
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -i is not compatible with a previous option\n";
rc = 1;
break;
@ -447,7 +447,7 @@ int Params::evalModify(int opt, const std::string& optarg)
if (opt == 'M') cmdLines_.push_back(optarg); // parse the commands later
break;
default:
std::cerr << progname()
std::cerr << progname()
<< ": Option -" << (char)opt
<< " is not compatible with a previous option\n";
rc = 1;
@ -538,7 +538,7 @@ int Params::nonoption(const std::string& argv)
} // Params::nonoption
int Params::getopt(int argc, char* const argv[])
{
{
int rc = Util::Getopt::getopt(argc, argv, optstring_);
// Further consistency checks
if (help_ || version_) return 0;
@ -548,12 +548,12 @@ int Params::getopt(int argc, char* const argv[])
rc = 1;
}
if (action_ == Action::adjust && !adjust_) {
std::cerr << progname()
std::cerr << progname()
<< ": Adjust action requires option -a time\n";
rc = 1;
}
if (action_ == Action::modify && cmdFiles_.empty() && cmdLines_.empty()) {
std::cerr << progname()
std::cerr << progname()
<< ": Modify action requires at least one -m or -M option\n";
rc = 1;
}
@ -564,7 +564,7 @@ int Params::getopt(int argc, char* const argv[])
if (rc == 0 && action_ == Action::modify) {
// Parse command files
if (!parseCmdFiles(modifyCmds_, cmdFiles_)) {
std::cerr << progname() << ": Error parsing -m option arguments\n";
std::cerr << progname() << ": Error parsing -m option arguments\n";
rc = 1;
}
}
@ -575,14 +575,14 @@ int Params::getopt(int argc, char* const argv[])
rc = 1;
}
}
if ( !directory_.empty()
if ( !directory_.empty()
&& !(action_ == Action::insert || action_ == Action::extract)) {
std::cerr << progname()
std::cerr << progname()
<< ": -l option can only be used with extract or insert actions\n";
rc = 1;
rc = 1;
}
if (!suffix_.empty() && !(action_ == Action::insert)) {
std::cerr << progname()
std::cerr << progname()
<< ": -S option can only be used with insert action\n";
rc = 1;
}
@ -633,7 +633,7 @@ namespace {
return true;
} // parseTime
int parseCommonTargets(const std::string& optarg,
int parseCommonTargets(const std::string& optarg,
const std::string& action)
{
int rc = 0;
@ -644,11 +644,11 @@ namespace {
case 'i': target |= Params::ctIptc; break;
case 'c': target |= Params::ctComment; break;
case 't': target |= Params::ctThumb; break;
case 'a': target |= Params::ctExif
case 'a': target |= Params::ctExif
| Params::ctIptc
| Params::ctComment; break;
default:
std::cerr << Params::instance().progname() << ": Unrecognized "
std::cerr << Params::instance().progname() << ": Unrecognized "
<< action << " target `" << optarg[i] << "'\n";
rc = -1;
break;
@ -657,7 +657,7 @@ namespace {
return rc ? rc : target;
} // parseCommonTargets
bool parseCmdFiles(ModifyCmds& modifyCmds,
bool parseCmdFiles(ModifyCmds& modifyCmds,
const Params::CmdFiles& cmdFiles)
{
Params::CmdFiles::const_iterator end = cmdFiles.end();
@ -666,7 +666,7 @@ namespace {
try {
std::ifstream file(filename->c_str());
if (!file) {
std::cerr << *filename
std::cerr << *filename
<< ": Failed to open command file for reading\n";
return false;
}
@ -687,7 +687,7 @@ namespace {
return true;
} // parseCmdFile
bool parseCmdLines(ModifyCmds& modifyCmds,
bool parseCmdLines(ModifyCmds& modifyCmds,
const Params::CmdLines& cmdLines)
{
try {
@ -716,21 +716,21 @@ namespace {
std::string::size_type cmdStart = line.find_first_not_of(delim);
if (cmdStart == std::string::npos || line[cmdStart] == '#') return false;
// Get command and key
// Get command and key
std::string::size_type cmdEnd = line.find_first_of(delim, cmdStart+1);
std::string::size_type keyStart = line.find_first_not_of(delim, cmdEnd+1);
std::string::size_type keyEnd = line.find_first_of(delim, keyStart+1);
if ( cmdStart == std::string::npos
|| cmdEnd == std::string::npos
|| keyStart == std::string::npos) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Invalid command line");
}
std::string cmd(line.substr(cmdStart, cmdEnd-cmdStart));
CmdId cmdId = commandId(cmd);
if (cmdId == invalidCmdId) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Invalid command `" + cmd + "'");
}
@ -740,7 +740,7 @@ namespace {
try {
Exiv2::IptcKey iptcKey(key);
metadataId = iptc;
defaultType = Exiv2::IptcDataSets::dataSetType(iptcKey.tag(),
defaultType = Exiv2::IptcDataSets::dataSetType(iptcKey.tag(),
iptcKey.record());
}
catch (const Exiv2::AnyError&) {}
@ -754,7 +754,7 @@ namespace {
catch (const Exiv2::AnyError&) {}
}
if (metadataId == invalidMetadataId) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Invalid key `" + key + "'");
}
@ -763,17 +763,17 @@ namespace {
bool explicitType = false;
if (cmdId != del) {
// Get type and value
std::string::size_type typeStart
std::string::size_type typeStart
= line.find_first_not_of(delim, keyEnd+1);
std::string::size_type typeEnd
std::string::size_type typeEnd
= line.find_first_of(delim, typeStart+1);
std::string::size_type valStart = typeStart;
std::string::size_type valEnd = line.find_last_not_of(delim);
if ( keyEnd == std::string::npos
if ( keyEnd == std::string::npos
|| typeStart == std::string::npos
|| valStart == std::string::npos) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Invalid command line ");
}
@ -783,7 +783,7 @@ namespace {
if (tmpType != Exiv2::invalidTypeId) {
valStart = line.find_first_not_of(delim, typeEnd+1);
if (valStart == std::string::npos) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Invalid command line ");
}
type = tmpType;
@ -793,9 +793,9 @@ namespace {
value = line.substr(valStart, valEnd+1-valStart);
std::string::size_type last = value.length()-1;
if ( (value[0] == '"' || value[last] == '"')
if ( (value[0] == '"' || value[last] == '"')
&& value[0] != value[last]) {
throw Exiv2::Error(1, Exiv2::toString(num)
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": Unbalanced quotes");
}
if (value[0] == '"') {

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -46,19 +46,19 @@
enum CmdId { invalidCmdId, add, set, del };
//! Metadata identifiers
enum MetadataId { invalidMetadataId, iptc, exif };
//! Structure for one parsed modification command
//! Structure for one parsed modification command
struct ModifyCmd {
//! C'tor
ModifyCmd() :
cmdId_(invalidCmdId), metadataId_(invalidMetadataId),
cmdId_(invalidCmdId), metadataId_(invalidMetadataId),
typeId_(Exiv2::invalidTypeId), explicitType_(false) {}
CmdId cmdId_; //!< Command identifier
std::string key_; //!< Exiv2 key string
MetadataId metadataId_; //!< Metadata identifier
MetadataId metadataId_; //!< Metadata identifier
Exiv2::TypeId typeId_; //!< Exiv2 type identifier
//! Flag to indicate if the type was explicitely specified (true)
bool explicitType_;
std::string value_; //!< Data
std::string value_; //!< Data
};
//! Container for modification commands
typedef std::vector<ModifyCmd> ModifyCmds;
@ -69,7 +69,7 @@ struct CmdIdAndString {
};
/*!
@brief Implements the command line handling for the program.
@brief Implements the command line handling for the program.
Derives from Util::Getopt to use the command line argument parsing
functionalty provided there. This class is implemented as a Singleton,
@ -123,7 +123,7 @@ public:
void cleanup();
//! Enumerates print modes
enum PrintMode { pmSummary, pmInterpreted, pmValues, pmHexdump, pmIptc,
enum PrintMode { pmSummary, pmInterpreted, pmValues, pmHexdump, pmIptc,
pmComment };
//! Enumerates common targets, bitmap
enum CommonTarget { ctExif = 1, ctIptc = 2, ctComment = 4, ctThumb = 8 };
@ -133,10 +133,10 @@ public:
bool help_; //!< Help option flag.
bool version_; //!< Version option flag.
bool verbose_; //!< Verbose (talkative) option flag.
bool force_; //!< Force overwrites flag.
bool force_; //!< Force overwrites flag.
FileExistsPolicy fileExistsPolicy_; //!< What to do if file to rename exists.
bool adjust_; //!< Adjustment flag.
PrintMode printMode_; //!< Print mode.
PrintMode printMode_; //!< Print mode.
//! %Action (integer rather than TaskType to avoid dependency).
int action_;
int target_; //!< What common target to process.
@ -156,10 +156,10 @@ private:
The c'tor is private to force instantiation through instance().
*/
Params() : optstring_(":hVvfFa:r:p:d:e:i:m:M:l:S:"),
help_(false),
help_(false),
version_(false),
verbose_(false),
force_(false),
verbose_(false),
force_(false),
fileExistsPolicy_(askPolicy),
adjust_(false),
printMode_(pmSummary),

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -25,7 +25,7 @@
History: 18-Feb-04, ahu: created
07-Mar-04, ahu: isolated as a separate component
Credits: Fujifilm MakerNote implemented according to the specification
in "Appendix 4: Makernote of Fujifilm" of the document
in "Appendix 4: Makernote of Fujifilm" of the document
"Exif file format" by TsuruZoh Tachibanaya
<http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html>
*/
@ -104,14 +104,14 @@ namespace Exiv2 {
}
int FujiMakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 12) return 1;
header_.alloc(12);
memcpy(header_.pData_, buf, header_.size_);
// Read offset to the IFD relative to the start of the makernote
// Read offset to the IFD relative to the start of the makernote
// from the header. Note that we ignore the byteOrder paramter
start_ = getUShort(header_.pData_ + 8, byteOrder_);
return 0;
@ -122,7 +122,7 @@ namespace Exiv2 {
int rc = 0;
// Check the FUJIFILM prefix
if ( header_.size_ < 12
|| std::string(reinterpret_cast<char*>(header_.pData_), 8)
|| std::string(reinterpret_cast<char*>(header_.pData_), 8)
!= std::string("FUJIFILM", 8)) {
rc = 2;
}
@ -134,7 +134,7 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
FujiMakerNote* FujiMakerNote::create_(bool alloc) const
FujiMakerNote* FujiMakerNote::create_(bool alloc) const
{
AutoPtr makerNote = AutoPtr(new FujiMakerNote(alloc));
assert(makerNote.get() != 0);
@ -147,7 +147,7 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
FujiMakerNote* FujiMakerNote::clone_() const
FujiMakerNote* FujiMakerNote::clone_() const
{
return new FujiMakerNote(*this);
}
@ -163,7 +163,7 @@ namespace Exiv2 {
return os;
}
std::ostream& FujiMakerNote::print0x1001(std::ostream& os,
std::ostream& FujiMakerNote::print0x1001(std::ostream& os,
const Value& value)
{
switch (value.toLong()) {
@ -173,7 +173,7 @@ namespace Exiv2 {
case 4: // fallthrough
case 5: os << "Hard"; break;
default: os << "(" << value << ")"; break;
}
}
return os;
}
@ -206,7 +206,7 @@ namespace Exiv2 {
return os;
}
std::ostream& FujiMakerNote::print0x1004(std::ostream& os,
std::ostream& FujiMakerNote::print0x1004(std::ostream& os,
const Value& value)
{
switch (value.toLong()) {
@ -218,7 +218,7 @@ namespace Exiv2 {
return os;
}
std::ostream& FujiMakerNote::print0x1010(std::ostream& os,
std::ostream& FujiMakerNote::print0x1010(std::ostream& os,
const Value& value)
{
switch (value.toLong()) {
@ -264,9 +264,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createFujiMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new FujiMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -21,7 +21,7 @@
/*!
@file fujimn.hpp
@brief Fujifilm MakerNote implemented according to the specification
in Appendix 4: Makernote of Fujifilm of the document
in Appendix 4: Makernote of Fujifilm of the document
<a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html">
Exif file format</a> by TsuruZoh Tachibanaya
@version $Rev$
@ -59,27 +59,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createFujiMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -105,8 +105,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -118,7 +118,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Fujifilm %MakerNote tags
//! @name Print functions for Fujifilm %MakerNote tags
//@{
//! Print Off or On status
static std::ostream& printOffOn(std::ostream& os, const Value& value);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -70,14 +70,14 @@ namespace Exiv2 {
std::string strError()
{
int error = errno;
std::ostringstream os;
std::ostringstream os;
#ifdef EXV_HAVE_STRERROR_R
const size_t n = 1024;
char buf[n];
strerror_r(error, buf, n);
os << buf;
#else
os << std::strerror(error);
os << std::strerror(error);
#endif
os << " (" << error << ")";
return os.str();

@ -1,19 +1,19 @@
// ********************************************************* -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -44,19 +44,19 @@ namespace Exiv2 {
/*!
@brief Test if a file exists.
@param path Name of file to verify.
@param ct Flag to check if <i>path</i> is a regular file.
@return true if <i>path</i> exists and, if <i>ct</i> is set,
is a regular file, else false.
@note The function calls <b>stat()</b> test for <i>path</i>
and its type, see stat(2). <b>errno</b> is left unchanged
and its type, see stat(2). <b>errno</b> is left unchanged
in case of an error.
*/
bool fileExists(const std::string& path, bool ct =false);
/*!
@brief Return a system error message and the error code (errno).
@brief Return a system error message and the error code (errno).
See %strerror(3).
*/
std::string strError();

@ -22,10 +22,10 @@ try {
std::cout << "Read standard Ifd from data buffer\n";
const long len = 77;
Exiv2::byte buf[]
Exiv2::byte buf[]
= { 0xff, // Filler
// No
0x00,0x04,
0x00,0x04,
// Tag Type Components Offset/Data
0x00,0x01, 0x00,0x02, 0x00,0x00,0x00,0x04, 'T', 'h', 'e', '\0',
0x00,0x02, 0x00,0x02, 0x00,0x00,0x00,0x06, 0x00,0x00,0x00,0x37,
@ -53,31 +53,31 @@ try {
return 1;
}
Exiv2::byte data[] = { 'T', 'H', 'R', 'E', 'E', '\0' };
std::cout << "Setting value of entry 3...\n";
pos->setValue(2, 6, data, 6);
Exiv2::DataBuf db(1024);
rc = ifd.copy(db.pData_ + 1, Exiv2::bigEndian);
std::cout << "Wrote " << rc << " characters to data buffer\n";
std::cout << "Wrote " << rc << " characters to data buffer\n";
rc = ifd.read(db.pData_, len, 1, Exiv2::bigEndian);
if (rc) {
std::cout << "Ifd::read (1a) failed, rc = " << rc << "\n";
return rc;
}
}
ifd.print(std::cout);
// -------------------------------------------------------------------------
std::cout << "\nRead non-standard Ifd from data buffer\n";
const long len2 = 76;
Exiv2::byte buf2[]
Exiv2::byte buf2[]
= { // Data
'K', 'u', 'a', 'l', 'a', '\0',
'L', 'u', 'm', 'p', 'u', 'r', '\0',
'M', 'a', 'l', 'a', 'y', 's', 'i', 'a', '\0',
// No
0x00,0x04,
0x00,0x04,
// Tag Type Components Offset/Data
0x00,0x01, 0x00,0x02, 0x00,0x00,0x00,0x04, 'T', 'h', 'e', '\0',
0x00,0x02, 0x00,0x02, 0x00,0x00,0x00,0x06, 0x00,0x00,0x00,0x00,
@ -101,7 +101,7 @@ try {
return 1;
}
Exiv2::byte data2[] = { 'T', 'H', 'R', 'E', 'E', '\0' };
std::cout << "Setting value of entry 3...\n";
pos->setValue(2, 6, data2, 6);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -50,7 +50,7 @@ EXIV2_RCSID("@(#) $Id$");
namespace Exiv2 {
Entry::Entry(bool alloc)
: alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0),
: alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0),
tag_(0), type_(0), count_(0), offset_(0), size_(0), pData_(0),
sizeDataArea_(0), pDataArea_(0)
{
@ -66,7 +66,7 @@ namespace Exiv2 {
Entry::Entry(const Entry& rhs)
: alloc_(rhs.alloc_), ifdId_(rhs.ifdId_), idx_(rhs.idx_),
tag_(rhs.tag_), type_(rhs.type_),
tag_(rhs.tag_), type_(rhs.type_),
count_(rhs.count_), offset_(rhs.offset_), size_(rhs.size_), pData_(0),
sizeDataArea_(rhs.sizeDataArea_), pDataArea_(0)
{
@ -201,7 +201,7 @@ namespace Exiv2 {
break;
}
case unsignedLong: {
ul2Data(buf, getULong(buf, byteOrder) + offset, byteOrder);
ul2Data(buf, getULong(buf, byteOrder) + offset, byteOrder);
break;
}
case unsignedRational: {
@ -253,7 +253,7 @@ namespace Exiv2 {
} // Entry::component
Ifd::Ifd(IfdId ifdId)
: alloc_(true), ifdId_(ifdId), pBase_(0), offset_(0),
: alloc_(true), ifdId_(ifdId), pBase_(0), offset_(0),
dataOffset_(0), hasNext_(true), pNext_(0), next_(0)
{
pNext_ = new byte[4];
@ -261,7 +261,7 @@ namespace Exiv2 {
}
Ifd::Ifd(IfdId ifdId, long offset)
: alloc_(true), ifdId_(ifdId), pBase_(0), offset_(offset),
: alloc_(true), ifdId_(ifdId), pBase_(0), offset_(offset),
dataOffset_(0), hasNext_(true), pNext_(0), next_(0)
{
pNext_ = new byte[4];
@ -269,7 +269,7 @@ namespace Exiv2 {
}
Ifd::Ifd(IfdId ifdId, long offset, bool alloc, bool hasNext)
: alloc_(alloc), ifdId_(ifdId), pBase_(0), offset_(offset),
: alloc_(alloc), ifdId_(ifdId), pBase_(0), offset_(offset),
dataOffset_(0), hasNext_(hasNext), pNext_(0), next_(0)
{
if (alloc_ && hasNext_) {
@ -286,19 +286,19 @@ namespace Exiv2 {
Ifd::Ifd(const Ifd& rhs)
: alloc_(rhs.alloc_), entries_(rhs.entries_), ifdId_(rhs.ifdId_),
pBase_(rhs.pBase_), offset_(rhs.offset_), dataOffset_(rhs.dataOffset_),
pBase_(rhs.pBase_), offset_(rhs.offset_), dataOffset_(rhs.dataOffset_),
hasNext_(rhs.hasNext_), pNext_(rhs.pNext_), next_(rhs.next_)
{
if (alloc_ && hasNext_) {
pNext_ = new byte[4];
memset(pNext_, 0x0, 4);
if (rhs.pNext_) memcpy(pNext_, rhs.pNext_, 4);
if (rhs.pNext_) memcpy(pNext_, rhs.pNext_, 4);
}
}
int Ifd::read(const byte* buf,
long len,
long start,
int Ifd::read(const byte* buf,
long len,
long start,
ByteOrder byteOrder,
long shift)
{
@ -315,7 +315,7 @@ namespace Exiv2 {
for (int i = 0; i < n; ++i) {
if (len < o + 12) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Error: " << ExifTags::ifdName(ifdId_)
std::cerr << "Error: " << ExifTags::ifdName(ifdId_)
<< " entry " << i
<< " lies outside of the IFD memory buffer.\n";
#endif
@ -336,7 +336,7 @@ namespace Exiv2 {
if (rc == 0 && hasNext_) {
if (len < o + 4) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Error: " << ExifTags::ifdName(ifdId_)
std::cerr << "Error: " << ExifTags::ifdName(ifdId_)
<< " memory of the pointer to the next IFD"
<< " lies outside of the IFD memory buffer.\n";
#endif
@ -363,25 +363,25 @@ namespace Exiv2 {
// Set the offset of the first data entry outside of the IFD
if (i->offset_ + shift < 0) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Error: Offset of the 1st data entry of "
<< ExifTags::ifdName(ifdId_)
std::cerr << "Error: Offset of the 1st data entry of "
<< ExifTags::ifdName(ifdId_)
<< " is out of bounds:\n"
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< i->offset_ - offset_ // relative to start of IFD
<< ", is before start of buffer by "
<< std::dec << -1 * (i->offset_ + shift)
<< " Bytes\n";
#endif
rc = 6;
}
}
else if (i->offset_ + shift + i->size_ > len) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Error: Upper boundary of the 1st data entry of "
<< ExifTags::ifdName(ifdId_)
std::cerr << "Error: Upper boundary of the 1st data entry of "
<< ExifTags::ifdName(ifdId_)
<< " is out of bounds:\n"
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< i->offset_ - offset_ // relative to start of IFD
<< ", exceeds buffer size by "
<< std::dec << i->offset_ + shift + i->size_ - len
@ -411,14 +411,14 @@ namespace Exiv2 {
i->size_ > 4 ? i->offset_ : i->offsetLoc_;
if (tmpOffset + shift + i->size_ > len) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Warning: Upper boundary of data for "
<< ExifTags::ifdName(ifdId_)
<< " entry " << static_cast<int>(i - begin)
std::cerr << "Warning: Upper boundary of data for "
<< ExifTags::ifdName(ifdId_)
<< " entry " << static_cast<int>(i - begin)
<< " is out of bounds:\n"
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< " Offset = 0x" << std::setw(8)
<< std::setfill('0') << std::hex
<< tmpOffset - offset_ // relative to start of IFD
<< ", size = " << std::dec << i->size_
<< ", size = " << std::dec << i->size_
<< ", exceeds buffer size by "
<< tmpOffset + shift + i->size_ - len
<< " Bytes; Truncating the data.\n";
@ -431,7 +431,7 @@ namespace Exiv2 {
// Set the offset to the data, relative to start of IFD
e.setOffset(tmpOffset - offset_);
// Set the size to at least for bytes to accomodate offset-data
e.setValue(i->type_, i->count_, buf + start + e.offset(),
e.setValue(i->type_, i->count_, buf + start + e.offset(),
std::max(long(4), i->size_));
this->add(e);
}
@ -442,7 +442,7 @@ namespace Exiv2 {
return rc;
} // Ifd::read
Ifd::const_iterator Ifd::findIdx(int idx) const
Ifd::const_iterator Ifd::findIdx(int idx) const
{
return std::find_if(entries_.begin(), entries_.end(),
FindEntryByIdx(idx));
@ -454,7 +454,7 @@ namespace Exiv2 {
FindEntryByIdx(idx));
}
Ifd::const_iterator Ifd::findTag(uint16_t tag) const
Ifd::const_iterator Ifd::findTag(uint16_t tag) const
{
return std::find_if(entries_.begin(), entries_.end(),
FindEntryByTag(tag));
@ -514,7 +514,7 @@ namespace Exiv2 {
us2Data(buf + o, i->tag(), byteOrder);
us2Data(buf + o + 2, i->type(), byteOrder);
ul2Data(buf + o + 4, i->count(), byteOrder);
if (i->sizeDataArea() > 0) {
if (i->sizeDataArea() > 0) {
long dataAreaOffset = offset_+size()+totalDataSize+dataAreaSize;
i->setDataAreaOffsets(dataAreaOffset, byteOrder);
dataAreaSize += i->sizeDataArea();
@ -633,7 +633,7 @@ namespace Exiv2 {
long Ifd::size() const
{
if (entries_.size() == 0 && next_ == 0) return 0;
return static_cast<long>(2 + 12 * entries_.size() + (hasNext_ ? 4 : 0));
return static_cast<long>(2 + 12 * entries_.size() + (hasNext_ ? 4 : 0));
}
long Ifd::dataSize() const
@ -652,9 +652,9 @@ namespace Exiv2 {
if (entries_.size() == 0) return;
// Print a header
os << prefix << "IFD Offset: 0x"
<< std::setw(8) << std::setfill('0') << std::hex << std::right
<< offset_
<< ", IFD Entries: "
<< std::setw(8) << std::setfill('0') << std::hex << std::right
<< offset_
<< ", IFD Entries: "
<< std::setfill(' ') << std::dec << std::right
<< static_cast<unsigned int>(entries_.size()) << "\n"
<< prefix << "Entry Tag Format (Bytes each) Number Offset\n"
@ -678,10 +678,10 @@ namespace Exiv2 {
}
os << prefix << std::setw(5) << std::setfill(' ') << std::dec
<< std::right << static_cast<int>(i - b)
<< " 0x" << std::setw(4) << std::setfill('0') << std::hex
<< " 0x" << std::setw(4) << std::setfill('0') << std::hex
<< std::right << i->tag()
<< " " << std::setw(17) << std::setfill(' ')
<< std::left << i->typeName()
<< " " << std::setw(17) << std::setfill(' ')
<< std::left << i->typeName()
<< " (" << std::dec << i->typeSize() << ")"
<< " " << std::setw(6) << std::setfill(' ') << std::dec
<< std::right << i->count()
@ -689,11 +689,11 @@ namespace Exiv2 {
<< "\n";
}
if (hasNext_) {
os << prefix << "Next IFD: 0x"
os << prefix << "Next IFD: 0x"
<< std::setw(8) << std::setfill('0') << std::hex
<< std::right << next() << "\n";
}
// Print data of IFD entries
// Print data of IFD entries
for (i = b; i != e; ++i) {
if (i->size() > 4) {
os << "Data of entry " << static_cast<int>(i - b) << ":\n";

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -60,11 +60,11 @@ namespace Exiv2 {
//! @name Creators
//@{
/*!
@brief Default constructor. The entry allocates memory for its
@brief Default constructor. The entry allocates memory for its
data if alloc is true (the default), otherwise it remembers
just the pointers into a read and writeable data buffer which
it doesn't allocate or delete.
*/
*/
explicit Entry(bool alloc =true);
//! Destructor
~Entry();
@ -87,13 +87,13 @@ namespace Exiv2 {
/*!
@brief Set the value of the entry to a single unsigned long component,
i.e., set the type of the entry to unsigned long, number of
components to one and the value according to the data provided.
components to one and the value according to the data provided.
The size of the data buffer is set to at least four bytes, but is left
unchanged if it can accomodate the pointer. This method can be used
to set the value of a tag which contains a pointer (offset) to a
location in the Exif data (like e.g., ExifTag, 0x8769 in IFD0, which
contains a pointer to the Exif IFD).
contains a pointer to the Exif IFD).
<BR>This method cannot be used to set the value of a newly created
%Entry in non-alloc mode.
@ -110,9 +110,9 @@ namespace Exiv2 {
copied, i.e., the buffer must remain valid throughout the life of the
%Entry. Subsequent calls in non-alloc mode will overwrite the data
pointed to by this pointer with the data provided, i.e., the buffer
provided in subsequent calls can be deleted after the call.
provided in subsequent calls can be deleted after the call.
<BR>In either memory allocation mode, the data buffer provided must be
large enough to hold count components of type. The size of the buffer
large enough to hold count components of type. The size of the buffer
will be as indicated in the size argument. I.e., it is possible to
allocate (set) a data buffer larger than required to hold count
components of the given type.
@ -121,14 +121,14 @@ namespace Exiv2 {
@param count Number of components in the buffer.
@param data Pointer to the data buffer.
@param size Size of the desired data buffer in bytes.
@throw Error if no memory allocation is allowed
and the size of the data buffer is larger than the existing
@throw Error if no memory allocation is allowed
and the size of the data buffer is larger than the existing
data buffer of the entry or if size is not large enough to hold
count components of the given type.
*/
void setValue(uint16_t type, uint32_t count, const byte* data, long size);
/*!
@brief Set the data area. Memory management as for
@brief Set the data area. Memory management as for
setValue(uint16_t, uint32_t, const byte*, long)
For certain tags the regular value of an IFD entry is an offset to a
@ -136,36 +136,36 @@ namespace Exiv2 {
(Exif.Image.ExifTag) or tag 0x0201 in IFD1
(Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points
to a data area containing the Exif IFD. That of JPEGInterchangeFormat
contains the JPEG thumbnail image.
contains the JPEG thumbnail image.
This method sets the data area of a tag in accordance with the memory
allocation mode.
@param buf Pointer to the data area.
@param len Size of the data area.
@throw Error in non-alloc mode, if there already is a dataarea but the
size of the existing dataarea is not large enough for the
@throw Error in non-alloc mode, if there already is a dataarea but the
size of the existing dataarea is not large enough for the
new buffer.
*/
void setDataArea(const byte* buf, long len);
/*!
@brief Set the offset(s) to the data area of an entry.
@brief Set the offset(s) to the data area of an entry.
Add @em offset to each data component of the entry. This is used by
Ifd::copy to convert the data components of an entry containing
offsets relative to the data area to become offsets from the start of
the TIFF header. Usually, entries with a data area have exactly one
the TIFF header. Usually, entries with a data area have exactly one
unsigned long data component, which is 0.
@param offset Offset
@param offset Offset
@param byteOrder Byte order
@throw Error if the offset is out of range for the data type of the
@throw Error if the offset is out of range for the data type of the
tag or the data type is not supported.
*/
void setDataAreaOffsets(uint32_t offset, ByteOrder byteOrder);
/*!
@brief Update the base pointer of the Entry from \em pOldBase
@brief Update the base pointer of the Entry from \em pOldBase
to \em pNewBase.
Allows to re-locate the underlying data buffer to a new location
@ -184,7 +184,7 @@ namespace Exiv2 {
//! Return the type id.
uint16_t type() const { return type_; }
//! Return the name of the type
const char* typeName() const
const char* typeName() const
{ return TypeInfo::typeName(TypeId(type_)); }
//! Return the size in bytes of one element of this type
long typeSize() const
@ -209,7 +209,7 @@ namespace Exiv2 {
*/
const byte* data() const { return pData_; }
/*!
@brief Return a pointer to the n-th component, 0 if there is no
@brief Return a pointer to the n-th component, 0 if there is no
n-th component. Do not attempt to write to this pointer.
*/
const byte* component(uint32_t n) const;
@ -227,7 +227,7 @@ namespace Exiv2 {
(Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points
to a data area containing the Exif IFD. That of JPEGInterchangeFormat
contains the JPEG thumbnail image.
Use this method to access (read-only) the data area of a tag. Use
Use this method to access (read-only) the data area of a tag. Use
setDataArea() to write to the data area.
@return Return a pointer to the data area.
@ -255,7 +255,7 @@ namespace Exiv2 {
//! Offset from the start of the IFD to the data
long offset_;
/*!
Size of the data buffer holding the value in bytes, there is
Size of the data buffer holding the value in bytes, there is
no minimum size.
*/
long size_;
@ -302,13 +302,13 @@ namespace Exiv2 {
private:
uint16_t tag_;
}; // class FindEntryByTag
/*!
@brief Models an IFD (%Image File Directory)
This class models an IFD as described in the TIFF 6.0 specification.
This class models an IFD as described in the TIFF 6.0 specification.
An instance of class %Ifd can operate in two modes, one that allocates and
deallocates the memory required to store data, and one that doesn't
@ -322,8 +322,8 @@ namespace Exiv2 {
that tag data, which the Exif reader may not understand (e.g., the
Makernote) remains valid. A "non-intrusive write operation" is the
modification of tag data without increasing the data size.
@note Use the mode with memory management (the default) if you are unsure
@note Use the mode with memory management (the default) if you are unsure
or if these memory management considerations are of no concern to you.
@note The two different modes imply completely different copy and
@ -375,8 +375,8 @@ namespace Exiv2 {
/*!
@brief Read a complete IFD and its data from a data buffer
@param buf Pointer to the Exif data buffer that contains the IFD to
decode. Usually, the buffer will contain all Exif data
@param buf Pointer to the Exif data buffer that contains the IFD to
decode. Usually, the buffer will contain all Exif data
starting from the TIFF header.
@param len Number of bytes in the Exif data buffer.
@param start IFD starts at buf + start.
@ -384,13 +384,13 @@ namespace Exiv2 {
@param shift IFD offsets are relative to buf + shift.
@return 0 if successful;<BR>
6 if the data buffer is too small, e.g., if an offset points
beyond the provided buffer. The IFD is cleared in this
6 if the data buffer is too small, e.g., if an offset points
beyond the provided buffer. The IFD is cleared in this
case.
*/
int read(const byte* buf,
long len,
long start,
int read(const byte* buf,
long len,
long start,
ByteOrder byteOrder,
long shift =0);
/*!
@ -440,7 +440,7 @@ namespace Exiv2 {
*/
void add(const Entry& entry);
/*!
@brief Delete the directory entry with the given tag. Return the index
@brief Delete the directory entry with the given tag. Return the index
of the deleted entry or 0 if no entry with tag was found.
*/
int erase(uint16_t tag);
@ -477,22 +477,22 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
@brief Read a sub-IFD from the location pointed to by the directory entry
@brief Read a sub-IFD from the location pointed to by the directory entry
with the given tag.
@param dest References the destination IFD.
@param buf The data buffer to read from. The buffer must contain all Exif
@param buf The data buffer to read from. The buffer must contain all Exif
data starting from the TIFF header.
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Applicable byte order (little or big endian).
@param tag Tag to look for.
@return 0 if successful;<BR>
6 if reading the sub-IFD failed (see read() above) or
the location pointed to by the directory entry with the
the location pointed to by the directory entry with the
given tag is outside of the data buffer.
@note It is not considered an error if the tag cannot be found in the
@note It is not considered an error if the tag cannot be found in the
IFD. 0 is returned and no action is taken in this case.
*/
int readSubIfd(
@ -514,7 +514,7 @@ namespace Exiv2 {
long offset() const { return offset_; }
/*!
@brief Get the offset of the first data entry outside of the IFD from
the start of the TIFF header, return 0 if there is none. The
the start of the TIFF header, return 0 if there is none. The
data offset is determined when the IFD is read.
*/
long dataOffset() const { return dataOffset_; }
@ -542,7 +542,7 @@ namespace Exiv2 {
//! Helper structure to build IFD entries
struct PreEntry {
uint16_t tag_;
uint16_t type_;
uint16_t type_;
uint32_t count_;
long size_;
long offsetLoc_;
@ -551,7 +551,7 @@ namespace Exiv2 {
//! cmpPreEntriesByOffset needs to know about PreEntry, that's all.
friend bool cmpPreEntriesByOffset(const PreEntry&, const PreEntry&);
//! Container for 'pre-entries'
typedef std::vector<PreEntry> PreEntries;
@ -576,7 +576,7 @@ namespace Exiv2 {
//! Pointer to the offset of next IFD
byte* pNext_;
/*!
The offset of the next IFD from the start of the TIFF header as data
The offset of the next IFD from the start of the TIFF header as data
value (always in sync with *pNext_)
*/
uint32_t next_;
@ -600,7 +600,7 @@ namespace Exiv2 {
than those with an offset.
*/
bool cmpPreEntriesByOffset(const Ifd::PreEntry& lhs, const Ifd::PreEntry& rhs);
} // namespace Exiv2
#endif // #ifndef IFD_HPP_

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -70,8 +70,8 @@ namespace Exiv2 {
return 0;
}
void ImageFactory::registerImage(int type,
NewInstanceFct newInst,
void ImageFactory::registerImage(int type,
NewInstanceFct newInst,
IsThisTypeFct isType)
{
unsigned int i = 0;
@ -98,7 +98,7 @@ namespace Exiv2 {
int ImageFactory::getType(BasicIo& io)
{
if (io.open() != 0) return ImageType::none;
if (io.open() != 0) return ImageType::none;
IoCloser closer(io);
for (unsigned int i = 0; registry_[i].imageType_ != ImageType::none; ++i) {
if (registry_[i].isThisType_(io, false)) {
@ -137,7 +137,7 @@ namespace Exiv2 {
return Image::AutoPtr();
} // ImageFactory::open
Image::AutoPtr ImageFactory::create(int type,
Image::AutoPtr ImageFactory::create(int type,
const std::string& path)
{
std::auto_ptr<FileIo> fileIo(new FileIo(path));
@ -160,7 +160,7 @@ namespace Exiv2 {
return image;
}
Image::AutoPtr ImageFactory::create(int type,
Image::AutoPtr ImageFactory::create(int type,
BasicIo::AutoPtr io)
{
// BasicIo instance does not need to be open
@ -171,7 +171,7 @@ namespace Exiv2 {
return Image::AutoPtr();
} // ImageFactory::create
TiffHeader::TiffHeader(ByteOrder byteOrder)
TiffHeader::TiffHeader(ByteOrder byteOrder)
: byteOrder_(byteOrder), tag_(0x002a), offset_(0x00000008)
{
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -24,7 +24,7 @@
@version $Rev$
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@author Brad Schick (brad)
@author Brad Schick (brad)
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
@date 09-Jan-04, ahu: created<BR>
11-Feb-04, ahu: isolated as a component<BR>
@ -56,7 +56,7 @@ namespace Exiv2 {
// class definitions
//! Supported image formats
namespace ImageType {
namespace ImageType {
const int none = 0; //!< Not an image
}
@ -66,10 +66,10 @@ namespace Exiv2 {
Most client apps will obtain an Image instance by calling a static
ImageFactory method. The Image class can then be used to to
read, write, and save metadata.
read, write, and save metadata.
*/
class Image {
public:
public:
//! Image auto_ptr type
typedef std::auto_ptr<Image> AutoPtr;
@ -85,7 +85,7 @@ namespace Exiv2 {
@brief Read all metadata supported by a specific image format from the
image. Before this method is called, the various metadata types
will be empty.
This method returns success even if no metadata is found in the
image. Callers must therefore check the size of individual metadata
types before accessing the data.
@ -96,7 +96,7 @@ namespace Exiv2 {
*/
virtual void readMetadata() =0;
/*!
@brief Write metadata back to the image.
@brief Write metadata back to the image.
All existing metadata sections in the image are either created,
replaced, or erased. If values for a given metadata type have been
@ -104,7 +104,7 @@ namespace Exiv2 {
replaced. If no values have been assigned to a given metadata type,
any exists section for that metadata type will be removed from the
image.
@throw Error if the operation fails
*/
virtual void writeMetadata() =0;
@ -158,7 +158,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
@brief Check if the Image instance is valid. Use after object
@brief Check if the Image instance is valid. Use after object
construction.
@return true if the Image is in a valid state.
*/
@ -171,7 +171,7 @@ namespace Exiv2 {
a previous call to readMetadata() or added directly. The Exif
data in the returned instance will be written to the image when
writeMetadata() is called.
@return read only ExifData instance containing Exif values
*/
virtual const ExifData& exifData() const =0;
@ -183,7 +183,7 @@ namespace Exiv2 {
a previous call to readMetadata() or added directly. The Exif
data in the returned instance will be written to the image when
writeMetadata() is called.
@return modifiable ExifData instance containing Exif values
*/
virtual ExifData& exifData() =0;
@ -195,7 +195,7 @@ namespace Exiv2 {
a previous call to readMetadata() or added directly. The Iptc
data in the returned instance will be written to the image when
writeMetadata() is called.
@return modifiable IptcData instance containing Iptc values
*/
virtual const IptcData& iptcData() const =0;
@ -207,7 +207,7 @@ namespace Exiv2 {
a previous call to readMetadata() or added directly. The Iptc
data in the returned instance will be written to the image when
writeMetadata() is called.
@return modifiable IptcData instance containing Iptc values
*/
virtual IptcData& iptcData() =0;
@ -217,12 +217,12 @@ namespace Exiv2 {
virtual std::string comment() const =0;
/*!
@brief Return a reference to the BasicIo instance being used for Io.
This refence is particularly useful to reading the results of
operations on a MemIo instance. For example after metadata has
been modified and the writeMetadata() method has been called,
this method can be used to get access to the modified image.
this method can be used to get access to the modified image.
@return BasicIo instance that can be used to read or write image
data directly.
@note If the returned BasicIo is used to write to the image, the
@ -277,8 +277,8 @@ namespace Exiv2 {
@param newInst Function pointer for creating image instances.
@param isType Function pointer to test for matching image types.
*/
static void registerImage(int type,
NewInstanceFct newInst,
static void registerImage(int type,
NewInstanceFct newInst,
IsThisTypeFct isType);
//@}
@ -287,11 +287,11 @@ namespace Exiv2 {
/*!
@brief Create an Image subclass of the appropriate type by reading
the specified file. %Image type is derived from the file
contents.
contents.
@param path %Image file. The contents of the file are tested to
determine the image type. File extension is ignored.
@return An auto-pointer that owns an Image instance whose type
matches that of the file.
@return An auto-pointer that owns an Image instance whose type
matches that of the file.
@throw Error If opening the file fails or it contains data of an
unknown image type.
*/
@ -299,11 +299,11 @@ namespace Exiv2 {
/*!
@brief Create an Image subclass of the appropriate type by reading
the provided memory. %Image type is derived from the memory
contents.
contents.
@param data Pointer to a data buffer containing an image. The contents
of the memory are tested to determine the image type.
@param size Number of bytes pointed to by \em data.
@return An auto-pointer that owns an Image instance whose type
@return An auto-pointer that owns an Image instance whose type
matches that of the data buffer.
@throw Error If the memory contains data of an unknown image type.
*/
@ -312,15 +312,15 @@ namespace Exiv2 {
@brief Create an Image subclass of the appropriate type by reading
the provided BasicIo instance. %Image type is derived from the
data provided by \em io. The passed in \em io instance is
(re)opened by this method.
(re)opened by this method.
@param io An auto-pointer that owns a BasicIo instance that provides
image data. The contents of the image data are tested to determine
the type.
the type.
@note This method takes ownership of the passed
in BasicIo instance through the auto-pointer. Callers should not
continue to use the BasicIo instance after it is passed to this method.
Use the Image::io() method to get a temporary reference.
@return An auto-pointer that owns an Image instance whose type
@return An auto-pointer that owns an Image instance whose type
matches that of the \em io data. If no image type could be
determined, the pointer is 0.
@throw Error If opening the BasicIo fails
@ -332,7 +332,7 @@ namespace Exiv2 {
@param type Type of the image to be created.
@param path %Image file to create. File extension is ignored.
@return An auto-pointer that owns an Image instance of the requested
type.
type.
@throw Error If the image type is not supported.
*/
static Image::AutoPtr create(int type, const std::string& path);
@ -341,7 +341,7 @@ namespace Exiv2 {
new image in memory.
@param type Type of the image to be created.
@return An auto-pointer that owns an Image instance of the requested
type.
type.
@throw Error If the image type is not supported
*/
static Image::AutoPtr create(int type);
@ -351,24 +351,24 @@ namespace Exiv2 {
contains data, it will be overwritten.
@param type Type of the image to be created.
@param io An auto-pointer that owns a BasicIo instance that will
be written to when creating a new image.
be written to when creating a new image.
@note This method takes ownership of the passed in BasicIo instance
through the auto-pointer. Callers should not continue to use the
BasicIo instance after it is passed to this method. Use the
through the auto-pointer. Callers should not continue to use the
BasicIo instance after it is passed to this method. Use the
Image::io() method to get a temporary reference.
@return An auto-pointer that owns an Image instance of the requested
type. If the image type is not supported, the pointer is 0.
*/
static Image::AutoPtr create(int type, BasicIo::AutoPtr io);
/*!
@brief Returns the image type of the provided file.
@brief Returns the image type of the provided file.
@param path %Image file. The contents of the file are tested to
determine the image type. File extension is ignored.
@return %Image type or Image::none if the type is not recognized.
*/
static int getType(const std::string& path);
/*!
@brief Returns the image type of the provided data buffer.
@brief Returns the image type of the provided data buffer.
@param data Pointer to a data buffer containing an image. The contents
of the memory are tested to determine the image type.
@param size Number of bytes pointed to by \em data.
@ -405,11 +405,11 @@ namespace Exiv2 {
{}
//! Constructor
Registry(int imageType,
NewInstanceFct newInstance,
IsThisTypeFct isThisType)
NewInstanceFct newInstance,
IsThisTypeFct isThisType)
: imageType_(imageType),
newInstance_(newInstance),
isThisType_(isThisType)
newInstance_(newInstance),
isThisType_(isThisType)
{}
int imageType_;
NewInstanceFct newInstance_;
@ -431,7 +431,7 @@ namespace Exiv2 {
//! @name Creators
//@{
/*!
@brief Default constructor. Optionally sets the byte order
@brief Default constructor. Optionally sets the byte order
(default: little endian).
*/
explicit TiffHeader(ByteOrder byteOrder =littleEndian);
@ -445,7 +445,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
/*!
/*!
@brief Write a standard TIFF header into buf as a data string, return
number of bytes copied.
@ -466,7 +466,7 @@ namespace Exiv2 {
uint16_t tag() const { return tag_; }
/*!
@brief Return the offset to IFD0 from the start of the TIFF header.
The offset is 0x00000008 if IFD0 begins immediately after the
The offset is 0x00000008 if IFD0 begins immediately after the
TIFF header.
*/
uint32_t offset() const { return offset_; }
@ -477,7 +477,7 @@ namespace Exiv2 {
uint16_t tag_;
uint32_t offset_;
}; // class TiffHeader
}; // class TiffHeader
} // namespace Exiv2

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -23,7 +23,7 @@
Version: $Rev$
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 19-Sep-05, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -75,7 +75,7 @@ try {
// Make sure they are all the same size
if(fileIn.size() != memIo1.size() || memIo1.size() != fileOut1.size()) {
std::cerr << argv[0] <<
std::cerr << argv[0] <<
": Sizes do not match\n";
return 1;
}
@ -95,7 +95,7 @@ try {
fileTest.close();
rc = WriteReadSeek(fileTest);
if (rc != 0) return rc;
// Another test of reading and writing
fileOut1.seek(0, BasicIo::beg);
memIo2.seek(0, BasicIo::beg);
@ -108,12 +108,12 @@ try {
byte buf[32];
while ((readCount=fileOut1.read(buf, sizeof(buf)))) {
if (memIo2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
std::cerr << argv[0] <<
": MemIo bad write 2\n";
return 13;
}
if (fileOut2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
std::cerr << argv[0] <<
": FileIo bad write 2\n";
return 14;
}
@ -146,7 +146,7 @@ int WriteReadSeek(BasicIo &io)
std::cerr << ": WRS initial write failed\n";
return 2;
}
if (io.size() != len1) {
std::cerr << ": WRS size is not " << len1 << "\n";
return 2;
@ -176,7 +176,7 @@ int WriteReadSeek(BasicIo &io)
std::cerr << ": WRS bad getb o\n";
return 5;
}
io.seek(-2, BasicIo::cur);
if (io.getb() != 'I') {
std::cerr << ": WRS bad getb I\n";
@ -187,7 +187,7 @@ int WriteReadSeek(BasicIo &io)
std::cerr << ": WRS bad putb\n";
return 7;
}
io.seek(-1, BasicIo::cur);
if (io.getb() != 'O') {
std::cerr << ": WRS bad getb O\n";
@ -209,7 +209,7 @@ int WriteReadSeek(BasicIo &io)
std::cerr << ": WRS something went wrong\n";
return 10;
}
// Make sure we got the null back
if(buf[insert + len2 - 1] != 0) {
std::cerr << ": WRS missing null terminator 2\n";

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -45,7 +45,7 @@ EXIV2_RCSID("@(#) $Id$");
// class member definitions
namespace Exiv2 {
Iptcdatum::Iptcdatum(const IptcKey& key,
Iptcdatum::Iptcdatum(const IptcKey& key,
const Value* pValue)
: key_(key.clone())
{
@ -66,7 +66,7 @@ namespace Exiv2 {
const Value& Iptcdatum::value() const
{
if (value_.get() == 0) throw Error(8);
return *value_;
return *value_;
}
Iptcdatum& Iptcdatum::operator=(const Iptcdatum& rhs)
@ -82,7 +82,7 @@ namespace Exiv2 {
return *this;
} // Iptcdatum::operator=
Iptcdatum& Iptcdatum::operator=(const uint16_t& value)
{
UShortValue::AutoPtr v = UShortValue::AutoPtr(new UShortValue);
@ -174,7 +174,7 @@ namespace Exiv2 {
return rc;
} // IptcData::read
int IptcData::readData(uint16_t dataSet, uint16_t record,
int IptcData::readData(uint16_t dataSet, uint16_t record,
const byte* data, uint32_t sizeData)
{
Value::AutoPtr value;
@ -246,7 +246,7 @@ namespace Exiv2 {
int IptcData::add(const Iptcdatum& iptcDatum)
{
if (!IptcDataSets::dataSetRepeatable(
iptcDatum.tag(), iptcDatum.record()) &&
iptcDatum.tag(), iptcDatum.record()) &&
findId(iptcDatum.tag(), iptcDatum.record()) != end()) {
return 6;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -22,7 +22,7 @@
@file iptc.hpp
@brief Encoding and decoding of Iptc data
@version $Rev$
@author Brad Schick (brad)
@author Brad Schick (brad)
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
@date 31-Jul-04, brad: created
*/
@ -49,7 +49,7 @@ namespace Exiv2 {
// class definitions
/*!
@brief Information related to one Iptc dataset. An Iptc metadatum consists
@brief Information related to one Iptc dataset. An Iptc metadatum consists
of an IptcKey and a Value and provides methods to manipulate these.
*/
class Iptcdatum : public Metadatum {
@ -68,7 +68,7 @@ namespace Exiv2 {
@throw Error if the key cannot be parsed and converted
to a tag number and record id.
*/
explicit Iptcdatum(const IptcKey& key,
explicit Iptcdatum(const IptcKey& key,
const Value* pValue =0);
//! Copy constructor
Iptcdatum(const Iptcdatum& rhs);
@ -86,7 +86,7 @@ namespace Exiv2 {
*/
Iptcdatum& operator=(const uint16_t& value);
/*!
@brief Assign \em value to the %Iptcdatum.
@brief Assign \em value to the %Iptcdatum.
Calls setValue(const std::string&).
*/
Iptcdatum& operator=(const std::string& value);
@ -101,11 +101,11 @@ namespace Exiv2 {
*/
void setValue(const Value* pValue);
/*!
@brief Set the value to the string \em value, using
Value::read(const std::string&).
@brief Set the value to the string \em value, using
Value::read(const std::string&).
If the %Iptcdatum does not have a Value yet, then a %Value of
the correct type for this %Iptcdatum is created. If that
fails (because of an unknown dataset), a StringValue is
fails (because of an unknown dataset), a StringValue is
created.
*/
void setValue(const std::string& value);
@ -124,7 +124,7 @@ namespace Exiv2 {
@param byteOrder Applicable byte order (little or big endian).
@return Number of characters written.
*/
long copy(byte* buf, ByteOrder byteOrder) const
long copy(byte* buf, ByteOrder byteOrder) const
{ return value_.get() == 0 ? 0 : value_->copy(buf, byteOrder); }
/*!
@brief Return the key of the Iptcdatum. The key is of the form
@ -140,10 +140,10 @@ namespace Exiv2 {
std::string recordName() const
{ return key_.get() == 0 ? "" : key_->recordName(); }
/*!
@brief Return the record id
@brief Return the record id
@return record id
*/
uint16_t record() const
uint16_t record() const
{ return key_.get() == 0 ? 0 : key_->record(); }
/*!
@brief Return the name of the tag (aka dataset)
@ -155,7 +155,7 @@ namespace Exiv2 {
uint16_t tag() const
{ return key_.get() == 0 ? 0 : key_->tag(); }
//! Return the type id of the value
TypeId typeId() const
TypeId typeId() const
{ return value_.get() == 0 ? invalidTypeId : value_->typeId(); }
//! Return the name of the type
const char* typeName() const { return TypeInfo::typeName(typeId()); }
@ -166,7 +166,7 @@ namespace Exiv2 {
//! Return the size of the value in bytes
long size() const { return value_.get() == 0 ? 0 : value_->size(); }
//! Return the value as a string.
std::string toString() const
std::string toString() const
{ return value_.get() == 0 ? "" : value_->toString(); }
/*!
@brief Return the n-th component of the value converted to long. The
@ -174,7 +174,7 @@ namespace Exiv2 {
the behaviour of the method is undefined if there is no n-th
component.
*/
long toLong(long n =0) const
long toLong(long n =0) const
{ return value_.get() == 0 ? -1 : value_->toLong(n); }
/*!
@brief Return the n-th component of the value converted to float. The
@ -182,7 +182,7 @@ namespace Exiv2 {
the behaviour of the method is undefined if there is no n-th
component.
*/
float toFloat(long n =0) const
float toFloat(long n =0) const
{ return value_.get() == 0 ? -1 : value_->toFloat(n); }
/*!
@brief Return the n-th component of the value converted to
@ -190,30 +190,30 @@ namespace Exiv2 {
Iptcdatum is not set and the behaviour of the method is
undefined if there is no n-th component.
*/
Rational toRational(long n =0) const
Rational toRational(long n =0) const
{ return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); }
/*!
@brief Return an auto-pointer to a copy (clone) of the value. The
caller owns this copy and the auto-pointer ensures that it will
be deleted.
This method is provided for users who need full control over the
This method is provided for users who need full control over the
value. A caller may, e.g., downcast the pointer to the appropriate
subclass of Value to make use of the interface of the subclass to set
or modify its contents.
@return An auto-pointer to a copy (clone) of the value, 0 if the value
is not set.
*/
Value::AutoPtr getValue() const
Value::AutoPtr getValue() const
{ return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); }
/*!
@brief Return a constant reference to the value.
@brief Return a constant reference to the value.
This method is provided mostly for convenient and versatile output of
the value which can (to some extent) be formatted through standard
stream manipulators. Do not attempt to write to the value through
this reference.
this reference.
<b>Example:</b> <br>
@code
@ -261,17 +261,17 @@ namespace Exiv2 {
private:
uint16_t dataset_;
uint16_t record_;
}; // class FindMetadatumById
/*!
@brief A container for Iptc data. This is a top-level class of
@brief A container for Iptc data. This is a top-level class of
the %Exiv2 library.
Provide high-level access to the Iptc data of an image:
- read Iptc information from JPEG files
- access metadata through keys and standard C++ iterators
- add, modify and delete metadata
- add, modify and delete metadata
- write Iptc data to JPEG files
- extract Iptc metadata to files, insert from these files
*/
@ -290,7 +290,7 @@ namespace Exiv2 {
@brief Load the Iptc data from a byte buffer. The format must follow
the IPTC IIM4 standard.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@return 0 if successful;<BR>
5 if Iptc data is invalid or corrupt;<BR>
*/
@ -319,7 +319,7 @@ namespace Exiv2 {
6 if the dataset already exists and is not repeatable
*/
int add(const IptcKey& key, Value* value);
/*!
/*!
@brief Add a copy of the Iptcdatum to the Iptc metadata. A check
for non-repeatable datasets is performed.
@return 0 if successful;<BR>
@ -327,9 +327,9 @@ namespace Exiv2 {
*/
int add(const Iptcdatum& iptcdatum);
/*!
@brief Delete the Iptcdatum at iterator position pos, return the
@brief Delete the Iptcdatum at iterator position pos, return the
position of the next Iptcdatum. Note that iterators into
the metadata, including pos, are potentially invalidated
the metadata, including pos, are potentially invalidated
by this call.
*/
iterator erase(iterator pos);
@ -347,17 +347,17 @@ namespace Exiv2 {
iterator end() { return iptcMetadata_.end(); }
/*!
@brief Find a Iptcdatum with the given key, return an iterator to it.
If multiple entries with the same key exist, it is undefined
If multiple entries with the same key exist, it is undefined
which of the matching metadata is found.
*/
iterator findKey(const IptcKey& key);
/*!
@brief Find a Iptcdatum with the given record and dataset it,
@brief Find a Iptcdatum with the given record and dataset it,
return a const iterator to it. If multiple entries with the
same Ids exists, it is undefined which of the matching
metadata is found.
*/
iterator findId(uint16_t dataset,
iterator findId(uint16_t dataset,
uint16_t record = IptcDataSets::application2);
//@}
@ -374,12 +374,12 @@ namespace Exiv2 {
*/
const_iterator findKey(const IptcKey& key) const;
/*!
@brief Find a Iptcdatum with the given record and dataset number,
@brief Find a Iptcdatum with the given record and dataset number,
return a const iterator to it. If multiple metadata with the
same Ids exist it is undefined which of the matching
metadata is found.
*/
const_iterator findId(uint16_t dataset,
const_iterator findId(uint16_t dataset,
uint16_t record = IptcDataSets::application2) const;
//! Return true if there is no Iptc metadata
bool empty() const { return count() == 0; }
@ -400,12 +400,12 @@ namespace Exiv2 {
@param sizeData Length in bytes of dataset payload
@return 0 if successful.
*/
int readData(uint16_t dataSet, uint16_t record,
int readData(uint16_t dataSet, uint16_t record,
const byte* data, uint32_t sizeData);
// Constant data
static const byte marker_; // Dataset marker
// DATA
IptcMetadata iptcMetadata_;
}; // class IptcData

@ -32,13 +32,13 @@ try {
std::cout << std::setw(44) << std::setfill(' ') << std::left
<< md->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << md->tag() << " "
<< std::hex << md->tag() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< md->count() << " "
<< std::dec << md->value()
<< std::dec << md->value()
<< std::endl;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -24,7 +24,7 @@
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
Brad Schick (brad) <brad@robotbattle.com>
History: 15-Jan-05, brad: split out from image.cpp
*/
// *****************************************************************************
#include "rcsid.hpp"
@ -49,7 +49,7 @@ EXIV2_RCSID("@(#) $Id$");
// *****************************************************************************
// class member definitions
namespace Exiv2 {
const byte JpegBase::sos_ = 0xda;
const byte JpegBase::eoi_ = 0xd9;
const byte JpegBase::app0_ = 0xe0;
@ -62,8 +62,8 @@ namespace Exiv2 {
const char JpegBase::ps3Id_[] = "Photoshop 3.0\0";
const char JpegBase::bimId_[] = "8BIM";
JpegBase::JpegBase(BasicIo::AutoPtr io, bool create,
const byte initData[], long dataSize)
JpegBase::JpegBase(BasicIo::AutoPtr io, bool create,
const byte initData[], long dataSize)
: io_(io)
{
if (create) {
@ -96,7 +96,7 @@ namespace Exiv2 {
clearExifData();
clearComment();
}
void JpegBase::clearIptcData()
{
iptcData_.clear();
@ -123,8 +123,8 @@ namespace Exiv2 {
}
void JpegBase::setComment(const std::string& comment)
{
comment_ = comment;
{
comment_ = comment;
}
void JpegBase::setMetadata(const Image& image)
@ -141,7 +141,7 @@ namespace Exiv2 {
while ((c=io_->getb()) != 0xff) {
if (c == EOF) return -1;
}
// Markers can start with any number of 0xff
while ((c=io_->getb()) == 0xff) {
if (c == EOF) return -1;
@ -169,7 +169,7 @@ namespace Exiv2 {
// Read section marker
int marker = advanceToMarker();
if (marker < 0) throw Error(15);
while (marker != sos_ && marker != eoi_ && search > 0) {
// Read size and signature (ok if this hits EOF)
bufRead = io_->read(buf.pData_, bufMinSize);
@ -179,7 +179,7 @@ namespace Exiv2 {
if (marker == app1_ && memcmp(buf.pData_ + 2, exifId_, 6) == 0) {
if (size < 8) throw Error(15);
// Seek to begining and read the Exif data
io_->seek(8-bufRead, BasicIo::cur);
io_->seek(8-bufRead, BasicIo::cur);
long sizeExifData = size - 8;
DataBuf rawExif(sizeExifData);
io_->read(rawExif.pData_, sizeExifData);
@ -235,9 +235,9 @@ namespace Exiv2 {
// Operates on raw data (rather than file streams) to simplify reuse
int JpegBase::locateIptcData(const byte *pPsData,
int JpegBase::locateIptcData(const byte *pPsData,
long sizePsData,
const byte **record,
const byte **record,
uint16_t *const sizeHdr,
uint16_t *const sizeIptc) const
{
@ -254,7 +254,7 @@ namespace Exiv2 {
position += 4;
uint16_t type = getUShort(pPsData+ position, bigEndian);
position += 2;
// Pascal string is padded to have an even size (including size byte)
byte psSize = pPsData[position] + 1;
psSize += (psSize & 1);
@ -265,7 +265,7 @@ namespace Exiv2 {
long dataSize = getULong(pPsData + position, bigEndian);
position += 4;
if (dataSize > sizePsData - position) return -2;
if (type == iptc_) {
*sizeIptc = static_cast<uint16_t>(dataSize);
*sizeHdr = psSize + 10;
@ -301,7 +301,7 @@ namespace Exiv2 {
if (io_->error() || io_->eof()) throw Error(20);
throw Error(22);
}
const long bufMinSize = 16;
long bufRead = 0;
DataBuf buf(bufMinSize);
@ -320,7 +320,7 @@ namespace Exiv2 {
// Read section marker
int marker = advanceToMarker();
if (marker < 0) throw Error(22);
// First find segments of interest. Normally app0 is first and we want
// to insert after it. But if app0 comes after com, app1 and app13 then
// don't bother.
@ -376,7 +376,7 @@ namespace Exiv2 {
count = 0;
marker = advanceToMarker();
if (marker < 0) throw Error(22);
// To simplify this a bit, new segments are inserts at either the start
// or right after app0. This is standard in most jpegs, but has the
// potential to change segment ordering (which is allowed).
@ -395,7 +395,7 @@ namespace Exiv2 {
// Write COM marker, size of comment, and string
tmpBuf[0] = 0xff;
tmpBuf[1] = com_;
us2Data(tmpBuf + 2,
us2Data(tmpBuf + 2,
static_cast<uint16_t>(comment_.length()+3), bigEndian);
if (outIo.write(tmpBuf, 4) != 4) throw Error(21);
if (outIo.write((byte*)comment_.data(), (long)comment_.length())
@ -409,17 +409,17 @@ namespace Exiv2 {
DataBuf rawExif(exifData_.copy());
tmpBuf[0] = 0xff;
tmpBuf[1] = app1_;
us2Data(tmpBuf + 2,
static_cast<uint16_t>(rawExif.size_+8),
us2Data(tmpBuf + 2,
static_cast<uint16_t>(rawExif.size_+8),
bigEndian);
memcpy(tmpBuf + 4, exifId_, 6);
if (outIo.write(tmpBuf, 10) != 10) throw Error(21);
if (outIo.write(rawExif.pData_, rawExif.size_)
if (outIo.write(rawExif.pData_, rawExif.size_)
!= rawExif.size_) throw Error(21);
if (outIo.error()) throw Error(21);
--search;
}
const byte *record = psData.pData_;
uint16_t sizeIptc = 0;
uint16_t sizeHdr = 0;
@ -434,9 +434,9 @@ namespace Exiv2 {
// write app13 marker, new size, and ps3Id
tmpBuf[0] = 0xff;
tmpBuf[1] = app13_;
const int sizeNewData = rawIptc.size_ ?
const int sizeNewData = rawIptc.size_ ?
rawIptc.size_ + (rawIptc.size_ & 1) + 12 : 0;
us2Data(tmpBuf + 2,
us2Data(tmpBuf + 2,
static_cast<uint16_t>(psData.size_-sizeOldData+sizeNewData+16),
bigEndian);
memcpy(tmpBuf + 4, ps3Id_, 14);
@ -456,7 +456,7 @@ namespace Exiv2 {
tmpBuf[7] = 0;
ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian);
if (outIo.write(tmpBuf, 12) != 12) throw Error(21);
if (outIo.write(rawIptc.pData_, rawIptc.size_)
if (outIo.write(rawIptc.pData_, rawIptc.size_)
!= rawIptc.size_) throw Error(21);
// data is padded to be even (but not included in size)
if (rawIptc.size_ & 1) {
@ -465,9 +465,9 @@ namespace Exiv2 {
if (outIo.error()) throw Error(21);
--search;
}
// write existing stuff after record
if (outIo.write(record+sizeOldData, sizeEnd)
if (outIo.write(record+sizeOldData, sizeEnd)
!= sizeEnd) throw Error(21);
if (outIo.error()) throw Error(21);
}
@ -526,11 +526,11 @@ namespace Exiv2 {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xDA,0x00,0x0C,0x03,0x01,0x00,0x02,
0x11,0x03,0x11,0x00,0x3F,0x00,0xA0,0x00,0x0F,0xFF,0xD9 };
JpegImage::JpegImage(BasicIo::AutoPtr io, bool create)
JpegImage::JpegImage(BasicIo::AutoPtr io, bool create)
: JpegBase(io, create, blank_, sizeof(blank_))
{
}
int JpegImage::writeHeader(BasicIo& outIo) const
{
// Jpeg header
@ -569,11 +569,11 @@ namespace Exiv2 {
if (!advance || !result ) iIo.seek(-2, BasicIo::cur);
return result;
}
const char ExvImage::exiv2Id_[] = "Exiv2";
const byte ExvImage::blank_[] = { 0xff,0x01,'E','x','i','v','2',0xff,0xd9 };
ExvImage::ExvImage(BasicIo::AutoPtr io, bool create)
ExvImage::ExvImage(BasicIo::AutoPtr io, bool create)
: JpegBase(io, create, blank_, sizeof(blank_))
{
}
@ -615,7 +615,7 @@ namespace Exiv2 {
iIo.read(tmpBuf, 7);
if (iIo.error() || iIo.eof()) return false;
if ( 0xff != tmpBuf[0] || 0x01 != tmpBuf[1]
if ( 0xff != tmpBuf[0] || 0x01 != tmpBuf[1]
|| memcmp(tmpBuf + 2, ExvImage::exiv2Id_, 5) != 0) {
result = false;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -24,7 +24,7 @@
@version $Rev$
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@author Brad Schick (brad)
@author Brad Schick (brad)
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
@date 15-Jan-05, brad: split out from image.cpp
*/
@ -51,12 +51,12 @@ namespace Exiv2 {
// class definitions
// Supported jpeg image formats
namespace ImageType {
namespace ImageType {
const int jpeg = 1; //!< Jpeg image type (see class JpegImage)
const int exv = 2; //!< Exv image type (see class ExvImage)
}
/*!
/*!
@brief Abstract helper base class to access JPEG images.
*/
class JpegBase : public Image {
@ -89,11 +89,11 @@ namespace Exiv2 {
IptcData& iptcData() { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
//@}
//@}
protected:
//! @name Creators
//@{
/*!
/*!
@brief Constructor that can either open an existing image or create
a new image from scratch. If a new image is to be created, any
existing data is overwritten.
@ -133,9 +133,9 @@ namespace Exiv2 {
moved (see below). This applies only if the type matches and the
function returns true. If the type does not match, the stream
position is not changed. However, if reading from the stream fails,
the stream position is undefined. Consult the stream state to obtain
the stream position is undefined. Consult the stream state to obtain
more information in this case.
@param iIo BasicIo instance to read from.
@param advance Flag indicating whether the position of the io
should be advanced by the number of characters read to
@ -180,7 +180,7 @@ namespace Exiv2 {
/*!
@brief Locates Photoshop formated Iptc data in a memory buffer.
Operates on raw data to simplify reuse.
@param pPsData Pointer to buffer containing entire payload of
@param pPsData Pointer to buffer containing entire payload of
Photoshop formated APP13 Jpeg segment.
@param sizePsData Size in bytes of pPsData.
@param record Output value that is set to the start of the Iptc
@ -195,9 +195,9 @@ namespace Exiv2 {
3 if no Iptc data was found in pPsData;<BR>
-2 if the pPsData buffer does not contain valid data.
*/
int locateIptcData(const byte *pPsData,
int locateIptcData(const byte *pPsData,
long sizePsData,
const byte **record,
const byte **record,
uint16_t *const sizeHdr,
uint16_t *const sizeIptc) const;
/*!
@ -209,8 +209,8 @@ namespace Exiv2 {
*/
int initImage(const byte initData[], long dataSize);
/*!
@brief Provides the main implementation of writeMetadata() by
writing all buffered metadata to the provided BasicIo.
@brief Provides the main implementation of writeMetadata() by
writing all buffered metadata to the provided BasicIo.
@param oIo BasicIo instance to write to (a temporary location).
@return 4 if opening or writing to the associated BasicIo fails
@ -226,7 +226,7 @@ namespace Exiv2 {
JpegBase& operator=(const JpegBase& rhs);
}; // class JpegBase
/*!
/*!
@brief Class to access JPEG images
*/
class JpegImage : public JpegBase {
@ -234,7 +234,7 @@ namespace Exiv2 {
public:
//! @name Creators
//@{
/*!
/*!
@brief Constructor that can either open an existing Jpeg image or create
a new image from scratch. If a new image is to be created, any
existing data is overwritten. Since the constructor can not return
@ -290,7 +290,7 @@ namespace Exiv2 {
public:
//! @name Creators
//@{
/*!
/*!
@brief Constructor that can either open an existing Exv image or create
a new image from scratch. If a new image is to be created, any
existing data is overwritten. Since the constructor can not return
@ -335,19 +335,19 @@ namespace Exiv2 {
// *****************************************************************************
// template, inline and free functions
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
/*!
@brief Create a new JpegImage instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create);
//! Check if the file iIo is a JPEG image.
bool isJpegType(BasicIo& iIo, bool advance);
/*!
@brief Create a new ExvImage instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
@brief Create a new ExvImage instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create);

@ -1,6 +1,6 @@
// ***************************************************************** -*- C++ -*-
/*
Abstract : Key unit tests
Abstract : Key unit tests
File : key-test.cpp
Version : $Rev$
@ -31,43 +31,43 @@ int main()
os << ek;
if (os.str() != key) {
std::cout << "Testcase failed (operator<<)" << std::endl;
rc += 1;
rc += 1;
}
// familyName
tc += 1;
if (std::string(ek.familyName()) != "Exif") {
std::cout << "Testcase failed (familyName)" << std::endl;
rc += 1;
rc += 1;
}
// groupName
tc += 1;
if (ek.groupName() != "Iop") {
std::cout << "Testcase failed (groupName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek.tagName() != "InteroperabilityVersion") {
std::cout << "Testcase failed (tagName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek.tag() != 0x0002) {
std::cout << "Testcase failed (tag)" << std::endl;
rc += 1;
rc += 1;
}
// ifdName
tc += 1;
if (std::string(ek.ifdName()) != "Iop") {
std::cout << "Testcase failed (ifdName: " << std::endl;
rc += 1;
rc += 1;
}
// sectionName
tc += 1;
if (ek.sectionName() != "Interoperability") {
std::cout << "Testcase failed (sectionName)" << std::endl;
rc += 1;
rc += 1;
}
// -----
@ -81,51 +81,51 @@ int main()
os2 << ek2;
if (os2.str() != key) {
std::cout << "Testcase failed (operator<<)" << std::endl;
rc += 1;
rc += 1;
}
// familyName
tc += 1;
if (std::string(ek2.familyName()) != "Exif") {
std::cout << "Testcase failed (familyName)" << std::endl;
rc += 1;
rc += 1;
}
// groupName
tc += 1;
if (ek2.groupName() != "Iop") {
std::cout << "Testcase failed (groupName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek2.tagName() != "InteroperabilityVersion") {
std::cout << "Testcase failed (tagName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek2.tag() != 0x0002) {
std::cout << "Testcase failed (tag)" << std::endl;
rc += 1;
rc += 1;
}
// ifdName
tc += 1;
if (std::string(ek2.ifdName()) != "Iop") {
std::cout << "Testcase failed (ifdName: " << std::endl;
rc += 1;
rc += 1;
}
// sectionName
tc += 1;
if (ek2.sectionName() != "Interoperability") {
std::cout << "Testcase failed (sectionName)" << std::endl;
rc += 1;
rc += 1;
}
// -----
long len = 76;
byte buf[]
byte buf[]
= { // No
0x00,0x04,
0x00,0x04,
// Tag Type Components Offset/Data
0x00,0x01, 0x00,0x02, 0x00,0x00,0x00,0x04, 'T', 'h', 'e', '\0',
0x00,0x02, 0x00,0x02, 0x00,0x00,0x00,0x06, 0x00,0x00,0x00,0x37,
@ -159,43 +159,43 @@ int main()
os2 << ek3;
if (os2.str() != key) {
std::cout << "Testcase failed (operator<<)" << std::endl;
rc += 1;
rc += 1;
}
// familyName
tc += 1;
if (std::string(ek3.familyName()) != "Exif") {
std::cout << "Testcase failed (familyName)" << std::endl;
rc += 1;
rc += 1;
}
// groupName
tc += 1;
if (ek3.groupName() != "Iop") {
std::cout << "Testcase failed (groupName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek3.tagName() != "InteroperabilityVersion") {
std::cout << "Testcase failed (tagName)" << std::endl;
rc += 1;
rc += 1;
}
// tagName
tc += 1;
if (ek3.tag() != 0x0002) {
std::cout << "Testcase failed (tag)" << std::endl;
rc += 1;
rc += 1;
}
// ifdName
tc += 1;
if (std::string(ek3.ifdName()) != "Iop") {
std::cout << "Testcase failed (ifdName: " << std::endl;
rc += 1;
rc += 1;
}
// sectionName
tc += 1;
if (ek3.sectionName() != "Interoperability") {
std::cout << "Testcase failed (sectionName)" << std::endl;
rc += 1;
rc += 1;
}
}
@ -206,12 +206,12 @@ int main()
tc += 1;
if (ek4.key() != "Exif.Image.Model") {
std::cout << "Testcase failed (converted key)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ek4.tagName() != "Model") {
std::cout << "Testcase failed (converted tagName)" << std::endl;
rc += 1;
rc += 1;
}
// -----
@ -220,12 +220,12 @@ int main()
tc += 1;
if (ek5.key() != "Exif.Nikon3.Focus") {
std::cout << "Testcase failed (converted key)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ek5.tagName() != "Focus") {
std::cout << "Testcase failed (converted tagName)" << std::endl;
rc += 1;
rc += 1;
}
// -----
@ -234,17 +234,17 @@ int main()
tc += 1;
if (ik1.key() != "Iptc.Envelope.Destination") {
std::cout << "Testcase failed (converted Iptc key)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ik1.tagName() != "Destination") {
std::cout << "Testcase failed (converted tagName)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ik1.recordName() != "Envelope") {
std::cout << "Testcase failed (converted recordName)" << std::endl;
rc += 1;
rc += 1;
}
// -----
@ -253,17 +253,17 @@ int main()
tc += 1;
if (ik2.key() != "Iptc.0x1234.0xabcd") {
std::cout << "Testcase failed (unknown Iptc key)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ik2.tagName() != "0xabcd") {
std::cout << "Testcase failed (converted tagName)" << std::endl;
rc += 1;
rc += 1;
}
tc += 1;
if (ik2.recordName() != "0x1234") {
std::cout << "Testcase failed (converted recordName)" << std::endl;
rc += 1;
rc += 1;
}
// -----

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -29,7 +29,7 @@
EXIV2_RCSID("@(#) $Id$");
// Define DEBUG_* to output debug information to std::cerr, e.g, by calling
// make like this: make DEFS=-DDEBUG_MAKERNOTE makernote.o
// make like this: make DEFS=-DDEBUG_MAKERNOTE makernote.o
//#define DEBUG_MAKERNOTE
//#define DEBUG_REGISTRY
@ -49,7 +49,7 @@ EXIV2_RCSID("@(#) $Id$");
// class member definitions
namespace Exiv2 {
MakerNote::MakerNote(bool alloc)
MakerNote::MakerNote(bool alloc)
: alloc_(alloc), offset_(0), byteOrder_(invalidByteOrder)
{
}
@ -65,7 +65,7 @@ namespace Exiv2 {
}
IfdMakerNote::IfdMakerNote(IfdId ifdId, bool alloc, bool hasNext)
: MakerNote(alloc),
: MakerNote(alloc),
absShift_(true), shift_(0), start_(0), ifd_(ifdId, 0, alloc, hasNext)
{
}
@ -78,8 +78,8 @@ namespace Exiv2 {
}
int IfdMakerNote::read(const byte* buf,
long len,
long start,
long len,
long start,
ByteOrder byteOrder,
long shift)
{
@ -132,7 +132,7 @@ namespace Exiv2 {
return len;
} // IfdMakerNote::copy
int IfdMakerNote::readHeader(const byte* buf,
int IfdMakerNote::readHeader(const byte* buf,
long len,
ByteOrder byteOrder)
{
@ -141,7 +141,7 @@ namespace Exiv2 {
}
void IfdMakerNote::updateBase(byte* pNewBase)
{
{
if (absShift_) {
ifd_.updateBase(pNewBase);
}
@ -164,9 +164,9 @@ namespace Exiv2 {
return header_.size_;
}
Entries::const_iterator IfdMakerNote::findIdx(int idx) const
Entries::const_iterator IfdMakerNote::findIdx(int idx) const
{
return ifd_.findIdx(idx);
return ifd_.findIdx(idx);
}
long IfdMakerNote::size() const
@ -253,12 +253,12 @@ namespace Exiv2 {
return i->second->create(alloc);
} // MakerNoteFactory::create
void MakerNoteFactory::registerMakerNote(const std::string& make,
const std::string& model,
void MakerNoteFactory::registerMakerNote(const std::string& make,
const std::string& model,
CreateFct createMakerNote)
{
#ifdef DEBUG_REGISTRY
std::cerr << "Registering MakerNote create function for \""
std::cerr << "Registering MakerNote create function for \""
<< make << "\" and \"" << model << "\".\n";
#endif
init();
@ -293,16 +293,16 @@ namespace Exiv2 {
}
} // MakerNoteFactory::registerMakerNote
MakerNote::AutoPtr MakerNoteFactory::create(const std::string& make,
MakerNote::AutoPtr MakerNoteFactory::create(const std::string& make,
const std::string& model,
bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
#ifdef DEBUG_REGISTRY
std::cerr << "Entering MakerNoteFactory::create(\""
std::cerr << "Entering MakerNoteFactory::create(\""
<< make << "\", \"" << model << "\", "
<< (alloc == true ? "true" : "false") << ")\n";
#endif
@ -311,7 +311,7 @@ namespace Exiv2 {
ModelRegistry* pModelRegistry = 0;
#ifdef DEBUG_REGISTRY
std::string makeMatch;
std::cerr << "Searching make registry...\n";
std::cerr << "Searching make registry...\n";
#endif
assert(pRegistry_ != 0);
Registry::const_iterator end1 = pRegistry_->end();
@ -362,7 +362,7 @@ namespace Exiv2 {
const std::string& key)
{
#ifdef DEBUG_REGISTRY
std::cerr << " Matching registry entry \"" << regEntry << "\" ("
std::cerr << " Matching registry entry \"" << regEntry << "\" ("
<< (int)regEntry.size() << ") with key \"" << key << "\" ("
<< (int)key.size() << "): ";
#endif
@ -398,11 +398,11 @@ namespace Exiv2 {
}
bool found = false;
// Find the substr ss in the key starting from index ki.
// Find the substr ss in the key starting from index ki.
// Take care of the special cases
// + where the substr must match the key from beg to end,
// + from beg,
// + to end
// + to end
// + and where it can be anywhere in the key.
// If found, ki is adjusted to the position in the key after ss.
if (ei == 0 && pos == std::string::npos) { // ei == 0 => ki == 0
@ -418,7 +418,7 @@ namespace Exiv2 {
}
}
else if (pos == std::string::npos) {
if ( ss.size() <= uKey.size()
if ( ss.size() <= uKey.size()
&& ki <= uKey.size() - ss.size()) {
if (0 == uKey.compare(
uKey.size() - ss.size(), ss.size(), ss)) {
@ -428,7 +428,7 @@ namespace Exiv2 {
}
}
else {
std::string::size_type idx = uKey.find(ss, ki);
std::string::size_type idx = uKey.find(ss, ki);
if (idx != std::string::npos) {
found = true;
ki = idx + ss.size();
@ -454,7 +454,7 @@ namespace Exiv2 {
std::cerr << "Match (score: " << count + 1 << ")\n";
#endif
return count + 1;
} // MakerNoteFactory::match
} // namespace Exiv2

@ -1,26 +1,26 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*!
@file makernote.hpp
@brief Contains the Exif %MakerNote interface, IFD %MakerNote and a
@brief Contains the Exif %MakerNote interface, IFD %MakerNote and a
MakerNote factory
@version $Rev$
@author Andreas Huggel (ahu)
@ -68,7 +68,7 @@ namespace Exiv2 {
MakerNote holds methods and functionality to
- read the makernote from a character buffer
- copy the makernote to a character buffer
- maintain a list of makernote entries (similar to IFD entries)
- maintain a list of makernote entries (similar to IFD entries)
- interpret (print) the values of makernote tags
Makernotes can be added to the system by subclassing %MakerNote and
@ -78,18 +78,18 @@ namespace Exiv2 {
subclass IfdMakerNote is provided. It contains an IFD container and
implements all interface methods related to the makernote entries. <BR>
To implement a new IFD makernote, all that you need to do is
- subclass %IfdMakerNote,
To implement a new IFD makernote, all that you need to do is
- subclass %IfdMakerNote,
- implement methods to read and check the header (if any) as well as
clone and create functions,
- add a list of tag descriptions and appropriate print functions and
- register the camera make/model and create function in the makernote factory.
- add a list of tag descriptions and appropriate print functions and
- register the camera make/model and create function in the makernote factory.
.
See existing makernote implementations for examples, e.g., CanonMakerNote
or FujiMakerNote.
Finally, the header file which defines the static variable
\em register*MakerNote needs to be included from mn.hpp, to ensure that
Finally, the header file which defines the static variable
\em register*MakerNote needs to be included from mn.hpp, to ensure that
the makernote is automatically registered in the factory.
*/
class MakerNote {
@ -106,7 +106,7 @@ namespace Exiv2 {
//! @name Creators
//@{
/*!
@brief Constructor. Allows to choose whether or not memory management
@brief Constructor. Allows to choose whether or not memory management
is required for the Entries.
*/
explicit MakerNote(bool alloc =true);
@ -117,11 +117,11 @@ namespace Exiv2 {
//! @name Manipulators
//@{
/*!
@brief Read the makernote, including the makernote header, from the
@brief Read the makernote, including the makernote header, from the
Exif data buffer.
@param buf Pointer to the Exif data buffer that contains the
MakerNote to decode. The buffer should contain all Exif
@param buf Pointer to the Exif data buffer that contains the
MakerNote to decode. The buffer should contain all Exif
data starting from the TIFF header.
@param len Number of bytes in the Exif data buffer
@param start MakerNote starts at buf + start.
@ -130,13 +130,13 @@ namespace Exiv2 {
@return 0 if successful.
*/
virtual int read(const byte* buf,
long len,
virtual int read(const byte* buf,
long len,
long start,
ByteOrder byteOrder,
long shift =0) =0;
/*!
@brief Copy (write) the makerNote to the character buffer buf at
@brief Copy (write) the makerNote to the character buffer buf at
position offset (from the start of the TIFF header), encoded
in byte order byteOrder. Update internal offsets if necessary.
Return the number of bytes written.
@ -145,7 +145,7 @@ namespace Exiv2 {
/*!
@brief Add the entry to the makernote. No duplicate-check is performed,
i.e., it is possible to add multiple entries with the same tag.
The memory allocation mode of the entry to be added must be the
The memory allocation mode of the entry to be added must be the
same as that of the makernote and the IFD id of the entry must
be set to 'makerIfd'.
*/
@ -155,7 +155,7 @@ namespace Exiv2 {
//! End of the makernote entries
virtual Entries::iterator end() =0;
/*!
@brief Update the base pointer of the %MakerNote and all its entries
@brief Update the base pointer of the %MakerNote and all its entries
to \em pNewBase.
Allows to re-locate the underlying data buffer to a new location
@ -176,7 +176,7 @@ namespace Exiv2 {
copied. The caller owns the new object and the auto-pointer
ensures that it will be deleted.
@param alloc Memory management model for the newly created object.
@param alloc Memory management model for the newly created object.
Indicates if memory required to store data should be allocated
and deallocated (true) or not (false). If false, only pointers
to the buffer provided to read() will be kept. See Ifd for more
@ -188,8 +188,8 @@ namespace Exiv2 {
owns the new object and the auto-pointer ensures that it will
be deleted.
@note In non-alloc mode the clone potentially contains pointers to
the same data buffer as the original.
@note In non-alloc mode the clone potentially contains pointers to
the same data buffer as the original.
Use updateBase(byte* pNewBase) to adjust them.
*/
AutoPtr clone() const;
@ -210,9 +210,9 @@ namespace Exiv2 {
True: requires memory allocation and deallocation, <BR>
False: no memory management needed.
*/
const bool alloc_;
/*!
@brief Offset of the makernote from the start of the TIFF header
const bool alloc_;
/*!
@brief Offset of the makernote from the start of the TIFF header
(for offset()).
*/
long offset_;
@ -248,9 +248,9 @@ namespace Exiv2 {
typedef std::auto_ptr<IfdMakerNote> AutoPtr;
//! @name Creators
//@{
//@{
/*!
@brief Constructor. Requires an %Ifd id and allows to choose whether
@brief Constructor. Requires an %Ifd id and allows to choose whether
or not memory management is needed for the Entries and whether
the IFD has a next pointer.
*/
@ -263,20 +263,20 @@ namespace Exiv2 {
//! @name Manipulators
//@{
virtual int read(const byte* buf,
long len,
long start,
virtual int read(const byte* buf,
long len,
long start,
ByteOrder byteOrder,
long shift);
/*!
@brief Read the makernote header from the makernote databuffer. This
method must set the offset to the start of the IFD (start_), if
method must set the offset to the start of the IFD (start_), if
needed (assuming that the required information is in the header).
Return 0 if successful.
Return 0 if successful.
@note The default implementation does nothing, assuming there is no
header
*/
virtual int readHeader(const byte* buf,
virtual int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
virtual long copy(byte* buf, ByteOrder byteOrder, long offset);
@ -303,14 +303,14 @@ namespace Exiv2 {
*/
virtual int checkHeader() const;
/*!
@brief Write the makernote header to a character buffer, return the
@brief Write the makernote header to a character buffer, return the
number of characters written.
@note The default implementation copies the header_ buffer.
*/
virtual long copyHeader(byte* buf) const;
/*!
/*!
@brief Return the size of the makernote header in bytes.
@note The default implementation returns the size of the header_
@note The default implementation returns the size of the header_
buffer.
*/
virtual long headerSize() const;
@ -322,7 +322,7 @@ namespace Exiv2 {
@brief True: IFD offsets are relative to the start of the TIFF
header (i.e., the start of the Exif data section)
+ shift_
False: IFD offsets are relative to the start of the
False: IFD offsets are relative to the start of the
makernote + shift_
*/
bool absShift_;
@ -373,13 +373,13 @@ namespace Exiv2 {
make tag.)
@param model Camera model. (Typically the string from the Exif
model tag.)
@param createMakerNote Pointer to a function to create a new
@param createMakerNote Pointer to a function to create a new
%MakerNote of a particular type.
*/
static void registerMakerNote(const std::string& make,
const std::string& model,
static void registerMakerNote(const std::string& make,
const std::string& model,
CreateFct createMakerNote);
//! Register a %MakerNote prototype in the IFD id registry.
static void registerMakerNote(IfdId ifdId, MakerNote::AutoPtr makerNote);
@ -415,24 +415,24 @@ namespace Exiv2 {
if memory required to store data should be allocated and
deallocated (true) or not (false). If false, only pointers to
the buffer provided to read() will be kept. See Ifd for more
background on this concept.
@param buf Pointer to the makernote character buffer.
@param len Length of the makernote character buffer.
@param byteOrder Byte order in which the Exif data (and possibly the
background on this concept.
@param buf Pointer to the makernote character buffer.
@param len Length of the makernote character buffer.
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded.
@param offset Offset from the start of the TIFF header of the makernote
buffer.
@return An auto-pointer that owns a %MakerNote for the camera model.
@return An auto-pointer that owns a %MakerNote for the camera model.
If the camera is not supported, the pointer is 0.
*/
static MakerNote::AutoPtr create(const std::string& make,
const std::string& model,
bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
static MakerNote::AutoPtr create(const std::string& make,
const std::string& model,
bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
//! Create a %MakerNote for an IFD id.
static MakerNote::AutoPtr create(IfdId ifdId, bool alloc =true);
@ -444,20 +444,20 @@ namespace Exiv2 {
registry entry are supported. The best match is an exact match, then
a match is rated according to the number of matching characters.
@return A score value indicating how good the key and registry entry
@return A score value indicating how good the key and registry entry
match. 0 means no match, values greater than 0 indicate a
match, larger values are better matches:<BR>
0: key and registry entry do not match<BR>
1: a pure wildcard match, i.e., the registry entry is just
1: a pure wildcard match, i.e., the registry entry is just
a wildcard.<BR>
Score values greater than 1 are computed by adding 1 to the
number of matching characters, except for an exact match,
Score values greater than 1 are computed by adding 1 to the
number of matching characters, except for an exact match,
which scores 2 plus the number of matching characters.
*/
static int match(const std::string& regEntry, const std::string& key);
/*!
@brief Class Init is used to execute initialisation and termination
@brief Class Init is used to execute initialisation and termination
code exactly once, at the begin and end of the program.
See Bjarne Stroustrup, 'The C++ Programming Language 3rd
@ -467,7 +467,7 @@ namespace Exiv2 {
static int count; //!< Counts calls to constructor
public:
//! @name Creators
//@{
//@{
//! Perform one-time initialisations.
Init();
//! Perform one-time cleanup operations.
@ -477,7 +477,7 @@ namespace Exiv2 {
private:
//! @name Creators
//@{
//@{
//! Prevent construction: not implemented.
MakerNoteFactory() {}
//! Prevent copy construction: not implemented.
@ -501,7 +501,7 @@ namespace Exiv2 {
static IfdIdRegistry* pIfdIdRegistry_;
}; // class MakerNoteFactory
} // namespace Exiv2
namespace {

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -57,7 +57,7 @@ try {
Exiv2::BasicIo::AutoPtr fileIo(new Exiv2::FileIo(params.read_));
Exiv2::BasicIo::AutoPtr memIo(new Exiv2::MemIo);
memIo->transfer(*fileIo);
Exiv2::Image::AutoPtr readImg = Exiv2::ImageFactory::open(memIo);
assert(readImg.get() != 0);
readImg->readMetadata();
@ -79,7 +79,7 @@ try {
writeImg->writeMetadata();
}
catch (const Exiv2::AnyError&) {
std::cerr << params.progname() <<
std::cerr << params.progname() <<
": Could not write metadata to (" << params.write_ << ")\n";
return 8;
}
@ -101,31 +101,31 @@ int Params::option(int opt, const std::string& optarg, int optopt)
case 'e': exif_ = true; break;
case 'c': comment_ = true; break;
case 'p': preserve_ = true; break;
case 'a':
iptc_ =true;
exif_ =true;
comment_ =true;
case 'a':
iptc_ =true;
exif_ =true;
comment_ =true;
break;
case ':':
std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
<< " requires an argument\n";
rc = 1;
break;
case '?':
std::cerr << progname() << ": Unrecognized option -"
std::cerr << progname() << ": Unrecognized option -"
<< static_cast<char>(optopt) << "\n";
rc = 1;
break;
default:
std::cerr << progname()
<< ": getopt returned unexpected character code "
std::cerr << progname()
<< ": getopt returned unexpected character code "
<< std::hex << opt << "\n";
rc = 1;
break;
}
return rc;
}
}
int Params::nonoption(const std::string& argv)
{
@ -137,10 +137,10 @@ int Params::nonoption(const std::string& argv)
else write_ = argv;
first_ = false;
return 0;
}
}
int Params::getopt(int argc, char* const argv[])
{
{
int rc = Util::Getopt::getopt(argc, argv, optstring_);
// Further consistency checks
if (help_==false) {
@ -164,7 +164,7 @@ int Params::getopt(int argc, char* const argv[])
void Params::usage(std::ostream& os) const
{
os << "\nReads and writes raw metadata. Use -h option for help.\n"
<< "Usage: " << progname()
<< "Usage: " << progname()
<< " [-iecaph] readfile writefile\n";
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -50,7 +50,7 @@ public:
*/
Params() : optstring_(":iecaph"),
first_(true),
help_(false),
help_(false),
iptc_(false),
exif_(false),
comment_(false),

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -42,43 +42,43 @@ EXIV2_RCSID("@(#) $Id$");
// *****************************************************************************
// class member definitions
namespace Exiv2 {
Key::AutoPtr Key::clone() const
{
return AutoPtr(clone_());
}
Key& Key::operator=(const Key& /*rhs*/)
Key& Key::operator=(const Key& /*rhs*/)
{
return *this;
return *this;
}
Metadatum::Metadatum()
{
}
Metadatum::Metadatum(const Metadatum& /*rhs*/)
Metadatum::Metadatum(const Metadatum& /*rhs*/)
{
}
Metadatum::~Metadatum()
Metadatum::~Metadatum()
{
}
Metadatum& Metadatum::operator=(const Metadatum& /*rhs*/)
Metadatum& Metadatum::operator=(const Metadatum& /*rhs*/)
{
return *this;
return *this;
}
std::ostream& operator<<(std::ostream& os, const Metadatum& md)
{
os << "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << md.tag() << " "
<< std::hex << md.tag() << " "
<< std::setw(40) << std::setfill(' ') << std::left
<< md.key() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< md.typeName() << " "
<< std::dec << md.value()
<< std::dec << md.value()
<< "\n";
return os;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -24,7 +24,7 @@
@version $Rev$
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@author Brad Schick (brad)
@author Brad Schick (brad)
<a href="mailto:brad@robotbattle.com">brad@robotbattle.com</a>
@date 09-Jan-04, ahu: created<BR>
31-Jul-04, brad: isolated as a component<BR>
@ -87,10 +87,10 @@ namespace Exiv2 {
will be deleted.
*/
AutoPtr clone() const;
/*!
/*!
@brief Write the key to an output stream. You do not usually have
to use this function; it is used for the implementation of
the output operator for %Key,
to use this function; it is used for the implementation of
the output operator for %Key,
operator<<(std::ostream &os, const Key &key).
*/
std::ostream& write(std::ostream& os) const { return os << key(); }
@ -142,7 +142,7 @@ namespace Exiv2 {
*/
virtual void setValue(const Value* pValue) =0;
/*!
@brief Set the value to the string buf.
@brief Set the value to the string buf.
Uses Value::read(const std::string& buf). If the metadatum does
not have a value yet, then an AsciiValue is created.
*/
@ -212,22 +212,22 @@ namespace Exiv2 {
caller owns this copy and the auto-poiner ensures that it will
be deleted.
This method is provided for users who need full control over the
This method is provided for users who need full control over the
value. A caller may, e.g., downcast the pointer to the appropriate
subclass of Value to make use of the interface of the subclass to set
or modify its contents.
@return An auto-pointer containing a pointer to a copy (clone) of the
@return An auto-pointer containing a pointer to a copy (clone) of the
value, 0 if the value is not set.
*/
virtual Value::AutoPtr getValue() const =0;
/*!
@brief Return a constant reference to the value.
@brief Return a constant reference to the value.
This method is provided mostly for convenient and versatile output of
the value which can (to some extent) be formatted through standard
stream manipulators. Do not attempt to write to the value through
this reference.
this reference.
<b>Example:</b> <br>
@code
@ -269,7 +269,7 @@ namespace Exiv2 {
private:
std::string key_;
}; // class FindMetadatumByTag

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

@ -2,21 +2,21 @@
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
* Lens database to decode Exif.Nikon3.LensData
* Lens database to decode Exif.Nikon3.LensData
* Copyright (C) 2005 Robert Rottmerhusen <email@rottmerhusen.com>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -103,7 +103,7 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
Nikon1MakerNote* Nikon1MakerNote::create_(bool alloc) const
Nikon1MakerNote* Nikon1MakerNote::create_(bool alloc) const
{
return new Nikon1MakerNote(alloc);
}
@ -113,7 +113,7 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
Nikon1MakerNote* Nikon1MakerNote::clone_() const
Nikon1MakerNote* Nikon1MakerNote::clone_() const
{
return new Nikon1MakerNote(*this);
}
@ -125,7 +125,7 @@ namespace Exiv2 {
os << value.toLong(1);
}
else {
os << "(" << value << ")";
os << "(" << value << ")";
}
return os;
}
@ -133,7 +133,7 @@ namespace Exiv2 {
std::ostream& Nikon1MakerNote::print0x0007(std::ostream& os,
const Value& value)
{
std::string focus = value.toString();
std::string focus = value.toString();
if (focus == "AF-C ") os << "Continuous autofocus";
else if (focus == "AF-S ") os << "Single autofocus";
else os << "(" << value << ")";
@ -196,7 +196,7 @@ namespace Exiv2 {
}
}
else {
os << "(" << value << ")";
os << "(" << value << ")";
}
return os;
}
@ -243,7 +243,7 @@ namespace Exiv2 {
}
int Nikon2MakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 8) return 1;
@ -259,7 +259,7 @@ namespace Exiv2 {
int rc = 0;
// Check the Nikon prefix
if ( header_.size_ < 8
|| std::string(reinterpret_cast<char*>(header_.pData_), 6)
|| std::string(reinterpret_cast<char*>(header_.pData_), 6)
!= std::string("Nikon\0", 6)) {
rc = 2;
}
@ -271,9 +271,9 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
Nikon2MakerNote* Nikon2MakerNote::create_(bool alloc) const
Nikon2MakerNote* Nikon2MakerNote::create_(bool alloc) const
{
AutoPtr makerNote(new Nikon2MakerNote(alloc));
AutoPtr makerNote(new Nikon2MakerNote(alloc));
assert(makerNote.get() != 0);
makerNote->readHeader(header_.pData_, header_.size_, byteOrder_);
return makerNote.release();
@ -284,7 +284,7 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
Nikon2MakerNote* Nikon2MakerNote::clone_() const
Nikon2MakerNote* Nikon2MakerNote::clone_() const
{
return new Nikon2MakerNote(*this);
}
@ -465,7 +465,7 @@ namespace Exiv2 {
{
absShift_ = false;
byte buf[] = {
'N', 'i', 'k', 'o', 'n', '\0',
'N', 'i', 'k', 'o', 'n', '\0',
0x02, 0x10, 0x00, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08
};
readHeader(buf, 18, byteOrder_);
@ -477,7 +477,7 @@ namespace Exiv2 {
}
int Nikon3MakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 18) return 1;
@ -497,7 +497,7 @@ namespace Exiv2 {
int rc = 0;
// Check the Nikon prefix
if ( header_.size_ < 18
|| std::string(reinterpret_cast<char*>(header_.pData_), 6)
|| std::string(reinterpret_cast<char*>(header_.pData_), 6)
!= std::string("Nikon\0", 6)) {
rc = 2;
}
@ -509,9 +509,9 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
Nikon3MakerNote* Nikon3MakerNote::create_(bool alloc) const
Nikon3MakerNote* Nikon3MakerNote::create_(bool alloc) const
{
AutoPtr makerNote(new Nikon3MakerNote(alloc));
AutoPtr makerNote(new Nikon3MakerNote(alloc));
assert(makerNote.get() != 0);
makerNote->readHeader(header_.pData_, header_.size_, byteOrder_);
return makerNote.release();
@ -522,7 +522,7 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
Nikon3MakerNote* Nikon3MakerNote::clone_() const
Nikon3MakerNote* Nikon3MakerNote::clone_() const
{
return new Nikon3MakerNote(*this);
}
@ -534,12 +534,12 @@ namespace Exiv2 {
os << value.toLong(1);
}
else {
os << "(" << value << ")";
os << "(" << value << ")";
}
return os;
}
std::ostream& Nikon3MakerNote::print0x0012(std::ostream& os,
std::ostream& Nikon3MakerNote::print0x0012(std::ostream& os,
const Value& value)
{
// From the PHP JPEG Metadata Toolkit
@ -579,13 +579,13 @@ namespace Exiv2 {
if (len2 != len1) {
os << "-" << len2;
}
os << "mm ";
os << "mm ";
std::ostringstream oss;
oss.copyfmt(os);
os << "F" << std::setprecision(2)
os << "F" << std::setprecision(2)
<< static_cast<float>(fno1.first) / fno1.second;
if (fno2 != fno1) {
os << "-" << std::setprecision(2)
os << "-" << std::setprecision(2)
<< static_cast<float>(fno2.first) / fno2.second;
}
os.copyfmt(oss);
@ -613,7 +613,7 @@ namespace Exiv2 {
std::ostream& Nikon3MakerNote::print0x0088(std::ostream& os,
const Value& value)
{
// Mappings taken from Exiftool
// Mappings taken from Exiftool
long afpos = value.toLong();
switch (afpos) {
case 0x0000: os << "Center"; break;
@ -621,7 +621,7 @@ namespace Exiv2 {
case 0x0200: os << "Bottom"; break;
case 0x0300: os << "Left"; break;
case 0x0400: os << "Right"; break;
// D70
case 0x00001: os << "Single area, center"; break;
case 0x10002: os << "Single area, top"; break;
@ -849,7 +849,7 @@ namespace Exiv2 {
idx = 6;
}
else if (0 == memcmp(lens.pData_, "0101", 4)) {
idx = 11;
idx = 11;
}
else if (0 == memcmp(lens.pData_, "0201", 4)) {
// Here we should decrypt(lens.pData_ + 4, lens.size_ - 4);
@ -875,7 +875,7 @@ namespace Exiv2 {
}
// Lens not found in database
return os << value;
#else
#else
return os << value;
#endif // EXV_HAVE_LENSDATA
}
@ -884,25 +884,25 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createNikonMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
// If there is no "Nikon" string it must be Nikon1 format
if (len < 6 || std::string(reinterpret_cast<const char*>(buf), 6)
if (len < 6 || std::string(reinterpret_cast<const char*>(buf), 6)
!= std::string("Nikon\0", 6)) {
return MakerNote::AutoPtr(new Nikon1MakerNote(alloc));
}
// If the "Nikon" string is not followed by a TIFF header, we assume
// Nikon2 format
TiffHeader tiffHeader;
if ( len < 18
if ( len < 18
|| tiffHeader.read(buf + 10) != 0 || tiffHeader.tag() != 0x002a) {
return MakerNote::AutoPtr(new Nikon2MakerNote(alloc));
return MakerNote::AutoPtr(new Nikon2MakerNote(alloc));
}
// Else we have a Nikon3 makernote
return MakerNote::AutoPtr(new Nikon3MakerNote(alloc));
return MakerNote::AutoPtr(new Nikon3MakerNote(alloc));
}
} // namespace Exiv2

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -23,16 +23,16 @@
@brief Nikon MakerNote formats.
The Nikon MakerNote formats are implemented according to the following references<BR>
Format 1:
Format 1:
<ul>
<li><a href="http://www.tawbaware.com/990exif.htm">MakerNote EXIF Tag of the Nikon 990</a> by Max Lyons</li></ul>
Format 2:
<ul><li>"Appendix 2: Makernote of Nikon" of the document
Format 2:
<ul><li>"Appendix 2: Makernote of Nikon" of the document
<a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html">
Exif file format</a> by TsuruZoh Tachibanaya</li></ul>
Format 3:
Format 3:
<ul><li>"EXIFutils Field Reference Guide"</li>
<li><a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/nikon_mn.html#Nikon_Type_3_Tags">Nikon Type 3 Makernote Tags Definition</a>
<li><a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/nikon_mn.html#Nikon_Type_3_Tags">Nikon Type 3 Makernote Tags Definition</a>
of the PHP JPEG Metadata Toolkit by Evan Hunter</li>
<li>Nikon tag information from <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey</li>
<li>Email communication with <a href="http://www.rottmerhusen.com">Robert Rottmerhusen</a></li>
@ -74,27 +74,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createNikonMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -125,7 +125,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Nikon1 %MakerNote tags
//! @name Print functions for Nikon1 %MakerNote tags
//@{
//! Print ISO setting
static std::ostream& print0x0002(std::ostream& os, const Value& value);
@ -160,9 +160,9 @@ namespace Exiv2 {
static Nikon1MakerNote::RegisterMn registerNikon1MakerNote;
/*!
@brief A second MakerNote format used by Nikon cameras, including the
@brief A second MakerNote format used by Nikon cameras, including the
E700, E800, E900, E900S, E910, E950
*/
*/
class Nikon2MakerNote : public IfdMakerNote {
public:
//! Shortcut for a %Nikon2MakerNote auto pointer.
@ -182,8 +182,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -195,7 +195,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Nikon2 %MakerNote tags
//! @name Print functions for Nikon2 %MakerNote tags
//@{
//! Print quality setting
static std::ostream& print0x0003(std::ostream& os, const Value& value);
@ -252,7 +252,7 @@ namespace Exiv2 {
//! @name Manipulators
//@{
int readHeader(const byte* buf,
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -264,7 +264,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Nikon3 %MakerNote tags
//! @name Print functions for Nikon3 %MakerNote tags
//@{
//! Print ISO setting
static std::ostream& print0x0002(std::ostream& os, const Value& value);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -52,7 +52,7 @@ namespace Exiv2 {
OlympusMakerNote::RegisterMn::RegisterMn()
{
MakerNoteFactory::registerMakerNote(
"OLYMPUS*", "*", createOlympusMakerNote);
"OLYMPUS*", "*", createOlympusMakerNote);
MakerNoteFactory::registerMakerNote(
olympusIfdId, MakerNote::AutoPtr(new OlympusMakerNote));
@ -149,11 +149,11 @@ namespace Exiv2 {
}
int OlympusMakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 8) return 1;
// Copy the header
header_.alloc(8);
memcpy(header_.pData_, buf, header_.size_);
@ -167,7 +167,7 @@ namespace Exiv2 {
int rc = 0;
// Check the OLYMPUS prefix
if ( header_.size_ < 8
|| std::string(reinterpret_cast<char*>(header_.pData_), 5)
|| std::string(reinterpret_cast<char*>(header_.pData_), 5)
!= std::string("OLYMP", 5)) {
rc = 2;
}
@ -192,12 +192,12 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
OlympusMakerNote* OlympusMakerNote::clone_() const
OlympusMakerNote* OlympusMakerNote::clone_() const
{
return new OlympusMakerNote(*this);
return new OlympusMakerNote(*this);
}
std::ostream& OlympusMakerNote::print0x0200(std::ostream& os,
std::ostream& OlympusMakerNote::print0x0200(std::ostream& os,
const Value& value)
{
if (value.count() != 3 || value.typeId() != unsignedLong) {
@ -239,7 +239,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& OlympusMakerNote::print0x0201(std::ostream& os,
std::ostream& OlympusMakerNote::print0x0201(std::ostream& os,
const Value& value)
{
return TagTranslator(quality).print(os, value);
@ -254,13 +254,13 @@ namespace Exiv2 {
{ -1, "(end)" }
};
std::ostream& OlympusMakerNote::print0x0202(std::ostream& os,
std::ostream& OlympusMakerNote::print0x0202(std::ostream& os,
const Value& value)
{
return TagTranslator(macro).print(os, value);
} // OlympusMakerNote::print0x0202
std::ostream& OlympusMakerNote::print0x0204(std::ostream& os,
std::ostream& OlympusMakerNote::print0x0204(std::ostream& os,
const Value& value)
{
float f = value.toFloat();
@ -281,7 +281,7 @@ namespace Exiv2 {
{ -1, "(end)" }
};
std::ostream& OlympusMakerNote::print0x0302(std::ostream& os,
std::ostream& OlympusMakerNote::print0x0302(std::ostream& os,
const Value& value)
{
return TagTranslator(oneTouchWb).print(os, value);
@ -297,7 +297,7 @@ namespace Exiv2 {
{ -1, "(end)" }
};
std::ostream& OlympusMakerNote::print0x1005(std::ostream& os,
std::ostream& OlympusMakerNote::print0x1005(std::ostream& os,
const Value& value)
{
return TagTranslator(flashDevice).print(os, value);
@ -307,9 +307,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createOlympusMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new OlympusMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -21,9 +21,9 @@
/*!
@file olympusmn.hpp
@brief Olympus MakerNote implemented using the following references:
<a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html#APP1">Exif file format, Appendix 1: MakerNote of Olympus Digicams</a> by TsuruZoh Tachibanaya,
Olympus.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey,
<a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html">Olympus Makernote Format Specification</a> by Evan Hunter,
<a href="http://park2.wakwak.com/%7Etsuruzoh/Computer/Digicams/exif-e.html#APP1">Exif file format, Appendix 1: MakerNote of Olympus Digicams</a> by TsuruZoh Tachibanaya,
Olympus.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey,
<a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html">Olympus Makernote Format Specification</a> by Evan Hunter,
email communication with <a href="mailto:wstokes@gmail.com">Will Stokes</a>
@version $Rev$
@author Andreas Huggel (ahu)
@ -62,27 +62,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createOlympusMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -108,8 +108,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -121,7 +121,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Olympus %MakerNote tags
//! @name Print functions for Olympus %MakerNote tags
//@{
//! Print 'Special Mode'
static std::ostream& print0x0200(std::ostream& os, const Value& value);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -107,7 +107,7 @@ namespace Exiv2 {
}
int PanasonicMakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 12) return 1;
@ -124,7 +124,7 @@ namespace Exiv2 {
int rc = 0;
// Check the Panasonic prefix
if ( header_.size_ < 12
|| std::string(reinterpret_cast<char*>(header_.pData_), 9)
|| std::string(reinterpret_cast<char*>(header_.pData_), 9)
!= std::string("Panasonic", 9)) {
rc = 2;
}
@ -136,7 +136,7 @@ namespace Exiv2 {
return AutoPtr(create_(alloc));
}
PanasonicMakerNote* PanasonicMakerNote::create_(bool alloc) const
PanasonicMakerNote* PanasonicMakerNote::create_(bool alloc) const
{
AutoPtr makerNote = AutoPtr(new PanasonicMakerNote(alloc));
assert(makerNote.get() != 0);
@ -149,7 +149,7 @@ namespace Exiv2 {
return AutoPtr(clone_());
}
PanasonicMakerNote* PanasonicMakerNote::clone_() const
PanasonicMakerNote* PanasonicMakerNote::clone_() const
{
return new PanasonicMakerNote(*this);
}
@ -164,7 +164,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x0001(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0001(std::ostream& os,
const Value& value)
{
return TagTranslator(quality).print(os, value);
@ -183,7 +183,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x0003(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0003(std::ostream& os,
const Value& value)
{
return TagTranslator(whiteBalance).print(os, value);
@ -197,13 +197,13 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x0007(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0007(std::ostream& os,
const Value& value)
{
return TagTranslator(focusMode).print(os, value);
} // PanasonicMakerNote::print0x0007
std::ostream& PanasonicMakerNote::print0x000f(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x000f(std::ostream& os,
const Value& value)
{
if (value.count() < 2 || value.typeId() != unsignedByte) {
@ -225,7 +225,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x001a(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x001a(std::ostream& os,
const Value& value)
{
return TagTranslator(imageStabilizer).print(os, value);
@ -239,7 +239,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x001c(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x001c(std::ostream& os,
const Value& value)
{
return TagTranslator(macro).print(os, value);
@ -266,7 +266,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x001f(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x001f(std::ostream& os,
const Value& value)
{
return TagTranslator(shootingMode).print(os, value);
@ -280,18 +280,18 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x0020(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0020(std::ostream& os,
const Value& value)
{
return TagTranslator(Audio).print(os, value);
} // PanasonicMakerNote::print0x0020
std::ostream& PanasonicMakerNote::print0x0023(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0023(std::ostream& os,
const Value& value)
{
std::ostringstream oss;
oss.copyfmt(os);
os << std::fixed << std::setprecision(1)
os << std::fixed << std::setprecision(1)
<< value.toLong() / 3 << " EV";
os.copyfmt(oss);
@ -310,7 +310,7 @@ namespace Exiv2 {
{ 0, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x0028(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x0028(std::ostream& os,
const Value& value)
{
return TagTranslator(colorEffect).print(os, value);
@ -328,7 +328,7 @@ namespace Exiv2 {
{ -1, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x002c(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x002c(std::ostream& os,
const Value& value)
{
return TagTranslator(contrast).print(os, value);
@ -343,7 +343,7 @@ namespace Exiv2 {
{ -1, "(end)" }
};
std::ostream& PanasonicMakerNote::print0x002d(std::ostream& os,
std::ostream& PanasonicMakerNote::print0x002d(std::ostream& os,
const Value& value)
{
return TagTranslator(noiseReduction).print(os, value);
@ -353,9 +353,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createPanasonicMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new PanasonicMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -21,8 +21,8 @@
/*!
@file panasonicmn.hpp
@brief Panasonic MakerNote implemented using the following references:
<a href="http://www.compton.nu/panasonic.html">Panasonic MakerNote Information</a> by Tom Hughes,
Panasonic.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey,
<a href="http://www.compton.nu/panasonic.html">Panasonic MakerNote Information</a> by Tom Hughes,
Panasonic.pm of <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey,
<a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html">Panasonic Makernote Format Specification</a> by Evan Hunter.
@version $Rev$
@author Andreas Huggel (ahu)
@ -59,27 +59,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createPanasonicMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -105,8 +105,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -118,7 +118,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Panasonic %MakerNote tags
//! @name Print functions for Panasonic %MakerNote tags
//@{
//! Print Quality
static std::ostream& print0x0001(std::ostream& os, const Value& value);

@ -12,7 +12,7 @@ int main(int argc, char* const argv[])
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " file\n";
return 1;
}
}
std::ifstream file(argv[1]);
if (!file) {
std::cerr << *argv[1] << ": Failed to open file for reading\n";
@ -27,7 +27,7 @@ int main(int argc, char* const argv[])
std::string b = Util::basename(path);
if (d != dir || b != base) {
std::cout << path << "\t'" << d << "'\t '" << b
std::cout << path << "\t'" << d << "'\t '" << b
<< "'\t ==> Testcase failed\n";
}
}

@ -1,29 +1,29 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*!
@file rcsid.hpp
@brief Define an RCS id string in every object file compiled from a source
@brief Define an RCS id string in every object file compiled from a source
file that includes rcsid.hpp.
This is a simplified version of the ACE_RCSID macro that is used in the
This is a simplified version of the ACE_RCSID macro that is used in the
<a href="http://www.cs.wustl.edu/~schmidt/ACE.html">ACE(TM)</a> distribution.
@version $Rev$
@ -36,7 +36,7 @@
#if !defined (EXIV2_RCSID)
/*!
@brief Macro to store version information in each object file.
@brief Macro to store version information in each object file.
Use this macro by including the following two lines at the beginning of
each *.cpp file. See the ident(1) manual pages for more information.

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -51,7 +51,7 @@ namespace Exiv2 {
//! @cond IGNORE
SigmaMakerNote::RegisterMn::RegisterMn()
{
MakerNoteFactory::registerMakerNote("SIGMA", "*", createSigmaMakerNote);
MakerNoteFactory::registerMakerNote("SIGMA", "*", createSigmaMakerNote);
MakerNoteFactory::registerMakerNote("FOVEON", "*", createSigmaMakerNote);
MakerNoteFactory::registerMakerNote(
sigmaIfdId, MakerNote::AutoPtr(new SigmaMakerNote));
@ -104,7 +104,7 @@ namespace Exiv2 {
}
int SigmaMakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 10) return 1;
@ -124,9 +124,9 @@ namespace Exiv2 {
int rc = 0;
// Check the SIGMA or FOVEON prefix
if ( header_.size_ < 10
|| std::string(reinterpret_cast<char*>(header_.pData_), 8)
|| std::string(reinterpret_cast<char*>(header_.pData_), 8)
!= std::string("SIGMA\0\0\0", 8)
&& std::string(reinterpret_cast<char*>(header_.pData_), 8)
&& std::string(reinterpret_cast<char*>(header_.pData_), 8)
!= std::string("FOVEON\0\0", 8)) {
rc = 2;
}
@ -197,9 +197,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createSigmaMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new SigmaMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -22,7 +22,7 @@
@file sigmamn.hpp
@brief Sigma and Foveon MakerNote implemented according to the specification
<a href="http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html">
SIGMA and FOVEON EXIF MakerNote Documentation</a> by Foveon.
SIGMA and FOVEON EXIF MakerNote Documentation</a> by Foveon.
@version $Rev$
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@ -58,27 +58,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createSigmaMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -104,8 +104,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}
@ -117,7 +117,7 @@ namespace Exiv2 {
AutoPtr clone() const;
//@}
//! @name Print functions for Sigma (Foveon) %MakerNote tags
//! @name Print functions for Sigma (Foveon) %MakerNote tags
//@{
//! Strip the label from the value and print the remainder
static std::ostream& printStripLabel(std::ostream& os, const Value& value);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -48,10 +48,10 @@ namespace Exiv2 {
//! @cond IGNORE
SonyMakerNote::RegisterMn::RegisterMn()
{
MakerNoteFactory::registerMakerNote("SONY", "*", createSonyMakerNote);
MakerNoteFactory::registerMakerNote("SONY", "*", createSonyMakerNote);
MakerNoteFactory::registerMakerNote(
sonyIfdId, MakerNote::AutoPtr(new SonyMakerNote));
ExifTags::registerMakerTagInfo(sonyIfdId, tagInfo_);
}
//! @endcond
@ -86,7 +86,7 @@ namespace Exiv2 {
}
int SonyMakerNote::readHeader(const byte* buf,
long len,
long len,
ByteOrder byteOrder)
{
if (len < 12) return 1;
@ -102,7 +102,7 @@ namespace Exiv2 {
int rc = 0;
// Check the SONY prefix
if ( header_.size_ < 12
|| std::string(reinterpret_cast<char*>(header_.pData_), 12)
|| std::string(reinterpret_cast<char*>(header_.pData_), 12)
!= std::string("SONY DSC \0\0\0", 12)) {
rc = 2;
}
@ -136,9 +136,9 @@ namespace Exiv2 {
// free functions
MakerNote::AutoPtr createSonyMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset)
{
return MakerNote::AutoPtr(new SonyMakerNote(alloc));

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -56,27 +56,27 @@ namespace Exiv2 {
initialized to operate in the memory management model indicated.
The caller owns this copy and the auto-pointer ensures that it
will be deleted.
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
@param buf Pointer to the makernote character buffer (not used).
@param len Length of the makernote character buffer (not used).
@param byteOrder Byte order in which the Exif data (and possibly the
makernote) is encoded (not used).
@param offset Offset from the start of the TIFF header of the makernote
buffer (not used).
@return An auto-pointer to a newly created empty MakerNote. The caller
owns this copy and the auto-pointer ensures that it will be
deleted.
*/
MakerNote::AutoPtr createSonyMakerNote(bool alloc,
const byte* buf,
long len,
ByteOrder byteOrder,
const byte* buf,
long len,
ByteOrder byteOrder,
long offset);
// *****************************************************************************
@ -102,8 +102,8 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
int readHeader(const byte* buf,
//@{
int readHeader(const byte* buf,
long len,
ByteOrder byteOrder);
//@}

@ -57,7 +57,7 @@ try {
break;
}
if (rc) {
std::cout << "Usage: " << argv[0]
std::cout << "Usage: " << argv[0]
<< " [Exif|Canon|CanonCs1|CanonCs2|CanonCf|Fujifilm|Nikon1|Nikon2|Nikon3|Olympus|Sigma|Sony|Iptc]\n"
<< "Print Exif tags, MakerNote tags, or Iptc datasets\n";
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -109,14 +109,14 @@ namespace Exiv2 {
};
TagInfo::TagInfo(
uint16_t tag,
const char* name,
const char* title,
const char* desc,
IfdId ifdId,
uint16_t tag,
const char* name,
const char* title,
const char* desc,
IfdId ifdId,
SectionId sectionId,
TypeId typeId,
PrintFct printFct
PrintFct printFct
)
: tag_(tag), name_(name), title_(title), desc_(desc), ifdId_(ifdId),
sectionId_(sectionId), typeId_(typeId), printFct_(printFct)
@ -274,7 +274,7 @@ namespace Exiv2 {
// End of list marker
TagInfo(0xffff, "(UnknownGpsTag)", "Unknown GPSInfo tag", "Unknown GPSInfo tag", ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
};
// Exif Interoperability IFD Tags
static const TagInfo iopTagInfo[] = {
TagInfo(0x0001, "InteroperabilityIndex", "InteroperabilityIndex", "Interoperability Identification", iopIfdId, iopTags, asciiString, printValue),
@ -311,8 +311,8 @@ namespace Exiv2 {
// this is an array with pointers to one list per IFD. The IfdId is used as the
// index into the array.
const TagInfo* ExifTags::tagInfos_[] = {
0,
ifdTagInfo, exifTagInfo, gpsTagInfo, iopTagInfo, ifdTagInfo,
0,
ifdTagInfo, exifTagInfo, gpsTagInfo, iopTagInfo, ifdTagInfo,
0
};
@ -364,7 +364,7 @@ namespace Exiv2 {
return 0;
} // ExifTags::makerTagInfo
const TagInfo* ExifTags::makerTagInfo(const std::string& tagName,
const TagInfo* ExifTags::makerTagInfo(const std::string& tagName,
IfdId ifdId)
{
int i = 0;
@ -533,13 +533,13 @@ namespace Exiv2 {
}
std::ostream& ExifTags::printTag(std::ostream& os,
uint16_t tag,
uint16_t tag,
IfdId ifdId,
const Value& value)
{
if (value.count() == 0) return os;
PrintFct fct = printValue;
if (isExifIfd(ifdId)) {
if (isExifIfd(ifdId)) {
int idx = tagInfoIdx(tag, ifdId);
if (idx != -1) {
fct = tagInfos_[ifdId][idx].printFct_;
@ -605,7 +605,7 @@ namespace Exiv2 {
}
ExifKey::ExifKey(const Entry& e)
: tag_(e.tag()), ifdId_(e.ifdId()),
: tag_(e.tag()), ifdId_(e.ifdId()),
ifdItem_(ExifTags::ifdItem(e.ifdId())),
idx_(e.idx()), key_("")
{
@ -636,9 +636,9 @@ namespace Exiv2 {
std::string ExifKey::tagName() const
{
return ExifTags::tagName(tag_, ifdId_);
return ExifTags::tagName(tag_, ifdId_);
}
ExifKey::AutoPtr ExifKey::clone() const
{
return AutoPtr(clone_());
@ -649,9 +649,9 @@ namespace Exiv2 {
return new ExifKey(*this);
}
std::string ExifKey::sectionName() const
std::string ExifKey::sectionName() const
{
return ExifTags::sectionName(tag(), ifdId());
return ExifTags::sectionName(tag(), ifdId());
}
void ExifKey::decomposeKey()
@ -680,7 +680,7 @@ namespace Exiv2 {
}
// Convert tag
uint16_t tag = ExifTags::tag(tagName, ifdId);
// Translate hex tag name (0xabcd) to a real tag name if there is one
tagName = ExifTags::tagName(tag, ifdId);
@ -692,11 +692,11 @@ namespace Exiv2 {
void ExifKey::makeKey()
{
key_ = std::string(familyName_)
key_ = std::string(familyName_)
+ "." + ifdItem_
+ "." + ExifTags::tagName(tag_, ifdId_);
}
// *************************************************************************
// free functions
@ -714,46 +714,46 @@ namespace Exiv2 {
return rc;
} // isExifIfd
std::ostream& operator<<(std::ostream& os, const TagInfo& ti)
std::ostream& operator<<(std::ostream& os, const TagInfo& ti)
{
ExifKey exifKey(ti.tag_, ExifTags::ifdItem(ti.ifdId_));
return os << ExifTags::tagName(ti.tag_, ti.ifdId_) << ", "
<< std::dec << ti.tag_ << ", "
<< "0x" << std::setw(4) << std::setfill('0')
<< "0x" << std::setw(4) << std::setfill('0')
<< std::right << std::hex << ti.tag_ << ", "
<< ExifTags::ifdName(ti.ifdId_) << ", "
<< exifKey.key() << ", "
<< exifKey.key() << ", "
<< TypeInfo::typeName(
ExifTags::tagType(ti.tag_, ti.ifdId_)) << ", "
<< ExifTags::tagDesc(ti.tag_, ti.ifdId_);
}
std::ostream& operator<<(std::ostream& os, const Rational& r)
std::ostream& operator<<(std::ostream& os, const Rational& r)
{
return os << r.first << "/" << r.second;
}
std::istream& operator>>(std::istream& is, Rational& r)
{
std::istream& operator>>(std::istream& is, Rational& r)
{
int32_t nominator;
int32_t denominator;
char c;
is >> nominator >> c >> denominator;
is >> nominator >> c >> denominator;
if (is && c == '/') r = std::make_pair(nominator, denominator);
return is;
}
std::ostream& operator<<(std::ostream& os, const URational& r)
{
std::ostream& operator<<(std::ostream& os, const URational& r)
{
return os << r.first << "/" << r.second;
}
std::istream& operator>>(std::istream& is, URational& r)
std::istream& operator>>(std::istream& is, URational& r)
{
uint32_t nominator;
uint32_t denominator;
char c;
is >> nominator >> c >> denominator;
is >> nominator >> c >> denominator;
if (is && c == '/') r = std::make_pair(nominator, denominator);
return is;
}
@ -998,7 +998,7 @@ namespace Exiv2 {
else {
os << "(" << value << ")";
}
return os;
return os;
}
std::ostream& print0x9207(std::ostream& os, const Value& value)

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -60,8 +60,8 @@ namespace Exiv2 {
@brief Section identifiers to logically group tags. A section consists
of nothing more than a name, based on the Exif standard.
*/
enum SectionId { sectionIdNotSet,
imgStruct, recOffset, imgCharacter, otherTags, exifFormat,
enum SectionId { sectionIdNotSet,
imgStruct, recOffset, imgCharacter, otherTags, exifFormat,
exifVersion, imgConfig, userInfo, relatedFile, dateTime,
captureCond, gpsTags, iopTags, makerTags,
lastSectionId };
@ -76,7 +76,7 @@ namespace Exiv2 {
IfdId ifdId_; //!< IFD id
const char* name_; //!< IFD name
//! Related IFD item. This is also an IFD name, unique for each IFD.
const char* item_;
const char* item_;
};
//! Contains information pertaining to one section
@ -92,10 +92,10 @@ namespace Exiv2 {
struct TagInfo {
//! Constructor
TagInfo(
uint16_t tag,
uint16_t tag,
const char* name,
const char* title,
const char* desc,
const char* desc,
IfdId ifdId,
SectionId sectionId,
TypeId typeId,
@ -112,7 +112,7 @@ namespace Exiv2 {
}; // struct TagInfo
/*!
@brief Helper structure for lookup tables for translations of numeric
@brief Helper structure for lookup tables for translations of numeric
tag values to human readable labels.
*/
struct TagDetails {
@ -154,14 +154,14 @@ namespace Exiv2 {
public:
/*!
@brief Return the name of the tag or a string with the hexadecimal
value of the tag in the form "0x01ff", if the tag is not
a known Exif tag.
@brief Return the name of the tag or a string with the hexadecimal
value of the tag in the form "0x01ff", if the tag is not
a known Exif tag.
@param tag The tag
@param ifdId IFD id
@return The name of the tag or a string containing the hexadecimal
value of the tag in the form "0x01ff", if this is an unknown
value of the tag in the form "0x01ff", if this is an unknown
tag.
*/
static std::string tagName(uint16_t tag, IfdId ifdId);
@ -178,12 +178,12 @@ namespace Exiv2 {
@param tag The tag
@param ifdId IFD id
@return The description of the tag or a string indicating that
the tag is unknown.
the tag is unknown.
*/
static const char* tagDesc(uint16_t tag, IfdId ifdId);
/*!
@brief Return the tag for one combination of IFD id and tagName.
If the tagName is not known, it expects tag names in the
@brief Return the tag for one combination of IFD id and tagName.
If the tagName is not known, it expects tag names in the
form "0x01ff" and converts them to unsigned integer.
@throw Error if the tagname or ifdId is invalid
@ -198,21 +198,21 @@ namespace Exiv2 {
//! Return the name of the section
static const char* sectionName(SectionId sectionId);
/*!
@brief Return the name of the section for a combination of
@brief Return the name of the section for a combination of
tag and IFD id.
@param tag The tag
@param ifdId IFD id
@return The name of the section or a string indicating that the
section or the tag is unknown.
@return The name of the section or a string indicating that the
section or the tag is unknown.
*/
static const char* sectionName(uint16_t tag, IfdId ifdId);
/*!
@brief Return the description of the section for a combination of
@brief Return the description of the section for a combination of
tag and IFD id.
@param tag The tag
@param ifdId IFD id
@return The description of the section or a string indicating that
the section or the tag is unknown.
the section or the tag is unknown.
*/
static const char* sectionDesc(uint16_t tag, IfdId ifdId);
//! Return the section id for a section name
@ -221,7 +221,7 @@ namespace Exiv2 {
static TypeId tagType(uint16_t tag, IfdId ifdId);
//! Interpret and print the value of an Exif tag
static std::ostream& printTag(std::ostream& os,
uint16_t tag,
uint16_t tag,
IfdId ifdId,
const Value& value);
//! Print a list of all standard Exif tags to output stream
@ -238,7 +238,7 @@ namespace Exiv2 {
static void registerMakerTagInfo(IfdId ifdId, const TagInfo* tagInfo);
/*!
@brief Return true if \em ifdId is an %Ifd Id which is registered
as a makernote %Ifd id. Note: Calling this function with
as a makernote %Ifd id. Note: Calling this function with
makerIfd returns false.
*/
static bool isMakerIfd(IfdId ifdId);
@ -246,7 +246,7 @@ namespace Exiv2 {
private:
static int tagInfoIdx(uint16_t tag, IfdId ifdId);
static const TagInfo* makerTagInfo(uint16_t tag, IfdId ifdId);
static const TagInfo* makerTagInfo(const std::string& tagName,
static const TagInfo* makerTagInfo(const std::string& tagName,
IfdId ifdId);
static const IfdInfo ifdInfo_[];
@ -276,14 +276,14 @@ namespace Exiv2 {
@param key The key string.
@throw Error if the first part of the key is not '<b>Exif</b>' or
the remainin parts of the key cannot be parsed and
converted to an ifd-item and tag name.
converted to an ifd-item and tag name.
*/
explicit ExifKey(const std::string& key);
/*!
@brief Constructor to create an Exif key from a tag and IFD item
@brief Constructor to create an Exif key from a tag and IFD item
string.
@param tag The tag value
@param ifdItem The IFD string. For MakerNote tags, this must be the
@param ifdItem The IFD string. For MakerNote tags, this must be the
IFD item of the specific MakerNote. "MakerNote" is not allowed.
@throw Error if the key cannot be constructed from the tag and IFD
item parameters.
@ -311,7 +311,7 @@ namespace Exiv2 {
/*!
@brief Return the name of the group (the second part of the key).
For Exif keys, the group name is the IFD item.
*/
*/
virtual std::string groupName() const { return ifdItem(); }
virtual std::string tagName() const;
virtual uint16_t tag() const { return tag_; }
@ -323,7 +323,7 @@ namespace Exiv2 {
const char* ifdName() const { return ExifTags::ifdName(ifdId()); }
//! Return the related image item
std::string ifdItem() const { return ifdItem_; }
//! Return the name of the Exif section (deprecated)
//! Return the name of the Exif section (deprecated)
std::string sectionName() const;
//! Return the index (unique id of this key within the original IFD)
int idx() const { return idx_; }
@ -333,12 +333,12 @@ namespace Exiv2 {
//! @name Manipulators
//@{
/*!
@brief Set the key corresponding to the tag and IFD id.
@brief Set the key corresponding to the tag and IFD id.
The key is of the form '<b>Exif</b>.ifdItem.tagName'.
*/
void makeKey();
/*!
@brief Parse and convert the key string into tag and IFD Id.
@brief Parse and convert the key string into tag and IFD Id.
Updates data members if the string can be decomposed,
or throws \em Error .
@ -348,7 +348,7 @@ namespace Exiv2 {
//@}
private:
//! Internal virtual copy constructor.
//! Internal virtual copy constructor.
virtual ExifKey* clone_() const;
// DATA
@ -356,7 +356,7 @@ namespace Exiv2 {
uint16_t tag_; //!< Tag value
IfdId ifdId_; //!< The IFD associated with this tag
std::string ifdItem_; //!< The IFD item
std::string ifdItem_; //!< The IFD item
int idx_; //!< Unique id of an entry within one IFD
std::string key_; //!< Key
}; // class ExifKey
@ -394,7 +394,7 @@ namespace Exiv2 {
std::ostream& print0x0112(std::ostream& os, const Value& value);
//! Print the YCbCrPositioning
std::ostream& print0x0213(std::ostream& os, const Value& value);
//! Print the copyright
//! Print the copyright
std::ostream& print0x8298(std::ostream& os, const Value& value);
//! Print the exposure time
std::ostream& print0x829a(std::ostream& os, const Value& value);
@ -438,7 +438,7 @@ namespace Exiv2 {
std::ostream& print0xa403(std::ostream& os, const Value& value);
//! Print digital zoom ratio
std::ostream& print0xa404(std::ostream& os, const Value& value);
//! Print 35mm equivalent focal length
//! Print 35mm equivalent focal length
std::ostream& print0xa405(std::ostream& os, const Value& value);
//! Print scene capture type
std::ostream& print0xa406(std::ostream& os, const Value& value);

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -90,14 +90,14 @@ namespace Exiv2 {
{
return typeInfoTable_[ typeId < lastTypeId ? typeId : 0 ].size_;
}
DataBuf::DataBuf(DataBuf& rhs)
: pData_(rhs.pData_), size_(rhs.size_)
{
rhs.release();
}
DataBuf::DataBuf(byte* pData, long size)
DataBuf::DataBuf(byte* pData, long size)
: pData_(0), size_(0)
{
if (size > 0) {
@ -115,12 +115,12 @@ namespace Exiv2 {
}
void DataBuf::alloc(long size)
{
{
if (size > size_) {
delete[] pData_;
size_ = size;
delete[] pData_;
size_ = size;
pData_ = new byte[size];
}
}
}
std::pair<byte*, long> DataBuf::release()
@ -156,11 +156,11 @@ namespace Exiv2 {
uint32_t getULong(const byte* buf, ByteOrder byteOrder)
{
if (byteOrder == littleEndian) {
return (byte)buf[3] << 24 | (byte)buf[2] << 16
return (byte)buf[3] << 24 | (byte)buf[2] << 16
| (byte)buf[1] << 8 | (byte)buf[0];
}
else {
return (byte)buf[0] << 24 | (byte)buf[1] << 16
return (byte)buf[0] << 24 | (byte)buf[1] << 16
| (byte)buf[2] << 8 | (byte)buf[3];
}
}
@ -185,11 +185,11 @@ namespace Exiv2 {
int32_t getLong(const byte* buf, ByteOrder byteOrder)
{
if (byteOrder == littleEndian) {
return (byte)buf[3] << 24 | (byte)buf[2] << 16
return (byte)buf[3] << 24 | (byte)buf[2] << 16
| (byte)buf[1] << 8 | (byte)buf[0];
}
else {
return (byte)buf[0] << 24 | (byte)buf[1] << 16
return (byte)buf[0] << 24 | (byte)buf[1] << 16
| (byte)buf[2] << 8 | (byte)buf[3];
}
}
@ -277,13 +277,13 @@ namespace Exiv2 {
void hexdump(std::ostream& os, const byte* buf, long len, long offset)
{
const std::string::size_type pos = 8 + 16 * 3 + 2;
const std::string align(pos, ' ');
const std::string::size_type pos = 8 + 16 * 3 + 2;
const std::string align(pos, ' ');
long i = 0;
while (i < len) {
os << " "
<< std::setw(4) << std::setfill('0') << std::hex
os << " "
<< std::setw(4) << std::setfill('0') << std::hex
<< i + offset << " ";
std::ostringstream ss;
do {
@ -300,11 +300,11 @@ namespace Exiv2 {
bool isHex(const std::string& str, size_t size, const std::string& prefix)
{
if ( str.size() <= prefix.size()
if ( str.size() <= prefix.size()
|| str.substr(0, prefix.size()) != prefix) return false;
if ( size > 0
&& str.size() != size + prefix.size()) return false;
for (size_t i = prefix.size(); i < str.size(); ++i) {
if (!isxdigit(str[i])) return false;
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -77,25 +77,25 @@ namespace Exiv2 {
enum ByteOrder { invalidByteOrder, littleEndian, bigEndian };
//! Type identifiers for IFD format types
enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
unsignedLong, unsignedRational, invalid6, undefined,
signedShort, signedLong, signedRational,
string, date, time,
comment,
directory,
enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
unsignedLong, unsignedRational, invalid6, undefined,
signedShort, signedLong, signedRational,
string, date, time,
comment,
directory,
lastTypeId };
// Todo: decentralize IfdId, so that new ids can be defined elsewhere
//! Type to specify the IFD to which a metadata belongs
enum IfdId { ifdIdNotSet,
ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id,
enum IfdId { ifdIdNotSet,
ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id,
canonIfdId, canonCs1IfdId, canonCs2IfdId, canonCfIfdId,
fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId,
fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId,
olympusIfdId, panasonicIfdId, sigmaIfdId, sonyIfdId,
lastIfdId };
//! Type to identify where the data is stored in a directory
enum DataLocId { invalidDataLocId,
enum DataLocId { invalidDataLocId,
valueData, directoryData,
lastDataLocId };
@ -108,7 +108,7 @@ namespace Exiv2 {
TypeInfoTable(TypeId typeId, const char* name, long size);
TypeId typeId_; //!< Type id
const char* name_; //!< Name of the type
long size_; //!< Bytes per data entry
long size_; //!< Bytes per data entry
}; // struct TypeInfoTable
//! Type information lookup functions. Implemented as a static class.
@ -157,12 +157,12 @@ namespace Exiv2 {
//@{
//! Default constructor
DataBuf() : pData_(0), size_(0) {}
//! Constructor with an initial buffer size
//! Constructor with an initial buffer size
explicit DataBuf(long size) : pData_(new byte[size]), size_(size) {}
//! Constructor, copies an existing buffer
DataBuf(byte* pData, long size);
/*!
@brief Copy constructor. Transfers the buffer to the newly created
/*!
@brief Copy constructor. Transfers the buffer to the newly created
object similar to std::auto_ptr, i.e., the original object is
modified.
*/
@ -175,14 +175,14 @@ namespace Exiv2 {
//@{
/*!
@brief Assignment operator. Transfers the buffer and releases the
buffer at the original object similar to std::auto_ptr, i.e.,
buffer at the original object similar to std::auto_ptr, i.e.,
the original object is modified.
*/
DataBuf& operator=(DataBuf& rhs);
//! Allocate a data buffer of the given size
void alloc(long size);
/*!
@brief Release ownership of the buffer to the caller. Returns the
@brief Release ownership of the buffer to the caller. Returns the
buffer as a data pointer and size pair, resets the internal
buffer.
*/
@ -194,7 +194,7 @@ namespace Exiv2 {
/*!
@name Conversions
Special conversions with auxiliary type to enable copies
Special conversions with auxiliary type to enable copies
and assignments, similar to those used for std::auto_ptr.
See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.
*/
@ -208,7 +208,7 @@ namespace Exiv2 {
//! Pointer to the buffer, 0 if none has been allocated
byte* pData_;
//! The current size of the buffer
long size_;
long size_;
}; // class DataBuf
@ -238,7 +238,7 @@ namespace Exiv2 {
std::istream& operator>>(std::istream& is, URational& r);
/*!
@brief Convert an unsigned short to data, write the data to the buffer,
@brief Convert an unsigned short to data, write the data to the buffer,
return number of bytes written.
*/
long us2Data(byte* buf, uint16_t s, ByteOrder byteOrder);
@ -253,7 +253,7 @@ namespace Exiv2 {
*/
long ur2Data(byte* buf, URational l, ByteOrder byteOrder);
/*!
@brief Convert a signed short to data, write the data to the buffer,
@brief Convert a signed short to data, write the data to the buffer,
return number of bytes written.
*/
long s2Data(byte* buf, int16_t s, ByteOrder byteOrder);
@ -277,10 +277,10 @@ namespace Exiv2 {
/*!
@brief Return true if str is a hex number starting with prefix followed
by size hex digits, false otherwise. If size is 0, any number of
by size hex digits, false otherwise. If size is 0, any number of
digits is allowed and all are checked.
*/
bool isHex(const std::string& str,
bool isHex(const std::string& str,
size_t size =0,
const std::string& prefix ="");
@ -288,7 +288,7 @@ namespace Exiv2 {
// template and inline definitions
//! Utility function to convert the argument of any type to a string
template<typename T>
template<typename T>
std::string toString(const T& arg)
{
std::ostringstream os;
@ -300,8 +300,8 @@ namespace Exiv2 {
@brief Return the greatest common denominator of n and m.
(implementation from Boost rational.hpp)
@note We use n and m as temporaries in this function, so there is no
value in using const IntType& as we would only need to make a copy
@note We use n and m as temporaries in this function, so there is no
value in using const IntType& as we would only need to make a copy
anyway...
*/
template <typename IntType>
@ -309,7 +309,7 @@ namespace Exiv2 {
{
// Avoid repeated construction
IntType zero(0);
// This is abs() - given the existence of broken compilers with Koenig
// lookup issues and other problems, I code this explicitly. (Remember,
// IntType may be a user-defined type).

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -72,12 +72,12 @@ namespace Util {
for (int i = ::optind; i < argc; i++) {
errcnt_ += nonoption(argv[i]);
}
return errcnt_;
return errcnt_;
}
int Getopt::nonoption(const std::string& /*argv*/)
{
return 0;
return 0;
}
// *****************************************************************************
@ -88,7 +88,7 @@ namespace Util {
if (path == "") return ".";
// Strip trailing slashes or backslashes
std::string p = path;
while ( p.length() > 1
while ( p.length() > 1
&& (p[p.length()-1] == '\\' || p[p.length()-1] == '/')) {
p = p.substr(0, p.length()-1);
}
@ -98,7 +98,7 @@ namespace Util {
if (idx == std::string::npos) return ".";
if (idx == 1 && p[0] == '\\' && p[1] == '\\') return p; // For Windows paths
p = p.substr(0, idx == 0 ? 1 : idx);
while ( p.length() > 1
while ( p.length() > 1
&& (p[p.length()-1] == '\\' || p[p.length()-1] == '/')) {
p = p.substr(0, p.length()-1);
}
@ -110,7 +110,7 @@ namespace Util {
if (path == "") return ".";
// Strip trailing slashes or backslashes
std::string p = path;
while ( p.length() > 1
while ( p.length() > 1
&& (p[p.length()-1] == '\\' || p[p.length()-1] == '/')) {
p = p.substr(0, p.length()-1);
}
@ -124,7 +124,7 @@ namespace Util {
std::string suffix(const std::string& path)
{
std::string b = basename(path);
std::string b = basename(path);
std::string::size_type idx = b.rfind('.');
if (idx == std::string::npos || idx == 0 || idx == b.length()-1) {
return "";

@ -1,19 +1,19 @@
// ********************************************************* -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -37,8 +37,8 @@
// *********************************************************************
// namespace extensions
/*!
@brief Contains utility classes and functions. Most of these are
wrappers for common C functions that do not require pointers
@brief Contains utility classes and functions. Most of these are
wrappers for common C functions that do not require pointers
and memory considerations.
*/
namespace Util {
@ -77,13 +77,13 @@ public:
@param argv Argument array as passed to main() on program invocation.
@param optstring String containing the legitimate option characters.
@return Number of errors (the sum of the return values from option()
@return Number of errors (the sum of the return values from option()
and nonoption()).
*/
int getopt(int argc, char* const argv[], const std::string& optstring);
/*!
@brief Callback used by getopt() to pass on each option and its
@brief Callback used by getopt() to pass on each option and its
argument (if any).
Implement this method in a derived class to handle the options as
@ -128,32 +128,32 @@ private:
// free functions
/*!
@brief Get the directory component from the \em path string.
@brief Get the directory component from the \em path string.
See %dirname(3).
This function can handle Windows paths to some extent: c:\\bar should
This function can handle Windows paths to some extent: c:\\bar should
be fine, \\\\bigsrv\\foo also, but \\\\bigsrv alone doesn't work.
*/
std::string dirname(const std::string& path);
/*!
@brief Get the filename component from the \em path string.
@brief Get the filename component from the \em path string.
See %basename(3). If the \em delsuffix parameter is true,
the suffix will be removed.
This function can handle Windows paths to some extent: c:\\bar should
be fine, \\\\bigsrv\\foo also, but \\\\bigsrv alone doesn't work.
This function can handle Windows paths to some extent: c:\\bar should
be fine, \\\\bigsrv\\foo also, but \\\\bigsrv alone doesn't work.
*/
std::string basename(const std::string& path, bool delsuffix =false);
/*!
@brief Get the suffix from the path string. Normally, the suffix
is the substring of the basename of path from the last '.'
is the substring of the basename of path from the last '.'
to the end of the string.
*/
std::string suffix(const std::string& path);
/*!
/*!
@brief Convert a C string to a long value, which is returned in n.
Returns true if the conversion is successful, else false.
n is not modified if the conversion is unsuccessful. See strtol(2).

@ -86,8 +86,8 @@ void testPaths()
void testPath(const std::string& path)
{
std::cout << std::setw(15) << path << " "
<< std::setw(15) << Util::dirname(path) << " "
<< std::setw(15) << Util::basename(path) << " "
std::cout << std::setw(15) << path << " "
<< std::setw(15) << Util::dirname(path) << " "
<< std::setw(15) << Util::basename(path) << " "
<< std::setw(15) << Util::suffix(path) << "\n";
}

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -110,9 +110,9 @@ namespace Exiv2 {
return value;
} // Value::create
int Value::setDataArea(const byte* /*buf*/, long /*len*/)
int Value::setDataArea(const byte* /*buf*/, long /*len*/)
{
return -1;
return -1;
}
std::string Value::toString() const
@ -188,7 +188,7 @@ namespace Exiv2 {
void StringValueBase::read(const byte* buf, long len, ByteOrder byteOrder)
{
// byteOrder not needed
// byteOrder not needed
value_ = std::string(reinterpret_cast<const char*>(buf), len);
}
@ -248,7 +248,7 @@ namespace Exiv2 {
}
CommentValue::CharsetTable::CharsetTable(CharsetId charsetId,
const char* name,
const char* name,
const char* code)
: charsetId_(charsetId), name_(name), code_(code)
{
@ -348,15 +348,15 @@ namespace Exiv2 {
const std::string code = value_.substr(0, 8);
charsetId = CharsetInfo::charsetIdByCode(code);
}
return charsetId;
return charsetId;
}
CommentValue* CommentValue::clone_() const
{
return new CommentValue(*this);
return new CommentValue(*this);
}
DateValue::DateValue(int year, int month, int day)
DateValue::DateValue(int year, int month, int day)
: Value(date)
{
date_.year = year;
@ -376,22 +376,22 @@ namespace Exiv2 {
void DateValue::read(const byte* buf, long len, ByteOrder byteOrder)
{
// byteOrder not needed
// byteOrder not needed
// Hard coded to read Iptc style dates
if (len != 8) throw Error(29);
int scanned = sscanf(reinterpret_cast<const char*>(buf),
"%4d%2d%2d",
int scanned = sscanf(reinterpret_cast<const char*>(buf),
"%4d%2d%2d",
&date_.year, &date_.month, &date_.day);
if (scanned != 3) throw Error(29);
}
void DateValue::read(const std::string& buf)
{
// byteOrder not needed
// byteOrder not needed
// Hard coded to read Iptc style dates
if (buf.length() < 8) throw Error(29);
int scanned = sscanf(buf.data(),
"%4d-%d-%d",
int scanned = sscanf(buf.data(),
"%4d-%d-%d",
&date_.year, &date_.month, &date_.day);
if (scanned != 3) throw Error(29);
}
@ -402,14 +402,14 @@ namespace Exiv2 {
date_.month = src.month;
date_.day = src.day;
}
long DateValue::copy(byte* buf, ByteOrder byteOrder) const
{
// byteOrder not needed
// sprintf wants to add the null terminator, so use oversized buffer
char temp[9];
int wrote = sprintf( temp, "%04d%02d%02d",
int wrote = sprintf( temp, "%04d%02d%02d",
date_.year, date_.month, date_.day);
assert(wrote == 8);
memcpy(buf, temp, 8);
@ -433,7 +433,7 @@ namespace Exiv2 {
<< std::setw(2) << std::setfill('0') << date_.day;
}
long DateValue::toLong(long n) const
long DateValue::toLong(long n) const
{
// Range of tm struct is limited to about 1970 to 2038
// This will return -1 if outside that range
@ -445,8 +445,8 @@ namespace Exiv2 {
return static_cast<long>(std::mktime(&tms));
}
TimeValue::TimeValue(int hour, int minute,
int second, int tzHour,
TimeValue::TimeValue(int hour, int minute,
int second, int tzHour,
int tzMinute)
: Value(date)
{
@ -467,13 +467,13 @@ namespace Exiv2 {
void TimeValue::read(const byte* buf, long len, ByteOrder byteOrder)
{
// byteOrder not needed
// byteOrder not needed
// Hard coded to read Iptc style times
if (len != 11) throw Error(30);
char plusMinus;
int scanned = sscanf(reinterpret_cast<const char*>(buf),
"%2d%2d%2d%1c%2d%2d",
&time_.hour, &time_.minute, &time_.second,
int scanned = sscanf(reinterpret_cast<const char*>(buf),
"%2d%2d%2d%1c%2d%2d",
&time_.hour, &time_.minute, &time_.second,
&plusMinus, &time_.tzHour, &time_.tzMinute );
if (scanned != 6) throw Error(30);
@ -485,13 +485,13 @@ namespace Exiv2 {
void TimeValue::read(const std::string& buf)
{
// byteOrder not needed
// byteOrder not needed
// Hard coded to read Iptc style times
if (buf.length() < 9) throw Error(30);
char plusMinus;
int scanned = sscanf(buf.data(),
"%d:%d:%d%1c%d:%d",
&time_.hour, &time_.minute, &time_.second,
"%d:%d:%d%1c%d:%d",
&time_.hour, &time_.minute, &time_.second,
&plusMinus, &time_.tzHour, &time_.tzMinute );
if (scanned != 6) throw Error(30);
@ -505,7 +505,7 @@ namespace Exiv2 {
{
memcpy(&time_, &src, sizeof(time_));
}
long TimeValue::copy(byte* buf, ByteOrder byteOrder) const
{
// byteOrder not needed
@ -514,9 +514,9 @@ namespace Exiv2 {
char plusMinus = '+';
if (time_.tzHour < 0 || time_.tzMinute < 0) plusMinus = '-';
int wrote = sprintf(temp,
"%02d%02d%02d%1c%02d%02d",
time_.hour, time_.minute, time_.second,
int wrote = sprintf(temp,
"%02d%02d%02d%1c%02d%02d",
time_.hour, time_.minute, time_.second,
plusMinus, abs(time_.tzHour), abs(time_.tzMinute));
assert(wrote == 11);
@ -538,7 +538,7 @@ namespace Exiv2 {
{
char plusMinus = '+';
if (time_.tzHour < 0 || time_.tzMinute < 0) plusMinus = '-';
return os << std::right
<< std::setw(2) << std::setfill('0') << time_.hour << ':'
<< std::setw(2) << std::setfill('0') << time_.minute << ':'
@ -547,9 +547,9 @@ namespace Exiv2 {
<< std::setw(2) << std::setfill('0') << abs(time_.tzMinute);
}
long TimeValue::toLong(long n) const
long TimeValue::toLong(long n) const
{
// Returns number of seconds in the day in UTC.
// Returns number of seconds in the day in UTC.
long result = (time_.hour - time_.tzHour) * 60 * 60;
result += (time_.minute - time_.tzMinute) * 60;
result += time_.second;

@ -1,19 +1,19 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004, 2005 Andreas Huggel <ahuggel@gmx.net>
*
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -50,7 +50,7 @@ namespace Exiv2 {
// class definitions
/*!
@brief Common interface for all types of values used with metadata.
@brief Common interface for all types of values used with metadata.
The interface provides a uniform way to access values independent from
their actual C++ type for simple tasks like reading the values from a
@ -66,7 +66,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Constructor, taking a type id to initialize the base class with
explicit Value(TypeId typeId)
explicit Value(TypeId typeId)
: type_(typeId) {}
//! Copy constructor
Value(const Value& rhs)
@ -81,14 +81,14 @@ namespace Exiv2 {
@brief Read the value from a character buffer.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Applicable byte order (little or big endian).
*/
virtual void read(const byte* buf, long len, ByteOrder byteOrder) =0;
/*!
/*!
@brief Set the value from a string buffer. The format of the string
corresponds to that of the write() method, i.e., a string
obtained through the write() method can be read by this
obtained through the write() method can be read by this
function.
@param buf The string to read from.
@ -115,12 +115,12 @@ namespace Exiv2 {
TypeId typeId() const { return type_; }
/*!
@brief Return the value as a string. Implemented in terms of
write(std::ostream& os) const of the concrete class.
write(std::ostream& os) const of the concrete class.
*/
std::string toString() const;
/*!
@brief Return an auto-pointer to a copy of itself (deep copy).
The caller owns this copy and the auto-pointer ensures that
The caller owns this copy and the auto-pointer ensures that
it will be deleted.
*/
AutoPtr clone() const { return AutoPtr(clone_()); }
@ -139,10 +139,10 @@ namespace Exiv2 {
virtual long count() const =0;
//! Return the size of the value in bytes
virtual long size() const =0;
/*!
/*!
@brief Write the value to an output stream. You do not usually have
to use this function; it is used for the implementation of
the output operator for %Value,
to use this function; it is used for the implementation of
the output operator for %Value,
operator<<(std::ostream &os, const Value &value).
*/
virtual std::ostream& write(std::ostream& os) const =0;
@ -151,7 +151,7 @@ namespace Exiv2 {
behaviour of this method may be undefined if there is no
n-th component.
@return The converted value.
@return The converted value.
*/
virtual long toLong(long n =0) const =0;
/*!
@ -159,7 +159,7 @@ namespace Exiv2 {
behaviour of this method may be undefined if there is no
n-th component.
@return The converted value.
@return The converted value.
*/
virtual float toFloat(long n =0) const =0;
/*!
@ -167,7 +167,7 @@ namespace Exiv2 {
behaviour of this method may be undefined if there is no
n-th component.
@return The converted value.
@return The converted value.
*/
virtual Rational toRational(long n =0) const =0;
//! Return the size of the data area, 0 if there is none.
@ -175,7 +175,7 @@ namespace Exiv2 {
/*!
@brief Return a copy of the data area if the value has one. The
caller owns this copy and DataBuf ensures that it will be
deleted.
deleted.
Values may have a data area, which can contain additional
information besides the actual value. This method is used to access
@ -251,7 +251,7 @@ namespace Exiv2 {
//! Constructor
DataValue(const byte* buf,
long len, ByteOrder byteOrder =invalidByteOrder,
TypeId typeId =undefined)
TypeId typeId =undefined)
: Value(typeId) { read(buf, len, byteOrder); }
//! Virtual destructor.
virtual ~DataValue() {}
@ -262,17 +262,17 @@ namespace Exiv2 {
//! Assignment operator.
DataValue& operator=(const DataValue& rhs);
/*!
@brief Read the value from a character buffer.
@brief Read the value from a character buffer.
@note The byte order is required by the interface but not
@note The byte order is required by the interface but not
used by this method, so just use the default.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Byte order. Not needed.
*/
virtual void read(const byte* buf,
long len,
long len,
ByteOrder byteOrder =invalidByteOrder);
//! Set the data from a string of integer values (e.g., "0 1 2 3")
virtual void read(const std::string& buf);
@ -282,7 +282,7 @@ namespace Exiv2 {
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
/*!
@brief Write value to a character data buffer.
@brief Write value to a character data buffer.
@note The byte order is required by the interface but not used by this
method, so just use the default.
@ -313,9 +313,9 @@ namespace Exiv2 {
}; // class DataValue
/*!
@brief Abstract base class for a string based %Value type.
@brief Abstract base class for a string based %Value type.
Uses a std::string to store the value and implements defaults for
Uses a std::string to store the value and implements defaults for
most operations.
*/
class StringValueBase : public Value {
@ -334,7 +334,7 @@ namespace Exiv2 {
//! Copy constructor
StringValueBase(const StringValueBase& rhs)
: Value(rhs), value_(rhs.value_) {}
//! Virtual destructor.
virtual ~StringValueBase() {}
//@}
@ -352,11 +352,11 @@ namespace Exiv2 {
method, so just use the default.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Byte order. Not needed.
*/
virtual void read(const byte* buf,
long len,
virtual void read(const byte* buf,
long len,
ByteOrder byteOrder =invalidByteOrder);
//@}
@ -390,7 +390,7 @@ namespace Exiv2 {
//! Internal virtual copy constructor.
virtual StringValueBase* clone_() const =0;
// DATA
std::string value_; //!< Stores the string value.
std::string value_; //!< Stores the string value.
}; // class StringValueBase
@ -409,12 +409,12 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor.
StringValue()
StringValue()
: StringValueBase(string) {}
//! Constructor
StringValue(const std::string& buf)
StringValue(const std::string& buf)
: StringValueBase(string, buf) {}
//! Copy constructor
//! Copy constructor
StringValue(const StringValue& rhs)
: StringValueBase(rhs) {}
//! Virtual destructor.
@ -438,9 +438,9 @@ namespace Exiv2 {
}; // class StringValue
/*!
@brief %Value for an Ascii string type.
@brief %Value for an Ascii string type.
This class is for null terminated single byte Ascii strings.
This class is for null terminated single byte Ascii strings.
This class also ensures that the string is null terminated.
*/
class AsciiValue : public StringValueBase {
@ -451,10 +451,10 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor.
AsciiValue()
AsciiValue()
: StringValueBase(asciiString) {}
//! Constructor
AsciiValue(const std::string &buf)
AsciiValue(const std::string &buf)
: StringValueBase(asciiString, buf) {}
//! Copy constructor
AsciiValue(const AsciiValue& rhs)
@ -478,7 +478,7 @@ namespace Exiv2 {
//! @name Accessors
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
/*!
/*!
@brief Write the value to an output stream. Any trailing '\\0'
characters of the ASCII value are stripped and not written to
the output stream.
@ -508,12 +508,12 @@ namespace Exiv2 {
//! Information pertaining to the defined character sets
struct CharsetTable {
//! Constructor
CharsetTable(CharsetId charsetId,
const char* name,
CharsetTable(CharsetId charsetId,
const char* name,
const char* code);
CharsetId charsetId_; //!< Charset id
const char* name_; //!< Name of the charset
const char* code_; //!< Code of the charset
const char* code_; //!< Code of the charset
}; // struct CharsetTable
//! Charset information lookup functions. Implemented as a static class.
class CharsetInfo {
@ -523,7 +523,7 @@ namespace Exiv2 {
CharsetInfo(const CharsetInfo&);
//! Prevent assignment: not implemented.
CharsetInfo& operator=(const CharsetInfo&);
public:
//! Return the name for a charset id
static const char* name(CharsetId charsetId);
@ -533,7 +533,7 @@ namespace Exiv2 {
static CharsetId charsetIdByName(const std::string& name);
//! Return the charset id for a code
static CharsetId charsetIdByCode(const std::string& code);
private:
static const CharsetTable charsetTable_[];
}; // class CharsetInfo
@ -548,7 +548,7 @@ namespace Exiv2 {
: StringValueBase(Exiv2::undefined) {}
//! Constructor, uses read(const std::string& comment)
CommentValue(const std::string& comment);
//! Copy constructor
//! Copy constructor
CommentValue(const CommentValue& rhs)
: StringValueBase(rhs) {}
//! Virtual destructor.
@ -561,10 +561,10 @@ namespace Exiv2 {
CommentValue& operator=(const CommentValue& rhs);
/*!
@brief Read the value from a comment
The format of \em comment is:
<BR>
<CODE>[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment</CODE>
<CODE>[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment</CODE>
<BR>
The default charset is Undefined.
@ -577,7 +577,7 @@ namespace Exiv2 {
//@{
AutoPtr clone() const { return AutoPtr(clone_()); }
/*!
@brief Write the comment in a format which can be read by
@brief Write the comment in a format which can be read by
read(const std::string& comment).
*/
std::ostream& write(std::ostream& os) const;
@ -593,7 +593,7 @@ namespace Exiv2 {
}; // class CommentValue
/*!
/*!
@brief %Value for simple ISO 8601 dates
This class is limited to parsing simple date strings in the ISO 8601
@ -615,7 +615,7 @@ namespace Exiv2 {
//@}
//! Simple Date helper structure
struct Date
struct Date
{
int year; //!< Year
int month; //!< Month
@ -633,16 +633,16 @@ namespace Exiv2 {
method, so just use the default.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Byte order. Not needed.
@throw Error in case of an unsupported date format
*/
virtual void read(const byte* buf,
long len,
virtual void read(const byte* buf,
long len,
ByteOrder byteOrder =invalidByteOrder);
/*!
@brief Set the value to that of the string buf.
@brief Set the value to that of the string buf.
@param buf String containing the date
@ -674,12 +674,12 @@ namespace Exiv2 {
virtual const Date& getDate() const { return date_; }
virtual long count() const { return size(); }
virtual long size() const;
/*!
/*!
@brief Write the value to an output stream. .
*/
virtual std::ostream& write(std::ostream& os) const;
virtual long toLong(long n =0) const;
virtual float toFloat(long n =0) const
virtual float toFloat(long n =0) const
{ return static_cast<float>(toLong(n)); }
virtual Rational toRational(long n =0) const
{ return Rational(toLong(n), 1); }
@ -691,7 +691,7 @@ namespace Exiv2 {
// DATA
Date date_;
}; // class DateValue
}; // class DateValue
/*!
@brief %Value for simple ISO 8601 times.
@ -711,7 +711,7 @@ namespace Exiv2 {
//! Default constructor.
TimeValue() : Value(time) { memset(&time_, 0, sizeof(time_)); }
//! Constructor
TimeValue(int hour, int minute, int second =0,
TimeValue(int hour, int minute, int second =0,
int tzHour =0, int tzMinute =0);
//! Virtual destructor.
@ -719,7 +719,7 @@ namespace Exiv2 {
//@}
//! Simple Time helper structure
struct Time
struct Time
{
int hour; //!< Hour
int minute; //!< Minute
@ -739,16 +739,16 @@ namespace Exiv2 {
method, so just use the default.
@param buf Pointer to the data buffer to read from
@param len Number of bytes in the data buffer
@param len Number of bytes in the data buffer
@param byteOrder Byte order. Not needed.
@throw Error in case of an unsupported time format
*/
virtual void read(const byte* buf,
long len,
virtual void read(const byte* buf,
long len,
ByteOrder byteOrder =invalidByteOrder);
/*!
@brief Set the value to that of the string buf.
@brief Set the value to that of the string buf.
@param buf String containing the time.
@ -780,12 +780,12 @@ namespace Exiv2 {
virtual const Time& getTime() const { return time_; }
virtual long count() const { return size(); }
virtual long size() const;
/*!
/*!
@brief Write the value to an output stream. .
*/
virtual std::ostream& write(std::ostream& os) const;
virtual long toLong(long n =0) const;
virtual float toFloat(long n =0) const
virtual float toFloat(long n =0) const
{ return static_cast<float>(toLong(n)); }
virtual Rational toRational(long n =0) const
{ return Rational(toLong(n), 1); }
@ -797,7 +797,7 @@ namespace Exiv2 {
// DATA
Time time_;
}; // class TimeValue
}; // class TimeValue
//! Template to determine the TypeId for a type T
template<typename T> TypeId getType();
@ -818,9 +818,9 @@ namespace Exiv2 {
// template<typename T> inline TypeId getType() { return invalid; }
/*!
@brief Template for a %Value of a basic type. This is used for unsigned
@brief Template for a %Value of a basic type. This is used for unsigned
and signed short, long and rationals.
*/
*/
template<typename T>
class ValueType : public Value {
public:
@ -847,9 +847,9 @@ namespace Exiv2 {
ValueType<T>& operator=(const ValueType<T>& rhs);
virtual void read(const byte* buf, long len, ByteOrder byteOrder);
/*!
@brief Set the data from a string of values of type T (e.g.,
"0 1 2 3" or "1/2 1/3 1/4" depending on what T is).
Generally, the accepted input format is the same as that
@brief Set the data from a string of values of type T (e.g.,
"0 1 2 3" or "1/2 1/3 1/4" depending on what T is).
Generally, the accepted input format is the same as that
produced by the write() method.
*/
virtual void read(const std::string& buf);
@ -879,7 +879,7 @@ namespace Exiv2 {
virtual DataBuf dataArea() const;
//@}
//! Container for values
//! Container for values
typedef std::vector<T> ValueList;
//! Iterator type defined for convenience.
typedef typename std::vector<T>::iterator iterator;
@ -888,9 +888,9 @@ namespace Exiv2 {
// DATA
/*!
@brief The container for all values. In your application, if you know
@brief The container for all values. In your application, if you know
what subclass of Value you're dealing with (and possibly the T)
then you can access this STL container through the usual
then you can access this STL container through the usual
standard library functions.
*/
ValueList value_;
@ -903,7 +903,7 @@ namespace Exiv2 {
//! Pointer to the buffer, 0 if none has been allocated
byte* pDataArea_;
//! The current size of the buffer
long sizeDataArea_;
long sizeDataArea_;
}; // class ValueType
//! Unsigned short value type
@ -925,7 +925,7 @@ namespace Exiv2 {
/*!
@brief Read a value of type T from the data buffer.
We need this template function for the ValueType template classes.
We need this template function for the ValueType template classes.
There are only specializations of this function available; no default
implementation is provided.
@ -935,37 +935,37 @@ namespace Exiv2 {
*/
template<typename T> T getValue(const byte* buf, ByteOrder byteOrder);
// Specialization for a 2 byte unsigned short value.
template<>
template<>
inline uint16_t getValue(const byte* buf, ByteOrder byteOrder)
{
return getUShort(buf, byteOrder);
}
// Specialization for a 4 byte unsigned long value.
template<>
template<>
inline uint32_t getValue(const byte* buf, ByteOrder byteOrder)
{
return getULong(buf, byteOrder);
}
// Specialization for an 8 byte unsigned rational value.
template<>
template<>
inline URational getValue(const byte* buf, ByteOrder byteOrder)
{
return getURational(buf, byteOrder);
}
// Specialization for a 2 byte signed short value.
template<>
template<>
inline int16_t getValue(const byte* buf, ByteOrder byteOrder)
{
return getShort(buf, byteOrder);
}
// Specialization for a 4 byte signed long value.
template<>
template<>
inline int32_t getValue(const byte* buf, ByteOrder byteOrder)
{
return getLong(buf, byteOrder);
}
// Specialization for an 8 byte signed rational value.
template<>
template<>
inline Rational getValue(const byte* buf, ByteOrder byteOrder)
{
return getRational(buf, byteOrder);
@ -974,7 +974,7 @@ namespace Exiv2 {
/*!
@brief Convert a value of type T to data, write the data to the data buffer.
We need this template function for the ValueType template classes.
We need this template function for the ValueType template classes.
There are only specializations of this function available; no default
implementation is provided.
@ -984,20 +984,20 @@ namespace Exiv2 {
@return The number of bytes written to the buffer.
*/
template<typename T> long toData(byte* buf, T t, ByteOrder byteOrder);
/*!
/*!
@brief Specialization to write an unsigned short to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, uint16_t t, ByteOrder byteOrder)
{
return us2Data(buf, t, byteOrder);
}
/*!
/*!
@brief Specialization to write an unsigned long to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, uint32_t t, ByteOrder byteOrder)
{
return ul2Data(buf, t, byteOrder);
@ -1006,25 +1006,25 @@ namespace Exiv2 {
@brief Specialization to write an unsigned rational to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, URational t, ByteOrder byteOrder)
{
return ur2Data(buf, t, byteOrder);
}
/*!
/*!
@brief Specialization to write a signed short to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, int16_t t, ByteOrder byteOrder)
{
return s2Data(buf, t, byteOrder);
}
/*!
/*!
@brief Specialization to write a signed long to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, int32_t t, ByteOrder byteOrder)
{
return l2Data(buf, t, byteOrder);
@ -1033,14 +1033,14 @@ namespace Exiv2 {
@brief Specialization to write a signed rational to the data buffer.
Return the number of bytes written.
*/
template<>
template<>
inline long toData(byte* buf, Rational t, ByteOrder byteOrder)
{
return r2Data(buf, t, byteOrder);
}
template<typename T>
ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder)
ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder)
: Value(getType<T>()), pDataArea_(0), sizeDataArea_(0)
{
read(buf, len, byteOrder);
@ -1048,11 +1048,11 @@ namespace Exiv2 {
template<typename T>
ValueType<T>::ValueType(const T& val, ByteOrder byteOrder)
: Value(getType<T>()), pDataArea_(0), sizeDataArea_(0)
: Value(getType<T>()), pDataArea_(0), sizeDataArea_(0)
{
read(reinterpret_cast<const byte*>(&val),
TypeInfo::typeSize(typeId()),
byteOrder);
read(reinterpret_cast<const byte*>(&val),
TypeInfo::typeSize(typeId()),
byteOrder);
}
template<typename T>
@ -1061,8 +1061,8 @@ namespace Exiv2 {
{
if (rhs.sizeDataArea_ > 0) {
pDataArea_ = new byte[rhs.sizeDataArea_];
memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_);
sizeDataArea_ = rhs.sizeDataArea_;
memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_);
sizeDataArea_ = rhs.sizeDataArea_;
}
}
@ -1082,7 +1082,7 @@ namespace Exiv2 {
byte* tmp = 0;
if (rhs.sizeDataArea_ > 0) {
tmp = new byte[rhs.sizeDataArea_];
memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_);
memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_);
}
delete[] pDataArea_;
pDataArea_ = tmp;
@ -1148,38 +1148,38 @@ namespace Exiv2 {
// Default implementation
template<typename T>
inline long ValueType<T>::toLong(long n) const
{
return value_[n];
{
return value_[n];
}
// Specialization for rational
template<>
inline long ValueType<Rational>::toLong(long n) const
inline long ValueType<Rational>::toLong(long n) const
{
return value_[n].first / value_[n].second;
return value_[n].first / value_[n].second;
}
// Specialization for unsigned rational
template<>
inline long ValueType<URational>::toLong(long n) const
inline long ValueType<URational>::toLong(long n) const
{
return value_[n].first / value_[n].second;
return value_[n].first / value_[n].second;
}
// Default implementation
template<typename T>
inline float ValueType<T>::toFloat(long n) const
{
return static_cast<float>(value_[n]);
{
return static_cast<float>(value_[n]);
}
// Specialization for rational
template<>
inline float ValueType<Rational>::toFloat(long n) const
inline float ValueType<Rational>::toFloat(long n) const
{
return static_cast<float>(value_[n].first) / value_[n].second;
return static_cast<float>(value_[n].first) / value_[n].second;
}
// Specialization for unsigned rational
template<>
inline float ValueType<URational>::toFloat(long n) const
inline float ValueType<URational>::toFloat(long n) const
{
return static_cast<float>(value_[n].first) / value_[n].second;
return static_cast<float>(value_[n].first) / value_[n].second;
}
// Default implementation
template<typename T>
@ -1189,13 +1189,13 @@ namespace Exiv2 {
}
// Specialization for rational
template<>
inline Rational ValueType<Rational>::toRational(long n) const
inline Rational ValueType<Rational>::toRational(long n) const
{
return Rational(value_[n].first, value_[n].second);
}
// Specialization for unsigned rational
template<>
inline Rational ValueType<URational>::toRational(long n) const
inline Rational ValueType<URational>::toRational(long n) const
{
return Rational(value_[n].first, value_[n].second);
}

@ -5,11 +5,11 @@
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
Version : $Rev$
Test procedure:
$ rm -f test.jpg thumb.jpg iii ttt;
Test procedure:
$ rm -f test.jpg thumb.jpg iii ttt;
$ ./exifprint ../test/img_1771.jpg > iii;
$ cp ../test/img_1771.jpg ./test.jpg;
$ ./makernote-test2 ../test/img_1771.jpg > ttt;
$ cp ../test/img_1771.jpg ./test.jpg;
$ ./makernote-test2 ../test/img_1771.jpg > ttt;
$ diff iii ttt
*/
@ -60,8 +60,8 @@ try {
case 1:
std::cerr << "Case 1: ";
std::cerr << "Non-intrusive change to the standard Exif metadata\n";
testCase(testFile, "test1.jpg", "thumb1",
"Exif.Photo.DateTimeOriginal",
testCase(testFile, "test1.jpg", "thumb1",
"Exif.Photo.DateTimeOriginal",
"1999:11:22 00:11:22");
break;
case 2:
@ -75,14 +75,14 @@ try {
std::cerr << "Case 3: ";
std::cerr << "Non-intrusive change to the Exif metadata (w/o makernote)\n";
testCase(testFile, "test3.jpg", "thumb3",
"Exif.Photo.DateTimeOriginal",
"Exif.Photo.DateTimeOriginal",
"1999:11:22 00:11:22");
break;
case 4:
std::cerr << "Case 4: ";
std::cerr << "Intrusive change to the standard Exif metadata\n";
testCase(testFile, "test4.jpg", "thumb4",
"Exif.Photo.DateTimeOriginal",
"Exif.Photo.DateTimeOriginal",
"1999:11:22 00:11:22 and twenty seconds");
break;
case 5:
@ -96,7 +96,7 @@ try {
std::cerr << "Case 6: ";
std::cerr << "Intrusive change to the Exif metadata (w/o makernote)\n";
testCase(testFile, "test6.jpg", "thumb6",
"Exif.Photo.DateTimeOriginal",
"Exif.Photo.DateTimeOriginal",
"1999:11:22 00:11:22 and twenty seconds");
break;
case 7:
@ -207,8 +207,8 @@ void exifPrint(const ExifData& exifData)
std::cout << std::setw(53) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::dec << i->value()
<< std::hex << i->tag() << " "
<< std::dec << i->value()
<< "\n";
}
}

@ -209,15 +209,15 @@ void print(const std::string& file)
std::cout << std::setw(45) << std::setfill(' ') << std::left
<< i->key() << " "
<< "0x" << std::setw(4) << std::setfill('0') << std::right
<< std::hex << i->tag() << " "
<< std::hex << i->tag() << " "
<< std::setw(12) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->typeName() << " "
<< std::dec << std::setw(3)
<< std::dec << std::setw(3)
<< std::setfill(' ') << std::right
<< i->count() << " "
<< std::dec << i->value()
<< std::dec << i->value()
<< "\n";
}

Loading…
Cancel
Save