191 Commits

Author SHA1 Message Date
Christian Kündig 7289eac20b COMMON: Fix Common::percentEncodeString 2025-08-13 18:38:54 +02:00
Le Philousophe 42b4e7ca10 COMMON: Improve scumm_stricmp and scumm_strnicmp performance
Avoid calling tolower when the characters are equal.
2025-08-07 20:19:28 +02:00
Donovan Watteau 5bf1a12082 BUILD: Effectively drop support for MSVC < 2015
It's been documented on the wiki for nearly 3 years that MSVC 2015 is
the oldest MSVC release being supported.

AFAICS no-one is actively using any older version nowadays, and C++11
support in MSVC 2013 is incomplete anyway:
https://learn.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)

This means that some old MSVC hacks can be dropped now (not touching
any vendored or generated code having such hacks, though).
2025-07-26 08:24:33 +03:00
Cameron Cawley c6ae30e7ea COMMON: Support creating strings from a repeated single character 2025-06-20 00:07:23 +02:00
Cameron Cawley b78d519ed3 COMMON: Make String::assignAppend public and extend it 2025-06-20 00:07:23 +02:00
Le Philousophe cfa25e9a4a COMMON: Use proper macro
And never commit without building, never.
2025-05-03 18:03:23 +02:00
sluicebox 2bc69dbb05 COMMON: Add missing semicolon 2025-05-03 09:00:03 -07:00
Le Philousophe 9e7bc8e9e6 COMMON: Don't use va_list several times
Do a copy of it before passing it to a function calling va_arg.
2025-05-03 17:28:34 +02:00
Cameron Cawley e31b6ea8a7 COMMON: Unified implementation of constructing strings with single characters 2024-11-29 01:16:55 +02:00
Paul Gilbert 2e5eaba8f1 M4: RIDDLE: Merge duplicated click_x/y and player.click_x/y
This fixes the Gallery room, where looking at the cartoons
was previously all showing the same cartoon
2024-10-20 10:50:49 -07:00
Abhinav Chennubhotla 6dc1950207 COMMON: Fix percentEncodeString() 2024-06-14 01:15:43 +02:00
Abhinav Chennubhotla 54d58463dc GUI: Display results in IntegrityDialog
- Create percentEncodeString for escaping URL strings
2024-06-14 01:15:43 +02:00
Cameron Cawley f7c2d14587 COMMON: Move all find and replace functions into BaseString 2024-01-08 23:39:22 +01:00
Cameron Cawley 35125f5509 COMMON: Use more standard library functions in String classes 2024-01-08 23:39:22 +01:00
Cameron Cawley 4abc229268 COMMON: Unify implementations of String::replace() 2024-01-08 23:39:22 +01:00
Le Philousophe 7205774eef COMMON: Add replace char function to String
It allows to efficiently replace all character occurences in a string.
It uses strchr to allow optimized libc implementations of string
scanning.
2023-12-24 13:19:25 +01:00
elasota 79e06f899a COMMON: Fix String::matchString matching excluded characters with trailing asterisk wildcards 2023-09-17 19:17:33 +02:00
Sergio d136a5f54c COMMON: fix String::rfind for default value of pos (max value of size_t) 2022-11-26 23:13:42 +02:00
Le Philousophe cd785e2208 COMMON: Add sprintf_s and vsprintf_s
These functions will issue warnings and truncate strings.
It's like snprintf and vsnprintf but noisier.
There are also versions automatically determining size based on the destination
array size.
This raises a compilation error when the size cannot be determined by
the compiler.
2022-10-23 22:46:19 +02:00
Le Philousophe 9c04d72471 COMMON: Forbid use of unsafe strcat and strcpy 2022-10-23 22:46:19 +02:00
Le Philousophe f8c25e2374 COMMON: Add strcpy_s and strcat_s
These functions will issue warnings and truncate strings.
It's like strlcpy and strlcat but noisier.
There are also versions automatically determining size based on the destination
array size.
This raises a compilation error when the size cannot be determined by
the compiler.
2022-10-23 22:46:19 +02:00
elasota cdedda7fa8 COMMON: Add move semantic assign and construct to strings 2022-09-28 17:09:34 +02:00
Eugene Sandulenko 498b2ca3a0 COMMON: Added firstPathComponents() method.
A better name is welcome
2022-03-14 21:16:03 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh cb61ec37c4 COMMON: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Eugene Sandulenko c544e5119b COMMON: Remove USE_CXX11 checks, it is now always present 2021-10-31 11:52:29 +02:00
djsrv 2aa7e3e558 COMMON: Replace matchString pathMode with general wildcard exclusions
Different characters may need to be excluded for different path styles.
2021-08-09 17:43:12 -04:00
Eugene Sandulenko f6e33231bb COMMON: Add an optional parameter to tag2str() for printing non-printables
This time without variadic macros
2021-06-29 22:15:02 +02:00
Eugene Sandulenko 76c6bcef2b Revert "COMMON: Add an optional parameter to tag2str() for printing non-printables"
This reverts commit c11fedb47e.

It is a C++11 feature...
2021-06-29 22:12:25 +02:00
Eugene Sandulenko c11fedb47e COMMON: Add an optional parameter to tag2str() for printing non-printables 2021-06-29 20:42:40 +02:00
D G Turner b8c4cd8129 COMMON: Use Correct Symbol in New String Function 2021-03-15 23:01:24 +00:00
Zvika Haramaty dc5783c910 COMMON: Add String::forEachLine and convertBiDiStringByLines
`convertBiDiStringByLines` calls the BiDi algo for each line in isolation,
and returns a joined result.
That's needed to support BiDi in AGI, and might be needed for other engines
in the future.

In order to do that, a new utility function was added:
`String::forEachLine` which gets a function as input, and its arg(s) (if it has any),
and calls the function on each line, and returns a new string which is all
concatenation of all the lines results (with '\n' added between them).
2021-03-14 18:52:36 +01:00
Vladimir Serbinenko 68a9136e4d COMMON: Rewrite Encoder and drop dependency on iconv (#2586)
Different platforms have different levels of support of encodings and
often have slight variations. We already have tables for most encoding
with only CJK missing. Full transcoding inclusion allows us to get reliable
encoding results independently of platform. The biggest con is the need for
external tables encoding.dat.

It removes a duplicate table for korean in graphics/korfont.cpp
2020-11-15 16:20:35 +01:00
Thierry Crozat e5bfe63087 COMMON: Merge the String and U32String destructors
The call to decRefCount has been moved to the destructor
of the base class BaseString.

Note that BaseString only exists for the purpose of being able
to reuse code for our String and U32String implementations. As
such it is not meant to be used polymorphically and its
destructor does not need to be virtual (with the overhead that
this generates). And to ensure that it is not used in a
polymorphic way, the destructor is declared protected.
2020-11-05 23:52:19 +00:00
Thierry Crozat 0b93a68a0d COMMON: Attempt to fix compilation for some compilers 2020-10-31 16:56:50 +00:00
Thierry Crozat 23ce3edac9 COMMON: Add contains overload for char32_t in String 2020-10-31 16:56:50 +00:00
Vladimir Serbinenko 29cfa7bb0f COMMON: Merge code for str.cpp and ustr.cpp
Most of the code in str.cpp and ustr.cpp is actually the same. Do some
template magic to merge them.
2020-10-31 14:05:30 +01:00
Vladimir Serbinenko 18e6878311 COMMON: Add String::asUint64Ext
This is the same as String::asUint64 but supports 0x and 0 prefixes
2020-10-17 22:34:58 +02:00
aryanrawlani28 e5445fb901 GUI: U32: Small improvements/fixes
- Remove = operator in String, which compared to a U32String.
- Let implicit cast take care of results from getResultString, so in-future easy to spot new changes.
- Use uint32 for each char when encodingUrlStrings, to avoid unsafe comparision.
2020-08-30 14:43:41 +02:00
aryanrawlani28 388473656e GUI: U32: Add contains utility for string, which takes in a uint. 2020-08-30 14:43:41 +02:00
Thierry Crozat 94035cf7aa COMMON: Fix creating a String from a U32String
There were memory issues due to class member variables not initialized
by the constructor.
2020-08-30 14:43:41 +02:00
aryanrawlani28 a9bfe35216 GUI: U32: More issue fixes and general improvements
- Use the fake constructor for message dialog less often
- solve errors regarding comparision between string and u32string in midi
- solve errors in testbed/speech related to ttsMan->say
- fix unsigned comparision warning in tab.cpp
- fix issue with static strings and translations in sdl-graphics
2020-08-30 14:43:41 +02:00
aryanrawlani28 fd763b61e5 GUI: U32: Add U32String conversion helpers to str.cpp
This commit adds a constructor and a "=" operator to allow conversion from u32strings->strings
2020-08-30 14:43:41 +02:00
Cameron Cawley cf068bcc08 ALL: Remove direct use of OSystem::createMutex() 2020-08-21 09:39:00 +02:00
Henrik "Henke37" Andersson dc7b0a7909 COMMON: Dedicated function for in buffer check
It's UB to compare pointers that aren't from the same array. Cast to uintptr to reduce the issue to IB.
2020-07-19 23:07:35 +01:00
Eugene Sandulenko 6059566777 COMMON: Added scumm_strcasestr() 2020-06-18 14:38:12 +02:00
Eugene Sandulenko b9fab94dbf COMMON: Shut coverity up with tons of false positives 2020-04-27 23:51:56 +02:00
Eugene Sandulenko eb04cff38d COMMON: Swtich scumm_strdup to malloc(), so its behaviour matches strdup() 2020-04-27 22:46:22 +02:00
Eugene Sandulenko a08dc72eab COMMON: Skip "an " in dictionary sort 2020-04-24 10:54:00 +02:00
Eugene Sandulenko 0b00d71643 COMMON: Add methods for dictionary string comparison 2020-04-24 10:54:00 +02:00