Ver código fonte

Move all internal limits definitions to MHD_limits.h

Evgeny Grin (Karlson2k) 10 anos atrás
pai
commit
2c842e6b95

+ 0 - 8
src/include/platform.h

@@ -206,12 +206,4 @@ typedef MHD_socket MHD_pipe;
 #define IPPROTO_IPV6 IPPROTO_IPV6
 #endif
 
-#ifndef OFF_T_MAX
-#define OFF_T_MAX ((off_t) ~(((uint64_t) 1) << (8 * sizeof(off_t) - 1)))
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) && !defined(OFF64_T_MAX)
-#define OFF64_T_MAX ((off64_t) ~(((uint64_t) 1) << (8 * sizeof(off64_t) - 1)))
-#endif
-
 #endif

+ 49 - 0
src/microhttpd/MHD_limits.h

@@ -0,0 +1,49 @@
+/*
+  This file is part of libmicrohttpd
+  Copyright (C) 2015 Karlson2k (Evgeny Grin)
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+/**
+ * @file microhttpd/MHD_limits.h
+ * @brief  limits values definitions
+ * @author Karlson2k (Evgeny Grin)
+ */
+
+#ifndef MHD_LIMITS_H
+#define MHD_LIMITS_H
+
+#include "platform.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif /* HAVE_LIMITS_H */
+
+
+#ifndef INT32_MAX
+#define INT32_MAX ((int32_t)0x7FFFFFFF)
+#endif /* !INT32_MAX */
+
+#ifndef OFF_T_MAX
+#define OFF_T_MAX ((off_t) ~(((uint64_t) 1) << (8 * sizeof(off_t) - 1)))
+#endif /* !OFF_T_MAX */
+
+#if defined(_LARGEFILE64_SOURCE) && !defined(OFF64_T_MAX)
+#define OFF64_T_MAX ((off64_t) ~(((uint64_t) 1) << (8 * sizeof(off64_t) - 1)))
+#endif /* _LARGEFILE64_SOURCE && !OFF64_T_MAX */
+
+
+#endif /* MHD_LIMITS_H */

+ 1 - 5
src/microhttpd/daemon.c

@@ -36,7 +36,7 @@
 #include "response.h"
 #include "connection.h"
 #include "memorypool.h"
-#include <limits.h>
+#include "MHD_limits.h"
 #include "autoinit_funcs.h"
 
 #if HAVE_SEARCH_H
@@ -117,10 +117,6 @@
 #define EPOLL_CLOEXEC 0
 #endif
 
-#ifndef INT32_MAX
-#define INT32_MAX ((int32_t)0x7FFFFFFF)
-#endif /* !INT32_MAX */
-
 
 /**
  * Default implementation of the panic function,

+ 1 - 5
src/microhttpd/response.c

@@ -28,7 +28,7 @@
 
 #include "internal.h"
 #include "response.h"
-#include <limits.h>
+#include "MHD_limits.h"
 
 #if defined(_WIN32) && defined(MHD_W32_MUTEX_)
 #ifndef WIN32_LEAN_AND_MEAN
@@ -305,10 +305,6 @@ MHD_set_response_options (struct MHD_Response *response,
 }
 
 
-#ifndef INT32_MAX
-#define INT32_MAX ((int32_t)0x7FFFFFFF)
-#endif /* !INT32_MAX */
-
 /**
  * Given a file descriptor, read data from the file
  * to generate the response.

+ 1 - 0
w32/VS2013/libmicrohttpd.vcxproj

@@ -92,6 +92,7 @@
     <ClInclude Include="..\..\src\microhttpd\internal.h" />
     <ClInclude Include="..\..\src\microhttpd\md5.h" />
     <ClInclude Include="..\..\src\microhttpd\memorypool.h" />
+    <ClInclude Include="..\..\src\microhttpd\MHD_limits.h" />
     <ClInclude Include="..\..\src\microhttpd\reason_phrase.h" />
     <ClInclude Include="..\..\src\microhttpd\response.h" />
     <ClInclude Include="..\..\src\microhttpd\tsearch.h" />

+ 3 - 0
w32/VS2013/libmicrohttpd.vcxproj.filters

@@ -105,6 +105,9 @@
     <ClInclude Include="..\..\src\include\autoinit_funcs.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\microhttpd\MHD_limits.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="microhttpd_dll_res_vc.rc">