1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-13 06:29:41 +01:00
Commit graph

18 commits

Author SHA1 Message Date
Misa
e481c75404 Use SDL stdlib funcs for free/malloc/strcmp
It's always good to have less of a dependency on a libc.
2020-08-14 09:51:19 -04:00
Misa
cf8442b12c Add bounds checks to getSize() and getAddress()
It's all too easy for someone to pass in a bad index and index out of
bounds, so we need to prevent that from happening.
2020-08-14 09:51:19 -04:00
Misa
6991b2045d Set valid to false if size is bogus
This is to prevent callers from parsing bogus sizes. If they listen to
the -1 sentinel value, at least...
2020-08-14 09:51:19 -04:00
Misa
7903b8967e Check valid in binaryBlob::getIndex()
The binary blob shouldn't return an index if it ends up being invalid.
That could cause a whole lot of issues if musicclass ends up parsing the
resulting struct.

With all that said, though, musicclass doesn't check the -1 sentinel
value anyway, even though it should, but that'll be fixed later.
2020-08-14 09:51:19 -04:00
Misa
52f7a587fe Separate includes into sections and alphabetize them
Okay, so basically here's the include layout that this game now
consistently uses:

[The "main" header file, if any (e.g. Graphics.h for Graphics.cpp)]
[blank line]
[All system includes, such as tinyxml2/physfs/utfcpp/SDL]
[blank line]
[All project includes, such as Game.h/Entity.h/etc.]

And if applicable, another blank line, and then some special-case
include screwy stuff (take a look at editor.cpp or FileSystemUtils.cpp,
for example, they have ifdefs and defines with their includes).
2020-07-19 21:37:40 -04:00
Misa
7703b2c1c2 Ensure that all member attributes are initialized
I ran the game through cppcheck and it spat out a bunch of member
attributes that weren't being initialized. So I initialized them.

In the previous version of this commit, I added constructors to
GraphicsResources, otherlevelclass, labclass, warpclass, and finalclass,
but flibit says this changes the code flow enough that it's risky to
merge before 2.4, so I got rid of those constructors, too.
2020-07-08 19:14:21 -04:00
Misa
36e38027d8 Simplify m_headers init, hardcode 128 less
I don't know how no one realized that the for-loop to (poorly)
initialize m_headers was basically unnecessary, and that the memset()
should've just been used instead. Well, except it should also be
replaced with SDL_memset(), but that's besides the point.

Also, I decided to hardcode the 128 thing less, in case people want to
fork the source code and make a build where it's changed.
2020-07-06 11:19:24 -04:00
Misa
97bf731fa3 If invalid valid value, set valid to false
This is just to prevent parsing potentially garbage data, because some
of the code relies on the `valid` value being valid.
2020-06-30 21:07:05 -04:00
Misa
4c2f5ed032 Add binaryBlob::getExtra()
This needs to be done because m_headers is a private member of
binaryBlob.
2020-06-30 21:07:05 -04:00
Ethan Lee
3323b7e3cf Maybe check the right size m8 2020-06-14 22:44:34 -04:00
Ethan Lee
bd71fb8a68 Disallow negative size values in BinaryBlob 2020-06-14 22:43:58 -04:00
Ethan Lee
4894639b3a valid needs to have either exactly 1 or 0 2020-06-14 22:40:57 -04:00
Ethan Lee
06a71bab18 Some sanity checks for BinaryBlob header data 2020-06-14 22:39:06 -04:00
leo60228
f3b26904ec Don't leak binaryBlob 2020-06-07 22:40:03 -04:00
Rémi Verschelde
a83e83ca1b Fix warnings raised by GCC 8 2020-01-11 08:53:32 -05:00
viri
5829007bed fix uninitialized member vars everywhere
also fix a spelling error of 'forground' in the graphics class buffer
2020-01-10 21:06:59 -05:00
Marvin Scholz
06c6de9433 Use PHYSFS_readBytes instead of deprecated PHYSFS_read 2020-01-10 18:41:22 -05:00
Ethan Lee
f7c0321b71 Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00