From 6fe3b2111dae3322bf699ff17df78dae88d6d5ba Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Fri, 17 Jan 2020 20:15:34 +0100 Subject: [PATCH 1/4] windows: add utf8 checks to lower/upper --- docs/docs.polserver.com/pol100/corechanges.xml | 7 ++++++- pol-core/bscript/str.cpp | 10 ++++++++++ pol-core/doc/core-changes.txt | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/docs.polserver.com/pol100/corechanges.xml b/docs/docs.polserver.com/pol100/corechanges.xml index a81d73da6..0184ce6fc 100644 --- a/docs/docs.polserver.com/pol100/corechanges.xml +++ b/docs/docs.polserver.com/pol100/corechanges.xml @@ -2,9 +2,14 @@
Latest Core Changes - 01-12-2020 + 01-17-2020
+ + 01-17-2020 + Kevin: + On Windows, add UTF8 checks to lowering/uppering of strings. + 01-12-2020 Kevin: diff --git a/pol-core/bscript/str.cpp b/pol-core/bscript/str.cpp index 2f51b606b..42c1e8530 100644 --- a/pol-core/bscript/str.cpp +++ b/pol-core/bscript/str.cpp @@ -412,6 +412,11 @@ void String::toUpper() utf8::unchecked::append( std::towupper( c ), std::back_inserter( value_ ) ); } #else + if ( !hasUTF8Characters() ) + { + Clib::mkupperASCII( value_ ); + return; + } std::wstring_convert> converter; std::wstring str = converter.from_bytes( value_ ); @@ -446,6 +451,11 @@ void String::toLower() utf8::unchecked::append( std::towlower( c ), std::back_inserter( value_ ) ); } #else + if ( !hasUTF8Characters() ) + { + Clib::mklowerASCII( value_ ); + return; + } std::wstring_convert> converter; std::wstring str = converter.from_bytes( value_ ); diff --git a/pol-core/doc/core-changes.txt b/pol-core/doc/core-changes.txt index 074857768..d762004fb 100644 --- a/pol-core/doc/core-changes.txt +++ b/pol-core/doc/core-changes.txt @@ -1,4 +1,6 @@ -- POL100 -- +01-17-2020 Kevin: + Fixed: On Windows, add UTF8 checks to lowering/uppering of strings. 01-12-2020 Kevin: Changed: On Windows, the pol.cfg setting UoDataFileRoot will now default to the directory of the Ultima Online installation found in the Windows Registry. This setting MUST be set for servers that do not have Ultima Online installed through the operating From 7ad3db992e63b4a4dae24078687d1c7793e109e7 Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Sat, 18 Jan 2020 00:28:20 +0100 Subject: [PATCH 2/4] move checking of utf-8 chars to both platforms --- pol-core/bscript/str.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pol-core/bscript/str.cpp b/pol-core/bscript/str.cpp index 42c1e8530..a3e8537f9 100644 --- a/pol-core/bscript/str.cpp +++ b/pol-core/bscript/str.cpp @@ -404,6 +404,11 @@ std::vector convertutf8( const std::string& value ) void String::toUpper() { + if ( !hasUTF8Characters() ) + { + Clib::mkupperASCII( value_ ); + return; + } #ifndef WINDOWS std::vector codes = convertutf8( value_ ); value_.clear(); @@ -412,11 +417,6 @@ void String::toUpper() utf8::unchecked::append( std::towupper( c ), std::back_inserter( value_ ) ); } #else - if ( !hasUTF8Characters() ) - { - Clib::mkupperASCII( value_ ); - return; - } std::wstring_convert> converter; std::wstring str = converter.from_bytes( value_ ); @@ -443,6 +443,11 @@ void String::toUpper() void String::toLower() { + if ( !hasUTF8Characters() ) + { + Clib::mklowerASCII( value_ ); + return; + } #ifndef WINDOWS std::vector codes = convertutf8( value_ ); value_.clear(); @@ -451,11 +456,6 @@ void String::toLower() utf8::unchecked::append( std::towlower( c ), std::back_inserter( value_ ) ); } #else - if ( !hasUTF8Characters() ) - { - Clib::mklowerASCII( value_ ); - return; - } std::wstring_convert> converter; std::wstring str = converter.from_bytes( value_ ); From 778c75ea2497bb892a7fdfbbc51876dc4af0d0cf Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Sat, 18 Jan 2020 00:39:07 +0100 Subject: [PATCH 3/4] update core changes --- docs/docs.polserver.com/pol100/corechanges.xml | 6 +++--- pol-core/doc/core-changes.txt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs.polserver.com/pol100/corechanges.xml b/docs/docs.polserver.com/pol100/corechanges.xml index 0184ce6fc..770888458 100644 --- a/docs/docs.polserver.com/pol100/corechanges.xml +++ b/docs/docs.polserver.com/pol100/corechanges.xml @@ -2,13 +2,13 @@
Latest Core Changes - 01-17-2020 + 01-18-2020
- 01-17-2020 + 01-18-2020 Kevin: - On Windows, add UTF8 checks to lowering/uppering of strings. + Add UTF8 checks to lowering/uppering of strings. 01-12-2020 diff --git a/pol-core/doc/core-changes.txt b/pol-core/doc/core-changes.txt index d762004fb..18ca04d76 100644 --- a/pol-core/doc/core-changes.txt +++ b/pol-core/doc/core-changes.txt @@ -1,6 +1,6 @@ -- POL100 -- -01-17-2020 Kevin: - Fixed: On Windows, add UTF8 checks to lowering/uppering of strings. +01-18-2020 Kevin: + Fixed: Add UTF8 checks to lowering/uppering of strings. 01-12-2020 Kevin: Changed: On Windows, the pol.cfg setting UoDataFileRoot will now default to the directory of the Ultima Online installation found in the Windows Registry. This setting MUST be set for servers that do not have Ultima Online installed through the operating From 1b25a7cf4592d80b4417afabdbcd4f5b7ece68fc Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Mon, 20 Jan 2020 12:04:30 +0100 Subject: [PATCH 4/4] Update core-changes --- docs/docs.polserver.com/pol100/corechanges.xml | 7 ++++++- pol-core/doc/core-changes.txt | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/docs.polserver.com/pol100/corechanges.xml b/docs/docs.polserver.com/pol100/corechanges.xml index 6323327b1..99903380a 100644 --- a/docs/docs.polserver.com/pol100/corechanges.xml +++ b/docs/docs.polserver.com/pol100/corechanges.xml @@ -2,9 +2,14 @@
Latest Core Changes - 01-18-2020 + 01-20-2020
+ + 01-20-2020 + Kevin: + Huge Performance loss in Lower/Upper String functions. + 01-18-2020 DevGIB: diff --git a/pol-core/doc/core-changes.txt b/pol-core/doc/core-changes.txt index c11b24e8f..78c73cb18 100644 --- a/pol-core/doc/core-changes.txt +++ b/pol-core/doc/core-changes.txt @@ -1,4 +1,6 @@ -- POL100 -- +01-20-2020 Kevin: + Fixed: Huge Performance loss in Lower/Upper String functions. 01-18-2020 DevGIB: Changed: Return type of XMLFile method .appendxmlnode() now returns the created node on success. Changed: Return type of XMLNode method .appendxmlnode() now returns the created node on success.