diff -r bf3695fee719 -r 481802342fdf libidav/utils.c --- a/libidav/utils.c Mon Feb 04 14:11:57 2019 +0100 +++ b/libidav/utils.c Mon Feb 04 17:17:48 2019 +0100 @@ -387,9 +387,9 @@ return url.ptr; } -char* util_get_url(DavSession *sn, char *href) { - sstr_t base = sstr(sn->base_url); - sstr_t href_str = sstr(href); +char* util_get_url(DavSession *sn, const char *href) { + scstr_t base = scstr(sn->base_url); + scstr_t href_str = scstr(href); char *base_path = util_url_path(sn->base_url); base.length -= strlen(base_path); @@ -398,7 +398,7 @@ return url.ptr; } -void util_set_url(DavSession *sn, char *href) { +void util_set_url(DavSession *sn, const char *href) { char *url = util_get_url(sn, href); curl_easy_setopt(sn->handle, CURLOPT_URL, url); free(url); @@ -463,7 +463,7 @@ } -char* util_base64decode(char *in) { +char* util_base64decode(const char *in) { int len = 0; return util_base64decode_len(in, &len); } @@ -484,7 +484,7 @@ 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, 66,66,66,66,66,66 }; -char* util_base64decode_len(char* in, int *outlen) { +char* util_base64decode_len(const char* in, int *outlen) { /* code is mostly from wikibooks */ size_t inlen = strlen(in); @@ -494,7 +494,7 @@ unsigned char *out = (unsigned char*)outbuf; - char *end = in + inlen; + const char *end = in + inlen; char iter = 0; uint32_t buf = 0; size_t len = 0; @@ -559,7 +559,7 @@ static char* b64enctable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -char* util_base64encode(char *in, size_t len) { +char* util_base64encode(const char *in, size_t len) { // calculate length of base64 output and create buffer size_t outlen = 4 * ((len + 2) / 3); int pad = len % 3;