Commit Graph

37 Commits

Author SHA1 Message Date
Max Horn
4d43c8a121 Added operator== and != to Common::Array
svn-id: r45247
2009-10-19 17:46:50 +00:00
Max Horn
3ed4f388d7 Unify PS2 and non-PS2 alloc code in Common::Array code (if this causes regressions somewhere, we better find a fix that also works on PS2)
svn-id: r42455
2009-07-13 22:08:56 +00:00
Max Lingua
13a1dc0a58 Added a temporary work-around for PS2 backend in common/array.h
cause its vintage compiler does not support "new T[newCapacity]()"
but only "new T[newCapacity]", this will let it compile through.

It's ifdef'd as __PLAYSTATION2__, so it won't make a difference
for other backends with more modern tools.

svn-id: r42402
2009-07-12 05:34:46 +00:00
Max Horn
94dfc8f638 Fixed a bug in Common::Array (including a unit test for it), and changed the way the internal storage growth over time.
The bug could result in incorrect results when using push_back (or insert_at)
to insert data from an array into itself if this insertions would cause the
internal array storage to grow. Also added a unit test for this bug.

Furthermore, if the internal storage needs to grow, it will now be resized to the next power of two,
instead of being increased by 32.

svn-id: r40907
2009-05-26 11:28:38 +00:00
Max Horn
36818ced2a Changed Common::Array::resize() to default init new array elements
svn-id: r40430
2009-05-10 19:17:11 +00:00
Max Horn
61dcaad888 COMMON: Changed Array destructor to reset _storage and _size to 0 -- this helps to find 'Array used after being disposed' bugs
svn-id: r40326
2009-05-05 12:29:15 +00:00
Max Horn
689511a56f COMMON: Made Array::resize() init/zero the memory it allocates
svn-id: r40304
2009-05-04 15:04:39 +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
4d57c1f9a9 COMMON: Changed Array::resize to not shrink the internal storage if we shrink the array
svn-id: r40262
2009-05-03 09:00:53 +00:00
Max Horn
7f20f3bb3e COMMON: Improved efficiency of some Common::List methods; added more unit tests and some doxygen comments for Common::List and Common::Array
svn-id: r40164
2009-04-27 14:25:16 +00:00
Max Horn
e579f91b5c COMMON: Made sure Common::List and Common::array each have all front/back/push_back/push_front, as have their STL counterparts
svn-id: r40163
2009-04-27 14:23:20 +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
Max Horn
78cf5a4ccf COMMON & TESTS: Added new constructor to Array<T>, namely Array(const T* data, int n), which makes it possible to clone a regular array into a Common::Array; added a unit test for that and slightly extended existing Common::Array unit tests
svn-id: r40027
2009-04-20 19:27:11 +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
Johannes Schickel
311e9165ed Proper delete[] formatting (this time all occurences should've been changed...)
svn-id: r31929
2008-05-07 15:09:10 +00:00
Johannes Schickel
db04dd427d Formatting.
svn-id: r31852
2008-05-03 23:02:05 +00:00
Max Horn
805f21e369 Removed Common::Array::contains()
svn-id: r31501
2008-04-14 12:11:10 +00:00
Max Horn
142a39da22 Added Array::resize() method
svn-id: r30983
2008-02-27 14:06:06 +00:00
Max Horn
0a918b02fb Added Array::resize() method, matching vector::resize() from the std C++ lib
svn-id: r30982
2008-02-27 13:35:29 +00:00
Johannes Schickel
a783c45d9e Cleanup.
svn-id: r29476
2007-11-11 11:39:59 +00:00
Nicola Mettifogo
258901bab9 Merged common/stdafx.h into common/scummsys.h. All referencing files have been updated.
svn-id: r28966
2007-09-19 08:40:12 +00:00
Max Horn
162460d18a Must include stdafx.h before scummsys.h
svn-id: r28949
2007-09-18 21:23:22 +00:00
Max Horn
218e132e37 Updated legal headers in source files, based on what Pidgin (the IM client formerly knowns as Gaim) does; added new (incomplete) COPYRIGHT file; updated copyright dates in a few spots
svn-id: r27024
2007-05-30 21:56:52 +00:00
Johannes Schickel
ad03c72bdb Commit of patch #1715313 ("CORE: STL like algorithm implementation").
svn-id: r26929
2007-05-23 12:02:31 +00:00
Max Horn
30e975f9db Protect Array<> and HashMap<> instances against self assignments
svn-id: r26115
2007-03-12 22:34:29 +00:00
Max Horn
728d01cb17 Removing some unnecessary #includes
svn-id: r26044
2007-03-09 23:46:45 +00:00
Johannes Schickel
d65e7826fd Fixes compiling for me with g++ (GCC) 4.1.2 20061007 (prerelease) (Debian 4.1.1-16) on amd64.
svn-id: r24298
2006-10-13 20:18:27 +00:00
Max Horn
9f93e5bb81 Renamed various container isEmpty() methods to empty() to match STL conventions
svn-id: r21472
2006-03-28 09:42:54 +00:00
Max Horn
36934b611d Change CVS keywords to SVN keywords
svn-id: r20510
2006-02-11 09:53:53 +00:00
Eugene Sandulenko
ea42bad781 Update copyright notice
svn-id: r20088
2006-01-18 17:39:49 +00:00
Eugene Sandulenko
b36677af71 Update FSF address. Eek. Actually that took place on May 1, 2005
svn-id: r19142
2005-10-18 01:30:26 +00:00
Eugene Sandulenko
6b4484472b Remove trailing whitespaces.
svn-id: r18604
2005-07-30 21:11:48 +00:00
Lars Persson
1c69696a9a Patches needed to build for SYMBIAN32 WINS/GCC added.
Test built for Symbian and run on P910i without any major problems.
Test built for MSVC6. Changed parts seems to compile ok but there are some problems with MSVC6 and some of the targets which the EPOC build does n't support (KYRA,SAGA).

svn-id: r18430
2005-06-21 22:08:21 +00:00
Max Horn
47280d9433 Updated copyright
svn-id: r16398
2005-01-01 16:09:25 +00:00
Max Horn
ab82837dcc Preserve the order of config file sections -> to suite people who manually edit the config file
svn-id: r15322
2004-09-28 12:10:49 +00:00
Eugene Sandulenko
e31aa60730 Fix compilation of remove_at() in array.h. It was never tested before.
Make stacks' pop() return top value, not just move stack pointer.

svn-id: r14565
2004-08-12 21:33:59 +00:00
Max Horn
8a69ffc46c Renamed template class 'List' to 'Array', since that is really what it is (a resizable array, not a linked list)
svn-id: r13520
2004-04-09 15:10:23 +00:00