[Scummvm-cvs-logs] SF.net SVN: scummvm:[51144] scummvm/trunk/engines/sci/graphics/frameout.cpp

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Thu Jul 22 16:33:16 CEST 2010


Revision: 51144
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51144&view=rev
Author:   mthreepwood
Date:     2010-07-22 14:33:14 +0000 (Thu, 22 Jul 2010)

Log Message:
-----------
Use new[]/delete[] instead of malloc/free

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/frameout.cpp

Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-07-22 14:29:00 UTC (rev 51143)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-07-22 14:33:14 UTC (rev 51144)
@@ -126,7 +126,7 @@
 	_palette->palVaryUpdate();
 
 	// Allocate enough space for all screen items
-	FrameoutEntry *itemData = (FrameoutEntry *)malloc(_screenItems.size() * sizeof(FrameoutEntry));
+	FrameoutEntry *itemData = new FrameoutEntry[_screenItems.size()];
 
 	for (Common::List<reg_t>::iterator it = _planes.begin(); it != _planes.end(); it++) {
 		reg_t planeObject = *it;
@@ -218,7 +218,7 @@
 			// Show base picture
 //			planePicture->drawSci32Vga(0, planePicture->getSci32celX(0), planePicture->getSci32celY(0), planePictureMirrored);
 			// Allocate memory for picture cels
-			pictureCels = (FrameoutEntry *)malloc(planePicture->getSci32celCount() * sizeof(FrameoutEntry));
+			pictureCels = new FrameoutEntry[planePicture->getSci32celCount()];
 			// Add following cels to the itemlist
 			FrameoutEntry *picEntry = pictureCels;
 			for (int pictureCelNr = 0; pictureCelNr < planePictureCels; pictureCelNr++) {
@@ -323,13 +323,13 @@
 		}
 
 		if (planePicture) {
-			free(pictureCels);
+			delete[] pictureCels;
 			delete planePicture;
 			planePicture = 0;
 		}
 	}
 
-	free(itemData);
+	delete[] itemData;
 	_screen->copyToScreen();
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list