Commit Graph

103 Commits

Author SHA1 Message Date
rubidium42 f00564eeb2
Fix: String validation could leave invalid Utf8 encoded strings (#9096)
In case a character was encoded in multiple bytes, but required fewer bytes to be encoded, the first byte would be copied to the output leaving an invalid Utf8 encoded string. Later uses of the validated string would use the same decode logic, which would yield a question mark and just read a single byte, so nothing dangerous happened.
Furthermore, because the next byte would not be a first byte of an encoded Utf8 character, the last few valid characters could be removed by the validation as well.
2021-04-29 23:16:41 +01:00
rubidium42 5202869f0f Add: String functionality to trim spaces from C-style strings 2021-04-24 08:02:54 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 024a3f6259 Codechange: Use automatic memory management for language pack reading. 2020-12-27 13:19:25 +01:00
Michael Lutz 0c6e8a8123 Codechange: Store file search paths as std::string. 2020-12-27 13:19:25 +01:00
Marcus Calhoun-Lopez eeed3a7613 Fix: unbreak building with ICU on macOS
A symbol clash breaks building ICU on macOS, and although it isn't
necessary, it might as well be possible.
2020-06-05 14:47:33 +01:00
Michael Lutz 715aa67a9c Codechange: Use std::string in INI file parsing. 2020-05-21 20:02:34 +02:00
Michael Lutz c082f570ce Codechange: Use std::string when translating TTDP NewGRF string codes. 2020-05-21 20:02:34 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz fbc4cef180 Codechange: Use override specifier for text layout classes. 2019-04-09 22:45:15 +02:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
Patric Stout 36105841b9 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.
2019-03-11 10:16:00 +01:00
glx c540d72445 Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32 2018-12-27 18:09:16 +01:00
Michael Lutz 4bf216993a Add: [OSX] Native text caret handling. 2018-12-08 20:13:27 +01:00
Michael Lutz 8d7cd6a526 Add: [OSX] Native natural sort implementation. 2018-12-08 20:13:27 +01:00
Charles Pigott 52ed3bcbaa Remove: A few bits of dead code 2018-10-31 12:41:49 +01:00
Charles Pigott e0c0394e37 Fix: Remove various dead or unnecessary assignments 2018-10-31 12:41:49 +01:00
Michael Lutz eec3f40931 Change: [Win32] Use Uniscribe instead of ICU for text caret handling.
This removes the need for the ICU lib on Windows.
2018-06-06 21:37:09 +02:00
Michael Lutz f4394debdc Add: [Win32] Native natural sort implementation. 2018-06-06 21:37:09 +02:00
michi_cc 35b77450f8 (svn r27380) -Fix: [Win32] Compilation with MSVC2015. 2015-08-10 20:21:29 +00:00
rubidium 562c269770 (svn r27377) -Codechange: use the pkg-config files of ICU as well. Since they are split into separate libraries it becomes possible to split RTL support for natural sorting, although the effect will be minimal 2015-08-09 13:54:17 +00:00
rubidium 69fac508c3 (svn r27367) -Codechange: make a distinction between the layouting part of ICU (lx) or the sorting/collation part of ICU (i18n) 2015-08-09 12:33:27 +00:00
rubidium d534c80e94 (svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces) 2014-10-15 18:31:37 +00:00
rubidium db8d208bfc (svn r26507) -Cleanup: remove now unused custom strndup implementation 2014-04-25 15:17:17 +00:00
rubidium e61fe21237 (svn r26506) -Codechange: replace most of vsnprintf with vseprintf 2014-04-24 19:51:45 +00:00
rubidium 99452c51ce (svn r26500) -Cleanup: remove unused snprintf implementation 2014-04-24 18:40:16 +00:00
rubidium 382ca0941f (svn r26498) -Add: method for duplicating strings with similar behaviours as strecpy and strecat; give end pointer instead of a size 2014-04-24 18:21:32 +00:00
frosch ef4c2ce031 (svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy and strecat. 2014-04-23 20:44:42 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
rubidium ddc35bc252 (svn r26472) -Cleanup: pointless instance variable 2014-04-20 14:17:13 +00:00
fonsinchen d0aa98ef7d (svn r26384) -Fix [FS#5924]: Return correct values from ICU iterators in case of leading or trailing whitespace 2014-03-01 14:14:41 +00:00
rubidium 5e3aa72855 (svn r26124) -Fix: make sure all members of the default string iterator are initialised 2013-11-26 13:42:09 +00:00
rubidium cdd6752ead (svn r25952) -Fix [FS#5719]: do not skip numbers when skipping spaces and other sorting 'improving' characters 2013-11-08 21:15:20 +00:00
michi_cc 76367f6bf1 (svn r25653) -Add: Caret movement by words for CJK languages. 2013-08-05 20:35:31 +00:00
michi_cc e7dc14b25a (svn r25652) -Fix: Improve text caret movement for complex scripts. 2013-08-05 20:35:27 +00:00
rubidium 4c443bce5c (svn r25555) -Fix [FS#5632]: [Script] Texts from scripts were not validated before they were shown, causing an assertion to trigger 2013-07-04 16:36:47 +00:00
alberth 631540c400 (svn r25527) -Fix[FS#5621]: strndup should not examine strings beyond its upper limit. 2013-06-30 08:29:51 +00:00
rubidium 7c0f34130c (svn r25454) -Remove/Fix/Cleanup: SETX(Y) does not work at all with other than default fonts, so get rid of it 2013-06-24 18:39:19 +00:00
frosch 3e02890b73 (svn r24983) -Change: Apply the same name sorting rules to content and NewGRF list as for the server list. 2013-02-09 17:31:07 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
yexo 2c99805117 (svn r23816) -Fix (r23635, r23805): make SCC_ENCODED the first entry in the StringControlCode enum since it's value is not allowed to change 2012-01-16 22:29:25 +00:00
smatz bcd3f2bb59 (svn r23706) -Codechange: prevent 'unknown command' doxygen errors 2012-01-01 17:36:19 +00:00
truebrain 5cda1d7c90 (svn r23603) -Add: support for control commands in strings, in both network and safe/load (Rubidium) 2011-12-19 20:50:44 +00:00
rubidium fefe22b4aa (svn r23590) -Codechange: make the string validation settings better expandable 2011-12-18 18:37:54 +00:00
alberth d55b380b69 (svn r22669) -Codechange: For non-windows, only test for file existence again if strtolower actually changed the name. 2011-07-16 18:43:22 +00:00