blob: edf2531f00122b7eedf5bc56b9f63cbae61707b9 [file] [log] [blame]
Frank Tang585942f2022-05-09 15:40:30 -07001diff --git a/source/common/characterproperties.cpp b/source/common/characterproperties.cpp
2index a84996b4..a2e051a4 100644
3--- a/source/common/characterproperties.cpp
4+++ b/source/common/characterproperties.cpp
5@@ -36,7 +36,7 @@ namespace {
6
7 UBool U_CALLCONV characterproperties_cleanup();
8
9-constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + UCHAR_INT_LIMIT - UCHAR_INT_START;
10+constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + (UCHAR_INT_LIMIT - UCHAR_INT_START);
11
12 struct Inclusion {
13 UnicodeSet *fSet = nullptr;
14@@ -210,7 +210,7 @@ const UnicodeSet *getInclusionsForSource(UPropertySource src, UErrorCode &errorC
15 void U_CALLCONV initIntPropInclusion(UProperty prop, UErrorCode &errorCode) {
16 // This function is invoked only via umtx_initOnce().
17 U_ASSERT(UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT);
18- int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
19+ int32_t inclIndex = UPROPS_SRC_COUNT + (prop - UCHAR_INT_START);
20 U_ASSERT(gInclusions[inclIndex].fSet == nullptr);
21 UPropertySource src = uprops_getSource(prop);
22 const UnicodeSet *incl = getInclusionsForSource(src, errorCode);
23@@ -255,7 +255,7 @@ const UnicodeSet *CharacterProperties::getInclusionsForProperty(
24 UProperty prop, UErrorCode &errorCode) {
25 if (U_FAILURE(errorCode)) { return nullptr; }
26 if (UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT) {
27- int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
28+ int32_t inclIndex = UPROPS_SRC_COUNT + (prop - UCHAR_INT_START);
29 Inclusion &i = gInclusions[inclIndex];
30 umtx_initOnce(i.fInitOnce, &initIntPropInclusion, prop, errorCode);
31 return i.fSet;
32diff --git a/source/common/ruleiter.h b/source/common/ruleiter.h
33index 09af1297..41731407 100644
34--- a/source/common/ruleiter.h
35+++ b/source/common/ruleiter.h
36@@ -66,28 +66,28 @@ public:
37 /**
38 * Value returned when there are no more characters to iterate.
39 */
40- enum { DONE = -1 };
41+ static constexpr int32_t DONE = -1;
42
43 /**
44 * Bitmask option to enable parsing of variable names. If (options &
45 * PARSE_VARIABLES) != 0, then an embedded variable will be expanded to
46 * its value. Variables are parsed using the SymbolTable API.
47 */
48- enum { PARSE_VARIABLES = 1 };
49+ static constexpr int32_t PARSE_VARIABLES = 1;
50
51 /**
52 * Bitmask option to enable parsing of escape sequences. If (options &
53 * PARSE_ESCAPES) != 0, then an embedded escape sequence will be expanded
54 * to its value. Escapes are parsed using Utility.unescapeAt().
55 */
56- enum { PARSE_ESCAPES = 2 };
57+ static constexpr int32_t PARSE_ESCAPES = 2;
58
59 /**
60 * Bitmask option to enable skipping of whitespace. If (options &
61 * SKIP_WHITESPACE) != 0, then Pattern_White_Space characters will be silently
62 * skipped, as if they were not present in the input.
63 */
64- enum { SKIP_WHITESPACE = 4 };
65+ static constexpr int32_t SKIP_WHITESPACE = 4;
66
67 /**
68 * Constructs an iterator over the given text, starting at the given
69diff --git a/source/common/ucptrie_impl.h b/source/common/ucptrie_impl.h
70index 048353c8..a7a80a8f 100644
71--- a/source/common/ucptrie_impl.h
72+++ b/source/common/ucptrie_impl.h
73@@ -54,80 +54,76 @@ struct UCPTrieHeader {
74 uint16_t shiftedHighStart;
75 };
76
77+// Constants for use with UCPTrieHeader.options.
78+constexpr uint16_t UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000;
79+constexpr uint16_t UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00;
80+constexpr uint16_t UCPTRIE_OPTIONS_RESERVED_MASK = 0x38;
81+constexpr uint16_t UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7;
82+
83 /**
84- * Constants for use with UCPTrieHeader.options.
85- * @internal
86+ * Value for index3NullOffset which indicates that there is no index-3 null block.
87+ * Bit 15 is unused for this value because this bit is used if the index-3 contains
88+ * 18-bit indexes.
89 */
90-enum {
91- UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000,
92- UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00,
93- UCPTRIE_OPTIONS_RESERVED_MASK = 0x38,
94- UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7,
95- /**
96- * Value for index3NullOffset which indicates that there is no index-3 null block.
97- * Bit 15 is unused for this value because this bit is used if the index-3 contains
98- * 18-bit indexes.
99- */
100- UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff,
101- UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff
102-};
103+constexpr int32_t UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff;
104+constexpr int32_t UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff;
105
106 // Internal constants.
107-enum {
108- /** The length of the BMP index table. 1024=0x400 */
109- UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT,
110
111- UCPTRIE_SMALL_LIMIT = 0x1000,
112- UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT,
113+/** The length of the BMP index table. 1024=0x400 */
114+constexpr int32_t UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT;
115
116- /** Shift size for getting the index-3 table offset. */
117- UCPTRIE_SHIFT_3 = 4,
118+constexpr int32_t UCPTRIE_SMALL_LIMIT = 0x1000;
119+constexpr int32_t UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT;
120
121- /** Shift size for getting the index-2 table offset. */
122- UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3,
123+/** Shift size for getting the index-3 table offset. */
124+constexpr int32_t UCPTRIE_SHIFT_3 = 4;
125
126- /** Shift size for getting the index-1 table offset. */
127- UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2,
128+/** Shift size for getting the index-2 table offset. */
129+constexpr int32_t UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3;
130
131- /**
132- * Difference between two shift sizes,
133- * for getting an index-2 offset from an index-3 offset. 5=9-4
134- */
135- UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3,
136+/** Shift size for getting the index-1 table offset. */
137+constexpr int32_t UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2;
138
139- /**
140- * Difference between two shift sizes,
141- * for getting an index-1 offset from an index-2 offset. 5=14-9
142- */
143- UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2,
144+/**
145+ * Difference between two shift sizes,
146+ * for getting an index-2 offset from an index-3 offset. 5=9-4
147+ */
148+constexpr int32_t UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3;
149
150- /**
151- * Number of index-1 entries for the BMP. (4)
152- * This part of the index-1 table is omitted from the serialized form.
153- */
154- UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1,
155+/**
156+ * Difference between two shift sizes,
157+ * for getting an index-1 offset from an index-2 offset. 5=14-9
158+ */
159+constexpr int32_t UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2;
160
161- /** Number of entries in an index-2 block. 32=0x20 */
162- UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2,
163+/**
164+ * Number of index-1 entries for the BMP. (4)
165+ * This part of the index-1 table is omitted from the serialized form.
166+ */
167+constexpr int32_t UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1;
168
169- /** Mask for getting the lower bits for the in-index-2-block offset. */
170- UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1,
171+/** Number of entries in an index-2 block. 32=0x20 */
172+constexpr int32_t UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2;
173
174- /** Number of code points per index-2 table entry. 512=0x200 */
175- UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2,
176+/** Mask for getting the lower bits for the in-index-2-block offset. */
177+constexpr int32_t UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1;
178
179- /** Number of entries in an index-3 block. 32=0x20 */
180- UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3,
181+/** Number of code points per index-2 table entry. 512=0x200 */
182+constexpr int32_t UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2;
183
184- /** Mask for getting the lower bits for the in-index-3-block offset. */
185- UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1,
186+/** Number of entries in an index-3 block. 32=0x20 */
187+constexpr int32_t UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3;
188
189- /** Number of entries in a small data block. 16=0x10 */
190- UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3,
191+/** Mask for getting the lower bits for the in-index-3-block offset. */
192+constexpr int32_t UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1;
193+
194+/** Number of entries in a small data block. 16=0x10 */
195+constexpr int32_t UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3;
196+
197+/** Mask for getting the lower bits for the in-small-data-block offset. */
198+constexpr int32_t UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1;
199
200- /** Mask for getting the lower bits for the in-small-data-block offset. */
201- UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1
202-};
203
204 typedef UChar32
205 UCPTrieGetRange(const void *trie, UChar32 start,
206diff --git a/source/i18n/coll.cpp b/source/i18n/coll.cpp
207index fe73118d..7bdd80f3 100644
208--- a/source/i18n/coll.cpp
209+++ b/source/i18n/coll.cpp
210@@ -372,7 +372,7 @@ void setAttributesFromKeywords(const Locale &loc, Collator &coll, UErrorCode &er
211 return;
212 }
213 if (length != 0) {
214- int32_t codes[USCRIPT_CODE_LIMIT + UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST];
215+ int32_t codes[USCRIPT_CODE_LIMIT + (UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST)];
216 int32_t codesLength = 0;
217 char *scriptName = value;
218 for (;;) {
219diff --git a/source/i18n/collationdata.h b/source/i18n/collationdata.h
220index ab9b4c47..71bf17ab 100644
221--- a/source/i18n/collationdata.h
222+++ b/source/i18n/collationdata.h
223@@ -41,16 +41,12 @@ struct U_I18N_API CollationData : public UMemory {
224 // Note: The ucadata.icu loader could discover the reserved ranges by setting an array
225 // parallel with the ranges, and resetting ranges that are indexed.
226 // The reordering builder code could clone the resulting template array.
227- enum {
228- REORDER_RESERVED_BEFORE_LATIN = UCOL_REORDER_CODE_FIRST + 14,
229- REORDER_RESERVED_AFTER_LATIN
230- };
231-
232- enum {
233- MAX_NUM_SPECIAL_REORDER_CODES = 8,
234- /** C++ only, data reader check scriptStartsLength. */
235- MAX_NUM_SCRIPT_RANGES = 256
236- };
237+ static constexpr int32_t REORDER_RESERVED_BEFORE_LATIN = UCOL_REORDER_CODE_FIRST + 14;
238+ static constexpr int32_t REORDER_RESERVED_AFTER_LATIN = REORDER_RESERVED_BEFORE_LATIN + 1;
239+
240+ static constexpr int32_t MAX_NUM_SPECIAL_REORDER_CODES = 8;
241+ /** C++ only, data reader check scriptStartsLength. */
242+ static constexpr int32_t MAX_NUM_SCRIPT_RANGES = 256;
243
244 CollationData(const Normalizer2Impl &nfc)
245 : trie(NULL),
246diff --git a/source/i18n/collationdatareader.cpp b/source/i18n/collationdatareader.cpp
247index 0eb18613..c7ab04cd 100644
248--- a/source/i18n/collationdatareader.cpp
249+++ b/source/i18n/collationdatareader.cpp
250@@ -436,7 +436,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
251 settings->options = options;
252 // Set variableTop from options and scripts data.
253 settings->variableTop = tailoring.data->getLastPrimaryForGroup(
254- UCOL_REORDER_CODE_FIRST + settings->getMaxVariable());
255+ UCOL_REORDER_CODE_FIRST + int32_t{settings->getMaxVariable()});
256 if(settings->variableTop == 0) {
257 errorCode = U_INVALID_FORMAT_ERROR;
258 return;
259diff --git a/source/i18n/formatted_string_builder.h b/source/i18n/formatted_string_builder.h
260index 92bcf07d..32e0900a 100644
261--- a/source/i18n/formatted_string_builder.h
262+++ b/source/i18n/formatted_string_builder.h
263@@ -218,7 +218,9 @@ class U_I18N_API FormattedStringBuilder : public UMemory {
264 };
265
266 static_assert(
267- std::is_pod<FormattedStringBuilder::Field>::value,
268+ // std::is_pod<> is deprecated.
269+ std::is_standard_layout<FormattedStringBuilder::Field>::value &&
270+ std::is_trivial<FormattedStringBuilder::Field>::value,
271 "Field should be a POD type for efficient initialization");
272
273 constexpr FormattedStringBuilder::Field::Field(uint8_t category, uint8_t field)
274diff --git a/source/i18n/gregoimp.cpp b/source/i18n/gregoimp.cpp
275index 537aa19d..101a8b8b 100644
276--- a/source/i18n/gregoimp.cpp
277+++ b/source/i18n/gregoimp.cpp
278@@ -144,7 +144,7 @@ void Grego::timeToFields(UDate time, int32_t& year, int32_t& month,
279
280 int32_t Grego::dayOfWeek(double day) {
281 int32_t dow;
282- ClockMath::floorDivide(day + UCAL_THURSDAY, 7, dow);
283+ ClockMath::floorDivide(day + int{UCAL_THURSDAY}, 7, dow);
284 return (dow == 0) ? UCAL_SATURDAY : dow;
285 }
286
287diff --git a/source/i18n/rulebasedcollator.cpp b/source/i18n/rulebasedcollator.cpp
288index 5e5cc3db..5f771468 100644
289--- a/source/i18n/rulebasedcollator.cpp
290+++ b/source/i18n/rulebasedcollator.cpp
291@@ -538,7 +538,8 @@ RuleBasedCollator::setMaxVariable(UColReorderCode group, UErrorCode &errorCode)
292 }
293
294 if(group == UCOL_REORDER_CODE_DEFAULT) {
295- group = (UColReorderCode)(UCOL_REORDER_CODE_FIRST + defaultSettings.getMaxVariable());
296+ group = (UColReorderCode)(
297+ UCOL_REORDER_CODE_FIRST + int32_t{defaultSettings.getMaxVariable()});
298 }
299 uint32_t varTop = data->getLastPrimaryForGroup(group);
300 U_ASSERT(varTop != 0);
301@@ -556,7 +557,7 @@ RuleBasedCollator::setMaxVariable(UColReorderCode group, UErrorCode &errorCode)
302
303 UColReorderCode
304 RuleBasedCollator::getMaxVariable() const {
305- return (UColReorderCode)(UCOL_REORDER_CODE_FIRST + settings->getMaxVariable());
306+ return (UColReorderCode)(UCOL_REORDER_CODE_FIRST + int32_t{settings->getMaxVariable()});
307 }
308
309 uint32_t
310diff --git a/source/i18n/unicode/basictz.h b/source/i18n/unicode/basictz.h
311index d9f85e45..a1c94e52 100644
312--- a/source/i18n/unicode/basictz.h
313+++ b/source/i18n/unicode/basictz.h
314@@ -186,13 +186,15 @@ protected:
315
316 #ifndef U_HIDE_INTERNAL_API
317 /**
318- * The time type option bit masks used by getOffsetFromLocal
319+ * A time type option bit mask used by getOffsetFromLocal.
320 * @internal
321 */
322- enum {
323- kStdDstMask = kDaylight,
324- kFormerLatterMask = kLatter
325- };
326+ static constexpr int32_t kStdDstMask = kDaylight;
327+ /**
328+ * A time type option bit mask used by getOffsetFromLocal.
329+ * @internal
330+ */
331+ static constexpr int32_t kFormerLatterMask = kLatter;
332 #endif /* U_HIDE_INTERNAL_API */
333
334 /**
335diff --git a/source/i18n/unicode/calendar.h b/source/i18n/unicode/calendar.h
336index c1bdf928..ddffc7b9 100644
337--- a/source/i18n/unicode/calendar.h
338+++ b/source/i18n/unicode/calendar.h
339@@ -1766,16 +1766,22 @@ protected:
340 int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
341
342 /**
343- * Values for field resolution tables
344+ * Marker for end of resolve set (row or group). Value for field resolution tables.
345+ *
346 * @see #resolveFields
347 * @internal
348 */
349- enum {
350- /** Marker for end of resolve set (row or group). */
351- kResolveSTOP = -1,
352- /** Value to be bitwised "ORed" against resolve table field values for remapping. Example: (UCAL_DATE | kResolveRemap) in 1st column will cause 'UCAL_DATE' to be returned, but will not examine the value of UCAL_DATE. */
353- kResolveRemap = 32
354- };
355+ static constexpr int32_t kResolveSTOP = -1;
356+ /**
357+ * Value to be bitwised "ORed" against resolve table field values for remapping.
358+ * Example: (UCAL_DATE | kResolveRemap) in 1st column will cause 'UCAL_DATE' to be returned,
359+ * but will not examine the value of UCAL_DATE.
360+ * Value for field resolution tables.
361+ *
362+ * @see #resolveFields
363+ * @internal
364+ */
365+ static constexpr int32_t kResolveRemap = 32;
366
367 /**
368 * Precedence table for Dates
369diff --git a/source/test/cintltst/ucptrietest.c b/source/test/cintltst/ucptrietest.c
370index af578f7a..8b8e0fb5 100644
371--- a/source/test/cintltst/ucptrietest.c
372+++ b/source/test/cintltst/ucptrietest.c
373@@ -12,7 +12,6 @@
374 #include "unicode/utf16.h"
375 #include "unicode/utf8.h"
376 #include "uassert.h"
377-#include "ucptrie_impl.h"
378 #include "utrie.h"
379 #include "cstring.h"
380 #include "cmemory.h"
381diff --git a/source/test/intltest/numrgts.cpp b/source/test/intltest/numrgts.cpp
382index c8d278e2..b7b89158 100644
383--- a/source/test/intltest/numrgts.cpp
384+++ b/source/test/intltest/numrgts.cpp
385@@ -1474,7 +1474,7 @@ void NumberFormatRegressionTest::Test4106658(void)
386 #if U_PLATFORM == U_PF_HPUX
387 d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword
388 #else
389- d1 *= -1.0; // Some compilers have a problem with defining -0.0
390+ d1 = d1 * -1.0; // Some compilers have a problem with defining -0.0
391 #endif
392 logln("pattern: \"" + df->toPattern(temp) + "\"");
393 df->format(d1, buffer, pos);
394@@ -1605,7 +1605,7 @@ void NumberFormatRegressionTest::Test4106667(void)
395 #if U_PLATFORM == U_PF_HPUX
396 d = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword
397 #else
398- d *= -1.0; // Some compilers have a problem with defining -0.0
399+ d = d * -1.0; // Some compilers have a problem with defining -0.0
400 #endif
401 df->setPositivePrefix(/*"+"*/bar);
402 df->format(d, buffer, pos);
403@@ -2056,7 +2056,7 @@ void NumberFormatRegressionTest::Test4147706(void)
404 #if U_PLATFORM == U_PF_HPUX
405 d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword
406 #else
407- d1 *= -1.0; // Some compilers have a problem with defining -0.0
408+ d1 = d1 * -1.0; // Some compilers have a problem with defining -0.0
409 #endif
410 df->adoptDecimalFormatSymbols(syms);
411 f1 = df->format(d1, f1, pos);
412diff --git a/source/test/intltest/tsdate.cpp b/source/test/intltest/tsdate.cpp
413index 79e61e82..6f81f623 100644
414--- a/source/test/intltest/tsdate.cpp
415+++ b/source/test/intltest/tsdate.cpp
416@@ -19,8 +19,6 @@
417 #include <stdlib.h>
418 #include <math.h>
419
420-const double IntlTestDateFormat::ONEYEAR = 365.25 * ONEDAY; // Approximate
421-
422 IntlTestDateFormat::~IntlTestDateFormat() {}
423
424 /**
425diff --git a/source/test/intltest/tsdate.h b/source/test/intltest/tsdate.h
426index 95b8dd69..350d1cd9 100644
427--- a/source/test/intltest/tsdate.h
428+++ b/source/test/intltest/tsdate.h
429@@ -59,15 +59,13 @@ private:
430 UnicodeString fTestName;
431 int32_t fLimit; // How many iterations it should take to reach convergence
432
433- enum
434- {
435- // Values in milliseconds (== Date)
436- ONESECOND = 1000,
437- ONEMINUTE = 60 * ONESECOND,
438- ONEHOUR = 60 * ONEMINUTE,
439- ONEDAY = 24 * ONEHOUR
440- };
441- static const double ONEYEAR;
442+ // Values in milliseconds (== Date)
443+ static constexpr int32_t ONESECOND = 1000;
444+ static constexpr int32_t ONEMINUTE = 60 * ONESECOND;
445+ static constexpr int32_t ONEHOUR = 60 * ONEMINUTE;
446+ static constexpr int32_t ONEDAY = 24 * ONEHOUR;
447+
448+ static constexpr double ONEYEAR = 365.25 * ONEDAY; // Approximate
449 enum EMode
450 {
451 GENERIC,
452diff --git a/source/test/intltest/tsputil.cpp b/source/test/intltest/tsputil.cpp
453index 8a169ca8..a59d37bc 100644
454--- a/source/test/intltest/tsputil.cpp
455+++ b/source/test/intltest/tsputil.cpp
456@@ -324,7 +324,7 @@ PUtilTest::testZero(void)
457 volatile double pzero = 0.0;
458 volatile double nzero = 0.0;
459
460- nzero *= -1;
461+ nzero = nzero * -1;
462
463 if((pzero == nzero) != TRUE) {
464 errln("FAIL: 0.0 == -0.0 returned FALSE, should be TRUE.");