From cf6ba06cd445f1f4554701637d5bab581acfba98 Mon Sep 17 00:00:00 2001 From: dartraiden Date: Mon, 21 Apr 2025 09:33:29 +0300 Subject: libcurl: update to 8.13.0 --- libs/libcurl/src/strparse.h | 60 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) (limited to 'libs/libcurl/src/strparse.h') diff --git a/libs/libcurl/src/strparse.h b/libs/libcurl/src/strparse.h index 1d4d02638d..01c696c277 100644 --- a/libs/libcurl/src/strparse.h +++ b/libs/libcurl/src/strparse.h @@ -33,39 +33,79 @@ #define STRE_BYTE 5 #define STRE_NEWLINE 6 #define STRE_OVERFLOW 7 +#define STRE_NO_NUM 8 +/* public struct, but all accesses should be done using the provided + functions */ struct Curl_str { - char *str; + const char *str; size_t len; }; +void Curl_str_init(struct Curl_str *out); +void Curl_str_assign(struct Curl_str *out, const char *str, size_t len); + +#define Curl_str(x) ((x)->str) +#define Curl_strlen(x) ((x)->len) + /* Get a word until the first space return non-zero on error */ -int Curl_str_word(char **linep, struct Curl_str *out, const size_t max); +int Curl_str_word(const char **linep, struct Curl_str *out, const size_t max); /* Get a word until the first DELIM or end of string return non-zero on error */ -int Curl_str_until(char **linep, struct Curl_str *out, const size_t max, +int Curl_str_until(const char **linep, struct Curl_str *out, const size_t max, char delim); +/* Get a word until a newline byte or end of string. At least one byte long. + return non-zero on error */ +int Curl_str_untilnl(const char **linep, struct Curl_str *out, + const size_t max); + /* Get a "quoted" word. No escaping possible. return non-zero on error */ -int Curl_str_quotedword(char **linep, struct Curl_str *out, const size_t max); +int Curl_str_quotedword(const char **linep, struct Curl_str *out, + const size_t max); /* Advance over a single character. return non-zero on error */ -int Curl_str_single(char **linep, char byte); +int Curl_str_single(const char **linep, char byte); /* Advance over a single space. return non-zero on error */ -int Curl_str_singlespace(char **linep); +int Curl_str_singlespace(const char **linep); -/* Get an unsigned number - return non-zero on error */ -int Curl_str_number(char **linep, size_t *nump, size_t max); +/* Get an unsigned decimal number. Return non-zero on error */ +int Curl_str_number(const char **linep, curl_off_t *nump, curl_off_t max); + +/* As above with CURL_OFF_T_MAX but also pass leading blanks */ +int Curl_str_numblanks(const char **str, curl_off_t *num); + +/* Get an unsigned hexadecimal number. Return non-zero on error */ +int Curl_str_hex(const char **linep, curl_off_t *nump, curl_off_t max); + +/* Get an unsigned octal number. Return non-zero on error */ +int Curl_str_octal(const char **linep, curl_off_t *nump, curl_off_t max); /* Check for CR or LF return non-zero on error */ -int Curl_str_newline(char **linep); +int Curl_str_newline(const char **linep); + +/* case insensitive compare that the parsed string matches the + given string. */ +int Curl_str_casecompare(struct Curl_str *str, const char *check); +int Curl_str_cmp(struct Curl_str *str, const char *check); + +int Curl_str_nudge(struct Curl_str *str, size_t num); + +int Curl_str_cspn(const char **linep, struct Curl_str *out, const char *cspn); +void Curl_str_trimblanks(struct Curl_str *out); +void Curl_str_passblanks(const char **linep); + +#define curlx_str_number(x,y,z) Curl_str_number(x,y,z) +#define curlx_str_octal(x,y,z) Curl_str_octal(x,y,z) +#define curlx_str_single(x,y) Curl_str_single(x,y) +#define curlx_str_passblanks(x) Curl_str_passblanks(x) +#define curlx_str_numblanks(x,y) Curl_str_numblanks(x,y) #endif /* HEADER_CURL_STRPARSE_H */ -- cgit v1.2.3