--- parser3/src/include/pa_common.h 2026/09/27 17:13:40 1.200 +++ parser3/src/include/pa_common.h 2026/10/18 21:05:35 1.203 @@ -8,7 +8,7 @@ #ifndef PA_COMMON_H #define PA_COMMON_H -#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.200 2026/09/27 17:13:40 moko Exp $" +#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.203 2026/10/18 21:05:35 moko Exp $" #include "pa_string.h" #include "pa_hash.h" @@ -50,13 +50,9 @@ extern const String content_disposition_ class Value; typedef HASH_STRING HashStringValue; -// replace system s*nprintf with our versions -#undef vsnprintf +/// use instead of system *snprintf: zero-terminated, returns the real length (<= size-1) int pa_vsnprintf(char *, size_t, const char* , va_list); -#define vsnprintf pa_vsnprintf -#undef snprintf int pa_snprintf(char *, size_t, const char* , ...); -#define snprintf pa_snprintf #ifdef _MSC_VER @@ -102,9 +98,10 @@ inline int pa_strncasecmp(const char* st return strncasecmp(str, substr, count ? count : strlen(substr)); } -#ifdef WIN32 -void back_slashes_to_slashes(char *s); -#endif +// copy of the path with '/' only +char* backslashes_to_slashes(const char* path); +// same, keeping the original languages +const String& backslashes_to_slashes(const String& path); size_t strpos(const char *str, const char *substr); @@ -113,7 +110,7 @@ size_t remove_crlf(char *start, char *en inline bool pa_isalpha(unsigned char c) { return (((c>='A') && (c<='Z')) || ((c>='a') && (c<='z'))); } inline bool pa_isalnum(unsigned char c) { return (((c>='0') && (c<='9')) || pa_isalpha(c)); } -void pa_strncpy(char *dst, const char *src, size_t n); +void pa_strncpy(char *dst, const char *src, size_t dst_size); char *pa_strcat(const char *a, const char *b, const char *c = 0); const char* capitalize(const char* s);