From bbddc1e584dd01b60042f622f8cecfc69361020b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 27 Jul 2016 17:44:27 +0200 Subject: [PATCH] fix unexpected ending spaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Ie7ebccb02b42e91457df3bdbf2a6f037b248400e Signed-off-by: José Bollo --- bindings/audio/audio-pulse.c | 2 +- bindings/intrinsics/afb-dbus-binding.c | 4 ++-- bindings/media/media-rygel.c | 4 ++-- bindings/radio/radio-api.c | 6 +++--- bindings/radio/radio-rtlsdr.c | 8 ++++---- bindings/samples/AuthLogin.c | 36 +++++++++++++++++----------------- bindings/samples/DemoContext.c | 16 +++++++-------- bindings/samples/DemoPost.c | 2 +- bindings/samples/HelloWorld.c | 8 ++++---- include/afb/afb-event-itf.h | 2 +- include/afb/afb-req-itf.h | 2 +- src/afb-api-dbus.c | 2 +- src/afb-api-so.c | 4 ++-- src/afb-common.c | 2 +- src/afb-common.h | 2 +- src/afb-hswitch.c | 2 +- src/afb-hswitch.h | 2 +- src/afb-sig-handler.c | 2 +- src/afb-sig-handler.h | 2 +- src/afb-wsj1.h | 2 +- src/main.c | 30 ++++++++++++++-------------- 21 files changed, 70 insertions(+), 70 deletions(-) diff --git a/bindings/audio/audio-pulse.c b/bindings/audio/audio-pulse.c index 34643603..a6d1e4dc 100644 --- a/bindings/audio/audio-pulse.c +++ b/bindings/audio/audio-pulse.c @@ -298,7 +298,7 @@ void _pulse_enumerate_cards () { asprintf (&alsa_info[i]->synonyms, "%s:%s", alsa_info[i]->synonyms, alsa_name); new_info = 0; break; - } + } } /* it was not ; create it */ if (new_info) { diff --git a/bindings/intrinsics/afb-dbus-binding.c b/bindings/intrinsics/afb-dbus-binding.c index 59fe78d6..dda59453 100644 --- a/bindings/intrinsics/afb-dbus-binding.c +++ b/bindings/intrinsics/afb-dbus-binding.c @@ -52,7 +52,7 @@ static int packlist(struct sd_bus_message *msg, const char *signature, struct js /* * Get the string of 'key' from 'obj' * Returns NULL if 'key' isn't in 'obj' - */ + */ static const char *strval(struct json_object *obj, const char *key) { struct json_object *keyval; @@ -110,7 +110,7 @@ static int lentype(const char *signature, int allows_dict, int allows_not_basic) } if (rc < 0) break; - return 1 + len; + return 1 + len; case SD_BUS_TYPE_DICT_ENTRY_BEGIN: if (!allows_not_basic || !allows_dict) diff --git a/bindings/media/media-rygel.c b/bindings/media/media-rygel.c index 00327795..38a8a442 100644 --- a/bindings/media/media-rygel.c +++ b/bindings/media/media-rygel.c @@ -146,7 +146,7 @@ json_object* _rygel_list (mediaCtxHandleT *ctx) { json_object_object_add (json_i, "title", json_title); json_object_array_add (json_a, json_i); - free (id); free (title); + free (id); free (title); i++; } @@ -549,7 +549,7 @@ static void _rygel_content_cb (GUPnPServiceProxy *content_dir, GUPnPServiceProxy return; if (number_returned == 1) { - found = strstr (result, "id=\""); + found = strstr (result, "id=\""); found += 4; strncpy (subid, found, 32); subid[32] = '\0'; diff --git a/bindings/radio/radio-api.c b/bindings/radio/radio-api.c index 0ed60e1c..7dd22b69 100644 --- a/bindings/radio/radio-api.c +++ b/bindings/radio/radio-api.c @@ -38,7 +38,7 @@ static pluginHandleT *the_radio = NULL; /* detect new radio devices */ void updateRadioDevList(pluginHandleT *handle) { - int idx; + int idx; // loop on existing radio if any for (idx = 0; idx < _radio_dev_count(); idx++) { @@ -305,7 +305,7 @@ static void mute (struct afb_req request) { /* AFB_SESSION_CHECK */ json_object_object_add (jresp, "mute", json_object_new_string ("off")); } - afb_req_success (request, jresp, "Radio - Mute set"); + afb_req_success (request, jresp, "Radio - Mute set"); } static void play (struct afb_req request) { /* AFB_SESSION_CHECK */ @@ -318,7 +318,7 @@ static void play (struct afb_req request) { /* AFB_SESSION_CHECK */ afb_req_fail (request, "failed", "you must call 'init' first"); return; } - + /* no "?value=" parameter : return current state */ if (!value || !ctx->radio) { ctx->is_playing ? diff --git a/bindings/radio/radio-rtlsdr.c b/bindings/radio/radio-rtlsdr.c index 7f76306e..00ceba63 100644 --- a/bindings/radio/radio-rtlsdr.c +++ b/bindings/radio/radio-rtlsdr.c @@ -37,13 +37,13 @@ static struct dev_ctx **dev_ctx = NULL; /* Radio initialization should be done only when user start the radio and not at plugin initialization Making this call too early would impose to restart the binder to detect a radio */ unsigned char _radio_on (unsigned int num, radioCtxHandleT *ctx) { - + if (num >= _radio_dev_count()) return 0; - + if (init_dev_count < _radio_dev_count()) { init_dev_count = _radio_dev_count(); - dev_ctx = (dev_ctx_T**) realloc (dev_ctx, init_dev_count * sizeof(dev_ctx_T*)); + dev_ctx = (dev_ctx_T**) realloc (dev_ctx, init_dev_count * sizeof(dev_ctx_T*)); } dev_ctx[num] = (dev_ctx_T*) malloc (sizeof(dev_ctx_T)); @@ -69,7 +69,7 @@ void _radio_off (unsigned int num) { _radio_dev_free (dev_ctx[num]); free (dev_ctx[num]); } - + /* free(dev_ctx); */ } diff --git a/bindings/samples/AuthLogin.c b/bindings/samples/AuthLogin.c index efecf240..ceb833e9 100644 --- a/bindings/samples/AuthLogin.c +++ b/bindings/samples/AuthLogin.c @@ -23,7 +23,7 @@ // Dummy sample of Client Application Context typedef struct { - int something; + int something; void *whateveryouwant; } MyClientApplicationHandle; @@ -45,33 +45,33 @@ static void clientContextConnect (struct afb_req request) // do something intelligent to check if we should or not update level of assurance from 0(anonymous) to 1(logged) afb_req_session_set_LOA(request, 1); - + // Send response to UI - jresp = json_object_new_object(); + jresp = json_object_new_object(); json_object_object_add(jresp, "token", json_object_new_string ("A New Token and Session Context Was Created")); afb_req_success(request, jresp, NULL); - + } // Before entering here token will be check and renew static void clientContextRefresh (struct afb_req request) { json_object *jresp; - + jresp = json_object_new_object(); - json_object_object_add(jresp, "token", json_object_new_string ("Token was refreshed")); - + json_object_object_add(jresp, "token", json_object_new_string ("Token was refreshed")); + afb_req_success(request, jresp, NULL); } // Session token will we verified before entering here static void clientContextCheck (struct afb_req request) { - - json_object *jresp = json_object_new_object(); - json_object_object_add(jresp, "isvalid", json_object_new_boolean (TRUE)); - + + json_object *jresp = json_object_new_object(); + json_object_object_add(jresp, "isvalid", json_object_new_boolean (TRUE)); + afb_req_success(request, jresp, NULL); } @@ -79,18 +79,18 @@ static void clientContextCheck (struct afb_req request) { // Close and Free context static void clientContextLogout (struct afb_req request) { json_object *jresp; - + /* after this call token will be reset - * - no further access to API will be possible + * - no further access to API will be possible * - every context from any used plugin will be freed */ - + jresp = json_object_new_object(); json_object_object_add(jresp, "info", json_object_new_string ("Token and all resources are released")); - - // WARNING: if you free context resource manually here do not forget to set *request.context=NULL; + + // WARNING: if you free context resource manually here do not forget to set *request.context=NULL; afb_req_success(request, jresp, NULL); - + afb_req_session_set_LOA(request, 0); } // Close and Free context @@ -100,7 +100,7 @@ static void clientGetPing (struct afb_req request) { jresp = json_object_new_object(); json_object_object_add(jresp, "count", json_object_new_int (count ++)); - + afb_req_success(request, jresp, NULL); } diff --git a/bindings/samples/DemoContext.c b/bindings/samples/DemoContext.c index ef703759..243ed687 100644 --- a/bindings/samples/DemoContext.c +++ b/bindings/samples/DemoContext.c @@ -22,10 +22,10 @@ #include typedef struct { - /* + /* * client context is attached a session but private to a each plugin. * Context is passed to each API under request->context - * + * * Note: * -client context is free when a session is closed. Developer should not * forget that even if context is private to each plugin, session is unique @@ -38,13 +38,13 @@ typedef struct { * -when an API use AFB_SESSION_RESET this close the session and each plugin * will be notified to free ressources. */ - + int count; char *abcd; - + } MyClientContextT; -// This function is call at session open time. Any client trying to +// This function is call at session open time. Any client trying to // call it with an already open session will be denied. // Ex: http://localhost:1234/api/context/create?token=123456789 static void myCreate (struct afb_req request) @@ -53,7 +53,7 @@ static void myCreate (struct afb_req request) // store something in our plugin private client context ctx->count = 0; - ctx->abcd = "SomeThingUseful"; + ctx->abcd = "SomeThingUseful"; afb_req_context_set(request, ctx, free); afb_req_success_f(request, NULL, "SUCCESS: create client context for plugin [%s]", ctx->abcd); @@ -66,7 +66,7 @@ static void myCreate (struct afb_req request) static void myAction (struct afb_req request) { MyClientContextT *ctx = (MyClientContextT*) afb_req_context_get(request); - + // store something in our plugin private client context ctx->count++; afb_req_success_f(request, NULL, "SUCCESS: plugin [%s] Check=[%d]\n", ctx->abcd, ctx->count); @@ -79,7 +79,7 @@ static void myAction (struct afb_req request) static void myClose (struct afb_req request) { MyClientContextT *ctx = (MyClientContextT*) afb_req_context_get(request); - + // store something in our plugin private client context ctx->count++; afb_req_success_f(request, NULL, "SUCCESS: plugin [%s] Close=[%d]\n", ctx->abcd, ctx->count); diff --git a/bindings/samples/DemoPost.c b/bindings/samples/DemoPost.c index b61b91c4..69de5572 100644 --- a/bindings/samples/DemoPost.c +++ b/bindings/samples/DemoPost.c @@ -67,7 +67,7 @@ static void UploadMusic (struct afb_req request) } // PostForm callback is called multiple times (one or each key within form, or once per file buffer) -// When file has been fully uploaded call is call with item==NULL +// When file has been fully uploaded call is call with item==NULL static void UploadImage (struct afb_req request) { Uploads(request, "images"); diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c index b6f49b78..15544895 100644 --- a/bindings/samples/HelloWorld.c +++ b/bindings/samples/HelloWorld.c @@ -144,16 +144,16 @@ static void pingEvent(struct afb_req request) // For samples https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/ static void pingJson (struct afb_req request) { - json_object *jresp, *embed; - + json_object *jresp, *embed; + jresp = json_object_new_object(); json_object_object_add(jresp, "myString", json_object_new_string ("Some String")); json_object_object_add(jresp, "myInt", json_object_new_int (1234)); - + embed = json_object_new_object(); json_object_object_add(embed, "subObjString", json_object_new_string ("Some String")); json_object_object_add(embed, "subObjInt", json_object_new_int (5678)); - + json_object_object_add(jresp,"eobj", embed); ping(request, jresp, "pingJson"); diff --git a/include/afb/afb-event-itf.h b/include/afb/afb-event-itf.h index 4c9ad473..e31f22c1 100644 --- a/include/afb/afb-event-itf.h +++ b/include/afb/afb-event-itf.h @@ -25,7 +25,7 @@ struct json_object; * It records the functions to be called for the request. * Don't use this structure directly. * Use the helper functions documented below. - */ + */ struct afb_event_itf { /* CAUTION: respect the order, add at the end */ diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h index 740b3ac0..bc4b618c 100644 --- a/include/afb/afb-req-itf.h +++ b/include/afb/afb-req-itf.h @@ -46,7 +46,7 @@ struct afb_arg { * It records the functions to be called for the request. * Don't use this structure directly. * Use the helper functions documented below. - */ + */ struct afb_req_itf { /* CAUTION: respect the order, add at the end */ diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index b781f54f..53bc2dcc 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author José Bollo * diff --git a/src/afb-api-so.c b/src/afb-api-so.c index 860b097c..1db76428 100644 --- a/src/afb-api-so.c +++ b/src/afb-api-so.c @@ -141,7 +141,7 @@ static void call_check(struct afb_req req, struct afb_context *context, const st afb_context_close(context); afb_req_fail(req, "failed", "invalid token's identity"); return; - } + } } if ((stag & AFB_SESSION_CREATE) != 0) { @@ -152,7 +152,7 @@ static void call_check(struct afb_req req, struct afb_context *context, const st afb_context_change_loa(context, 1); afb_context_refresh(context); } - + if ((stag & (AFB_SESSION_CREATE | AFB_SESSION_RENEW)) != 0) afb_context_refresh(context); diff --git a/src/afb-common.c b/src/afb-common.c index 3bd5514e..2b16e573 100644 --- a/src/afb-common.c +++ b/src/afb-common.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author José Bollo * diff --git a/src/afb-common.h b/src/afb-common.h index 588ef700..4d6327c1 100644 --- a/src/afb-common.h +++ b/src/afb-common.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author José Bollo * diff --git a/src/afb-hswitch.c b/src/afb-hswitch.c index fea30c59..c6552d44 100644 --- a/src/afb-hswitch.c +++ b/src/afb-hswitch.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author "Fulup Ar Foll" * Author José Bollo diff --git a/src/afb-hswitch.h b/src/afb-hswitch.h index ece5608b..65dc9e91 100644 --- a/src/afb-hswitch.h +++ b/src/afb-hswitch.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author "Fulup Ar Foll" * Author José Bollo diff --git a/src/afb-sig-handler.c b/src/afb-sig-handler.c index 5fc5bb5e..ad56392c 100644 --- a/src/afb-sig-handler.c +++ b/src/afb-sig-handler.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author "Fulup Ar Foll" * Author José Bollo diff --git a/src/afb-sig-handler.h b/src/afb-sig-handler.h index 7ef28c30..3c9626cb 100644 --- a/src/afb-sig-handler.h +++ b/src/afb-sig-handler.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author "Fulup Ar Foll" * Author José Bollo diff --git a/src/afb-wsj1.h b/src/afb-wsj1.h index 1f433483..18657c33 100644 --- a/src/afb-wsj1.h +++ b/src/afb-wsj1.h @@ -94,7 +94,7 @@ extern int afb_wsj1_send_event_j(struct afb_wsj1 *wsj1, const char *event, struc /* * Sends on 'wsj1' a call to the method of 'api'/'verb' with arguments - * given by 'object'. If not NULL, 'object' should be a valid JSON string. + * given by 'object'. If not NULL, 'object' should be a valid JSON string. * On receiving the reply, the function 'on_reply' is called with 'closure' * as its first argument and the message of the reply. * Return 0 in case of success. Otherwise, returns -1 and set errno. diff --git a/src/main.c b/src/main.c index 7c457217..c474fafa 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author "Fulup Ar Foll" * Author José Bollo @@ -102,16 +102,16 @@ static AFB_options cliOptions [] = { {SET_ROOT_BASE ,1,"rootbase" , "Angular Base Root URL [default /opa]"}, {SET_ROOT_API ,1,"rootapi" , "HTML Root API URL [default /api]"}, {SET_ALIAS ,1,"alias" , "Muliple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]"}, - + {SET_APITIMEOUT ,1,"apitimeout" , "Binding API timeout in seconds [default 10]"}, {SET_CNTXTIMEOUT ,1,"cntxtimeout" , "Client Session Context Timeout [default 900]"}, {SET_CACHE_TIMEOUT,1,"cache-eol" , "Client cache end of live [default 3600]"}, - + {SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"}, {SET_LDPATH ,1,"ldpaths" , "Load bindingss from dir1:dir2:... [default = "BINDING_INSTALL_DIR"]"}, {SET_AUTH_TOKEN ,1,"token" , "Initial Secret [default=no-session, --token="" for session without authentication]"}, - + {DISPLAY_VERSION ,0,"version" , "Display version and copyright"}, {DISPLAY_HELP ,0,"help" , "Display this help"}, @@ -173,11 +173,11 @@ static void config_set_default (struct afb_config * config) // default HTTP port if (config->httpdPort == 0) config->httpdPort = 1234; - + // default binding API timeout if (config->apiTimeout == 0) config->apiTimeout = DEFLT_API_TIMEOUT; - + // default AUTH_TOKEN if (config->token == NULL) config->token = DEFLT_AUTH_TOKEN; @@ -204,11 +204,11 @@ static void config_set_default (struct afb_config * config) // if directory does not exist createit mkdir (config->rootdir, O_RDWR | S_IRWXU | S_IRGRP); } - + // if no Angular/HTML5 rootbase let's try '/' as default if (config->rootbase == NULL) config->rootbase = "/opa"; - + if (config->rootapi == NULL) config->rootapi = "/api"; @@ -289,7 +289,7 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config) if (optarg == 0) goto needValueForOption; if (!sscanf (optarg, "%d", &config->httpdPort)) goto notAnInteger; break; - + case SET_APITIMEOUT: if (optarg == 0) goto needValueForOption; if (!sscanf (optarg, "%d", &config->apiTimeout)) goto notAnInteger; @@ -304,8 +304,8 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config) if (optarg == 0) goto needValueForOption; config->rootdir = optarg; INFO("Forcing Rootdir=%s",config->rootdir); - break; - + break; + case SET_ROOT_BASE: if (optarg == 0) goto needValueForOption; config->rootbase = optarg; @@ -317,7 +317,7 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config) config->rootapi = optarg; INFO("Forcing Rootapi=%s",config->rootapi); break; - + case SET_ALIAS: if (optarg == 0) goto needValueForOption; if ((unsigned)config->aliascount < sizeof (config->aliasdir) / sizeof (config->aliasdir[0])) { @@ -331,9 +331,9 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config) } } else { ERROR("Too many aliases [max:%d] %s ignored", MAX_ALIAS, optarg); - } + } break; - + case SET_AUTH_TOKEN: if (optarg == 0) goto needValueForOption; config->token = optarg; @@ -401,7 +401,7 @@ static void parse_arguments(int argc, char *argv[], struct afb_config *config) } } free(gnuOptions); - + config_set_default (config); return; -- 2.16.6