From d92e264ff0c15294ded048f33d8cf34b1b7846c3 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 22 Dec 2025 00:48:33 +0100 Subject: [PATCH] curlx: rename `Curl_`-prefixed symbols to `curlx_` Closes #20069 --- lib/curlx/base64.c | 4 ++-- lib/curlx/base64.h | 2 +- lib/curlx/inet_pton.c | 2 +- lib/curlx/strparse.c | 8 ++++---- lib/curlx/strparse.h | 4 ++-- lib/escape.c | 4 ++-- lib/mime.c | 14 +++++++------- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/curlx/base64.c b/lib/curlx/base64.c index 6635fc328c..0e44eae7fa 100644 --- a/lib/curlx/base64.c +++ b/lib/curlx/base64.c @@ -29,7 +29,7 @@ #include "base64.h" /* ---- Base64 Encoding/Decoding Table --- */ -const char Curl_base64encdec[] = +const char curlx_base64encdec[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /* The Base 64 encoding with a URL and filename safe alphabet, RFC 4648 @@ -241,7 +241,7 @@ static CURLcode base64_encode(const char *table64, CURLcode curlx_base64_encode(const uint8_t *inputbuff, size_t insize, char **outptr, size_t *outlen) { - return base64_encode(Curl_base64encdec, '=', + return base64_encode(curlx_base64encdec, '=', inputbuff, insize, outptr, outlen); } diff --git a/lib/curlx/base64.h b/lib/curlx/base64.h index 3c97ecc9fe..2e77814822 100644 --- a/lib/curlx/base64.h +++ b/lib/curlx/base64.h @@ -31,7 +31,7 @@ CURLcode curlx_base64url_encode(const uint8_t *inputbuff, size_t insize, CURLcode curlx_base64_decode(const char *src, uint8_t **outptr, size_t *outlen); -extern const char Curl_base64encdec[]; +extern const char curlx_base64encdec[]; /* maximum input length acceptable to base64 encode, here to catch and prevent mistakes */ diff --git a/lib/curlx/inet_pton.c b/lib/curlx/inet_pton.c index 5d8d3be8b7..8d356bb3d4 100644 --- a/lib/curlx/inet_pton.c +++ b/lib/curlx/inet_pton.c @@ -169,7 +169,7 @@ static int inet_pton6(const char *src, unsigned char *dst) while((ch = *src++) != '\0') { if(ISXDIGIT(ch)) { val <<= 4; - val |= Curl_hexval(ch); + val |= curlx_hexval(ch); if(++saw_xdigit > 4) return 0; continue; diff --git a/lib/curlx/strparse.c b/lib/curlx/strparse.c index e75173c69b..66c749b916 100644 --- a/lib/curlx/strparse.c +++ b/lib/curlx/strparse.c @@ -136,12 +136,12 @@ int curlx_str_singlespace(const char **linep) /* given an ASCII character and max ascii, return TRUE if valid */ #define valid_digit(x, m) \ - (((x) >= '0') && ((x) <= m) && Curl_hexasciitable[(x) - '0']) + (((x) >= '0') && ((x) <= m) && curlx_hexasciitable[(x) - '0']) /* We use 16 for the zero index (and the necessary bitwise AND in the loop) to be able to have a non-zero value there to make valid_digit() able to use the info */ -const unsigned char Curl_hexasciitable[] = { +const unsigned char curlx_hexasciitable[] = { 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 0x30: 0 - 9 */ 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, /* 0x41: A - F */ @@ -167,7 +167,7 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max, if(max < base) { /* special-case low max scenario because check needs to be different */ do { - int n = Curl_hexval(*p++); + int n = curlx_hexval(*p++); num = num * base + n; if(num > max) return STRE_OVERFLOW; @@ -175,7 +175,7 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max, } else { do { - int n = Curl_hexval(*p++); + int n = curlx_hexval(*p++); if(num > ((max - n) / base)) return STRE_OVERFLOW; num = num * base + n; diff --git a/lib/curlx/strparse.h b/lib/curlx/strparse.h index 7fb90ac40f..27fea2957e 100644 --- a/lib/curlx/strparse.h +++ b/lib/curlx/strparse.h @@ -106,7 +106,7 @@ void curlx_str_passblanks(const char **linep); returns 10. THIS ONLY WORKS ON VALID HEXADECIMAL LETTER INPUT. Verify before calling this! */ -extern const unsigned char Curl_hexasciitable[]; -#define Curl_hexval(x) (unsigned char)(Curl_hexasciitable[(x) - '0'] & 0x0f) +extern const unsigned char curlx_hexasciitable[]; +#define curlx_hexval(x) (unsigned char)(curlx_hexasciitable[(x) - '0'] & 0x0f) #endif /* HEADER_CURL_STRPARSE_H */ diff --git a/lib/escape.c b/lib/escape.c index f9f69a8000..2e38301d9c 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -125,8 +125,8 @@ CURLcode Curl_urldecode(const char *string, size_t length, if(('%' == in) && (alloc > 2) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { /* this is two hexadecimal digits following a '%' */ - in = (unsigned char)((Curl_hexval(string[1]) << 4) | - Curl_hexval(string[2])); + in = (unsigned char)((curlx_hexval(string[1]) << 4) | + curlx_hexval(string[2])); string += 3; alloc -= 3; } diff --git a/lib/mime.c b/lib/mime.c index 393d709ed5..b6b64fd10f 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -453,10 +453,10 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof, i = st->buf[st->bufbeg++] & 0xFF; i = (i << 8) | (st->buf[st->bufbeg++] & 0xFF); i = (i << 8) | (st->buf[st->bufbeg++] & 0xFF); - *ptr++ = Curl_base64encdec[(i >> 18) & 0x3F]; - *ptr++ = Curl_base64encdec[(i >> 12) & 0x3F]; - *ptr++ = Curl_base64encdec[(i >> 6) & 0x3F]; - *ptr++ = Curl_base64encdec[i & 0x3F]; + *ptr++ = curlx_base64encdec[(i >> 18) & 0x3F]; + *ptr++ = curlx_base64encdec[(i >> 12) & 0x3F]; + *ptr++ = curlx_base64encdec[(i >> 6) & 0x3F]; + *ptr++ = curlx_base64encdec[i & 0x3F]; cursize += 4; st->pos += 4; size -= 4; @@ -480,10 +480,10 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof, i = (st->buf[st->bufbeg + 1] & 0xFF) << 8; i |= (st->buf[st->bufbeg] & 0xFF) << 16; - ptr[0] = Curl_base64encdec[(i >> 18) & 0x3F]; - ptr[1] = Curl_base64encdec[(i >> 12) & 0x3F]; + ptr[0] = curlx_base64encdec[(i >> 18) & 0x3F]; + ptr[1] = curlx_base64encdec[(i >> 12) & 0x3F]; if(++st->bufbeg != st->bufend) { - ptr[2] = Curl_base64encdec[(i >> 6) & 0x3F]; + ptr[2] = curlx_base64encdec[(i >> 6) & 0x3F]; st->bufbeg++; } cursize += 4;