# HG changeset patch # User Mike Becker # Date 1350038814 -7200 # Node ID dc8bade7f2a3cdd997a185c85dc9ca129b2b603d # Parent f15c7d6aebb93d529c40c4f10eae7870a78404a2 made the code work with g++ and without warnings diff -r f15c7d6aebb9 -r dc8bade7f2a3 test/string_tests.c --- a/test/string_tests.c Fri Oct 12 12:12:59 2012 +0200 +++ b/test/string_tests.c Fri Oct 12 12:46:54 2012 +0200 @@ -5,8 +5,8 @@ #include "string_tests.h" UCX_TEST_IMPLEMENT(test_sstr) { - sstr_t s1 = sstr("1234"); - sstr_t s2 = sstrn("ab", 2); + sstr_t s1 = sstr((char*)"1234"); + sstr_t s2 = sstrn((char*)"ab", 2); UCX_TEST_BEGIN @@ -17,9 +17,9 @@ } UCX_TEST_IMPLEMENT(test_sstr_len_cat) { - sstr_t s1 = sstr("1234"); - sstr_t s2 = sstr(".:.:."); - sstr_t s3 = sstr("X"); + sstr_t s1 = S("1234"); + sstr_t s2 = S(".:.:."); + sstr_t s3 = S("X"); sstr_t cat; @@ -54,7 +54,7 @@ UCX_TEST_IMPLEMENT(test_sstrsplit) { const char *original = "this,is,a,csv,string"; - sstr_t test = sstr("this,is,a,csv,string"); /* use copy of original here */ + sstr_t test = S("this,is,a,csv,string"); /* use copy of original here */ size_t n; sstr_t *list; diff -r f15c7d6aebb9 -r dc8bade7f2a3 ucx/string.h --- a/ucx/string.h Fri Oct 12 12:12:59 2012 +0200 +++ b/ucx/string.h Fri Oct 12 12:46:54 2012 +0200 @@ -12,8 +12,8 @@ #include /* use macros for literals only */ -#define S(s) { s, sizeof(s)-1 } -#define ST(s) sstrn(s, sizeof(s)-1) +#define S(s) { (char*)s, sizeof(s)-1 } +#define ST(s) sstrn((char*)s, sizeof(s)-1) #ifdef __cplusplus extern "C" {