Skip to content

Commit 113136e

Browse files
piponazoD4N
authored andcommitted
Replace DEBUG with EXIV2_DEBUG_MESSAGES
Fixes #926
1 parent b7a9785 commit 113136e

31 files changed

+187
-188
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,22 +424,22 @@ $
424424

425425
[TOC](#TOC)
426426

427-
2) About preprocessor symbols **NDEBUG** and **DEBUG**
427+
2) About preprocessor symbols `NDEBUG` and `EXIV2_DEBUG_MESSAGES`
428428

429-
In accordance with current practice, exiv2 respects the symbol *NDEBUG* which is set for Release builds. There are sequences of code which are defined within:
429+
Exiv2 respects the symbol `NDEBUG` which is set only for Release builds. There are sequences of code which are defined within:
430430

431431
```C++
432-
#ifdef DEBUG
432+
#ifdef EXIV2_DEBUG_MESSAGES
433433
....
434434
#endif
435435
```
436436

437-
Those blocks of code are not compiled for debug builds. They are provided for additional debugging information. For example, if you are interested in additonal output from webpimage.cpp, you can update your build as follows:
437+
Those blocks of code are not compiled unless you define `EXIV2_DEBUG_MESSAGES` by yourself. They are provided for additional debugging information. For example, if you are interested in additional output from webpimage.cpp, you can update your build as follows:
438438

439439
```bash
440440
$ cd <exiv2dir>
441441
$ touch src/webpimage.cpp
442-
$ make CXXFLAGS=-DDEBUG
442+
$ make CXXFLAGS=-DEXIV2_DEBUG_MESSAGESDEBUG
443443
$ bin/exiv2 ...
444444
-- or --
445445
$ sudo make install

samples/geotag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ int timeZoneAdjust()
450450
struct tm local = *localtime(&now) ;
451451
offset = local.tm_gmtoff ;
452452

453-
#if DEBUG
453+
#if EXIV2_DEBUG_MESSAGES
454454
struct tm utc = *gmtime(&now);
455455
printf("utc : offset = %6d dst = %d time = %s", 0 ,utc .tm_isdst, asctime(&utc ));
456456
printf("local: offset = %6d dst = %d time = %s", offset,local.tm_isdst, asctime(&local));

src/actions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ namespace {
20702070
int targetType,
20712071
bool preserve)
20722072
{
2073-
#ifdef DEBUG
2073+
#ifdef EXIV2_DEBUG_MESSAGES
20742074
std::cerr << "actions.cpp::metacopy" << " source = " << source << " target = " << tgt << std::endl;
20752075
#endif
20762076

src/basicio.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ namespace Exiv2 {
306306
}
307307
// #906. Mountain Lion 'sandbox' terminates the app when we call setxattr
308308
#ifndef __APPLE__
309-
#ifdef DEBUG
309+
#ifdef EXIV2_DEBUG_MESSAGES
310310
EXV_DEBUG << "Copying xattr \"" << name << "\" with value size " << valueSize << "\n";
311311
#endif
312312
if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) {
@@ -337,19 +337,19 @@ namespace Exiv2 {
337337
if (pfcn_GetFileInformationByHandle(hFd, &fi)) {
338338
nlink = fi.nNumberOfLinks;
339339
}
340-
#ifdef DEBUG
340+
#ifdef EXIV2_DEBUG_MESSAGES
341341
else EXV_DEBUG << "GetFileInformationByHandle failed\n";
342342
#endif
343343
}
344-
#ifdef DEBUG
344+
#ifdef EXIV2_DEBUG_MESSAGES
345345
else EXV_DEBUG << "GetProcAddress(hKernel, \"GetFileInformationByHandle\") failed\n";
346346
#endif
347347
}
348-
#ifdef DEBUG
348+
#ifdef EXIV2_DEBUG_MESSAGES
349349
else EXV_DEBUG << "GetModuleHandleA(\"kernel32.dll\") failed\n";
350350
#endif
351351
}
352-
#ifdef DEBUG
352+
#ifdef EXIV2_DEBUG_MESSAGES
353353
else EXV_DEBUG << "_get_osfhandle failed: INVALID_HANDLE_VALUE\n";
354354
#endif
355355

@@ -1730,7 +1730,7 @@ namespace Exiv2 {
17301730
p_->eof_ = false;
17311731
p_->idx_ = 0;
17321732
}
1733-
#ifdef DEBUG
1733+
#ifdef EXIV2_DEBUG_MESSAGES
17341734
std::cerr << "RemoteIo::close totalRead_ = " << p_->totalRead_ << std::endl;
17351735
#endif
17361736
if ( bigBlock_ ) {
@@ -1950,7 +1950,7 @@ namespace Exiv2 {
19501950
memcpy(bigBlock_+(block*blockSize),p,blockSize);
19511951
}
19521952
}
1953-
#ifdef DEBUG
1953+
#ifdef EXIV2_DEBUG_MESSAGES
19541954
std::cerr << "RemoteIo::mmap nRealData = " << nRealData << std::endl;
19551955
#endif
19561956
}

src/bmpimage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace Exiv2
7070

7171
void BmpImage::readMetadata()
7272
{
73-
#ifdef DEBUG
73+
#ifdef EXIV2_DEBUG_MESSAGES
7474
std::cerr << "Exiv2::BmpImage::readMetadata: Reading Windows bitmap file " << io_->path() << "\n";
7575
#endif
7676
if (io_->open() != 0) {

src/convert.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ namespace {
13741374
{
13751375
// Naive byte-swapping, I'm sure this can be done more efficiently
13761376
if (str.size() & 1) {
1377-
#ifdef DEBUG
1377+
#ifdef EXIV2_DEBUG_MESSAGES
13781378
EXV_DEBUG << "swapBytes: Size " << str.size() << " of input string is not even.\n";
13791379
#endif
13801380
return false;
@@ -1392,7 +1392,7 @@ namespace {
13921392
if (str.empty()) return true;
13931393
int len = MultiByteToWideChar(cp, 0, str.c_str(), (int)str.size(), 0, 0);
13941394
if (len == 0) {
1395-
#ifdef DEBUG
1395+
#ifdef EXIV2_DEBUG_MESSAGES
13961396
EXV_DEBUG << "mb2wc: Failed to determine required size of output buffer.\n";
13971397
#endif
13981398
return false;
@@ -1401,7 +1401,7 @@ namespace {
14011401
out.resize(len * 2);
14021402
int ret = MultiByteToWideChar(cp, 0, str.c_str(), (int)str.size(), (LPWSTR)&out[0], len * 2);
14031403
if (ret == 0) {
1404-
#ifdef DEBUG
1404+
#ifdef EXIV2_DEBUG_MESSAGES
14051405
EXV_DEBUG << "mb2wc: Failed to convert the input string to a wide character string.\n";
14061406
#endif
14071407
return false;
@@ -1414,14 +1414,14 @@ namespace {
14141414
{
14151415
if (str.empty()) return true;
14161416
if (str.size() & 1) {
1417-
#ifdef DEBUG
1417+
#ifdef EXIV2_DEBUG_MESSAGES
14181418
EXV_DEBUG << "wc2mb: Size " << str.size() << " of input string is not even.\n";
14191419
#endif
14201420
return false;
14211421
}
14221422
int len = WideCharToMultiByte(cp, 0, (LPCWSTR)str.data(), (int)str.size() / 2, 0, 0, 0, 0);
14231423
if (len == 0) {
1424-
#ifdef DEBUG
1424+
#ifdef EXIV2_DEBUG_MESSAGES
14251425
EXV_DEBUG << "wc2mb: Failed to determine required size of output buffer.\n";
14261426
#endif
14271427
return false;
@@ -1430,7 +1430,7 @@ namespace {
14301430
out.resize(len);
14311431
int ret = WideCharToMultiByte(cp, 0, (LPCWSTR)str.data(), (int)str.size() / 2, (LPSTR)&out[0], len, 0, 0);
14321432
if (ret == 0) {
1433-
#ifdef DEBUG
1433+
#ifdef EXIV2_DEBUG_MESSAGES
14341434
EXV_DEBUG << "wc2mb: Failed to convert the input string to a multi byte string.\n";
14351435
#endif
14361436
return false;

src/cr2image.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace Exiv2 {
8989

9090
void Cr2Image::readMetadata()
9191
{
92-
#ifdef DEBUG
92+
#ifdef EXIV2_DEBUG_MESSAGES
9393
std::cerr << "Reading CR2 file " << io_->path() << "\n";
9494
#endif
9595
if (io_->open() != 0) {
@@ -112,7 +112,7 @@ namespace Exiv2 {
112112

113113
void Cr2Image::writeMetadata()
114114
{
115-
#ifdef DEBUG
115+
#ifdef EXIV2_DEBUG_MESSAGES
116116
std::cerr << "Writing CR2 file " << io_->path() << "\n";
117117
#endif
118118
ByteOrder bo = byteOrder();
@@ -174,7 +174,7 @@ namespace Exiv2 {
174174
panaRawId
175175
};
176176
for (unsigned int i = 0; i < EXV_COUNTOF(filteredIfds); ++i) {
177-
#ifdef DEBUG
177+
#ifdef EXIV2_DEBUG_MESSAGES
178178
std::cerr << "Warning: Exif IFD " << filteredIfds[i] << " not encoded\n";
179179
#endif
180180
ed.erase(std::remove_if(ed.begin(),

src/crwimage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace Exiv2 {
8888

8989
void CrwImage::readMetadata()
9090
{
91-
#ifdef DEBUG
91+
#ifdef EXIV2_DEBUG_MESSAGES
9292
std::cerr << "Reading CRW file " << io_->path() << "\n";
9393
#endif
9494
if (io_->open() != 0) {
@@ -110,7 +110,7 @@ namespace Exiv2 {
110110

111111
void CrwImage::writeMetadata()
112112
{
113-
#ifdef DEBUG
113+
#ifdef EXIV2_DEBUG_MESSAGES
114114
std::cerr << "Writing CRW file " << io_->path() << "\n";
115115
#endif
116116
// Read existing image
@@ -148,7 +148,7 @@ namespace Exiv2 {
148148
// Parse the image, starting with a CIFF header component
149149
CiffHeader::AutoPtr head(new CiffHeader);
150150
head->read(pData, size);
151-
#ifdef DEBUG
151+
#ifdef EXIV2_DEBUG_MESSAGES
152152
head->print(std::cerr);
153153
#endif
154154
head->decode(*pCrwImage);

src/crwimage_int.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ namespace Exiv2 {
250250
offset_ = start + 2;
251251
}
252252
pData_ = pData + offset_;
253-
#ifdef DEBUG
253+
#ifdef EXIV2_DEBUG_MESSAGES
254254
std::cout << " Entry for tag 0x"
255255
<< std::hex << tagId() << " (0x" << tag()
256256
<< "), " << std::dec << size_
@@ -265,11 +265,11 @@ namespace Exiv2 {
265265
ByteOrder byteOrder)
266266
{
267267
CiffComponent::doRead(pData, size, start, byteOrder);
268-
#ifdef DEBUG
268+
#ifdef EXIV2_DEBUG_MESSAGES
269269
std::cout << "Reading directory 0x" << std::hex << tag() << "\n";
270270
#endif
271271
readDirectory(pData + offset(), this->size(), byteOrder);
272-
#ifdef DEBUG
272+
#ifdef EXIV2_DEBUG_MESSAGES
273273
std::cout << "<---- 0x" << std::hex << tag() << "\n";
274274
#endif
275275
} // CiffDirectory::doRead
@@ -284,7 +284,7 @@ namespace Exiv2 {
284284
if ( o > size-2 )
285285
throw Error(kerCorruptedMetadata);
286286
uint16_t count = getUShort(pData + o, byteOrder);
287-
#ifdef DEBUG
287+
#ifdef EXIV2_DEBUG_MESSAGES
288288
std::cout << "Directory at offset " << std::dec << o
289289
<<", " << count << " entries \n";
290290
#endif
@@ -383,7 +383,7 @@ namespace Exiv2 {
383383
uint32_t CiffComponent::writeValueData(Blob& blob, uint32_t offset)
384384
{
385385
if (dataLocation() == valueData) {
386-
#ifdef DEBUG
386+
#ifdef EXIV2_DEBUG_MESSAGES
387387
std::cout << " Data for tag 0x" << std::hex << tagId()
388388
<< ", " << std::dec << size_ << " Bytes\n";
389389
#endif
@@ -403,7 +403,7 @@ namespace Exiv2 {
403403
ByteOrder byteOrder,
404404
uint32_t offset)
405405
{
406-
#ifdef DEBUG
406+
#ifdef EXIV2_DEBUG_MESSAGES
407407
std::cout << "Writing directory 0x" << std::hex << tag() << "---->\n";
408408
#endif
409409
// Ciff offsets are relative to the start of the directory
@@ -438,7 +438,7 @@ namespace Exiv2 {
438438
setOffset(offset);
439439
setSize(dirOffset);
440440

441-
#ifdef DEBUG
441+
#ifdef EXIV2_DEBUG_MESSAGES
442442
std::cout << "Directory is at offset " << std::dec << dirStart
443443
<< ", " << components_.size() << " entries\n"
444444
<< "<---- 0x" << std::hex << tag() << "\n";
@@ -448,7 +448,7 @@ namespace Exiv2 {
448448

449449
void CiffComponent::writeDirEntry(Blob& blob, ByteOrder byteOrder) const
450450
{
451-
#ifdef DEBUG
451+
#ifdef EXIV2_DEBUG_MESSAGES
452452
std::cout << " Directory entry for tag 0x"
453453
<< std::hex << tagId() << " (0x" << tag()
454454
<< "), " << std::dec << size_

src/exif.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ namespace Exiv2 {
665665
for (unsigned int i = 0; i < EXV_COUNTOF(filteredIfd0Tags); ++i) {
666666
ExifData::iterator pos = ed.findKey(ExifKey(filteredIfd0Tags[i]));
667667
if (pos != ed.end()) {
668-
#ifdef DEBUG
668+
#ifdef EXIV2_DEBUG_MESSAGES
669669
std::cerr << "Warning: Exif tag " << pos->key() << " not encoded\n";
670670
#endif
671671
ed.erase(pos);
@@ -689,7 +689,7 @@ namespace Exiv2 {
689689
ifd3Id
690690
};
691691
for (unsigned int i = 0; i < EXV_COUNTOF(filteredIfds); ++i) {
692-
#ifdef DEBUG
692+
#ifdef EXIV2_DEBUG_MESSAGES
693693
std::cerr << "Warning: Exif IFD " << filteredIfds[i] << " not encoded\n";
694694
#endif
695695
eraseIfd(ed, filteredIfds[i]);
@@ -816,7 +816,7 @@ namespace Exiv2 {
816816
header.get(),
817817
0);
818818
append(blob, mio2.mmap(), (uint32_t) mio2.size());
819-
#ifdef DEBUG
819+
#ifdef EXIV2_DEBUG_MESSAGES
820820
if (wm == wmIntrusive) {
821821
std::cerr << "SIZE OF EXIF DATA IS " << std::dec << mio2.size() << " BYTES\n";
822822
}

0 commit comments

Comments
 (0)