# HG changeset patch # User Mike Becker # Date 1529590219 -7200 # Node ID 2bf1da3c411e69442e074f72fadbd38989df8179 # Parent fbc33813265b21856464351f79969a23cbfba26b makes g++ happy again diff -r fbc33813265b -r 2bf1da3c411e src/logging.c --- a/src/logging.c Thu Jun 21 16:00:37 2018 +0200 +++ b/src/logging.c Thu Jun 21 16:10:19 2018 +0200 @@ -71,12 +71,12 @@ const unsigned int line, const char *format, ...) { if (level <= logger->level) { char msg[UCX_LOGGER_MSGMAX]; - char *text; + const char *text; size_t k = 0; size_t n; if ((logger->mask & UCX_LOGGER_LEVEL) > 0) { - text = (char*) ucx_map_int_get(logger->levels, level); + text = (const char*) ucx_map_int_get(logger->levels, level); if (!text) { text = "[UNKNOWN]"; } diff -r fbc33813265b -r 2bf1da3c411e src/map.c --- a/src/map.c Thu Jun 21 16:00:37 2018 +0200 +++ b/src/map.c Thu Jun 21 16:10:19 2018 +0200 @@ -154,7 +154,7 @@ UcxAllocator *allocator = map->allocator; if (key.hash == 0) { - key.hash = ucx_hash(key.data, key.len); + key.hash = ucx_hash((const char*)key.data, key.len); } struct UcxMapKey mapkey; @@ -203,7 +203,7 @@ static void* ucx_map_get_and_remove(UcxMap *map, UcxKey key, int remove) { if(key.hash == 0) { - key.hash = ucx_hash((char*)key.data, key.len); + key.hash = ucx_hash((const char*)key.data, key.len); } size_t slot = key.hash%map->size; @@ -247,7 +247,7 @@ UcxKey key; key.data = data; key.len = len; - key.hash = ucx_hash(data, len); + key.hash = ucx_hash((const char*)data, len); return key; } diff -r fbc33813265b -r 2bf1da3c411e src/ucx/string.h --- a/src/ucx/string.h Thu Jun 21 16:00:37 2018 +0200 +++ b/src/ucx/string.h Thu Jun 21 16:10:19 2018 +0200 @@ -124,7 +124,7 @@ inline scstr_t s2scstr(sstr_t s) { scstr_t c; c.ptr = s.ptr; - c.length = s.ptr; + c.length = s.length; return c; } diff -r fbc33813265b -r 2bf1da3c411e src/ucx/utils.h --- a/src/ucx/utils.h Thu Jun 21 16:00:37 2018 +0200 +++ b/src/ucx/utils.h Thu Jun 21 16:10:19 2018 +0200 @@ -38,10 +38,6 @@ #ifndef UCX_UTILS_H #define UCX_UTILS_H -#ifdef __cplusplus -extern "C" { -#endif - #include "ucx.h" #include "string.h" #include "allocator.h" @@ -49,6 +45,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * Default buffer size for ucx_stream_copy() and ucx_stream_ncopy(). */