[Scummvm-git-logs] scummvm master -> 04d522121bfd3d42426ac8766fa0814286a02d8b

digitall dgturner at iee.org
Sat Sep 14 02:26:36 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:
04d522121b HDB: Remove Fixed Sized String Buffers in Menu Code


Commit: 04d522121bfd3d42426ac8766fa0814286a02d8b
    https://github.com/scummvm/scummvm/commit/04d522121bfd3d42426ac8766fa0814286a02d8b
Author: D G Turner (digitall at scummvm.org)
Date: 2019-09-14T01:22:25+01:00

Commit Message:
HDB: Remove Fixed Sized String Buffers in Menu Code

These are replaced by Common::String usage.

Changed paths:
    engines/hdb/menu.cpp


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 6c89c93..77d43a7 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -841,9 +841,8 @@ void Menu::drawMenu() {
 					g_hdb->_gfx->drawText(_saveGames[i].mapName);
 
 					g_hdb->_gfx->setCursor(_saveSlotX + 180, i * 32 + _saveSlotY);
-					char buff[16];
-					sprintf(buff, "%02d:%02d", seconds / 3600, (seconds / 60) % 60);
-					g_hdb->_gfx->drawText(buff);
+					Common::String buff = Common::String::format("%02d:%02d", seconds / 3600, (seconds / 60) % 60);
+					g_hdb->_gfx->drawText(buff.c_str());
 				}
 			}
 		}
@@ -1605,11 +1604,11 @@ void Menu::processInput(int x, int y) {
 				g_hdb->_gfx->updateVideo();
 			_warpActive = 0;
 
-			char string[16];
-			sprintf(string, "MAP%02d", map);
+			Common::String mapString = Common::String::format("MAP%02d", map);
 
-			if (g_hdb->isDemo())
-				strcat(string, "_DEMO");
+			if (g_hdb->isDemo()) {
+				mapString += "_DEMO";
+			}
 
 			freeMenu();
 			g_hdb->setGameState(GAME_PLAY);
@@ -1617,7 +1616,7 @@ void Menu::processInput(int x, int y) {
 			g_hdb->_ai->clearPersistent();
 			g_hdb->resetTimer();
 			g_hdb->_sound->playSound(SND_POP);
-			g_hdb->startMap(string);
+			g_hdb->startMap(mapString.c_str());
 		}
 	} else if (_quitActive) {
 		//-------------------------------------------------------------------





More information about the Scummvm-git-logs mailing list