Fix build when EXIV2_BUILD_MESSAGES is ON

main
Luis Díaz Más 3 years ago
parent 8b3da36f42
commit 21eb0cec4f

@ -147,9 +147,6 @@ namespace Exiv2 {
// Parse the image, starting with a CIFF header component
CiffHeader header;
header.read(pData, size);
#ifdef EXIV2_DEBUG_MESSAGES
header.print(std::cerr);
#endif
header.decode(*pCrwImage);
// a hack to get absolute offset of preview image inside CRW structure

@ -27,6 +27,7 @@
#include <cassert>
#include <ctime>
#include <iostream>
// *****************************************************************************
// local declarations

@ -26,6 +26,8 @@
#include "tiffvisitor_int.hpp"
#include "i18n.h" // NLS support.
#include <iostream>
// Shortcuts for the newTiffBinaryArray templates.
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, EXV_COUNTOF(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>)

@ -50,6 +50,54 @@
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
namespace {
[[maybe_unused]] std::string binaryToHex(const uint8_t* data, size_t size)
{
std::stringstream hexOutput;
auto tl = size_t(size / 16) * 16;
auto tl_offset = size_t(size) - tl;
for (size_t loop = 0; loop < size; loop++) {
if (data[loop] < 16) {
hexOutput << "0";
}
hexOutput << std::hex << static_cast<int>(data[loop]);
if ((loop % 8) == 7) {
hexOutput << " ";
}
if ((loop % 16) == 15 || loop == (tl + tl_offset - 1)) {
int max = 15;
if (loop >= tl) {
max = int(tl_offset) - 1;
for (int offset = 0; offset < int(16 - tl_offset); offset++) {
if ((offset % 8) == 7) {
hexOutput << " ";
}
hexOutput << " ";
}
}
hexOutput << " ";
for (int offset = max; offset >= 0; offset--) {
if (offset == (max - 8)) {
hexOutput << " ";
}
uint8_t c = '.';
if (data[loop - offset] >= 0x20 && data[loop - offset] <= 0x7E) {
c = data[loop - offset];
}
hexOutput << static_cast<char>(c);
}
hexOutput << std::endl;
}
}
hexOutput << std::endl << std::endl << std::endl;
return hexOutput.str();
}
} // namespace
// *****************************************************************************
// class member definitions
namespace Exiv2 {
@ -688,7 +736,7 @@ namespace Exiv2 {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Display Hex Dump [size:" << static_cast<unsigned long>(sizePayload) << "]" << std::endl;
std::cout << Internal::binaryToHex(rawExifData.c_data(), sizePayload);
std::cout << binaryToHex(rawExifData.c_data(), sizePayload);
#endif
if (pos != -1) {
@ -716,7 +764,7 @@ namespace Exiv2 {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Display Hex Dump [size:" << static_cast<unsigned long>(payload.size()) << "]"
<< std::endl;
std::cout << Internal::binaryToHex(payload.c_data(), payload.size());
std::cout << binaryToHex(payload.c_data(), payload.size());
#endif
}
} else {

Loading…
Cancel
Save