--- parser3/src/include/pa_common.h 2016/07/25 17:16:36 1.164 +++ parser3/src/include/pa_common.h 2016/12/24 22:53:30 1.169 @@ -8,7 +8,7 @@ #ifndef PA_COMMON_H #define PA_COMMON_H -#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.164 2016/07/25 17:16:36 moko Exp $" +#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.169 2016/12/24 22:53:30 moko Exp $" #include "pa_string.h" #include "pa_hash.h" @@ -55,11 +55,11 @@ typedef HASH_STRING HashStringVa // replace system s*nprintf with our versions #undef vsnprintf -int __vsnprintf(char *, size_t, const char* , va_list); -#define vsnprintf __vsnprintf +int pa_vsnprintf(char *, size_t, const char* , va_list); +#define vsnprintf pa_vsnprintf #undef snprintf -int __snprintf(char *, size_t, const char* , ...); -#define snprintf __snprintf +int pa_snprintf(char *, size_t, const char* , ...); +#define snprintf pa_snprintf #ifdef _MSC_VER @@ -203,12 +203,7 @@ bool dir_exists(const String& file_spec) const String* file_exist(const String& path, const String& name); bool file_executable(const String& file_spec); -bool file_stat(const String& file_spec, - size_t& rsize, - time_t& ratime, - time_t& rmtime, - time_t& rctime, - bool fail_on_read_problem=true); +bool file_stat(const String& file_spec, uint64_t& rsize, time_t& ratime, time_t& rmtime, time_t& rctime, bool fail_on_read_problem=true); size_t stdout_write(const void *buf, size_t size); @@ -220,8 +215,6 @@ int file_block_read(const int f, unsigne String related functions */ -const char* capitalize(const char* s); - /** under WIN32 "t" mode fixes DOS chars OK, can't say that about other systems/ line break styles */ @@ -231,6 +224,7 @@ char *getrow(char **row_ref,char delim=' char *lsplit(char *string, char delim); char *lsplit(char **string_ref,char delim); char *rsplit(char *string, char delim); + const char* format(double value, const char *fmt); char* unescape_chars(const char* cp, int len, Charset* client_charset=0, bool js=false/*true==decode \uXXXX and don't convert '+' to space*/); @@ -249,13 +243,12 @@ size_t strpos(const char *str, const cha int remove_crlf(char *start, char *end); -inline bool pa_isalpha(unsigned char c) { - return (((c>='A') && (c<='Z')) || ((c>='a') && (c<='z'))); -} +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)); } -inline bool pa_isalnum(unsigned char c) { - return (((c>='0') && (c<='9')) || pa_isalpha(c)); -} +const char* capitalize(const char* s); +char *str_lower(const char *s, size_t helper_length=0); +char *str_upper(const char *s, size_t helper_length=0); const char* hex_string(unsigned char* bytes, size_t size, bool upcase); extern const char* hex_digits; @@ -267,8 +260,8 @@ char* pa_base64_encode(const String& fil const char *pa_idna_encode(const char *in, Charset &source); const char *pa_idna_decode(const char *in, Charset &source); -const unsigned long pa_crc32(const char *in, size_t in_size); -const unsigned long pa_crc32(const String& file_spec); +unsigned long pa_crc32(const char *in, size_t in_size); +unsigned long pa_crc32(const String& file_spec); /** Mix functions @@ -309,7 +302,7 @@ extern const String file_status_name; #ifndef DOXYGEN enum Table2hash_distint { D_ILLEGAL, D_FIRST }; -enum Table2hash_value_type { C_HASH, C_STRING, C_TABLE }; +enum Table2hash_value_type { C_HASH, C_STRING, C_TABLE, C_CODE }; #endif #endif