Revision: 76822
http://sourceforge.net/p/brlcad/code/76822
Author: starseeker
Date: 2020-08-18 10:57:01 +0000 (Tue, 18 Aug 2020)
Log Message:
-----------
Rather than fatally aborting when we find a command mismatch on a named ged
function call, warn and override with the "root" function name. This should
work in every case the command would originally have worked - the only failure
would be if there is a command that the plugin is supposed to be providing that
didn't get set up, which would be a legitimate bug on libged's end.
Modified Paths:
--------------
brlcad/trunk/src/libged/exec_mapping.cpp
brlcad/trunk/src/libged/tests/plugins.cpp
Modified: brlcad/trunk/src/libged/exec_mapping.cpp
===================================================================
--- brlcad/trunk/src/libged/exec_mapping.cpp 2020-08-18 02:28:28 UTC (rev
76821)
+++ brlcad/trunk/src/libged/exec_mapping.cpp 2020-08-18 10:57:01 UTC (rev
76822)
@@ -36,12 +36,15 @@
int GED_CMD_HELPER1(ged_,x)(struct ged *gedp, int argc, const char
*argv[]) \
{ \
const char *fname = #x ; \
- int ret = ged_cmd_valid(argv[0], fname); \
- if (ret) { \
- bu_log("Error(%d): LIBGED command \"ged_" #x "\" called with an
unexpected argv[0] value: %s\n", ret, argv[0]); \
- return GED_UNKNOWN; \
+ int vret = ged_cmd_valid(argv[0], fname); \
+ if (vret) { \
+ bu_log("Warning(%d): LIBGED command \"ged_" #x "\" called with
argv[0] value \"%s\" which is not a known version of this command - overriding
argv[0] with \"%s\"\n", vret, argv[0], fname); \
+ argv[0] = fname; \
}\
- ret = ged_exec(gedp, argc, argv); \
+ int ret = ged_exec(gedp, argc, argv); \
+ if (vret) { \
+ ret |= GED_UNKNOWN; \
+ } \
return ret; \
} \
Modified: brlcad/trunk/src/libged/tests/plugins.cpp
===================================================================
--- brlcad/trunk/src/libged/tests/plugins.cpp 2020-08-18 02:28:28 UTC (rev
76821)
+++ brlcad/trunk/src/libged/tests/plugins.cpp 2020-08-18 10:57:01 UTC (rev
76822)
@@ -370,9 +370,9 @@
const char *wav0 = "wrong_name";
int ret = ged_ls(gbp, 1, &wav0);
if (ret & GED_UNKNOWN) {
- bu_log("\nged_ls called with command name \"%s\" reported expected
error\n", wav0);
+ bu_log("\nged_ls called with command name \"%s\" correctly returned
with GED_UNKNOWN set\n", wav0);
} else {
- bu_log("\nged_ls called with command name \"%s\" did not report the
expected error\n", wav0);
+ bu_log("\nged_ls called with command name \"%s\" did not return
with GED_UNKNOWN set\n", wav0);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits