aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-24 16:01:34 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-24 16:01:34 +0200
commitced31fb2be1cdcc0dfc8da2b9b00105c3ad903cb (patch)
treee6544671f170bac8258e946f515dfde471125cbf /src
parentdoc protocol stuff except message passing related stuff (diff)
downloadmds-ced31fb2be1cdcc0dfc8da2b9b00105c3ad903cb.tar.gz
mds-ced31fb2be1cdcc0dfc8da2b9b00105c3ad903cb.tar.bz2
mds-ced31fb2be1cdcc0dfc8da2b9b00105c3ad903cb.tar.xz
message id is unsigned 32-bit
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mds-clipboard.c26
-rw-r--r--src/mds-echo.c14
-rw-r--r--src/mds-kkbd.c28
-rw-r--r--src/mds-registry/globals.c2
-rw-r--r--src/mds-registry/globals.h2
-rw-r--r--src/mds-registry/reexec.c6
-rw-r--r--src/mds-registry/registry.c6
-rw-r--r--src/mds-registry/slave.c6
-rw-r--r--src/mds-vt.c8
9 files changed, 49 insertions, 49 deletions
diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c
index c700b6c..85398d7 100644
--- a/src/mds-clipboard.c
+++ b/src/mds-clipboard.c
@@ -55,7 +55,7 @@ server_characteristics_t server_characteristics =
/**
* Value of the ‘Message ID’ header for the next message
*/
-static int32_t message_id = 1;
+static uint32_t message_id = 1;
/**
* Buffer for received messages
@@ -178,7 +178,7 @@ int postinitialise_server(void)
*/
size_t marshal_server_size(void)
{
- size_t i, j, rc = 2 * sizeof(int) + sizeof(int32_t) + mds_message_marshal_size(&received);
+ size_t i, j, rc = 2 * sizeof(int) + sizeof(uint32_t) + mds_message_marshal_size(&received);
rc += 2 * CLIPBOARD_LEVELS * sizeof(size_t);
for (i = 0; i < CLIPBOARD_LEVELS; i++)
for (j = 0; j < clipboard_used[i]; j++)
@@ -216,7 +216,7 @@ int marshal_server(char* state_buf)
buf_set_next(state_buf, int, MDS_CLIPBOARD_VARS_VERSION);
buf_set_next(state_buf, int, connected);
- buf_set_next(state_buf, int32_t, message_id);
+ buf_set_next(state_buf, uint32_t, message_id);
mds_message_marshal(&received, state_buf);
/* Removed entires from the clipboard that may not be marshalled. */
@@ -281,7 +281,7 @@ int unmarshal_server(char* state_buf)
/* buf_get_next(state_buf, int, MDS_CLIPBOARD_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
- buf_get_next(state_buf, int32_t, message_id);
+ buf_get_next(state_buf, uint32_t, message_id);
fail_if (mds_message_unmarshal(&received, state_buf));
for (i = 0; i < CLIPBOARD_LEVELS; i++)
@@ -566,7 +566,7 @@ static int clipboard_notify_pop(int level, size_t index)
n += strlen("Command: clipboard-info\n"
"Event: crash\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Level: %i\n"
"Popped: %zu\n"
"Size: %zu\n"
@@ -579,7 +579,7 @@ static int clipboard_notify_pop(int level, size_t index)
sprintf(message,
"Command: clipboard-info\n"
"Event: crash\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Level: %i\n"
"Popped: %zu\n"
"Size: %zu\n"
@@ -587,7 +587,7 @@ static int clipboard_notify_pop(int level, size_t index)
"\n",
message_id, level, index, size, used);
- message_id = message_id == INT32_MAX ? 0 : (message_id + 1);
+ message_id = message_id == UINT32_MAX ? 0 : (message_id + 1);
return full_send(message, strlen(message)) ? -1 : 0;
}
@@ -738,7 +738,7 @@ int clipboard_read(int level, size_t index, const char* recv_client_id, const ch
{
n = strlen("To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n");
n += strlen(recv_client_id) + strlen(recv_message_id) + 10;
@@ -747,7 +747,7 @@ int clipboard_read(int level, size_t index, const char* recv_client_id, const ch
sprintf(message,
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n",
recv_client_id, recv_message_id, message_id);
@@ -761,7 +761,7 @@ int clipboard_read(int level, size_t index, const char* recv_client_id, const ch
n = strlen("To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Length: %zu\n"
"\n");
n += strlen(recv_client_id) + strlen(recv_message_id) + 10 + 3 * sizeof(size_t);
@@ -771,7 +771,7 @@ int clipboard_read(int level, size_t index, const char* recv_client_id, const ch
sprintf(message,
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Length: %zu\n"
"\n",
recv_client_id, recv_message_id, message_id, clip->length);
@@ -865,7 +865,7 @@ int clipboard_get_size(int level, const char* recv_client_id, const char* recv_m
n = strlen("To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Size: %zu\n"
"Used: %zu\n"
"\n");
@@ -875,7 +875,7 @@ int clipboard_get_size(int level, const char* recv_client_id, const char* recv_m
sprintf(message,
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Size: %zu\n"
"Used: %zu\n"
"\n",
diff --git a/src/mds-echo.c b/src/mds-echo.c
index 6070dbf..3a5eaa2 100644
--- a/src/mds-echo.c
+++ b/src/mds-echo.c
@@ -55,7 +55,7 @@ server_characteristics_t server_characteristics =
/**
* Value of the ‘Message ID’ header for the next message
*/
-static int32_t message_id = 1;
+static uint32_t message_id = 1;
/**
* Buffer for received messages
@@ -150,7 +150,7 @@ int postinitialise_server(void)
*/
size_t marshal_server_size(void)
{
- return 2 * sizeof(int) + sizeof(int32_t) + mds_message_marshal_size(&received);
+ return 2 * sizeof(int) + sizeof(uint32_t) + mds_message_marshal_size(&received);
}
@@ -164,7 +164,7 @@ int marshal_server(char* state_buf)
{
buf_set_next(state_buf, int, MDS_ECHO_VARS_VERSION);
buf_set_next(state_buf, int, connected);
- buf_set_next(state_buf, int32_t, message_id);
+ buf_set_next(state_buf, uint32_t, message_id);
mds_message_marshal(&received, state_buf);
mds_message_destroy(&received);
@@ -188,7 +188,7 @@ int unmarshal_server(char* state_buf)
/* buf_get_next(state_buf, int, MDS_ECHO_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
- buf_get_next(state_buf, int32_t, message_id);
+ buf_get_next(state_buf, uint32_t, message_id);
r = mds_message_unmarshal(&received, state_buf);
if (r)
{
@@ -311,7 +311,7 @@ int echo_message(void)
/* Construct echo message headers. */
n = 1 + strlen("To: \nIn response to: \nMessage ID: \n\n");
- n += strlen(recv_client_id) + strlen(recv_message_id) + 3 * sizeof(int32_t);
+ n += strlen(recv_client_id) + strlen(recv_message_id) + 2 * sizeof(int32_t) + sizeof(uint32);
if (recv_length != NULL)
n += strlen(recv_length) + 1;
@@ -325,13 +325,13 @@ int echo_message(void)
}
}
- sprintf(echo_buffer, "To: %s\nIn response to: %s\nMessage ID: %" PRIi32 "\n%s%s\n",
+ sprintf(echo_buffer, "To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\n%s%s\n",
recv_client_id, recv_message_id, message_id,
recv_length == NULL ? "" : recv_length,
recv_length == NULL ? "" : "\n");
/* Increase message ID. */
- message_id = message_id == INT32_MAX ? 0 : (message_id + 1);
+ message_id = message_id == UINT32_MAX ? 0 : (message_id + 1);
/* Send echo. */
if (full_send(echo_buffer, strlen(echo_buffer)))
diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c
index 690f3d9..8a0091b 100644
--- a/src/mds-kkbd.c
+++ b/src/mds-kkbd.c
@@ -100,7 +100,7 @@ server_characteristics_t server_characteristics =
/**
* Value of the ‘Message ID’ header for the next message
*/
-static int32_t message_id = 3;
+static uint32_t message_id = 3;
/**
* Buffer for received messages
@@ -313,7 +313,7 @@ void fork_cleanup(int status)
*/
size_t marshal_server_size(void)
{
- size_t rc = 9 * sizeof(int) + sizeof(int32_t) + sizeof(struct termios);
+ size_t rc = 9 * sizeof(int) + sizeof(uint32_t) + sizeof(struct termios);
rc += sizeof(size_t) + mapping_size * sizeof(int);
rc += mds_message_marshal_size(&received);
return rc;
@@ -330,7 +330,7 @@ int marshal_server(char* state_buf)
{
buf_set_next(state_buf, int, MDS_KKBD_VARS_VERSION);
buf_set_next(state_buf, int, connected);
- buf_set_next(state_buf, int32_t, message_id);
+ buf_set_next(state_buf, uint32_t, message_id);
buf_set_next(state_buf, int, ledfd);
buf_set_next(state_buf, int, saved_leds);
buf_set_next(state_buf, struct termios, saved_stty);
@@ -368,7 +368,7 @@ int unmarshal_server(char* state_buf)
/* buf_get_next(state_buf, int, MDS_KKBDOARD_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
- buf_get_next(state_buf, int32_t, message_id);
+ buf_get_next(state_buf, uint32_t, message_id);
buf_get_next(state_buf, int, ledfd);
buf_get_next(state_buf, int, saved_leds);
buf_get_next(state_buf, struct termios, saved_stty);
@@ -609,7 +609,7 @@ int handle_enumerate_keyboards(const char* recv_client_id, const char* recv_mess
with_mutex (send_mutex,
msgid = message_id;
- message_id = message_id == INT32_MAX ? 0 : (message_id + 1);
+ message_id = message_id == UINT32_MAX ? 0 : (message_id + 1);
);
if (ensure_send_buffer_size(48 + strlen(recv_modify_id) + 1) < 0)
@@ -617,7 +617,7 @@ int handle_enumerate_keyboards(const char* recv_client_id, const char* recv_mess
sprintf(send_buffer,
"Modify: no\n"
"Modify ID: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n",
recv_modify_id, msgid);
@@ -640,14 +640,14 @@ int handle_enumerate_keyboards(const char* recv_client_id, const char* recv_mess
sprintf(send_buffer,
"Modify: yes\n"
"Modify ID: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n"
/* NEXT MESSAGE */
"Command: keyboard-enumeration\n"
"To: %s\n"
"In response to: %s\n"
"Length: %zu\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n"
KEYBOARD_ID "\n",
recv_modify_id, msgid,
@@ -720,7 +720,7 @@ int handle_keyboard_enumeration(const char* recv_modify_id)
sprintf(send_buffer,
"Modify ID: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Length: %zu\n",
recv_modify_id, msgid, n);
top = strlen(send_buffer) + 1;
@@ -868,7 +868,7 @@ int handle_get_keyboard_leds(const char* recv_client_id, const char* recv_messag
sprintf(send_buffer,
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Active:%s%s%s%s%s\n"
"Present: " PRESENT_LEDS "\n"
"\n",
@@ -1057,7 +1057,7 @@ static int mapping_query(const char* recv_client_id, const char* recv_message_id
sprintf(send_buffer,
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Length: %zu\n"
"\n",
recv_client_id, recv_message_id, msgid, n);
@@ -1318,7 +1318,7 @@ int send_key(int* restrict scancode, int trio)
"Keycode: %i\n"
"Released: %s\n"
"Keyboard: " KEYBOARD_ID "\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n",
scancode[0], scancode[1], scancode[2], keycode,
released ? "yes" : "no", msgid);
@@ -1329,7 +1329,7 @@ int send_key(int* restrict scancode, int trio)
"Keycode: %i\n"
"Released: %s\n"
"Keyboard: " KEYBOARD_ID "\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"\n",
scancode[0], keycode,
released ? "yes" : "no", msgid);
@@ -1436,7 +1436,7 @@ int send_errno(int error, const char* recv_client_id, const char* recv_message_i
"Command: error\n"
"To: %s\n"
"In response to: %s\n"
- "Message ID: %" PRIi32 "\n"
+ "Message ID: %" PRIu32 "\n"
"Error: %i\n"
"\n",
recv_client_id, recv_message_id, message_id, error);
diff --git a/src/mds-registry/globals.c b/src/mds-registry/globals.c
index e275eb7..2e0252f 100644
--- a/src/mds-registry/globals.c
+++ b/src/mds-registry/globals.c
@@ -22,7 +22,7 @@
/**
* Value of the ‘Message ID’ header for the next message
*/
-int32_t message_id = 2;
+uint32_t message_id = 2;
/**
* Buffer for received messages
diff --git a/src/mds-registry/globals.h b/src/mds-registry/globals.h
index 21f3b3e..bd83ff4 100644
--- a/src/mds-registry/globals.h
+++ b/src/mds-registry/globals.h
@@ -35,7 +35,7 @@
/**
* Value of the ‘Message ID’ header for the next message
*/
-extern int32_t message_id;
+extern uint32_t message_id;
/**
* Buffer for received messages
diff --git a/src/mds-registry/reexec.c b/src/mds-registry/reexec.c
index 6e34db8..6247e18 100644
--- a/src/mds-registry/reexec.c
+++ b/src/mds-registry/reexec.c
@@ -42,7 +42,7 @@
*/
size_t marshal_server_size(void)
{
- size_t i, rc = 2 * sizeof(int) + sizeof(int32_t) + 4 * sizeof(size_t);
+ size_t i, rc = 2 * sizeof(int) + sizeof(uint32_t) + 4 * sizeof(size_t);
hash_entry_t* entry;
ssize_t node;
@@ -82,7 +82,7 @@ int marshal_server(char* state_buf)
buf_set_next(state_buf, int, MDS_REGISTRY_VARS_VERSION);
buf_set_next(state_buf, int, connected);
- buf_set_next(state_buf, int32_t, message_id);
+ buf_set_next(state_buf, uint32_t, message_id);
buf_set_next(state_buf, size_t, n);
mds_message_marshal(&received, state_buf);
state_buf += n / sizeof(char);
@@ -145,7 +145,7 @@ int unmarshal_server(char* state_buf)
/* buf_get_next(state_buf, int, MDS_REGISTRY_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
- buf_get_next(state_buf, int32_t, message_id);
+ buf_get_next(state_buf, uint32_t, message_id);
buf_get_next(state_buf, size_t, n);
fail_if (mds_message_unmarshal(&received, state_buf));
state_buf += n / sizeof(char);
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index d2a9c10..726d361 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -377,7 +377,7 @@ static int list_registry(const char* recv_client_id, const char* recv_message_id
/* Make sure the message headers can fit the send buffer. */
i = strlen(recv_message_id) + strlen(recv_client_id) + 10 + 19;
- i += strlen("To: %s\nIn response to: %s\nMessage ID: %" PRIi32 "\nLength: %" PRIu64 "\n\n");
+ i += strlen("To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\nLength: %" PRIu64 "\n\n");
while (ptr + i >= send_buffer_size)
if (growalloc(old, send_buffer, send_buffer_size, char))
@@ -385,11 +385,11 @@ static int list_registry(const char* recv_client_id, const char* recv_message_id
/* Construct message headers. */
- sprintf(send_buffer + ptr, "To: %s\nIn response to: %s\nMessage ID: %" PRIi32 "\nLength: %" PRIu64 "\n\n",
+ sprintf(send_buffer + ptr, "To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\nLength: %" PRIu64 "\n\n",
recv_client_id, recv_message_id, message_id, ptr);
/* Increase message ID. */
- with_mutex (slave_mutex, message_id = message_id == INT32_MAX ? 0 : (message_id + 1););
+ with_mutex (slave_mutex, message_id = message_id == UINT32_MAX ? 0 : (message_id + 1););
/* Send message. */
if (full_send(send_buffer + ptr, strlen(send_buffer + ptr)))
diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c
index 5e714d4..f98dc20 100644
--- a/src/mds-registry/slave.c
+++ b/src/mds-registry/slave.c
@@ -40,15 +40,15 @@
*/
static int slave_notify_client(slave_t* slave)
{
- char buf[sizeof("To: %s\nIn response to: %s\nMessage ID: %" PRIi32 "\n\n") / sizeof(char) + 40];
+ char buf[sizeof("To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\n\n") / sizeof(char) + 40];
size_t ptr = 0, sent, left;
/* Construct message headers. */
- sprintf(buf, "To: %s\nIn response to: %s\nMessage ID: %" PRIi32 "\n\n",
+ sprintf(buf, "To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\n\n",
slave->client_id, slave->message_id, message_id);
/* Increase message ID. */
- message_id = message_id == INT32_MAX ? 0 : (message_id + 1);
+ message_id = message_id == UINT32_MAX ? 0 : (message_id + 1);
/* Send message to client. */
left = strlen(buf);
diff --git a/src/mds-vt.c b/src/mds-vt.c
index 4c4894a..bd294d9 100644
--- a/src/mds-vt.c
+++ b/src/mds-vt.c
@@ -62,7 +62,7 @@ server_characteristics_t server_characteristics =
/**
* Value of the ‘Message ID’ header for the next message
*/
-static int32_t message_id = 1;
+static uint32_t message_id = 1;
/**
* Buffer for received messages
@@ -281,7 +281,7 @@ int postinitialise_server(void)
*/
size_t marshal_server_size(void)
{
- size_t rc = 5 * sizeof(int) + sizeof(int32_t);
+ size_t rc = 5 * sizeof(int) + sizeof(uint32_t);
rc += sizeof(struct stat);
rc += PATH_MAX * sizeof(char);
rc += mds_message_marshal_size(&received);
@@ -299,7 +299,7 @@ int marshal_server(char* state_buf)
{
buf_set_next(state_buf, int, MDS_VT_VARS_VERSION);
buf_set_next(state_buf, int, connected);
- buf_set_next(state_buf, int32_t, message_id);
+ buf_set_next(state_buf, uint32_t, message_id);
buf_set_next(state_buf, int, display_vt);
buf_set_next(state_buf, int, display_tty_fd);
buf_set_next(state_buf, int, vt_is_active);
@@ -329,7 +329,7 @@ int unmarshal_server(char* state_buf)
/* buf_get_next(state_buf, int, MDS_VT_VARS_VERSION); */
buf_next(state_buf, int, 1);
buf_get_next(state_buf, int, connected);
- buf_get_next(state_buf, int32_t, message_id);
+ buf_get_next(state_buf, uint32_t, message_id);
buf_get_next(state_buf, int, display_vt);
buf_get_next(state_buf, int, display_tty_fd);
buf_get_next(state_buf, int, vt_is_active);