[Scummvm-git-logs] scummvm master -> a01e561f3443db990341f27b54e94423f134f614

Strangerke noreply at scummvm.org
Tue Jan 27 21:50:40 UTC 2026


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

Summary:
a01e561f34 M4: Fix CID 1533000 and 1532992


Commit: a01e561f3443db990341f27b54e94423f134f614
    https://github.com/scummvm/scummvm/commit/a01e561f3443db990341f27b54e94423f134f614
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-01-27T22:50:26+01:00

Commit Message:
M4: Fix CID 1533000 and 1532992

Changed paths:
    engines/m4/graphics/gr_buff.h
    engines/m4/graphics/gr_sprite.cpp


diff --git a/engines/m4/graphics/gr_buff.h b/engines/m4/graphics/gr_buff.h
index f159ebb2ba2..9deceadd5ac 100644
--- a/engines/m4/graphics/gr_buff.h
+++ b/engines/m4/graphics/gr_buff.h
@@ -31,8 +31,8 @@ class GrBuff {
 protected:
 	void alloc_pixmap();
 
-	Buffer dummy;
-	MemHandle pixmap;
+	Buffer dummy{};
+	MemHandle pixmap = nullptr;
 public:
 	int32 w, h, x_off, y_off, pitch, height;
 
@@ -51,7 +51,6 @@ public:
 	Buffer *get_buffer();
 
 	uint8 *get_pixmap();
-	void clear();
 
 	void lock();
 	void release();
diff --git a/engines/m4/graphics/gr_sprite.cpp b/engines/m4/graphics/gr_sprite.cpp
index c39664bf597..be65e32c55f 100644
--- a/engines/m4/graphics/gr_sprite.cpp
+++ b/engines/m4/graphics/gr_sprite.cpp
@@ -35,14 +35,14 @@ namespace M4 {
  * S and D are Raw encoded (unencoded!) buffers.
  */
 static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
-	uint8 *pScaled, *pData = S->data;
-
 	if (!D)
 		error_show(FL, 'BUF!', "scale sprite NULL D");
 
 	if (!S)
 		error_show(FL, 'BUF!', "scale sprite h:%d w:%d sx:%uld sy:%uld", D->h, D->w, ScaleX, ScaleY);
 
+	uint8 *pData = S->data;
+
 	/* calculate new x size */
 	D->w = S->w * ScaleX / 100;
 	if (S->w * ScaleX % 100 >= 50)
@@ -56,9 +56,11 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
 	D->stride = D->w;
 
 	/* allocate 'scaled' buffer */
-	if (!(D->data = pScaled = (uint8 *)mem_alloc(D->h * D->stride, "scaled buffer")))
+	uint8 *pScaled = (uint8 *)mem_alloc(D->h * D->stride, "scaled buffer");
+	if (!pScaled)
 		error_show(FL, 'OOM!', "scaled buffer h:%uld w:%uld", D->h, D->stride);
-
+	D->data = pScaled;
+	
 	uint16 ErrY = 50;
 	for (uint16 i = 0; i < S->h; ++i) {
 		ErrY += ScaleY;
@@ -193,7 +195,7 @@ static uint16 EncodeScan(uint8 *pi, uint8 *po, uint16 scanlen, uint8 EndByte) {
 
 	while (scanlen) {
 		uint16 limit = (scanlen < 255) ? scanlen : 255;
-		//imath_min(scanlen, 255);
+
 		for (run = 1; run < limit && *pi == *ps; ++run, ++ps) {}
 
 		if (run > 1) {
@@ -241,8 +243,9 @@ uint32 gr_sprite_RLE8_encode(Buffer *Source, Buffer *Dest) {
 	Dest->h = Source->h;
 	Dest->encoding = RLE8;
 	Dest->stride = Source->stride;
-
-	if (!(Dest->data = (uint8 *)mem_alloc(Source->h * OutBuffSize(Source->stride), "sprite data"))) {
+	Dest->data = (uint8 *)mem_alloc(Source->h * OutBuffSize(Source->stride), "sprite data");
+	
+	if (!Dest->data) {
 		return 0;
 	}
 




More information about the Scummvm-git-logs mailing list