Skip to content

Commit

Permalink
ALL: Reduce assignment of "" to Common::String.
Browse files Browse the repository at this point in the history
When clearing an existant object clear() should be used.

When constructing objects (or using default values for parameters) the
constructor of String without any argument should be used.

This changes only a few instances I noticed while looking over some recent
commit logs.
  • Loading branch information
Johannes Schickel committed Oct 23, 2011
1 parent a41d72a commit 3a19647
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion audio/mididrv.cpp
Expand Up @@ -74,7 +74,7 @@ static const struct {
};

Common::String MidiDriver::musicType2GUIO(uint32 musicType) {
Common::String res = "";
Common::String res;

for (int i = 0; GUIOMapping[i].guio; i++) {
if (musicType == GUIOMapping[i].type || musicType == (uint32)-1)
Expand Down
2 changes: 1 addition & 1 deletion common/util.cpp
Expand Up @@ -381,7 +381,7 @@ String parseGameGUIOptions(const String &str) {
}

const String getGameGUIOptionsDescription(const String &options) {
String res = "";
String res;

for (int i = 0; g_gameOptions[i].desc; i++)
if (options.contains(g_gameOptions[i].option[0]))
Expand Down
4 changes: 2 additions & 2 deletions engines/game.h
Expand Up @@ -65,12 +65,12 @@ enum GameSupportLevel {
class GameDescriptor : public Common::StringMap {
public:
GameDescriptor();
GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions = "");
GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions = Common::String());
GameDescriptor(const Common::String &gameid,
const Common::String &description,
Common::Language language = Common::UNK_LANG,
Common::Platform platform = Common::kPlatformUnknown,
Common::String guioptions = "",
Common::String guioptions = Common::String(),
GameSupportLevel gsl = kStableGame);

/**
Expand Down
4 changes: 2 additions & 2 deletions gui/options.cpp
Expand Up @@ -141,7 +141,7 @@ void OptionsDialog::init() {
_oldTheme = g_gui.theme()->getThemeId();

// Retrieve game GUI options
_guioptions = "";
_guioptions.clear();
if (ConfMan.hasKey("guioptions", _domain)) {
_guioptionsString = ConfMan.get("guioptions", _domain);
_guioptions = parseGameGUIOptions(_guioptionsString);
Expand All @@ -155,7 +155,7 @@ void OptionsDialog::open() {
setResult(0);

// Retrieve game GUI options
_guioptions = "";
_guioptions.clear();
if (ConfMan.hasKey("guioptions", _domain)) {
_guioptionsString = ConfMan.get("guioptions", _domain);
_guioptions = parseGameGUIOptions(_guioptionsString);
Expand Down
2 changes: 1 addition & 1 deletion gui/saveload.cpp
Expand Up @@ -92,7 +92,7 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con
_thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportThumbnail);
_saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportCreationDate);
_playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportPlayTime);
_resultString = "";
_resultString.clear();
reflowLayout();
updateSaveList();

Expand Down

0 comments on commit 3a19647

Please sign in to comment.