aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-05-22 10:51:52 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:38:23 +0200
commit75ae498dd19d5a10945421d69ae86c0a16f109c8 (patch)
treee625c6e455a825e2b20c0a564de1c8f1c602b6eb
parent598fe2f3ce3bc091208fe29402c2ac2613558b19 (diff)
Fixed compilation warnings with gcc-7.2.0
Replaced some 'size_t' by 'int' Change-Id: Iaf58b4b65f9aa2e82c0a87af45f21ca62fa4d84e Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
-rw-r--r--ctl-lib/ctl-action.c2
-rw-r--r--ctl-lib/ctl-config.c8
-rw-r--r--ctl-lib/ctl-lua.c4
-rw-r--r--ctl-lib/ctl-plugin.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index c8df2c7..089fcf4 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -335,7 +335,7 @@ CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int exportAp
// action array is close with a nullvalue;
if (json_object_is_type(actionsJ, json_type_array)) {
- size_t count = json_object_array_length(actionsJ);
+ int count = json_object_array_length(actionsJ);
actions = calloc(count + 1, sizeof (CtlActionT));
for (int idx = 0; idx < count; idx++) {
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index d508b78..334b586 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -65,7 +65,7 @@ json_object* CtlConfigScan(const char *dirList, const char *prefix) {
char* ConfigSearch(AFB_ApiT apiHandle, json_object *responseJ) {
// We load 1st file others are just warnings
size_t p_length;
- char *filepath;
+ char *filepath = NULL;
const char *filename;
const char*fullpath;
@@ -185,7 +185,7 @@ json_object* LoadAdditionalsFiles(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, con
json_object* CtlUpdateSectionConfig(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, const char *key, json_object *sectionJ, json_object *filesJ) {
json_object *sectionArrayJ;
- char *oneFile;
+ char *oneFile = NULL;
const char *bindingPath = GetBindingDirPath(apiHandle);
if(! json_object_is_type(sectionJ, json_type_array)) {
@@ -200,7 +200,7 @@ json_object* CtlUpdateSectionConfig(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, c
json_object_object_add(ctlHandle->configJ, key, sectionArrayJ);
if (json_object_get_type(filesJ) == json_type_array) {
- size_t length = json_object_array_length(filesJ);
+ int length = json_object_array_length(filesJ);
for (int idx=0; idx < length; idx++) {
json_object *oneFileJ = json_object_array_get_idx(filesJ, idx);
json_object *responseJ = ScanForConfig(CONTROL_CONFIG_PATH ,CTL_SCAN_RECURSIVE, json_object_get_string(oneFileJ), ".json");
@@ -243,7 +243,7 @@ json_object* LoadAdditionalsFiles(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, con
{
json_object *filesJ, *filesArrayJ = json_object_new_array();
if (json_object_get_type(sectionJ) == json_type_array) {
- size_t length = json_object_array_length(sectionJ);
+ int length = json_object_array_length(sectionJ);
for (int idx=0; idx < length; idx++) {
json_object *obj = json_object_array_get_idx(sectionJ, idx);
int hasFiles = json_object_object_get_ex(obj, "files", &filesJ);
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 15e1fd8..7008cc4 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -114,7 +114,7 @@ static int LuaPushArgument(CtlSourceT *source, json_object *argsJ) {
}
case json_type_array:
{
- size_t length = json_object_array_length(argsJ);
+ int length = json_object_array_length(argsJ);
lua_newtable(luaState);
for (int idx = 0; idx < length; idx++) {
json_object *val = json_object_array_get_idx(argsJ, idx);
@@ -861,7 +861,7 @@ static int LuaDoString(const char *script, CtlSourceT *source) {
// Execute LUA code from received API request
static void LuaDoAction(LuaDoActionT action, AFB_ReqT request) {
- int err, count = 0;
+ int err = 0, count = 0;
CtlSourceT *source = alloca(sizeof (CtlSourceT));
source->request = request;
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index d20950f..505daf1 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -194,7 +194,7 @@ static int LoadFoundPlugins(AFB_ApiT apiHandle, json_object *scanResult, json_ob
char *fullpath;
char *ext;
int i;
- size_t len;
+ int len;
json_object *object = NULL;
pluginpath[CONTROL_MAXPATH_LEN - 1] = '\0';
@@ -365,7 +365,7 @@ static int PluginLoad (AFB_ApiT apiHandle, CtlPluginT *ctlPlugin, json_object *p
int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ) {
int err = 0;
int idx = 0;
- size_t length = 0;
+ int length = 0;
if (ctlPlugins)
{