Johannes Schickel
854e22b38b
COMMON: Make GPL headers consistent in themselves.
2014-02-18 02:39:33 +01:00
richiesams
e1ff60da7a
COMMON: Add erase method to String class
2013-06-20 15:40:25 -05:00
Thierry Crozat
33a29ca61c
COMMON: Fix assert condition in String::setChar()
2013-03-20 20:10:13 +00:00
Johannes Schickel
b4d0a8ba66
JANITORIAL: Enforce "} // End of namespace" with a single space after }.
2013-01-26 19:38:02 +01:00
Johannes Schickel
b0ba4b01a4
COMMON: Add wrapper for isprint.
...
This is done in the spirit of 658080deed
.
2012-12-13 21:08:47 +01:00
Willem Jan Palenstijn
9ffe3e11d9
Merge pull request #182 from fingolfin/forbid-ctype
...
ALL: Avoid using is* macros from ctype.h
2012-02-21 11:33:32 -08:00
Max Horn
2017ba338a
COMMON: Fix typo
2012-02-16 11:12:39 +01:00
Max Horn
658080deed
ALL: Avoid using is* macros from ctype.h
...
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.
2012-02-15 16:51:37 +01:00
Littleboy
b694a78f62
ANALYSIS: Add static casts to is* functions
...
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-23 08:52:52 -04:00
Max Horn
e792adb1b8
COMMON: Add vformat() function (Common::String analog to vsprintf)
2011-06-18 01:36:15 +02:00
Max Horn
0a0258edcf
COMMON: Let Common::normalizePath normalize '..' in paths
...
There are some unit tests to verify that this works correctly.
There is a small chance that this causes regressions in weird setups.
2011-06-03 17:33:07 +02:00
Max Horn
8e3aafd30d
COMMON: Provide our own implementations for scumm_str(n)icmp
...
This takes up a tiny little bit of extra binary size, but gets
rid of some awful #ifdef hackery.
2011-05-23 19:12:25 +02:00
strangerke
69b1485a22
GIT: Clean up: Suppress SVN tags, now useless
2011-05-12 01:16:22 +02: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
Joost Peters
426d6749cf
COMMON: work around different vsnprintf behaviour on IRIX
...
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-10-10 22:36:03 +00:00
Willem Jan Palenstijn
532663c742
COMMON: Fix edge case for wildcard in matchString
...
svn-id: r52618
2010-09-07 11:40:44 +00:00
Florian Kagerer
b480f0f2f0
COMMON: fix MSVC assert when using umlauts (or other characters > 127) in the global save/load menu
...
svn-id: r52173
2010-08-17 20:58:01 +00:00
Eugene Sandulenko
7dfd8f9ce2
COMMON: Remove redundant include from str.cpp
...
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-17 12:47:18 +00:00
Johannes Schickel
7b51537be2
Common: Fix bug in lastPathComponent.
...
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-08-16 16:01:31 +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
Thierry Crozat
721db3eccb
Fix an issue in String::ensureCapacity() when the string is shared. It could 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-06-19 15:35:21 +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
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
Willem Jan Palenstijn
833e6f41d5
Fix broken size in Common::String::printf output in MSVC
...
svn-id: r44979
2009-10-12 11:51:28 +00:00
Willem Jan Palenstijn
90eebcd245
Use buffer in Common::String::printf slightly more efficiently
...
svn-id: r44562
2009-10-03 20:26:30 +00:00
Willem Jan Palenstijn
ddea9a5bda
Fix Common::String::printf in MSVC
...
svn-id: r44520
2009-10-01 14:47:52 +00:00
Johannes Schickel
75113ad5f3
COMMON: Add "ignoreCase" parameter to matchString.
...
svn-id: r44265
2009-09-23 00:14:06 +00:00
Eugene Sandulenko
a69b4d60fc
Formatting
...
svn-id: r42746
2009-07-25 10:37:20 +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
a5ff6cc19d
Fixed appending a (substring of a) string to itself
...
svn-id: r41337
2009-06-07 13:14:34 +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
c33a875d9f
Fixed new[] / delete mismatch in Common::String
...
svn-id: r40302
2009-05-04 14:20:17 +00:00
Max Horn
882c24d2ee
COMMON: Check for failed memory allocations; changed Common::String to use new/delete instead of malloc/free
...
svn-id: r40291
2009-05-03 22:45:31 +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
95474b048a
COMMON: Added a new ObjectPool class, with matching operator new/delete overloads
...
svn-id: r34785
2008-10-12 22:05:26 +00:00
Max Horn
0aa9e6ff4c
Ignore String::deleteLastChar when called on an empty string
...
svn-id: r34718
2008-10-02 17:17:18 +00:00
Max Horn
f9650f0b6a
Changed Common::String to use a MemoryPool for its refcounts
...
svn-id: r34642
2008-09-24 20:29:29 +00:00
Max Horn
bbba275913
Little readability tweak
...
svn-id: r34615
2008-09-20 15:53:17 +00:00
Max Horn
0dcb30e75c
Optimized matchString for the common case where there is a trailing * (if that is the case, abort immediately instead of scanning the rest of the string)
...
svn-id: r34367
2008-09-05 20:29:03 +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
3cb4cfa06f
Fix nasty off-by-one errors
...
svn-id: r34317
2008-09-03 18:38:01 +00:00
Max Horn
c3d7c908e8
Modified Common::Str to use exponential growth for its storage; also changed the meaning of 'capacity' from 'max length of string' to 'size of storage' (i.e. added one)
...
svn-id: r34313
2008-09-03 17:39:18 +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
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
918e0fe473
Reorder stuff a little bit, moving private String methods together: cleanup
...
svn-id: r33248
2008-07-23 16:49:45 +00:00