Colin Snover
9d3893459f
COMMON: Add strnlen for safer C string length reads
...
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.
2017-01-05 22:07:24 +01:00
Alexander Tkachev
438ba985a4
JANITORIAL: Remove spaces at the end of the line
...
I knew there were some, but I wanted to fix them once, instead of doing
it all the time.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
627bda9d82
COMMON: Add replace(String, String, String)
...
Searches for a substring in the string and replaces it with the other
string.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c99b24c16d
COMMON: Add String::asUint64()
...
Instead of all these atoull() I've added everywhere.
2016-08-24 16:07:55 +06:00
Borja Lorente Escobar
a19b50ddf2
COMMON: Add replace functions to Common and String.
...
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-05-16 22:01:21 +02:00
Johannes Schickel
06641f29a7
COMMON: Allow '#' to only match digits in matchString.
2016-01-26 16:35:30 +01:00
Vincent Bénony
16605a3e10
IOS: Moves the helper function were it is used.
2016-01-06 16:20:29 +01:00
Vincent Bénony
bbf3785bba
IOS: Adds two helper functions on strings
2016-01-06 15:35:30 +01:00
Einar Johan Trøan Sømåen
b7c5ce879f
COMMON: Fix some Doxygen comments that seem wrong.
2014-08-29 03:28:00 +02:00
Johannes Schickel
854e22b38b
COMMON: Make GPL headers consistent in themselves.
2014-02-18 02:39:33 +01:00
Johannes Schickel
abe6d30f36
COMMON: Document Common::String::unsigned_type.
2013-11-23 21:34:55 +01:00
Johannes Schickel
1a6f9378aa
COMMON: Add underlying type names to Common::String.
...
The value_type is analogous to std::basic_string::value_type.
The unsigned_type on the other hand is an unsigned type of the value_type which
allows to obtain an character without nasty sign extension.
2013-11-23 21:34:54 +01:00
richiesams
e1ff60da7a
COMMON: Add erase method to String class
2013-06-20 15:40:25 -05:00
Christoph Mallon
84220d2ca0
COMMON: Remove superfluous Common:: qualifiers.
2011-08-07 15:19:07 +02:00
Max Horn
e792adb1b8
COMMON: Add vformat() function (Common::String analog to vsprintf)
2011-06-18 01:36:15 +02:00
Max Horn
e06ca6560f
COMMON: Move scumm_str(n)icmp declaration to str.h
2011-05-31 14:19:25 +02:00
Matthew Hoops
eea482fa43
ALL: behaviour -> behavior
2011-05-25 10:50:46 -04:00
strangerke
69b1485a22
GIT: Clean up: Suppress SVN tags, now useless
2011-05-12 01:16:22 +02:00
Jordi Vilalta Prat
d5a4f554af
ALL: Fix a few typos
...
svn-id: r54716
2010-12-01 20:03:05 +00:00
Max Horn
e27b05ef35
COMMON: Rename String::printf() to String::format()
...
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-11-01 16:02:28 +00:00
Eugene Sandulenko
f7645fea45
Revert "COMMON: Implement Common::vprintf(). Patch by littleboy"
...
svn-id: r53586
2010-10-18 20:20:14 +00:00
Eugene Sandulenko
4b5640883c
COMMON: Implement Common::vprintf(). Patch by littleboy
...
svn-id: r53576
2010-10-18 19:04:41 +00:00
Willem Jan Palenstijn
a3202eab7c
Note Common::String's behaviour may be undefined with \0 characters.
...
Also make operator=(char) and String(char) behave the same.
svn-id: r50712
2010-07-05 21:29:52 +00:00
Johannes Schickel
9521f8d008
Typo fixes.
...
svn-id: r49324
2010-05-30 13:41:40 +00:00
Johannes Schickel
f02e31f2fc
Fix non-const version of Common::String::begin.
...
Common::String::begin now assures the storage is a unique one, i.e. there are
no other Common::String objects pointing at it. This allows for safe use of
the writable iterators (and thus fixes the test case added with my last commit)
svn-id: r49323
2010-05-30 13:10:44 +00:00
Johannes Schickel
388e4b65bf
Add a custom implementation of OpenBSD's strlcat and strlcpy.
...
This includes both an implementation and some basic unit tests for
the above mentioned functions.
svn-id: r48953
2010-05-05 17:52:59 +00:00
Max Horn
c934642bdb
COMMON: Move typedef StringList from str.h to new header str-array.h
...
This removes the dependency on array.h from str.h.
Also, begun migration from the confusing type name "StringList" to
the more appropriate StringArray.
svn-id: r48282
2010-03-18 15:09:24 +00:00
Max Horn
30c84d2cff
COMMON: Move tag2str from util.h to str.h
...
svn-id: r48281
2010-03-18 15:07:48 +00:00
Johannes Schickel
5278b82f33
Slight formatting fixes to comply to our coding guidelines.
...
svn-id: r47744
2010-01-31 10:22:09 +00:00
Max Horn
b0e02675e7
Get rid of Common::String::emptyString, and also of some port specific hackery (getting rid of certain global C++ objs)
...
svn-id: r46781
2009-12-30 23:01:36 +00:00
Johannes Schickel
75113ad5f3
COMMON: Add "ignoreCase" parameter to matchString.
...
svn-id: r44265
2009-09-23 00:14:06 +00:00
Willem Jan Palenstijn
744112ceb0
Add Common::String::printf to format a string
...
svn-id: r42743
2009-07-25 10:25:57 +00:00
Max Horn
a39048877a
Added some new method variants to Common::String
...
svn-id: r41333
2009-06-07 13:04:03 +00:00
Max Horn
c91a6c97ae
Clarified docstring for String::insertChar
...
svn-id: r40382
2009-05-08 12:37:28 +00:00
Max Horn
b98f79fe12
COMMON: changed class StringList to a simple typedef; enhanced the Common::Array constructor which converts regular arrays to Array objects to be more flexible in its type (allows e.g. to assign an array of char* to a StringList
...
svn-id: r40077
2009-04-22 17:52:56 +00:00
Johannes Schickel
a9e424f177
Formatting.
...
svn-id: r39789
2009-04-01 13:59:53 +00:00
Max Horn
17014c4f47
Merged internal 'matchPath' method of class Archive into global matchString function (via an optional 'path mode' in the latter). Also changed Archive::listMatchingMembers to use path mode when matching, just like FSDirectory::listMatchingMembers
...
svn-id: r38277
2009-02-15 18:45:53 +00:00
Jordi Vilalta Prat
b1999a2a16
Fixed indentation and removed whitespaces at the end of line
...
svn-id: r35481
2008-12-22 11:22:15 +00:00
Max Horn
0d34b772a4
Fixed a nasty bug in SearchManager::addDirectory; made the 'char' constructor of Common::String explicit, to avoid such bugs in the future
...
svn-id: r34660
2008-09-27 18:34:24 +00:00
Max Horn
a408f4a776
Changed builtin Common::String capacity to 24 (on 32 bit systems), to make sizeof(String) 32; reduces overall memory req by 200k on my system; overall # of mallocs after this + the refcount memory pool change is almost unchanged
...
svn-id: r34644
2008-09-24 20:35:31 +00:00
Max Horn
9bf7aa308e
Moved matchString from util.* to str.*; added new String::matchString method; fixed matchString doxygen comment (it confused pattern & string); added unit tests for matchString
...
svn-id: r34364
2008-09-05 20:07:34 +00:00
Max Horn
155b8606c1
Added two new global funcs which ease proper handling of 'path' strings: Common::lastPathComponent() and Common::normalizePath()
...
svn-id: r34272
2008-09-02 11:32:38 +00:00
Johannes Schickel
df5c0b6d0c
And for all of those who love recompiling most of ScummVM... fixed typo properly :-P
...
svn-id: r34188
2008-08-26 13:56:58 +00:00
Johannes Schickel
61f750832a
Fixed typo. (Thanks to salty-horse for spotting it).
...
svn-id: r34187
2008-08-26 13:51:26 +00:00
Max Horn
a79e9385a1
Unified member names in container/storage classes Array, HashMap and String: _storage, _size, _capacity
...
svn-id: r34052
2008-08-20 11:07:16 +00:00
Max Horn
15c610a069
Added convenience method String::makeUnique(); simplified String::operator=(char c); extended String unit tests
...
svn-id: r33246
2008-07-23 16:33:53 +00:00
Max Horn
705c92ddc3
Added String::trim() method
...
svn-id: r33203
2008-07-22 14:39:26 +00:00
Max Horn
c625a6a647
Fixed potential issue in Common::String when asserting a substring of a string X back to X (memcpy -> memmove); also added some other sanity checks, and merged some duplicate code into a new method String::initWithCStr
...
svn-id: r33137
2008-07-20 16:42:56 +00:00
Max Horn
57ad73faee
Removed char &operator [] from class String -- it had the potential to wreak havoc when used on shared strings (thanks to tramboi for pointing this out)
...
svn-id: r31334
2008-03-30 18:37:09 +00:00
Max Horn
7e1ba4732e
Dropped superfluous 'virtual' keyword (saves us a few bytes for each String)
...
svn-id: r31327
2008-03-30 12:44:05 +00:00