Compare commits

..

No commits in common. "27a848758326a0bfd0cc3f4341c227c027507353" and "fcc9835419b8ea82417ee4ab049f3969a0037c5f" have entirely different histories.

4 changed files with 1 additions and 47 deletions

View file

@ -1,5 +1,5 @@
CC?=gcc
CFLAGS+=-Werror -Wall -Wextra -std=c99 -ggdb -fsanitize=address
CFLAGS+=-Werror -Wall -Wextra -std=c99 -ggdb
jitterbug: wire.c server.c main.c
$(CC) $(CFLAGS) -o $@ $^

View file

@ -90,7 +90,6 @@ int jb_server_name_add(struct jb_server *s, char *name, int client_index)
if (s->names[i].client_index == -1) {
s->names[i].client_index = client_index;
s->names[i].name = name;
s->names_count++;
return i;
}
}
@ -155,7 +154,6 @@ void jb_server_name_remove(struct jb_server *s, int i)
s->names[i].name = NULL;
}
s->names[i].client_index = -1;
s->names_count--;
}
}
@ -324,45 +322,6 @@ int jb_server_client_process_message(struct jb_server *s, int i, uint8_t *data,
_reply_begin("b") {
TRYPTR(wire_set_u32(&reply_ctx, target ? 1 : 0));
} _reply_end()
} else if (strcmp(member, "ListNames") == 0) {
_reply_begin("as") {
TRYPTR(wire_set_u32(&reply_ctx, s->names_count));
int left = s->names_count;
for (int i = 0; i < JB_MAX_NAMES; i++) {
if (s->names[i].name && s->names[i].client_index >= 0) {
left--;
TRYPTR(wire_set_string(&reply_ctx, s->names[i].name));
}
if (left <= 0) {
break;
}
}
} _reply_end()
} else if (strcmp(member, "ListActivatableNames") == 0) {
// TODO: stub (always returns empty array)
printf("STUB: ListActivatableNames\n");
_reply_begin("as") {
TRYPTR(wire_set_u32(&reply_ctx, 0));
// empty arrays still need to align
TRYPTR(wire_write_align(&reply_ctx, 4));
} _reply_end()
} else if (strcmp(member, "StartServiceByName") == 0) {
// TODO: stub (does nothing and always returns success)
char *name = TRYPTR(wire_get_string(&ctx, NULL));
int name_len = strlen(name);
if (name_len < 1 || name_len > 256) {
return -1;
}
printf("STUB: StartServiceByName: %s\n", name);
_reply_begin("u") {
TRYPTR(wire_set_u32(&reply_ctx, 1));
} _reply_end()
return 0;
} else {
_reply_error("org.freedesktop.DBus.Error.UnknownMethod");
return 0;

View file

@ -31,7 +31,6 @@ struct jb_name {
struct jb_server {
int sock_fd;
int fd_num;
int names_count;
struct jb_client clients[JB_MAX_CLIENTS];
struct jb_name names[JB_MAX_NAMES];
struct pollfd fds[JB_MAX_CLIENTS + 1];

4
wire.c
View file

@ -130,8 +130,6 @@ int wire_parse_message(wire_context_t *c, wire_message_t *msg)
size_t header_fields_end = c->byte_cursor + msg->header_fields_length;
printf("start parse message: type=%d\n", msg->type);
while (c->byte_cursor < header_fields_end) {
uint8_t field_code = *(uint8_t*)TRYPTR(wire_get_u8(c));
TRYPTR(wire_get_signature(c, NULL));
@ -171,8 +169,6 @@ int wire_parse_message(wire_context_t *c, wire_message_t *msg)
}
}
printf("end parse message\n");
/* header ends at 8 byte boundry */
TRYPTR(wire_align(c, 8));