Remove dead code

main
Luis Díaz Más 3 years ago
parent 1d243ed40e
commit ea201ce613

@ -175,11 +175,6 @@ namespace Action {
registry_.clear(); registry_.clear();
} }
void TaskFactory::registerTask(TaskType type, Task::UniquePtr task)
{
registry_[type] = std::move(task);
}
TaskFactory::TaskFactory() TaskFactory::TaskFactory()
{ {
registry_.emplace(adjust, std::make_unique<Adjust>()); registry_.emplace(adjust, std::make_unique<Adjust>());
@ -595,7 +590,6 @@ namespace Action {
if (Params::instance().printItems_ & Params::prHex) { if (Params::instance().printItems_ & Params::prHex) {
if (!first) if (!first)
std::cout << std::endl; std::cout << std::endl;
first = false;
Exiv2::DataBuf buf(md.size()); Exiv2::DataBuf buf(md.size());
md.copy(buf.data(), pImage->byteOrder()); md.copy(buf.data(), pImage->byteOrder());
Exiv2::hexdump(std::cout, buf.c_data(), buf.size()); Exiv2::hexdump(std::cout, buf.c_data(), buf.size());
@ -1892,7 +1886,6 @@ namespace {
// #1148 use Raw XMP packet if there are no XMP modification commands // #1148 use Raw XMP packet if there are no XMP modification commands
int tRawSidecar = Params::ctXmpSidecar | Params::ctXmpRaw; // option -eXX int tRawSidecar = Params::ctXmpSidecar | Params::ctXmpRaw; // option -eXX
// printTarget("in metacopy",Params::instance().target_,true);
if (Params::instance().modifyCmds_.empty() && (Params::instance().target_ & tRawSidecar) == tRawSidecar) { if (Params::instance().modifyCmds_.empty() && (Params::instance().target_ & tRawSidecar) == tRawSidecar) {
// std::cout << "short cut" << std::endl; // std::cout << "short cut" << std::endl;
// http://www.cplusplus.com/doc/tutorial/files/ // http://www.cplusplus.com/doc/tutorial/files/

@ -123,20 +123,6 @@ namespace Action {
*/ */
Task::UniquePtr create(TaskType type); Task::UniquePtr create(TaskType type);
/*!
@brief Register a task prototype together with its type.
The task factory creates new tasks of a given type by cloning its
associated prototype. Additional tasks can be registered. If called
for a type which already exists in the list, the corresponding
prototype is replaced.
@param type Task type.
@param task Pointer to the prototype. Ownership is transferred to the
task factory. That's what the auto pointer indicates.
*/
void registerTask(TaskType type, Task::UniquePtr task);
private: private:
//! Prevent construction other than through instance(). //! Prevent construction other than through instance().
TaskFactory(); TaskFactory();

@ -248,25 +248,6 @@ void Params::usage(std::ostream& os) const
<< _("Image metadata manipulation tool.\n"); << _("Image metadata manipulation tool.\n");
} }
std::string Params::printTarget(const std::string &before, int target, bool bPrint, std::ostream& out)
{
std::string t;
if ( target & Params::ctExif ) t+= 'e';
if ( target & Params::ctXmpSidecar ) t+= 'X';
if ( target & Params::ctXmpRaw ) t+= target & Params::ctXmpSidecar ? 'X' : 'R' ;
if ( target & Params::ctIptc ) t+= 'i';
if ( target & Params::ctIccProfile ) t+= 'C';
if ( target & Params::ctIptcRaw ) t+= 'I';
if ( target & Params::ctXmp ) t+= 'x';
if ( target & Params::ctComment ) t+= 'c';
if ( target & Params::ctThumb ) t+= 't';
if ( target & Params::ctPreview ) t+= 'p';
if ( target & Params::ctStdInOut ) t+= '-';
if ( bPrint ) out << before << " :" << t << std::endl;
return t;
}
void Params::help(std::ostream& os) const void Params::help(std::ostream& os) const
{ {
usage(os); usage(os);

@ -339,10 +339,6 @@ public:
//! Print version information to an output stream. //! Print version information to an output stream.
static void version(bool verbose = false, std::ostream& os = std::cout); static void version(bool verbose = false, std::ostream& os = std::cout);
//! Print target_
static std::string printTarget(const std::string& before, int target, bool bPrint = false,
std::ostream& out = std::cout);
//! getStdin binary data read from stdin to DataBuf //! getStdin binary data read from stdin to DataBuf
/* /*
stdin can be used by multiple images in the exiv2 command line: stdin can be used by multiple images in the exiv2 command line:

@ -352,10 +352,10 @@ namespace Exiv2 {
byte buf[4096]; byte buf[4096];
long readCount = 0; long readCount = 0;
long writeCount = 0;
long writeTotal = 0; long writeTotal = 0;
while ((readCount = src.read(buf, sizeof(buf)))) { while ((readCount = src.read(buf, sizeof(buf)))) {
writeTotal += writeCount = static_cast<long>(std::fwrite(buf, 1, readCount, p_->fp_)); long writeCount = static_cast<long>(std::fwrite(buf, 1, readCount, p_->fp_));
writeTotal += writeCount;
if (writeCount != readCount) { if (writeCount != readCount) {
// try to reset back to where write stopped // try to reset back to where write stopped
src.seek(writeCount-readCount, BasicIo::cur); src.seek(writeCount-readCount, BasicIo::cur);
@ -678,18 +678,17 @@ namespace Exiv2 {
{ {
return type_ == bNone; return type_ == bNone;
} }
bool isInMem () const
{
return type_ == bMemory;
}
bool isKnown () const bool isKnown () const
{ {
return type_ == bKnown; return type_ == bKnown;
} }
byte* getData () const byte* getData () const
{ {
return data_; return data_;
} }
size_t getSize () const size_t getSize () const
{ {
return size_; return size_;
@ -1247,9 +1246,6 @@ namespace Exiv2 {
size_t left = 0; size_t left = 0;
size_t right = 0; size_t right = 0;
size_t blockIndex = 0; size_t blockIndex = 0;
size_t i = 0;
size_t readCount = 0;
size_t blockSize = 0;
auto buf = new byte [p_->blockSize_]; auto buf = new byte [p_->blockSize_];
size_t nBlocks = (p_->size_ + p_->blockSize_ - 1) / p_->blockSize_; size_t nBlocks = (p_->size_ + p_->blockSize_ - 1) / p_->blockSize_;
@ -1257,11 +1253,11 @@ namespace Exiv2 {
src.seek(0, BasicIo::beg); src.seek(0, BasicIo::beg);
bool findDiff = false; bool findDiff = false;
while (blockIndex < nBlocks && !src.eof() && !findDiff) { while (blockIndex < nBlocks && !src.eof() && !findDiff) {
blockSize = p_->blocksMap_[blockIndex].getSize(); size_t blockSize = p_->blocksMap_[blockIndex].getSize();
bool isFakeData = p_->blocksMap_[blockIndex].isKnown(); // fake data bool isFakeData = p_->blocksMap_[blockIndex].isKnown(); // fake data
readCount = static_cast<size_t>(src.read(buf, static_cast<long>(blockSize))); size_t readCount = static_cast<size_t>(src.read(buf.data(), static_cast<long>(blockSize)));
byte* blockData = p_->blocksMap_[blockIndex].getData(); byte* blockData = p_->blocksMap_[blockIndex].getData();
for (i = 0; (i < readCount) && (i < blockSize) && !findDiff; i++) { for (size_t i = 0; (i < readCount) && (i < blockSize) && !findDiff; i++) {
if ((!isFakeData && buf[i] != blockData[i]) || (isFakeData && buf[i] != 0)) { if ((!isFakeData && buf[i] != blockData[i]) || (isFakeData && buf[i] != 0)) {
findDiff = true; findDiff = true;
} else { } else {
@ -1276,14 +1272,14 @@ namespace Exiv2 {
blockIndex = nBlocks; blockIndex = nBlocks;
while (blockIndex > 0 && right < src.size() && !findDiff) { while (blockIndex > 0 && right < src.size() && !findDiff) {
blockIndex--; blockIndex--;
blockSize = p_->blocksMap_[blockIndex].getSize(); size_t blockSize = p_->blocksMap_[blockIndex].getSize();
if(src.seek(-1 * (blockSize + right), BasicIo::end)) { if(src.seek(-1 * (blockSize + right), BasicIo::end)) {
findDiff = true; findDiff = true;
} else { } else {
bool isFakeData = p_->blocksMap_[blockIndex].isKnown(); // fake data bool isFakeData = p_->blocksMap_[blockIndex].isKnown(); // fake data
readCount = src.read(buf, static_cast<long>(blockSize)); size_t readCount = src.read(buf.data(), static_cast<long>(blockSize));
byte* blockData = p_->blocksMap_[blockIndex].getData(); byte* blockData = p_->blocksMap_[blockIndex].getData();
for (i = 0; (i < readCount) && (i < blockSize) && !findDiff; i++) { for (size_t i = 0; (i < readCount) && (i < blockSize) && !findDiff; i++) {
if ((!isFakeData && buf[readCount - i - 1] != blockData[blockSize - i - 1]) || (isFakeData && buf[readCount - i - 1] != 0)) { if ((!isFakeData && buf[readCount - i - 1] != blockData[blockSize - i - 1]) || (isFakeData && buf[readCount - i - 1] != 0)) {
findDiff = true; findDiff = true;
} else { } else {

@ -284,8 +284,6 @@ namespace Exiv2 {
//@{ //@{
//! Get the value of the erase flag, see also setErase(bool on). //! Get the value of the erase flag, see also setErase(bool on).
bool erase() const { return erase_; } bool erase() const { return erase_; }
//! Get the value of the overwrite flag, see also setOverwrite(bool on).
bool overwrite() const { return overwrite_; }
//@} //@}
private: private:
@ -293,7 +291,6 @@ namespace Exiv2 {
bool prepareIptcTarget(const char* to, bool force =false); bool prepareIptcTarget(const char* to, bool force =false);
bool prepareXmpTarget(const char* to, bool force =false); bool prepareXmpTarget(const char* to, bool force =false);
std::string computeExifDigest(bool tiff); std::string computeExifDigest(bool tiff);
std::string computeIptcDigest();
// DATA // DATA
static const Conversion conversion_[]; //<! Conversion rules static const Conversion conversion_[]; //<! Conversion rules
@ -1084,7 +1081,6 @@ namespace Exiv2 {
else { else {
sec = (min - static_cast<int>(min)) * 60.0; sec = (min - static_cast<int>(min)) * 60.0;
min = static_cast<double>(static_cast<int>(min)); min = static_cast<double>(static_cast<int>(min));
sep2 = ',';
} }
if ( in.bad() || !(ref == 'N' || ref == 'S' || ref == 'E' || ref == 'W') if ( in.bad() || !(ref == 'N' || ref == 'S' || ref == 'E' || ref == 'W')
@ -1256,28 +1252,6 @@ namespace Exiv2 {
writeExifDigest(); writeExifDigest();
} }
std::string Converter::computeIptcDigest()
{
#ifdef EXV_HAVE_XMP_TOOLKIT
std::ostringstream res;
MD5_CTX context;
unsigned char digest[16];
MD5Init(&context);
DataBuf data = IptcParser::encode(*iptcData_);
MD5Update(&context, data.c_data(), data.size());
MD5Final(digest, &context);
res << std::setw(2) << std::setfill('0') << std::hex << std::uppercase;
for (auto&& i : digest) {
res << static_cast<int>(i);
}
return res.str();
#else
return std::string("");
#endif
}
// ************************************************************************* // *************************************************************************
// free functions // free functions
@ -1288,6 +1262,7 @@ namespace Exiv2 {
converter.cnvToXmp(); converter.cnvToXmp();
} }
/// \todo not used internally. We should at least have unit tests for this.
void moveExifToXmp(ExifData& exifData, XmpData& xmpData) void moveExifToXmp(ExifData& exifData, XmpData& xmpData)
{ {
Converter converter(exifData, xmpData); Converter converter(exifData, xmpData);
@ -1301,6 +1276,7 @@ namespace Exiv2 {
converter.cnvFromXmp(); converter.cnvFromXmp();
} }
/// \todo not used internally. We should at least have unit tests for this.
void moveXmpToExif(XmpData& xmpData, ExifData& exifData) void moveXmpToExif(XmpData& xmpData, ExifData& exifData)
{ {
Converter converter(exifData, xmpData); Converter converter(exifData, xmpData);
@ -1323,6 +1299,7 @@ namespace Exiv2 {
converter.cnvToXmp(); converter.cnvToXmp();
} }
/// \todo not used internally. We should at least have unit tests for this.
void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char *iptcCharset) void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char *iptcCharset)
{ {
if (!iptcCharset) iptcCharset = iptcData.detectCharset(); if (!iptcCharset) iptcCharset = iptcData.detectCharset();
@ -1338,6 +1315,7 @@ namespace Exiv2 {
converter.cnvFromXmp(); converter.cnvFromXmp();
} }
/// \todo not used internally. We should at least have unit tests for this.
void moveXmpToIptc(XmpData& xmpData, IptcData& iptcData) void moveXmpToIptc(XmpData& xmpData, IptcData& iptcData)
{ {
Converter converter(iptcData, xmpData); Converter converter(iptcData, xmpData);

@ -53,7 +53,6 @@ namespace {
// ***************************************************************************** // *****************************************************************************
// local definitions // local definitions
namespace { namespace {
//! @cond IGNORE
constexpr RotationMap::OmList RotationMap::omList_[] = { constexpr RotationMap::OmList RotationMap::omList_[] = {
{ 1, 0 }, { 1, 0 },
{ 3, 180 }, { 3, 180 },
@ -87,7 +86,6 @@ namespace {
} }
return d; return d;
} }
//! @endcond
} // namespace } // namespace
namespace Exiv2 { namespace Exiv2 {
@ -503,16 +501,6 @@ namespace Exiv2 {
} }
} // CiffComponent::writeDirEntry } // CiffComponent::writeDirEntry
void CiffHeader::print(std::ostream& os, const std::string& prefix) const
{
std::ios::fmtflags f( os.flags() );
os << prefix
<< _("Header, offset") << " = 0x" << std::setw(8) << std::setfill('0')
<< std::hex << std::right << offset_ << "\n";
if (pRootDir_) pRootDir_->print(os, byteOrder_, prefix);
os.flags(f);
} // CiffHeader::print
void CiffComponent::print(std::ostream& os, void CiffComponent::print(std::ostream& os,
ByteOrder byteOrder, ByteOrder byteOrder,
const std::string& prefix) const const std::string& prefix) const

@ -481,13 +481,7 @@ namespace Exiv2 {
@param image Image to add metadata to @param image Image to add metadata to
*/ */
void decode(Image& image) const; void decode(Image& image) const;
/*!
@brief Print debug info for the CRW image to \em os.
@param os Output stream to write to.
@param prefix Prefix to be written before each line of output.
*/
void print(std::ostream& os, const std::string& prefix ="") const;
//! Return the byte order (little or big endian). //! Return the byte order (little or big endian).
ByteOrder byteOrder() const { return byteOrder_; } ByteOrder byteOrder() const { return byteOrder_; }
/*! /*!

@ -239,8 +239,6 @@ int Exiv2::http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::stri
servername_p = Proxy.Host.c_str(); servername_p = Proxy.Host.c_str();
port_p = Proxy.Port.c_str(); port_p = Proxy.Port.c_str();
page = url.c_str(); page = url.c_str();
std::string p(proxy?proxi:PROXI);
// std::cerr << p << '=' << prox << " page = " << page << std::endl;
} }
if ( !port [0] ) port = "80"; if ( !port [0] ) port = "80";
if ( !port_p[0] ) port_p = "80"; if ( !port_p[0] ) port_p = "80";

@ -284,6 +284,7 @@ namespace Exiv2 {
return Image::byteSwap(v,bSwap); return Image::byteSwap(v,bSwap);
} }
/// \todo not used internally. At least we should test it
uint64_t Image::byteSwap8(const DataBuf& buf,size_t offset,bool bSwap) uint64_t Image::byteSwap8(const DataBuf& buf,size_t offset,bool bSwap)
{ {
uint64_t v = 0; uint64_t v = 0;
@ -373,7 +374,6 @@ namespace Exiv2 {
// Break for unknown tag types else we may segfault. // Break for unknown tag types else we may segfault.
if ( !typeValid(type) ) { if ( !typeValid(type) ) {
EXV_ERROR << "invalid type in tiff structure" << type << std::endl; EXV_ERROR << "invalid type in tiff structure" << type << std::endl;
start = 0; // break from do loop
throw Error(kerInvalidTypeValue); throw Error(kerInvalidTypeValue);
} }
@ -525,7 +525,6 @@ namespace Exiv2 {
out << Internal::indent(depth) << "END " << io.path() << std::endl; out << Internal::indent(depth) << "END " << io.path() << std::endl;
} }
out.flush(); out.flush();
depth--;
} }
void Image::printTiffStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,int depth,size_t offset /*=0*/) void Image::printTiffStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,int depth,size_t offset /*=0*/)
@ -582,6 +581,7 @@ namespace Exiv2 {
return xmpPacket_; return xmpPacket_;
} }
/// \todo not used internally. At least we should test it
void Image::setMetadata(const Image& image) void Image::setMetadata(const Image& image)
{ {
if (checkMode(mdExif) & amWrite) { if (checkMode(mdExif) & amWrite) {
@ -754,6 +754,7 @@ namespace Exiv2 {
return ImageFactory::checkType(imageType_, *io_, false); return ImageFactory::checkType(imageType_, *io_, false);
} }
/// \todo not used internally. At least we should test it
bool Image::supportsMetadata(MetadataId metadataId) const bool Image::supportsMetadata(MetadataId metadataId) const
{ {
return (supportedMetadata_ & metadataId) != 0; return (supportedMetadata_ & metadataId) != 0;

@ -57,52 +57,6 @@ namespace Exiv2
return result; return result;
} }
std::string binaryToHex(const byte* data, size_t size)
{
std::stringstream hexOutput;
auto tl = size_t(size / 16) * 16;
auto tl_offset = size_t(size) - tl;
for (size_t loop = 0; loop < size; loop++) {
if (data[loop] < 16) {
hexOutput << "0";
}
hexOutput << std::hex << static_cast<int>(data[loop]);
if ((loop % 8) == 7) {
hexOutput << " ";
}
if ((loop % 16) == 15 || loop == (tl + tl_offset - 1)) {
int max = 15;
if (loop >= tl) {
max = int(tl_offset) - 1;
for (int offset = 0; offset < int(16 - tl_offset); offset++) {
if ((offset % 8) == 7) {
hexOutput << " ";
}
hexOutput << " ";
}
}
hexOutput << " ";
for (int offset = max; offset >= 0; offset--) {
if (offset == (max - 8)) {
hexOutput << " ";
}
byte c = '.';
if (data[loop - offset] >= 0x20 && data[loop - offset] <= 0x7E) {
c = data[loop - offset];
}
hexOutput << static_cast<char>(c);
}
hexOutput << std::endl;
}
}
hexOutput << std::endl << std::endl << std::endl;
return hexOutput.str();
}
std::string indent(int32_t d) std::string indent(int32_t d)
{ {
std::string result; std::string result;

@ -120,14 +120,7 @@ namespace Exiv2 {
return binaryToStringHelper<T>(sl); return binaryToStringHelper<T>(sl);
} }
/*! /// @brief indent output for kpsRecursive in \em printStructure() \em .
@brief format binary for display of raw data .
*/
std::string binaryToHex(const byte *data, size_t size);
/*!
@brief indent output for kpsRecursive in \em printStructure() \em .
*/
std::string indent(int32_t depth); std::string indent(int32_t depth);
}} // namespace Internal, Exiv2 }} // namespace Internal, Exiv2

@ -327,11 +327,13 @@ namespace Exiv2 {
FindIptcdatum(dataset, record)); FindIptcdatum(dataset, record));
} }
/// \todo not used internally. At least we should test it
void IptcData::sortByKey() void IptcData::sortByKey()
{ {
std::sort(iptcMetadata_.begin(), iptcMetadata_.end(), cmpMetadataByKey); std::sort(iptcMetadata_.begin(), iptcMetadata_.end(), cmpMetadataByKey);
} }
/// \todo not used internally. At least we should test it
void IptcData::sortByTag() void IptcData::sortByTag()
{ {
std::sort(iptcMetadata_.begin(), iptcMetadata_.end(), cmpMetadataByTag); std::sort(iptcMetadata_.begin(), iptcMetadata_.end(), cmpMetadataByTag);
@ -350,8 +352,7 @@ namespace Exiv2 {
size_t i = 0; size_t i = 0;
while (i < bytes.size() - 3 && bytes.at(i) != 0x1c) while (i < bytes.size() - 3 && bytes.at(i) != 0x1c)
i++; i++;
depth++; out << Internal::indent(++depth) << "Record | DataSet | Name | Length | Data" << std::endl;
out << Internal::indent(depth) << "Record | DataSet | Name | Length | Data" << std::endl;
while (i < bytes.size() - 3) { while (i < bytes.size() - 3) {
if (bytes.at(i) != 0x1c) { if (bytes.at(i) != 0x1c) {
break; break;
@ -370,7 +371,6 @@ namespace Exiv2 {
<< std::endl; << std::endl;
i += 5 + len; i += 5 + len;
} }
depth--;
} }
const char *IptcData::detectCharset() const const char *IptcData::detectCharset() const

@ -221,7 +221,6 @@ static void boxes_check(size_t b,size_t m)
throw Error(kerNotAnImage, "JPEG-2000"); throw Error(kerNotAnImage, "JPEG-2000");
} }
long position = 0;
Jp2BoxHeader box = {0,0}; Jp2BoxHeader box = {0,0};
Jp2BoxHeader subBox = {0,0}; Jp2BoxHeader subBox = {0,0};
Jp2ImageHeaderBox ihdr = {0,0,0,0,0,0,0,0}; Jp2ImageHeaderBox ihdr = {0,0,0,0,0,0,0,0};
@ -231,7 +230,7 @@ static void boxes_check(size_t b,size_t m)
while (io_->read(reinterpret_cast<byte*>(&box), sizeof(box)) == sizeof(box)) { while (io_->read(reinterpret_cast<byte*>(&box), sizeof(box)) == sizeof(box)) {
boxes_check(boxes++,boxem ); boxes_check(boxes++,boxem );
position = io_->tell(); long position = io_->tell();
box.length = getLong(reinterpret_cast<byte*>(&box.length), bigEndian); box.length = getLong(reinterpret_cast<byte*>(&box.length), bigEndian);
box.type = getLong(reinterpret_cast<byte*>(&box.type), bigEndian); box.type = getLong(reinterpret_cast<byte*>(&box.type), bigEndian);
#ifdef EXIV2_DEBUG_MESSAGES #ifdef EXIV2_DEBUG_MESSAGES
@ -490,7 +489,6 @@ static void boxes_check(size_t b,size_t m)
if ( bPrint || bXMP || bICC || bIPTCErase ) { if ( bPrint || bXMP || bICC || bIPTCErase ) {
long position = 0;
Jp2BoxHeader box = {1,1}; Jp2BoxHeader box = {1,1};
Jp2BoxHeader subBox = {1,1}; Jp2BoxHeader subBox = {1,1};
Jp2UuidBox uuid = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; Jp2UuidBox uuid = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
@ -498,7 +496,7 @@ static void boxes_check(size_t b,size_t m)
while (box.length && box.type != kJp2BoxTypeClose && while (box.length && box.type != kJp2BoxTypeClose &&
io_->read(reinterpret_cast<byte*>(&box), sizeof(box)) == sizeof(box)) { io_->read(reinterpret_cast<byte*>(&box), sizeof(box)) == sizeof(box)) {
position = io_->tell(); long position = io_->tell();
box.length = getLong(reinterpret_cast<byte*>(&box.length), bigEndian); box.length = getLong(reinterpret_cast<byte*>(&box.length), bigEndian);
box.type = getLong(reinterpret_cast<byte*>(&box.type), bigEndian); box.type = getLong(reinterpret_cast<byte*>(&box.type), bigEndian);
enforce(box.length <= sizeof(box)+io_->size()-io_->tell() , Exiv2::kerCorruptedMetadata); enforce(box.length <= sizeof(box)+io_->size()-io_->tell() , Exiv2::kerCorruptedMetadata);

@ -2490,16 +2490,5 @@ namespace Exiv2 {
return EXV_PRINT_TAG(minoltaSonyZoneMatching)(os, value, metadata); return EXV_PRINT_TAG(minoltaSonyZoneMatching)(os, value, metadata);
} }
std::ostream& printMinoltaSonyFlashExposureComp(std::ostream& os, const Value& value, const ExifData*)
{
std::ios::fmtflags f( os.flags() );
if (value.count() != 1 || value.typeId() != signedRational) {
return os << "(" << value << ")";
}
os << std::fixed << std::setprecision(2) << value.toFloat(0) << " EV";
os.flags(f);
return os;
}
} // namespace Internal } // namespace Internal
} // namespace Exiv2 } // namespace Exiv2

@ -136,9 +136,6 @@ namespace Exiv2 {
//! Print Minolta/Sony ZoneMatching values to readable labels. //! Print Minolta/Sony ZoneMatching values to readable labels.
std::ostream& printMinoltaSonyZoneMatching(std::ostream&, const Value&, const ExifData*); std::ostream& printMinoltaSonyZoneMatching(std::ostream&, const Value&, const ExifData*);
//! Print Minolta/Sony FlashExposureComp values to readable labels.
std::ostream& printMinoltaSonyFlashExposureComp(std::ostream&, const Value&, const ExifData*);
// TODO: Added shared methods here. // TODO: Added shared methods here.
}} // namespace Internal, Exiv2 }} // namespace Internal, Exiv2

@ -3943,6 +3943,7 @@ namespace Exiv2 {
XmpProperties::NsRegistry XmpProperties::nsRegistry_; XmpProperties::NsRegistry XmpProperties::nsRegistry_;
std::mutex XmpProperties::mutex_; std::mutex XmpProperties::mutex_;
/// \todo not used internally. At least we should test it
const XmpNsInfo* XmpProperties::lookupNsRegistry(const XmpNsInfo::Prefix& prefix) const XmpNsInfo* XmpProperties::lookupNsRegistry(const XmpNsInfo::Prefix& prefix)
{ {
std::lock_guard<std::mutex> scoped_read_lock(mutex_); std::lock_guard<std::mutex> scoped_read_lock(mutex_);
@ -4095,6 +4096,7 @@ namespace Exiv2 {
return pi; return pi;
} }
/// \todo not used internally. At least we should test it
const char* XmpProperties::nsDesc(const std::string& prefix) const char* XmpProperties::nsDesc(const std::string& prefix)
{ {
return nsInfo(prefix)->desc_; return nsInfo(prefix)->desc_;

@ -399,13 +399,15 @@ namespace Exiv2 {
#endif #endif
// Copy colorData // Copy colorData
uint32_t readTotal = 0; uint32_t readTotal = 0;
long toRead = 0;
while (readTotal < colorDataLength) { while (readTotal < colorDataLength) {
toRead = static_cast<long>(colorDataLength - readTotal) < lbuf.size() long toRead = static_cast<long>(colorDataLength - readTotal) < lbuf.size()
? static_cast<long>(colorDataLength - readTotal) : lbuf.size(); ? static_cast<long>(colorDataLength - readTotal)
if (io_->read(lbuf.data(), toRead) != toRead) throw Error(kerNotAnImage, "Photoshop"); : lbuf.size();
if (io_->read(lbuf.data(), toRead) != toRead)
throw Error(kerNotAnImage, "Photoshop");
readTotal += toRead; readTotal += toRead;
if (outIo.write(lbuf.c_data(), toRead) != toRead) throw Error(kerImageWriteFailed); if (outIo.write(lbuf.c_data(), toRead) != toRead)
throw Error(kerImageWriteFailed);
} }
if (outIo.error()) throw Error(kerImageWriteFailed); if (outIo.error()) throw Error(kerImageWriteFailed);
@ -505,15 +507,17 @@ namespace Exiv2 {
if (outIo.write(buf, 4) != 4) throw Error(kerImageWriteFailed); if (outIo.write(buf, 4) != 4) throw Error(kerImageWriteFailed);
readTotal = 0; readTotal = 0;
toRead = 0;
while (readTotal < pResourceSize) { while (readTotal < pResourceSize) {
toRead = static_cast<long>(pResourceSize - readTotal) < lbuf.size() /// \todo almost same code as in lines 403-410. Factor out & reuse!
? static_cast<long>(pResourceSize - readTotal) : lbuf.size(); long toRead = static_cast<long>(pResourceSize - readTotal) < lbuf.size()
? static_cast<long>(pResourceSize - readTotal)
: lbuf.size();
if (io_->read(lbuf.data(), toRead) != toRead) { if (io_->read(lbuf.data(), toRead) != toRead) {
throw Error(kerNotAnImage, "Photoshop"); throw Error(kerNotAnImage, "Photoshop");
} }
readTotal += toRead; readTotal += toRead;
if (outIo.write(lbuf.c_data(), toRead) != toRead) throw Error(kerImageWriteFailed); if (outIo.write(lbuf.c_data(), toRead) != toRead)
throw Error(kerImageWriteFailed);
} }
if (outIo.error()) throw Error(kerImageWriteFailed); if (outIo.error()) throw Error(kerImageWriteFailed);
newResLength += pResourceSize + adjResourceNameLen + 12; newResLength += pResourceSize + adjResourceNameLen + 12;
@ -532,13 +536,11 @@ namespace Exiv2 {
// Append ExifInfo resource block, if not yet written // Append ExifInfo resource block, if not yet written
if (!exifDone) { if (!exifDone) {
newResLength += writeExifData(exifData_, outIo); newResLength += writeExifData(exifData_, outIo);
exifDone = true;
} }
// Append XmpPacket resource block, if not yet written // Append XmpPacket resource block, if not yet written
if (!xmpDone) { if (!xmpDone) {
newResLength += writeXmpData(xmpData_, outIo); newResLength += writeXmpData(xmpData_, outIo);
xmpDone = true;
} }
// Populate the fake data, only make sense for remoteio, httpio and sshio. // Populate the fake data, only make sense for remoteio, httpio and sshio.

@ -96,12 +96,11 @@ namespace Exiv2 {
if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData);
throw Error(kerNotAnImage, "RAF"); throw Error(kerNotAnImage, "RAF");
} }
size_t address = 0 ;
size_t address2 = 0 ;
const bool bPrint = option==kpsBasic || option==kpsRecursive; const bool bPrint = option==kpsBasic || option==kpsRecursive;
if ( bPrint ) { if ( bPrint ) {
io_->seek(0,BasicIo::beg); // rewind io_->seek(0,BasicIo::beg); // rewind
address = io_->tell(); size_t address = io_->tell();
const char* format = " %8d | %8d | "; const char* format = " %8d | %8d | ";
{ {
@ -174,7 +173,7 @@ namespace Exiv2 {
byte jpg_img_offset [4]; byte jpg_img_offset [4];
io_->read(jpg_img_offset, 4); io_->read(jpg_img_offset, 4);
byte jpg_img_length [4]; byte jpg_img_length [4];
address2 = io_->tell(); size_t address2 = io_->tell();
io_->read(jpg_img_length, 4); io_->read(jpg_img_length, 4);
long jpg_img_off = Exiv2::getULong(jpg_img_offset, bigEndian); long jpg_img_off = Exiv2::getULong(jpg_img_offset, bigEndian);

@ -127,6 +127,7 @@ namespace Exiv2 {
return sectionInfo[ti->sectionId_].name_; return sectionInfo[ti->sectionId_].name_;
} }
/// \todo not used internally. At least we should test it
uint16_t ExifTags::defaultCount(const ExifKey& key) uint16_t ExifTags::defaultCount(const ExifKey& key)
{ {
const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId())); const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId()));

@ -469,6 +469,7 @@ namespace Exiv2 {
const uint16_t nMasks = (nPoints+15)/(sizeof(uint16_t) * 8); const uint16_t nMasks = (nPoints+15)/(sizeof(uint16_t) * 8);
int nStart = 0; int nStart = 0;
/// \todo make this static
struct { struct {
uint16_t tag ; uint16_t tag ;
uint16_t size ; uint16_t size ;

@ -1110,6 +1110,7 @@ namespace Exiv2 {
return 1; return 1;
} }
/// \todo not used internally. At least we should test it
void TimeValue::setTime( const Time& src ) void TimeValue::setTime( const Time& src )
{ {
std::memcpy(&time_, &src, sizeof(time_)); std::memcpy(&time_, &src, sizeof(time_));

@ -833,8 +833,6 @@ namespace Exiv2 {
if (iIo.tell() % 2) { if (iIo.tell() % 2) {
if (iIo.write(&WEBP_PAD_ODD, 1) != 1) throw Error(kerImageWriteFailed); if (iIo.write(&WEBP_PAD_ODD, 1) != 1) throw Error(kerImageWriteFailed);
} }
has_icc = false;
} }
} }

Loading…
Cancel
Save