From 01098e207888bf6986dd46f601989bf7fb6c7260 Mon Sep 17 00:00:00 2001 From: thorkill Date: Tue, 30 Jun 2015 18:09:11 +0200 Subject: [PATCH] Revert "Fixing implicit conversion changes to signedness" This reverts commit 7099a4437e84740d2e5cc6242561b3fd894ff802. --- src/logger.c | 4 ++-- src/meta.c | 19 +++++++------------ src/meta.h | 6 +++--- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/logger.c b/src/logger.c index 9e060dec..2fbb9095 100644 --- a/src/logger.c +++ b/src/logger.c @@ -96,8 +96,8 @@ static void real_logger(int level, int priority, const char *message) { logcontrol = true; if(level > (c->outcompression >= 0 ? (int)c->outcompression : (int)debug_level)) continue; - size_t len = strlen(message); - if(send_request(c, "%d %d %zu", CONTROL, REQ_LOG, len)) + int len = strlen(message); + if(send_request(c, "%d %d %d", CONTROL, REQ_LOG, len)) send_meta(c, message, len); } suppress = false; diff --git a/src/meta.c b/src/meta.c index d09c9a58..35672a78 100644 --- a/src/meta.c +++ b/src/meta.c @@ -48,22 +48,17 @@ bool send_meta_sptps(void *handle, uint8_t type, const void *buffer, size_t leng return true; } -bool send_meta(connection_t *c, const char *buffer, size_t length) { +bool send_meta(connection_t *c, const char *buffer, int length) { if(!c) { logger(DEBUG_ALWAYS, LOG_ERR, "send_meta() called with NULL pointer!"); abort(); } - logger(DEBUG_META, LOG_DEBUG, "Sending %zu bytes of metadata to %s (%s)", length, + logger(DEBUG_META, LOG_DEBUG, "Sending %d bytes of metadata to %s (%s)", length, c->name, c->hostname); - if(c->protocol_minor >= 2) { - if (length > UINT16_MAX) { - logger(DEBUG_ALWAYS, LOG_ERR, "send_meta() aborting due to length %zu >= %d!", length, UINT16_MAX); - abort(); - } - return sptps_send_record(&c->sptps, 0, buffer, (uint16_t)length); - } + if(c->protocol_minor >= 2) + return sptps_send_record(&c->sptps, 0, buffer, length); /* Add our data to buffer */ if(c->status.encryptout) { @@ -87,13 +82,13 @@ bool send_meta(connection_t *c, const char *buffer, size_t length) { return true; } -void send_meta_raw(connection_t *c, const char *buffer, size_t length) { +void send_meta_raw(connection_t *c, const char *buffer, int length) { if(!c) { logger(DEBUG_ALWAYS, LOG_ERR, "send_meta() called with NULL pointer!"); abort(); } - logger(DEBUG_META, LOG_DEBUG, "Sending %zu bytes of raw metadata to %s (%s)", length, + logger(DEBUG_META, LOG_DEBUG, "Sending %d bytes of raw metadata to %s (%s)", length, c->name, c->hostname); buffer_add(&c->outbuf, buffer, length); @@ -101,7 +96,7 @@ void send_meta_raw(connection_t *c, const char *buffer, size_t length) { io_set(&c->io, IO_READ | IO_WRITE); } -void broadcast_meta(connection_t *from, const char *buffer, size_t length) { +void broadcast_meta(connection_t *from, const char *buffer, int length) { for list_each(connection_t, c, connection_list) if(c != from && c->edge) send_meta(c, buffer, length); diff --git a/src/meta.h b/src/meta.h index 4ec36fff..8b00a5ab 100644 --- a/src/meta.h +++ b/src/meta.h @@ -23,11 +23,11 @@ #include "connection.h" -extern bool send_meta(struct connection_t *, const char *, size_t); -extern void send_meta_raw(struct connection_t *, const char *, size_t); +extern bool send_meta(struct connection_t *, const char *, int); +extern void send_meta_raw(struct connection_t *, const char *, int); extern bool send_meta_sptps(void *, uint8_t, const void *, size_t); extern bool receive_meta_sptps(void *, uint8_t, const void *, uint16_t); -extern void broadcast_meta(struct connection_t *, const char *, size_t); +extern void broadcast_meta(struct connection_t *, const char *, int); extern bool receive_meta(struct connection_t *); #endif /* __TINC_META_H__ */