From 1ddea9dd3848c640c0c63ba87056f6a850a7323d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 23 Mar 2016 17:11:04 +0100 Subject: [PATCH] AFB_error: improves mangement MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I88969338623aad0cb628f97f9e9962315ae9380c Signed-off-by: José Bollo --- include/local-def.h | 2 +- src/helper-api.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/local-def.h b/include/local-def.h index 48437d91..280ab0bb 100644 --- a/include/local-def.h +++ b/include/local-def.h @@ -78,7 +78,7 @@ extern int verbose; // this is the only global variable // Plugin Type typedef enum {AFB_PLUGIN_JSON=123456789, AFB_PLUGIN_JSCRIPT=987654321, AFB_PLUGIN_RAW=987123546} AFB_pluginE; -// prebuild json error are constructed in config.c +// prebuild json error are constructed in helper-api.c typedef enum { AFB_FALSE, AFB_TRUE, AFB_FATAL, AFB_FAIL, AFB_WARNING, AFB_EMPTY, AFB_SUCCESS, AFB_DONE, AFB_UNAUTH} AFB_error; #define MAX_POST_SIZE 4096 // maximum size for POST data diff --git a/src/helper-api.c b/src/helper-api.c index bf94c898..912093bb 100644 --- a/src/helper-api.c +++ b/src/helper-api.c @@ -38,12 +38,12 @@ typedef struct { json_object *json; } AFB_errorT; -static AFB_errorT AFBerr [AFB_SUCCESS+1]; +static AFB_errorT AFBerr [AFB_UNAUTH+1]; static json_object *jTypeStatic; PUBLIC int verbose; -static const char *ERROR_LABEL[] = {"false", "true", "fatal", "fail", "warning", "empty", "success"}; +static const char *ERROR_LABEL[] = {"false", "true", "fatal", "fail", "warning", "empty", "success", "done", "unauth"}; @@ -225,7 +225,7 @@ static void jsoninit() verbosesav = verbose; verbose = 0; // run initialisation in silent mode jTypeStatic = json_object_new_string ("AFB_message"); - for (idx = 0; idx <= AFB_SUCCESS; idx++) { + for (idx = 0; idx <= AFB_UNAUTH; idx++) { AFBerr[idx].level = idx; AFBerr[idx].label = ERROR_LABEL [idx]; AFBerr[idx].json = jsonNewMessage (idx, NULL); -- 2.16.6