Kaynağa Gözat

将工程转换为VS2022,支持更高版本C++。VS2008不支持C++11以上语法,部分功能实现困难。

JeffWang 2 yıl önce
ebeveyn
işleme
1c3f128f3a

Dosya farkı çok büyük olduğundan ihmal edildi
+ 351 - 216
Source/OGCAssistTool/Include/curl/curl.h


+ 12 - 12
Source/OGCAssistTool/Include/curl/curlver.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_CURLVER_H
-#define __CURL_CURLVER_H
+#ifndef CURLINC_CURLVER_H
+#define CURLINC_CURLVER_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -26,20 +26,20 @@
    a script at release-time. This was made its own header file in 7.11.2 */
 
 /* This is the global package copyright */
-#define LIBCURL_COPYRIGHT "1996 - 2019 Daniel Stenberg, <daniel@haxx.se>."
+#define LIBCURL_COPYRIGHT "1996 - 2021 Daniel Stenberg, <daniel@haxx.se>."
 
 /* This is the version number of the libcurl package from which this header
    file origins: */
-#define LIBCURL_VERSION "7.65.3"
+#define LIBCURL_VERSION "7.80.0"
 
 /* The numeric version number is also available "in parts" by using these
    defines: */
 #define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 65
-#define LIBCURL_VERSION_PATCH 3
+#define LIBCURL_VERSION_MINOR 80
+#define LIBCURL_VERSION_PATCH 0
 
 /* This is the numeric version of the libcurl version number, meant for easier
-   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
+   parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
    always follow this syntax:
 
          0xXXYYZZ
@@ -57,7 +57,7 @@
    CURL_VERSION_BITS() macro since curl's own configure script greps for it
    and needs it to contain the full number.
 */
-#define LIBCURL_VERSION_NUM 0x074103
+#define LIBCURL_VERSION_NUM 0x075000
 
 /*
  * This is the date and time when the full source package was created. The
@@ -68,10 +68,10 @@
  *
  * "2007-11-23"
  */
-#define LIBCURL_TIMESTAMP "2019-07-19"
+#define LIBCURL_TIMESTAMP "2021-11-10"
 
 #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
 #define CURL_AT_LEAST_VERSION(x,y,z) \
   (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
 
-#endif /* __CURL_CURLVER_H */
+#endif /* CURLINC_CURLVER_H */

+ 15 - 4
Source/OGCAssistTool/Include/curl/easy.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_EASY_H
-#define __CURL_EASY_H
+#ifndef CURLINC_EASY_H
+#define CURLINC_EASY_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -25,6 +25,17 @@
 extern "C" {
 #endif
 
+/* Flag bits in the curl_blob struct: */
+#define CURL_BLOB_COPY   1 /* tell libcurl to copy the data */
+#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
+
+struct curl_blob {
+  void *data;
+  size_t len;
+  unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
+                         left zeroes */
+};
+
 CURL_EXTERN CURL *curl_easy_init(void);
 CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
 CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);

+ 5 - 5
Source/OGCAssistTool/Include/curl/mprintf.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_MPRINTF_H
-#define __CURL_MPRINTF_H
+#ifndef CURLINC_MPRINTF_H
+#define CURLINC_MPRINTF_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -47,4 +47,4 @@ CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
 }
 #endif
 
-#endif /* __CURL_MPRINTF_H */
+#endif /* CURLINC_MPRINTF_H */

+ 56 - 41
Source/OGCAssistTool/Include/curl/multi.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_MULTI_H
-#define __CURL_MULTI_H
+#ifndef CURLINC_MULTI_H
+#define CURLINC_MULTI_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -72,6 +72,8 @@ typedef enum {
                             attempted to get added - again */
   CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
                                callback */
+  CURLM_WAKEUP_FAILURE,  /* wakeup is unavailable or failed */
+  CURLM_BAD_FUNCTION_ARGUMENT,  /* function called with a bad parameter */
   CURLM_LAST
 } CURLMcode;
 
@@ -173,6 +175,29 @@ CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
                                       int timeout_ms,
                                       int *ret);
 
+/*
+ * Name:     curl_multi_poll()
+ *
+ * Desc:     Poll on all fds within a CURLM set as well as any
+ *           additional fds passed to the function.
+ *
+ * Returns:  CURLMcode type, general multi error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
+                                      struct curl_waitfd extra_fds[],
+                                      unsigned int extra_nfds,
+                                      int timeout_ms,
+                                      int *ret);
+
+/*
+ * Name:     curl_multi_wakeup()
+ *
+ * Desc:     wakes up a sleeping curl_multi_poll call.
+ *
+ * Returns:  CURLMcode type, general multi error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
+
  /*
   * Name:    curl_multi_perform()
   *
@@ -242,7 +267,7 @@ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
  *          value into the equivalent human readable error string.  This is
  *          useful for printing meaningful error messages.
  *
- * Returns: A pointer to a zero-terminated error message.
+ * Returns: A pointer to a null-terminated error message.
  */
 CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
 
@@ -319,68 +344,56 @@ CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
 CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
                                          long *milliseconds);
 
-#undef CINIT /* re-using the same name as in curl.h */
-
-#ifdef CURL_ISOCPP
-#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
-#else
-/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
-#define LONG          CURLOPTTYPE_LONG
-#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
-#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
-#define OFF_T         CURLOPTTYPE_OFF_T
-#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
-#endif
-
 typedef enum {
   /* This is the socket callback function pointer */
-  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
+  CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
 
   /* This is the argument passed to the socket callback */
-  CINIT(SOCKETDATA, OBJECTPOINT, 2),
+  CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
 
     /* set to 1 to enable pipelining for this multi handle */
-  CINIT(PIPELINING, LONG, 3),
+  CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
 
    /* This is the timer callback function pointer */
-  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
+  CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
 
   /* This is the argument passed to the timer callback */
-  CINIT(TIMERDATA, OBJECTPOINT, 5),
+  CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
 
   /* maximum number of entries in the connection cache */
-  CINIT(MAXCONNECTS, LONG, 6),
+  CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
 
   /* maximum number of (pipelining) connections to one host */
-  CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
+  CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
 
   /* maximum number of requests in a pipeline */
-  CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
+  CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
 
   /* a connection with a content-length longer than this
      will not be considered for pipelining */
-  CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
+  CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
 
   /* a connection with a chunk length longer than this
      will not be considered for pipelining */
-  CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
+  CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
 
-  /* a list of site names(+port) that are blacklisted from
-     pipelining */
-  CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
+  /* a list of site names(+port) that are blocked from pipelining */
+  CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
 
-  /* a list of server types that are blacklisted from
-     pipelining */
-  CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
+  /* a list of server types that are blocked from pipelining */
+  CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
 
   /* maximum number of open connections in total */
-  CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
+  CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
 
    /* This is the server push callback function pointer */
-  CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
+  CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
 
   /* This is the argument passed to the server push callback */
-  CINIT(PUSHDATA, OBJECTPOINT, 15),
+  CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
+
+  /* maximum number of concurrent streams to support on a connection */
+  CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
 
   CURLMOPT_LASTENTRY /* the last unused */
 } CURLMoption;
@@ -414,12 +427,14 @@ CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
  * Name: curl_push_callback
  *
  * Desc: This callback gets called when a new stream is being pushed by the
- *       server. It approves or denies the new stream.
+ *       server. It approves or denies the new stream. It can also decide
+ *       to completely fail the connection.
  *
- * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
+ * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
  */
-#define CURL_PUSH_OK   0
-#define CURL_PUSH_DENY 1
+#define CURL_PUSH_OK       0
+#define CURL_PUSH_DENY     1
+#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
 
 struct curl_pushheaders;  /* forward declaration only */
 

+ 68 - 0
Source/OGCAssistTool/Include/curl/options.h

@@ -0,0 +1,68 @@
+#ifndef CURLINC_OPTIONS_H
+#define CURLINC_OPTIONS_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+  CURLOT_LONG,    /* long (a range of values) */
+  CURLOT_VALUES,  /*      (a defined set or bitmask) */
+  CURLOT_OFF_T,   /* curl_off_t (a range of values) */
+  CURLOT_OBJECT,  /* pointer (void *) */
+  CURLOT_STRING,  /*         (char * to zero terminated buffer) */
+  CURLOT_SLIST,   /*         (struct curl_slist *) */
+  CURLOT_CBPTR,   /*         (void * passed as-is to a callback) */
+  CURLOT_BLOB,    /* blob (struct curl_blob *) */
+  CURLOT_FUNCTION /* function pointer */
+} curl_easytype;
+
+/* Flag bits */
+
+/* "alias" means it is provided for old programs to remain functional,
+   we prefer another name */
+#define CURLOT_FLAG_ALIAS (1<<0)
+
+/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
+   to use for curl_easy_setopt() for the given id */
+struct curl_easyoption {
+  const char *name;
+  CURLoption id;
+  curl_easytype type;
+  unsigned int flags;
+};
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_by_name(const char *name);
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_by_id (CURLoption id);
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_next(const struct curl_easyoption *prev);
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+#endif /* CURLINC_OPTIONS_H */

+ 5 - 5
Source/OGCAssistTool/Include/curl/stdcheaders.h

@@ -1,5 +1,5 @@
-#ifndef __STDC_HEADERS_H
-#define __STDC_HEADERS_H
+#ifndef CURLINC_STDCHEADERS_H
+#define CURLINC_STDCHEADERS_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -30,4 +30,4 @@ size_t fwrite(const void *, size_t, size_t, FILE *);
 int strcasecmp(const char *, const char *);
 int strncasecmp(const char *, const char *, size_t);
 
-#endif /* __STDC_HEADERS_H */
+#endif /* CURLINC_STDCHEADERS_H */

+ 35 - 24
Source/OGCAssistTool/Include/curl/system.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_SYSTEM_H
-#define __CURL_SYSTEM_H
+#ifndef CURLINC_SYSTEM_H
+#define CURLINC_SYSTEM_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -137,15 +137,26 @@
 #  define CURL_TYPEOF_CURL_SOCKLEN_T int
 
 #elif defined(__LCC__)
-#  define CURL_TYPEOF_CURL_OFF_T     long
-#  define CURL_FORMAT_CURL_OFF_T     "ld"
-#  define CURL_FORMAT_CURL_OFF_TU    "lu"
-#  define CURL_SUFFIX_CURL_OFF_T     L
-#  define CURL_SUFFIX_CURL_OFF_TU    UL
-#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  if defined(__e2k__) /* MCST eLbrus C Compiler */
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#    define CURL_PULL_SYS_TYPES_H      1
+#    define CURL_PULL_SYS_SOCKET_H     1
+#  else                /* Local (or Little) C Compiler */
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#    define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  endif
 
 #elif defined(__SYMBIAN32__)
-#  if defined(__EABI__)  /* Treat all ARM compilers equally */
+#  if defined(__EABI__) /* Treat all ARM compilers equally */
 #    define CURL_TYPEOF_CURL_OFF_T     long long
 #    define CURL_FORMAT_CURL_OFF_T     "lld"
 #    define CURL_FORMAT_CURL_OFF_TU    "llu"
@@ -288,7 +299,6 @@
 #  define CURL_TYPEOF_CURL_SOCKLEN_T int
 
 #elif defined(__TINYC__) /* also known as tcc */
-
 #  define CURL_TYPEOF_CURL_OFF_T     long long
 #  define CURL_FORMAT_CURL_OFF_T     "lld"
 #  define CURL_FORMAT_CURL_OFF_TU    "llu"
@@ -377,6 +387,7 @@
 #    define CURL_SUFFIX_CURL_OFF_TU    ULL
 #  elif defined(__LP64__) || \
         defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
+        defined(__e2k__) || \
         (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
         (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
 #    define CURL_TYPEOF_CURL_OFF_T     long
@@ -473,21 +484,21 @@
  */
 
 #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
-#  define __CURL_OFF_T_C_HLPR2(x) x
-#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
-#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \
-                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
-#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
-                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
+#  define CURLINC_OFF_T_C_HLPR2(x) x
+#  define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
+#  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val) ## \
+                             CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
+#  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
+                             CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
 #else
 #  ifdef CURL_ISOCPP
-#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
+#    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
 #  else
-#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
+#    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
 #  endif
-#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
-#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
-#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
+#  define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
+#  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
+#  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
 #endif
 
-#endif /* __CURL_SYSTEM_H */
+#endif /* CURLINC_SYSTEM_H */

+ 292 - 283
Source/OGCAssistTool/Include/curl/typecheck-gcc.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_TYPECHECK_GCC_H
-#define __CURL_TYPECHECK_GCC_H
+#ifndef CURLINC_TYPECHECK_GCC_H
+#define CURLINC_TYPECHECK_GCC_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -25,10 +25,10 @@
 /* wraps curl_easy_setopt() with typechecking */
 
 /* To add a new kind of warning, add an
- *   if(_curl_is_sometype_option(_curl_opt))
- *     if(!_curl_is_sometype(value))
+ *   if(curlcheck_sometype_option(_curl_opt))
+ *     if(!curlcheck_sometype(value))
  *       _curl_easy_setopt_err_sometype();
- * block and define _curl_is_sometype_option, _curl_is_sometype and
+ * block and define curlcheck_sometype_option, curlcheck_sometype and
  * _curl_easy_setopt_err_sometype below
  *
  * NOTE: We use two nested 'if' statements here instead of the && operator, in
@@ -38,112 +38,112 @@
  * To add an option that uses the same type as an existing option, you'll just
  * need to extend the appropriate _curl_*_option macro
  */
-#define curl_easy_setopt(handle, option, value)                               \
-__extension__ ({                                                              \
-  __typeof__(option) _curl_opt = option;                                     \
-  if(__builtin_constant_p(_curl_opt)) {                                       \
-    if(_curl_is_long_option(_curl_opt))                                       \
-      if(!_curl_is_long(value))                                               \
-        _curl_easy_setopt_err_long();                                         \
-    if(_curl_is_off_t_option(_curl_opt))                                      \
-      if(!_curl_is_off_t(value))                                              \
-        _curl_easy_setopt_err_curl_off_t();                                   \
-    if(_curl_is_string_option(_curl_opt))                                     \
-      if(!_curl_is_string(value))                                             \
-        _curl_easy_setopt_err_string();                                       \
-    if(_curl_is_write_cb_option(_curl_opt))                                   \
-      if(!_curl_is_write_cb(value))                                           \
-        _curl_easy_setopt_err_write_callback();                               \
-    if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION)                        \
-      if(!_curl_is_resolver_start_callback(value))                            \
-        _curl_easy_setopt_err_resolver_start_callback();                      \
-    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \
-      if(!_curl_is_read_cb(value))                                            \
-        _curl_easy_setopt_err_read_cb();                                      \
-    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \
-      if(!_curl_is_ioctl_cb(value))                                           \
-        _curl_easy_setopt_err_ioctl_cb();                                     \
-    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \
-      if(!_curl_is_sockopt_cb(value))                                         \
-        _curl_easy_setopt_err_sockopt_cb();                                   \
-    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \
-      if(!_curl_is_opensocket_cb(value))                                      \
-        _curl_easy_setopt_err_opensocket_cb();                                \
-    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \
-      if(!_curl_is_progress_cb(value))                                        \
-        _curl_easy_setopt_err_progress_cb();                                  \
-    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \
-      if(!_curl_is_debug_cb(value))                                           \
-        _curl_easy_setopt_err_debug_cb();                                     \
-    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \
-      if(!_curl_is_ssl_ctx_cb(value))                                         \
-        _curl_easy_setopt_err_ssl_ctx_cb();                                   \
-    if(_curl_is_conv_cb_option(_curl_opt))                                    \
-      if(!_curl_is_conv_cb(value))                                            \
-        _curl_easy_setopt_err_conv_cb();                                      \
-    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \
-      if(!_curl_is_seek_cb(value))                                            \
-        _curl_easy_setopt_err_seek_cb();                                      \
-    if(_curl_is_cb_data_option(_curl_opt))                                    \
-      if(!_curl_is_cb_data(value))                                            \
-        _curl_easy_setopt_err_cb_data();                                      \
-    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \
-      if(!_curl_is_error_buffer(value))                                       \
-        _curl_easy_setopt_err_error_buffer();                                 \
-    if((_curl_opt) == CURLOPT_STDERR)                                         \
-      if(!_curl_is_FILE(value))                                               \
-        _curl_easy_setopt_err_FILE();                                         \
-    if(_curl_is_postfields_option(_curl_opt))                                 \
-      if(!_curl_is_postfields(value))                                         \
-        _curl_easy_setopt_err_postfields();                                   \
-    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \
-      if(!_curl_is_arr((value), struct curl_httppost))                        \
-        _curl_easy_setopt_err_curl_httpost();                                 \
-    if((_curl_opt) == CURLOPT_MIMEPOST)                                       \
-      if(!_curl_is_ptr((value), curl_mime))                                   \
-        _curl_easy_setopt_err_curl_mimepost();                                \
-    if(_curl_is_slist_option(_curl_opt))                                      \
-      if(!_curl_is_arr((value), struct curl_slist))                           \
-        _curl_easy_setopt_err_curl_slist();                                   \
-    if((_curl_opt) == CURLOPT_SHARE)                                          \
-      if(!_curl_is_ptr((value), CURLSH))                                      \
-        _curl_easy_setopt_err_CURLSH();                                       \
-  }                                                                           \
-  curl_easy_setopt(handle, _curl_opt, value);                                 \
-})
+#define curl_easy_setopt(handle, option, value)                         \
+  __extension__({                                                       \
+      __typeof__(option) _curl_opt = option;                            \
+      if(__builtin_constant_p(_curl_opt)) {                             \
+        if(curlcheck_long_option(_curl_opt))                            \
+          if(!curlcheck_long(value))                                    \
+            _curl_easy_setopt_err_long();                               \
+        if(curlcheck_off_t_option(_curl_opt))                           \
+          if(!curlcheck_off_t(value))                                   \
+            _curl_easy_setopt_err_curl_off_t();                         \
+        if(curlcheck_string_option(_curl_opt))                          \
+          if(!curlcheck_string(value))                                  \
+            _curl_easy_setopt_err_string();                             \
+        if(curlcheck_write_cb_option(_curl_opt))                        \
+          if(!curlcheck_write_cb(value))                                \
+            _curl_easy_setopt_err_write_callback();                     \
+        if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION)              \
+          if(!curlcheck_resolver_start_callback(value))                 \
+            _curl_easy_setopt_err_resolver_start_callback();            \
+        if((_curl_opt) == CURLOPT_READFUNCTION)                         \
+          if(!curlcheck_read_cb(value))                                 \
+            _curl_easy_setopt_err_read_cb();                            \
+        if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                        \
+          if(!curlcheck_ioctl_cb(value))                                \
+            _curl_easy_setopt_err_ioctl_cb();                           \
+        if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                      \
+          if(!curlcheck_sockopt_cb(value))                              \
+            _curl_easy_setopt_err_sockopt_cb();                         \
+        if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                   \
+          if(!curlcheck_opensocket_cb(value))                           \
+            _curl_easy_setopt_err_opensocket_cb();                      \
+        if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                     \
+          if(!curlcheck_progress_cb(value))                             \
+            _curl_easy_setopt_err_progress_cb();                        \
+        if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                        \
+          if(!curlcheck_debug_cb(value))                                \
+            _curl_easy_setopt_err_debug_cb();                           \
+        if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                     \
+          if(!curlcheck_ssl_ctx_cb(value))                              \
+            _curl_easy_setopt_err_ssl_ctx_cb();                         \
+        if(curlcheck_conv_cb_option(_curl_opt))                         \
+          if(!curlcheck_conv_cb(value))                                 \
+            _curl_easy_setopt_err_conv_cb();                            \
+        if((_curl_opt) == CURLOPT_SEEKFUNCTION)                         \
+          if(!curlcheck_seek_cb(value))                                 \
+            _curl_easy_setopt_err_seek_cb();                            \
+        if(curlcheck_cb_data_option(_curl_opt))                         \
+          if(!curlcheck_cb_data(value))                                 \
+            _curl_easy_setopt_err_cb_data();                            \
+        if((_curl_opt) == CURLOPT_ERRORBUFFER)                          \
+          if(!curlcheck_error_buffer(value))                            \
+            _curl_easy_setopt_err_error_buffer();                       \
+        if((_curl_opt) == CURLOPT_STDERR)                               \
+          if(!curlcheck_FILE(value))                                    \
+            _curl_easy_setopt_err_FILE();                               \
+        if(curlcheck_postfields_option(_curl_opt))                      \
+          if(!curlcheck_postfields(value))                              \
+            _curl_easy_setopt_err_postfields();                         \
+        if((_curl_opt) == CURLOPT_HTTPPOST)                             \
+          if(!curlcheck_arr((value), struct curl_httppost))             \
+            _curl_easy_setopt_err_curl_httpost();                       \
+        if((_curl_opt) == CURLOPT_MIMEPOST)                             \
+          if(!curlcheck_ptr((value), curl_mime))                        \
+            _curl_easy_setopt_err_curl_mimepost();                      \
+        if(curlcheck_slist_option(_curl_opt))                           \
+          if(!curlcheck_arr((value), struct curl_slist))                \
+            _curl_easy_setopt_err_curl_slist();                         \
+        if((_curl_opt) == CURLOPT_SHARE)                                \
+          if(!curlcheck_ptr((value), CURLSH))                           \
+            _curl_easy_setopt_err_CURLSH();                             \
+      }                                                                 \
+      curl_easy_setopt(handle, _curl_opt, value);                       \
+    })
 
 /* wraps curl_easy_getinfo() with typechecking */
-#define curl_easy_getinfo(handle, info, arg)                                  \
-__extension__ ({                                                              \
-  __typeof__(info) _curl_info = info;                                         \
-  if(__builtin_constant_p(_curl_info)) {                                      \
-    if(_curl_is_string_info(_curl_info))                                      \
-      if(!_curl_is_arr((arg), char *))                                        \
-        _curl_easy_getinfo_err_string();                                      \
-    if(_curl_is_long_info(_curl_info))                                        \
-      if(!_curl_is_arr((arg), long))                                          \
-        _curl_easy_getinfo_err_long();                                        \
-    if(_curl_is_double_info(_curl_info))                                      \
-      if(!_curl_is_arr((arg), double))                                        \
-        _curl_easy_getinfo_err_double();                                      \
-    if(_curl_is_slist_info(_curl_info))                                       \
-      if(!_curl_is_arr((arg), struct curl_slist *))                           \
-        _curl_easy_getinfo_err_curl_slist();                                  \
-    if(_curl_is_tlssessioninfo_info(_curl_info))                              \
-      if(!_curl_is_arr((arg), struct curl_tlssessioninfo *))                  \
-        _curl_easy_getinfo_err_curl_tlssesssioninfo();                        \
-    if(_curl_is_certinfo_info(_curl_info))                                    \
-      if(!_curl_is_arr((arg), struct curl_certinfo *))                        \
-        _curl_easy_getinfo_err_curl_certinfo();                               \
-    if(_curl_is_socket_info(_curl_info))                                      \
-      if(!_curl_is_arr((arg), curl_socket_t))                                 \
-        _curl_easy_getinfo_err_curl_socket();                                 \
-    if(_curl_is_off_t_info(_curl_info))                                       \
-      if(!_curl_is_arr((arg), curl_off_t))                                    \
-        _curl_easy_getinfo_err_curl_off_t();                                  \
-  }                                                                           \
-  curl_easy_getinfo(handle, _curl_info, arg);                                 \
-})
+#define curl_easy_getinfo(handle, info, arg)                            \
+  __extension__({                                                      \
+      __typeof__(info) _curl_info = info;                               \
+      if(__builtin_constant_p(_curl_info)) {                            \
+        if(curlcheck_string_info(_curl_info))                           \
+          if(!curlcheck_arr((arg), char *))                             \
+            _curl_easy_getinfo_err_string();                            \
+        if(curlcheck_long_info(_curl_info))                             \
+          if(!curlcheck_arr((arg), long))                               \
+            _curl_easy_getinfo_err_long();                              \
+        if(curlcheck_double_info(_curl_info))                           \
+          if(!curlcheck_arr((arg), double))                             \
+            _curl_easy_getinfo_err_double();                            \
+        if(curlcheck_slist_info(_curl_info))                            \
+          if(!curlcheck_arr((arg), struct curl_slist *))                \
+            _curl_easy_getinfo_err_curl_slist();                        \
+        if(curlcheck_tlssessioninfo_info(_curl_info))                   \
+          if(!curlcheck_arr((arg), struct curl_tlssessioninfo *))       \
+            _curl_easy_getinfo_err_curl_tlssesssioninfo();              \
+        if(curlcheck_certinfo_info(_curl_info))                         \
+          if(!curlcheck_arr((arg), struct curl_certinfo *))             \
+            _curl_easy_getinfo_err_curl_certinfo();                     \
+        if(curlcheck_socket_info(_curl_info))                           \
+          if(!curlcheck_arr((arg), curl_socket_t))                      \
+            _curl_easy_getinfo_err_curl_socket();                       \
+        if(curlcheck_off_t_info(_curl_info))                            \
+          if(!curlcheck_arr((arg), curl_off_t))                         \
+            _curl_easy_getinfo_err_curl_off_t();                        \
+      }                                                                 \
+      curl_easy_getinfo(handle, _curl_info, arg);                       \
+    })
 
 /*
  * For now, just make sure that the functions are called with three arguments
@@ -156,83 +156,83 @@ __extension__ ({                                                              \
  * functions */
 
 /* To define a new warning, use _CURL_WARNING(identifier, "message") */
-#define _CURL_WARNING(id, message)                                            \
-  static void __attribute__((__warning__(message)))                           \
-  __attribute__((__unused__)) __attribute__((__noinline__))                   \
+#define CURLWARNING(id, message)                                        \
+  static void __attribute__((__warning__(message)))                     \
+  __attribute__((__unused__)) __attribute__((__noinline__))             \
   id(void) { __asm__(""); }
 
-_CURL_WARNING(_curl_easy_setopt_err_long,
+CURLWARNING(_curl_easy_setopt_err_long,
   "curl_easy_setopt expects a long argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
+CURLWARNING(_curl_easy_setopt_err_curl_off_t,
   "curl_easy_setopt expects a curl_off_t argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_string,
+CURLWARNING(_curl_easy_setopt_err_string,
               "curl_easy_setopt expects a "
               "string ('char *' or char[]) argument for this option"
   )
-_CURL_WARNING(_curl_easy_setopt_err_write_callback,
+CURLWARNING(_curl_easy_setopt_err_write_callback,
   "curl_easy_setopt expects a curl_write_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback,
+CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
               "curl_easy_setopt expects a "
               "curl_resolver_start_callback argument for this option"
   )
-_CURL_WARNING(_curl_easy_setopt_err_read_cb,
+CURLWARNING(_curl_easy_setopt_err_read_cb,
   "curl_easy_setopt expects a curl_read_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
+CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
   "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
+CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
   "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
+CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
               "curl_easy_setopt expects a "
               "curl_opensocket_callback argument for this option"
   )
-_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
+CURLWARNING(_curl_easy_setopt_err_progress_cb,
   "curl_easy_setopt expects a curl_progress_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
+CURLWARNING(_curl_easy_setopt_err_debug_cb,
   "curl_easy_setopt expects a curl_debug_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
+CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
   "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
+CURLWARNING(_curl_easy_setopt_err_conv_cb,
   "curl_easy_setopt expects a curl_conv_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
+CURLWARNING(_curl_easy_setopt_err_seek_cb,
   "curl_easy_setopt expects a curl_seek_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_cb_data,
+CURLWARNING(_curl_easy_setopt_err_cb_data,
               "curl_easy_setopt expects a "
               "private data pointer as argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
+CURLWARNING(_curl_easy_setopt_err_error_buffer,
               "curl_easy_setopt expects a "
               "char buffer of CURL_ERROR_SIZE as argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_FILE,
+CURLWARNING(_curl_easy_setopt_err_FILE,
   "curl_easy_setopt expects a 'FILE *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_postfields,
+CURLWARNING(_curl_easy_setopt_err_postfields,
   "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
+CURLWARNING(_curl_easy_setopt_err_curl_httpost,
               "curl_easy_setopt expects a 'struct curl_httppost *' "
               "argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
+CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
               "curl_easy_setopt expects a 'curl_mime *' "
               "argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
+CURLWARNING(_curl_easy_setopt_err_curl_slist,
   "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
+CURLWARNING(_curl_easy_setopt_err_CURLSH,
   "curl_easy_setopt expects a CURLSH* argument for this option")
 
-_CURL_WARNING(_curl_easy_getinfo_err_string,
+CURLWARNING(_curl_easy_getinfo_err_string,
   "curl_easy_getinfo expects a pointer to 'char *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_long,
+CURLWARNING(_curl_easy_getinfo_err_long,
   "curl_easy_getinfo expects a pointer to long for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_double,
+CURLWARNING(_curl_easy_getinfo_err_double,
   "curl_easy_getinfo expects a pointer to double for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
+CURLWARNING(_curl_easy_getinfo_err_curl_slist,
   "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
+CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
               "curl_easy_getinfo expects a pointer to "
               "'struct curl_tlssessioninfo *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
+CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
               "curl_easy_getinfo expects a pointer to "
               "'struct curl_certinfo *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
+CURLWARNING(_curl_easy_getinfo_err_curl_socket,
   "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
+CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
   "curl_easy_getinfo expects a pointer to curl_off_t for this info")
 
 /* groups of curl_easy_setops options that take the same type of argument */
@@ -244,14 +244,14 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
  */
 
 /* evaluates to true if option takes a long argument */
-#define _curl_is_long_option(option)                                          \
+#define curlcheck_long_option(option)                   \
   (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
 
-#define _curl_is_off_t_option(option)                                         \
-  ((option) > CURLOPTTYPE_OFF_T)
+#define curlcheck_off_t_option(option)          \
+  (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
 
 /* evaluates to true if option takes a char* argument */
-#define _curl_is_string_option(option)                                        \
+#define curlcheck_string_option(option)                                       \
   ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET ||                                \
    (option) == CURLOPT_ACCEPT_ENCODING ||                                     \
    (option) == CURLOPT_ALTSVC ||                                              \
@@ -273,6 +273,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    (option) == CURLOPT_FTPPORT ||                                             \
    (option) == CURLOPT_FTP_ACCOUNT ||                                         \
    (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \
+   (option) == CURLOPT_HSTS ||                                                \
    (option) == CURLOPT_INTERFACE ||                                           \
    (option) == CURLOPT_ISSUERCERT ||                                          \
    (option) == CURLOPT_KEYPASSWD ||                                           \
@@ -292,6 +293,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    (option) == CURLOPT_PROXY_CAINFO ||                                        \
    (option) == CURLOPT_PROXY_CAPATH ||                                        \
    (option) == CURLOPT_PROXY_CRLFILE ||                                       \
+   (option) == CURLOPT_PROXY_ISSUERCERT ||                                    \
    (option) == CURLOPT_PROXY_KEYPASSWD ||                                     \
    (option) == CURLOPT_PROXY_PINNEDPUBLICKEY ||                               \
    (option) == CURLOPT_PROXY_SERVICE_NAME ||                                  \
@@ -311,9 +313,11 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    (option) == CURLOPT_RTSP_SESSION_ID ||                                     \
    (option) == CURLOPT_RTSP_STREAM_URI ||                                     \
    (option) == CURLOPT_RTSP_TRANSPORT ||                                      \
+   (option) == CURLOPT_SASL_AUTHZID ||                                        \
    (option) == CURLOPT_SERVICE_NAME ||                                        \
    (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \
    (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \
+   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 ||                          \
    (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \
    (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \
    (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \
@@ -331,32 +335,36 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    (option) == CURLOPT_URL ||                                                 \
    (option) == CURLOPT_USERAGENT ||                                           \
    (option) == CURLOPT_USERNAME ||                                            \
+   (option) == CURLOPT_AWS_SIGV4 ||                                           \
    (option) == CURLOPT_USERPWD ||                                             \
    (option) == CURLOPT_XOAUTH2_BEARER ||                                      \
+   (option) == CURLOPT_SSL_EC_CURVES ||                                       \
    0)
 
 /* evaluates to true if option takes a curl_write_callback argument */
-#define _curl_is_write_cb_option(option)                                      \
-  ((option) == CURLOPT_HEADERFUNCTION ||                                      \
+#define curlcheck_write_cb_option(option)                               \
+  ((option) == CURLOPT_HEADERFUNCTION ||                                \
    (option) == CURLOPT_WRITEFUNCTION)
 
 /* evaluates to true if option takes a curl_conv_callback argument */
-#define _curl_is_conv_cb_option(option)                                       \
-  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \
-   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \
+#define curlcheck_conv_cb_option(option)                                \
+  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                      \
+   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                    \
    (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
 
 /* evaluates to true if option takes a data argument to pass to a callback */
-#define _curl_is_cb_data_option(option)                                       \
+#define curlcheck_cb_data_option(option)                                      \
   ((option) == CURLOPT_CHUNK_DATA ||                                          \
    (option) == CURLOPT_CLOSESOCKETDATA ||                                     \
    (option) == CURLOPT_DEBUGDATA ||                                           \
    (option) == CURLOPT_FNMATCH_DATA ||                                        \
    (option) == CURLOPT_HEADERDATA ||                                          \
+   (option) == CURLOPT_HSTSREADDATA ||                                        \
+   (option) == CURLOPT_HSTSWRITEDATA ||                                       \
    (option) == CURLOPT_INTERLEAVEDATA ||                                      \
    (option) == CURLOPT_IOCTLDATA ||                                           \
    (option) == CURLOPT_OPENSOCKETDATA ||                                      \
-   (option) == CURLOPT_PRIVATE ||                                             \
+   (option) == CURLOPT_PREREQDATA ||                                          \
    (option) == CURLOPT_PROGRESSDATA ||                                        \
    (option) == CURLOPT_READDATA ||                                            \
    (option) == CURLOPT_SEEKDATA ||                                            \
@@ -369,13 +377,13 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    0)
 
 /* evaluates to true if option takes a POST data argument (void* or char*) */
-#define _curl_is_postfields_option(option)                                    \
+#define curlcheck_postfields_option(option)                                   \
   ((option) == CURLOPT_POSTFIELDS ||                                          \
    (option) == CURLOPT_COPYPOSTFIELDS ||                                      \
    0)
 
 /* evaluates to true if option takes a struct curl_slist * argument */
-#define _curl_is_slist_option(option)                                         \
+#define curlcheck_slist_option(option)                                        \
   ((option) == CURLOPT_HTTP200ALIASES ||                                      \
    (option) == CURLOPT_HTTPHEADER ||                                          \
    (option) == CURLOPT_MAIL_RCPT ||                                           \
@@ -391,40 +399,41 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
 /* groups of curl_easy_getinfo infos that take the same type of argument */
 
 /* evaluates to true if info expects a pointer to char * argument */
-#define _curl_is_string_info(info)                                            \
-  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
+#define curlcheck_string_info(info)                             \
+  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG &&        \
+   (info) != CURLINFO_PRIVATE)
 
 /* evaluates to true if info expects a pointer to long argument */
-#define _curl_is_long_info(info)                                              \
+#define curlcheck_long_info(info)                       \
   (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
 
 /* evaluates to true if info expects a pointer to double argument */
-#define _curl_is_double_info(info)                                            \
+#define curlcheck_double_info(info)                     \
   (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
 
 /* true if info expects a pointer to struct curl_slist * argument */
-#define _curl_is_slist_info(info)                                       \
+#define curlcheck_slist_info(info)                                      \
   (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
 
 /* true if info expects a pointer to struct curl_tlssessioninfo * argument */
-#define _curl_is_tlssessioninfo_info(info)                              \
+#define curlcheck_tlssessioninfo_info(info)                              \
   (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
 
 /* true if info expects a pointer to struct curl_certinfo * argument */
-#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
+#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
 
 /* true if info expects a pointer to struct curl_socket_t argument */
-#define _curl_is_socket_info(info)                                            \
+#define curlcheck_socket_info(info)                     \
   (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
 
 /* true if info expects a pointer to curl_off_t argument */
-#define _curl_is_off_t_info(info)                                             \
+#define curlcheck_off_t_info(info)              \
   (CURLINFO_OFF_T < (info))
 
 
 /* typecheck helpers -- check whether given expression has requested type*/
 
-/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
+/* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros,
  * otherwise define a new macro. Search for __builtin_types_compatible_p
  * in the GCC manual.
  * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
@@ -434,35 +443,35 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
  */
 
 /* XXX: should evaluate to true if expr is a pointer */
-#define _curl_is_any_ptr(expr)                                                \
+#define curlcheck_any_ptr(expr)                 \
   (sizeof(expr) == sizeof(void *))
 
 /* evaluates to true if expr is NULL */
 /* XXX: must not evaluate expr, so this check is not accurate */
-#define _curl_is_NULL(expr)                                                   \
+#define curlcheck_NULL(expr)                                            \
   (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
 
 /* evaluates to true if expr is type*, const type* or NULL */
-#define _curl_is_ptr(expr, type)                                              \
-  (_curl_is_NULL(expr) ||                                                     \
-   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \
+#define curlcheck_ptr(expr, type)                                       \
+  (curlcheck_NULL(expr) ||                                              \
+   __builtin_types_compatible_p(__typeof__(expr), type *) ||            \
    __builtin_types_compatible_p(__typeof__(expr), const type *))
 
 /* evaluates to true if expr is one of type[], type*, NULL or const type* */
-#define _curl_is_arr(expr, type)                                              \
-  (_curl_is_ptr((expr), type) ||                                              \
+#define curlcheck_arr(expr, type)                                       \
+  (curlcheck_ptr((expr), type) ||                                       \
    __builtin_types_compatible_p(__typeof__(expr), type []))
 
 /* evaluates to true if expr is a string */
-#define _curl_is_string(expr)                                                 \
-  (_curl_is_arr((expr), char) ||                                              \
-   _curl_is_arr((expr), signed char) ||                                       \
-   _curl_is_arr((expr), unsigned char))
+#define curlcheck_string(expr)                                          \
+  (curlcheck_arr((expr), char) ||                                       \
+   curlcheck_arr((expr), signed char) ||                                \
+   curlcheck_arr((expr), unsigned char))
 
 /* evaluates to true if expr is a long (no matter the signedness)
  * XXX: for now, int is also accepted (and therefore short and char, which
  * are promoted to int when passed to a variadic function) */
-#define _curl_is_long(expr)                                                   \
+#define curlcheck_long(expr)                                                  \
   (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \
    __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \
    __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \
@@ -477,59 +486,59 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    __builtin_types_compatible_p(__typeof__(expr), unsigned char))
 
 /* evaluates to true if expr is of type curl_off_t */
-#define _curl_is_off_t(expr)                                                  \
+#define curlcheck_off_t(expr)                                   \
   (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
 
 /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
 /* XXX: also check size of an char[] array? */
-#define _curl_is_error_buffer(expr)                                           \
-  (_curl_is_NULL(expr) ||                                                     \
-   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
+#define curlcheck_error_buffer(expr)                                    \
+  (curlcheck_NULL(expr) ||                                              \
+   __builtin_types_compatible_p(__typeof__(expr), char *) ||            \
    __builtin_types_compatible_p(__typeof__(expr), char[]))
 
 /* evaluates to true if expr is of type (const) void* or (const) FILE* */
 #if 0
-#define _curl_is_cb_data(expr)                                                \
-  (_curl_is_ptr((expr), void) ||                                              \
-   _curl_is_ptr((expr), FILE))
+#define curlcheck_cb_data(expr)                                         \
+  (curlcheck_ptr((expr), void) ||                                       \
+   curlcheck_ptr((expr), FILE))
 #else /* be less strict */
-#define _curl_is_cb_data(expr)                                                \
-  _curl_is_any_ptr(expr)
+#define curlcheck_cb_data(expr)                 \
+  curlcheck_any_ptr(expr)
 #endif
 
 /* evaluates to true if expr is of type FILE* */
-#define _curl_is_FILE(expr)                                             \
-  (_curl_is_NULL(expr) ||                                              \
+#define curlcheck_FILE(expr)                                            \
+  (curlcheck_NULL(expr) ||                                              \
    (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
 
 /* evaluates to true if expr can be passed as POST data (void* or char*) */
-#define _curl_is_postfields(expr)                                             \
-  (_curl_is_ptr((expr), void) ||                                              \
-   _curl_is_arr((expr), char) ||                                              \
-   _curl_is_arr((expr), unsigned char))
+#define curlcheck_postfields(expr)                                      \
+  (curlcheck_ptr((expr), void) ||                                       \
+   curlcheck_arr((expr), char) ||                                       \
+   curlcheck_arr((expr), unsigned char))
 
 /* helper: __builtin_types_compatible_p distinguishes between functions and
  * function pointers, hide it */
-#define _curl_callback_compatible(func, type)                                 \
-  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \
+#define curlcheck_cb_compatible(func, type)                             \
+  (__builtin_types_compatible_p(__typeof__(func), type) ||              \
    __builtin_types_compatible_p(__typeof__(func) *, type))
 
 /* evaluates to true if expr is of type curl_resolver_start_callback */
-#define _curl_is_resolver_start_callback(expr)       \
-  (_curl_is_NULL(expr) || \
-   _curl_callback_compatible((expr), curl_resolver_start_callback))
+#define curlcheck_resolver_start_callback(expr)       \
+  (curlcheck_NULL(expr) || \
+   curlcheck_cb_compatible((expr), curl_resolver_start_callback))
 
 /* evaluates to true if expr is of type curl_read_callback or "similar" */
-#define _curl_is_read_cb(expr)                                          \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), __typeof__(fread) *) ||                  \
-   _curl_callback_compatible((expr), curl_read_callback) ||                   \
-   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \
-   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \
-   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \
-   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \
-   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \
-   _curl_callback_compatible((expr), _curl_read_callback6))
+#define curlcheck_read_cb(expr)                                         \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), __typeof__(fread) *) ||              \
+   curlcheck_cb_compatible((expr), curl_read_callback) ||               \
+   curlcheck_cb_compatible((expr), _curl_read_callback1) ||             \
+   curlcheck_cb_compatible((expr), _curl_read_callback2) ||             \
+   curlcheck_cb_compatible((expr), _curl_read_callback3) ||             \
+   curlcheck_cb_compatible((expr), _curl_read_callback4) ||             \
+   curlcheck_cb_compatible((expr), _curl_read_callback5) ||             \
+   curlcheck_cb_compatible((expr), _curl_read_callback6))
 typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
 typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
 typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
@@ -538,16 +547,16 @@ typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
 typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
 
 /* evaluates to true if expr is of type curl_write_callback or "similar" */
-#define _curl_is_write_cb(expr)                                               \
-  (_curl_is_read_cb(expr) ||                                            \
-   _curl_callback_compatible((expr), __typeof__(fwrite) *) ||                 \
-   _curl_callback_compatible((expr), curl_write_callback) ||                  \
-   _curl_callback_compatible((expr), _curl_write_callback1) ||                \
-   _curl_callback_compatible((expr), _curl_write_callback2) ||                \
-   _curl_callback_compatible((expr), _curl_write_callback3) ||                \
-   _curl_callback_compatible((expr), _curl_write_callback4) ||                \
-   _curl_callback_compatible((expr), _curl_write_callback5) ||                \
-   _curl_callback_compatible((expr), _curl_write_callback6))
+#define curlcheck_write_cb(expr)                                        \
+  (curlcheck_read_cb(expr) ||                                           \
+   curlcheck_cb_compatible((expr), __typeof__(fwrite) *) ||             \
+   curlcheck_cb_compatible((expr), curl_write_callback) ||              \
+   curlcheck_cb_compatible((expr), _curl_write_callback1) ||            \
+   curlcheck_cb_compatible((expr), _curl_write_callback2) ||            \
+   curlcheck_cb_compatible((expr), _curl_write_callback3) ||            \
+   curlcheck_cb_compatible((expr), _curl_write_callback4) ||            \
+   curlcheck_cb_compatible((expr), _curl_write_callback5) ||            \
+   curlcheck_cb_compatible((expr), _curl_write_callback6))
 typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
 typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
                                        const void *);
@@ -558,37 +567,37 @@ typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
 typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
 
 /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
-#define _curl_is_ioctl_cb(expr)                                         \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_ioctl_callback) ||                  \
-   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \
-   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \
-   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \
-   _curl_callback_compatible((expr), _curl_ioctl_callback4))
+#define curlcheck_ioctl_cb(expr)                                        \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_ioctl_callback) ||              \
+   curlcheck_cb_compatible((expr), _curl_ioctl_callback1) ||            \
+   curlcheck_cb_compatible((expr), _curl_ioctl_callback2) ||            \
+   curlcheck_cb_compatible((expr), _curl_ioctl_callback3) ||            \
+   curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
 typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
 typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
 typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
 typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
 
 /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
-#define _curl_is_sockopt_cb(expr)                                       \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_sockopt_callback) ||                \
-   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \
-   _curl_callback_compatible((expr), _curl_sockopt_callback2))
+#define curlcheck_sockopt_cb(expr)                                      \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_sockopt_callback) ||            \
+   curlcheck_cb_compatible((expr), _curl_sockopt_callback1) ||          \
+   curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
 typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
 typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
                                       curlsocktype);
 
 /* evaluates to true if expr is of type curl_opensocket_callback or
    "similar" */
-#define _curl_is_opensocket_cb(expr)                                    \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_opensocket_callback) ||             \
-   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \
-   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \
-   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \
-   _curl_callback_compatible((expr), _curl_opensocket_callback4))
+#define curlcheck_opensocket_cb(expr)                                   \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_opensocket_callback) ||         \
+   curlcheck_cb_compatible((expr), _curl_opensocket_callback1) ||       \
+   curlcheck_cb_compatible((expr), _curl_opensocket_callback2) ||       \
+   curlcheck_cb_compatible((expr), _curl_opensocket_callback3) ||       \
+   curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
 typedef curl_socket_t (*_curl_opensocket_callback1)
   (void *, curlsocktype, struct curl_sockaddr *);
 typedef curl_socket_t (*_curl_opensocket_callback2)
@@ -599,28 +608,28 @@ typedef curl_socket_t (*_curl_opensocket_callback4)
   (const void *, curlsocktype, const struct curl_sockaddr *);
 
 /* evaluates to true if expr is of type curl_progress_callback or "similar" */
-#define _curl_is_progress_cb(expr)                                      \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_progress_callback) ||               \
-   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \
-   _curl_callback_compatible((expr), _curl_progress_callback2))
+#define curlcheck_progress_cb(expr)                                     \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_progress_callback) ||           \
+   curlcheck_cb_compatible((expr), _curl_progress_callback1) ||         \
+   curlcheck_cb_compatible((expr), _curl_progress_callback2))
 typedef int (*_curl_progress_callback1)(void *,
     double, double, double, double);
 typedef int (*_curl_progress_callback2)(const void *,
     double, double, double, double);
 
 /* evaluates to true if expr is of type curl_debug_callback or "similar" */
-#define _curl_is_debug_cb(expr)                                         \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_debug_callback) ||                  \
-   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \
-   _curl_callback_compatible((expr), _curl_debug_callback8))
+#define curlcheck_debug_cb(expr)                                        \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_debug_callback) ||              \
+   curlcheck_cb_compatible((expr), _curl_debug_callback1) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback2) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback3) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback4) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback5) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback6) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback7) ||            \
+   curlcheck_cb_compatible((expr), _curl_debug_callback8))
 typedef int (*_curl_debug_callback1) (CURL *,
     curl_infotype, char *, size_t, void *);
 typedef int (*_curl_debug_callback2) (CURL *,
@@ -640,17 +649,17 @@ typedef int (*_curl_debug_callback8) (CURL *,
 
 /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
 /* this is getting even messier... */
-#define _curl_is_ssl_ctx_cb(expr)                                       \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_ssl_ctx_callback) ||                \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \
-   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
+#define curlcheck_ssl_ctx_cb(expr)                                      \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) ||            \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) ||          \
+   curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
 typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
 typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
 typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
@@ -660,11 +669,11 @@ typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
 /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
  * this will of course break if we're included before OpenSSL headers...
  */
-typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
-typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
-                                           const void *);
+typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
+typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
+typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
+typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
+                                            const void *);
 #else
 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
@@ -673,26 +682,26 @@ typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
 #endif
 
 /* evaluates to true if expr is of type curl_conv_callback or "similar" */
-#define _curl_is_conv_cb(expr)                                          \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_conv_callback) ||                   \
-   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \
-   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \
-   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \
-   _curl_callback_compatible((expr), _curl_conv_callback4))
+#define curlcheck_conv_cb(expr)                                         \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_conv_callback) ||               \
+   curlcheck_cb_compatible((expr), _curl_conv_callback1) ||             \
+   curlcheck_cb_compatible((expr), _curl_conv_callback2) ||             \
+   curlcheck_cb_compatible((expr), _curl_conv_callback3) ||             \
+   curlcheck_cb_compatible((expr), _curl_conv_callback4))
 typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
 typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
 typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
 typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
 
 /* evaluates to true if expr is of type curl_seek_callback or "similar" */
-#define _curl_is_seek_cb(expr)                                          \
-  (_curl_is_NULL(expr) ||                                                     \
-   _curl_callback_compatible((expr), curl_seek_callback) ||                   \
-   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \
-   _curl_callback_compatible((expr), _curl_seek_callback2))
+#define curlcheck_seek_cb(expr)                                         \
+  (curlcheck_NULL(expr) ||                                              \
+   curlcheck_cb_compatible((expr), curl_seek_callback) ||               \
+   curlcheck_cb_compatible((expr), _curl_seek_callback1) ||             \
+   curlcheck_cb_compatible((expr), _curl_seek_callback2))
 typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
 typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
 
 
-#endif /* __CURL_TYPECHECK_GCC_H */
+#endif /* CURLINC_TYPECHECK_GCC_H */

+ 16 - 6
Source/OGCAssistTool/Include/curl/urlapi.h

@@ -1,5 +1,5 @@
-#ifndef __CURL_URLAPI_H
-#define __CURL_URLAPI_H
+#ifndef CURLINC_URLAPI_H
+#define CURLINC_URLAPI_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,11 +7,11 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2018 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -47,7 +47,8 @@ typedef enum {
   CURLUE_NO_HOST,             /* 14 */
   CURLUE_NO_PORT,             /* 15 */
   CURLUE_NO_QUERY,            /* 16 */
-  CURLUE_NO_FRAGMENT          /* 17 */
+  CURLUE_NO_FRAGMENT,         /* 17 */
+  CURLUE_LAST
 } CURLUcode;
 
 typedef enum {
@@ -77,6 +78,9 @@ typedef enum {
 #define CURLU_URLENCODE (1<<7)          /* URL encode on set */
 #define CURLU_APPENDQUERY (1<<8)        /* append a form style part */
 #define CURLU_GUESS_SCHEME (1<<9)       /* legacy curl-style guessing */
+#define CURLU_NO_AUTHORITY (1<<10)      /* Allow empty authority when the
+                                           scheme is unknown. */
+#define CURLU_ALLOW_SPACE (1<<11)       /* Allow spaces in the URL */
 
 typedef struct Curl_URL CURLU;
 
@@ -115,9 +119,15 @@ CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
 CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
                                    const char *part, unsigned int flags);
 
+/*
+ * curl_url_strerror() turns a CURLUcode value into the equivalent human
+ * readable error string.  This is useful for printing meaningful error
+ * messages.
+ */
+CURL_EXTERN const char *curl_url_strerror(CURLUcode);
 
 #ifdef __cplusplus
 } /* end of extern "C" */
 #endif
 
-#endif
+#endif /* CURLINC_URLAPI_H */

+ 258 - 0
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.vcxproj

@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <ProjectGuid>{0B8CE487-8311-4878-902B-15813A89DB90}</ProjectGuid>
+    <RootNamespace>OGCAssistTool</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v143</PlatformToolset>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <CLRSupport>false</CLRSupport>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v143</PlatformToolset>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <CLRSupport>false</CLRSupport>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>17.0.32203.90</_ProjectFileVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>..\..\..\..\bin\$(SolutionName)\</OutDir>
+    <IntDir>$(OutDir)$(ProjectName)\$(Configuration)\</IntDir>
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>..\..\..\..\bin\$(SolutionName)\</OutDir>
+    <IntDir>$(OutDir)$(ProjectName)\$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\include;..\cJson;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CURL_STATICLIB;__LIST_DRAW__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0804</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>crypt32.lib;ws2_32.lib;winmm.lib;wldap32.lib;libcurld.lib;libeay32.lib;ssleay32.lib;sqlite3d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AssemblyDebug>true</AssemblyDebug>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>..\include;..\cJson;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CURL_STATICLIB;__LIST_DRAW__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0804</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>crypt32.lib;ws2_32.lib;winmm.lib;wldap32.lib;libcurl.lib;libeay32.lib;ssleay32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
+      <UACUIAccess>false</UACUIAccess>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+      <ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\cJson\cJSON.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="..\cJson\cJSON_Utils.c">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="..\cJson\JsonUtils.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="Base64.cpp" />
+    <ClCompile Include="BCMenu.cpp" />
+    <ClCompile Include="BtnST.cpp" />
+    <ClCompile Include="CeXDib.cpp" />
+    <ClCompile Include="CharConvert.cpp" />
+    <ClCompile Include="CharEncoding.cpp" />
+    <ClCompile Include="CurlClient.cpp" />
+    <ClCompile Include="DataImpl.cpp" />
+    <ClCompile Include="des.cpp" />
+    <ClCompile Include="DlgLogin.cpp" />
+    <ClCompile Include="FontSize.cpp" />
+    <ClCompile Include="Global.cpp" />
+    <ClCompile Include="HyperLink.cpp" />
+    <ClCompile Include="Injection.cpp" />
+    <ClCompile Include="ListSortCtrl.cpp" />
+    <ClCompile Include="log4z.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="MD5.cpp" />
+    <ClCompile Include="MESdb.cpp" />
+    <ClCompile Include="OGCAssistTool.cpp" />
+    <ClCompile Include="OGCAssistToolDlg.cpp" />
+    <ClCompile Include="PageConfig.cpp" />
+    <ClCompile Include="PageDebug.cpp" />
+    <ClCompile Include="PageLog.cpp" />
+    <ClCompile Include="PageStatistics.cpp" />
+    <ClCompile Include="PipeService.cpp" />
+    <ClCompile Include="ShadeButtonST.cpp" />
+    <ClCompile Include="SortHeaderCtrl.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="SubLabel.cpp" />
+    <ClCompile Include="tinyxml2.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="WinXPButtonST.cpp" />
+    <ClCompile Include="XColorStatic.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\cJson\cJSON.h" />
+    <ClInclude Include="..\cJson\cJSON_Utils.h" />
+    <ClInclude Include="..\cJson\JsonUtils.h" />
+    <ClInclude Include="..\cJson\Json_Type.h" />
+    <ClInclude Include="Base64.h" />
+    <ClInclude Include="BCMenu.h" />
+    <ClInclude Include="BtnST.h" />
+    <ClInclude Include="CeXDib.h" />
+    <ClInclude Include="CharConvert.h" />
+    <ClInclude Include="CharEncoding.h" />
+    <ClInclude Include="CritSection.h" />
+    <ClInclude Include="CurlClient.h" />
+    <ClInclude Include="DataImpl.h" />
+    <ClInclude Include="des.h" />
+    <ClInclude Include="DlgLogin.h" />
+    <ClInclude Include="FontSize.h" />
+    <ClInclude Include="Global.h" />
+    <ClInclude Include="HyperLink.h" />
+    <ClInclude Include="Injection.h" />
+    <ClInclude Include="ListSortCtrl.h" />
+    <ClInclude Include="log4z.h" />
+    <ClInclude Include="MD5.h" />
+    <ClInclude Include="MESdb.h" />
+    <ClInclude Include="MTVERIFY.H" />
+    <ClInclude Include="OGCAssistTool.h" />
+    <ClInclude Include="OGCAssistToolDlg.h" />
+    <ClInclude Include="PageConfig.h" />
+    <ClInclude Include="PageDebug.h" />
+    <ClInclude Include="PageLog.h" />
+    <ClInclude Include="PageStatistics.h" />
+    <ClInclude Include="PipeService.h" />
+    <ClInclude Include="Protocol.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="ShadeButtonST.h" />
+    <ClInclude Include="SortHeaderCtrl.h" />
+    <ClInclude Include="sqlite3.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="stdint.h" />
+    <ClInclude Include="SubLabel.h" />
+    <ClInclude Include="TableInfo.h" />
+    <ClInclude Include="targetver.h" />
+    <ClInclude Include="tinyxml2.h" />
+    <ClInclude Include="WinXPButtonST.h" />
+    <ClInclude Include="XColorStatic.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\logo.bmp" />
+    <Image Include="res\OGCAssistTool.ico" />
+    <Image Include="res\tab.bmp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="OGCAssistTool.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\OGCAssistTool.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="OGCAssistTool.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>

+ 297 - 0
Source/OGCAssistTool/OGCAssistTool/OGCAssistTool.vcxproj.filters

@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="源文件">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="头文件">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="资源文件">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="Page">
+      <UniqueIdentifier>{02721432-2287-4678-ac29-c8db9329a057}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Core">
+      <UniqueIdentifier>{b155593a-07bb-4ea6-91aa-16b16aab9119}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="UI">
+      <UniqueIdentifier>{c353f76f-d29b-4369-8736-5700a3639446}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="db">
+      <UniqueIdentifier>{8d1cba59-090f-465b-ab49-708b18eaa968}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="cJson">
+      <UniqueIdentifier>{4d108e14-d97e-4cab-8690-3adc5f7ed779}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="log4z.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="OGCAssistTool.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="OGCAssistToolDlg.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="DlgLogin.cpp">
+      <Filter>Page</Filter>
+    </ClCompile>
+    <ClCompile Include="PageConfig.cpp">
+      <Filter>Page</Filter>
+    </ClCompile>
+    <ClCompile Include="PageDebug.cpp">
+      <Filter>Page</Filter>
+    </ClCompile>
+    <ClCompile Include="PageLog.cpp">
+      <Filter>Page</Filter>
+    </ClCompile>
+    <ClCompile Include="PageStatistics.cpp">
+      <Filter>Page</Filter>
+    </ClCompile>
+    <ClCompile Include="Base64.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="CharConvert.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="CharEncoding.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="CurlClient.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="DataImpl.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="des.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="Global.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="Injection.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="MD5.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="PipeService.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="tinyxml2.cpp">
+      <Filter>Core</Filter>
+    </ClCompile>
+    <ClCompile Include="BCMenu.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="BtnST.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="CeXDib.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="FontSize.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="HyperLink.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="ListSortCtrl.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="ShadeButtonST.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="SortHeaderCtrl.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="SubLabel.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="WinXPButtonST.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="XColorStatic.cpp">
+      <Filter>UI</Filter>
+    </ClCompile>
+    <ClCompile Include="MESdb.cpp">
+      <Filter>db</Filter>
+    </ClCompile>
+    <ClCompile Include="..\cJson\cJSON.c">
+      <Filter>cJson</Filter>
+    </ClCompile>
+    <ClCompile Include="..\cJson\cJSON_Utils.c">
+      <Filter>cJson</Filter>
+    </ClCompile>
+    <ClCompile Include="..\cJson\JsonUtils.cpp">
+      <Filter>cJson</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="log4z.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="OGCAssistTool.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="OGCAssistToolDlg.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="sqlite3.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="DlgLogin.h">
+      <Filter>Page</Filter>
+    </ClInclude>
+    <ClInclude Include="PageConfig.h">
+      <Filter>Page</Filter>
+    </ClInclude>
+    <ClInclude Include="PageDebug.h">
+      <Filter>Page</Filter>
+    </ClInclude>
+    <ClInclude Include="PageLog.h">
+      <Filter>Page</Filter>
+    </ClInclude>
+    <ClInclude Include="PageStatistics.h">
+      <Filter>Page</Filter>
+    </ClInclude>
+    <ClInclude Include="Base64.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="CharConvert.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="CharEncoding.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="CritSection.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="CurlClient.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="DataImpl.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="des.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="Global.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="Injection.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="MD5.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="MTVERIFY.H">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="PipeService.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="Protocol.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="stdint.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="TableInfo.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="tinyxml2.h">
+      <Filter>Core</Filter>
+    </ClInclude>
+    <ClInclude Include="BCMenu.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="BtnST.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="CeXDib.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="FontSize.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="HyperLink.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="ListSortCtrl.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="ShadeButtonST.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="SortHeaderCtrl.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="SubLabel.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="WinXPButtonST.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="XColorStatic.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="MESdb.h">
+      <Filter>db</Filter>
+    </ClInclude>
+    <ClInclude Include="..\cJson\cJSON.h">
+      <Filter>cJson</Filter>
+    </ClInclude>
+    <ClInclude Include="..\cJson\cJSON_Utils.h">
+      <Filter>cJson</Filter>
+    </ClInclude>
+    <ClInclude Include="..\cJson\Json_Type.h">
+      <Filter>cJson</Filter>
+    </ClInclude>
+    <ClInclude Include="..\cJson\JsonUtils.h">
+      <Filter>cJson</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\logo.bmp">
+      <Filter>资源文件</Filter>
+    </Image>
+    <Image Include="res\OGCAssistTool.ico">
+      <Filter>资源文件</Filter>
+    </Image>
+    <Image Include="res\tab.bmp">
+      <Filter>资源文件</Filter>
+    </Image>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="OGCAssistTool.rc">
+      <Filter>资源文件</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\OGCAssistTool.rc2">
+      <Filter>资源文件</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+</Project>

+ 2065 - 0
Source/OGCAssistTool/OGCAssistTool/log4z.cpp

@@ -0,0 +1,2065 @@
+/*
+ * Log4z License
+ * -----------
+ * 
+ * Log4z is licensed under the terms of the MIT license reproduced below.
+ * This means that Log4z is free software and can be used for both academic
+ * and commercial purposes at absolutely no cost.
+ * 
+ * 
+ * ===============================================================================
+ * 
+ * Copyright (C) 2010-2017 YaweiZhang <yawei.zhang@foxmail.com>.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * 
+ * ===============================================================================
+ * 
+ * (end of COPYRIGHT)
+ */
+
+#include "log4z.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <math.h>
+#include <string>
+#include <vector>
+#include <map>
+#include <list>
+#include <algorithm>
+#include <iostream>
+
+
+#ifdef WIN32
+#include <io.h>
+#include <shlwapi.h>
+#include <process.h>
+#pragma comment(lib, "shlwapi")
+#pragma comment(lib, "User32.lib")
+#pragma warning(disable:4996)
+
+#else
+#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include<pthread.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <sys/syscall.h>
+#endif
+
+
+#ifdef __APPLE__
+#include "TargetConditionals.h"
+#include <dispatch/dispatch.h>
+#if !TARGET_OS_IPHONE
+#define LOG4Z_HAVE_LIBPROC
+#include <libproc.h>
+#endif
+#endif
+
+
+
+_ZSUMMER_BEGIN
+_ZSUMMER_LOG4Z_BEGIN
+
+static const char *const LOG_STRING[]=
+{
+    "LOG_TRACE",
+    "LOG_DEBUG",
+    "LOG_INFO ",
+    "LOG_WARN ",
+    "LOG_ERROR",
+    "LOG_ALARM",
+    "LOG_FATAL",
+};
+static const size_t LOG_STRING_LEN[] =
+{
+    sizeof("LOG_TRACE") - 1,
+    sizeof("LOG_DEBUG") - 1,
+    sizeof("LOG_INFO") - 1,
+    sizeof("LOG_WARN") - 1,
+    sizeof("LOG_ERROR") - 1,
+    sizeof("LOG_ALARM") - 1,
+    sizeof("LOG_FATAL") - 1,
+};
+
+#ifdef WIN32
+const static WORD LOG_COLOR[LOG_LEVEL_FATAL + 1] = {
+    0,
+    0,
+    FOREGROUND_BLUE | FOREGROUND_GREEN,
+    FOREGROUND_GREEN | FOREGROUND_RED,
+    FOREGROUND_RED,
+    FOREGROUND_GREEN,
+    FOREGROUND_RED | FOREGROUND_BLUE };
+#else
+
+const static char LOG_COLOR[LOG_LEVEL_FATAL + 1][50] = {
+    "\e[0m",
+    "\e[0m",
+    "\e[34m\e[1m",//hight blue
+    "\e[33m", //yellow
+    "\e[31m", //red
+    "\e[32m", //green
+    "\e[35m" };
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+//! Log4zFileHandler
+//////////////////////////////////////////////////////////////////////////
+class Log4zFileHandler
+{
+public:
+    Log4zFileHandler(){ _file = NULL; }
+    ~Log4zFileHandler(){ close(); }
+    inline bool isOpen(){ return _file != NULL; }
+    inline long open(const char *path, const char * mod)
+    {
+        if (_file != NULL){fclose(_file);_file = NULL;}
+        _file = fopen(path, mod);
+        if (_file)
+        {
+            long tel = 0;
+            long cur = ftell(_file);
+            fseek(_file, 0L, SEEK_END);
+            tel = ftell(_file);
+            fseek(_file, cur, SEEK_SET);
+            return tel;
+        }
+        return -1;
+    }
+    inline void clean(int index, int len)
+    {
+#if !defined(__APPLE__) && !defined(WIN32) 
+       if (_file != NULL)
+       {
+          int fd = fileno(_file);
+          fsync(fd);
+          posix_fadvise(fd, index, len, POSIX_FADV_DONTNEED);
+          fsync(fd);
+       }
+#endif
+    }
+    inline void close()
+    {
+        if (_file != NULL){clean(0, 0); fclose(_file);_file = NULL;}
+    }
+    inline void write(const char * data, size_t len)
+    {
+        if (_file && len > 0)
+        {
+            if (fwrite(data, 1, len, _file) != len)
+            {
+                close();
+            }
+        }
+    }
+    inline void flush(){ if (_file) fflush(_file); }
+
+    inline std::string readLine()
+    {
+        char buf[500] = { 0 };
+        if (_file && fgets(buf, 500, _file) != NULL)
+        {
+            return std::string(buf);
+        }
+        return std::string();
+    }
+    inline const std::string readContent();
+	inline bool removeFile(const std::string & path) { return ::remove(path.c_str()) == 0; }
+public:
+    FILE *_file;
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+//! UTILITY
+//////////////////////////////////////////////////////////////////////////
+
+
+static void fixPath(std::string &path);
+static void trimLogConfig(std::string &str, std::string extIgnore = std::string());
+static std::pair<std::string, std::string> splitPairString(const std::string & str, const std::string & delimiter);
+
+
+static bool isDirectory(std::string path);
+static bool createRecursionDir(std::string path);
+static std::string getProcessID();
+static std::string getProcessName();
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//! LockHelper
+//////////////////////////////////////////////////////////////////////////
+class LockHelper
+{
+public:
+    LockHelper();
+    virtual ~LockHelper();
+
+public:
+    void lock();
+    void unLock();
+private:
+#ifdef WIN32
+    CRITICAL_SECTION _crit;
+#else
+    pthread_mutex_t  _crit;
+#endif
+};
+
+//////////////////////////////////////////////////////////////////////////
+//! AutoLock
+//////////////////////////////////////////////////////////////////////////
+class AutoLock
+{
+public:
+    explicit AutoLock(LockHelper & lk):_lock(lk){_lock.lock();}
+    ~AutoLock(){_lock.unLock();}
+private:
+    LockHelper & _lock;
+};
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//! SemHelper
+//////////////////////////////////////////////////////////////////////////
+class SemHelper
+{
+public:
+    SemHelper();
+    virtual ~SemHelper();
+public:
+    bool create(int initcount);
+    bool wait(int timeout = 0);
+    bool post();
+private:
+#ifdef WIN32
+    HANDLE _hSem;
+#elif defined(__APPLE__)
+    dispatch_semaphore_t _semid;
+#else
+    sem_t _semid;
+    bool  _isCreate;
+#endif
+
+};
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//! ThreadHelper
+//////////////////////////////////////////////////////////////////////////
+#ifdef WIN32
+static unsigned int WINAPI  threadProc(LPVOID lpParam);
+#else
+static void * threadProc(void * pParam);
+#endif
+
+class ThreadHelper
+{
+public:
+    ThreadHelper(){_hThreadID = 0;}
+    virtual ~ThreadHelper(){}
+public:
+    bool start();
+    bool wait();
+    virtual void run() = 0;
+private:
+    unsigned long long _hThreadID;
+#ifndef WIN32
+    pthread_t _phtreadID;
+#endif
+};
+
+#ifdef WIN32
+unsigned int WINAPI  threadProc(LPVOID lpParam)
+{
+    ThreadHelper * p = (ThreadHelper *) lpParam;
+    p->run();
+    return 0;
+}
+#else
+void * threadProc(void * pParam)
+{
+    ThreadHelper * p = (ThreadHelper *) pParam;
+    p->run();
+    return NULL;
+}
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////
+//! LogData
+//////////////////////////////////////////////////////////////////////////
+enum LogDataType
+{
+    LDT_GENERAL,
+    LDT_ENABLE_LOGGER,
+    LDT_SET_LOGGER_NAME,
+    LDT_SET_LOGGER_PATH,
+    LDT_SET_LOGGER_LEVEL,
+    LDT_SET_LOGGER_FILELINE,
+    LDT_SET_LOGGER_DISPLAY,
+    LDT_SET_LOGGER_OUTFILE,
+    LDT_SET_LOGGER_LIMITSIZE,
+	LDT_SET_LOGGER_MONTHDIR,
+	LDT_SET_LOGGER_RESERVETIME,
+	//    LDT_SET_LOGGER_,
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+//! LoggerInfo
+//////////////////////////////////////////////////////////////////////////
+struct LoggerInfo 
+{
+    //! attribute
+    std::string _key;   //logger key
+    std::string _name;    // one logger one name.
+    std::string _path;    //path for log file.
+    int  _level;        //filter level
+    bool _display;        //display to screen 
+    bool _outfile;        //output to file
+    bool _monthdir;        //create directory per month 
+    unsigned int _limitsize; //limit file's size, unit Million byte.
+    bool _enable;        //logger is enable 
+    bool _fileLine;        //enable/disable the log's suffix.(file name:line number)
+	time_t _logReserveTime; //log file reserve time. unit is time second.
+    //! runtime info
+    time_t _curFileCreateTime;    //file create time
+    time_t _curFileCreateDay;    //file create day time
+    unsigned int _curFileIndex; //rolling file index
+    unsigned int _curWriteLen;  //current file length
+    Log4zFileHandler    _handle;        //file handle.
+	//!history
+	std::list<std::pair<time_t, std::string> > _historyLogs;
+
+    
+    LoggerInfo()
+    {
+        _enable = false; 
+        _path = LOG4Z_DEFAULT_PATH; 
+        _level = LOG4Z_DEFAULT_LEVEL; 
+        _display = LOG4Z_DEFAULT_DISPLAY; 
+        _outfile = LOG4Z_DEFAULT_OUTFILE;
+
+        _monthdir = LOG4Z_DEFAULT_MONTHDIR; 
+        _limitsize = LOG4Z_DEFAULT_LIMITSIZE;
+        _fileLine = LOG4Z_DEFAULT_SHOWSUFFIX;
+
+        _curFileCreateTime = 0;
+        _curFileCreateDay = 0;
+        _curFileIndex = 0;
+        _curWriteLen = 0;
+		_logReserveTime = 0;
+    }
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+//! LogerManager
+//////////////////////////////////////////////////////////////////////////
+class LogerManager : public ThreadHelper, public ILog4zManager
+{
+public:
+    LogerManager();
+    virtual ~LogerManager();
+    
+    bool configFromStringImpl(std::string content, bool isUpdate);
+    //! 读取配置文件并覆写
+    virtual bool config(const char* configPath);
+    virtual bool configFromString(const char* configContent);
+
+    //! 覆写式创建
+    virtual LoggerId createLogger(const char* key);
+    virtual bool start();
+    virtual bool stop();
+    virtual bool prePushLog(LoggerId id, int level);
+    virtual bool pushLog(LogData * pLog, const char * file, int line);
+    //! 查找ID
+    virtual LoggerId findLogger(const char*  key);
+    bool hotChange(LoggerId id, LogDataType ldt, int num, const std::string & text);
+    virtual bool enableLogger(LoggerId id, bool enable);
+    virtual bool setLoggerName(LoggerId id, const char * name);
+    virtual bool setLoggerPath(LoggerId id, const char * path);
+    virtual bool setLoggerLevel(LoggerId id, int nLevel);
+    virtual bool setLoggerFileLine(LoggerId id, bool enable);
+    virtual bool setLoggerDisplay(LoggerId id, bool enable);
+    virtual bool setLoggerOutFile(LoggerId id, bool enable);
+    virtual bool setLoggerLimitsize(LoggerId id, unsigned int limitsize);
+    virtual bool setLoggerMonthdir(LoggerId id, bool enable);
+	virtual bool setLoggerReserveTime(LoggerId id, time_t sec);
+    virtual bool setAutoUpdate(int interval);
+    virtual bool updateConfig();
+    virtual bool isLoggerEnable(LoggerId id);
+    virtual unsigned long long getStatusTotalWriteCount(){return _ullStatusTotalWriteFileCount;}
+    virtual unsigned long long getStatusTotalWriteBytes() { return _ullStatusTotalWriteFileBytes; }
+    virtual unsigned long long getStatusTotalPushQueue() { return _ullStatusTotalPushLog; }
+    virtual unsigned long long getStatusTotalPopQueue() { return _ullStatusTotalPopLog; }
+    virtual unsigned int getStatusActiveLoggers();
+protected:
+    virtual LogData * makeLogData(LoggerId id, int level);
+    virtual void freeLogData(LogData * log);
+    void showColorText(const char *text, int level = LOG_LEVEL_DEBUG);
+    bool onHotChange(LoggerId id, LogDataType ldt, int num, const std::string & text);
+    bool openLogger(LogData * log);
+    bool closeLogger(LoggerId id);
+    bool popLog(LogData *& log);
+    virtual void run();
+private:
+
+    //! thread status.
+    bool        _runing;
+    //! wait thread started.
+    SemHelper        _semaphore;
+
+    //! hot change name or path for one logger
+    int _hotUpdateInterval;
+    unsigned int _checksum;
+
+    //! the process info.
+    std::string _pid;
+    std::string _proName;
+
+    //! config file name
+    std::string _configFile;
+
+    //! logger id manager, [logger name]:[logger id].
+    std::map<std::string, LoggerId> _ids; 
+    // the last used id of _loggers
+    LoggerId    _lastId; 
+    LoggerInfo _loggers[LOG4Z_LOGGER_MAX];
+
+    
+    //! log queue
+    char _chunk1[256];
+    LockHelper    _logLock;
+    std::deque<LogData *> _logs;
+    unsigned long long _ullStatusTotalPushLog;
+
+    char _chunk2[256];
+    LockHelper    _freeLock;
+    std::vector<LogData*> _freeLogDatas;
+
+    char _chunk3[256];
+    //show color lock
+    LockHelper _scLock;
+    //status statistics
+    //write file
+    char _chunk4[256];
+    std::deque<LogData *> _logsCache;
+    unsigned long long _ullStatusTotalPopLog;
+    unsigned long long _ullStatusTotalWriteFileCount;
+    unsigned long long _ullStatusTotalWriteFileBytes;
+};
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//! Log4zFileHandler
+//////////////////////////////////////////////////////////////////////////
+
+const std::string Log4zFileHandler::readContent()
+{
+    std::string content;
+
+    if (!_file)
+    {
+        return content;
+    }
+    char buf[BUFSIZ];
+    size_t ret = 0;
+    do  
+    {
+        ret = fread(buf, sizeof(char), BUFSIZ, _file);
+        content.append(buf, ret);
+    }
+    while (ret == BUFSIZ);
+
+    return content;
+}
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//! utility
+//////////////////////////////////////////////////////////////////////////
+
+
+static inline void sleepMillisecond(unsigned int ms)
+{
+#ifdef WIN32
+    ::Sleep(ms);
+#else
+    usleep(1000*ms);
+#endif
+}
+
+static inline struct tm timeToTm(time_t t)
+{
+#ifdef WIN32
+#if _MSC_VER < 1400 //VS2003
+    return * localtime(&t);
+#else //vs2005->vs2013->
+    struct tm tt = { 0 };
+    localtime_s(&tt, &t);
+    return tt;
+#endif
+#else //linux
+    struct tm tt = { 0 };
+    localtime_r(&t, &tt);
+    return tt;
+#endif
+}
+
+
+
+
+static void fixPath(std::string &path)
+{
+    if (path.empty()){return;}
+    for (std::string::iterator iter = path.begin(); iter != path.end(); ++iter)
+    {
+        if (*iter == '\\'){*iter = '/';}
+    }
+    if (path.at(path.length()-1) != '/'){path.append("/");}
+}
+
+static void trimLogConfig(std::string &str, std::string extIgnore)
+{
+    if (str.empty()){return;}
+    extIgnore += "\r\n\t ";
+    int length = (int)str.length();
+    int posBegin = 0;
+    int posEnd = 0;
+
+    //trim utf8 file bom
+    if (str.length() >= 3 
+        && (unsigned char)str[0] == 0xef
+        && (unsigned char)str[1] == 0xbb
+        && (unsigned char)str[2] == 0xbf)
+    {
+        posBegin = 3;
+    }
+
+    //trim character 
+    for (int i = posBegin; i<length; i++)
+    {
+        bool bCheck = false;
+        for (int j = 0; j < (int)extIgnore.length(); j++)
+        {
+            if (str[i] == extIgnore[j])
+            {
+                bCheck = true;
+            }
+        }
+        if (bCheck)
+        {
+            if (i == posBegin)
+            {
+                posBegin++;
+            }
+        }
+        else
+        {
+            posEnd = i + 1;
+        }
+    }
+    if (posBegin < posEnd)
+    {
+        str = str.substr(posBegin, posEnd-posBegin);
+    }
+    else
+    {
+        str.clear();
+    }
+}
+
+//split
+static std::pair<std::string, std::string> splitPairString(const std::string & str, const std::string & delimiter)
+{
+    std::string::size_type pos = str.find(delimiter.c_str());
+    if (pos == std::string::npos)
+    {
+        return std::make_pair(str, "");
+    }
+    return std::make_pair(str.substr(0, pos), str.substr(pos+delimiter.length()));
+}
+
+static bool parseConfigLine(const std::string& line, int curLineNum, std::string & key, std::map<std::string, LoggerInfo> & outInfo)
+{
+    std::pair<std::string, std::string> kv = splitPairString(line, "=");
+    if (kv.first.empty())
+    {
+        return false;
+    }
+
+    trimLogConfig(kv.first);
+    trimLogConfig(kv.second);
+    if (kv.first.empty() || kv.first.at(0) == '#')
+    {
+        return true;
+    }
+
+    if (kv.first.at(0) == '[')
+    {
+        trimLogConfig(kv.first, "[]");
+        key = kv.first;
+        {
+            std::string tmpstr = kv.first;
+            std::transform(tmpstr.begin(), tmpstr.end(), tmpstr.begin(), ::tolower);
+            if (tmpstr == "main")
+            {
+                key = "Main";
+            }
+        }
+        std::map<std::string, LoggerInfo>::iterator iter = outInfo.find(key);
+        if (iter == outInfo.end())
+        {
+            LoggerInfo li;
+            li._enable = true;
+            li._key = key;
+            li._name = key;
+            outInfo.insert(std::make_pair(li._key, li));
+        }
+        else
+        {
+			printf("log4z configure warning: duplicate logger key:[%s] at line: %d \r\n", key.c_str(), curLineNum);
+        }
+        return true;
+    }
+    trimLogConfig(kv.first);
+    trimLogConfig(kv.second);
+    std::map<std::string, LoggerInfo>::iterator iter = outInfo.find(key);
+    if (iter == outInfo.end())
+    {
+		printf("log4z configure warning: not found current logger name:[%s] at line:%d, key=%s, value=%s \r\n", 
+			key.c_str(), curLineNum, kv.first.c_str(), kv.second.c_str());
+        return true;
+    }
+    std::transform(kv.first.begin(), kv.first.end(), kv.first.begin(), ::tolower);
+    //! path
+    if (kv.first == "path")
+    {
+        iter->second._path = kv.second;
+        return true;
+    }
+    else if (kv.first == "name")
+    {
+        iter->second._name = kv.second;
+        return true;
+    }
+    std::transform(kv.second.begin(), kv.second.end(), kv.second.begin(), ::tolower);
+    //! level
+    if (kv.first == "level")
+    {
+        if (kv.second == "trace" || kv.second == "all")
+        {
+            iter->second._level = LOG_LEVEL_TRACE;
+        }
+        else if (kv.second == "debug")
+        {
+            iter->second._level = LOG_LEVEL_DEBUG;
+        }
+        else if (kv.second == "info")
+        {
+            iter->second._level = LOG_LEVEL_INFO;
+        }
+        else if (kv.second == "warn" || kv.second == "warning")
+        {
+            iter->second._level = LOG_LEVEL_WARN;
+        }
+        else if (kv.second == "error")
+        {
+            iter->second._level = LOG_LEVEL_ERROR;
+        }
+        else if (kv.second == "alarm")
+        {
+            iter->second._level = LOG_LEVEL_ALARM;
+        }
+        else if (kv.second == "fatal")
+        {
+            iter->second._level = LOG_LEVEL_FATAL;
+        }
+    }
+    //! display
+    else if (kv.first == "display")
+    {
+        if (kv.second == "false" || kv.second == "0")
+        {
+            iter->second._display = false;
+        }
+        else
+        {
+            iter->second._display = true;
+        }
+    }
+    //! output to file
+    else if (kv.first == "outfile")
+    {
+        if (kv.second == "false" || kv.second == "0")
+        {
+            iter->second._outfile = false;
+        }
+        else
+        {
+            iter->second._outfile = true;
+        }
+    }
+    //! monthdir
+    else if (kv.first == "monthdir")
+    {
+        if (kv.second == "false" || kv.second == "0")
+        {
+            iter->second._monthdir = false;
+        }
+        else
+        {
+            iter->second._monthdir = true;
+        }
+    }
+    //! limit file size
+    else if (kv.first == "limitsize")
+    {
+        iter->second._limitsize = atoi(kv.second.c_str());
+    }
+    //! display log in file line
+    else if (kv.first == "fileline")
+    {
+        if (kv.second == "false" || kv.second == "0")
+        {
+            iter->second._fileLine = false;
+        }
+        else
+        {
+            iter->second._fileLine = true;
+        }
+    }
+    //! enable/disable one logger
+    else if (kv.first == "enable")
+    {
+        if (kv.second == "false" || kv.second == "0")
+        {
+            iter->second._enable = false;
+        }
+        else
+        {
+            iter->second._enable = true;
+        }
+    }
+	//! set reserve time 
+	else if (kv.first == "reserve")
+	{
+		iter->second._logReserveTime = atoi(kv.second.c_str());
+	}
+    return true;
+}
+
+static bool parseConfigFromString(std::string content, std::map<std::string, LoggerInfo> & outInfo)
+{
+
+    std::string key;
+    int curLine = 1;
+    std::string line;
+    std::string::size_type curPos = 0;
+    if (content.empty())
+    {
+        return true;
+    }
+    do
+    {
+        std::string::size_type pos = std::string::npos;
+        for (std::string::size_type i = curPos; i < content.length(); ++i)
+        {
+            //support linux/unix/windows LRCF
+            if (content[i] == '\r' || content[i] == '\n')
+            {
+                pos = i;
+                break;
+            }
+        }
+        line = content.substr(curPos, pos - curPos);
+        parseConfigLine(line, curLine, key, outInfo);
+        curLine++;
+
+        if (pos == std::string::npos)
+        {
+            break;
+        }
+        else
+        {
+            curPos = pos+1;
+        }
+    } while (1);
+    return true;
+}
+
+
+
+bool isDirectory(std::string path)
+{
+#ifdef WIN32
+    return PathIsDirectoryA(path.c_str()) ? true : false;
+#else
+    DIR * pdir = opendir(path.c_str());
+    if (pdir == NULL)
+    {
+        return false;
+    }
+    else
+    {
+        closedir(pdir);
+        pdir = NULL;
+        return true;
+    }
+#endif
+}
+
+
+
+bool createRecursionDir(std::string path)
+{
+    if (path.length() == 0) return true;
+    std::string sub;
+    fixPath(path);
+
+    std::string::size_type pos = path.find('/');
+    while (pos != std::string::npos)
+    {
+        std::string cur = path.substr(0, pos-0);
+        if (cur.length() > 0 && !isDirectory(cur))
+        {
+            bool ret = false;
+#ifdef WIN32
+            ret = CreateDirectoryA(cur.c_str(), NULL) ? true : false;
+#else
+            ret = (mkdir(cur.c_str(), S_IRWXU|S_IRWXG|S_IRWXO) == 0);
+#endif
+            if (!ret)
+            {
+                return false;
+            }
+        }
+        pos = path.find('/', pos+1);
+    }
+
+    return true;
+}
+
+std::string getProcessID()
+{
+    std::string pid = "0";
+    char buf[260] = {0};
+#ifdef WIN32
+    DWORD winPID = GetCurrentProcessId();
+    sprintf(buf, "%06u", winPID);
+    pid = buf;
+#else
+    sprintf(buf, "%06d", getpid());
+    pid = buf;
+#endif
+    return pid;
+}
+
+
+std::string getProcessName()
+{
+    std::string name = "process";
+    char buf[260] = {0};
+#ifdef WIN32
+    if (GetModuleFileNameA(NULL, buf, 259) > 0)
+    {
+        name = buf;
+    }
+    std::string::size_type pos = name.rfind("\\");
+    if (pos != std::string::npos)
+    {
+        name = name.substr(pos+1, std::string::npos);
+    }
+    pos = name.rfind(".");
+    if (pos != std::string::npos)
+    {
+        name = name.substr(0, pos-0);
+    }
+
+#elif defined(LOG4Z_HAVE_LIBPROC)
+    proc_name(getpid(), buf, 260);
+    name = buf;
+    return name;;
+#else
+    sprintf(buf, "/proc/%d/cmdline", (int)getpid());
+    Log4zFileHandler i;
+    i.open(buf, "rb");
+    if (!i.isOpen())
+    {
+        return name;
+    }
+    name = i.readLine();
+    i.close();
+
+    std::string::size_type pos = name.rfind("/");
+    if (pos != std::string::npos)
+    {
+        name = name.substr(pos+1, std::string::npos);
+    }
+#endif
+
+
+    return name;
+}
+
+
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// LockHelper
+//////////////////////////////////////////////////////////////////////////
+LockHelper::LockHelper()
+{
+#ifdef WIN32
+    InitializeCriticalSection(&_crit);
+#else
+    //_crit = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+    pthread_mutexattr_t attr;
+    pthread_mutexattr_init(&attr);
+    //pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_TIMED_NP);
+    //pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    pthread_mutex_init(&_crit, &attr);
+    pthread_mutexattr_destroy(&attr);
+#endif
+}
+LockHelper::~LockHelper()
+{
+#ifdef WIN32
+    DeleteCriticalSection(&_crit);
+#else
+    pthread_mutex_destroy(&_crit);
+#endif
+}
+
+void LockHelper::lock()
+{
+#ifdef WIN32
+    EnterCriticalSection(&_crit);
+#else
+    pthread_mutex_lock(&_crit);
+#endif
+}
+void LockHelper::unLock()
+{
+#ifdef WIN32
+    LeaveCriticalSection(&_crit);
+#else
+    pthread_mutex_unlock(&_crit);
+#endif
+}
+//////////////////////////////////////////////////////////////////////////
+// SemHelper
+//////////////////////////////////////////////////////////////////////////
+SemHelper::SemHelper()
+{
+#ifdef WIN32
+    _hSem = NULL;
+#elif defined(__APPLE__)
+    _semid = NULL;
+#else
+    _isCreate = false;
+#endif
+
+}
+SemHelper::~SemHelper()
+{
+#ifdef WIN32
+    if (_hSem != NULL)
+    {
+        CloseHandle(_hSem);
+        _hSem = NULL;
+    }
+#elif defined(__APPLE__)
+    if (_semid)
+    {
+        dispatch_release(_semid);
+        _semid = NULL;
+    }
+#else
+    if (_isCreate)
+    {
+        _isCreate = false;
+        sem_destroy(&_semid);
+    }
+#endif
+
+}
+
+bool SemHelper::create(int initcount)
+{
+    if (initcount < 0)
+    {
+        initcount = 0;
+    }
+#ifdef WIN32
+    if (initcount > 64)
+    {
+        return false;
+    }
+    _hSem = CreateSemaphore(NULL, initcount, 64, NULL);
+    if (_hSem == NULL)
+    {
+        return false;
+    }
+#elif defined(__APPLE__)
+    _semid = dispatch_semaphore_create(initcount);
+    if (!_semid)
+    {
+        return false;
+    }
+#else
+    if (sem_init(&_semid, 0, initcount) != 0)
+    {
+        return false;
+    }
+    _isCreate = true;
+#endif
+
+    return true;
+}
+bool SemHelper::wait(int timeout)
+{
+#ifdef WIN32
+    if (timeout <= 0)
+    {
+        timeout = INFINITE;
+    }
+    if (WaitForSingleObject(_hSem, timeout) != WAIT_OBJECT_0)
+    {
+        return false;
+    }
+#elif defined(__APPLE__)
+    if (dispatch_semaphore_wait(_semid, dispatch_time(DISPATCH_TIME_NOW, timeout*1000)) != 0)
+    {
+        return false;
+    }
+#else
+    if (timeout <= 0)
+    {
+        return (sem_wait(&_semid) == 0);
+    }
+    else
+    {
+        struct timeval tm;
+        gettimeofday(&tm, NULL);
+        long long endtime = tm.tv_sec *1000 + tm.tv_usec/1000 + timeout;
+        do 
+        {
+            sleepMillisecond(50);
+            int ret = sem_trywait(&_semid);
+            if (ret == 0)
+            {
+                return true;
+            }
+            struct timeval tv_cur;
+            gettimeofday(&tv_cur, NULL);
+            if (tv_cur.tv_sec*1000 + tv_cur.tv_usec/1000 > endtime)
+            {
+                return false;
+            }
+
+            if (ret == -1 && errno == EAGAIN)
+            {
+                continue;
+            }
+            else
+            {
+                return false;
+            }
+        } while (true);
+        return false;
+    }
+#endif
+    return true;
+}
+
+bool SemHelper::post()
+{
+#ifdef WIN32
+    return ReleaseSemaphore(_hSem, 1, NULL) ? true : false;
+#elif defined(__APPLE__)
+    return dispatch_semaphore_signal(_semid) == 0;
+#else
+    return (sem_post(&_semid) == 0);
+#endif
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+//! ThreadHelper
+//////////////////////////////////////////////////////////////////////////
+bool ThreadHelper::start()
+{
+#ifdef WIN32
+    unsigned long long ret = _beginthreadex(NULL, 0, threadProc, (void *) this, 0, NULL);
+
+    if (ret == -1 || ret == 0)
+    {
+		printf("log4z: create log4z thread error! \r\n");
+        return false;
+    }
+    _hThreadID = ret;
+#else
+    int ret = pthread_create(&_phtreadID, NULL, threadProc, (void*)this);
+    if (ret != 0)
+    {
+		printf("log4z: create log4z thread error! \r\n");
+        return false;
+    }
+#endif
+    return true;
+}
+
+bool ThreadHelper::wait()
+{
+#ifdef WIN32
+    if (WaitForSingleObject((HANDLE)_hThreadID, INFINITE) != WAIT_OBJECT_0)
+    {
+        return false;
+    }
+#else
+    if (pthread_join(_phtreadID, NULL) != 0)
+    {
+        return false;
+    }
+#endif
+    return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//! LogerManager
+//////////////////////////////////////////////////////////////////////////
+LogerManager::LogerManager()
+{
+    _runing = false;
+    _lastId = LOG4Z_MAIN_LOGGER_ID;
+    _hotUpdateInterval = 0;
+
+    _ullStatusTotalPushLog = 0;
+    _ullStatusTotalPopLog = 0;
+    _ullStatusTotalWriteFileCount = 0;
+    _ullStatusTotalWriteFileBytes = 0;
+    
+    _pid = getProcessID();
+    _proName = getProcessName();
+    _loggers[LOG4Z_MAIN_LOGGER_ID]._enable = true;
+    _ids[LOG4Z_MAIN_LOGGER_KEY] = LOG4Z_MAIN_LOGGER_ID;
+    _loggers[LOG4Z_MAIN_LOGGER_ID]._key = LOG4Z_MAIN_LOGGER_KEY;
+    _loggers[LOG4Z_MAIN_LOGGER_ID]._name = LOG4Z_MAIN_LOGGER_KEY;
+
+    _chunk1[0] = '\0';
+    _chunk2[1] = '\0';
+    _chunk3[2] = '\0';
+    _chunk4[3] = '\0';
+}
+LogerManager::~LogerManager()
+{
+    stop();
+}
+
+
+LogData * LogerManager::makeLogData(LoggerId id, int level)
+{
+    LogData * pLog = NULL;
+    if (true)
+    {
+        if (!_freeLogDatas.empty())
+        {
+            AutoLock l(_freeLock);
+            if (!_freeLogDatas.empty())
+            {
+                pLog = _freeLogDatas.back();
+                _freeLogDatas.pop_back();
+            }
+        }
+        if (pLog == NULL)
+        {
+            pLog = new(malloc(sizeof(LogData) + LOG4Z_LOG_BUF_SIZE-1))LogData();
+        }
+    }
+    //append precise time to log
+    if (true)
+    {
+        pLog->_id = id;
+        pLog->_level = level;
+        pLog->_type = LDT_GENERAL;
+        pLog->_typeval = 0;
+        pLog->_threadID = 0;
+        pLog->_contentLen = 0;
+#ifdef WIN32
+        FILETIME ft;
+        GetSystemTimeAsFileTime(&ft);
+        unsigned long long now = ft.dwHighDateTime;
+        now <<= 32;
+        now |= ft.dwLowDateTime;
+        now /= 10;
+        now -= 11644473600000000ULL;
+        now /= 1000;
+        pLog->_time = now / 1000;
+        pLog->_precise = (unsigned int)(now % 1000);
+#else
+        struct timeval tm;
+        gettimeofday(&tm, NULL);
+        pLog->_time = tm.tv_sec;
+        pLog->_precise = tm.tv_usec / 1000;
+#endif
+#ifdef WIN32
+        pLog->_threadID = GetCurrentThreadId();
+#elif defined(__APPLE__)
+        unsigned long long tid = 0;
+        pthread_threadid_np(NULL, &tid);
+        pLog->_threadID = (unsigned int) tid;
+#else
+        pLog->_threadID = (unsigned int)syscall(SYS_gettid);
+#endif
+    }
+
+    //format log
+    if (true)
+    {
+#ifdef WIN32
+        static __declspec(thread) tm g_tt = { 0 };
+        static __declspec(thread) time_t g_curDayTime =  0 ;
+#else
+        static __thread tm g_tt = { 0 };
+        static __thread time_t g_curDayTime = 0;
+#endif // WIN32
+        if (pLog->_time < g_curDayTime || pLog->_time >= g_curDayTime + 24*3600)
+        {
+            g_tt = timeToTm(pLog->_time);
+            g_tt.tm_hour = 0;
+            g_tt.tm_min = 0;
+            g_tt.tm_sec = 0;
+            g_curDayTime = mktime(&g_tt);
+        }
+        time_t sec = pLog->_time - g_curDayTime;
+        Log4zStream ls(pLog->_content, LOG4Z_LOG_BUF_SIZE);
+        ls.writeULongLong(g_tt.tm_year + 1900, 4);
+        ls.writeChar('-');
+        ls.writeULongLong(g_tt.tm_mon + 1, 2);
+        ls.writeChar('-');
+        ls.writeULongLong(g_tt.tm_mday, 2);
+        ls.writeChar(' ');
+        ls.writeULongLong(sec/3600, 2);
+        ls.writeChar(':');
+        ls.writeULongLong((sec % 3600)/60 , 2);
+        ls.writeChar(':');
+        ls.writeULongLong(sec % 60, 2);
+        ls.writeChar('.');
+        ls.writeULongLong(pLog->_precise, 3);
+        ls.writeChar(' ');
+        ls.writeChar('[');
+        ls.writeULongLong(pLog->_threadID, 4);
+        ls.writeChar(']');
+
+        ls.writeChar(' ');
+        ls.writeString(LOG_STRING[pLog->_level], LOG_STRING_LEN[pLog->_level]);
+        ls.writeChar(' ');
+        pLog->_contentLen = ls.getCurrentLen();
+    }
+    return pLog;
+}
+void LogerManager::freeLogData(LogData * log)
+{
+    if (_freeLogDatas.size() < 200)
+    {
+        AutoLock l(_freeLock);
+        _freeLogDatas.push_back(log);
+    }
+    else
+    {
+        log->~LogData();
+        free( log);
+    }
+}
+
+void LogerManager::showColorText(const char *text, int level)
+{
+
+#if defined(WIN32) && defined(LOG4Z_OEM_CONSOLE)
+    char oem[LOG4Z_LOG_BUF_SIZE] = { 0 };
+    CharToOemBuffA(text, oem, LOG4Z_LOG_BUF_SIZE);
+#endif
+
+    if (level <= LOG_LEVEL_DEBUG || level > LOG_LEVEL_FATAL)
+    {
+#if defined(WIN32) && defined(LOG4Z_OEM_CONSOLE)
+        printf("%s", oem);
+#else
+        printf("%s", text);
+#endif
+        return;
+    }
+#ifndef WIN32
+    printf("%s%s\e[0m", LOG_COLOR[level], text);
+#else
+    AutoLock l(_scLock);
+    HANDLE hStd = ::GetStdHandle(STD_OUTPUT_HANDLE);
+    if (hStd == INVALID_HANDLE_VALUE) return;
+    CONSOLE_SCREEN_BUFFER_INFO oldInfo;
+    if (!GetConsoleScreenBufferInfo(hStd, &oldInfo))
+    {
+        return;
+    }
+    else
+    {
+        SetConsoleTextAttribute(hStd, LOG_COLOR[level]);
+#ifdef LOG4Z_OEM_CONSOLE
+		printf("%s", oem);
+#else
+		printf("%s", text);
+#endif
+		SetConsoleTextAttribute(hStd, oldInfo.wAttributes);
+    }
+#endif
+    return;
+}
+
+bool LogerManager::configFromStringImpl(std::string content, bool isUpdate)
+{
+    unsigned int sum = 0;
+    for (std::string::iterator iter = content.begin(); iter != content.end(); ++iter)
+    {
+        sum += (unsigned char)*iter;
+    }
+    if (sum == _checksum)
+    {
+        return true;
+    }
+    _checksum = sum;
+    
+
+    std::map<std::string, LoggerInfo> loggerMap;
+    if (!parseConfigFromString(content, loggerMap))
+    {
+        printf(" !!! !!! !!! !!!\r\n");
+		printf(" !!! !!! log4z load config file error \r\n");
+		printf(" !!! !!! !!! !!!\r\n");
+        return false;
+    }
+    for (std::map<std::string, LoggerInfo>::iterator iter = loggerMap.begin(); iter != loggerMap.end(); ++iter)
+    {
+        LoggerId id = LOG4Z_INVALID_LOGGER_ID;
+        id = findLogger(iter->second._key.c_str());
+        if (id == LOG4Z_INVALID_LOGGER_ID)
+        {
+            if (isUpdate)
+            {
+                continue;
+            }
+            else
+            {
+                id = createLogger(iter->second._key.c_str());
+                if (id == LOG4Z_INVALID_LOGGER_ID)
+                {
+                    continue;
+                }
+            }
+        }
+        enableLogger(id, iter->second._enable);
+        setLoggerName(id, iter->second._name.c_str());
+        setLoggerPath(id, iter->second._path.c_str());
+        setLoggerLevel(id, iter->second._level);
+        setLoggerFileLine(id, iter->second._fileLine);
+        setLoggerDisplay(id, iter->second._display);
+        setLoggerOutFile(id, iter->second._outfile);
+        setLoggerLimitsize(id, iter->second._limitsize);
+        setLoggerMonthdir(id, iter->second._monthdir);
+    }
+    return true;
+}
+
+//! read configure and create with overwriting
+bool LogerManager::config(const char* configPath)
+{
+    if (!_configFile.empty())
+    {
+		printf(" !!! !!! !!! !!!\r\n");
+		printf(" !!! !!! log4z configure error: too many calls to Config. the old config file=%s,  the new config file=%s !!! !!! \r\n"
+		, _configFile.c_str(), configPath);
+		printf(" !!! !!! !!! !!!\r\n");
+        return false;
+    }
+    _configFile = configPath;
+
+    Log4zFileHandler f;
+    f.open(_configFile.c_str(), "rb");
+    if (!f.isOpen())
+    {
+		printf(" !!! !!! !!! !!!\r\n");
+		printf(" !!! !!! log4z load config file error. filename=%s  !!! !!! \r\n", configPath);
+		printf(" !!! !!! !!! !!!\r\n");
+        return false;
+    }
+    return configFromStringImpl(f.readContent().c_str(), false);
+}
+
+//! read configure and create with overwriting
+bool LogerManager::configFromString(const char* configContent)
+{
+    return configFromStringImpl(configContent, false);
+}
+
+//! create with overwriting
+LoggerId LogerManager::createLogger(const char* key)
+{
+    if (key == NULL)
+    {
+        return LOG4Z_INVALID_LOGGER_ID;
+    }
+    
+    std::string copyKey = key;
+    trimLogConfig(copyKey);
+
+    LoggerId newID = LOG4Z_INVALID_LOGGER_ID;
+    {
+        std::map<std::string, LoggerId>::iterator iter = _ids.find(copyKey);
+        if (iter != _ids.end())
+        {
+            newID = iter->second;
+        }
+    }
+    if (newID == LOG4Z_INVALID_LOGGER_ID)
+    {
+        if (_lastId +1 >= LOG4Z_LOGGER_MAX)
+        {
+            showColorText("log4z: CreateLogger can not create|writeover, because loggerid need < LOGGER_MAX! \r\n", LOG_LEVEL_FATAL);
+            return LOG4Z_INVALID_LOGGER_ID;
+        }
+        newID = ++ _lastId;
+        _ids[copyKey] = newID;
+        _loggers[newID]._enable = true;
+        _loggers[newID]._key = copyKey;
+        _loggers[newID]._name = copyKey;
+    }
+
+    return newID;
+}
+
+
+bool LogerManager::start()
+{
+    if (_runing)
+    {
+        showColorText("log4z already start \r\n", LOG_LEVEL_FATAL);
+        return false;
+    }
+    _semaphore.create(0);
+    bool ret = ThreadHelper::start();
+    return ret && _semaphore.wait(3000);
+}
+bool LogerManager::stop()
+{
+    if (_runing)
+    {
+        showColorText("log4z stopping \r\n", LOG_LEVEL_FATAL);
+        _runing = false;
+        wait();
+        while (!_freeLogDatas.empty())
+        {
+            delete _freeLogDatas.back();
+            _freeLogDatas.pop_back();
+        }
+        return true;
+    }
+    return false;
+}
+bool LogerManager::prePushLog(LoggerId id, int level)
+{
+    if (id < 0 || id > _lastId || !_runing || !_loggers[id]._enable)
+    {
+        return false;
+    }
+    if (level < _loggers[id]._level)
+    {
+        return false;
+    }
+    size_t count = _logs.size();
+
+    if (count > LOG4Z_LOG_QUEUE_LIMIT_SIZE)
+    {
+        size_t rate = (count - LOG4Z_LOG_QUEUE_LIMIT_SIZE) * 100 / LOG4Z_LOG_QUEUE_LIMIT_SIZE;
+        if (rate > 100)
+        {
+            rate = 100;
+        }
+        if ((size_t)rand() % 100 < rate)
+        {
+            if (rate > 50)
+            {
+                AutoLock l(_logLock);
+                count = _logs.size();
+            }
+            if (count > LOG4Z_LOG_QUEUE_LIMIT_SIZE)
+            {
+                sleepMillisecond((unsigned int)(rate));
+            }
+        }
+    }
+    return true;
+}
+bool LogerManager::pushLog(LogData * pLog, const char * file, int line)
+{
+    // discard log
+    if (pLog->_id < 0 || pLog->_id > _lastId || !_runing || !_loggers[pLog->_id]._enable)
+    {
+        freeLogData(pLog);
+        return false;
+    }
+
+    //filter log
+    if (pLog->_level < _loggers[pLog->_id]._level)
+    {
+        freeLogData(pLog);
+        return false;
+    }
+    if (_loggers[pLog->_id]._fileLine && file)
+    {
+        const char * pNameEnd = file + strlen(file);
+        const char * pNameBegin = pNameEnd;
+        do
+        {
+            if (*pNameBegin == '\\' || *pNameBegin == '/') { pNameBegin++; break; }
+            if (pNameBegin == file) { break; }
+            pNameBegin--;
+        } while (true);
+        zsummer::log4z::Log4zStream ss(pLog->_content + pLog->_contentLen, LOG4Z_LOG_BUF_SIZE - pLog->_contentLen); 
+        ss.writeChar(' ');
+        ss.writeString(pNameBegin, pNameEnd - pNameBegin);
+        ss.writeChar(':');
+        ss.writeULongLong((unsigned long long)line);
+        pLog->_contentLen += ss.getCurrentLen();
+    }
+
+    if (pLog->_contentLen +3 > LOG4Z_LOG_BUF_SIZE ) pLog->_contentLen = LOG4Z_LOG_BUF_SIZE - 3;
+    pLog->_content[pLog->_contentLen + 0] = '\r';
+    pLog->_content[pLog->_contentLen + 1] = '\n';
+    pLog->_content[pLog->_contentLen + 2] = '\0';
+    pLog->_contentLen += 2;
+
+
+    if (_loggers[pLog->_id]._display && LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+    {
+        showColorText(pLog->_content, pLog->_level);
+    }
+
+    if (LOG4Z_ALL_DEBUGOUTPUT_DISPLAY && LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+    {
+#ifdef WIN32
+        OutputDebugStringA(pLog->_content);
+#endif
+    }
+
+    if (_loggers[pLog->_id]._outfile && LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+    {
+        AutoLock l(_logLock);
+        if (openLogger(pLog))
+        {
+            _loggers[pLog->_id]._handle.write(pLog->_content, pLog->_contentLen);
+            _loggers[pLog->_id]._curWriteLen += (unsigned int)pLog->_contentLen;
+            closeLogger(pLog->_id);
+            _ullStatusTotalWriteFileCount++;
+            _ullStatusTotalWriteFileBytes += pLog->_contentLen;
+        }
+    }
+
+    if (LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+    {
+        freeLogData(pLog);
+        return true;
+    }
+    
+    AutoLock l(_logLock);
+    _logs.push_back(pLog);
+    _ullStatusTotalPushLog ++;
+    return true;
+}
+
+//! 查找ID
+LoggerId LogerManager::findLogger(const char * key)
+{
+    std::map<std::string, LoggerId>::iterator iter;
+    iter = _ids.find(key);
+    if (iter != _ids.end())
+    {
+        return iter->second;
+    }
+    return LOG4Z_INVALID_LOGGER_ID;
+}
+
+bool LogerManager::hotChange(LoggerId id, LogDataType ldt, int num, const std::string & text)
+{
+    if (id <0 || id > _lastId) return false;
+    if (text.length() >= LOG4Z_LOG_BUF_SIZE) return false;
+    if (!_runing || LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+    {
+        return onHotChange(id, ldt, num, text);
+    }
+    LogData * pLog = makeLogData(id, LOG4Z_DEFAULT_LEVEL);
+    pLog->_id = id;
+    pLog->_type = ldt;
+    pLog->_typeval = num;
+    memcpy(pLog->_content, text.c_str(), text.length());
+    pLog->_contentLen = (int)text.length();
+    AutoLock l(_logLock);
+    _logs.push_back(pLog);
+    return true;
+}
+
+bool LogerManager::onHotChange(LoggerId id, LogDataType ldt, int num, const std::string & text)
+{
+    if (id < LOG4Z_MAIN_LOGGER_ID || id > _lastId)
+    {
+        return false;
+    }
+    LoggerInfo & logger = _loggers[id];
+    if (ldt == LDT_ENABLE_LOGGER) logger._enable = num != 0;
+    else if (ldt == LDT_SET_LOGGER_NAME) logger._name = text;
+    else if (ldt == LDT_SET_LOGGER_PATH) logger._path = text;
+    else if (ldt == LDT_SET_LOGGER_LEVEL) logger._level = num;
+    else if (ldt == LDT_SET_LOGGER_FILELINE) logger._fileLine = num != 0;
+    else if (ldt == LDT_SET_LOGGER_DISPLAY) logger._display = num != 0;
+    else if (ldt == LDT_SET_LOGGER_OUTFILE) logger._outfile = num != 0;
+    else if (ldt == LDT_SET_LOGGER_LIMITSIZE) logger._limitsize = num;
+	else if (ldt == LDT_SET_LOGGER_MONTHDIR) logger._monthdir = num != 0;
+	else if (ldt == LDT_SET_LOGGER_RESERVETIME) logger._logReserveTime = num >= 0 ? num : 0;
+	return true;
+}
+
+bool LogerManager::enableLogger(LoggerId id, bool enable) 
+{
+    if (id < 0 || id > _lastId) return false;
+    if (enable)
+    {
+        _loggers[id]._enable = true;
+        return true;
+    }
+    return hotChange(id, LDT_ENABLE_LOGGER, false, ""); 
+}
+bool LogerManager::setLoggerLevel(LoggerId id, int level) 
+{ 
+    if (id < 0 || id > _lastId) return false;
+    if (level <= _loggers[id]._level)
+    {
+        _loggers[id]._level = level;
+        return true;
+    }
+    return hotChange(id, LDT_SET_LOGGER_LEVEL, level, ""); 
+}
+bool LogerManager::setLoggerDisplay(LoggerId id, bool enable) { return hotChange(id, LDT_SET_LOGGER_DISPLAY, enable, ""); }
+bool LogerManager::setLoggerOutFile(LoggerId id, bool enable) { return hotChange(id, LDT_SET_LOGGER_OUTFILE, enable, ""); }
+bool LogerManager::setLoggerMonthdir(LoggerId id, bool enable) { return hotChange(id, LDT_SET_LOGGER_MONTHDIR, enable, ""); }
+bool LogerManager::setLoggerFileLine(LoggerId id, bool enable) { return hotChange(id, LDT_SET_LOGGER_FILELINE, enable, ""); }
+bool LogerManager::setLoggerReserveTime(LoggerId id, time_t sec) { return hotChange(id, LDT_SET_LOGGER_RESERVETIME, (int)sec, ""); }
+bool LogerManager::setLoggerLimitsize(LoggerId id, unsigned int limitsize)
+{
+    if (limitsize == 0 ) {limitsize = (unsigned int)-1;}
+    return hotChange(id, LDT_SET_LOGGER_LIMITSIZE, limitsize, "");
+}
+
+bool LogerManager::setLoggerName(LoggerId id, const char * name)
+{
+    if (id <0 || id > _lastId) return false;
+    //the name by main logger is the process name and it's can't change. 
+//    if (id == LOG4Z_MAIN_LOGGER_ID) return false; 
+    
+    if (name == NULL || strlen(name) == 0) 
+    {
+        return false;
+    }
+    return hotChange(id, LDT_SET_LOGGER_NAME, 0, name);
+}
+
+bool LogerManager::setLoggerPath(LoggerId id, const char * path)
+{
+    if (id <0 || id > _lastId) return false;
+    if (path == NULL || strlen(path) == 0)  return false;
+    std::string copyPath = path;
+    {
+        char ch = copyPath.at(copyPath.length() - 1);
+        if (ch != '\\' && ch != '/')
+        {
+            copyPath.append("/");
+        }
+    }
+    return hotChange(id, LDT_SET_LOGGER_PATH, 0, copyPath);
+}
+bool LogerManager::setAutoUpdate(int interval)
+{
+    _hotUpdateInterval = interval;
+    return true;
+}
+bool LogerManager::updateConfig()
+{
+    if (_configFile.empty())
+    {
+        //LOGW("log4z update config file error. filename is empty.");
+        return false;
+    }
+    Log4zFileHandler f;
+    f.open(_configFile.c_str(), "rb");
+    if (!f.isOpen())
+    {
+		printf(" !!! !!! !!! !!!\r\n");
+		printf(" !!! !!! log4z load config file error. filename=%s  !!! !!! \r\n", _configFile.c_str());
+		printf(" !!! !!! !!! !!!\r\n");
+        return false;
+    }
+    return configFromStringImpl(f.readContent().c_str(), true);
+}
+
+bool LogerManager::isLoggerEnable(LoggerId id)
+{
+    if (id <0 || id > _lastId) return false;
+    return _loggers[id]._enable;
+}
+
+unsigned int LogerManager::getStatusActiveLoggers()
+{
+    unsigned int actives = 0;
+    for (int i=0; i<= _lastId; i++)
+    {
+        if (_loggers[i]._enable)
+        {
+            actives ++;
+        }
+    }
+    return actives;
+}
+
+
+bool LogerManager::openLogger(LogData * pLog)
+{
+    int id = pLog->_id;
+    if (id < 0 || id >_lastId)
+    {
+        showColorText("log4z: openLogger can not open, invalide logger id! \r\n", LOG_LEVEL_FATAL);
+        return false;
+    }
+
+    LoggerInfo * pLogger = &_loggers[id];
+    if (!pLogger->_enable || !pLogger->_outfile || pLog->_level < pLogger->_level)
+    {
+        return false;
+    }
+
+    bool sameday = pLog->_time >= pLogger->_curFileCreateDay && pLog->_time - pLogger->_curFileCreateDay < 24*3600;
+    bool needChageFile = pLogger->_curWriteLen > pLogger->_limitsize * 1024 * 1024;
+    if (!sameday || needChageFile)
+    {
+        if (!sameday)
+        {
+            pLogger->_curFileIndex = 0;
+        }
+        else
+        {
+            pLogger->_curFileIndex++;
+        }
+        if (pLogger->_handle.isOpen())
+        {
+            pLogger->_handle.close();
+        }
+    }
+    if (!pLogger->_handle.isOpen())
+    {
+        pLogger->_curFileCreateTime = pLog->_time;
+        pLogger->_curWriteLen = 0;
+
+        tm t = timeToTm(pLogger->_curFileCreateTime);
+        if (true) //process day time   
+        {
+            tm day = t;
+            day.tm_hour = 0;
+            day.tm_min = 0;
+            day.tm_sec = 0;
+            pLogger->_curFileCreateDay = mktime(&day);
+        }
+        
+        std::string name;
+        std::string path;
+
+        name = pLogger->_name;
+        path = pLogger->_path;
+
+        
+        char buf[500] = { 0 };
+        if (pLogger->_monthdir)
+        {
+            sprintf(buf, "%04d_%02d/", t.tm_year + 1900, t.tm_mon + 1);
+            path += buf;
+        }
+
+        if (!isDirectory(path))
+        {
+            createRecursionDir(path);
+        }
+        if (LOG4Z_ALL_SYNCHRONOUS_OUTPUT)
+        {
+            sprintf(buf, "%s_%s_%04d%02d%02d%02d_%s_%03u.log",
+                _proName.c_str(), name.c_str(), t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
+                t.tm_hour, _pid.c_str(), pLogger->_curFileIndex);
+        }
+        else
+        {
+
+            sprintf(buf, "%s_%s_%04d%02d%02d%02d%02d_%s_%03u.log",
+                _proName.c_str(), name.c_str(), t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
+                t.tm_hour, t.tm_min, _pid.c_str(), pLogger->_curFileIndex);
+        }
+        path += buf;
+        long curLen = pLogger->_handle.open(path.c_str(), "ab");
+        if (!pLogger->_handle.isOpen() || curLen < 0)
+        {
+			sprintf(buf, "log4z: can not open log file %s. \r\n", path.c_str());
+            showColorText("!!!!!!!!!!!!!!!!!!!!!!!!!! \r\n", LOG_LEVEL_FATAL);
+            showColorText(buf, LOG_LEVEL_FATAL);
+            showColorText("!!!!!!!!!!!!!!!!!!!!!!!!!! \r\n", LOG_LEVEL_FATAL);
+            pLogger->_outfile = false;
+            return false;
+        }
+        pLogger->_curWriteLen = (unsigned int)curLen;
+
+		if (pLogger->_logReserveTime > 0 )
+		{
+			if (pLogger->_historyLogs.size() > LOG4Z_FORCE_RESERVE_FILE_COUNT)
+			{
+				while (!pLogger->_historyLogs.empty() && pLogger->_historyLogs.front().first < time(NULL) - pLogger->_logReserveTime)
+				{
+					pLogger->_handle.removeFile(pLogger->_historyLogs.front().second.c_str());
+					pLogger->_historyLogs.pop_front();
+				}
+			}
+            if (pLogger->_historyLogs.empty() || pLogger->_historyLogs.back().second != path)
+            {
+                pLogger->_historyLogs.push_back(std::make_pair(time(NULL), path));
+            }
+		}
+        return true;
+    }
+    return true;
+}
+bool LogerManager::closeLogger(LoggerId id)
+{
+    if (id < 0 || id >_lastId)
+    {
+        showColorText("log4z: closeLogger can not close, invalide logger id! \r\n", LOG_LEVEL_FATAL);
+        return false;
+    }
+    LoggerInfo * pLogger = &_loggers[id];
+    if (pLogger->_handle.isOpen())
+    {
+        pLogger->_handle.close();
+        return true;
+    }
+    return false;
+}
+bool LogerManager::popLog(LogData *& log)
+{
+    if (_logsCache.empty())
+    {
+        if (!_logs.empty())
+        {
+            AutoLock l(_logLock);
+            if (_logs.empty())
+            {
+                return false;
+            }
+            _logsCache.swap(_logs);
+        }
+    }
+    if (!_logsCache.empty())
+    {
+        log = _logsCache.front();
+        _logsCache.pop_front();
+        return true;
+    }
+    return false;
+}
+
+void LogerManager::run()
+{
+    _runing = true;
+    LOGA("-----------------  log4z thread started!   ----------------------------");
+    for (int i = 0; i <= _lastId; i++)
+    {
+        if (_loggers[i]._enable)
+        {
+            LOGA("logger id=" << i
+                << " key=" << _loggers[i]._key
+                << " name=" << _loggers[i]._name
+                << " path=" << _loggers[i]._path
+                << " level=" << _loggers[i]._level
+                << " display=" << _loggers[i]._display);
+        }
+    }
+
+    _semaphore.post();
+
+
+    LogData * pLog = NULL;
+    int needFlush[LOG4Z_LOGGER_MAX] = {0};
+    time_t lastCheckUpdate = time(NULL);
+
+
+    while (true)
+    {
+        while(popLog(pLog))
+        {
+            if (pLog->_id <0 || pLog->_id > _lastId)
+            {
+                freeLogData(pLog);
+                continue;
+            }
+            LoggerInfo & curLogger = _loggers[pLog->_id];
+
+            if (pLog->_type != LDT_GENERAL)
+            {
+                onHotChange(pLog->_id, (LogDataType)pLog->_type, pLog->_typeval, std::string(pLog->_content, pLog->_contentLen));
+                curLogger._handle.close();
+                freeLogData(pLog);
+                continue;
+            }
+            
+            //
+            _ullStatusTotalPopLog ++;
+            //discard
+            
+            if (!curLogger._enable || pLog->_level <curLogger._level  )
+            {
+                freeLogData(pLog);
+                continue;
+            }
+
+
+            if (curLogger._display)
+            {
+                showColorText(pLog->_content, pLog->_level);
+            }
+            if (LOG4Z_ALL_DEBUGOUTPUT_DISPLAY )
+            {
+#ifdef WIN32
+                OutputDebugStringA(pLog->_content);
+#endif
+            }
+
+
+            if (curLogger._outfile )
+            {
+                if (!openLogger(pLog))
+                {
+                    freeLogData(pLog);
+                    continue;
+                }
+
+                curLogger._handle.write(pLog->_content, pLog->_contentLen);
+                curLogger._curWriteLen += (unsigned int)pLog->_contentLen;
+                needFlush[pLog->_id] ++;
+                _ullStatusTotalWriteFileCount++;
+                _ullStatusTotalWriteFileBytes += pLog->_contentLen;
+            }
+            else 
+            {
+                _ullStatusTotalWriteFileCount++;
+                _ullStatusTotalWriteFileBytes += pLog->_contentLen;
+            }
+
+            freeLogData(pLog);
+        }
+
+        for (int i=0; i<=_lastId; i++)
+        {
+            if (_loggers[i]._enable && needFlush[i] > 0)
+            {
+                _loggers[i]._handle.flush();
+                needFlush[i] = 0;
+            }
+            if(!_loggers[i]._enable && _loggers[i]._handle.isOpen())
+            {
+                _loggers[i]._handle.close();
+            }
+        }
+
+        //! delay. 
+        sleepMillisecond(50);
+
+        //! quit
+        if (!_runing && _logs.empty())
+        {
+            break;
+        }
+        
+        if (_hotUpdateInterval != 0 && time(NULL) - lastCheckUpdate > _hotUpdateInterval)
+        {
+            updateConfig();
+            lastCheckUpdate = time(NULL);
+        }
+        
+
+
+    }
+
+    for (int i=0; i <= _lastId; i++)
+    {
+        if (_loggers[i]._enable)
+        {
+            _loggers[i]._enable = false;
+            closeLogger(i);
+        }
+    }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+//ILog4zManager::getInstance
+//////////////////////////////////////////////////////////////////////////
+ILog4zManager * ILog4zManager::getInstance()
+{
+    static LogerManager m;
+    return &m;
+}
+
+
+
+_ZSUMMER_LOG4Z_END
+_ZSUMMER_END

+ 933 - 0
Source/OGCAssistTool/OGCAssistTool/log4z.h

@@ -0,0 +1,933 @@
+/*
+ * Log4z License
+ * -----------
+ * 
+ * Log4z is licensed under the terms of the MIT license reproduced below.
+ * This means that Log4z is free software and can be used for both academic
+ * and commercial purposes at absolutely no cost.
+ * 
+ * 
+ * ===============================================================================
+ * 
+ * Copyright (C) 2010-2017 YaweiZhang <yawei.zhang@foxmail.com>.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * 
+ * ===============================================================================
+ * 
+ * (end of COPYRIGHT)
+ */
+
+
+/*
+ * AUTHORS:  YaweiZhang <yawei.zhang@foxmail.com>
+ * VERSION:  3.5.0
+ * PURPOSE:  A lightweight library for error reporting and logging to file and screen .
+ * CREATION: 2010.10.4
+ * LCHANGE:  2017.08.20
+ * LICENSE:  Expat/MIT License, See Copyright Notice at the begin of this file.
+ */
+
+
+/*
+ * contact me:
+ * tencent qq group: 19811947
+ * mail: yawei.zhang@foxmail.com
+ */
+
+
+/* 
+ * UPDATES LOG
+ * 
+ * VERSION 0.1.0 <DATE: 2010.10.4>
+ *     create the first project.  
+ *     It support put log to screen and files, 
+ *     support log level, support one day one log file.
+ *     support multi-thread, cross-platform.
+ * 
+ * VERSION .... <DATE: ...>
+ *     ...
+ * 
+ * VERSION 0.9.0 <DATE: 2012.12.24>
+ *     support config files.
+ *     support color text in screen.
+ *     support multiple output to different files.
+ * 
+ * VERSION 1.0.0 <DATE: 2012.12.29>
+ *     support comments in the config file.
+ *     add a advanced demo in the ./project
+ *     fix some details.
+ * 
+ * VERSION 1.0.1 <DATE: 2013.01.01>
+ *     change and add some Comments in the log4z
+ *     simplify the 'fast_test' demo projects.
+ * 
+ * VERSION 1.1.0 <DATE: 2013.01.24>
+ *     the method Start will wait for the logger thread started.
+ *     config and add method change. 
+ *     namespace change.
+ * 
+ * VERSION 1.1.1 <DATE: 2013.02.23>
+ *     add status info method.
+ *     optimize. 
+ *
+ * VERSION 1.2.0 <DATE: 2013.04.05>
+ *     add stress test demo
+ *  rewrite Stream module,better performance. 
+ * 
+ * VERSION 1.2.1 <DATE: 2013.04.13>
+ *     fixed type name 'long' stream format on 64/32 operation system.
+ *  logger will not loss any log on process normal exit.
+ *
+ * VERSION 2.0.0 <DATE: 2013.04.25>
+ *     new interface: 
+ *      merge some Main interface and Dynamic interface
+ *      add Change Logger Attribute method by thread-safe
+ *     new config design.
+ *     log file name append process id.
+ *
+ * VERSION 2.1 <DATE: 2013.05.22>
+ *     support binary text output 
+ *  rewrite write file module, support vs2005 open Chinese characters path
+ *
+ * VERSION 2.2 <DATE: 2013.07.08>
+ *    optimized binary stream output view
+ *     support wchar * string.
+ *  
+ * VERSION 2.3 <DATE: 2013.08.29>
+ *  adjust output file named.
+ *  support different month different directory.
+ *  adjust some detail.
+ * 
+ * VERSION 2.4 <DATE: 2013.10.07>
+ *  support rolling log file.
+ *  support hot update configure
+ *  used precision time in log.
+ *  micro set default logger attribute
+ *  fix tls bug in windows xp dll
+ *
+ * VERSION 2.5 <DATE: 2014.03.25>
+ *  screen output can choice synchronous or not
+ *  fix sometimes color will disorder on windows.
+ *  eliminate some compiler warning
+ *  fix sem_timewait in linux
+ *  add format-style method at input log, cannot support vs2003 and VC6.
+ *  fix WCHAR String cannot output
+ *  optimize std::string, binary log input, and support std::wstring.
+ *  clean code, better readability
+ *  
+ * VERSION 2.6 <DATE: 2014.08.19>
+ *  add PrePushLog 
+ *  better performance when log is filter out.
+ *  interface replace std::string because it's in shared library is unsafe.
+ *  add log level 'trace'
+ * 
+ * VERSION 2.6.1 <DATE: 2014.08.22>
+ *  fix bug from defined _MSC_VER 
+ *
+ * VERSION 2.7 <DATE: 2014.09.21>
+ *  compatible mac machine,  now  log4z can working in linux/windows/mac.
+ *
+ * VERSION 2.8 <DATE: 2014.09.27>
+ *  support synchronous written to file and thread-safe
+ *  fix compatibility on MinGW. a constant value suffix.
+ *  ignore utf-8 file BOM when load configure file
+ *  use macro WIN32_LEAN_AND_MEAN replace head file winsock2.h
+ *  new naming notations
+ * 
+ * VERSION 3.0 <DATE: 2014.12.19>
+ *  new naming notations
+ *  support for reading config from a string.
+ *  remove all TLS code, used dispatch_semaphore in apple OS.
+ *  support system: windows, linux, mac, iOS
+ *
+ * VERSION 3.1 <DATE: 2014.12.19>
+ *  add method enable/disable logger by specific logger id
+ *  add method enable/disable log suffix line number.
+ *  add method enable/disable log output to file.
+ *
+ * VERSION 3.2 <DATE: 2014.12.19>
+ *  add interface setLoggerName,setLoggerPath,setAutoUpdate
+ *  support auto update from configure file
+ *
+ * VERSION 3.3 <DATE: 2014.12.19>
+ *  support map vector list
+ *  support continuum via travis.
+ *  new hot change design, all change realize need via push log flow.
+ *  support oem string convert.
+ *  new method to read whole content of file.
+ *  check configure's checksum when auto update it.
+ *  some other optimize.
+ * 
+ * VERSION 3.5 <DATE: 2017.08.20>
+ *  optimization
+ *
+ */
+
+
+#pragma once
+#ifndef _ZSUMMER_LOG4Z_H_
+#define _ZSUMMER_LOG4Z_H_
+
+#include <string>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <cmath>
+#include <stdlib.h>
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#endif
+#include <vector>
+#include <map>
+#include <list>
+#include <queue>
+#include <deque>
+#include <float.h>
+#include <math.h>
+
+//! logger ID type. DO NOT TOUCH
+typedef int LoggerId;
+
+//! the invalid logger id. DO NOT TOUCH
+const int LOG4Z_INVALID_LOGGER_ID = -1;
+
+//! the main logger id. DO NOT TOUCH
+//! can use this id to set the main logger's attribute.
+//! example:
+//! ILog4zManager::getPtr()->setLoggerLevel(LOG4Z_MAIN_LOGGER_ID, LOG_LEVEL_WARN);
+//! ILog4zManager::getPtr()->setLoggerDisplay(LOG4Z_MAIN_LOGGER_ID, false);
+const int LOG4Z_MAIN_LOGGER_ID = 0;
+
+//! the main logger name. DO NOT TOUCH
+const char*const LOG4Z_MAIN_LOGGER_KEY = "Main";
+
+//! check VC VERSION. DO NOT TOUCH
+//! format micro cannot support VC6 or VS2003, please use stream input log, like LOGI, LOGD, LOG_DEBUG, LOG_STREAM ...
+#if _MSC_VER >= 1400 //MSVC >= VS2005
+#define LOG4Z_FORMAT_INPUT_ENABLE
+#endif
+
+#ifndef WIN32
+#define LOG4Z_FORMAT_INPUT_ENABLE
+#endif
+
+//! LOG Level
+enum ENUM_LOG_LEVEL
+{
+    LOG_LEVEL_TRACE = 0,
+    LOG_LEVEL_DEBUG,
+    LOG_LEVEL_INFO,
+    LOG_LEVEL_WARN,
+    LOG_LEVEL_ERROR,
+    LOG_LEVEL_ALARM,
+    LOG_LEVEL_FATAL,
+};
+
+//////////////////////////////////////////////////////////////////////////
+//! -----------------default logger config, can change on this.-----------
+//////////////////////////////////////////////////////////////////////////
+//! the max logger count.
+const int LOG4Z_LOGGER_MAX = 20;
+//! the max log content length.
+const int LOG4Z_LOG_BUF_SIZE = 1024 * 8;
+//! the max stl container depth.
+const int LOG4Z_LOG_CONTAINER_DEPTH = 5;
+//! the log queue length limit size.
+const int LOG4Z_LOG_QUEUE_LIMIT_SIZE = 20000;
+
+//! all logger synchronous output or not
+const bool LOG4Z_ALL_SYNCHRONOUS_OUTPUT = false;
+//! all logger synchronous display to the windows debug output
+const bool LOG4Z_ALL_DEBUGOUTPUT_DISPLAY = false;
+
+//! default logger output file.
+const char* const LOG4Z_DEFAULT_PATH = "./log/";
+//! default log filter level
+const int LOG4Z_DEFAULT_LEVEL = LOG_LEVEL_DEBUG;
+//! default logger display
+const bool LOG4Z_DEFAULT_DISPLAY = true;
+//! default logger output to file
+const bool LOG4Z_DEFAULT_OUTFILE = true;
+//! default logger month dir used status
+const bool LOG4Z_DEFAULT_MONTHDIR = false;
+//! default logger output file limit size, unit M byte.
+const int LOG4Z_DEFAULT_LIMITSIZE = 100;
+//! default logger show suffix (file name and line number) 
+const bool LOG4Z_DEFAULT_SHOWSUFFIX = true;
+//! support ANSI->OEM console conversion on Windows
+#undef LOG4Z_OEM_CONSOLE
+//! default logger force reserve log file count.
+const size_t LOG4Z_FORCE_RESERVE_FILE_COUNT = 7;
+
+///////////////////////////////////////////////////////////////////////////
+//! -----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef _ZSUMMER_BEGIN
+#define _ZSUMMER_BEGIN namespace zsummer {
+#endif  
+#ifndef _ZSUMMER_LOG4Z_BEGIN
+#define _ZSUMMER_LOG4Z_BEGIN namespace log4z {
+#endif
+_ZSUMMER_BEGIN
+_ZSUMMER_LOG4Z_BEGIN
+
+
+struct LogData
+{
+    LoggerId _id;        //dest logger id
+    int    _type;     //type.
+    int    _typeval;
+    int    _level;    //log level
+    time_t _time;        //create time
+    unsigned int _precise; //create time 
+    unsigned int _threadID;
+    int _contentLen;
+    char _content[1]; //content
+};
+
+//! log4z class
+class ILog4zManager
+{
+public:
+    ILog4zManager(){};
+    virtual ~ILog4zManager(){};
+
+    //! Log4z Singleton
+    
+    static ILog4zManager * getInstance();
+    inline static ILog4zManager & getRef(){return *getInstance();}
+    inline static ILog4zManager * getPtr(){return getInstance();}
+
+    //! Config or overwrite configure
+    //! Needs to be called before ILog4zManager::Start,, OR Do not call.
+    virtual bool config(const char * configPath) = 0;
+    virtual bool configFromString(const char * configContent) = 0;
+
+    //! Create or overwrite logger.
+    //! Needs to be called before ILog4zManager::Start, OR Do not call.
+    virtual LoggerId createLogger(const char* key) = 0;
+
+    //! Start Log Thread. This method can only be called once by one process.
+    virtual bool start() = 0;
+
+    //! Default the method will be calling at process exit auto.
+    //! Default no need to call and no recommended.
+    virtual bool stop() = 0;
+
+    //! Find logger. thread safe.
+    virtual LoggerId findLogger(const char* key) =0;
+
+    //pre-check the log filter. if filter out return false. 
+    virtual bool prePushLog(LoggerId id, int level) = 0;
+    //! Push log, thread safe.
+    virtual bool pushLog(LogData * pLog, const char * file = NULL, int line = 0) = 0;
+
+    //! set logger's attribute, thread safe.
+    virtual bool enableLogger(LoggerId id, bool enable) = 0; // immediately when enable, and queue up when disable. 
+    virtual bool setLoggerName(LoggerId id, const char * name) = 0;
+    virtual bool setLoggerPath(LoggerId id, const char * path) = 0;
+    virtual bool setLoggerLevel(LoggerId id, int nLevel) = 0; // immediately when enable, and queue up when disable. 
+    virtual bool setLoggerFileLine(LoggerId id, bool enable) = 0;
+    virtual bool setLoggerDisplay(LoggerId id, bool enable) = 0;
+    virtual bool setLoggerOutFile(LoggerId id, bool enable) = 0;
+    virtual bool setLoggerLimitsize(LoggerId id, unsigned int limitsize) = 0;
+	virtual bool setLoggerMonthdir(LoggerId id, bool enable) = 0;
+	virtual bool setLoggerReserveTime(LoggerId id, time_t sec) = 0;
+
+
+    //! Update logger's attribute from config file, thread safe.
+    virtual bool setAutoUpdate(int interval/*per second, 0 is disable auto update*/) = 0;
+    virtual bool updateConfig() = 0;
+
+    //! Log4z status statistics, thread safe.
+    virtual bool isLoggerEnable(LoggerId id) = 0;
+    virtual unsigned long long getStatusTotalWriteCount() = 0;
+    virtual unsigned long long getStatusTotalWriteBytes() = 0;
+    virtual unsigned long long getStatusTotalPushQueue() = 0;
+    virtual unsigned long long getStatusTotalPopQueue() = 0;
+    virtual unsigned int getStatusActiveLoggers() = 0;
+
+    virtual LogData * makeLogData(LoggerId id, int level) = 0;
+    virtual void freeLogData(LogData * log) = 0;
+};
+
+class Log4zStream;
+class Log4zBinary;
+
+#ifndef _ZSUMMER_END
+#define _ZSUMMER_END }
+#endif  
+#ifndef _ZSUMMER_LOG4Z_END
+#define _ZSUMMER_LOG4Z_END }
+#endif
+
+_ZSUMMER_LOG4Z_END
+_ZSUMMER_END
+
+
+
+//! base macro.
+#define LOG_STREAM(id, level, file, line, log)\
+do{\
+    if (zsummer::log4z::ILog4zManager::getPtr()->prePushLog(id,level)) \
+    {\
+        zsummer::log4z::LogData * __pLog = zsummer::log4z::ILog4zManager::getPtr()->makeLogData(id, level); \
+        zsummer::log4z::Log4zStream __ss(__pLog->_content + __pLog->_contentLen, LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen);\
+        __ss << log;\
+        __pLog->_contentLen += __ss.getCurrentLen(); \
+        zsummer::log4z::ILog4zManager::getPtr()->pushLog(__pLog, file, line);\
+    }\
+} while (0)
+
+
+//! fast macro
+#define LOG_TRACE(id, log) LOG_STREAM(id, LOG_LEVEL_TRACE, __FILE__, __LINE__, log)
+#define LOG_DEBUG(id, log) LOG_STREAM(id, LOG_LEVEL_DEBUG, __FILE__, __LINE__, log)
+#define LOG_INFO(id, log)  LOG_STREAM(id, LOG_LEVEL_INFO, __FILE__, __LINE__, log)
+#define LOG_WARN(id, log)  LOG_STREAM(id, LOG_LEVEL_WARN, __FILE__, __LINE__, log)
+#define LOG_ERROR(id, log) LOG_STREAM(id, LOG_LEVEL_ERROR, __FILE__, __LINE__, log)
+#define LOG_ALARM(id, log) LOG_STREAM(id, LOG_LEVEL_ALARM, __FILE__, __LINE__, log)
+#define LOG_FATAL(id, log) LOG_STREAM(id, LOG_LEVEL_FATAL, __FILE__, __LINE__, log)
+
+//! super macro.
+#define LOGT( log ) LOG_TRACE(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGD( log ) LOG_DEBUG(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGI( log ) LOG_INFO(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGW( log ) LOG_WARN(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGE( log ) LOG_ERROR(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGA( log ) LOG_ALARM(LOG4Z_MAIN_LOGGER_ID, log )
+#define LOGF( log ) LOG_FATAL(LOG4Z_MAIN_LOGGER_ID, log )
+
+
+//! format input log.
+#ifdef LOG4Z_FORMAT_INPUT_ENABLE
+#ifdef WIN32
+#define LOG_FORMAT(id, level, file, line, logformat, ...) \
+do{ \
+    if (zsummer::log4z::ILog4zManager::getPtr()->prePushLog(id,level)) \
+    {\
+        zsummer::log4z::LogData * __pLog = zsummer::log4z::ILog4zManager::getPtr()->makeLogData(id, level); \
+        int __logLen = _snprintf_s(__pLog->_content + __pLog->_contentLen, LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen, _TRUNCATE, logformat, ##__VA_ARGS__); \
+        if (__logLen < 0) __logLen = LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen; \
+        __pLog->_contentLen += __logLen; \
+        zsummer::log4z::ILog4zManager::getPtr()->pushLog(__pLog, file, line); \
+    }\
+} while (0)
+#else
+#define LOG_FORMAT(id, level, file, line, logformat, ...) \
+do{ \
+    if (zsummer::log4z::ILog4zManager::getPtr()->prePushLog(id,level)) \
+    {\
+        zsummer::log4z::LogData * __pLog = zsummer::log4z::ILog4zManager::getPtr()->makeLogData(id, level); \
+        int __logLen = snprintf(__pLog->_content + __pLog->_contentLen, LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen,logformat, ##__VA_ARGS__); \
+        if (__logLen < 0) __logLen = 0; \
+        if (__logLen > LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen) __logLen = LOG4Z_LOG_BUF_SIZE - __pLog->_contentLen; \
+        __pLog->_contentLen += __logLen; \
+        zsummer::log4z::ILog4zManager::getPtr()->pushLog(__pLog, file, line); \
+    } \
+}while(0)
+#endif
+//!format string
+#define LOGFMT_TRACE(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_TRACE, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_DEBUG(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_DEBUG, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_INFO(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_INFO, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_WARN(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_WARN, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_ERROR(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_ERROR, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_ALARM(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_ALARM, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMT_FATAL(id, fmt, ...)  LOG_FORMAT(id, LOG_LEVEL_FATAL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
+#define LOGFMTT( fmt, ...) LOGFMT_TRACE(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTD( fmt, ...) LOGFMT_DEBUG(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTI( fmt, ...) LOGFMT_INFO(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTW( fmt, ...) LOGFMT_WARN(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTE( fmt, ...) LOGFMT_ERROR(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTA( fmt, ...) LOGFMT_ALARM(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#define LOGFMTF( fmt, ...) LOGFMT_FATAL(LOG4Z_MAIN_LOGGER_ID, fmt,  ##__VA_ARGS__)
+#else
+inline void empty_log_format_function1(LoggerId id, const char*, ...){}
+inline void empty_log_format_function2(const char*, ...){}
+#define LOGFMT_TRACE empty_log_format_function1
+#define LOGFMT_DEBUG LOGFMT_TRACE
+#define LOGFMT_INFO LOGFMT_TRACE
+#define LOGFMT_WARN LOGFMT_TRACE
+#define LOGFMT_ERROR LOGFMT_TRACE
+#define LOGFMT_ALARM LOGFMT_TRACE
+#define LOGFMT_FATAL LOGFMT_TRACE
+#define LOGFMTT empty_log_format_function2
+#define LOGFMTD LOGFMTT
+#define LOGFMTI LOGFMTT
+#define LOGFMTW LOGFMTT
+#define LOGFMTE LOGFMTT
+#define LOGFMTA LOGFMTT
+#define LOGFMTF LOGFMTT
+#endif
+
+
+_ZSUMMER_BEGIN
+_ZSUMMER_LOG4Z_BEGIN
+
+//! optimze from std::stringstream to Log4zStream
+#ifdef WIN32
+#pragma warning(push)
+#pragma warning(disable:4996)
+#endif
+class Log4zBinary
+{
+public:
+    Log4zBinary(const void * buf, size_t len)
+    {
+        this->buf = (const char *)buf;
+        this->len = len;
+    }
+    const char * buf;
+    size_t  len;
+};
+
+class Log4zString
+{
+public:
+    Log4zString(const char * buf, size_t len)
+    {
+        this->buf = (const char *)buf;
+        this->len = len;
+    }
+    const char * buf;
+    size_t  len;
+};
+
+class Log4zStream
+{
+public:
+    inline Log4zStream(char * buf, int len);
+    inline int getCurrentLen(){return (int)(_cur - _begin);}
+public:
+    inline Log4zStream & writeLongLong(long long t, int width = 0, int dec = 10);
+    inline Log4zStream & writeULongLong(unsigned long long t, int width = 0, int dec = 10);
+    inline Log4zStream & writeDouble(double t, bool isSimple);
+    inline Log4zStream & writePointer(const void * t);
+    inline Log4zStream & writeString(const char * t) { return writeString(t, strlen(t)); };
+    inline Log4zStream & writeString(const char * t, size_t len);
+    inline Log4zStream & writeChar(char ch);
+    inline Log4zStream & writeBinary(const Log4zBinary & t);
+public:
+    inline Log4zStream & operator <<(const void * t){ return  writePointer(t); }
+
+    inline Log4zStream & operator <<(const char * t){return writeString(t);}
+
+    inline Log4zStream & operator <<(bool t){ return (t ? writeString("true", 4) : writeString("false", 5));}
+
+    inline Log4zStream & operator <<(char t){return writeChar(t);}
+
+    inline Log4zStream & operator <<(unsigned char t){return writeULongLong(t);}
+
+    inline Log4zStream & operator <<(short t){ return writeLongLong(t); }
+
+    inline Log4zStream & operator <<(unsigned short t){ return writeULongLong(t); }
+
+    inline Log4zStream & operator <<(int t){return writeLongLong(t);}
+
+    inline Log4zStream & operator <<(unsigned int t){return writeULongLong(t);}
+
+    inline Log4zStream & operator <<(long t) { return writeLongLong(t); }
+
+    inline Log4zStream & operator <<(unsigned long t){ return writeULongLong(t); }
+
+    inline Log4zStream & operator <<(long long t) { return writeLongLong(t); }
+
+    inline Log4zStream & operator <<(unsigned long long t){ return writeULongLong(t); }
+
+    inline Log4zStream & operator <<(float t){return writeDouble(t, true);}
+
+    inline Log4zStream & operator <<(double t){return writeDouble(t, false);}
+
+    template<class _Elem,class _Traits,class _Alloc> //support std::string, std::wstring
+    inline Log4zStream & operator <<(const std::basic_string<_Elem, _Traits, _Alloc> & t){ return writeString(t.c_str(), t.length()); }
+
+    inline Log4zStream & operator << (const zsummer::log4z::Log4zBinary & binary) { return writeBinary(binary); }
+
+    inline Log4zStream & operator << (const zsummer::log4z::Log4zString & str) { return writeString(str.buf, str.len); }
+
+    template<class _Ty1, class _Ty2>
+    inline Log4zStream & operator <<(const std::pair<_Ty1, _Ty2> & t){ return *this << "pair(" << t.first << ":" << t.second << ")"; }
+
+    template<class _Elem, class _Alloc>
+    inline Log4zStream & operator <<(const std::vector<_Elem, _Alloc> & t)
+    { 
+        *this << "vector(" << t.size() << ")[";
+        int inputCount = 0;
+        for (typename std::vector<_Elem, _Alloc>::const_iterator iter = t.begin(); iter != t.end(); iter++)
+        {
+            inputCount++;
+            if (inputCount > LOG4Z_LOG_CONTAINER_DEPTH)
+            {
+                *this << "..., ";
+                break;
+            }
+            *this << *iter << ", ";
+        }
+        if (!t.empty())
+        {
+            _cur -= 2;
+        }
+        return *this << "]";
+    }
+    template<class _Elem, class _Alloc>
+    inline Log4zStream & operator <<(const std::list<_Elem, _Alloc> & t)
+    { 
+        *this << "list(" << t.size() << ")[";
+        int inputCount = 0;
+        for (typename std::list<_Elem, _Alloc>::const_iterator iter = t.begin(); iter != t.end(); iter++)
+        {
+            inputCount++;
+            if (inputCount > LOG4Z_LOG_CONTAINER_DEPTH)
+            {
+                *this << "..., ";
+                break;
+            }
+            *this << *iter << ", ";
+        }
+        if (!t.empty())
+        {
+            _cur -= 2;
+        }
+        return *this << "]";
+    }
+    template<class _Elem, class _Alloc>
+    inline Log4zStream & operator <<(const std::deque<_Elem, _Alloc> & t)
+    {
+        *this << "deque(" << t.size() << ")[";
+        int inputCount = 0;
+        for (typename std::deque<_Elem, _Alloc>::const_iterator iter = t.begin(); iter != t.end(); iter++)
+        {
+            inputCount++;
+            if (inputCount > LOG4Z_LOG_CONTAINER_DEPTH)
+            {
+                *this << "..., ";
+                break;
+            }
+            *this << *iter << ", ";
+        }
+        if (!t.empty())
+        {
+            _cur -= 2;
+        }
+        return *this << "]";
+    }
+    template<class _Elem, class _Alloc>
+    inline Log4zStream & operator <<(const std::queue<_Elem, _Alloc> & t)
+    {
+        *this << "queue(" << t.size() << ")[";
+        int inputCount = 0;
+        for (typename std::queue<_Elem, _Alloc>::const_iterator iter = t.begin(); iter != t.end(); iter++)
+        {
+            inputCount++;
+            if (inputCount > LOG4Z_LOG_CONTAINER_DEPTH)
+            {
+                *this << "..., ";
+                break;
+            }
+            *this << *iter << ", ";
+        }
+        if (!t.empty())
+        {
+            _cur -= 2;
+        }
+        return *this << "]";
+    }
+    template<class _K, class _V, class _Pr, class _Alloc>
+    inline Log4zStream & operator <<(const std::map<_K, _V, _Pr, _Alloc> & t)
+    {
+        *this << "map(" << t.size() << ")[";
+        int inputCount = 0;
+        for (typename std::map < _K, _V, _Pr, _Alloc>::const_iterator iter = t.begin(); iter != t.end(); iter++)
+        {
+            inputCount++;
+            if (inputCount > LOG4Z_LOG_CONTAINER_DEPTH)
+            {
+                *this << "..., ";
+                break;
+            }
+            *this << *iter << ", ";
+        }
+        if (!t.empty())
+        {
+            _cur -= 2;
+        }
+        return *this << "]";
+    }
+
+private:
+    Log4zStream(){}
+    Log4zStream(Log4zStream &){}
+    char *  _begin;
+    char *  _end;
+    char *  _cur;
+};
+
+inline Log4zStream::Log4zStream(char * buf, int len)
+{
+    _begin = buf;
+    _end = buf + len;
+    _cur = _begin;
+}
+
+
+
+inline Log4zStream & Log4zStream::writeLongLong(long long t, int width, int dec)
+{
+    if (t < 0 )
+    {
+        t = -t;
+        writeChar('-');
+    }
+    writeULongLong((unsigned long long)t, width, dec);
+    return *this;
+}
+
+inline Log4zStream & Log4zStream::writeULongLong(unsigned long long t, int width, int dec)
+{
+    static const char * lut = 
+        "0123456789abcdef";
+
+    static const char *lutDec = 
+        "00010203040506070809"
+        "10111213141516171819"
+        "20212223242526272829"
+        "30313233343536373839"
+        "40414243444546474849"
+        "50515253545556575859"
+        "60616263646566676869"
+        "70717273747576777879"
+        "80818283848586878889"
+        "90919293949596979899";
+
+    static const char *lutHex = 
+        "000102030405060708090A0B0C0D0E0F"
+        "101112131415161718191A1B1C1D1E1F"
+        "202122232425262728292A2B2C2D2E2F"
+        "303132333435363738393A3B3C3D3E3F"
+        "404142434445464748494A4B4C4D4E4F"
+        "505152535455565758595A5B5C5D5E5F"
+        "606162636465666768696A6B6C6D6E6F"
+        "707172737475767778797A7B7C7D7E7F"
+        "808182838485868788898A8B8C8D8E8F"
+        "909192939495969798999A9B9C9D9E9F"
+        "A0A1A2A3A4A5A6A7A8A9AAABACADAEAF"
+        "B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF"
+        "C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF"
+        "D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF"
+        "E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF"
+        "F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF";
+
+    const unsigned long long cacheSize = 64;
+
+    if ((unsigned long long)(_end - _cur) > cacheSize)
+    {
+        char buf[cacheSize];
+        unsigned long long val = t;
+        unsigned long long i = cacheSize;
+        unsigned long long digit = 0;
+
+
+
+        if (dec == 10)
+        {
+            do
+            {
+                const unsigned long long m2 = (unsigned long long)((val % 100) * 2);
+                *(buf + i - 1) = lutDec[m2 + 1];
+                *(buf + i - 2) = lutDec[m2];
+                i -= 2;
+                val /= 100;
+                digit += 2;
+            } while (val && i >= 2);
+            if (digit >= 2 && buf[cacheSize - digit] == '0')
+            {
+                digit--;
+            }
+        }
+        else if (dec == 16)
+        {
+            do
+            {
+                const unsigned long long m2 = (unsigned long long)((val % 256) * 2);
+                *(buf + i - 1) = lutHex[m2 + 1];
+                *(buf + i - 2) = lutHex[m2];
+                i -= 2;
+                val /= 256;
+                digit += 2;
+            } while (val && i >= 2);
+            if (digit >= 2 && buf[cacheSize - digit] == '0')
+            {
+                digit--;
+            }
+        }
+        else
+        {
+            do
+            {
+                buf[--i] = lut[val % dec];
+                val /= dec;
+                digit++;
+            } while (val && i > 0);
+        }
+
+        while (digit < (unsigned long long)width)
+        {
+            digit++;
+            buf[cacheSize - digit] = '0';
+        }
+
+        writeString(buf + (cacheSize - digit), (size_t)digit);
+    }
+    return *this;
+}
+
+inline Log4zStream & Log4zStream::writeDouble(double t, bool isSimple)
+{
+
+#if __cplusplus >= 201103L
+                using std::isnan;
+                using std::isinf;
+#endif
+    if (_isnan(t))
+    {
+        writeString("nan", 3);
+        return *this;
+    }
+    else if (isinf(t))
+    {
+        writeString("inf", 3);
+        return *this;
+    }
+
+
+
+    size_t count = _end - _cur;
+    double fabst = fabs(t);
+    if (count > 30)
+    {
+        if ( fabst < 0.0001 || (!isSimple && fabst > 4503599627370495ULL) || (isSimple && fabst > 8388607))
+        {
+            gcvt(t, isSimple ? 7 : 16, _cur);
+            size_t len = strlen(_cur);
+            if (len > count) len = count;
+            _cur += len;
+            return *this;
+        }
+        else
+        {
+            if (t < 0.0)
+            {
+                writeChar('-');
+            }
+            double intpart = 0;
+            unsigned long long fractpart = (unsigned long long)(modf(fabst, &intpart) * 10000);
+            writeULongLong((unsigned long long)intpart);
+            if (fractpart > 0)
+            {
+                writeChar('.');
+                writeULongLong(fractpart, 4);
+            }
+        }
+    }
+
+    return *this;
+}
+
+inline Log4zStream & Log4zStream::writePointer(const void * t)
+{
+    sizeof(t) == 8 ?  writeULongLong((unsigned long long)t, 16, 16): writeULongLong((unsigned long long)t, 8, 16);
+    return *this;
+}
+
+inline Log4zStream & Log4zStream::writeBinary(const Log4zBinary & t)
+{
+    writeString("\r\n\t[");
+    for (size_t i=0; i<(t.len / 32)+1; i++)
+    {
+        writeString("\r\n\t");
+        *this << (void*)(t.buf + i*32);
+        writeString(": ");
+        for (size_t j = i * 32; j < (i + 1) * 32 && j < t.len; j++)
+        {
+            if (isprint((unsigned char)t.buf[j]))
+            {
+                writeChar(' ');
+                writeChar(t.buf[j]);
+                writeChar(' ');
+            }
+            else
+            {
+                *this << " . ";
+            }
+        }
+        writeString("\r\n\t");
+        *this << (void*)(t.buf + i * 32);
+        writeString(": ");
+        for (size_t j = i * 32; j < (i + 1) * 32 && j < t.len; j++)
+        {
+            writeULongLong((unsigned long long)(unsigned char)t.buf[j], 2, 16);
+            writeChar(' ');
+        }
+    }
+
+    writeString("\r\n\t]\r\n\t");
+    return *this;
+}
+inline Log4zStream & zsummer::log4z::Log4zStream::writeChar(char ch)
+{
+    if (_end - _cur > 1)
+    {
+        _cur[0] = ch;
+        _cur++;
+    }
+    return *this;
+}
+
+inline Log4zStream & zsummer::log4z::Log4zStream::writeString(const char * t, size_t len)
+{
+    size_t count = _end - _cur;
+    if (len > count)
+    {
+        len = count;
+    }
+    if (len > 0)
+    {
+        memcpy(_cur, t, len);
+        _cur += len;
+    }
+    
+    return *this;
+}
+
+
+
+
+#ifdef WIN32
+#pragma warning(pop)
+#endif
+
+_ZSUMMER_LOG4Z_END
+_ZSUMMER_END
+
+#endif

+ 1 - 1
Source/OGCAssistTool/OGCAssistTool/stdint.h

@@ -41,7 +41,7 @@
 #pragma once
 #endif
 
-#if _MSC_VER >= 2000 // [
+#if _MSC_VER >= 1931 // [
 #include <stdint.h>
 #else // ] _MSC_VER >= 1600 [
 

+ 25 - 0
Source/OGCAssistTool/OGCAssistTool_17.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32328.378
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGCAssistTool", "OGCAssistTool\OGCAssistTool.vcxproj", "{0B8CE487-8311-4878-902B-15813A89DB90}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{0B8CE487-8311-4878-902B-15813A89DB90}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0B8CE487-8311-4878-902B-15813A89DB90}.Debug|Win32.Build.0 = Debug|Win32
+		{0B8CE487-8311-4878-902B-15813A89DB90}.Release|Win32.ActiveCfg = Release|Win32
+		{0B8CE487-8311-4878-902B-15813A89DB90}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CFE4059A-3FA4-44C4-AE79-6B2EAB4077B4}
+	EndGlobalSection
+EndGlobal

BIN
Source/OGCAssistTool/lib/SQLite3.lib


BIN
Source/OGCAssistTool/lib/SQLite3D.lib


BIN
Source/OGCAssistTool/lib/libcurl.lib


BIN
Source/OGCAssistTool/lib/libcurld.lib


BIN
Source/OGCAssistTool/lib/libeay32.lib


BIN
Source/OGCAssistTool/lib/ssleay32.lib


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor