Skip to content

Commit 181f321

Browse files
authored
Adjust ICU version range to lookup for 53-99 major versions (#9134)
ICU 53 is from 2014 and is supposed to be more thread sharing friendly https://icu.unicode.org/design/cpp/shared_object
1 parent 2d371e2 commit 181f321

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;
@@ -1308,16 +1305,12 @@ void UnicodeUtil::getICUVersion(ICU* icu, int& majorVersion, int& minorVersion)
13081305
UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13091306
{
13101307
if (convIcu)
1311-
{
13121308
return *convIcu;
1313-
}
13141309

13151310
MutexLockGuard g(convIcuMutex, "UnicodeUtil::getConversionICU");
13161311

13171312
if (convIcu)
1318-
{
13191313
return *convIcu;
1320-
}
13211314

13221315
// Try "favorite" (distributed on Windows) version first
13231316
constexpr int favMaj = 77;
@@ -1336,32 +1329,17 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13361329
CheckStatusWrapper lastError(&ls);
13371330
string version;
13381331

1339-
// According to http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
1340-
// we using two ranges of version numbers: 3.0 - 4.8 and 49 - 79.
1341-
// Note 1: the most current version for now is 64, thus it is seems as enough to
1342-
// limit upper bound by value of 79. It should be enlarged when necessary in the
1343-
// future.
1344-
// Note 2: the required function ucal_getTZDataVersion() is available since 3.8.
1332+
// Note: the most current version for now is 78, thus it is seems as enough to limit upper bound by value of 99.
1333+
// It should be enlarged when necessary in the future.
13451334

1346-
for (int major = 79; major >= 3;)
1335+
for (int major = 99; major >= 53;)
13471336
{
1348-
#ifdef WIN_NT
1349-
int minor = 0;
1350-
#else
13511337
int minor = 9;
1352-
#endif
1353-
1354-
if (major == 4)
1355-
minor = 8;
1356-
else if (major <= 4)
1357-
minor = 9;
13581338

13591339
for (; minor >= 0; --minor)
13601340
{
13611341
if ((major == favMaj) && (minor == favMin))
1362-
{
13631342
continue;
1364-
}
13651343

13661344
if ((convIcu = ImplementConversionICU::create(probeStatus, major, minor)))
13671345
return *convIcu;
@@ -1373,10 +1351,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13731351
}
13741352
}
13751353

1376-
if (major == 49)
1377-
major = 4;
1378-
else
1379-
major--;
1354+
--major;
13801355
}
13811356

13821357
Arg::Gds err(isc_icu_library);

0 commit comments

Comments
 (0)