Skip to content
Permalink
Browse files

Codechange: ICU_SORT is in reality ICU_I18N (according to their CMake…

… files)

By naming it in a different way, things get a bit confusing.
Especially if we are switching to CMake, which autodetects these
things, we need to use the name the authors of ICU gave it; not
our interpertation of that name.
  • Loading branch information...
TrueBrain committed Mar 10, 2019
1 parent 52d7e7d commit 36105841b9d09a3c1cd1a8f7a5bd7b84af135d9f
Showing with 20 additions and 20 deletions.
  1. +1 −1 Doxyfile
  2. +1 −1 config.lib
  3. +5 −5 src/crashlog.cpp
  4. +4 −4 src/language.h
  5. +5 −5 src/string.cpp
  6. +4 −4 src/strings.cpp
@@ -297,7 +297,7 @@ PREDEFINED = ENABLE_NETWORK \
WITH_PNG \
WITH_FONTCONFIG \
WITH_FREETYPE \
WITH_ICU_SORT \
WITH_ICU_I18N \
WITH_ICU_LX \
UNICODE \
_UNICODE \
@@ -1776,7 +1776,7 @@ make_cflags_and_ldflags() {
fi

if [ -n "$icu_sort_config" ]; then
CFLAGS="$CFLAGS -DWITH_ICU_SORT"
CFLAGS="$CFLAGS -DWITH_ICU_I18N"
CFLAGS="$CFLAGS `$icu_sort_config --cflags | tr '\n\r' ' '`"

if [ "$static_icu" != "0" ]; then
@@ -52,9 +52,9 @@
# include <ft2build.h>
# include FT_FREETYPE_H
#endif /* WITH_FREETYPE */
#if defined(WITH_ICU_LX) || defined(WITH_ICU_SORT)
#if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
# include <unicode/uversion.h>
#endif /* WITH_ICU_LX || WITH_ICU_SORT */
#endif /* WITH_ICU_LX || WITH_ICU_I18N */
#ifdef WITH_LIBLZMA
# include <lzma.h>
#endif
@@ -240,19 +240,19 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
buffer += seprintf(buffer, last, " FreeType: %d.%d.%d\n", major, minor, patch);
#endif /* WITH_FREETYPE */

#if defined(WITH_ICU_LX) || defined(WITH_ICU_SORT)
#if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
/* 4 times 0-255, separated by dots (.) and a trailing '\0' */
char buf[4 * 3 + 3 + 1];
UVersionInfo ver;
u_getVersion(ver);
u_versionToString(ver, buf);
#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
buffer += seprintf(buffer, last, " ICU i18n: %s\n", buf);
#endif
#ifdef WITH_ICU_LX
buffer += seprintf(buffer, last, " ICU lx: %s\n", buf);
#endif
#endif /* WITH_ICU_LX || WITH_ICU_SORT */
#endif /* WITH_ICU_LX || WITH_ICU_I18N */

#ifdef WITH_LIBLZMA
buffer += seprintf(buffer, last, " LZMA: %s\n", lzma_version_string());
@@ -13,9 +13,9 @@
#define LANGUAGE_H

#include "core/smallvec_type.hpp"
#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
#include <unicode/coll.h>
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */
#include "strings_type.h"

static const uint8 CASE_GENDER_LEN = 16; ///< The (maximum) length of a case/gender string.
@@ -104,9 +104,9 @@ extern LanguageList _languages;
/** The currently loaded language. */
extern const LanguageMetadata *_current_language;

#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
extern icu::Collator *_current_collator;
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */

bool ReadLanguagePack(const LanguageMetadata *lang);
const LanguageMetadata *GetLanguage(byte newgrflangid);
@@ -37,12 +37,12 @@
#include "os/macosx/string_osx.h"
#endif

#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
/* Required by strnatcmp. */
#include <unicode/ustring.h>
#include "language.h"
#include "gfx_func.h"
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */

/* The function vsnprintf is used internally to perform the required formatting
* tasks. As such this one must be allowed, and makes sure it's terminated. */
@@ -584,13 +584,13 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
s2 = SkipGarbage(s2);
}

#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
if (_current_collator != NULL) {
UErrorCode status = U_ZERO_ERROR;
int result = _current_collator->compareUTF8(s1, s2, status);
if (U_SUCCESS(status)) return result;
}
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */

#if defined(_WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN)
int res = OTTDStringCompare(s1, s2);
@@ -613,7 +613,7 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
return new UniscribeStringIterator();
}

#elif defined(WITH_ICU_SORT)
#elif defined(WITH_ICU_I18N)

#include <unicode/utext.h>
#include <unicode/brkiter.h>
@@ -51,9 +51,9 @@ const LanguageMetadata *_current_language = NULL; ///< The currently loaded lang

TextDirection _current_text_dir; ///< Text direction of the currently selected language.

#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
icu::Collator *_current_collator = NULL; ///< Collator for the language currently in use.
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */

static uint64 _global_string_params_data[20]; ///< Global array of string parameters. To access, use #SetDParam.
static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params
@@ -1796,7 +1796,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
MacOSSetCurrentLocaleName(_current_language->isocode);
#endif

#ifdef WITH_ICU_SORT
#ifdef WITH_ICU_I18N
/* Delete previous collator. */
if (_current_collator != NULL) {
delete _current_collator;
@@ -1813,7 +1813,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
delete _current_collator;
_current_collator = NULL;
}
#endif /* WITH_ICU_SORT */
#endif /* WITH_ICU_I18N */

/* Some lists need to be sorted again after a language change. */
ReconsiderGameScriptLanguage();

0 comments on commit 3610584

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.