aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-12-08 07:30:22 +0000
committerTorbjörn Andersson2003-12-08 07:30:22 +0000
commit5c539040e426e915a6834d72f8521376a2e965ac (patch)
treeb1bc2b943fe6531109c3f378ece59a67a04364c4 /sword2
parent2047e6c01c67cc6f82f0da9b8945f6c7a2685bdc (diff)
downloadscummvm-rg350-5c539040e426e915a6834d72f8521376a2e965ac.tar.gz
scummvm-rg350-5c539040e426e915a6834d72f8521376a2e965ac.tar.bz2
scummvm-rg350-5c539040e426e915a6834d72f8521376a2e965ac.zip
Shut up Valgrind warnings.
svn-id: r11528
Diffstat (limited to 'sword2')
-rw-r--r--sword2/driver/render.cpp11
-rw-r--r--sword2/resman.cpp2
2 files changed, 6 insertions, 7 deletions
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp
index 8beceddc51..3ef3151744 100644
--- a/sword2/driver/render.cpp
+++ b/sword2/driver/render.cpp
@@ -708,15 +708,10 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) {
// Decode the parallax layer into a large chunk of memory
- memchunk = (uint8 *) malloc(_xBlocks[_layer] * BLOCKWIDTH * _yBlocks[_layer] * BLOCKHEIGHT);
+ memchunk = (uint8 *) calloc(_xBlocks[_layer] * _yBlocks[_layer], BLOCKWIDTH * BLOCKHEIGHT);
if (!memchunk)
return RDERR_OUTOFMEMORY;
- // We clear not the entire memory chunk, but enough of it to store
- // the entire parallax layer.
-
- memset(memchunk, 0, p->w * p->h);
-
for (i = 0; i < p->h; i++) {
if (p->offset[i] == 0)
continue;
@@ -763,6 +758,10 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) {
data = memchunk + (p->w * BLOCKHEIGHT * (i / _xBlocks[_layer])) + BLOCKWIDTH * (i % _xBlocks[_layer]);
+ // FIXME: The 'block_is_transparent' flag should only consider
+ // data that is inside the parallax layer. Still, it won't do
+ // any harm to leave it this way...
+
for (j = 0; j < BLOCKHEIGHT; j++) {
for (k = 0; k < BLOCKWIDTH; k++) {
if (data[j * p->w + k])
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 49098b7021..ef5f852be6 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -165,7 +165,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) {
_cdTab[j] = cdInf[i].cd;
}
- delete cdInf;
+ delete [] cdInf;
debug(5, "%d resources in %d cluster files", _totalResFiles, _totalClusters);
for (j = 0; j < _totalClusters; j++)