From c217ab36a03a9d00a790af3963d3041bf03e6985 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 24 Aug 2014 00:46:58 +0200 Subject: m + do not any assumtion of int typedefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/config.h | 2 +- src/libmdsserver/linked-list.c | 20 ++++++++++---------- src/libmdsserver/linked-list.h | 2 +- src/mds-base.c | 3 ++- src/mds-clipboard.c | 24 ++++++++++++------------ src/mds-kkbd.c | 8 ++++---- 6 files changed, 30 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/libmdsserver/config.h b/src/libmdsserver/config.h index 4cc4fc3..dbd7655 100644 --- a/src/libmdsserver/config.h +++ b/src/libmdsserver/config.h @@ -153,7 +153,7 @@ * Pattern for the names of shared object to which states are marshalled */ #ifndef SHM_PATH_PATTERN -#define SHM_PATH_PATTERN "/.proc-pid-%lu" +#define SHM_PATH_PATTERN "/.proc-pid-%ji" #endif diff --git a/src/libmdsserver/linked-list.c b/src/libmdsserver/linked-list.c index 066414a..948b0a8 100644 --- a/src/libmdsserver/linked-list.c +++ b/src/libmdsserver/linked-list.c @@ -476,31 +476,31 @@ int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data) * @param this The list * @param output Output file */ -void linked_list_dump(linked_list_t* restrict this, FILE* output) +void linked_list_dump(linked_list_t* restrict this, FILE* restrict output) { ssize_t i; size_t j; fprintf(output, "======= LINKED LIST DUMP =======\n"); - fprintf(output, "Capacity: %lu\n", this->capacity); - fprintf(output, "End: %lu\n", this->end); - fprintf(output, "Reuse head: %lu\n", this->reuse_head); - fprintf(output, "Edge: %li\n", this->edge); + fprintf(output, "Capacity: %zu\n", this->capacity); + fprintf(output, "End: %zu\n", this->end); + fprintf(output, "Reuse head: %zu\n", this->reuse_head); + fprintf(output, "Edge: %zi\n", this->edge); fprintf(output, "--------------------------------\n"); fprintf(output, "Node table (Next, Prev, Value):\n"); i = this->edge; - fprintf(output, " %li: %li, %li, %lu\n", i, this->next[i], this->previous[i], this->values[i]); + fprintf(output, " %zi: %zi, %zi, %zu\n", i, this->next[i], this->previous[i], this->values[i]); foreach_linked_list_node((*this), i) - fprintf(output, " %li: %li, %li, %lu\n", i, this->next[i], this->previous[i], this->values[i]); + fprintf(output, " %zi: %zi, %zi, %zu\n", i, this->next[i], this->previous[i], this->values[i]); i = this->edge; - fprintf(output, " %li: %li, %li, %lu\n", i, this->next[i], this->previous[i], this->values[i]); + fprintf(output, " %zi: %zi, %zi, %zu\n", i, this->next[i], this->previous[i], this->values[i]); fprintf(output, "--------------------------------\n"); fprintf(output, "Raw node table:\n"); for (j = 0; j < this->end; j++) - fprintf(output, " %lu: %li, %li, %lu\n", i, this->next[i], this->previous[i], this->values[i]); + fprintf(output, " %zu: %zi, %zi, %zu\n", i, this->next[i], this->previous[i], this->values[i]); fprintf(output, "--------------------------------\n"); fprintf(output, "Reuse stack:\n"); for (j = 0; j < this->reuse_head; j++) - fprintf(output, " %lu: %li\n", j, this->reusable[j]); + fprintf(output, " %zu: %zi\n", j, this->reusable[j]); fprintf(output, "================================\n"); } diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h index e77f33d..4edaad2 100644 --- a/src/libmdsserver/linked-list.h +++ b/src/libmdsserver/linked-list.h @@ -282,7 +282,7 @@ int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data); * @param this The list * @param output Output file */ -void linked_list_dump(linked_list_t* restrict this, FILE* output); +void linked_list_dump(linked_list_t* restrict this, FILE* restrict output); #endif diff --git a/src/mds-base.c b/src/mds-base.c index 672a1d5..b2d1935 100644 --- a/src/mds-base.c +++ b/src/mds-base.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -358,7 +359,7 @@ static int base_unmarshal(void) char* state_buf_; /* Acquire access to marshalled data. */ - xsnprintf(shm_path, SHM_PATH_PATTERN, (unsigned long int)pid); + xsnprintf(shm_path, SHM_PATH_PATTERN, (intmax_t)pid); reexec_fd = shm_open(shm_path, O_RDONLY, S_IRWXU); fail_if (reexec_fd < 0); /* Critical. */ diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c index cc4fc2d..c700b6c 100644 --- a/src/mds-clipboard.c +++ b/src/mds-clipboard.c @@ -568,9 +568,9 @@ static int clipboard_notify_pop(int level, size_t index) "Event: crash\n" "Message ID: %" PRIi32 "\n" "Level: %i\n" - "Popped: %lu\n" - "Size: %lu\n" - "Used: %lu\n" + "Popped: %zu\n" + "Size: %zu\n" + "Used: %zu\n" "\n"); if (xmalloc(message, n, char)) @@ -581,9 +581,9 @@ static int clipboard_notify_pop(int level, size_t index) "Event: crash\n" "Message ID: %" PRIi32 "\n" "Level: %i\n" - "Popped: %lu\n" - "Size: %lu\n" - "Used: %lu\n" + "Popped: %zu\n" + "Size: %zu\n" + "Used: %zu\n" "\n", message_id, level, index, size, used); @@ -762,7 +762,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" - "Length: %lu\n" + "Length: %zu\n" "\n"); n += strlen(recv_client_id) + strlen(recv_message_id) + 10 + 3 * sizeof(size_t); @@ -772,7 +772,7 @@ int clipboard_read(int level, size_t index, const char* recv_client_id, const ch "To: %s\n" "In response to: %s\n" "Message ID: %" PRIi32 "\n" - "Length: %lu\n" + "Length: %zu\n" "\n", recv_client_id, recv_message_id, message_id, clip->length); @@ -866,8 +866,8 @@ 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" - "Size: %lu\n" - "Used: %lu\n" + "Size: %zu\n" + "Used: %zu\n" "\n"); n += strlen(recv_client_id) + strlen(recv_message_id) + 10 + 2 * 3 * sizeof(size_t); @@ -876,8 +876,8 @@ int clipboard_get_size(int level, const char* recv_client_id, const char* recv_m "To: %s\n" "In response to: %s\n" "Message ID: %" PRIi32 "\n" - "Size: %lu\n" - "Used: %lu\n" + "Size: %zu\n" + "Used: %zu\n" "\n", recv_client_id, recv_message_id, message_id, clipboard_size[level], clipboard_used[level]); diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c index 842da90..690f3d9 100644 --- a/src/mds-kkbd.c +++ b/src/mds-kkbd.c @@ -646,7 +646,7 @@ int handle_enumerate_keyboards(const char* recv_client_id, const char* recv_mess "Command: keyboard-enumeration\n" "To: %s\n" "In response to: %s\n" - "Length: %lu\n" + "Length: %zu\n" "Message ID: %" PRIi32 "\n" "\n" KEYBOARD_ID "\n", @@ -702,7 +702,7 @@ int handle_keyboard_enumeration(const char* recv_modify_id) { have_len = 1; sprintf(send_buffer + n, - "Length: %lu\n", + "Length: %zu\n", strlen(KEYBOARD_ID "\n") + received.payload_size); n += strlen(send_buffer + n); } @@ -721,7 +721,7 @@ int handle_keyboard_enumeration(const char* recv_modify_id) sprintf(send_buffer, "Modify ID: %s\n" "Message ID: %" PRIi32 "\n" - "Length: %lu\n", + "Length: %zu\n", recv_modify_id, msgid, n); top = strlen(send_buffer) + 1; send_buffer[top - 1] = '\n'; @@ -1058,7 +1058,7 @@ static int mapping_query(const char* recv_client_id, const char* recv_message_id "To: %s\n" "In response to: %s\n" "Message ID: %" PRIi32 "\n" - "Length: %lu\n" + "Length: %zu\n" "\n", recv_client_id, recv_message_id, msgid, n); -- cgit v1.2.3-70-g09d2