--- parser3/src/include/pa_common.h 2016/07/29 13:30:41 1.166 +++ parser3/src/include/pa_common.h 2017/01/23 09:33:02 1.172 @@ -8,7 +8,7 @@ #ifndef PA_COMMON_H #define PA_COMMON_H -#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.166 2016/07/29 13:30:41 moko Exp $" +#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.172 2017/01/23 09:33:02 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 @@ -77,6 +77,15 @@ int __snprintf(char *, size_t, const cha # define strncasecmp _strnicmp #endif +#define stat __stat64 +#define pa_stat _stat64 +#define pa_fstat _fstat64 + +#else + +#define pa_stat stat +#define pa_fstat fstat + #endif /** @@ -203,7 +212,8 @@ 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 check_file_size(uint64_t size, const String& file_spec); size_t stdout_write(const void *buf, size_t size); @@ -260,8 +270,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 @@ -269,15 +279,6 @@ const unsigned long pa_crc32(const Strin #define PA_DEFAULT(A,B) ((A) ? (A):(B) ) -// some stuff for use with .for_each -static void copy_all_overwrite_to(HashStringValue::key_type key, HashStringValue::value_type value, HashStringValue* dest) { - dest->put(key, value); -} - -static void remove_key_from(HashStringValue::key_type key, HashStringValue::value_type /*value*/, HashStringValue* dest) { - dest->remove(key); -} - Charset* detect_charset(const char* content_type); // globals