fix unexpected ending spaces
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 27 Jul 2016 15:44:27 +0000 (17:44 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 27 Jul 2016 15:44:27 +0000 (17:44 +0200)
Change-Id: Ie7ebccb02b42e91457df3bdbf2a6f037b248400e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
21 files changed:
bindings/audio/audio-pulse.c
bindings/intrinsics/afb-dbus-binding.c
bindings/media/media-rygel.c
bindings/radio/radio-api.c
bindings/radio/radio-rtlsdr.c
bindings/samples/AuthLogin.c
bindings/samples/DemoContext.c
bindings/samples/DemoPost.c
bindings/samples/HelloWorld.c
include/afb/afb-event-itf.h
include/afb/afb-req-itf.h
src/afb-api-dbus.c
src/afb-api-so.c
src/afb-common.c
src/afb-common.h
src/afb-hswitch.c
src/afb-hswitch.h
src/afb-sig-handler.c
src/afb-sig-handler.h
src/afb-wsj1.h
src/main.c

index 3464360..a6d1e4d 100644 (file)
@@ -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) {
index 59fe78d..dda5945 100644 (file)
@@ -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)
index 0032779..38a8a44 100644 (file)
@@ -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';
 
index 0ed60e1..7dd22b6 100644 (file)
@@ -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 ?
index 7f76306..00ceba6 100644 (file)
@@ -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); */
 }
 
index efecf24..ceb833e 100644 (file)
@@ -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);
 }
 
index ef70375..243ed68 100644 (file)
 #include <afb/afb-plugin.h>
 
 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);
index b61b91c..69de557 100644 (file)
@@ -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");
index b6f49b7..1554489 100644 (file)
@@ -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");
index 4c9ad47..e31f22c 100644 (file)
@@ -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 */
 
index 740b3ac..bc4b618 100644 (file)
@@ -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 */
 
index b781f54..53bc2dc 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
index 860b097..1db7642 100644 (file)
@@ -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);
 
index 3bd5514..2b16e57 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
index 588ef70..4d6327c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
index fea30c5..c6552d4 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author "Fulup Ar Foll"
  * Author José Bollo <jose.bollo@iot.bzh>
index ece5608..65dc9e9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author "Fulup Ar Foll"
  * Author José Bollo <jose.bollo@iot.bzh>
index 5fc5bb5..ad56392 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author "Fulup Ar Foll"
  * Author José Bollo <jose.bollo@iot.bzh>
index 7ef28c3..3c9626c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author "Fulup Ar Foll"
  * Author José Bollo <jose.bollo@iot.bzh>
index 1f43348..18657c3 100644 (file)
@@ -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.
index 7c45721..c474faf 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2015, 2016 "IoT.bzh"
  * Author "Fulup Ar Foll"
  * Author José Bollo <jose.bollo@iot.bzh>
@@ -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;