From 3a574199b0b3e848d786d71a50a1107536507479 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 18 Apr 2011 18:19:53 +0200 Subject: COMMON: Cleanup names/handling of some error codes --- base/commandLine.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index f920dd0170..7c482d3057 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -641,29 +641,30 @@ static Common::Error listSaves(const char *target) { GameDescriptor game = EngineMan.findGame(gameid, &plugin); if (!plugin) { - warning("Could not find any plugin to handle target '%s' (gameid '%s')", target, gameid.c_str()); - return Common::kPluginNotFound; + return Common::Error(Common::kEnginePluginNotFound, + Common::String::format("target '%s', gameid '%s", target, gameid.c_str())); } if (!(*plugin)->hasFeature(MetaEngine::kSupportsListSaves)) { // TODO: Include more info about the target (desc, engine name, ...) ??? - printf("ScummVM does not support listing save states for target '%s' (gameid '%s') .\n", target, gameid.c_str()); - result = Common::kPluginNotSupportSaves; + return Common::Error(Common::kEnginePluginNotSupportSaves, + Common::String::format("target '%s', gameid '%s", target, gameid.c_str())); } else { // Query the plugin for a list of savegames SaveStateList saveList = (*plugin)->listSaves(target); - // TODO: Include more info about the target (desc, engine name, ...) ??? - printf("Saves for target '%s' (gameid '%s'):\n", target, gameid.c_str()); - printf(" Slot Description \n" - " ---- ------------------------------------------------------\n"); - - if (saveList.size() == 0) - result = Common::kNoSavesError; + if (saveList.size() > 0) { + // TODO: Include more info about the target (desc, engine name, ...) ??? + printf("Save states for target '%s' (gameid '%s'):\n", target, gameid.c_str()); + printf(" Slot Description \n" + " ---- ------------------------------------------------------\n"); - for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) { - printf(" %-4s %s\n", x->save_slot().c_str(), x->description().c_str()); - // TODO: Could also iterate over the full hashmap, printing all key-value pairs + for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) { + printf(" %-4s %s\n", x->save_slot().c_str(), x->description().c_str()); + // TODO: Could also iterate over the full hashmap, printing all key-value pairs + } + } else { + printf("There are no save states for target '%s' (gameid '%s'):\n", target, gameid.c_str()); } } -- cgit v1.2.3 From aee0fa34bf5ea2ce474a2ae67f7722df4929d4a5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 25 Apr 2011 15:26:23 +0200 Subject: BASE: Remove unused variable in DO_OPTION_INT. --- base/commandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 7c482d3057..bb2141b110 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -262,7 +262,7 @@ void registerDefaults() { #define DO_OPTION_INT(shortCmd, longCmd) \ DO_OPTION(shortCmd, longCmd) \ char *endptr = 0; \ - int intValue; intValue = (int)strtol(option, &endptr, 0); \ + strtol(option, &endptr, 0); \ if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option); // Use this for boolean options; this distinguishes between "-x" and "-X", -- cgit v1.2.3 From 9414d7a6e287ff8abfb5746b564e92c8f0e6de58 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Sun, 24 Apr 2011 11:34:27 +0300 Subject: JANITORIAL: Reduce header dependencies in shared code Some backends may break as I only compiled SDL --- base/commandLine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index bb2141b110..b74370df4c 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -30,6 +30,7 @@ #include "common/config-manager.h" #include "common/system.h" +#include "common/textconsole.h" #include "common/fs.h" #include "gui/ThemeEngine.h" -- cgit v1.2.3 From 59e77ed66779d33a14a5f4d2a5885a70b793f36f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 2 May 2011 14:42:08 +0200 Subject: ALL: Mark printf and various other symbols as forbidden Right now, a few places in the frontend code still use printf and consorts. We mark the affected files with a FIXME for now, and add a dedicated exception for each. To be fixed! Also tweak FORBIDDEN_SYMBOL_REPLACEMENT to hopefully really always enforce a compiler error --- base/commandLine.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index b74370df4c..05e1d2c131 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -23,6 +23,9 @@ * */ +// FIXME: Avoid using printf +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "engines/metaengine.h" #include "base/commandLine.h" #include "base/plugins.h" -- cgit v1.2.3