Commit Graph

104 Commits

Author SHA1 Message Date
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
Thierry Crozat
b5804e1257 COMMON: Do not return an error for unknown hashmap key in release builds
We have a lot of legacy code that was written with the old behaviour
where it returned the default value in such a case. Until we are
confident all this code has been updated, we continue to use the
old behaviour in release builds to avoid creating instabilities.

This still error our in non-release builds, which will help detect
the code that still needs to be updated.
2021-04-03 02:09:53 +01:00
Henrik "Henke37" Andersson
6b2bf785a4 COMMON: Correctly specialize unknownKeyError for int. 2021-02-21 15:33:26 +00:00
Henrik "Henke37" Andersson
f8facede40 COMMON: Specialize unknownKeyError for const char* 2021-02-21 15:33:26 +00:00
Henrik "Henke37" Andersson
0caeac64aa COMMON: Include the not found key in the error message 2021-02-12 00:41:23 +01:00
Henrik "Henke37" Andersson
2d6fdcaf3e COMMON: getVal no longer hides missing keys 2021-02-12 00:41:23 +01:00
Bartosz Gentkowski
24e3b6096e DOXYGEN: Doxygen improvements part 3
Editing doxygen comments in files:

- debug.h
- dialogs.h
- encoding.h
- endian.h
- error.h
- events.h
- fft.h
- file.h
- frac.h
- fs.h
- gui_options.h
- hash-ptr.h
- hashmap.h
- huffman.h
- ini-file.h

Plus some small changes in the config file.
2020-11-04 19:42:34 +00:00
Henrik "Henke37" Andersson
d83a38e0e6 COMMON: HashMap::tryGetVal function 2020-10-17 20:16:33 +02:00
Bartosz Gentkowski
ec24687ce4 DOXYGEN: Add doxygen groups to header files in the common folder
Adding @defgroup and @ingroup doxygen tags into all headers
in the common folder that contain doxygen blocks.

This improves the structure, readability, and findability
of information in the resulting output.

This commit targets purely structure and does not deal with
the content of the currently existing doxygen documentation.
2020-10-04 18:25:50 +02:00
Eugene Sandulenko
aa563f0c81 ALL: Remove PS2 port 2020-08-01 15:15:49 +02:00
Le Philousophe
5cc574a695 BUILD: Fix GCC bogus warning by removing const
GCC emits "warning: type qualifiers ignored on cast result type" when
some types are used for HashMap because of the const modifier.
This applies especially to pointer-to-member-functions.
The const there is not really useful as it only prevents unfortunate
object editions.
2019-09-09 17:39:06 +03:00
Le Philousophe
3a7219fa57 JANITORIAL: Avoid C4121 warnings in MSVC by reordering fields
C4121 is about 'symbol': alignment of a member was sensitive to packing
2019-06-30 21:43:58 +03:00
Thierry Crozat
53d0fe22d9 COMMON: Fix HashMap never reusing erased items storage
When erasing and inserting many items this caused the hashmap capacity
to grow more than it should which resulted in performances issues (and
possibly memory issues as well). The issue was reported on IRC today
with the wintermute engine.
2018-07-30 19:32:02 +01:00
whiterandrek
ac5f61265f COMMON: fix wrong size assignment in HashMap 2018-05-25 19:13:14 +01:00
Bastien Bouclet
955e18c648 COMMON: Use nullptr instead of NULL or 0 where appropriate 2018-05-10 08:35:46 +02:00
Adrian Frühwirth
3747d852ee JANITORIAL: Fix whitespace 2018-04-15 16:31:31 +02:00
Johannes Schickel
854e22b38b COMMON: Make GPL headers consistent in themselves. 2014-02-18 02:39:33 +01:00
Johannes Schickel
b4d0a8ba66 JANITORIAL: Enforce "} // End of namespace" with a single space after }. 2013-01-26 19:38:02 +01:00
Johannes Schickel
dac6ac66ad COMMON: Add a size_type to HashMap. 2012-02-22 20:13:33 +01:00
Johannes Schickel
7e4224e52a COMMON: Fix compilation when USE_HASHMAP_MEMORY_POOL is not defined. 2011-07-03 00:16:07 +02:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Max Horn
c4ae3b90db COMMON: Fix (harmless) int <-> uint mismatch 2011-04-04 09:53:26 +02:00
Johannes Schickel
867c0d9645 COMMON: Add an erase method which takes an iterator to HashMap.
Currently there is no iterator returned from this method, to have some
similarity to associative containers of the STL.

I also "added" one unit test for this method, which is basically just
a copy of the HashMap::erase(const Key &) test with the required adaptions.

svn-id: r55661
2011-01-30 17:28:35 +00:00
Max Horn
963cf0b08a COMMON: Disable DEBUG_HASH_COLLISIONS (oops)
svn-id: r54013
2010-11-01 16:42:31 +00:00
Max Horn
7a85365004 COMMON: Change some (f)printf to debug calls; clenaup hashmap.h
svn-id: r54003
2010-11-01 16:00:53 +00:00
Johannes Schickel
08afc68df0 COMMON: Extend workaround in HashMap code for sgi IRIX MIPSpro to also apply for Intel's C++ compiler.
svn-id: r53507
2010-10-15 18:20:21 +00:00
Max Horn
0b48a71c99 Remove PalmOS port
svn-id: r50964
2010-07-17 18:41:38 +00:00
Joost Peters
dd0c1fd6f0 Restrict MIPSpro workaround to non-gcc compilers -- fixes compilation with gcc on irix.
svn-id: r49060
2010-05-17 16:50:10 +00:00
Johannes Schickel
aed02365ec Strip trailing spaces/tabs.
svn-id: r47541
2010-01-25 01:39:44 +00:00
Willem Jan Palenstijn
f9909bfbf5 Remove superfluous checks
svn-id: r44258
2009-09-22 12:39:07 +00:00
Johannes Schickel
4f65994267 Fix regression in 44236, which caused iterators to see dummy node entries as valid entries.
svn-id: r44256
2009-09-22 11:58:59 +00:00
Max Horn
537c886aeb Stop confusing doxygen :)
svn-id: r44237
2009-09-21 21:37:12 +00:00
Max Horn
2bf7969f95 COMMON: Remove Common::HashMap::_dummyNode, instead use HASHMAP_DUMMY_NODE (this saves memory and should still be safe)
svn-id: r44236
2009-09-21 21:36:35 +00:00
Max Horn
ae16d496b9 COMMON: HashMap::getVal now allows specifying a default value.
A new variant of HashMap::getVal with a second 'default value' parameter
has been added. This helps avoid many contains() + getVal() combos
(which incur double lookup penalty), and is much lighter than using
find() (which has to create an iterator).

svn-id: r43983
2009-09-06 12:59:07 +00:00
Joost Peters
edaa4a0422 MIPSpro compilation fixes / workarounds (from a patch by Rainer Canavan)
The hashmap.h change is ugly, but so far the only thing found to work. Suggestions for a better "fix" appreciated!

svn-id: r43380
2009-08-14 17:18:03 +00:00
Max Horn
9b3074d929 If NDEBUG is #defined, then assert does nothing, leading to warnings about 'old_size' not being used -> fix that
svn-id: r42056
2009-07-03 11:05:59 +00:00
Willem Jan Palenstijn
6eed461c94 Fix erase() sometimes hiding other hash elements.
Like CPython, we now use a dummy node to mark nodes as erased,
so that lookup() can skip over it. All tests should now pass again.

svn-id: r41496
2009-06-13 21:07:05 +00:00
Max Horn
9a971c7d80 fixed a typo
svn-id: r40171
2009-04-28 10:23:08 +00:00
Max Lingua
ccf9dedecb Modified HashMap ctr to skip _defaultVal() on PS2 to avoid gcc 3.2.2 ICE
svn-id: r39174
2009-03-07 05:01:56 +00:00
Max Horn
6098cadde3 More paranoia checks
svn-id: r38339
2009-02-16 01:58:20 +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
31ce5eb496 Revised HashMap implementation
svn-id: r34273
2008-09-02 11:34:12 +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
47429f2197 Extended HashMap debug output
svn-id: r34051
2008-08-20 10:18:59 +00:00
Lars Persson
476e5bbb10 List the correct engines in about,
updated actions with Lure (from WinCE). 
Increased min heap size to 5MB

svn-id: r33618
2008-08-04 18:14:17 +00:00
Lars Persson
c296869108 Disable hashmemory pool for Symbian OS
svn-id: r33212
2008-07-22 19:09:10 +00:00
Willem Jan Palenstijn
90bf3de2d6 Decrement _nele when erasing an element from hashmap, and add a test-case for this bug.
svn-id: r32343
2008-05-28 18:32:05 +00:00