Skip to content

Commit

Permalink
(net/build) suppress some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
letoram committed Oct 5, 2023
1 parent d6db073 commit f6a8eb6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
12 changes: 7 additions & 5 deletions src/a12/a12.c
Expand Up @@ -1422,7 +1422,7 @@ void a12_enqueue_bstream(struct a12_state* S,
next->type = type;
next->identifier = id;

if (extid && (type == A12_BTYPE_APPL || type == A12_BTYPE_APPL_RESOURCE)){
if (type == A12_BTYPE_APPL || type == A12_BTYPE_APPL_RESOURCE){
snprintf(next->extid, 16, "%s", extid);
}

Expand Down Expand Up @@ -1897,7 +1897,7 @@ static void command_dirdiscover(struct a12_state* S, void (*on_event)
size_t outl;
unsigned char* pk =
a12helper_tob64(&S->decode[36], 32, &outl);
snprintf((char*)&ev.ext.netstate.name, 66, "%d:%s", petname, pk);
snprintf((char*)&ev.ext.netstate.name, 66, "%s:%s", petname, pk);
free(pk);

on_event(S->channels[0].cont, 0, &ev, tag);
Expand Down Expand Up @@ -3142,6 +3142,8 @@ a12_channel_enqueue(struct a12_state* S, struct arcan_event* ev)
if (!S || S->cookie != 0xfeedface || !ev)
return false;

char empty_ext[16] = {0};

/* descriptor passing events are another complex affair, those that require
* the caller to provide data outwards should already have been handled at
* this stage, so it is basically STORE and BCHUNK_OUT that are allowed to
Expand All @@ -3160,14 +3162,14 @@ a12_channel_enqueue(struct a12_state* S, struct arcan_event* ev)
* the rest */
case TARGET_COMMAND_RESTORE:
a12_enqueue_bstream(S,
ev->tgt.ioevs[0].iv, A12_BTYPE_STATE, false, 0, 0, NULL);
ev->tgt.ioevs[0].iv, A12_BTYPE_STATE, false, 0, 0, empty_ext);
return true;
break;

/* let the bstream- side determine if the source is streaming or not */
case TARGET_COMMAND_BCHUNK_IN:
a12_enqueue_bstream(S,
ev->tgt.ioevs[0].iv, A12_BTYPE_BLOB, false, 0, 0, NULL);
ev->tgt.ioevs[0].iv, A12_BTYPE_BLOB, false, 0, 0, empty_ext);
return true;
break;

Expand All @@ -3177,7 +3179,7 @@ a12_channel_enqueue(struct a12_state* S, struct arcan_event* ev)
case TARGET_COMMAND_FONTHINT:
a12_enqueue_bstream(S,
ev->tgt.ioevs[0].iv, ev->tgt.ioevs[4].iv == 1 ?
A12_BTYPE_FONT_SUPPL : A12_BTYPE_FONT, false, 0, 0, NULL
A12_BTYPE_FONT_SUPPL : A12_BTYPE_FONT, false, 0, 0, empty_ext
);
break;
default:
Expand Down
5 changes: 3 additions & 2 deletions src/a12/net/dir_cl.c
Expand Up @@ -351,14 +351,15 @@ static void process_thread(struct ioloop_shared* I, bool ok)
goto out;
}

char empty_ext[16] = {0};
if (exec_res && !cbt->clopt->block_state){
a12_enqueue_bstream(I->S, state_fd,
A12_BTYPE_STATE, cbt->clopt->applid, false, state_sz, NULL);
A12_BTYPE_STATE, cbt->clopt->applid, false, state_sz, empty_ext);
}
else if (!exec_res && !cbt->clopt->block_log){
fprintf(stderr, "sending crash report (%zu) bytes\n", state_sz);
a12_enqueue_bstream(I->S, state_fd,
A12_BTYPE_CRASHDUMP, cbt->clopt->applid, false, state_sz, NULL);
A12_BTYPE_CRASHDUMP, cbt->clopt->applid, false, state_sz, empty_ext);
}

out:
Expand Down
2 changes: 1 addition & 1 deletion src/a12/net/dir_srv.c
Expand Up @@ -502,7 +502,7 @@ static void* dircl_process(void* P)
while (1 == shmifsrv_dequeue_events(C->C, &ev, 1)){
/* petName for a source/dir or for joining an appl */
if (ev.ext.kind == EVENT_EXTERNAL_IDENT){
A12INT_DIRTRACE("dirsv:kind=worker:cl_join=%s", ev.ext.message);
A12INT_DIRTRACE("dirsv:kind=worker:cl_join=%s", (char*)ev.ext.message.data);
}

/* right now we permit the worker to fetch / update their state store of any
Expand Down
10 changes: 6 additions & 4 deletions src/a12/net/dir_srv_worker.c
Expand Up @@ -141,15 +141,17 @@ static void on_srv_event(
/* if the appl exist, first try the state blob, then the appl */
if (fd != -1){
char buf[COUNT_OF(ev->ext.message.data)];
char empty_ext[16] = {0};

snprintf(buf, sizeof(buf), "%d.state", (int) extid);
int state_fd = request_parent_resource(cbt->S, C, buf, false);
if (state_fd != -1){
a12_enqueue_bstream(cbt->S,
state_fd, A12_BTYPE_STATE, extid, false, 0, NULL);
state_fd, A12_BTYPE_STATE, extid, false, 0, empty_ext);
close(state_fd);
}
a12_enqueue_bstream(cbt->S,
fd, A12_BTYPE_BLOB, extid, false, 0, NULL);
fd, A12_BTYPE_BLOB, extid, false, 0, empty_ext);
close(fd);
}
else
Expand Down Expand Up @@ -214,13 +216,13 @@ static void unpack_index(
*cur = malloc(sizeof(struct appl_meta));
**cur = (struct appl_meta){.role = source ? ROLE_SOURCE : ROLE_DIR};

snprintf((*cur)->appl.name, 18, name);
snprintf((*cur)->appl.name, 18, "%s", name);
cur = &(*cur)->next;
}
else if (strcmp(kind, "appl") == 0 && name){
*cur = malloc(sizeof(struct appl_meta));
**cur = (struct appl_meta){.role = 0}; /* no role == APPL */
snprintf((*cur)->appl.name, 18, name);
snprintf((*cur)->appl.name, 18, "%s", name);

const char* tmp;
if (arg_lookup(entry, "categories", 0, &tmp) && tmp)
Expand Down
2 changes: 1 addition & 1 deletion src/a12/net/net.c
Expand Up @@ -285,6 +285,7 @@ static void fork_a12srv(struct a12_state* S, int fd, void* tag)

struct shmifsrv_client* C = NULL;
struct arcan_net_meta* meta = tag;
int rc = 0;

if (!handover_setup(S, fd, meta, &C)){
goto out;
Expand All @@ -293,7 +294,6 @@ static void fork_a12srv(struct a12_state* S, int fd, void* tag)
/* this is for a full 'remote desktop' like scenario, directory is handled
* in handover_setup */
arcan_shmif_privsep(NULL, "shmif", NULL, 0);
int rc = 0;

if (C){
a12helper_a12cl_shmifsrv(S, C, fd, fd, (struct a12helper_opts){
Expand Down

0 comments on commit f6a8eb6

Please sign in to comment.