Commit Graph

98 Commits

Author SHA1 Message Date
Alfred Wingate d7c93d87be
Add support for libfmt-11
fmt::join was moved into fmt/ranges.h

Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-08-22 16:54:35 +03:00
Guilherme Janczak 0859d2c472
improve NetBSD-specific code
NetBSD doesn't put packages in /usr/local like /CMakeLists.txt thought.
The `#ifdef __NetBSD__` around iconv was actually breaking compilation
on NetBSD when using the system libiconv (there's also a GNU iconv
package)
A C program included from C++ source broke on NetBSD specifically, work
around it.

This doesn't fix compilation on NetBSD, which is currently broken, but
is closer to correct.
2024-05-03 15:12:29 +00:00
Admiral H. Curtiss 4f04ac5858
Common/StringUtil: Use internal linkage for codepage conversion functions. 2023-12-29 19:50:55 +01:00
Sketch 2154941c2c IOS/KD: Implement NWC24_CHECK_MAIL_NOW 2023-09-03 13:05:58 -04:00
get 445bf8d2c6 Kill AsciiToHex
Now superseded by Common::FromChars
2023-06-22 00:06:50 -05:00
Lioncash 954afd81ec StringUtil: Move CommandLineToUtf8Argv() into Common namespace 2023-05-16 14:23:21 -04:00
Lioncash d368c989e7 StringUtil: Move GetEscapedHtml() into Common namespace 2023-05-16 14:21:19 -04:00
Lioncash 21df3ca572 StringUtil: Move IsPrintableCharacter() into Common namespace 2023-05-16 14:17:54 -04:00
Brad Smith c9bbb12c2e Fix build of iconv code on OpenBSD 2023-04-25 01:22:05 -04:00
Admiral H. Curtiss bdb19085c4
Common: Add utility function for case-insensitive string comparison. 2023-02-28 00:56:33 +01:00
Lioncash 1d03835c5d StringUtil: Make StringUTF8CodePointCount take string_view
There's nothing really about this that would need to constrain it to
only std::string instances.
2023-01-24 16:55:43 -05:00
Lioncash e5b91f00b0 Common: Replace StringBeginsWith/StringEndsWith with std equivalents
Obsoletes these functions in favor of the standard member functions
added in C++20.
2023-01-24 14:58:20 -05:00
Shawn Hoffman d51e4e5236 get rid of HAS_STD_FILESYSTEM
just use std::filesystem
2023-01-10 05:17:43 -08:00
Admiral H. Curtiss 6b419c7ca3
Merge pull request #10876 from shuffle2/cpudetect
CPUDetect: improve win/arm64 support
2022-07-26 12:52:50 +02:00
Shawn Hoffman 76b4318b88 CPUDetect: improve win/arm64 support
read brand_string on macos/arm64
remove unused flags
report family/model info instead of vendor name
2022-07-25 21:21:11 -07:00
Shawn Hoffman f92541fbd9 StripSpaces: only strip spaces
StripWhitespace maintains old behavior
2022-07-25 18:40:12 -07:00
Admiral H. Curtiss b1d1f2aa06
Common/StringUtil: Add convenience function for converting paths to use forward slashes on Windows. 2022-06-05 21:24:45 +02:00
Admiral H. Curtiss 5c687fc2a3
Common/StringUtil: Use simpler formatting for floats and doubles. 2022-04-12 23:35:19 +02:00
Pokechu22 aaec64501a Create Common::ToLower and Common::ToUpper 2022-01-16 16:56:53 -08:00
Dentomologist f5e5e8553c StringUtil: Remove unused function BuildCompleteFilename 2021-07-21 12:39:00 -07:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Dentomologist 99ed43280d Updater: Escape HTML characters in commit descriptions 2021-06-01 17:22:19 -07:00
Filoppi 574477866f InputCommon: fix serialization of control expression with line breaks
The control expression editor allows line breaks, but the serialization was
losing anything after the first line break (/r /n).
Instead of opting to encode them and decode them on serialization
(which I tried but was not safe, as it would lose /n written in the string by users),
I opted to replace them with a space.
2021-05-12 18:25:56 +03:00
David Carlier 2c355b81f2
Add NetBSD support 2020-12-15 02:34:25 +01:00
Lioncash 4e8df93f41 Common: Migrate logging to fmt
Continues the migration of our code over to the fmt logger.
2020-10-23 14:58:03 -04:00
JosJuice 16d2ef1ea9 DolphinQt: Handle non-ASCII characters in Windows cmd arguments
CommandLineParse expects UTF-8 strings. (QApplication, on the
other hand, seems to be designed so that you can pass in the
char** argv untouched on Windows and get proper Unicode handling.)
2020-09-21 17:26:29 +02:00
LC 487cd7abd9
Merge pull request #8905 from JosJuice/jni-encoding
Android: Use correct encoding when converting strings
2020-07-18 22:13:14 -04:00
Techjar 037aa2192f NetPlay: Limit nickname length
Ridiculously long nicknames cause UI silliness, so 30 characters seems
like a reasonable limit, as it's the same as the forum.
2020-07-16 19:03:54 -04:00
JosJuice f5da6e07d7 Android: Use correct encoding when converting strings
The functions with "UTF" in the name use "modified UTF-8" rather
than the standard UTF-8 which Dolphin uses, at least according
to Oracle's documentation, so it is incorrect for us to use them.
This change fixes the problem by converting between UTF-8 and
UTF-16 manually instead of letting JNI do it for us.
2020-07-08 14:52:05 +02:00
JosJuice 38791eec18 Common: Never convert from UCS-2 in WStringToUTF8
Probably not something we would run into in practice since
Windows uses a separate implementation, but let's do it
for the sake of correctness.
2020-07-08 14:51:35 +02:00
JosJuice 15d9fab0bb Common: Rename UTF16ToUTF8
This function does *not* always convert from UTF-16. It converts
from UTF-16 on Windows and UTF-32 on other operating systems.

Also renaming UTF8ToUTF16 for consistency, even though it
technically doesn't have the same problem since it only was
implemented on Windows.
2020-07-08 14:51:35 +02:00
JosJuice 5f6598f9e9 StringUtil: Add PathToFileName function 2020-03-16 21:03:34 +01:00
magiblot 55e8601192
Fix another implicit false-to-nullptr conversion 2020-02-09 15:51:30 +01:00
Léo Lam 89b0ab2d22 StringUtil: Add IsPrintableCharacter and use it
Add a function that safely returns whether a character is printable
i.e. whether 0x20 <= c <= 0x7e is true.

This is done in several places in our codebase and it's easy to run
into undefined behaviour if the C version defined in <cctype>
is used instead of this one, since its behaviour is undefined
if the character is not representable as an unsigned char.

This fixes MemoryViewWidget.
2020-01-16 00:22:26 +01:00
Jordan Woyak 0e8d4cb6ac StringUtil: Make TryParse of floats handle comma and dot decimal separators. 2020-01-04 07:19:15 -06:00
David Korth c2dd2e8a2e Use std::istringstream or std::ostringstream instead of std::stringstream where possible.
This removes std::iostream from the inheritance chain, which reduces
overhead slightly.
2019-12-29 23:45:02 -05:00
QuellaZhang e67eb4693e
Fix implicit false-to-nullptr conversions 2019-08-15 17:49:57 +02:00
JosJuice 117a60ceb2 StringUtil: Comply with variable naming style 2019-07-23 14:49:13 +02:00
JosJuice a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
JosJuice c0a6fa5dcc Work around C++20 std::filesystem changes related to u8string 2019-06-21 18:34:21 +02:00
Lioncash 5b92d5076a
Common: Use fmt where applicable
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().

Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
2019-06-14 15:04:09 -04:00
Filip Gawin 49fe9f5db1 Use empty instead of size 2019-02-13 00:03:49 +01:00
Jordan Woyak fae368d2ee
Fix spurious error logs for conversions of empty strings on Windows. 2018-11-22 06:50:11 +01:00
Léo Lam 83324fe77d StringUtil: Remove ValueToString(std::string)
Doesn't make a lot of sense to have a function that gives the string
representation for a string.
2018-06-03 15:11:59 +02:00
Léo Lam fc0193c4b1 Move Config ValueToString to StringUtil
An identical implementation is used by IniFile, so move those functions
to StringUtil. A future commit will modify IniFile to use them.
2018-06-03 14:10:52 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Miikka Juomoja 7169be242f StringUtil: Fix possible bad free 2018-03-26 23:48:13 +02:00
34will 86a787bdf9 Modified StringUtil to change UTF16ToUTF8 to use a wstring_convert and codecvt_utf8<wchar_t> to convert a UTF16 wstring to a UTF8 string. 2018-01-11 21:49:25 +00:00
34will a949e98d9b Modified UTF16BEUTF8 to just convert the UTF-16 C-string into a std::u16string, and pass it into CodeToUTF8 with the 'from' parameter being "UTF-16BE", rather than manually performing the big endian to little endian encoding. 2018-01-11 19:51:19 +00:00
34will ba111959fa Modified StringUtil to use a u16string instead of a wstring in the non-win32 UTF16BEToUTR8 method. 2018-01-11 02:45:27 +00:00