Skip to content

Commit f0c6648

Browse files
committed
Fix broken clang build.
1 parent 5219e71 commit f0c6648

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

source/base/image/jpeg.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,21 @@
5151
#include <memory>
5252
#include <string>
5353

54+
// Make sure we can later identify whether JPEGlib wants `TRUE` and `FALSE` to be macros.
55+
#undef TRUE
56+
#undef FALSE
57+
5458
// Other 3rd party header files
5559
extern "C"
5660
{
5761
#include <jpeglib.h>
5862
}
5963

64+
// Check whether JPEGlib wants `TRUE` and `FALSE` to be macros.
65+
#ifdef TRUE
66+
#define POV_KEEP_BOOLEAN_MACROS
67+
#endif
68+
6069
// POV-Ray header files (base module)
6170
#include "base/fileinputoutput.h"
6271
#include "base/image/colourspace.h"
@@ -68,6 +77,13 @@ extern "C"
6877
// this must be the last file included
6978
#include "base/povdebug.h"
7079

80+
// Work around an issue on Mac OS X, where `TRUE` and `FALSE` are defined
81+
// _somewhere_, in a manner that is incompatible with JPEGlib.
82+
#ifndef POV_KEEP_BOOLEAN_MACROS
83+
#undef TRUE
84+
#undef FALSE
85+
#endif
86+
7187
namespace pov_base
7288
{
7389

source/base/stringutilities.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ struct CharsetUCS4 final : public CharsetUCS4Subset
438438
}
439439
};
440440

441-
static const CharsetUCS4 kCharsetUCS4;
441+
static const auto kCharsetUCS4 = CharsetUCS4();
442442

443443
//------------------------------------------------------------------------------
444444

@@ -459,7 +459,7 @@ struct CharsetUCS2 final : public CharsetUCS4Subset
459459
}
460460
};
461461

462-
static const CharsetUCS2 kCharsetUCS2;
462+
static const auto kCharsetUCS2 = CharsetUCS2();
463463

464464
//------------------------------------------------------------------------------
465465

@@ -480,7 +480,7 @@ struct CharsetLatin1 final : public CharsetUCS4Subset
480480
}
481481
};
482482

483-
static const CharsetLatin1 kCharsetLatin1;
483+
static const auto kCharsetLatin1 = CharsetLatin1();
484484

485485
//------------------------------------------------------------------------------
486486

@@ -501,7 +501,7 @@ struct CharsetASCII final : public CharsetUCS4Subset
501501
}
502502
};
503503

504-
static const CharsetASCII kCharsetASCII;
504+
static const auto kCharsetASCII = CharsetASCII();
505505

506506
//------------------------------------------------------------------------------
507507

@@ -512,8 +512,8 @@ struct CharsetExtendedASCII final : public Charset
512512
int i = 0;
513513
for (UCS4 c : highCharacters)
514514
mHighCharacters[i++] = c;
515-
while (i < kNumNonASCIICharacters)
516-
mHighCharacters[i++] = kFirstNonASCIICharacter + i;
515+
for (; i < kNumNonASCIICharacters; ++i)
516+
mHighCharacters[i] = kFirstNonASCIICharacter + i;
517517
}
518518

519519
virtual bool Encode(POV_UINT32& result, UCS4 character) const override

0 commit comments

Comments
 (0)