Commit Graph

92 Commits

Author SHA1 Message Date
Peter Nelson a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Ivan Fefer 23d733be95
Add: Basic autocompletion on tab for console commands (#12163) 2024-03-13 21:43:08 +01:00
Patric Stout 75f21065c9
Codechange: refactor DecodeHexText to a generic purpose ConvertHexToBytes (#11866)
DecodeHexText() does more than just decoding hex. ConvertHexToBytes()
now only does pure hex decoding. This required a bit of refactoring
for the code using DecodeHexText().
2024-01-22 19:42:47 +01:00
Rubidium 2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
Patric Stout fd073a2810 Remove: replace custom span with std::span 2024-01-17 00:25:08 +01:00
Rubidium 3a676a5af0 Codechange: replace static inline with static for non-class functions 2024-01-06 13:37:33 +01:00
Michael Lutz 86e28e79fb Fix #11402: Make string filter locale-aware. 2023-11-03 22:34:01 +01:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium e04d43f396 Remove: now unused stredup 2023-07-03 18:08:03 +02:00
Rubidium 48dcb79145 Cleanup: remove seprintf and vsnprintf 2023-06-09 06:41:33 +02:00
Rubidium 97dd84d1e0 Codechange: move saveload string fixing code to saveload 2023-06-08 20:36:27 +02:00
Rubidium e762855201 Cleanup: remove str_strip_colours; StrMakeValid also removes the colours
Essentially str_strip_colours followed by StrMakeValid makes the calling of
str_strip_colours useless, as StrMakeValid would have removed them too.
2023-06-08 19:32:15 +02:00
Rubidium 4ca23a19b6 Cleanup: char-pointer variant of strtolower 2023-06-08 18:09:11 +02:00
Rubidium ce8933d63e Add: std::back_insert_iterator<std::string> Utf8Encode function 2023-06-05 23:26:12 +02:00
Rubidium 6a519f5d89 Cleanup: strecat has no uses anymore 2023-06-04 19:45:42 +02:00
Rubidium acec34a0fe Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex 2023-05-19 11:24:44 +02:00
Rubidium d9a04ba446 Codechange: make the MD5 hash/digest/checksum variables a std::array 2023-05-19 11:24:44 +02:00
Peter Nelson 83f2ad500e Codechange: stdarg.h include not needed as cstdarg is included. 2023-05-17 10:14:41 +01:00
Rubidium f1fb6c95fe Add: case insensitive string comparator 2023-05-09 23:14:48 +02:00
Patric Stout febe394806
Codechange: replace C-style strings with C++-style strings in textfile (#10772) 2023-05-09 19:35:50 +00:00
Rubidium a312a6c1b2 Codechange: make md5sumToString std::string compatible 2023-05-04 23:23:32 +02:00
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 2023-04-29 10:25:25 +02:00
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
Rubidium 9fe853f7b5 Codechange: use fmt::format instead of vseprintf for midi command formatting 2023-04-26 18:46:17 +02:00
Rubidium c8ff6a9f7c Codechange: replace str_fmt with std::string constructs 2023-04-26 18:46:17 +02:00
Michael Lutz a05fd7aa50 Change: [Network] Transfer command data as serialized byte stream without fixed structure.
The data will be transmitted as the length followed by the serialized data. This allows the command
data to be different for every command type in the future.
2021-12-16 22:28:32 +01:00
rubidium42 fed3e3305f Codechange: add function to determine whether are string starts or ends with a given other string 2021-06-13 10:26:58 +02:00
rubidium42 b4aedef848 Codechange: add std::string variant of Utf8StringLength 2021-05-29 19:02:18 +02:00
Patric Stout 7713c3e3cc Codechange: move casting a "const char *" to "char *" to the caller
It is not nice to have your definition say you won't change a value
while in fact the whole reason for your existance is to change it.
2021-05-29 16:23:59 +02:00
Patric Stout ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +02:00
rubidium42 16437b7c0d Codechange: move client name in settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42 dc05917287 Add: [[nodiscard]] to std::string str_validate 2021-05-06 20:31:02 +02:00
Milek7 8e9eca6ddd
Codechange: Use __attribute__ access none to silence GCC 11 -Wmaybe-uninitialized warnings (#9124) 2021-04-28 22:06:47 +01:00
rubidium42 5202869f0f Add: String functionality to trim spaces from C-style strings 2021-04-24 08:02:54 +02:00
Patric Stout fda1fbf61c
Revert c1fddb9, 639cfa4: "Codechange: Check if access __attribute__ is supported before trying to use it." (#8526)
This reverts commit c1fddb9a6a and 639cfa43d2.

access_mode "none" is only supported by GCC11, but introduced
after it branched. So there are GCC11.0s out there that do not
support it. We will have to wait for GCC11.1 to hit before we
can re-add this.
2021-01-08 15:25:44 +01:00
milek7 639cfa43d2 Codechange: Use access __attribute__ to silence warnings in GCC 2021-01-08 00:40:45 +00:00
Michael Lutz 0c6e8a8123 Codechange: Store file search paths as std::string. 2020-12-27 13:19:25 +01:00
Charles Pigott 64b1c70fdd Codechange: Add WARN_FORMAT to vseprintf and fix the cascade of warnings that followed 2020-06-27 14:51:14 +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
frosch 08eeec15be (svn r26513) -Fix: 9x compilation, maybe 2014-04-25 19:25:38 +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 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
michi_cc 76367f6bf1 (svn r25653) -Add: Caret movement by words for CJK languages. 2013-08-05 20:35:31 +00:00