1
0
Fork 0
Commit Graph

109 Commits (9cf36dac396b1baf0110210f3c8962cc8cae7f08)

Author SHA1 Message Date
frosch 9cf36dac39 Codechange: Use data() instead of c_str(), if no NUL termination is needed. 2025-04-30 19:33:56 +02:00
Rubidium 708e6a512d Codechange: replace char* with C++ style strings 2025-04-30 12:05:04 +02:00
Rubidium f4ad614285 Codechange: use std::string_view for FS2OTTD and OTTD2FS 2025-04-29 22:33:32 +02:00
Rubidium af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Rubidium 360670626b Codechange: replace char* with std::string_view 2025-04-28 21:31:12 +02:00
Rubidium 86039a5b69 Codechange: make SetDebugString use C++-style strings and function types 2025-04-25 19:04:22 +02:00
Rubidium 02f040b22a Codechange: remove unused alloc_func.hpp includes 2025-02-24 20:00:19 +01:00
Jonathan G Rennison 23dc393822
Codechange: Compile fmt internals in a separate translation unit (#13527)
Instead of defining FMT_HEADER_ONLY to include fmt internals
in the headers included by all fmt-using translation units.
2025-02-11 20:11:50 +01:00
Valeri 5d8e98207d
Codechange: Use lowercase name for winnls.h (#13170)
Fixes cross-compilation under MXE.
2024-12-13 19:55:53 +01:00
Peter Nelson e98407973f Fix #12993: Replace known-bugs text with markdown version.
This allows a little bit better formatting/display in game.

(No attempt to check if these are still valid known-bugs...)
2024-10-22 00:34:16 +01:00
Jonathan G Rennison 6ca9ddcffa Codefix: [Win32] String handling in OTTDStringCompare, Win32StringContains
Avoid truncation if CompareStringEx is missing
Fix handling of zero length inputs
2024-10-21 17:34:30 +02:00
Peter Nelson e2a796dbcd Codefix: Potential unterminated string returned from convert_to_fs.
Converting from UTF-8 to UTF-16 could have resulted in a buffer overflow if the buffer size was exactly the length of the converted string.

Pass string_view/span to convert_from/to_fs instead, and ensure the buffer is terminated. This replaces passing a pointer to the buffer and the buffer size as separate parameters, allowing the compiler to pass both in one parameter.

Removes use of `lengthof()`.
2024-07-10 20:57:02 +01:00
Peter Nelson b37954722b Codefix: Don't copy path string to itself.
When determining base paths on Windows the path is converted to UCS-16, and then copied into the same buffer.
2024-07-10 20:57:02 +01:00
Peter Nelson 6120165433
Fix #12839: Truncated help text dialog on Windows. (#12844)
Replace fixed-length buffer message conversion with std::string.
2024-07-07 18:05:53 +01:00
Peter Nelson 63ce81570c Remove: Custom opendir implementation for Windows no longer needed.
std::filesystem::directory_iterator is now used instead.
2024-04-18 01:41:14 +01:00
Peter Nelson d7c547d0db Codechange: Use directory_iterator to list directories in file list windows.
This replaces use of custom ttd_opendir. Files are listed separately using ScanPath as that handles downloaded content.
2024-04-18 01:41:14 +01:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Rubidium caa7c44052 Cleanup: remove checks for old MSVC versions 2024-03-24 10:09:15 +01:00
Patric Stout d3ee045c2d
Codechange: refactor the Windows-only DllLoader in a cross-platform LibraryLoader (#11751) 2024-01-10 21:38:58 +00:00
rubidium42 27082f9efa Codechange: pass std::string references to OpenBrowser 2023-11-29 02:02:30 +01:00
Michael Lutz 86e28e79fb Fix #11402: Make string filter locale-aware. 2023-11-03 22:34:01 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02: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 b2a8d8aea4 Codechange: use std::string for Windows' ISO code mangling 2023-06-07 08:27:18 +02:00
Rubidium d68b5c9162 Codechange: replace buffer + strecpy with std::string for getting clipboard contents 2023-06-03 20:14:33 +02:00
Rubidium 324c43eeb2 Codechange: let FiosGetDiskFreeSpace only return disk space and split FiosGetCurrentPath off 2023-05-31 10:56:33 +02:00
Rubidium f2e704b9a7 Codechange: use std::string for FiosIsRoot 2023-05-31 10:56:33 +02:00
Rubidium 13789d1703 Codechange: use std::string for FiosIsValidFile 2023-05-31 10:56:33 +02:00
PeterN d086f288cd
Codechange: Remove duplicated includes. (#10888)
These are now included by stdafx.h so don't need to be included again.
2023-05-29 14:29:00 +01:00
Rubidium 275ebf4509 Codechange: replace fprintf(<FILE*> with fmt::print(<FILE*> 2023-05-21 15:12:02 +02:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Rubidium 3a822fcd01 Codechange: Make FiosItem's name and title std::string 2023-04-29 13:23:34 +02:00
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Rubidium df19673fbd Codechange: let convert_to_fs accept std::string 2023-04-29 12:07:45 +02:00
Rubidium f5f6306af3 Codechange: use string/fmt instead of printf for ShowInfo(F) 2023-04-24 17:51:54 +02:00
Rubidium 9e89eb5726 Codechange: move main function(s) to separate files 2023-04-16 18:58:21 +02:00
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
glx22 16abdd5254 Change: [Win32] Set the console codepage to UTF-8 2021-07-16 23:01:08 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
glx22 744a9e4745 Codechange: [WIN32] Add a wrapper around GetProcAddress() 2021-06-10 23:17:29 +02:00
glx22 f4c7d5577e Codechange: [WIN32] Use VersionHelpers where appropriate 2021-06-10 23:17:29 +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
PeterN f018471b36
Cleanup: Remove old FiosList helper methods. (#9139) 2021-04-29 22:46:42 +01:00
PeterN 56f982fa7f
Fix #9015: Don't set free space value if not requested. (#9016) 2021-04-11 13:07:08 +01:00
Wim Leflere 5233fd2751
Change: [win32] Use user UI language for initial language selection (#8973) (#8974) 2021-04-09 11:22:03 +02:00
Niels Martin Hansen 746f1ca11a Codechange: Remove the now meaningless console_cp parameter from OTTD2FS 2021-04-07 09:31:47 +02:00
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 2021-04-07 09:31:47 +02:00
Niels Martin Hansen cc465efa67 Change: [Win32] Use more modern way of getting free disk space 2021-02-23 11:25:39 +01:00
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 2021-02-23 11:25:39 +01:00
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 2021-02-23 11:25:39 +01:00