More size_t for sizes
This commit is contained in:
+4
-4
@@ -926,7 +926,7 @@ namespace Action {
|
||||
if (num == 0) {
|
||||
// Write all previews
|
||||
for (num = 0; num < pvList.size(); ++num) {
|
||||
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), static_cast<int>(num + 1));
|
||||
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), num + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -936,7 +936,7 @@ namespace Action {
|
||||
<< " " << num + 1 << "\n";
|
||||
continue;
|
||||
}
|
||||
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), static_cast<int>(num + 1));
|
||||
writePreviewFile(pvMgr.getPreviewImage(pvList[num]), num + 1);
|
||||
}
|
||||
return 0;
|
||||
} // Extract::writePreviews
|
||||
@@ -977,7 +977,7 @@ namespace Action {
|
||||
} // Extract::writeIccProfile
|
||||
|
||||
|
||||
void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, int num) const
|
||||
void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const
|
||||
{
|
||||
std::string pvFile = newFilePath(path_, "-preview") + Exiv2::toString(num);
|
||||
std::string pvPath = pvFile + pvImg.extension();
|
||||
@@ -997,7 +997,7 @@ namespace Action {
|
||||
std::cerr << path_ << ": " << _("Image does not have preview")
|
||||
<< " " << num << "\n";
|
||||
}
|
||||
} // Extract::writePreviewFile
|
||||
}
|
||||
|
||||
Task::UniquePtr Extract::clone() const
|
||||
{
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ namespace Action {
|
||||
/// @param path Path of the file to process.
|
||||
/// @return 0 if successful.
|
||||
virtual int run(const std::string& path) =0;
|
||||
|
||||
|
||||
bool setBinary(bool b)
|
||||
{
|
||||
bool bResult = binary_;
|
||||
@@ -240,7 +240,7 @@ namespace Action {
|
||||
/// @brief Write one preview image to a file. The filename is composed by removing the suffix from the image
|
||||
/// filename and appending "-preview<num>" and the appropriate suffix (".jpg" or ".tif"), depending on the
|
||||
/// format of the Exif thumbnail image.
|
||||
void writePreviewFile(const Exiv2::PreviewImage& pvImg, int num) const;
|
||||
void writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const;
|
||||
|
||||
/// @brief Write embedded iccProfile files.
|
||||
int writeIccProfile(const std::string& target) const;
|
||||
|
||||
@@ -99,16 +99,15 @@ namespace Exiv2 {
|
||||
IptcData& iptcData,
|
||||
XmpData& xmpData,
|
||||
const byte* pData,
|
||||
uint32_t size
|
||||
size_t size
|
||||
);
|
||||
/*!
|
||||
@brief Encode metadata from the provided metadata to CR2 format.
|
||||
See TiffParser::encode().
|
||||
*/
|
||||
static WriteMethod encode(
|
||||
BasicIo& io,
|
||||
static WriteMethod encode(BasicIo& io,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder byteOrder,
|
||||
const ExifData& exifData,
|
||||
const IptcData& iptcData,
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Exiv2 {
|
||||
|
||||
@throw Error If the data buffer cannot be parsed.
|
||||
*/
|
||||
static void decode(CrwImage* pCrwImage, const byte* pData, uint32_t size);
|
||||
static void decode(CrwImage* pCrwImage, const byte* pData, size_t size);
|
||||
/*!
|
||||
@brief Encode metadata from the CRW image into a data buffer (the
|
||||
binary CRW image).
|
||||
@@ -118,10 +118,9 @@ namespace Exiv2 {
|
||||
|
||||
@throw Error If the metadata from the CRW image cannot be encoded.
|
||||
*/
|
||||
static void encode(
|
||||
Blob& blob,
|
||||
static void encode(Blob& blob,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
const CrwImage* pCrwImage
|
||||
);
|
||||
|
||||
|
||||
@@ -164,17 +164,17 @@ namespace Exiv2 {
|
||||
//! Return the name of the type
|
||||
const char* typeName() const override;
|
||||
//! Return the size in bytes of one component of this type
|
||||
long typeSize() const override;
|
||||
size_t typeSize() const override;
|
||||
//! Return the number of components in the value
|
||||
size_t count() const override;
|
||||
//! Return the size of the value in bytes
|
||||
size_t size() const override;
|
||||
//! Return the value as a string.
|
||||
std::string toString() const override;
|
||||
std::string toString(long n) const override;
|
||||
int64_t toInt64(long n = 0) const override;
|
||||
float toFloat(long n = 0) const override;
|
||||
Rational toRational(long n = 0) const override;
|
||||
std::string toString(size_t n) const override;
|
||||
int64_t toInt64(size_t n = 0) const override;
|
||||
float toFloat(size_t n = 0) const override;
|
||||
Rational toRational(size_t n = 0) const override;
|
||||
Value::UniquePtr getValue() const override;
|
||||
const Value& value() const override;
|
||||
//! Return the size of the data area.
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Exiv2
|
||||
|
||||
@note Source: https://github.com/davidgaleano/libwebsockets/blob/master/lib/base64-decode.c
|
||||
*/
|
||||
EXIV2API long base64decode(const char* in, char* out, size_t out_size);
|
||||
EXIV2API size_t base64decode(const char* in, char* out, size_t out_size);
|
||||
|
||||
/*!
|
||||
@brief Return the protocol of the path.
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Exiv2 {
|
||||
/*!
|
||||
@brief Print out the structure of a TIFF IFD
|
||||
*/
|
||||
void printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth);
|
||||
void printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option, size_t start, bool bSwap, char c, int depth);
|
||||
|
||||
/*!
|
||||
@brief is the host platform bigEndian
|
||||
|
||||
@@ -118,14 +118,14 @@ namespace Exiv2 {
|
||||
uint16_t tag() const override;
|
||||
TypeId typeId() const override;
|
||||
const char* typeName() const override;
|
||||
long typeSize() const override;
|
||||
size_t typeSize() const override;
|
||||
size_t count() const override;
|
||||
size_t size() const override;
|
||||
std::string toString() const override;
|
||||
std::string toString(long n) const override;
|
||||
int64_t toInt64(long n = 0) const override;
|
||||
float toFloat(long n = 0) const override;
|
||||
Rational toRational(long n = 0) const override;
|
||||
std::string toString(size_t n) const override;
|
||||
int64_t toInt64(size_t n = 0) const override;
|
||||
float toFloat(size_t n = 0) const override;
|
||||
Rational toRational(size_t n = 0) const override;
|
||||
Value::UniquePtr getValue() const override;
|
||||
const Value& value() const override;
|
||||
//@}
|
||||
@@ -272,7 +272,7 @@ namespace Exiv2 {
|
||||
@return 0 if successful;<BR>
|
||||
5 if the binary IPTC data is invalid or corrupt
|
||||
*/
|
||||
static int decode(IptcData& iptcData, const byte* pData, uint32_t size);
|
||||
static int decode(IptcData& iptcData, const byte* pData, size_t size);
|
||||
|
||||
/*!
|
||||
@brief Encode the IPTC datasets from \em iptcData to a binary representation in IPTC IIM4 format.
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Exiv2 {
|
||||
//! Return the name of the type
|
||||
virtual const char* typeName() const =0;
|
||||
//! Return the size in bytes of one component of this type
|
||||
virtual long typeSize() const =0;
|
||||
virtual size_t typeSize() const =0;
|
||||
//! Return the number of components in the value
|
||||
virtual size_t count() const =0;
|
||||
//! Return the size of the value in bytes
|
||||
@@ -199,29 +199,29 @@ namespace Exiv2 {
|
||||
a string. The behaviour of the method is undefined if there
|
||||
is no <EM>n</EM>-th component.
|
||||
*/
|
||||
virtual std::string toString(long n) const =0;
|
||||
virtual std::string toString(size_t n) const =0;
|
||||
/*!
|
||||
@brief Return the <EM>n</EM>-th component of the value converted to int64_t.
|
||||
The return value is -1 if the value is not set and the behaviour
|
||||
of the method is undefined if there is no <EM>n</EM>-th component.
|
||||
*/
|
||||
virtual int64_t toInt64(long n =0) const =0;
|
||||
virtual int64_t toInt64(size_t n =0) const =0;
|
||||
/*!
|
||||
@brief Return the <EM>n</EM>-th component of the value converted to uint32_t.
|
||||
*/
|
||||
uint32_t toUint32(long n =0) const;
|
||||
uint32_t toUint32(size_t n =0) const;
|
||||
/*!
|
||||
@brief Return the <EM>n</EM>-th component of the value converted to float.
|
||||
The return value is -1 if the value is not set and the behaviour
|
||||
of the method is undefined if there is no <EM>n</EM>-th component.
|
||||
*/
|
||||
virtual float toFloat(long n =0) const =0;
|
||||
virtual float toFloat(size_t n =0) const =0;
|
||||
/*!
|
||||
@brief Return the <EM>n</EM>-th component of the value converted to Rational.
|
||||
The return value is -1/1 if the value is not set and the behaviour
|
||||
of the method is undefined if there is no <EM>n</EM>-th component.
|
||||
*/
|
||||
virtual Rational toRational(long n =0) const =0;
|
||||
virtual Rational toRational(size_t n =0) const =0;
|
||||
/*!
|
||||
@brief Return an auto-pointer to a copy (clone) of the value. The
|
||||
caller owns this copy and the auto-poiner ensures that it will
|
||||
|
||||
@@ -244,9 +244,7 @@ namespace Exiv2 {
|
||||
|
||||
explicit DataValue(TypeId typeId =undefined);
|
||||
|
||||
DataValue(const byte* buf,
|
||||
long len, ByteOrder byteOrder =invalidByteOrder,
|
||||
TypeId typeId =undefined);
|
||||
DataValue(const byte* buf, size_t len, ByteOrder byteOrder =invalidByteOrder, TypeId typeId =undefined);
|
||||
|
||||
~DataValue() override = default;
|
||||
|
||||
@@ -1142,7 +1140,7 @@ namespace Exiv2 {
|
||||
// The default c'tor and this one can be combined, but that causes MSVC 7.1 to fall on its nose
|
||||
explicit ValueType(TypeId typeId);
|
||||
//! Constructor.
|
||||
ValueType(const byte* buf, long len, ByteOrder byteOrder, TypeId typeId =getType<T>());
|
||||
ValueType(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId =getType<T>());
|
||||
//! Constructor.
|
||||
explicit ValueType(const T& val, TypeId typeId =getType<T>());
|
||||
//! Copy constructor
|
||||
@@ -1457,7 +1455,7 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder, TypeId typeId) : Value(typeId)
|
||||
ValueType<T>::ValueType(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId) : Value(typeId)
|
||||
{
|
||||
read(buf, len, byteOrder);
|
||||
}
|
||||
@@ -1553,7 +1551,7 @@ namespace Exiv2 {
|
||||
template<typename T>
|
||||
size_t ValueType<T>::size() const
|
||||
{
|
||||
return static_cast<long>(TypeInfo::typeSize(typeId()) * value_.size());
|
||||
return TypeInfo::typeSize(typeId()) * value_.size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -113,14 +113,14 @@ namespace Exiv2 {
|
||||
const char* typeName() const override;
|
||||
// Todo: Remove this method from the baseclass
|
||||
//! The Exif typeSize doesn't make sense here. Return 0.
|
||||
long typeSize() const override;
|
||||
size_t typeSize() const override;
|
||||
size_t count() const override;
|
||||
size_t size() const override;
|
||||
std::string toString() const override;
|
||||
std::string toString(long n) const override;
|
||||
int64_t toInt64(long n = 0) const override;
|
||||
float toFloat(long n = 0) const override;
|
||||
Rational toRational(long n = 0) const override;
|
||||
std::string toString(size_t n) const override;
|
||||
int64_t toInt64(size_t n = 0) const override;
|
||||
float toFloat(size_t n = 0) const override;
|
||||
Rational toRational(size_t n = 0) const override;
|
||||
Value::UniquePtr getValue() const override;
|
||||
const Value& value() const override;
|
||||
//@}
|
||||
|
||||
+31
-30
@@ -281,7 +281,7 @@ namespace Exiv2 {
|
||||
p_->pMappedArea_ = static_cast<byte*>(rc);
|
||||
#else
|
||||
// Workaround for platforms without mmap: Read the file into memory
|
||||
DataBuf buf(static_cast<long>(p_->mappedLength_));
|
||||
DataBuf buf(p_->mappedLength_);
|
||||
if (read(buf.data(), buf.size()) != buf.size()) {
|
||||
throw Error(ErrorCode::kerCallFailed, path(), strError(), "FileIo::read");
|
||||
}
|
||||
@@ -529,7 +529,7 @@ namespace Exiv2 {
|
||||
DataBuf FileIo::read(size_t rcount)
|
||||
{
|
||||
assert(p_->fp_);
|
||||
if (static_cast<size_t>(rcount) > size())
|
||||
if (rcount > size())
|
||||
throw Error(ErrorCode::kerInvalidMalloc);
|
||||
DataBuf buf(rcount);
|
||||
size_t readCount = read(buf.data(), buf.size());
|
||||
@@ -767,8 +767,10 @@ namespace Exiv2 {
|
||||
|
||||
size_t MemIo::write(BasicIo& src)
|
||||
{
|
||||
if (static_cast<BasicIo*>(this) == &src) return 0;
|
||||
if (!src.isopen()) return 0;
|
||||
if (static_cast<BasicIo*>(this) == &src)
|
||||
return 0;
|
||||
if (!src.isopen())
|
||||
return 0;
|
||||
|
||||
byte buf[4096];
|
||||
size_t readCount = 0;
|
||||
@@ -807,7 +809,7 @@ namespace Exiv2 {
|
||||
return 1;
|
||||
}
|
||||
|
||||
p_->idx_ = static_cast<long>(newIdx);
|
||||
p_->idx_ = static_cast<size_t>(newIdx);
|
||||
p_->eof_ = false;
|
||||
return 0;
|
||||
}
|
||||
@@ -936,7 +938,7 @@ namespace Exiv2 {
|
||||
|
||||
std::string data = path.substr(base64Pos+7);
|
||||
char* decodeData = new char[data.length()];
|
||||
long size = base64decode(data.c_str(), decodeData, data.length());
|
||||
auto size = base64decode(data.c_str(), decodeData, data.length());
|
||||
if (size > 0)
|
||||
write((byte*)decodeData, size);
|
||||
else
|
||||
@@ -1012,7 +1014,7 @@ namespace Exiv2 {
|
||||
|
||||
std::string data = orgPath.substr(base64Pos+7);
|
||||
std::vector<char> decodeData (data.length());
|
||||
long size = base64decode(data.c_str(), decodeData.data(), data.length());
|
||||
auto size = base64decode(data.c_str(), decodeData.data(), data.length());
|
||||
if (size > 0) {
|
||||
fs.write(decodeData.data(), size);
|
||||
fs.close();
|
||||
@@ -1065,7 +1067,7 @@ namespace Exiv2 {
|
||||
@throw Error if the server returns the error code.
|
||||
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
|
||||
*/
|
||||
virtual void getDataByRange(long lowBlock, long highBlock, std::string& response) = 0;
|
||||
virtual void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) = 0;
|
||||
/*!
|
||||
@brief Submit the data to the remote machine. The data replace a part of the remote file.
|
||||
The replaced part of remote file is indicated by from and to parameters.
|
||||
@@ -1077,7 +1079,7 @@ namespace Exiv2 {
|
||||
on the remote machine to handle the data. SSH requires the permission to edit the file.
|
||||
@throw Error if it fails.
|
||||
*/
|
||||
virtual void writeRemote(const byte* data, size_t size, long from, long to) = 0;
|
||||
virtual void writeRemote(const byte* data, size_t size, size_t from, size_t to) = 0;
|
||||
/*!
|
||||
@brief Get the data from the remote machine and write them to the memory blocks.
|
||||
@param lowBlock The start block index.
|
||||
@@ -1114,7 +1116,7 @@ namespace Exiv2 {
|
||||
if (blocksMap_[highBlock].isNone())
|
||||
{
|
||||
std::string data;
|
||||
getDataByRange(static_cast<long>(lowBlock), static_cast<long>(highBlock), data);
|
||||
getDataByRange(lowBlock, highBlock, data);
|
||||
rcount = data.length();
|
||||
if (rcount == 0) {
|
||||
throw Error(ErrorCode::kerErrorMessage, "Data By Range is empty. Please check the permission.");
|
||||
@@ -1156,7 +1158,7 @@ namespace Exiv2 {
|
||||
long length = p_->getFileLength();
|
||||
if (length < 0) { // unable to get the length of remote file, get the whole file content.
|
||||
std::string data;
|
||||
p_->getDataByRange(-1, -1, data);
|
||||
p_->getDataByRange(std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max(), data);
|
||||
p_->size_ = data.length();
|
||||
size_t nBlocks = (p_->size_ + p_->blockSize_ - 1) / p_->blockSize_;
|
||||
p_->blocksMap_ = new BlockMap[nBlocks];
|
||||
@@ -1206,7 +1208,8 @@ namespace Exiv2 {
|
||||
size_t RemoteIo::write(BasicIo& src)
|
||||
{
|
||||
assert(p_->isMalloced_);
|
||||
if (!src.isopen()) return 0;
|
||||
if (!src.isopen())
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The idea is to compare the file content, find the different bytes and submit them to the remote machine.
|
||||
@@ -1262,16 +1265,14 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
// submit to the remote machine.
|
||||
auto dataSize = static_cast<long>(src.size() - left - right);
|
||||
auto dataSize = src.size() - left - right;
|
||||
if (dataSize > 0) {
|
||||
auto data = static_cast<byte*>(std::malloc(dataSize));
|
||||
std::vector<byte> data(dataSize);
|
||||
src.seek(left, BasicIo::beg);
|
||||
src.read(data, dataSize);
|
||||
p_->writeRemote(data, dataSize, static_cast<long>(left), static_cast<long>(p_->size_ - right));
|
||||
if (data)
|
||||
std::free(data);
|
||||
src.read(data.data(), dataSize);
|
||||
p_->writeRemote(data.data(), dataSize, left, p_->size_ - right);
|
||||
}
|
||||
return static_cast<long>(src.size());
|
||||
return src.size();
|
||||
}
|
||||
|
||||
int RemoteIo::putb(byte /*unused data*/)
|
||||
@@ -1410,7 +1411,7 @@ namespace Exiv2 {
|
||||
|
||||
size_t RemoteIo::size() const
|
||||
{
|
||||
return static_cast<long>(p_->size_);
|
||||
return p_->size_;
|
||||
}
|
||||
|
||||
bool RemoteIo::isopen() const
|
||||
@@ -1468,7 +1469,7 @@ namespace Exiv2 {
|
||||
@throw Error if the server returns the error code.
|
||||
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
|
||||
*/
|
||||
void getDataByRange(long lowBlock, long highBlock, std::string& response) override;
|
||||
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) override;
|
||||
/*!
|
||||
@brief Submit the data to the remote machine. The data replace a part of the remote file.
|
||||
The replaced part of remote file is indicated by from and to parameters.
|
||||
@@ -1482,7 +1483,7 @@ namespace Exiv2 {
|
||||
"/exiv2.php". More info is available at http://dev.exiv2.org/wiki/exiv2
|
||||
@throw Error if it fails.
|
||||
*/
|
||||
void writeRemote(const byte* data, size_t size, long from, long to) override;
|
||||
void writeRemote(const byte* data, size_t size, size_t from, size_t to) override;
|
||||
|
||||
// NOT IMPLEMENTED
|
||||
HttpImpl(const HttpImpl& rhs) = delete; //!< Copy constructor
|
||||
@@ -1514,7 +1515,7 @@ namespace Exiv2 {
|
||||
return (lengthIter == response.end()) ? -1 : atol((lengthIter->second).c_str());
|
||||
}
|
||||
|
||||
void HttpIo::HttpImpl::getDataByRange(long lowBlock, long highBlock, std::string& response)
|
||||
void HttpIo::HttpImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response)
|
||||
{
|
||||
Exiv2::Dictionary responseDic;
|
||||
Exiv2::Dictionary request;
|
||||
@@ -1524,7 +1525,7 @@ namespace Exiv2 {
|
||||
request["port"] = hostInfo_.Port;
|
||||
request["verb"] = "GET";
|
||||
std::string errors;
|
||||
if (lowBlock > -1 && highBlock > -1) {
|
||||
if (lowBlock != std::numeric_limits<size_t>::max() && highBlock != std::numeric_limits<size_t>::max()) {
|
||||
std::stringstream ss;
|
||||
ss << "Range: bytes=" << lowBlock * blockSize_ << "-" << ((highBlock + 1) * blockSize_ - 1) << "\r\n";
|
||||
request["header"] = ss.str();
|
||||
@@ -1537,7 +1538,7 @@ namespace Exiv2 {
|
||||
response = responseDic["body"];
|
||||
}
|
||||
|
||||
void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, long from, long to)
|
||||
void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, size_t from, size_t to)
|
||||
{
|
||||
std::string scriptPath(getEnv(envHTTPPOST));
|
||||
if (scriptPath.empty()) {
|
||||
@@ -1619,7 +1620,7 @@ namespace Exiv2 {
|
||||
@throw Error if the server returns the error code.
|
||||
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content.
|
||||
*/
|
||||
void getDataByRange(long lowBlock, long highBlock, std::string& response) override;
|
||||
void getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) override;
|
||||
/*!
|
||||
@brief Submit the data to the remote machine. The data replace a part of the remote file.
|
||||
The replaced part of remote file is indicated by from and to parameters.
|
||||
@@ -1634,7 +1635,7 @@ namespace Exiv2 {
|
||||
string EXIV2_HTTP_POST. The default value is "/exiv2.php". More info is available at
|
||||
http://dev.exiv2.org/wiki/exiv2
|
||||
*/
|
||||
void writeRemote(const byte* data, size_t size, long from, long to) override;
|
||||
void writeRemote(const byte* data, size_t size, size_t from, size_t to) override;
|
||||
|
||||
// NOT IMPLEMENTED
|
||||
CurlImpl(const CurlImpl& rhs) = delete; //!< Copy constructor
|
||||
@@ -1693,7 +1694,7 @@ namespace Exiv2 {
|
||||
return static_cast<long>(temp);
|
||||
}
|
||||
|
||||
void CurlIo::CurlImpl::getDataByRange(long lowBlock, long highBlock, std::string& response)
|
||||
void CurlIo::CurlImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response)
|
||||
{
|
||||
curl_easy_reset(curl_); // reset all options
|
||||
curl_easy_setopt(curl_, CURLOPT_URL, path_.c_str());
|
||||
@@ -1706,7 +1707,7 @@ namespace Exiv2 {
|
||||
|
||||
//curl_easy_setopt(curl_, CURLOPT_VERBOSE, 1); // debugging mode
|
||||
|
||||
if (lowBlock > -1 && highBlock> -1) {
|
||||
if (lowBlock != std::numeric_limits<size_t>::max() && highBlock != std::numeric_limits<size_t>::max()) {
|
||||
std::stringstream ss;
|
||||
ss << lowBlock * blockSize_ << "-" << ((highBlock + 1) * blockSize_ - 1);
|
||||
std::string range = ss.str();
|
||||
@@ -1726,7 +1727,7 @@ namespace Exiv2 {
|
||||
}
|
||||
}
|
||||
|
||||
void CurlIo::CurlImpl::writeRemote(const byte* data, size_t size, long from, long to)
|
||||
void CurlIo::CurlImpl::writeRemote(const byte* data, size_t size, size_t from, size_t to)
|
||||
{
|
||||
std::string scriptPath(getEnv(envHTTPPOST));
|
||||
if (scriptPath.empty()) {
|
||||
|
||||
+6
-5
@@ -535,7 +535,7 @@ namespace Exiv2 {
|
||||
if (!prepareXmpTarget(to))
|
||||
return;
|
||||
for (size_t i = 0; i < pos->count(); ++i) {
|
||||
std::string value = pos->toString(static_cast<long>(i));
|
||||
std::string value = pos->toString(i);
|
||||
if (!pos->value().ok()) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
|
||||
@@ -687,7 +687,7 @@ namespace Exiv2 {
|
||||
return;
|
||||
std::ostringstream value;
|
||||
for (size_t i = 0; i < pos->count(); ++i) {
|
||||
value << static_cast<char>(pos->toInt64(static_cast<long>(i)));
|
||||
value << static_cast<char>(pos->toInt64(i));
|
||||
}
|
||||
(*xmpData_)[to] = value.str();
|
||||
if (erase_) exifData_->erase(pos);
|
||||
@@ -702,8 +702,9 @@ namespace Exiv2 {
|
||||
return;
|
||||
std::ostringstream value;
|
||||
for (size_t i = 0; i < pos->count(); ++i) {
|
||||
if (i > 0) value << '.';
|
||||
value << pos->toInt64(static_cast<long>(i));
|
||||
if (i > 0)
|
||||
value << '.';
|
||||
value << pos->toInt64(i);
|
||||
}
|
||||
(*xmpData_)[to] = value.str();
|
||||
if (erase_) exifData_->erase(pos);
|
||||
@@ -830,7 +831,7 @@ namespace Exiv2 {
|
||||
return;
|
||||
std::ostringstream array;
|
||||
for (size_t i = 0; i < pos->count(); ++i) {
|
||||
std::string value = pos->toString(static_cast<long>(i));
|
||||
std::string value = pos->toString(i);
|
||||
if (!pos->value().ok()) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
|
||||
|
||||
+6
-12
@@ -77,8 +77,7 @@ namespace Exiv2 {
|
||||
throw Error(ErrorCode::kerNotAnImage, "CR2");
|
||||
}
|
||||
clearMetadata();
|
||||
ByteOrder bo =
|
||||
Cr2Parser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), static_cast<uint32_t>(io_->size()));
|
||||
ByteOrder bo = Cr2Parser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), io_->size());
|
||||
setByteOrder(bo);
|
||||
} // Cr2Image::readMetadata
|
||||
|
||||
@@ -89,13 +88,13 @@ namespace Exiv2 {
|
||||
#endif
|
||||
ByteOrder bo = byteOrder();
|
||||
byte* pData = nullptr;
|
||||
long size = 0;
|
||||
size_t size = 0;
|
||||
IoCloser closer(*io_);
|
||||
if (io_->open() == 0) {
|
||||
// Ensure that this is the correct image type
|
||||
if (isCr2Type(*io_, false)) {
|
||||
pData = io_->mmap(true);
|
||||
size = static_cast<long>(io_->size());
|
||||
size = io_->size();
|
||||
Cr2Header cr2Header;
|
||||
if (0 == cr2Header.read(pData, 16)) {
|
||||
bo = cr2Header.byteOrder();
|
||||
@@ -109,13 +108,8 @@ namespace Exiv2 {
|
||||
Cr2Parser::encode(*io_, pData, size, bo, exifData_, iptcData_, xmpData_); // may throw
|
||||
} // Cr2Image::writeMetadata
|
||||
|
||||
ByteOrder Cr2Parser::decode(
|
||||
ExifData& exifData,
|
||||
IptcData& iptcData,
|
||||
XmpData& xmpData,
|
||||
const byte* pData,
|
||||
uint32_t size
|
||||
)
|
||||
ByteOrder Cr2Parser::decode(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, const byte* pData,
|
||||
size_t size)
|
||||
{
|
||||
Cr2Header cr2Header;
|
||||
return TiffParserWorker::decode(exifData,
|
||||
@@ -131,7 +125,7 @@ namespace Exiv2 {
|
||||
WriteMethod Cr2Parser::encode(
|
||||
BasicIo& io,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder byteOrder,
|
||||
const ExifData& exifData,
|
||||
const IptcData& iptcData,
|
||||
|
||||
+5
-10
@@ -74,7 +74,7 @@ namespace Exiv2 {
|
||||
DataBuf file(io().size());
|
||||
io_->read(file.data(), file.size());
|
||||
|
||||
CrwParser::decode(this, io_->mmap(), static_cast<uint32_t>(io_->size()));
|
||||
CrwParser::decode(this, io_->mmap(), io_->size());
|
||||
|
||||
} // CrwImage::readMetadata
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
Blob blob;
|
||||
CrwParser::encode(blob, buf.c_data(), static_cast<uint32_t>(buf.size()), this);
|
||||
CrwParser::encode(blob, buf.c_data(), buf.size(), this);
|
||||
|
||||
// Write new buffer to file
|
||||
auto tempIo = std::make_unique<MemIo>();
|
||||
@@ -109,7 +109,7 @@ namespace Exiv2 {
|
||||
|
||||
} // CrwImage::writeMetadata
|
||||
|
||||
void CrwParser::decode(CrwImage* pCrwImage, const byte* pData, uint32_t size)
|
||||
void CrwParser::decode(CrwImage* pCrwImage, const byte* pData, size_t size)
|
||||
{
|
||||
assert(pCrwImage);
|
||||
assert(pData);
|
||||
@@ -123,16 +123,11 @@ namespace Exiv2 {
|
||||
CiffComponent* preview = header.findComponent(0x2007, 0x0000);
|
||||
if (preview) {
|
||||
(pCrwImage->exifData())["Exif.Image2.JPEGInterchangeFormat"] = uint32_t(preview->pData() - pData);
|
||||
(pCrwImage->exifData())["Exif.Image2.JPEGInterchangeFormatLength"] = preview->size();
|
||||
(pCrwImage->exifData())["Exif.Image2.JPEGInterchangeFormatLength"] = static_cast<uint32_t>(preview->size());
|
||||
}
|
||||
} // CrwParser::decode
|
||||
|
||||
void CrwParser::encode(
|
||||
Blob& blob,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
const CrwImage* pCrwImage
|
||||
)
|
||||
void CrwParser::encode(Blob& blob, const byte* pData, size_t size, const CrwImage* pCrwImage)
|
||||
{
|
||||
// Parse image, starting with a CIFF header component
|
||||
CiffHeader header;
|
||||
|
||||
+29
-44
@@ -169,10 +169,10 @@ namespace Exiv2::Internal {
|
||||
components_.push_back(component.release());
|
||||
} // CiffDirectory::doAdd
|
||||
|
||||
void CiffHeader::read(const byte* pData, uint32_t size)
|
||||
void CiffHeader::read(const byte* pData, size_t size)
|
||||
{
|
||||
if (size < 14) throw
|
||||
Error(ErrorCode::kerNotACrwImage);
|
||||
if (size < 14)
|
||||
throw Error(ErrorCode::kerNotACrwImage);
|
||||
|
||||
if (pData[0] == 'I' && pData[0] == pData[1]) {
|
||||
byteOrder_ = littleEndian;
|
||||
@@ -199,18 +199,12 @@ namespace Exiv2::Internal {
|
||||
pRootDir_->readDirectory(pData + offset_, size - offset_, byteOrder_);
|
||||
} // CiffHeader::read
|
||||
|
||||
void CiffComponent::read(const byte* pData,
|
||||
uint32_t size,
|
||||
uint32_t start,
|
||||
ByteOrder byteOrder)
|
||||
void CiffComponent::read(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder)
|
||||
{
|
||||
doRead(pData, size, start, byteOrder);
|
||||
}
|
||||
|
||||
void CiffComponent::doRead(const byte* pData,
|
||||
uint32_t size,
|
||||
uint32_t start,
|
||||
ByteOrder byteOrder)
|
||||
void CiffComponent::doRead(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder)
|
||||
{
|
||||
// We're going read 10 bytes. Make sure they won't be out-of-bounds.
|
||||
enforce(size >= 10 && start <= size - 10, ErrorCode::kerNotACrwImage);
|
||||
@@ -253,7 +247,7 @@ namespace Exiv2::Internal {
|
||||
} // CiffComponent::doRead
|
||||
|
||||
void CiffDirectory::doRead(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
uint32_t start,
|
||||
ByteOrder byteOrder)
|
||||
{
|
||||
@@ -270,9 +264,7 @@ namespace Exiv2::Internal {
|
||||
#endif
|
||||
} // CiffDirectory::doRead
|
||||
|
||||
void CiffDirectory::readDirectory(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder)
|
||||
void CiffDirectory::readDirectory(const byte* pData, size_t size, ByteOrder byteOrder)
|
||||
{
|
||||
if (size < 4)
|
||||
throw Error(ErrorCode::kerCorruptedMetadata);
|
||||
@@ -360,21 +352,17 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t CiffComponent::write(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
uint32_t offset)
|
||||
size_t CiffComponent::write(Blob& blob, ByteOrder byteOrder, size_t offset)
|
||||
{
|
||||
return doWrite(blob, byteOrder, offset);
|
||||
}
|
||||
|
||||
uint32_t CiffEntry::doWrite(Blob& blob,
|
||||
ByteOrder /*byteOrder*/,
|
||||
uint32_t offset)
|
||||
size_t CiffEntry::doWrite(Blob& blob, ByteOrder /*byteOrder*/, size_t offset)
|
||||
{
|
||||
return writeValueData(blob, offset);
|
||||
} // CiffEntry::doWrite
|
||||
}
|
||||
|
||||
uint32_t CiffComponent::writeValueData(Blob& blob, uint32_t offset)
|
||||
size_t CiffComponent::writeValueData(Blob& blob, size_t offset)
|
||||
{
|
||||
if (dataLocation() == valueData) {
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
@@ -391,23 +379,21 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
} // CiffComponent::writeValueData
|
||||
}
|
||||
|
||||
uint32_t CiffDirectory::doWrite(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
uint32_t offset)
|
||||
size_t CiffDirectory::doWrite(Blob& blob, ByteOrder byteOrder, size_t offset)
|
||||
{
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
std::cout << "Writing directory 0x" << std::hex << tag() << "---->\n";
|
||||
#endif
|
||||
// Ciff offsets are relative to the start of the directory
|
||||
uint32_t dirOffset = 0;
|
||||
size_t dirOffset = 0;
|
||||
|
||||
// Value data
|
||||
for (auto&& component : components_) {
|
||||
dirOffset = component->write(blob, byteOrder, dirOffset);
|
||||
}
|
||||
const uint32_t dirStart = dirOffset;
|
||||
const uint32_t dirStart = static_cast<uint32_t>(dirOffset);
|
||||
|
||||
// Number of directory entries
|
||||
byte buf[4];
|
||||
@@ -455,10 +441,10 @@ namespace Exiv2::Internal {
|
||||
us2Data(buf, tag_, byteOrder);
|
||||
append(blob, buf, 2);
|
||||
|
||||
ul2Data(buf, size_, byteOrder);
|
||||
ul2Data(buf, static_cast<uint32_t>(size_), byteOrder);
|
||||
append(blob, buf, 4);
|
||||
|
||||
ul2Data(buf, offset_, byteOrder);
|
||||
ul2Data(buf, static_cast<uint32_t>(offset_), byteOrder);
|
||||
append(blob, buf, 4);
|
||||
}
|
||||
|
||||
@@ -471,7 +457,7 @@ namespace Exiv2::Internal {
|
||||
// Copy value instead of size and offset
|
||||
append(blob, pData_, size_);
|
||||
// Pad with 0s
|
||||
for (uint32_t i = size_; i < 8; ++i) {
|
||||
for (size_t i = size_; i < 8; ++i) {
|
||||
blob.push_back(0);
|
||||
}
|
||||
}
|
||||
@@ -520,11 +506,11 @@ namespace Exiv2::Internal {
|
||||
{
|
||||
storage_ = std::move(buf);
|
||||
pData_ = storage_.c_data();
|
||||
size_ = static_cast<uint32_t>(storage_.size());
|
||||
size_ = storage_.size();
|
||||
if (size_ > 8 && dataLocation() == directoryData) {
|
||||
tag_ &= 0x3fff;
|
||||
}
|
||||
} // CiffComponent::setValue
|
||||
}
|
||||
|
||||
TypeId CiffComponent::typeId(uint16_t tag)
|
||||
{
|
||||
@@ -811,9 +797,9 @@ namespace Exiv2::Internal {
|
||||
assert(ifdId != ifdIdNotSet);
|
||||
|
||||
std::string groupName(Internal::groupName(ifdId));
|
||||
const uint32_t component_size = ciffComponent.size();
|
||||
const size_t component_size = ciffComponent.size();
|
||||
enforce(component_size % 2 == 0, ErrorCode::kerCorruptedMetadata);
|
||||
enforce(component_size/2 <= static_cast<uint32_t>(std::numeric_limits<uint16_t>::max()), ErrorCode::kerCorruptedMetadata);
|
||||
enforce(component_size/2 <= static_cast<size_t>(std::numeric_limits<uint16_t>::max()), ErrorCode::kerCorruptedMetadata);
|
||||
const auto num_components = static_cast<uint16_t>(component_size / 2);
|
||||
uint16_t c = 1;
|
||||
while (c < num_components) {
|
||||
@@ -915,10 +901,9 @@ namespace Exiv2::Internal {
|
||||
std::unique_ptr<Value> value;
|
||||
if (ciffComponent.typeId() != directory) {
|
||||
value = Value::create(ciffComponent.typeId());
|
||||
uint32_t size = 0;
|
||||
size_t size = 0;
|
||||
if (pCrwMapping->size_ != 0) {
|
||||
// size in the mapping table overrides all
|
||||
size = pCrwMapping->size_;
|
||||
size = pCrwMapping->size_; // size in the mapping table overrides all
|
||||
}
|
||||
else if (ciffComponent.typeId() == asciiString) {
|
||||
// determine size from the data, by looking for the first 0
|
||||
@@ -991,8 +976,9 @@ namespace Exiv2::Internal {
|
||||
CiffComponent* cc = pHead->findComponent(pCrwMapping->crwTagId_,
|
||||
pCrwMapping->crwDir_);
|
||||
if (!comment.empty()) {
|
||||
auto size = static_cast<uint32_t>(comment.size());
|
||||
if (cc && cc->size() > size) size = cc->size();
|
||||
auto size = comment.size();
|
||||
if (cc && cc->size() > size)
|
||||
size = cc->size();
|
||||
DataBuf buf(size);
|
||||
buf.copyBytes(0, comment.data(), comment.size());
|
||||
pHead->add(pCrwMapping->crwTagId_, pCrwMapping->crwDir_, std::move(buf));
|
||||
@@ -1115,10 +1101,9 @@ namespace Exiv2::Internal {
|
||||
const auto edO = exivData.findKey(kO);
|
||||
const auto edEnd = exivData.end();
|
||||
|
||||
CiffComponent* cc = pHead->findComponent(pCrwMapping->crwTagId_,
|
||||
pCrwMapping->crwDir_);
|
||||
CiffComponent* cc = pHead->findComponent(pCrwMapping->crwTagId_, pCrwMapping->crwDir_);
|
||||
if (edX != edEnd || edY != edEnd || edO != edEnd) {
|
||||
uint32_t size = 28;
|
||||
size_t size = 28;
|
||||
if (cc) {
|
||||
if (cc->size() < size)
|
||||
throw Error(ErrorCode::kerCorruptedMetadata);
|
||||
|
||||
+18
-24
@@ -110,10 +110,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
@throw Error If the component cannot be parsed.
|
||||
*/
|
||||
void read(const byte* pData,
|
||||
uint32_t size,
|
||||
uint32_t start,
|
||||
ByteOrder byteOrder);
|
||||
void read(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder);
|
||||
/*!
|
||||
@brief Write the metadata from the raw metadata component to the
|
||||
binary image \em blob. This method may append to the blob.
|
||||
@@ -124,7 +121,8 @@ namespace Exiv2::Internal {
|
||||
|
||||
@return New offset
|
||||
*/
|
||||
uint32_t write(Blob& blob, ByteOrder byteOrder, uint32_t offset);
|
||||
size_t write(Blob& blob, ByteOrder byteOrder, size_t offset);
|
||||
|
||||
/*!
|
||||
@brief Writes the entry's value if size is larger than eight bytes. If
|
||||
needed, the value is padded with one 0 byte to make the number
|
||||
@@ -135,7 +133,8 @@ namespace Exiv2::Internal {
|
||||
|
||||
@return New offset.
|
||||
*/
|
||||
uint32_t writeValueData(Blob& blob, uint32_t offset);
|
||||
size_t writeValueData(Blob& blob, size_t offset);
|
||||
|
||||
//! Set the directory tag for this component.
|
||||
void setDir(uint16_t dir) { dir_ = dir; }
|
||||
//! Set the data value of the entry.
|
||||
@@ -190,10 +189,10 @@ namespace Exiv2::Internal {
|
||||
of data bytes this component can have. The actual size,
|
||||
i.e., used data bytes, may be less than 8.
|
||||
*/
|
||||
uint32_t size() const { return size_; }
|
||||
size_t size() const { return size_; }
|
||||
|
||||
//! Return the offset to the data from the start of the directory
|
||||
uint32_t offset() const { return offset_; }
|
||||
size_t offset() const { return offset_; }
|
||||
|
||||
//! Return a pointer to the data area of this component
|
||||
const byte* pData() const { return pData_; }
|
||||
@@ -224,18 +223,13 @@ namespace Exiv2::Internal {
|
||||
//! Implements remove(). The default implementation does nothing.
|
||||
virtual void doRemove(CrwDirs& crwDirs, uint16_t crwTagId);
|
||||
//! Implements read(). The default implementation reads a directory entry.
|
||||
virtual void doRead(const byte* pData,
|
||||
uint32_t size,
|
||||
uint32_t start,
|
||||
ByteOrder byteOrder);
|
||||
virtual void doRead(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder);
|
||||
//! Implements write()
|
||||
virtual uint32_t doWrite(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
uint32_t offset) =0;
|
||||
virtual size_t doWrite(Blob& blob, ByteOrder byteOrder, size_t offset) = 0;
|
||||
//! Set the size of the data area.
|
||||
void setSize(uint32_t size) { size_ = size; }
|
||||
void setSize(size_t size) { size_ = size; }
|
||||
//! Set the offset for this component.
|
||||
void setOffset(uint32_t offset) { offset_ = offset; }
|
||||
void setOffset(size_t offset) { offset_ = offset; }
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
@@ -258,8 +252,8 @@ namespace Exiv2::Internal {
|
||||
// DATA
|
||||
uint16_t dir_ = 0; //!< Tag of the directory containing this component
|
||||
uint16_t tag_ = 0; //!< Tag of the entry
|
||||
uint32_t size_ = 0; //!< Size of the data area
|
||||
uint32_t offset_ = 0; //!< Offset to the data area from start of dir
|
||||
size_t size_ = 0; //!< Size of the data area
|
||||
size_t offset_ = 0; //!< Offset to the data area from start of dir
|
||||
|
||||
// Notes on the ownership model of pData_: pData_ is a always a read-only
|
||||
// pointer to a buffer owned by somebody else. Usually it is a pointer
|
||||
@@ -299,7 +293,7 @@ namespace Exiv2::Internal {
|
||||
@brief Implements write(). Writes only the value data of the entry,
|
||||
using writeValueData().
|
||||
*/
|
||||
uint32_t doWrite(Blob& blob, ByteOrder byteOrder, uint32_t offset) override;
|
||||
size_t doWrite(Blob& blob, ByteOrder byteOrder, size_t offset) override;
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
@@ -336,7 +330,7 @@ namespace Exiv2::Internal {
|
||||
@param byteOrder Applicable byte order (little or big endian)
|
||||
*/
|
||||
void readDirectory(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
|
||||
@@ -353,9 +347,9 @@ namespace Exiv2::Internal {
|
||||
@brief Implements write(). Writes the complete Ciff directory to
|
||||
the blob.
|
||||
*/
|
||||
uint32_t doWrite(Blob& blob, ByteOrder byteOrder, uint32_t offset) override;
|
||||
size_t doWrite(Blob& blob, ByteOrder byteOrder, size_t offset) override;
|
||||
// See base class comment
|
||||
void doRead(const byte* pData, uint32_t size, uint32_t start, ByteOrder byteOrder) override;
|
||||
void doRead(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
@@ -411,7 +405,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
@throw Error If the image cannot be parsed.
|
||||
*/
|
||||
void read(const byte* pData, uint32_t size);
|
||||
void read(const byte* pData, size_t size);
|
||||
/*!
|
||||
@brief Set the value of entry \em crwTagId in directory \em crwDir to
|
||||
\em buf. If this tag doesn't exist, it is added along with all
|
||||
|
||||
+11
-11
@@ -311,9 +311,9 @@ namespace Exiv2 {
|
||||
return TypeInfo::typeName(typeId());
|
||||
}
|
||||
|
||||
long Exifdatum::typeSize() const
|
||||
size_t Exifdatum::typeSize() const
|
||||
{
|
||||
return static_cast<long>(TypeInfo::typeSize(typeId()));
|
||||
return TypeInfo::typeSize(typeId());
|
||||
}
|
||||
|
||||
size_t Exifdatum::count() const { return value_ ? value_->count() : 0; }
|
||||
@@ -322,13 +322,13 @@ namespace Exiv2 {
|
||||
|
||||
std::string Exifdatum::toString() const { return value_ ? value_->toString() : ""; }
|
||||
|
||||
std::string Exifdatum::toString(long n) const { return value_ ? value_->toString(n) : ""; }
|
||||
std::string Exifdatum::toString(size_t n) const { return value_ ? value_->toString(n) : ""; }
|
||||
|
||||
int64_t Exifdatum::toInt64(long n) const { return value_ ? value_->toInt64(n) : -1; }
|
||||
int64_t Exifdatum::toInt64(size_t n) const { return value_ ? value_->toInt64(n) : -1; }
|
||||
|
||||
float Exifdatum::toFloat(long n) const { return value_ ? value_->toFloat(n) : -1; }
|
||||
float Exifdatum::toFloat(size_t n) const { return value_ ? value_->toFloat(n) : -1; }
|
||||
|
||||
Rational Exifdatum::toRational(long n) const { return value_ ? value_->toRational(n) : Rational(-1, 1); }
|
||||
Rational Exifdatum::toRational(size_t n) const { return value_ ? value_->toRational(n) : Rational(-1, 1); }
|
||||
|
||||
Value::UniquePtr Exifdatum::getValue() const { return value_ ? value_->clone() : nullptr; }
|
||||
|
||||
@@ -574,10 +574,10 @@ namespace Exiv2 {
|
||||
// Encode and check if the result fits into a JPEG Exif APP1 segment
|
||||
MemIo mio1;
|
||||
TiffHeader header(byteOrder, 0x00000008, false);
|
||||
WriteMethod wm = TiffParserWorker::encode(mio1, pData, static_cast<uint32_t>(size), ed, emptyIptc, emptyXmp,
|
||||
WriteMethod wm = TiffParserWorker::encode(mio1, pData, size, ed, emptyIptc, emptyXmp,
|
||||
Tag::root, TiffMapping::findEncoder, &header, nullptr);
|
||||
if (mio1.size() <= 65527) {
|
||||
append(blob, mio1.mmap(), static_cast<uint32_t>(mio1.size()));
|
||||
append(blob, mio1.mmap(), mio1.size());
|
||||
return wm;
|
||||
}
|
||||
|
||||
@@ -672,9 +672,9 @@ namespace Exiv2 {
|
||||
|
||||
// Encode the remaining Exif tags again, don't care if it fits this time
|
||||
MemIo mio2;
|
||||
wm = TiffParserWorker::encode(mio2, pData, static_cast<uint32_t>(size), ed, emptyIptc, emptyXmp, Tag::root,
|
||||
wm = TiffParserWorker::encode(mio2, pData, size, ed, emptyIptc, emptyXmp, Tag::root,
|
||||
TiffMapping::findEncoder, &header, nullptr);
|
||||
append(blob, mio2.mmap(), static_cast<uint32_t>(mio2.size()));
|
||||
append(blob, mio2.mmap(), mio2.size());
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
if (wm == wmIntrusive) {
|
||||
std::cerr << "SIZE OF EXIF DATA IS " << std::dec << mio2.size() << " BYTES\n";
|
||||
@@ -771,7 +771,7 @@ namespace {
|
||||
{
|
||||
int64_t sum = 0;
|
||||
for (size_t i = 0; i < md.count(); ++i) {
|
||||
sum += md.toInt64(static_cast<long>(i));
|
||||
sum += md.toInt64(i);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
+9
-7
@@ -152,10 +152,12 @@ namespace Exiv2 {
|
||||
return rc;
|
||||
} // base64encode
|
||||
|
||||
long base64decode(const char* in,char* out,size_t out_size) {
|
||||
long result = 0;
|
||||
size_t base64decode(const char* in,char* out,size_t out_size)
|
||||
{
|
||||
size_t result = 0;
|
||||
size_t input_length = in ? ::strlen(in) : 0;
|
||||
if (!in || input_length % 4 != 0) return result;
|
||||
if (!in || input_length % 4 != 0)
|
||||
return result;
|
||||
|
||||
auto encoding_table = reinterpret_cast<const unsigned char*>(base64_encode);
|
||||
unsigned char decoding_table[256];
|
||||
@@ -186,11 +188,11 @@ namespace Exiv2 {
|
||||
if (j < output_length) out[j++] = (triple >> 0 * 8) & 0xFF;
|
||||
}
|
||||
out[output_length]=0;
|
||||
result = static_cast<long>(output_length);
|
||||
result = output_length;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
} // base64decode
|
||||
}
|
||||
|
||||
Protocol fileProtocol(const std::string& path) {
|
||||
Protocol result = pFile ;
|
||||
@@ -380,7 +382,7 @@ namespace Exiv2 {
|
||||
if ( procs ) procstat_freeprocs(procstat, procs);
|
||||
if ( procstat ) procstat_close(procstat);
|
||||
#elif defined(__sun__)
|
||||
// https://stackoverflow.com/questions/47472762/on-solaris-how-to-get-the-full-path-of-executable-of-running-process-programatic
|
||||
// https://stackoverflow.com/questions/47472762/on-solaris-how-to-get-the-full-path-of-executable-of-running-process-programatic
|
||||
const char* proc = Internal::stringFormat("/proc/%d/path/a.out",getpid()).c_str();
|
||||
char path[500];
|
||||
ssize_t l = readlink (proc,path,sizeof(path)-1);
|
||||
|
||||
+15
-16
@@ -232,7 +232,7 @@ namespace Exiv2 {
|
||||
return bSwap ? result : value;
|
||||
}
|
||||
|
||||
uint16_t Image::byteSwap2(const DataBuf& buf,size_t offset,bool bSwap)
|
||||
uint16_t Image::byteSwap2(const DataBuf& buf,size_t offset,bool bSwap)
|
||||
{
|
||||
uint16_t v = 0;
|
||||
auto p = reinterpret_cast<char*>(&v);
|
||||
@@ -241,7 +241,7 @@ namespace Exiv2 {
|
||||
return Image::byteSwap(v,bSwap);
|
||||
}
|
||||
|
||||
uint32_t Image::byteSwap4(const DataBuf& buf,size_t offset,bool bSwap)
|
||||
uint32_t Image::byteSwap4(const DataBuf& buf,size_t offset,bool bSwap)
|
||||
{
|
||||
uint32_t v = 0;
|
||||
auto p = reinterpret_cast<char*>(&v);
|
||||
@@ -253,7 +253,7 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
/// \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;
|
||||
auto p = reinterpret_cast<byte*>(&v);
|
||||
@@ -293,7 +293,8 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
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,size_t start,bool bSwap,char c,int depth)
|
||||
{
|
||||
depth++;
|
||||
if ( depth == 1 ) visits.clear();
|
||||
@@ -325,7 +326,7 @@ namespace Exiv2 {
|
||||
throw Error(ErrorCode::kerCorruptedMetadata);
|
||||
}
|
||||
visits.insert(io.tell());
|
||||
|
||||
|
||||
if ( bFirst && bPrint ) {
|
||||
out << Internal::indent(depth)
|
||||
<< " address | tag | "
|
||||
@@ -355,7 +356,7 @@ namespace Exiv2 {
|
||||
: count
|
||||
;
|
||||
uint32_t pad = isStringType(type) ? 1 : 0;
|
||||
uint32_t size = isStringType(type) ? 1
|
||||
size_t size = isStringType(type) ? 1
|
||||
: is2ByteType(type) ? 2
|
||||
: is4ByteType(type) ? 4
|
||||
: is8ByteType(type) ? 8
|
||||
@@ -365,19 +366,17 @@ namespace Exiv2 {
|
||||
// if ( offset > io.size() ) offset = 0; // Denial of service?
|
||||
|
||||
// #55 and #56 memory allocation crash test/data/POC8
|
||||
const uint64_t allocate64 = static_cast<uint64_t>(size) * count + pad + 20;
|
||||
const size_t allocate64 = size * count + pad + 20;
|
||||
if ( allocate64 > io.size() ) {
|
||||
throw Error(ErrorCode::kerInvalidMalloc);
|
||||
}
|
||||
// Overflow check
|
||||
enforce(allocate64 <= static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()), ErrorCode::kerCorruptedMetadata);
|
||||
enforce(allocate64 <= static_cast<uint64_t>(std::numeric_limits<long>::max()), ErrorCode::kerCorruptedMetadata);
|
||||
const auto allocate = static_cast<long>(allocate64);
|
||||
DataBuf buf(allocate); // allocate a buffer
|
||||
enforce(allocate64 <= std::numeric_limits<size_t>::max(), ErrorCode::kerCorruptedMetadata);
|
||||
DataBuf buf(allocate64); // allocate a buffer
|
||||
buf.copyBytes(0, dir.c_data(8), 4); // copy dir[8:11] into buffer (short strings)
|
||||
|
||||
// We have already checked that this multiplication cannot overflow.
|
||||
const uint32_t count_x_size = count*size;
|
||||
const size_t count_x_size = count*size;
|
||||
const bool bOffsetIsPointer = count_x_size > 4;
|
||||
|
||||
if ( bOffsetIsPointer ) { // read into buffer
|
||||
@@ -388,7 +387,7 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
if ( bPrint ) {
|
||||
const uint32_t address = start + 2 + i*12 ;
|
||||
const size_t address = start + 2 + i*12 ;
|
||||
const std::string offsetString = bOffsetIsPointer?
|
||||
Internal::stringFormat("%10u", offset):
|
||||
"";
|
||||
@@ -503,12 +502,12 @@ namespace Exiv2 {
|
||||
|
||||
// read header (we already know for certain that we have a Tiff file)
|
||||
io.readOrThrow(dir.data(), 8, ErrorCode::kerCorruptedMetadata);
|
||||
auto c = static_cast<char>(dir.read_uint8(0));
|
||||
auto c = dir.read_uint8(0);
|
||||
bool bSwap = ( c == 'M' && isLittleEndianPlatform() )
|
||||
|| ( c == 'I' && isBigEndianPlatform() )
|
||||
;
|
||||
uint32_t start = byteSwap4(dir,4,bSwap);
|
||||
printIFDStructure(io, out, option, start + static_cast<uint32_t>(offset), bSwap, c, depth);
|
||||
size_t start = byteSwap4(dir,4,bSwap);
|
||||
printIFDStructure(io, out, option, start + offset, bSwap, c, depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-12
@@ -107,9 +107,9 @@ namespace Exiv2 {
|
||||
return TypeInfo::typeName(typeId());
|
||||
}
|
||||
|
||||
long Iptcdatum::typeSize() const
|
||||
size_t Iptcdatum::typeSize() const
|
||||
{
|
||||
return static_cast<long>(TypeInfo::typeSize(typeId()));
|
||||
return TypeInfo::typeSize(typeId());
|
||||
}
|
||||
|
||||
size_t Iptcdatum::count() const { return value_ ? value_->count() : 0; }
|
||||
@@ -118,13 +118,13 @@ namespace Exiv2 {
|
||||
|
||||
std::string Iptcdatum::toString() const { return value_ ? value_->toString() : ""; }
|
||||
|
||||
std::string Iptcdatum::toString(long n) const { return value_ ? value_->toString(n) : ""; }
|
||||
std::string Iptcdatum::toString(size_t n) const { return value_ ? value_->toString(n) : ""; }
|
||||
|
||||
int64_t Iptcdatum::toInt64(long n) const { return value_ ? value_->toInt64(n) : -1; }
|
||||
int64_t Iptcdatum::toInt64(size_t n) const { return value_ ? value_->toInt64(n) : -1; }
|
||||
|
||||
float Iptcdatum::toFloat(long n) const { return value_ ? value_->toFloat(n) : -1; }
|
||||
float Iptcdatum::toFloat(size_t n) const { return value_ ? value_->toFloat(n) : -1; }
|
||||
|
||||
Rational Iptcdatum::toRational(long n) const { return value_ ? value_->toRational(n) : Rational(-1, 1); }
|
||||
Rational Iptcdatum::toRational(size_t n) const { return value_ ? value_->toRational(n) : Rational(-1, 1); }
|
||||
|
||||
Value::UniquePtr Iptcdatum::getValue() const { return value_ ? value_->clone() : nullptr; }
|
||||
|
||||
@@ -353,11 +353,7 @@ namespace Exiv2 {
|
||||
|
||||
const byte IptcParser::marker_ = 0x1C; // Dataset marker
|
||||
|
||||
int IptcParser::decode(
|
||||
IptcData& iptcData,
|
||||
const byte* pData,
|
||||
uint32_t size
|
||||
)
|
||||
int IptcParser::decode(IptcData& iptcData, const byte* pData, size_t size)
|
||||
{
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
std::cerr << "IptcParser::decode, size = " << size << "\n";
|
||||
@@ -385,7 +381,8 @@ namespace Exiv2 {
|
||||
uint16_t sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF);
|
||||
if (sizeOfSize > 4) return 5;
|
||||
pRead += 2;
|
||||
if (sizeOfSize > static_cast<size_t>(pEnd - pRead)) return 6;
|
||||
if (sizeOfSize > pEnd - pRead)
|
||||
return 6;
|
||||
sizeData = 0;
|
||||
for (; sizeOfSize > 0; --sizeOfSize) {
|
||||
sizeData |= *pRead++ << (8 *(sizeOfSize-1));
|
||||
|
||||
+13
-12
@@ -254,7 +254,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
#endif
|
||||
|
||||
const long pad = 3 ; // 3 padding bytes 2 0 0
|
||||
const size_t data_length = Safe::add(subBox.length, static_cast<uint32_t>(8));
|
||||
const size_t data_length = Safe::add(subBox.length, 8u);
|
||||
// data_length makes no sense if it is larger than the rest of the file
|
||||
if (data_length > io_->size() - io_->tell()) {
|
||||
throw Error(ErrorCode::kerCorruptedMetadata);
|
||||
@@ -384,7 +384,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
if (io_->error()) throw Error(ErrorCode::kerFailedToReadImageData);
|
||||
if (bufRead != rawData.size()) throw Error(ErrorCode::kerInputDataReadFailed);
|
||||
|
||||
if (IptcParser::decode(iptcData_, rawData.c_data(), static_cast<uint32_t>(rawData.size())))
|
||||
if (IptcParser::decode(iptcData_, rawData.c_data(), rawData.size()))
|
||||
{
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "Failed to decode IPTC metadata." << std::endl;
|
||||
@@ -399,7 +399,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
std::cout << "Exiv2::Jp2Image::readMetadata: Xmp data found" << std::endl;
|
||||
#endif
|
||||
enforce(box.length >= sizeof(box) + sizeof(uuid), ErrorCode::kerCorruptedMetadata);
|
||||
rawData.alloc(box.length - static_cast<uint32_t>(sizeof(box) + sizeof(uuid)));
|
||||
rawData.alloc(box.length - (sizeof(box) + sizeof(uuid)));
|
||||
bufRead = io_->read(rawData.data(), rawData.size());
|
||||
if (io_->error())
|
||||
throw Error(ErrorCode::kerFailedToReadImageData);
|
||||
@@ -434,7 +434,8 @@ static void boxes_check(size_t b,size_t m)
|
||||
|
||||
// Move to the next box.
|
||||
io_->seek(static_cast<long>(position - sizeof(box) + box.length), BasicIo::beg);
|
||||
if (io_->error()) throw Error(ErrorCode::kerFailedToReadImageData);
|
||||
if (io_->error())
|
||||
throw Error(ErrorCode::kerFailedToReadImageData);
|
||||
}
|
||||
|
||||
} // Jp2Image::readMetadata
|
||||
@@ -628,7 +629,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
void Jp2Image::encodeJp2Header(const DataBuf& boxBuf,DataBuf& outBuf)
|
||||
{
|
||||
DataBuf output(boxBuf.size() + iccProfile_.size() + 100); // allocate sufficient space
|
||||
long outlen = sizeof(Jp2BoxHeader) ; // now many bytes have we written to output?
|
||||
size_t outlen = sizeof(Jp2BoxHeader) ; // now many bytes have we written to output?
|
||||
long inlen = sizeof(Jp2BoxHeader) ; // how many bytes have we read from boxBuf?
|
||||
enforce(sizeof(Jp2BoxHeader) <= output.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
|
||||
auto pBox = reinterpret_cast<const Jp2BoxHeader*>(boxBuf.c_data());
|
||||
@@ -662,7 +663,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
count = length;
|
||||
}
|
||||
|
||||
uint32_t newlen = subBox.length;
|
||||
size_t newlen = subBox.length;
|
||||
if ( newBox.type == kJp2BoxTypeColorHeader ) {
|
||||
bWroteColor = true ;
|
||||
if ( ! iccProfileDefined() ) {
|
||||
@@ -677,9 +678,9 @@ static void boxes_check(size_t b,size_t m)
|
||||
} else {
|
||||
const char* pad = "\x02\x00\x00";
|
||||
uint32_t psize = 3;
|
||||
newlen = sizeof(newBox) + psize + static_cast<uint32_t>(iccProfile_.size());
|
||||
newlen = sizeof(newBox) + psize + iccProfile_.size();
|
||||
enforce(newlen <= static_cast<size_t>(output.size() - outlen), Exiv2::ErrorCode::kerCorruptedMetadata);
|
||||
ul2Data(reinterpret_cast<byte*>(&newBox.length), newlen, bigEndian);
|
||||
ul2Data(reinterpret_cast<byte*>(&newBox.length), static_cast<uint32_t>(newlen), bigEndian);
|
||||
ul2Data(reinterpret_cast<byte*>(&newBox.type), newBox.type, bigEndian);
|
||||
output.copyBytes(outlen ,&newBox ,sizeof(newBox) );
|
||||
output.copyBytes(outlen+sizeof(newBox) , pad ,psize );
|
||||
@@ -699,8 +700,8 @@ static void boxes_check(size_t b,size_t m)
|
||||
outBuf.copyBytes(0,output.c_data(),outlen);
|
||||
auto oBox = reinterpret_cast<Jp2BoxHeader*>(outBuf.data());
|
||||
ul2Data(reinterpret_cast<byte*>(&oBox->type), kJp2BoxTypeJp2Header, bigEndian);
|
||||
ul2Data(reinterpret_cast<byte*>(&oBox->length), outlen, bigEndian);
|
||||
} // Jp2Image::encodeJp2Header
|
||||
ul2Data(reinterpret_cast<byte*>(&oBox->length), static_cast<uint32_t>(outlen), bigEndian);
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
@@ -815,7 +816,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
Blob blob;
|
||||
ExifParser::encode(blob, littleEndian, exifData_);
|
||||
if (!blob.empty()) {
|
||||
DataBuf rawExif(static_cast<long>(blob.size()));
|
||||
DataBuf rawExif(blob.size());
|
||||
rawExif.copyBytes(0, &blob[0], blob.size());
|
||||
|
||||
DataBuf boxData(8 + 16 + rawExif.size());
|
||||
@@ -869,7 +870,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
if (!xmpPacket_.empty()) {
|
||||
// Update Xmp data to a new UUID box
|
||||
|
||||
DataBuf xmp(reinterpret_cast<const byte*>(xmpPacket_.data()), static_cast<long>(xmpPacket_.size()));
|
||||
DataBuf xmp(reinterpret_cast<const byte*>(xmpPacket_.data()), xmpPacket_.size());
|
||||
DataBuf boxData(8 + 16 + xmp.size());
|
||||
ul2Data(boxDataSize, static_cast<uint32_t>(boxData.size()), Exiv2::bigEndian);
|
||||
ul2Data(boxUUIDtype, kJp2BoxTypeUuid, Exiv2::bigEndian);
|
||||
|
||||
+8
-9
@@ -117,8 +117,7 @@ namespace Exiv2 {
|
||||
return -2;
|
||||
}
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
if ( (dataSize & 1)
|
||||
&& position + dataSize == static_cast<uint32_t>(sizePsData)) {
|
||||
if ( (dataSize & 1) && position + dataSize == sizePsData) {
|
||||
std::cerr << "Warning: "
|
||||
<< "Photoshop IRB data is not padded to even size\n";
|
||||
}
|
||||
@@ -174,7 +173,8 @@ namespace Exiv2 {
|
||||
assert(pPsData);
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
std::cerr << "IRB block at the beginning of Photoshop::setIptcIrb\n";
|
||||
if (sizePsData == 0) std::cerr << " None.\n";
|
||||
if (sizePsData == 0)
|
||||
std::cerr << " None.\n";
|
||||
else hexdump(std::cerr, pPsData, sizePsData);
|
||||
#endif
|
||||
const byte* record = pPsData;
|
||||
@@ -357,7 +357,6 @@ namespace Exiv2 {
|
||||
&& buf.cmpBytes(2, Photoshop::ps3Id_, 14) == 0) {
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
std::cerr << "Found app13 segment, size = " << size << "\n";
|
||||
//hexdump(std::cerr, psData.pData_, psData.size_);
|
||||
#endif
|
||||
// Append to psBlob
|
||||
append(psBlob, buf.c_data(16), size - 16);
|
||||
@@ -457,7 +456,7 @@ namespace Exiv2 {
|
||||
pCur = record + sizeHdr + sizeIptc + (sizeIptc & 1);
|
||||
}
|
||||
if (!iptcBlob.empty() &&
|
||||
IptcParser::decode(iptcData_, &iptcBlob[0], static_cast<uint32_t>(iptcBlob.size()))) {
|
||||
IptcParser::decode(iptcData_, &iptcBlob[0], iptcBlob.size())) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "Failed to decode IPTC metadata.\n";
|
||||
#endif
|
||||
@@ -732,7 +731,7 @@ namespace Exiv2 {
|
||||
size_t count = iptcDataSegs.size();
|
||||
|
||||
// figure out which blocks to copy
|
||||
std::vector<long> pos(count + 2);
|
||||
std::vector<size_t> pos(count + 2);
|
||||
pos[0] = 0;
|
||||
// copy the data that is not iptc
|
||||
auto it = iptcDataSegs.begin();
|
||||
@@ -742,7 +741,7 @@ namespace Exiv2 {
|
||||
pos[i + 1] = bEven ? *it : pos[i] + *it;
|
||||
++it;
|
||||
}
|
||||
pos[count + 1] = static_cast<long>(io_->size());
|
||||
pos[count + 1] = io_->size();
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
for (size_t i = 0; i < count + 2; i++)
|
||||
std::cout << pos[i] << " ";
|
||||
@@ -756,10 +755,10 @@ namespace Exiv2 {
|
||||
// binary copy io_ to a temporary file
|
||||
auto tempIo = std::make_unique<MemIo>();
|
||||
for (size_t i = 0; i < (count / 2) + 1; i++) {
|
||||
long start = pos[2 * i] + 2; // step JPG 2 byte marker
|
||||
size_t start = pos[2 * i] + 2; // step JPG 2 byte marker
|
||||
if (start == 2)
|
||||
start = 0; // read the file 2 byte SOI
|
||||
long length = pos[2 * i + 1] - start;
|
||||
size_t length = pos[2 * i + 1] - start;
|
||||
if (length) {
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
std::cout << start << ":" << length << std::endl;
|
||||
|
||||
+71
-77
@@ -176,7 +176,7 @@ namespace Exiv2::Internal {
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t MnHeader::ifdOffset() const
|
||||
size_t MnHeader::ifdOffset() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ namespace Exiv2::Internal {
|
||||
'O', 'L', 'Y', 'M', 'P', 0x00, 0x01, 0x00
|
||||
};
|
||||
|
||||
uint32_t OlympusMnHeader::sizeOfSignature()
|
||||
size_t OlympusMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -205,39 +205,37 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t OlympusMnHeader::size() const
|
||||
size_t OlympusMnHeader::size() const
|
||||
{
|
||||
return static_cast<uint32_t>(header_.size());
|
||||
return header_.size();
|
||||
}
|
||||
|
||||
uint32_t OlympusMnHeader::ifdOffset() const
|
||||
size_t OlympusMnHeader::ifdOffset() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
bool OlympusMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
bool OlympusMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
if (!pData || size < sizeOfSignature())
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
header_.copyBytes(0, pData, header_.size());
|
||||
return !(static_cast<uint32_t>(header_.size()) < sizeOfSignature() ||
|
||||
0 != header_.cmpBytes(0, signature_, 6));
|
||||
} // OlympusMnHeader::read
|
||||
|
||||
uint32_t OlympusMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
size_t OlympusMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
return sizeOfSignature();
|
||||
} // OlympusMnHeader::write
|
||||
} // OlympusMnHeader::write
|
||||
|
||||
const byte Olympus2MnHeader::signature_[] = {
|
||||
'O', 'L', 'Y', 'M', 'P', 'U', 'S', 0x00, 'I', 'I', 0x03, 0x00
|
||||
};
|
||||
|
||||
uint32_t Olympus2MnHeader::sizeOfSignature()
|
||||
size_t Olympus2MnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -247,12 +245,12 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t Olympus2MnHeader::size() const
|
||||
size_t Olympus2MnHeader::size() const
|
||||
{
|
||||
return static_cast<uint32_t>(header_.size());
|
||||
return header_.size();
|
||||
}
|
||||
|
||||
uint32_t Olympus2MnHeader::ifdOffset() const
|
||||
size_t Olympus2MnHeader::ifdOffset() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
@@ -262,18 +260,17 @@ namespace Exiv2::Internal {
|
||||
return mnOffset;
|
||||
}
|
||||
|
||||
bool Olympus2MnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
bool Olympus2MnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
if (!pData || size < sizeOfSignature())
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
header_.copyBytes(0, pData, header_.size());
|
||||
return !(static_cast<uint32_t>(header_.size()) < sizeOfSignature() ||
|
||||
0 != header_.cmpBytes(0, signature_, 10));
|
||||
} // Olympus2MnHeader::read
|
||||
|
||||
uint32_t Olympus2MnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t Olympus2MnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -285,7 +282,7 @@ namespace Exiv2::Internal {
|
||||
};
|
||||
const ByteOrder FujiMnHeader::byteOrder_ = littleEndian;
|
||||
|
||||
uint32_t FujiMnHeader::sizeOfSignature()
|
||||
size_t FujiMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -295,12 +292,12 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), byteOrder_);
|
||||
}
|
||||
|
||||
uint32_t FujiMnHeader::size() const
|
||||
size_t FujiMnHeader::size() const
|
||||
{
|
||||
return static_cast<uint32_t>(header_.size());
|
||||
return header_.size();
|
||||
}
|
||||
|
||||
uint32_t FujiMnHeader::ifdOffset() const
|
||||
size_t FujiMnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
@@ -315,11 +312,10 @@ namespace Exiv2::Internal {
|
||||
return mnOffset;
|
||||
}
|
||||
|
||||
bool FujiMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
bool FujiMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
if (!pData || size < sizeOfSignature())
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
header_.copyBytes(0, pData, header_.size());
|
||||
// Read offset to the IFD relative to the start of the makernote
|
||||
@@ -329,7 +325,7 @@ namespace Exiv2::Internal {
|
||||
0 != header_.cmpBytes(0, signature_, 8));
|
||||
} // FujiMnHeader::read
|
||||
|
||||
uint32_t FujiMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t FujiMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -340,7 +336,7 @@ namespace Exiv2::Internal {
|
||||
'N', 'i', 'k', 'o', 'n', '\0', 0x01, 0x00
|
||||
};
|
||||
|
||||
uint32_t Nikon2MnHeader::sizeOfSignature()
|
||||
size_t Nikon2MnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -350,18 +346,18 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t Nikon2MnHeader::size() const
|
||||
size_t Nikon2MnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t Nikon2MnHeader::ifdOffset() const
|
||||
size_t Nikon2MnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
bool Nikon2MnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -372,7 +368,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // Nikon2MnHeader::read
|
||||
|
||||
uint32_t Nikon2MnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t Nikon2MnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -384,7 +380,7 @@ namespace Exiv2::Internal {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
uint32_t Nikon3MnHeader::sizeOfSignature()
|
||||
size_t Nikon3MnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -395,12 +391,12 @@ namespace Exiv2::Internal {
|
||||
buf_.copyBytes(0, signature_, buf_.size());
|
||||
}
|
||||
|
||||
uint32_t Nikon3MnHeader::size() const
|
||||
size_t Nikon3MnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t Nikon3MnHeader::ifdOffset() const
|
||||
size_t Nikon3MnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
@@ -416,7 +412,7 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
|
||||
bool Nikon3MnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -430,7 +426,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // Nikon3MnHeader::read
|
||||
|
||||
uint32_t Nikon3MnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t Nikon3MnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder byteOrder) const
|
||||
{
|
||||
assert(buf_.size() >= 10);
|
||||
@@ -452,7 +448,7 @@ namespace Exiv2::Internal {
|
||||
'P', 'a', 'n', 'a', 's', 'o', 'n', 'i', 'c', 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
uint32_t PanasonicMnHeader::sizeOfSignature()
|
||||
size_t PanasonicMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -462,19 +458,17 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t PanasonicMnHeader::size() const
|
||||
size_t PanasonicMnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t PanasonicMnHeader::ifdOffset() const
|
||||
size_t PanasonicMnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
bool PanasonicMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
bool PanasonicMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
if (0 != memcmp(pData, signature_, 9)) return false;
|
||||
@@ -484,7 +478,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // PanasonicMnHeader::read
|
||||
|
||||
uint32_t PanasonicMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t PanasonicMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -495,7 +489,7 @@ namespace Exiv2::Internal {
|
||||
'P', 'E', 'N', 'T', 'A', 'X', ' ', 0x00, 'M', 'M'
|
||||
};
|
||||
|
||||
uint32_t PentaxDngMnHeader::sizeOfSignature()
|
||||
size_t PentaxDngMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -505,9 +499,9 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t PentaxDngMnHeader::size() const
|
||||
size_t PentaxDngMnHeader::size() const
|
||||
{
|
||||
return static_cast<uint32_t>(header_.size());
|
||||
return header_.size();
|
||||
}
|
||||
|
||||
uint32_t PentaxDngMnHeader::baseOffset(uint32_t mnOffset) const
|
||||
@@ -515,13 +509,13 @@ namespace Exiv2::Internal {
|
||||
return mnOffset;
|
||||
}
|
||||
|
||||
uint32_t PentaxDngMnHeader::ifdOffset() const
|
||||
size_t PentaxDngMnHeader::ifdOffset() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
bool PentaxDngMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -531,7 +525,7 @@ namespace Exiv2::Internal {
|
||||
0 != header_.cmpBytes(0, signature_, 7));
|
||||
} // PentaxDngMnHeader::read
|
||||
|
||||
uint32_t PentaxDngMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t PentaxDngMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -542,7 +536,7 @@ namespace Exiv2::Internal {
|
||||
'A', 'O', 'C', 0x00, 'M', 'M'
|
||||
};
|
||||
|
||||
uint32_t PentaxMnHeader::sizeOfSignature()
|
||||
size_t PentaxMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -552,18 +546,18 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t PentaxMnHeader::size() const
|
||||
size_t PentaxMnHeader::size() const
|
||||
{
|
||||
return static_cast<uint32_t>(header_.size());
|
||||
return header_.size();
|
||||
}
|
||||
|
||||
uint32_t PentaxMnHeader::ifdOffset() const
|
||||
size_t PentaxMnHeader::ifdOffset() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
bool PentaxMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -573,7 +567,7 @@ namespace Exiv2::Internal {
|
||||
0 != header_.cmpBytes(0, signature_, 3));
|
||||
} // PentaxMnHeader::read
|
||||
|
||||
uint32_t PentaxMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t PentaxMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -585,7 +579,7 @@ namespace Exiv2::Internal {
|
||||
read(nullptr, 0, invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t SamsungMnHeader::size() const
|
||||
size_t SamsungMnHeader::size() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -596,13 +590,13 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
|
||||
bool SamsungMnHeader::read(const byte* /*pData*/,
|
||||
uint32_t /*size*/,
|
||||
size_t /*size*/,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
return true;
|
||||
} // SamsungMnHeader::read
|
||||
|
||||
uint32_t SamsungMnHeader::write(IoWrapper& /*ioWrapper*/,
|
||||
size_t SamsungMnHeader::write(IoWrapper& /*ioWrapper*/,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
return 0;
|
||||
@@ -615,7 +609,7 @@ namespace Exiv2::Internal {
|
||||
'F', 'O', 'V', 'E', 'O', 'N', '\0', '\0', 0x01, 0x00
|
||||
};
|
||||
|
||||
uint32_t SigmaMnHeader::sizeOfSignature()
|
||||
size_t SigmaMnHeader::sizeOfSignature()
|
||||
{
|
||||
assert(sizeof(signature1_) == sizeof(signature2_));
|
||||
return sizeof(signature1_);
|
||||
@@ -626,18 +620,18 @@ namespace Exiv2::Internal {
|
||||
read(signature1_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t SigmaMnHeader::size() const
|
||||
size_t SigmaMnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t SigmaMnHeader::ifdOffset() const
|
||||
size_t SigmaMnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
bool SigmaMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -649,7 +643,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // SigmaMnHeader::read
|
||||
|
||||
uint32_t SigmaMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t SigmaMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature1_, sizeOfSignature());
|
||||
@@ -660,7 +654,7 @@ namespace Exiv2::Internal {
|
||||
'S', 'O', 'N', 'Y', ' ', 'D', 'S', 'C', ' ', '\0', '\0', '\0'
|
||||
};
|
||||
|
||||
uint32_t SonyMnHeader::sizeOfSignature()
|
||||
size_t SonyMnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -670,18 +664,18 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder);
|
||||
}
|
||||
|
||||
uint32_t SonyMnHeader::size() const
|
||||
size_t SonyMnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t SonyMnHeader::ifdOffset() const
|
||||
size_t SonyMnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
bool SonyMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -692,7 +686,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // SonyMnHeader::read
|
||||
|
||||
uint32_t SonyMnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t SonyMnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
@@ -704,7 +698,7 @@ namespace Exiv2::Internal {
|
||||
};
|
||||
const ByteOrder Casio2MnHeader::byteOrder_ = bigEndian;
|
||||
|
||||
uint32_t Casio2MnHeader::sizeOfSignature()
|
||||
size_t Casio2MnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
@@ -714,12 +708,12 @@ namespace Exiv2::Internal {
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder );
|
||||
}
|
||||
|
||||
uint32_t Casio2MnHeader::size() const
|
||||
size_t Casio2MnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t Casio2MnHeader::ifdOffset() const
|
||||
size_t Casio2MnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
@@ -730,7 +724,7 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
|
||||
bool Casio2MnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
@@ -741,7 +735,7 @@ namespace Exiv2::Internal {
|
||||
return true;
|
||||
} // Casio2MnHeader::read
|
||||
|
||||
uint32_t Casio2MnHeader::write(IoWrapper& ioWrapper,
|
||||
size_t Casio2MnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
|
||||
+68
-71
@@ -111,9 +111,7 @@ namespace Exiv2::Internal {
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
//! Read the header from a data buffer, return true if ok
|
||||
virtual bool read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder) =0;
|
||||
virtual bool read(const byte* pData, size_t size, ByteOrder byteOrder) = 0;
|
||||
/*!
|
||||
@brief Set the byte order for the makernote.
|
||||
*/
|
||||
@@ -122,15 +120,14 @@ namespace Exiv2::Internal {
|
||||
//! @name Accessors
|
||||
//@{
|
||||
//! Return the size of the header (in bytes).
|
||||
virtual uint32_t size() const =0;
|
||||
virtual size_t size() const =0;
|
||||
//! Write the header to a data buffer, return the number of bytes written.
|
||||
virtual uint32_t write(IoWrapper& ioWrapper,
|
||||
ByteOrder byteOrder) const =0;
|
||||
virtual size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const = 0;
|
||||
/*!
|
||||
@brief Return the offset to the start of the Makernote IFD from
|
||||
the start of the Makernote (= the start of the header).
|
||||
*/
|
||||
virtual uint32_t ifdOffset() const;
|
||||
virtual size_t ifdOffset() const;
|
||||
/*!
|
||||
@brief Return the byte order for the makernote. If the return value is
|
||||
invalidByteOrder, this means that the byte order of the the
|
||||
@@ -159,16 +156,16 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf header_; //!< Data buffer for the makernote header
|
||||
@@ -188,17 +185,17 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
uint32_t baseOffset(uint32_t mnOffset) const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf header_; //!< Data buffer for the makernote header
|
||||
@@ -218,19 +215,19 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
// setByteOrder not implemented
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
ByteOrder byteOrder() const override;
|
||||
uint32_t baseOffset(uint32_t mnOffset) const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf header_; //!< Data buffer for the makernote header
|
||||
@@ -252,20 +249,20 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Nikon 2 makernote header signature
|
||||
|
||||
}; // class Nikon2MnHeader
|
||||
@@ -282,24 +279,24 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
void setByteOrder(ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
ByteOrder byteOrder() const override;
|
||||
uint32_t baseOffset(uint32_t mnOffset) const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
ByteOrder byteOrder_; //!< Byteorder for makernote
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Nikon 3 makernote header signature
|
||||
|
||||
}; // class Nikon3MnHeader
|
||||
@@ -316,20 +313,20 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Panasonic makernote header signature
|
||||
|
||||
}; // class PanasonicMnHeader
|
||||
@@ -346,17 +343,17 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
uint32_t baseOffset(uint32_t mnOffset) const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf header_; //!< Data buffer for the makernote header
|
||||
@@ -376,16 +373,16 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf header_; //!< Data buffer for the makernote header
|
||||
@@ -403,12 +400,12 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t baseOffset(uint32_t mnOffset) const override;
|
||||
//@}
|
||||
|
||||
@@ -426,20 +423,20 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature1_[]; //!< Sigma makernote header signature 1
|
||||
static const byte signature2_[]; //!< Sigma makernote header signature 2
|
||||
|
||||
@@ -457,20 +454,20 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Sony makernote header signature
|
||||
|
||||
}; // class SonyMnHeader
|
||||
@@ -487,21 +484,21 @@ namespace Exiv2::Internal {
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
bool read(const byte* pData, uint32_t size, ByteOrder byteOrder) override;
|
||||
bool read(const byte* pData, size_t size, ByteOrder byteOrder) override;
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
uint32_t size() const override;
|
||||
uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
uint32_t ifdOffset() const override;
|
||||
size_t size() const override;
|
||||
size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
|
||||
size_t ifdOffset() const override;
|
||||
ByteOrder byteOrder() const override;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
static size_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
size_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Casio makernote header signature
|
||||
static const ByteOrder byteOrder_; //!< Byteorder for makernote (always big endian)
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ namespace Exiv2 {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
uint32_t Metadatum::toUint32(long n) const {
|
||||
uint32_t Metadatum::toUint32(size_t n) const {
|
||||
return static_cast<uint32_t>(toInt64(n));
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
void TiffDataEntry::setStrips(const Value* pSize,
|
||||
const byte* pData,
|
||||
uint32_t sizeData,
|
||||
size_t sizeData,
|
||||
uint32_t baseOffset)
|
||||
{
|
||||
if (!pValue() || !pSize) {
|
||||
@@ -366,7 +366,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
void TiffImageEntry::setStrips(const Value* pSize,
|
||||
const byte* pData,
|
||||
uint32_t sizeData,
|
||||
size_t sizeData,
|
||||
uint32_t baseOffset)
|
||||
{
|
||||
if (!pValue() || !pSize) {
|
||||
@@ -410,7 +410,7 @@ namespace Exiv2::Internal {
|
||||
}
|
||||
} // TiffImageEntry::setStrips
|
||||
|
||||
uint32_t TiffIfdMakernote::ifdOffset() const
|
||||
size_t TiffIfdMakernote::ifdOffset() const
|
||||
{
|
||||
if (!pHeader_) return 0;
|
||||
return pHeader_->ifdOffset();
|
||||
@@ -449,15 +449,17 @@ namespace Exiv2::Internal {
|
||||
if (pHeader_) pHeader_->setByteOrder(byteOrder);
|
||||
}
|
||||
|
||||
uint32_t TiffIfdMakernote::sizeHeader() const
|
||||
size_t TiffIfdMakernote::sizeHeader() const
|
||||
{
|
||||
if (!pHeader_) return 0;
|
||||
if (!pHeader_)
|
||||
return 0;
|
||||
return pHeader_->size();
|
||||
}
|
||||
|
||||
uint32_t TiffIfdMakernote::writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const
|
||||
size_t TiffIfdMakernote::writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const
|
||||
{
|
||||
if (!pHeader_) return 0;
|
||||
if (!pHeader_)
|
||||
return 0;
|
||||
return pHeader_->write(ioWrapper, byteOrder);
|
||||
}
|
||||
|
||||
@@ -1295,7 +1297,7 @@ namespace Exiv2::Internal {
|
||||
{
|
||||
mnOffset_ = static_cast<uint32_t>(offset);
|
||||
setImageByteOrder(byteOrder);
|
||||
uint32_t len = writeHeader(ioWrapper, this->byteOrder());
|
||||
uint32_t len = static_cast<uint32_t>(writeHeader(ioWrapper, this->byteOrder()));
|
||||
len += ifd_.write(ioWrapper, this->byteOrder(),
|
||||
offset - baseOffset() + len,
|
||||
uint32_t(-1), uint32_t(-1),
|
||||
|
||||
@@ -616,7 +616,7 @@ namespace Exiv2 {
|
||||
*/
|
||||
virtual void setStrips(const Value* pSize,
|
||||
const byte* pData,
|
||||
uint32_t sizeData,
|
||||
size_t sizeData,
|
||||
uint32_t baseOffset) =0;
|
||||
//@}
|
||||
|
||||
@@ -653,7 +653,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
void setStrips(const Value* pSize, const byte* pData, uint32_t sizeData, uint32_t baseOffset) override;
|
||||
void setStrips(const Value* pSize, const byte* pData, size_t sizeData, uint32_t baseOffset) override;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
@@ -718,7 +718,7 @@ namespace Exiv2 {
|
||||
public:
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
void setStrips(const Value* pSize, const byte* pData, uint32_t sizeData, uint32_t baseOffset) override;
|
||||
void setStrips(const Value* pSize, const byte* pData, size_t sizeData, uint32_t baseOffset) override;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
@@ -1111,9 +1111,9 @@ namespace Exiv2 {
|
||||
//! @name Accessors
|
||||
//@{
|
||||
//! Return the size of the header in bytes.
|
||||
uint32_t sizeHeader() const;
|
||||
size_t sizeHeader() const;
|
||||
//! Write the header to a data buffer, return the number of bytes written.
|
||||
uint32_t writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
|
||||
size_t writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
|
||||
/*!
|
||||
@brief Return the offset to the makernote from the start of the
|
||||
TIFF header.
|
||||
@@ -1124,7 +1124,7 @@ namespace Exiv2 {
|
||||
the start of the Makernote.
|
||||
Returns 0 if there is no header.
|
||||
*/
|
||||
uint32_t ifdOffset() const;
|
||||
size_t ifdOffset() const;
|
||||
/*!
|
||||
@brief Return the byte order for the makernote. Requires the image
|
||||
byte order to be set (setImageByteOrder()). Returns the byte
|
||||
|
||||
@@ -2029,7 +2029,7 @@ namespace Exiv2::Internal {
|
||||
IptcData& iptcData,
|
||||
XmpData& xmpData,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
uint32_t root,
|
||||
FindDecoderFct findDecoderFct,
|
||||
TiffHeaderBase* pHeader
|
||||
@@ -2058,7 +2058,7 @@ namespace Exiv2::Internal {
|
||||
WriteMethod TiffParserWorker::encode(
|
||||
BasicIo& io,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
const ExifData& exifData,
|
||||
const IptcData& iptcData,
|
||||
const XmpData& xmpData,
|
||||
@@ -2132,7 +2132,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
TiffComponent::UniquePtr TiffParserWorker::parse(
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
uint32_t root,
|
||||
TiffHeaderBase* pHeader
|
||||
)
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Exiv2::Internal {
|
||||
decoding failed.
|
||||
*/
|
||||
static ByteOrder decode(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, const byte* pData,
|
||||
uint32_t size, uint32_t root, FindDecoderFct findDecoderFct,
|
||||
size_t size, uint32_t root, FindDecoderFct findDecoderFct,
|
||||
TiffHeaderBase* pHeader = nullptr);
|
||||
/*!
|
||||
@brief Encode TIFF metadata from the metadata containers into a
|
||||
@@ -282,10 +282,9 @@ namespace Exiv2::Internal {
|
||||
writing"). If there is a parsed tree, it is only used to access the
|
||||
image data in this case.
|
||||
*/
|
||||
static WriteMethod encode(
|
||||
BasicIo& io,
|
||||
static WriteMethod encode(BasicIo& io,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
const ExifData& exifData,
|
||||
const IptcData& iptcData,
|
||||
const XmpData& xmpData,
|
||||
@@ -311,7 +310,7 @@ namespace Exiv2::Internal {
|
||||
*/
|
||||
static std::unique_ptr<TiffComponent> parse(
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
size_t size,
|
||||
uint32_t root,
|
||||
TiffHeaderBase* pHeader
|
||||
);
|
||||
|
||||
@@ -1146,10 +1146,7 @@ namespace Exiv2::Internal {
|
||||
|
||||
} // TiffEncoder::add
|
||||
|
||||
TiffReader::TiffReader(const byte* pData,
|
||||
uint32_t size,
|
||||
TiffComponent* pRoot,
|
||||
TiffRwState state)
|
||||
TiffReader::TiffReader(const byte* pData, size_t size, TiffComponent* pRoot, TiffRwState state)
|
||||
: pData_(pData),
|
||||
size_(size),
|
||||
pLast_(pData + size),
|
||||
|
||||
@@ -595,10 +595,7 @@ namespace Exiv2 {
|
||||
@param state State object for creation function, byte order and
|
||||
base offset.
|
||||
*/
|
||||
TiffReader(const byte* pData,
|
||||
uint32_t size,
|
||||
TiffComponent* pRoot,
|
||||
TiffRwState state);
|
||||
TiffReader(const byte* pData, size_t size, TiffComponent* pRoot, TiffRwState state);
|
||||
|
||||
//! Virtual destructor
|
||||
~TiffReader() override = default;
|
||||
@@ -674,7 +671,7 @@ namespace Exiv2 {
|
||||
|
||||
// DATA
|
||||
const byte* pData_; //!< Pointer to the memory buffer
|
||||
const uint32_t size_; //!< Size of the buffer
|
||||
const size_t size_; //!< Size of the buffer
|
||||
const byte* pLast_; //!< Pointer to the last byte
|
||||
TiffComponent* const pRoot_; //!< Root element of the composite
|
||||
TiffRwState* pState_; //!< Pointer to the state in effect (origState_ or mnState_)
|
||||
|
||||
+1
-3
@@ -544,9 +544,7 @@ namespace Exiv2 {
|
||||
|
||||
size_t i = 0;
|
||||
while (i < len) {
|
||||
os << " "
|
||||
<< std::setw(4) << std::setfill('0') << std::hex
|
||||
<< i + offset << " ";
|
||||
os << " " << std::setw(4) << std::setfill('0') << std::hex << i + offset << " ";
|
||||
std::ostringstream ss;
|
||||
do {
|
||||
byte c = buf[i];
|
||||
|
||||
+1
-2
@@ -125,8 +125,7 @@ namespace Exiv2 {
|
||||
{
|
||||
}
|
||||
|
||||
DataValue::DataValue(const byte* buf,
|
||||
long len, ByteOrder byteOrder,TypeId typeId)
|
||||
DataValue::DataValue(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId)
|
||||
: Value(typeId)
|
||||
{
|
||||
read(buf, len, byteOrder);
|
||||
|
||||
+5
-5
@@ -345,7 +345,7 @@ namespace Exiv2 {
|
||||
return TypeInfo::typeName(typeId());
|
||||
}
|
||||
|
||||
long Xmpdatum::typeSize() const
|
||||
size_t Xmpdatum::typeSize() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -356,13 +356,13 @@ namespace Exiv2 {
|
||||
|
||||
std::string Xmpdatum::toString() const { return p_->value_ ? p_->value_->toString() : ""; }
|
||||
|
||||
std::string Xmpdatum::toString(long n) const { return p_->value_ ? p_->value_->toString(n) : ""; }
|
||||
std::string Xmpdatum::toString(size_t n) const { return p_->value_ ? p_->value_->toString(n) : ""; }
|
||||
|
||||
int64_t Xmpdatum::toInt64(long n) const { return p_->value_ ? p_->value_->toInt64(n) : -1; }
|
||||
int64_t Xmpdatum::toInt64(size_t n) const { return p_->value_ ? p_->value_->toInt64(n) : -1; }
|
||||
|
||||
float Xmpdatum::toFloat(long n) const { return p_->value_ ? p_->value_->toFloat(n) : -1; }
|
||||
float Xmpdatum::toFloat(size_t n) const { return p_->value_ ? p_->value_->toFloat(n) : -1; }
|
||||
|
||||
Rational Xmpdatum::toRational(long n) const { return p_->value_ ? p_->value_->toRational(n) : Rational(-1, 1); }
|
||||
Rational Xmpdatum::toRational(size_t n) const { return p_->value_ ? p_->value_->toRational(n) : Rational(-1, 1); }
|
||||
|
||||
Value::UniquePtr Xmpdatum::getValue() const { return p_->value_ ? p_->value_->clone() : nullptr; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user