[Scummvm-git-logs] scummvm master -> 1c37569ce23ec053a683c8ab99ff40bbcaf5086d

digitall dgturner at iee.org
Wed May 8 00:19:23 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1c37569ce2 QUEEN: Fix GCC Compiler Warnings


Commit: 1c37569ce23ec053a683c8ab99ff40bbcaf5086d
    https://github.com/scummvm/scummvm/commit/1c37569ce23ec053a683c8ab99ff40bbcaf5086d
Author: D G Turner (digitall at scummvm.org)
Date: 2019-05-07T23:16:50+01:00

Commit Message:
QUEEN: Fix GCC Compiler Warnings

These are further warnings of the use of memset to clear a non-trivial
structure / class. Since it is trivial to add a default constructor to
these to initialise them instead, the memset calls can be removed.

Changed paths:
    engines/queen/grid.cpp
    engines/queen/structs.h


diff --git a/engines/queen/grid.cpp b/engines/queen/grid.cpp
index 467f341..01a3716 100644
--- a/engines/queen/grid.cpp
+++ b/engines/queen/grid.cpp
@@ -54,11 +54,11 @@ void Grid::readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr) {
 
 	_objMax[0] = 0;
 	_areaMax[0] = 0;
-	memset(&_area[0], 0, sizeof(Area) * MAX_AREAS_NUMBER);
+	// _area[0][] cleared by default constructor
 	for (i = 1; i <= _numRoomAreas; i++) {
 		_objMax[i] = (int16)READ_BE_INT16(ptr); ptr += 2;
 		_areaMax[i] = (int16)READ_BE_INT16(ptr); ptr += 2;
-		memset(&_area[i][0], 0, sizeof(Area));
+		// _area[i][0] cleared by default constructor
 		for (j = 1; j <= _areaMax[i]; j++) {
 			assert(j < MAX_AREAS_NUMBER);
 			_area[i][j].readFromBE(ptr);
@@ -66,7 +66,7 @@ void Grid::readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr) {
 	}
 
 	_objectBox = new Box[numObjects + 1];
-	memset(&_objectBox[0], 0, sizeof(Box));
+	// _objectBox[0] cleared by default constructor
 	for (i = 1; i <= numObjects; i++) {
 		_objectBox[i].readFromBE(ptr);
 	}
diff --git a/engines/queen/structs.h b/engines/queen/structs.h
index 4f413d8..4af75f3 100644
--- a/engines/queen/structs.h
+++ b/engines/queen/structs.h
@@ -85,6 +85,10 @@ struct Area {
 	//! entry in ObjectData, object lying in this area
 	uint16 object;
 
+	Area()
+		: mapNeighbors(0), bottomScaleFactor(0), topScaleFactor(0), object(0) {
+	}
+
 	void readFromBE(byte *&ptr) {
 		mapNeighbors = (int16)READ_BE_UINT16(ptr); ptr += 2;
 		box.readFromBE(ptr);





More information about the Scummvm-git-logs mailing list