From 7d9a80326dc3b14b1a04362eb18e635d9d41a27e Mon Sep 17 00:00:00 2001 From: Phenom Date: Tue, 18 Apr 2017 11:18:10 +0200 Subject: [PATCH 1/2] Fix Clang warnings: bdnet_inet_ntoa C-linkage /libbitdht/src/util/bdnet.h:107: warning: 'bdnet_inet_ntoa' has C- linkage specified, but returns user-defined type 'std::string' (aka 'basic_string') which is incompatible with C [-Wreturn-type-c- linkage] std::string bdnet_inet_ntoa(struct in_addr in); ^ --- libbitdht/src/util/bdnet.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libbitdht/src/util/bdnet.h b/libbitdht/src/util/bdnet.h index 9b9d36f48..7e3e24644 100644 --- a/libbitdht/src/util/bdnet.h +++ b/libbitdht/src/util/bdnet.h @@ -103,8 +103,6 @@ int bdnet_inet_aton(const char *name, struct in_addr *addr); int bdnet_checkTTL(int fd); void bdsockaddr_clear(struct sockaddr_in *addr); -/* thread-safe version of inet_ntoa */ -std::string bdnet_inet_ntoa(struct in_addr in); /* Extra stuff to declare for windows error handling (mimics unix errno) */ @@ -175,4 +173,7 @@ int usleep(unsigned int usec); } /* C Interface */ #endif +/* thread-safe version of inet_ntoa */ +std::string bdnet_inet_ntoa(struct in_addr in); + #endif /* BITDHT_UNIVERSAL_NETWORK_HEADER */ From 37331372c145d24291d5e53ac45acd426ef4ee4d Mon Sep 17 00:00:00 2001 From: Phenom Date: Tue, 18 Apr 2017 11:25:41 +0200 Subject: [PATCH 2/2] Fix Clang warnings: implicit conversion warning: implicit conversion from 'int' to 'char' changes value from 255 to -1 [-Wconstant-conversion] asctobin()[i] = 255; /* used to detect invalid characters */ --- libretroshare/src/util/radix64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/util/radix64.h b/libretroshare/src/util/radix64.h index 9ee80f2dd..7776995f9 100644 --- a/libretroshare/src/util/radix64.h +++ b/libretroshare/src/util/radix64.h @@ -147,7 +147,7 @@ again: private: static inline char *bintoasc() { static char bta[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; return bta ; } - static inline char *asctobin() { static char s[256]; return s ; } /* runtime radix64_initd */ + static inline uint8_t *asctobin() { static uint8_t s[256]; return s ; } /* runtime radix64_initd */ static int& is_radix64_initd() { static int is_inited = false ; return is_inited ; } /* hey, guess what: this is a read-only table.