Просмотр исходного кода

mhd_str: improved compatibility with older compilers, including VS2010, VS2012

Evgeny Grin (Karlson2k) 9 лет назад
Родитель
Сommit
ec79f5e0db
2 измененных файлов с 6 добавлено и 1 удалено
  1. 2 1
      src/microhttpd/mhd_str.c
  2. 4 0
      w32/common/MHD_config.h

+ 2 - 1
src/microhttpd/mhd_str.c

@@ -271,7 +271,8 @@ MHD_str_equal_caseless_ (const char * str1, const char * str2)
 int
 int
 MHD_str_equal_caseless_n_ (const char * const str1, const char * const str2, size_t maxlen)
 MHD_str_equal_caseless_n_ (const char * const str1, const char * const str2, size_t maxlen)
 {
 {
-  for (size_t i = 0; i < maxlen; ++i)
+  size_t i;
+  for (i = 0; i < maxlen; ++i)
     {
     {
       const char c1 = str1[i];
       const char c1 = str1[i];
       const char c2 = str2[i];
       const char c2 = str2[i];

+ 4 - 0
w32/common/MHD_config.h

@@ -10,7 +10,11 @@
 #define MSVC 1
 #define MSVC 1
 
 
 /* Define to type which will be used as boolean type. */
 /* Define to type which will be used as boolean type. */
+#if _MSC_VER+0 >= 1800
 #define _MHD_bool _Bool
 #define _MHD_bool _Bool
+#else  /* before VS 2013 */
+#define _MHD_bool int
+#endif /* before VS 2013 */
 
 
 /* Define to 1 if your C compiler supports inline functions. */
 /* Define to 1 if your C compiler supports inline functions. */
 #define INLINE_FUNC 1
 #define INLINE_FUNC 1