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

digitall noreply at scummvm.org
Sat Jun 4 15:00:03 UTC 2022


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

Summary:
fc01321ace GLK: Remove Zero Sized Allocation from Quetzal Code
cd627adf89 WINTERMUTE: Remove Zero Sized Buffer Allocation


Commit: fc01321ace023a18e78ccce3123a0a8444a213bb
    https://github.com/scummvm/scummvm/commit/fc01321ace023a18e78ccce3123a0a8444a213bb
Author: D G Turner (digitall at scummvm.org)
Date: 2022-06-04T15:59:59+01:00

Commit Message:
GLK: Remove Zero Sized Allocation from Quetzal Code

The behaviour of malloc and similar functions when called with a zero
sized parameter is implementation dependent resulting in subtle portability
bugs and should be avoided.

This will generate warnings in GCC if -Walloc-zero is passed.

Changed paths:
    engines/glk/quetzal.h


diff --git a/engines/glk/quetzal.h b/engines/glk/quetzal.h
index 25ce6faf568..60f049121b6 100644
--- a/engines/glk/quetzal.h
+++ b/engines/glk/quetzal.h
@@ -108,7 +108,7 @@ public:
 		Common::SeekableReadStream *getStream() {
 			_stream->seek(_chunks[_index]._offset);
 			return (_chunks[_index]._size == 0) ?
-				new Common::MemoryReadStream((byte *)malloc(0), 0, DisposeAfterUse::YES) :
+				new Common::MemoryReadStream(nullptr, 0, DisposeAfterUse::YES) :
 				_stream->readStream(_chunks[_index]._size);
 		}
 	};


Commit: cd627adf89c504f7e3c95e085f7bcc3d4f91c8f4
    https://github.com/scummvm/scummvm/commit/cd627adf89c504f7e3c95e085f7bcc3d4f91c8f4
Author: D G Turner (digitall at scummvm.org)
Date: 2022-06-04T15:59:59+01:00

Commit Message:
WINTERMUTE: Remove Zero Sized Buffer Allocation

The behaviour of malloc and similar functions when called with a zero
sized parameter is implementation dependent resulting in subtle portability
bugs and should be avoided.

This will generate warnings in GCC if -Walloc-zero is passed.

Changed paths:
    engines/wintermute/base/gfx/x/modelx.cpp


diff --git a/engines/wintermute/base/gfx/x/modelx.cpp b/engines/wintermute/base/gfx/x/modelx.cpp
index 6744ed954a4..3f346467762 100644
--- a/engines/wintermute/base/gfx/x/modelx.cpp
+++ b/engines/wintermute/base/gfx/x/modelx.cpp
@@ -121,7 +121,7 @@ static byte *DecompressMsZipData(byte *buffer, uint32 inputSize, uint32 &decompr
 #endif
 	warning("DecompressMsZipData: Error decompressing data!");
 	decompressedSize = 0;
-	return new byte[0];
+	return nullptr;
 }
 
 static XFileLexer createXFileLexer(byte *&buffer, uint32 fileSize) {




More information about the Scummvm-git-logs mailing list