Revert "Fixing implicit conversion changes to signedness"

This reverts commit 7099a4437e.
This commit is contained in:
thorkill 2015-06-30 18:09:11 +02:00
parent 4f82a6359f
commit 01098e2078
3 changed files with 12 additions and 17 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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__ */