fix warnings
This commit is contained in:
parent
7cdd84ac63
commit
98c7d8b648
3 changed files with 9 additions and 8 deletions
6
match.c
6
match.c
|
@ -178,7 +178,7 @@ fail:
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
int match_check_sender(Bus *s, BusClient *sender_client, MatchRule *rule)
|
int match_check_sender(BusClient *sender_client, MatchRule *rule)
|
||||||
{
|
{
|
||||||
if (rule->sender) {
|
if (rule->sender) {
|
||||||
if (sender_client->unique_name) {
|
if (sender_client->unique_name) {
|
||||||
|
@ -196,7 +196,7 @@ int match_check_sender(Bus *s, BusClient *sender_client, MatchRule *rule)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx)
|
int match_rule_check(BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx)
|
||||||
{
|
{
|
||||||
if (rule->type && msg->type != rule->type) {
|
if (rule->type && msg->type != rule->type) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -208,7 +208,7 @@ int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (match_check_sender(s, sender_client, rule) < 0) {
|
if (match_check_sender(sender_client, rule) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
match.h
2
match.h
|
@ -8,6 +8,6 @@
|
||||||
|
|
||||||
void match_rule_free(MatchRule *rule);
|
void match_rule_free(MatchRule *rule);
|
||||||
MatchRule *match_rule_from_string(char *d);
|
MatchRule *match_rule_from_string(char *d);
|
||||||
int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx);
|
int match_rule_check(BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx);
|
||||||
|
|
||||||
#endif // _JITTERBUG__MATCH_H
|
#endif // _JITTERBUG__MATCH_H
|
||||||
|
|
9
server.c
9
server.c
|
@ -196,7 +196,7 @@ BusName *bus_name_add(Bus *s, char *name, BusClient *client)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bus_client_match_add(Bus *s, BusClient *c, char *match)
|
int bus_client_match_add(BusClient *c, char *match)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < BUS_MAX_MATCH; i++) {
|
for (int i = 0; i < BUS_MAX_MATCH; i++) {
|
||||||
if (!c->matches[i]) {
|
if (!c->matches[i]) {
|
||||||
|
@ -325,7 +325,7 @@ int bus_broadcast_message(Bus *s, BusClient *sender_client, WireMsg *msg, WireCt
|
||||||
match_left--;
|
match_left--;
|
||||||
|
|
||||||
uint32_t previous_cursor = ctx->byte_cursor;
|
uint32_t previous_cursor = ctx->byte_cursor;
|
||||||
if (match_rule_check(s, sender_client, c->matches[j], msg, ctx) >= 0) {
|
if (match_rule_check(sender_client, c->matches[j], msg, ctx) >= 0) {
|
||||||
TRYST(wire_compose_unicast_reply(reply_ctx, ctx, msg, sender_client->unique_name->name));
|
TRYST(wire_compose_unicast_reply(reply_ctx, ctx, msg, sender_client->unique_name->name));
|
||||||
TRYST(send(c->fd, reply_ctx->data, reply_ctx->byte_cursor, 0));
|
TRYST(send(c->fd, reply_ctx->data, reply_ctx->byte_cursor, 0));
|
||||||
// TODO?
|
// TODO?
|
||||||
|
@ -360,7 +360,7 @@ int bus_broadcast_signal(Bus *s, BusClient *client, WireCtx *ctx, WireMsg *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
match_left--;
|
match_left--;
|
||||||
if (match_rule_check(s, client, c->matches[j], msg, ctx) >= 0) {
|
if (match_rule_check(client, c->matches[j], msg, ctx) >= 0) {
|
||||||
uint32_t previous_cursor = ctx->byte_cursor;
|
uint32_t previous_cursor = ctx->byte_cursor;
|
||||||
TRYST(send(c->fd, ctx->data, ctx->byte_cursor, 0));
|
TRYST(send(c->fd, ctx->data, ctx->byte_cursor, 0));
|
||||||
ctx->byte_cursor = previous_cursor;
|
ctx->byte_cursor = previous_cursor;
|
||||||
|
@ -399,6 +399,7 @@ int bus_unicast_message(Bus *s, WireMsg *msg, WireCtx *ctx, char *target_name, c
|
||||||
|
|
||||||
|
|
||||||
#define _reply_begin(M_sig) \
|
#define _reply_begin(M_sig) \
|
||||||
|
(void)s; \
|
||||||
uint32_t *body_length = NULL; \
|
uint32_t *body_length = NULL; \
|
||||||
uint32_t body_start = 0; \
|
uint32_t body_start = 0; \
|
||||||
if (!(msg->flags & DBUS_FLAG_NO_REPLY_EXPECTED)) { \
|
if (!(msg->flags & DBUS_FLAG_NO_REPLY_EXPECTED)) { \
|
||||||
|
@ -569,7 +570,7 @@ int handle_add_match(Bus *s, BusClient *client, WireMsg *msg, WireCtx *ctx, Wire
|
||||||
|
|
||||||
VERBOSE("client index %d adding match rule: '%s'\n", client->fd_index, match);
|
VERBOSE("client index %d adding match rule: '%s'\n", client->fd_index, match);
|
||||||
|
|
||||||
TRYST(bus_client_match_add(s, client, match));
|
TRYST(bus_client_match_add(client, match));
|
||||||
|
|
||||||
_reply_begin("") {} _reply_end()
|
_reply_begin("") {} _reply_end()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue