Add defaultbranch
[src/app-framework-main.git] / src / afm-launch.c
index 13f2bf9..88402c9 100644 (file)
@@ -141,8 +141,8 @@ static void dump_launchers(FILE *file)
 static int next_token(struct confread *cread)
 {
        int idx = cread->index + cread->length;
-       cread->index = idx + strspn(&cread->buffer[idx], separators);
-       cread->length = strcspn(&cread->buffer[cread->index], separators);
+       cread->index = idx + (int)strspn(&cread->buffer[idx], separators);
+       cread->length = (int)strcspn(&cread->buffer[cread->index], separators);
        return cread->length;
 }
 
@@ -156,11 +156,11 @@ static int read_line(struct confread *cread)
 {
        while (fgets(cread->buffer, sizeof cread->buffer, cread->file) != NULL) {
                cread->lineno++;
-               cread->index = strspn(cread->buffer, separators);
+               cread->index = (int)strspn(cread->buffer, separators);
                if (cread->buffer[cread->index]
                  && cread->buffer[cread->index] != '#') {
-                       cread->length = strcspn(&cread->buffer[cread->index],
-                                                               separators);
+                       cread->length = (int)strcspn(
+                               &cread->buffer[cread->index], separators);
                        assert(cread->length > 0);
                        return cread->length;
                }
@@ -183,7 +183,7 @@ static const char **read_vector(struct confread *cread)
        int index0, length0;
        const char **vector;
        char *args;
-       int count, length;
+       unsigned count, length;
 
        /* record origin */
        index0 = cread->index;
@@ -194,7 +194,7 @@ static const char **read_vector(struct confread *cread)
        length = 0;
        while(cread->length) {
                count++;
-               length += cread->length;
+               length += (unsigned)cread->length;
                next_token(cread);
        }
 
@@ -210,7 +210,8 @@ static const char **read_vector(struct confread *cread)
        count = 0;
        while(cread->length) {
                vector[count++] = args;
-               memcpy(args, &cread->buffer[cread->index], cread->length);
+               memcpy(args, &cread->buffer[cread->index],
+                                               (unsigned)cread->length);
                args += cread->length;
                *args++ = 0;
                next_token(cread);
@@ -247,7 +248,7 @@ static struct type_list *read_type(struct confread *cread)
        }
 
        /* allocate structure */
-       result = malloc(sizeof(struct type_list) + length);
+       result = malloc(sizeof(struct type_list) + (unsigned)length);
        if (result == NULL) {
                ERROR("%s:%d: out of memory", cread->filepath, cread->lineno);
                errno = ENOMEM;
@@ -255,7 +256,7 @@ static struct type_list *read_type(struct confread *cread)
        }
 
        /* fill the structure */
-       memcpy(result->type, &cread->buffer[index], length);
+       memcpy(result->type, &cread->buffer[index], (unsigned)length);
        result->type[length] = 0;
        return result;
 }
@@ -486,6 +487,7 @@ static int mkport()
 /*
 %% %
 %a appid                       desc->appid
+%b bindings                    desc->bindings
 %c content                     desc->content
 %D datadir                     params->datadir
 %H height                      desc->height
@@ -493,7 +495,6 @@ static int mkport()
 %I icondir                     FWK_ICON_DIR
 %m mime-type                   desc->type
 %n name                                desc->name
-%p plugins                     desc->plugins
 %P port                                params->port
 %r rootdir                     desc->path
 %R readyfd                      params->readyfd
@@ -531,7 +532,7 @@ static union arguments instantiate_arguments(
        const char * const *iter;
        const char *p, *v;
        char *data, c, sep;
-       int n, s;
+       unsigned n, s;
        union arguments result;
        char port[20], width[20], height[20], readyfd[20], mini[3];
 
@@ -570,6 +571,9 @@ static union arguments instantiate_arguments(
                                        c = *p++;
                                        switch (c) {
                                        case 'a': v = desc->appid; break;
+                                       case 'b':
+                                               v = "" /*TODO:desc->bindings*/;
+                                               break;
                                        case 'c': v = desc->content; break;
                                        case 'D': v = params->datadir; break;
                                        case 'H':
@@ -588,9 +592,6 @@ static union arguments instantiate_arguments(
                                                                params->port);
                                                v = port;
                                                break;
-                                       case 'p':
-                                               v = "" /*TODO:desc->plugins*/;
-                                               break;
                                        case 'R':
                                                if(!data)
                                                        sprintf(readyfd, "%d",
@@ -615,7 +616,7 @@ static union arguments instantiate_arguments(
                                        if (data)
                                                data = stpcpy(data, v);
                                        else
-                                               s += strlen(v);
+                                               s += (unsigned)strlen(v);
                                }
                        }
                        /* terminate the argument */
@@ -891,7 +892,7 @@ int afm_launch(struct afm_launch_desc *desc, pid_t children[2], char **uri)
        /* prepare paths */
        rc = snprintf(datadir, sizeof datadir, "%s/%s",
                                                desc->home, desc->appid);
-       if (rc < 0 || rc >= sizeof datadir) {
+       if (rc < 0 || rc >= (int)sizeof datadir) {
                ERROR("overflow for datadir");
                errno = EINVAL;
                return -1;
@@ -931,7 +932,7 @@ int afm_launch_initialize()
        if (s && s != e)
                groupid = s; /* the original groupid is used */
        else
-               groupid = -1;
+               groupid = (gid_t)-1;
 
        rc = read_configuration_file(FWK_LAUNCH_CONF);
        /* dump_launchers(stderr); */