[Scummvm-git-logs] scummvm master -> 72dbd12811aac2929638b13a5f90d07a51977343
digitall
dgturner at iee.org
Thu Jan 12 10:39:44 CET 2017
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:
72dbd12811 GUI: Replace sprintf() with safer String::format() in KeysDialog.
Commit: 72dbd12811aac2929638b13a5f90d07a51977343
https://github.com/scummvm/scummvm/commit/72dbd12811aac2929638b13a5f90d07a51977343
Author: D G Turner (digitall at scummvm.org)
Date: 2017-01-12T09:46:14Z
Commit Message:
GUI: Replace sprintf() with safer String::format() in KeysDialog.
Changed paths:
gui/KeysDialog.cpp
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp
index 7adb20a..fcf9201 100644
--- a/gui/KeysDialog.cpp
+++ b/gui/KeysDialog.cpp
@@ -68,7 +68,7 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
case kListSelectionChangedCmd:
if (_actionsList->getSelected() >= 0) {
- char selection[100];
+ Common::String selection;
uint16 key = Actions::Instance()->getMapping(_actionsList->getSelected());
#ifdef __SYMBIAN32__
@@ -77,9 +77,9 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
key = key - Common::ASCII_F1 + SDLK_F1;
#endif
if (key != 0)
- sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
+ selection = Common::String::format(_("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
else
- sprintf(selection, _("Associated key : none"));
+ selection = Common::String::format(_("Associated key : none"));
_keyMapping->setLabel(selection);
_keyMapping->draw();
@@ -89,7 +89,7 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
if (_actionsList->getSelected() < 0) {
_actionTitle->setLabel(_("Please select an action"));
} else {
- char selection[100];
+ Common::String selection;
_actionSelected = _actionsList->getSelected();
uint16 key = Actions::Instance()->getMapping(_actionSelected);
@@ -99,9 +99,9 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
key = key - Common::ASCII_F1 + SDLK_F1;
#endif
if (key != 0)
- sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
+ selection = Common::String::format(_("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
else
- sprintf(selection, _("Associated key : none"));
+ selection = Common::String::format(_("Associated key : none"));
_actionTitle->setLabel(_("Press the key to associate"));
_keyMapping->setLabel(selection);
@@ -133,14 +133,14 @@ void KeysDialog::handleKeyUp(Common::KeyState state) {
#else
if (state.flags == 0xff && Actions::Instance()->mappingActive()) { // GAPI key was selected
#endif
- char selection[100];
+ Common::String selection;
Actions::Instance()->setMapping((ActionType)_actionSelected, state.ascii);
if (state.ascii != 0)
- sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey) state.keycode));
+ selection = Common::String::format(_("Associated key : %s"), SDL_GetKeyName((SDLKey) state.keycode));
else
- sprintf(selection, _("Associated key : none"));
+ selection = Common::String::format(_("Associated key : none"));
_actionTitle->setLabel(_("Choose an action to map"));
_keyMapping->setLabel(selection);
More information about the Scummvm-git-logs
mailing list