Skip to content

Commit 32c0aba

Browse files
committed
Adjust ICU version range to lookup for 53-99 major versions
ICU 53 is from 2014 and is supposed to be more thread sharing friendly https://icu.unicode.org/design/cpp/shared_object?utm_source=chatgpt.com
1 parent 0be0450 commit 32c0aba

1 file changed

Lines changed: 5 additions & 30 deletions

File tree

src/common/unicode_util.cpp

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
#include <unicode/uchar.h>
4848
#include <unicode/ucol.h>
4949
#include <unicode/uversion.h>
50-
51-
#if U_ICU_VERSION_MAJOR_NUM >= 51
52-
# include <unicode/utf_old.h>
53-
#endif
50+
#include <unicode/utf_old.h>
5451

5552

5653
using namespace Firebird;
@@ -1282,16 +1279,12 @@ void UnicodeUtil::getICUVersion(ICU* icu, int& majorVersion, int& minorVersion)
12821279
UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
12831280
{
12841281
if (convIcu)
1285-
{
12861282
return *convIcu;
1287-
}
12881283

12891284
MutexLockGuard g(convIcuMutex, "UnicodeUtil::getConversionICU");
12901285

12911286
if (convIcu)
1292-
{
12931287
return *convIcu;
1294-
}
12951288

12961289
// Try "favorite" (distributed on Windows) version first
12971290
constexpr int favMaj = 77;
@@ -1318,32 +1311,17 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13181311
CheckStatusWrapper lastError(&ls);
13191312
string version;
13201313

1321-
// According to http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
1322-
// we using two ranges of version numbers: 3.0 - 4.8 and 49 - 79.
1323-
// Note 1: the most current version for now is 64, thus it is seems as enough to
1324-
// limit upper bound by value of 79. It should be enlarged when necessary in the
1325-
// future.
1326-
// Note 2: the required function ucal_getTZDataVersion() is available since 3.8.
1314+
// Note: the most current version for now is 78, thus it is seems as enough to limit upper bound by value of 99.
1315+
// It should be enlarged when necessary in the future.
13271316

1328-
for (int major = 79; major >= 3;)
1317+
for (int major = 99; major >= 53;)
13291318
{
1330-
#ifdef WIN_NT
1331-
int minor = 0;
1332-
#else
13331319
int minor = 9;
1334-
#endif
1335-
1336-
if (major == 4)
1337-
minor = 8;
1338-
else if (major <= 4)
1339-
minor = 9;
13401320

13411321
for (; minor >= 0; --minor)
13421322
{
13431323
if ((major == favMaj) && (minor == favMin))
1344-
{
13451324
continue;
1346-
}
13471325

13481326
try
13491327
{
@@ -1357,10 +1335,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13571335
}
13581336
}
13591337

1360-
if (major == 49)
1361-
major = 4;
1362-
else
1363-
major--;
1338+
--major;
13641339
}
13651340

13661341
Arg::Gds err(isc_icu_library);

0 commit comments

Comments
 (0)