[Scummvm-cvs-logs] scummvm master -> f1fa8ea1ca2f083cec3391caef0f38826e5bbd6c

sev- sev at scummvm.org
Mon Mar 28 18:47:38 CEST 2016


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:
f1fa8ea1ca COMMON: Use better reallocation strategy in MemoryWriteStreamDynamic.


Commit: f1fa8ea1ca2f083cec3391caef0f38826e5bbd6c
    https://github.com/scummvm/scummvm/commit/f1fa8ea1ca2f083cec3391caef0f38826e5bbd6c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-28T18:45:34+02:00

Commit Message:
COMMON: Use better reallocation strategy in MemoryWriteStreamDynamic.

Fixes bug #6983: "SWORD25: long saving time"

Changed paths:
    common/memstream.h



diff --git a/common/memstream.h b/common/memstream.h
index 5ecc553..a01973c 100644
--- a/common/memstream.h
+++ b/common/memstream.h
@@ -25,6 +25,7 @@
 
 #include "common/stream.h"
 #include "common/types.h"
+#include "common/util.h"
 
 namespace Common {
 
@@ -170,7 +171,7 @@ private:
 
 		byte *old_data = _data;
 
-		_capacity = new_len + 32;
+		_capacity = MAX(new_len + 32, _capacity * 2);
 		_data = (byte *)malloc(_capacity);
 		_ptr = _data + _pos;
 






More information about the Scummvm-git-logs mailing list