aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
AgeCommit message (Collapse)Author
2019-12-11COMMON: Fix toPrintable() for upper charactersEugene Sandulenko
2019-12-10COMMON: Added helper function to produce printable stringsEugene Sandulenko
2019-10-18COMMON: Added String::find()Eugene Sandulenko
2019-09-30COMMON: Fix MSVC Compiler WarningD G Turner
The enum is implicitly int32 by default so causes signed vs. unsigned assignment warnings. Changing this to a const uint32 avoids the issue.
2019-03-03COMMON: Allow '\#' to match '#' in matchStringsluicebox
matchString patterns couldn't be used to find files with the # character as it was only treated as a digit wildcard. SCI expected that to work as it looks for files that start with the # character.
2018-10-14COMMON: Add mutex to protect access to the String memory poolThierry Crozat
This fixes a crash due to concurrent access to the global MemoryPool used by the String class when String objects are used simultaneously from several threads (as is for example the case when enabling the cloud features). See bug #10524: Thread safety issue with MemoryPool
2018-08-18COMMON: Move new_strdup to common/str.cppCameron Cawley
2018-05-10COMMON: Use nullptr instead of NULL or 0 where appropriateBastien Bouclet
2018-04-30GUI: Make the tab completion case insensitive in the debug consoleBastien Bouclet
It made little sense for the tab-completion to be case sensitive while command execution itself is case insensitive.
2018-04-15JANITORIAL: Fix whitespaceAdrian Frühwirth
2017-11-10COMMON: Add basic fixed-width word wrap to Common::StringColin Snover
2017-01-05COMMON: Add strnlen for safer C string length readsColin Snover
This API is intended for use in cases where C strings come from untrusted sources like game files, where malformed data missing the null terminator would cause strlen to read out of bounds.
2016-08-24COMMON: Add replace(String, String, String)Alexander Tkachev
Searches for a substring in the string and replaces it with the other string.
2016-08-24COMMON: Add String::asUint64()Alexander Tkachev
Instead of all these atoull() I've added everywhere.
2016-05-28COMMON: Fix warning about shadowing class membersEugene Sandulenko
2016-05-16COMMON: Add replace functions to Common and String.Borja Lorente Escobar
COMMON: Add replacement to common/algorithm.h COMMON: Intermediate commit to show doubts. COMMON: Basic String::replace() methods implemented. COMMON: Fix typo in the algorithm.h documentation. COMMON: Fix documentation of String::replace() COMMON: Fix formatting issues in method signatures. COMMON: Add assert and reformat loops in str and algorithm. COMMON: Fix typo in comment. COMMON: Fix style in string test cases. COMMON: Add Doxygen documentation to algorithm and String. COMMON: Add Doxygen documentation to algorithm and String. COMMON: Add Doxygen documentation to algorithm. COMMON: Fix style in algorithm comments. COMMON: Add Doxygen comments to String. COMMON: Add Doxygen comments to algorithm test function. COMMON: Add String support for substring replace. COMMON: Fix string replace to comply with STL COMMON: Fix documentation on string replace COMMON: Fix style in string replace COMMON: Fix unwanted reference problem in String::replace(). COMMON: Fix indentation in comments for replace COMMON: Fix indentation in replace COMMON: Fix comments in String::replace to match implementation. COMMON: Remove assert to allow for not-null-terminated character arrays COMMON: Add new test for String::replace COMMON: Fix broken comments on String::replace COMMON: Fix sharing bug on ensureCapacity COMMON: Remove superfluous call to makeUnique()
2016-01-26COMMON: Allow '#' to only match digits in matchString.Johannes Schickel
2014-02-18COMMON: Make GPL headers consistent in themselves.Johannes Schickel
2013-06-20COMMON: Add erase method to String classrichiesams
2013-03-20COMMON: Fix assert condition in String::setChar()Thierry Crozat
2013-01-26JANITORIAL: Enforce "} // End of namespace" with a single space after }.Johannes Schickel
2012-12-13COMMON: Add wrapper for isprint.Johannes Schickel
This is done in the spirit of 658080deeda79d20ea40643569fbcb072573e7cf.
2012-02-21Merge pull request #182 from fingolfin/forbid-ctypeWillem Jan Palenstijn
ALL: Avoid using is* macros from ctype.h
2012-02-16COMMON: Fix typoMax Horn
2012-02-15ALL: Avoid using is* macros from ctype.hMax Horn
On some systems, passing signed chars to macros like isspace() etc. lead to a runtime error. Hence, mark these macros as forbidden by default, and introduce otherwise equivalent alternatives for them.
2011-06-23ANALYSIS: Add static casts to is* functionsLittleboy
This fixes a potential problem with passing char values that would be sign-extended and yield unexpected results. See http://msdn.microsoft.com/en-us/library/ms245348.aspx
2011-06-18COMMON: Add vformat() function (Common::String analog to vsprintf)Max Horn
2011-06-03COMMON: Let Common::normalizePath normalize '..' in pathsMax Horn
There are some unit tests to verify that this works correctly. There is a small chance that this causes regressions in weird setups.
2011-05-23COMMON: Provide our own implementations for scumm_str(n)icmpMax Horn
This takes up a tiny little bit of extra binary size, but gets rid of some awful #ifdef hackery.
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2010-11-01COMMON: Rename String::printf() to String::format()Max Horn
This is a first step towards getting rid of all uses of regular printf, fprintf, vprintf, vfprintf, puts, fputs, etc. in our codebase. The name format() reflects the purpose of the function, and parallels String.format() in Java, boost::format, and others. svn-id: r54004
2010-10-18Revert "COMMON: Implement Common::vprintf(). Patch by littleboy"Eugene Sandulenko
svn-id: r53586
2010-10-18COMMON: Implement Common::vprintf(). Patch by littleboyEugene Sandulenko
svn-id: r53576
2010-10-10COMMON: work around different vsnprintf behaviour on IRIXJoost Peters
The return value of vsnprintf when the provided buffer is not large enough to hold the formatted string is implementation-dependent: C99: The size the formatted string would take up. MSVC: -1, with no indication of how large the buffer should be. IRIX: The number of characters actually written, which is at most the size of the buffer minus one, as the string is truncated to fit. This means the only way to be sure the entire string is written is if the return value is less than the capacity - 1. This change means that whenever we try to format a string where the size is 1 below the built-in capacity, that the capacity will be needlessly increased. If this turns out to be problematic we could make this behaviour __sgi conditional. svn-id: r53143
2010-09-07COMMON: Fix edge case for wildcard in matchStringWillem Jan Palenstijn
svn-id: r52618
2010-08-17COMMON: fix MSVC assert when using umlauts (or other characters > 127) in ↵Florian Kagerer
the global save/load menu svn-id: r52173
2010-08-17COMMON: Remove redundant include from str.cppEugene Sandulenko
If it is needed for your specific platform, then readd it, but for that platform. Although to me it looks all redundant. svn-id: r52155
2010-08-16Common: Fix bug in lastPathComponent.Johannes Schickel
Prior to this change lastPathComponent would not create a correct result, when the input of lastPathComponent did not contain a single separator. I also added a test case for this in our unit tests. svn-id: r52123
2010-07-05Note Common::String's behaviour may be undefined with \0 characters.Willem Jan Palenstijn
Also make operator=(char) and String(char) behave the same. svn-id: r50712
2010-06-19Fix an issue in String::ensureCapacity() when the string is shared. It could ↵Thierry Crozat
allocate two much memory as it was at least doubling the current capacity even when this one was sufficient. It fixes a crash in GUI::Widget::cleanupHotkey() as the capacity of the string was doubled at each iteration once it was too long for the internal storage (only to add one character to the string). This ended up in a bad_alloc exception after a few iterations. svn-id: r50050
2010-05-05Add a custom implementation of OpenBSD's strlcat and strlcpy.Johannes Schickel
This includes both an implementation and some basic unit tests for the above mentioned functions. svn-id: r48953
2010-03-18COMMON: Move tag2str from util.h to str.hMax Horn
svn-id: r48281
2010-01-31Slight formatting fixes to comply to our coding guidelines.Johannes Schickel
svn-id: r47744
2009-12-30Get rid of Common::String::emptyString, and also of some port specific ↵Max Horn
hackery (getting rid of certain global C++ objs) svn-id: r46781
2009-10-12Fix broken size in Common::String::printf output in MSVCWillem Jan Palenstijn
svn-id: r44979
2009-10-03Use buffer in Common::String::printf slightly more efficientlyWillem Jan Palenstijn
svn-id: r44562
2009-10-01Fix Common::String::printf in MSVCWillem Jan Palenstijn
svn-id: r44520
2009-09-23COMMON: Add "ignoreCase" parameter to matchString.Johannes Schickel
svn-id: r44265
2009-07-25FormattingEugene Sandulenko
svn-id: r42746
2009-07-25Add Common::String::printf to format a stringWillem Jan Palenstijn
svn-id: r42743