Minor whitespace formatting
This commit is contained in:
parent
2c0f3c2bbc
commit
e09d093ccf
@ -7,7 +7,7 @@ if (${EXIV2_ENABLE_WEBREADY})
|
|||||||
set(EXV_USE_SSH ${EXIV2_ENABLE_SSH})
|
set(EXV_USE_SSH ${EXIV2_ENABLE_SSH})
|
||||||
set(EXV_USE_CURL ${EXIV2_ENABLE_CURL})
|
set(EXV_USE_CURL ${EXIV2_ENABLE_CURL})
|
||||||
endif()
|
endif()
|
||||||
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
|
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
|
||||||
set(EXV_ENABLE_VIDEO ${EXIV2_ENABLE_VIDEO})
|
set(EXV_ENABLE_VIDEO ${EXIV2_ENABLE_VIDEO})
|
||||||
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
|
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
|
||||||
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
|
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
|
||||||
|
|||||||
@ -72,4 +72,4 @@
|
|||||||
#include "exiv2/xmp_exiv2.hpp"
|
#include "exiv2/xmp_exiv2.hpp"
|
||||||
#include "exiv2/xmpsidecar.hpp"
|
#include "exiv2/xmpsidecar.hpp"
|
||||||
|
|
||||||
#endif//ifndef EXIV2_HPP_
|
#endif //ifndef EXIV2_HPP_
|
||||||
|
|||||||
@ -31,17 +31,17 @@
|
|||||||
#include "safe_op.hpp"
|
#include "safe_op.hpp"
|
||||||
#include "slice.hpp"
|
#include "slice.hpp"
|
||||||
|
|
||||||
#ifdef EXV_ENABLE_BMFF
|
#ifdef EXV_ENABLE_BMFF
|
||||||
#include "bmffimage.hpp"
|
#include "bmffimage.hpp"
|
||||||
#endif// EXV_ENABLE_BMFF
|
#endif // EXV_ENABLE_BMFF
|
||||||
#include "cr2image.hpp"
|
#include "cr2image.hpp"
|
||||||
#include "crwimage.hpp"
|
#include "crwimage.hpp"
|
||||||
#include "epsimage.hpp"
|
#include "epsimage.hpp"
|
||||||
#include "jpgimage.hpp"
|
#include "jpgimage.hpp"
|
||||||
#include "mrwimage.hpp"
|
#include "mrwimage.hpp"
|
||||||
#ifdef EXV_HAVE_LIBZ
|
#ifdef EXV_HAVE_LIBZ
|
||||||
# include "pngimage.hpp"
|
# include "pngimage.hpp"
|
||||||
#endif// EXV_HAVE_LIBZ
|
#endif // EXV_HAVE_LIBZ
|
||||||
#include "rafimage.hpp"
|
#include "rafimage.hpp"
|
||||||
#include "tiffimage.hpp"
|
#include "tiffimage.hpp"
|
||||||
#include "tiffimage_int.hpp"
|
#include "tiffimage_int.hpp"
|
||||||
@ -56,12 +56,12 @@
|
|||||||
#include "jp2image.hpp"
|
#include "jp2image.hpp"
|
||||||
#include "nikonmn_int.hpp"
|
#include "nikonmn_int.hpp"
|
||||||
|
|
||||||
#ifdef EXV_ENABLE_VIDEO
|
#ifdef EXV_ENABLE_VIDEO
|
||||||
#include "matroskavideo.hpp"
|
#include "matroskavideo.hpp"
|
||||||
#include "quicktimevideo.hpp"
|
#include "quicktimevideo.hpp"
|
||||||
#include "riffvideo.hpp"
|
#include "riffvideo.hpp"
|
||||||
#include "asfvideo.hpp"
|
#include "asfvideo.hpp"
|
||||||
#endif// EXV_ENABLE_VIDEO
|
#endif // EXV_ENABLE_VIDEO
|
||||||
#include "rw2image.hpp"
|
#include "rw2image.hpp"
|
||||||
#include "pgfimage.hpp"
|
#include "pgfimage.hpp"
|
||||||
#include "xmpsidecar.hpp"
|
#include "xmpsidecar.hpp"
|
||||||
@ -176,7 +176,7 @@ namespace Exiv2 {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::printStructure(std::ostream&, PrintStructureOption,int /*depth*/)
|
void Image::printStructure(std::ostream&, PrintStructureOption, int /*depth*/)
|
||||||
{
|
{
|
||||||
throw Error(kerUnsupportedImageType, io_->path());
|
throw Error(kerUnsupportedImageType, io_->path());
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
bool Image::isLittleEndianPlatform() { return !isBigEndianPlatform(); }
|
bool Image::isLittleEndianPlatform() { return !isBigEndianPlatform(); }
|
||||||
|
|
||||||
uint64_t Image::byteSwap(uint64_t value,bool bSwap) const
|
uint64_t Image::byteSwap(uint64_t value, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint64_t result = 0;
|
uint64_t result = 0;
|
||||||
byte* source_value = reinterpret_cast<byte *>(&value);
|
byte* source_value = reinterpret_cast<byte *>(&value);
|
||||||
@ -260,7 +260,7 @@ namespace Exiv2 {
|
|||||||
return bSwap ? result : value;
|
return bSwap ? result : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Image::byteSwap(uint32_t value,bool bSwap) const
|
uint32_t Image::byteSwap(uint32_t value, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
result |= (value & 0x000000FF) << 24;
|
result |= (value & 0x000000FF) << 24;
|
||||||
@ -270,7 +270,7 @@ namespace Exiv2 {
|
|||||||
return bSwap ? result : value;
|
return bSwap ? result : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Image::byteSwap(uint16_t value,bool bSwap) const
|
uint16_t Image::byteSwap(uint16_t value, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
result |= (value & 0x00FF) << 8;
|
result |= (value & 0x00FF) << 8;
|
||||||
@ -278,16 +278,16 @@ namespace Exiv2 {
|
|||||||
return bSwap ? result : value;
|
return bSwap ? result : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Image::byteSwap2(const DataBuf& buf,size_t offset,bool bSwap) const
|
uint16_t Image::byteSwap2(const DataBuf& buf, size_t offset, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint16_t v;
|
uint16_t v;
|
||||||
char* p = (char*) &v;
|
char* p = (char*) &v;
|
||||||
p[0] = buf.pData_[offset];
|
p[0] = buf.pData_[offset];
|
||||||
p[1] = buf.pData_[offset+1];
|
p[1] = buf.pData_[offset+1];
|
||||||
return Image::byteSwap(v,bSwap);
|
return Image::byteSwap(v, bSwap);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Image::byteSwap4(const DataBuf& buf,size_t offset,bool bSwap) const
|
uint32_t Image::byteSwap4(const DataBuf& buf, size_t offset, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint32_t v;
|
uint32_t v;
|
||||||
char* p = (char*) &v;
|
char* p = (char*) &v;
|
||||||
@ -295,10 +295,10 @@ namespace Exiv2 {
|
|||||||
p[1] = buf.pData_[offset+1];
|
p[1] = buf.pData_[offset+1];
|
||||||
p[2] = buf.pData_[offset+2];
|
p[2] = buf.pData_[offset+2];
|
||||||
p[3] = buf.pData_[offset+3];
|
p[3] = buf.pData_[offset+3];
|
||||||
return Image::byteSwap(v,bSwap);
|
return Image::byteSwap(v, bSwap);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Image::byteSwap8(const DataBuf& buf,size_t offset,bool bSwap) const
|
uint64_t Image::byteSwap8(const DataBuf& buf, size_t offset, bool bSwap) const
|
||||||
{
|
{
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
byte* p = reinterpret_cast<byte *>(&v);
|
byte* p = reinterpret_cast<byte *>(&v);
|
||||||
@ -306,7 +306,7 @@ namespace Exiv2 {
|
|||||||
for(int i = 0; i < 8; i++)
|
for(int i = 0; i < 8; i++)
|
||||||
p[i] = buf.pData_[offset + i];
|
p[i] = buf.pData_[offset + i];
|
||||||
|
|
||||||
return Image::byteSwap(v,bSwap);
|
return Image::byteSwap(v, bSwap);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Image::typeName(uint16_t tag) const
|
const char* Image::typeName(uint16_t tag) const
|
||||||
@ -338,7 +338,7 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::set<long> visits; // #547
|
static std::set<long> visits; // #547
|
||||||
void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth)
|
void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option, uint32_t start, bool bSwap, char c, int depth)
|
||||||
{
|
{
|
||||||
depth++;
|
depth++;
|
||||||
if ( depth == 1 ) visits.clear();
|
if ( depth == 1 ) visits.clear();
|
||||||
@ -351,18 +351,18 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
// Read top of directory
|
// Read top of directory
|
||||||
const int seekSuccess = !io.seek(start,BasicIo::beg);
|
const int seekSuccess = !io.seek(start, BasicIo::beg);
|
||||||
const long bytesRead = io.read(dir.pData_, 2);
|
const long bytesRead = io.read(dir.pData_, 2);
|
||||||
if (!seekSuccess || bytesRead == 0) {
|
if (!seekSuccess || bytesRead == 0) {
|
||||||
throw Error(kerCorruptedMetadata);
|
throw Error(kerCorruptedMetadata);
|
||||||
}
|
}
|
||||||
uint16_t dirLength = byteSwap2(dir,0,bSwap);
|
uint16_t dirLength = byteSwap2(dir, 0, bSwap);
|
||||||
|
|
||||||
bool tooBig = dirLength > 500;
|
bool tooBig = dirLength > 500;
|
||||||
if ( tooBig ) throw Error(kerTiffDirectoryTooLarge);
|
if ( tooBig ) throw Error(kerTiffDirectoryTooLarge);
|
||||||
|
|
||||||
if ( bFirst && bPrint ) {
|
if ( bFirst && bPrint ) {
|
||||||
out << Internal::indent(depth) << Internal::stringFormat("STRUCTURE OF TIFF FILE (%c%c): ",c,c) << io.path() << std::endl;
|
out << Internal::indent(depth) << Internal::stringFormat("STRUCTURE OF TIFF FILE (%c%c): ", c, c) << io.path() << std::endl;
|
||||||
if ( tooBig ) out << Internal::indent(depth) << "dirLength = " << dirLength << std::endl;
|
if ( tooBig ) out << Internal::indent(depth) << "dirLength = " << dirLength << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,10 +381,10 @@ namespace Exiv2 {
|
|||||||
bFirst = false;
|
bFirst = false;
|
||||||
|
|
||||||
io.read(dir.pData_, 12);
|
io.read(dir.pData_, 12);
|
||||||
uint16_t tag = byteSwap2(dir,0,bSwap);
|
uint16_t tag = byteSwap2(dir, 0, bSwap);
|
||||||
uint16_t type = byteSwap2(dir,2,bSwap);
|
uint16_t type = byteSwap2(dir, 2, bSwap);
|
||||||
uint32_t count = byteSwap4(dir,4,bSwap);
|
uint32_t count = byteSwap4(dir, 4, bSwap);
|
||||||
uint32_t offset = byteSwap4(dir,8,bSwap);
|
uint32_t offset = byteSwap4(dir, 8, bSwap);
|
||||||
|
|
||||||
// Break for unknown tag types else we may segfault.
|
// Break for unknown tag types else we may segfault.
|
||||||
if ( !typeValid(type) ) {
|
if ( !typeValid(type) ) {
|
||||||
@ -396,10 +396,10 @@ namespace Exiv2 {
|
|||||||
std::string sp = "" ; // output spacer
|
std::string sp = "" ; // output spacer
|
||||||
|
|
||||||
//prepare to print the value
|
//prepare to print the value
|
||||||
uint32_t kount = isPrintXMP(tag,option) ? count // haul in all the data
|
uint32_t kount = isPrintXMP(tag, option) ? count // haul in all the data
|
||||||
: isPrintICC(tag,option) ? count // ditto
|
: isPrintICC(tag, option) ? count // ditto
|
||||||
: isStringType(type) ? (count > 32 ? 32 : count) // restrict long arrays
|
: isStringType(type) ? (count > 32 ? 32 : count) // restrict long arrays
|
||||||
: count > 5 ? 5
|
: count > 5 ? 5
|
||||||
: count
|
: count
|
||||||
;
|
;
|
||||||
uint32_t pad = isStringType(type) ? 1 : 0;
|
uint32_t pad = isStringType(type) ? 1 : 0;
|
||||||
@ -419,14 +419,14 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
DataBuf buf((long)allocate); // allocate a buffer
|
DataBuf buf((long)allocate); // allocate a buffer
|
||||||
std::memset(buf.pData_, 0, buf.size_);
|
std::memset(buf.pData_, 0, buf.size_);
|
||||||
std::memcpy(buf.pData_,dir.pData_+8,4); // copy dir[8:11] into buffer (short strings)
|
std::memcpy(buf.pData_, dir.pData_+8, 4); // copy dir[8:11] into buffer (short strings)
|
||||||
const bool bOffsetIsPointer = count*size > 4;
|
const bool bOffsetIsPointer = count*size > 4;
|
||||||
|
|
||||||
if ( bOffsetIsPointer ) { // read into buffer
|
if ( bOffsetIsPointer ) { // read into buffer
|
||||||
size_t restore = io.tell(); // save
|
size_t restore = io.tell(); // save
|
||||||
io.seek(offset,BasicIo::beg); // position
|
io.seek(offset, BasicIo::beg); // position
|
||||||
io.read(buf.pData_,count*size);// read
|
io.read(buf.pData_, count*size);// read
|
||||||
io.seek(restore,BasicIo::beg); // restore
|
io.seek(restore,BasicIo::beg); // restore
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bPrint ) {
|
if ( bPrint ) {
|
||||||
@ -436,23 +436,23 @@ namespace Exiv2 {
|
|||||||
"";
|
"";
|
||||||
|
|
||||||
out << Internal::indent(depth)
|
out << Internal::indent(depth)
|
||||||
<< Internal::stringFormat("%8u | %#06x %-28s |%10s |%9u |%10s | "
|
<< Internal::stringFormat("%8u | %#06x %-28s |%10s |%9u |%10s | ",
|
||||||
,address,tag,tagName(tag).c_str(),typeName(type),count,offsetString.c_str());
|
address, tag, tagName(tag).c_str(), typeName(type), count, offsetString.c_str());
|
||||||
if ( isShortType(type) ){
|
if ( isShortType(type) ){
|
||||||
for ( size_t k = 0 ; k < kount ; k++ ) {
|
for ( size_t k = 0 ; k < kount ; k++ ) {
|
||||||
out << sp << byteSwap2(buf,k*size,bSwap);
|
out << sp << byteSwap2(buf, k*size, bSwap);
|
||||||
sp = " ";
|
sp = " ";
|
||||||
}
|
}
|
||||||
} else if ( isLongType(type) ){
|
} else if ( isLongType(type) ){
|
||||||
for ( size_t k = 0 ; k < kount ; k++ ) {
|
for ( size_t k = 0 ; k < kount ; k++ ) {
|
||||||
out << sp << byteSwap4(buf,k*size,bSwap);
|
out << sp << byteSwap4(buf, k*size, bSwap);
|
||||||
sp = " ";
|
sp = " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( isRationalType(type) ){
|
} else if ( isRationalType(type) ){
|
||||||
for ( size_t k = 0 ; k < kount ; k++ ) {
|
for ( size_t k = 0 ; k < kount ; k++ ) {
|
||||||
uint32_t a = byteSwap4(buf,k*size+0,bSwap);
|
uint32_t a = byteSwap4(buf, k*size+0, bSwap);
|
||||||
uint32_t b = byteSwap4(buf,k*size+4,bSwap);
|
uint32_t b = byteSwap4(buf, k*size+4, bSwap);
|
||||||
out << sp << a << "/" << b;
|
out << sp << a << "/" << b;
|
||||||
sp = " ";
|
sp = " ";
|
||||||
}
|
}
|
||||||
@ -466,8 +466,8 @@ namespace Exiv2 {
|
|||||||
if ( option == kpsRecursive && (tag == 0x8769 /* ExifTag */ || tag == 0x014a/*SubIFDs*/ || type == tiffIfd) ) {
|
if ( option == kpsRecursive && (tag == 0x8769 /* ExifTag */ || tag == 0x014a/*SubIFDs*/ || type == tiffIfd) ) {
|
||||||
for ( size_t k = 0 ; k < count ; k++ ) {
|
for ( size_t k = 0 ; k < count ; k++ ) {
|
||||||
size_t restore = io.tell();
|
size_t restore = io.tell();
|
||||||
uint32_t offset = byteSwap4(buf,k*size,bSwap);
|
uint32_t offset = byteSwap4(buf, k*size, bSwap);
|
||||||
printIFDStructure(io,out,option,offset,bSwap,c,depth);
|
printIFDStructure(io, out, option, offset, bSwap,c,depth);
|
||||||
io.seek(restore,BasicIo::beg);
|
io.seek(restore,BasicIo::beg);
|
||||||
}
|
}
|
||||||
} else if ( option == kpsRecursive && tag == 0x83bb /* IPTCNAA */ ) {
|
} else if ( option == kpsRecursive && tag == 0x83bb /* IPTCNAA */ ) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user