Commit graph

85 commits

Author SHA1 Message Date
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
JosJuice
2c10ba9be1 Simplify StringUtil::UTF16ToUTF8 2017-11-11 20:30:06 +01:00
JosJuice
65c1df094f Remove unneeded check in StringUtil::UTF16ToUTF8
No code is relying on this unexplained null byte check, since
the only code that calls UTF16ToUTF8 on non-Windows systems
is UTF16BEToUTF8, which explicitly strips null bytes.
2017-11-11 20:30:06 +01:00
JosJuice
6902bbb696 When NAND is damaged, show title names from save files
The earlier code always tried to use TitleDatabase for getting
title names, but that didn't work for disc-based games, because
there was no way to get the maker ID.
2017-11-03 23:17:36 +01:00
JosJuice
5a6d90900e Add WiiSaveBanner class
This class is similar to the BannerLoaderWii class that was
removed in ee694e32.
2017-11-03 23:00:43 +01:00
Pierre Bourdon
43f067c6e1 StringUtil: support TryParse(u16*) 2017-09-18 05:04:11 +02:00
Léo Lam
90f8265497 Replace StringFromInt with std::to_string
Updated version of #47. Android should support to_string now that
we use a modern version of libc++ when building.
2017-07-05 13:49:33 +02:00
Léo Lam
17ef4c8046 StringUtil: Make SplitString return by value
Simpler usage.
2017-06-11 16:48:20 +02:00
Sepalani
f28f23af1d StringUtil: StringPopBackIf added 2017-06-06 05:08:51 +01:00
spycrab
e66ad018f4 Convert VolumeDirectory names back to SHIFT-JIS (issue #9988) 2017-05-01 14:08:47 +02:00
Sepalani
c170659189 StringUtil: Fix a ctype assertion 2017-04-06 15:02:21 +01:00
Augustin Cavalier
0831dad467 Initial support for Haiku. 2017-03-27 23:46:19 -04:00
Lioncash
beec40f178 IniFile: Handle s64/u64 values 2017-02-25 00:03:20 -05:00
JosJuice
bc2b9f4c3c Translate Swedish in example strings to English 2017-02-04 22:51:01 +01:00