GNU libmicrohttpd  0.9.29
mhd_limits.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2015 Karlson2k (Evgeny Grin)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
26 #ifndef MHD_LIMITS_H
27 #define MHD_LIMITS_H
28 
29 #include "platform.h"
30 
31 #ifdef HAVE_LIMITS_H
32 #include <limits.h>
33 #endif /* HAVE_LIMITS_H */
34 
35 #ifndef LONG_MAX
36 #define LONG_MAX ((long) ~(((uint64_t) 1) << (8 * sizeof(long) - 1)))
37 #endif /* !OFF_T_MAX */
38 
39 #ifndef ULLONG_MAX
40 #define ((MHD_UNSIGNED_LONG_LONG) ~((MHD_UNSIGNED_LONG_LONG)0))
41 #endif /* !ULLONG_MAX */
42 
43 #ifndef INT32_MAX
44 #define INT32_MAX ((int32_t)0x7FFFFFFF)
45 #endif /* !INT32_MAX */
46 
47 #ifndef SIZE_MAX
48 #define SIZE_MAX ((size_t) ~((size_t)0))
49 #endif /* !SIZE_MAX */
50 
51 #ifndef OFF_T_MAX
52 #define OFF_T_MAX ((off_t) ~(((uint64_t) 1) << (8 * sizeof(off_t) - 1)))
53 #endif /* !OFF_T_MAX */
54 
55 #if defined(_LARGEFILE64_SOURCE) && !defined(OFF64_T_MAX)
56 #define OFF64_T_MAX ((off64_t) ~(((uint64_t) 1) << (8 * sizeof(off64_t) - 1)))
57 #endif /* _LARGEFILE64_SOURCE && !OFF64_T_MAX */
58 
59 #ifndef TIME_T_MAX
60 /* Assume that time_t is signed type. */
61 /* Even if time_t is unsigned, TIME_T_MAX will be safe limit */
62 #define TIME_T_MAX ( (time_t) ~(((uint64_t) 1) << (8 * sizeof(time_t) - 1)) )
63 #endif /* !TIME_T_MAX */
64 
65 #ifndef TIMEVAL_TV_SEC_MAX
66 #ifndef _WIN32
67 #define TIMEVAL_TV_SEC_MAX TIME_T_MAX
68 #else /* _WIN32 */
69 #define TIMEVAL_TV_SEC_MAX LONG_MAX
70 #endif /* _WIN32 */
71 #endif /* !TIMEVAL_TV_SEC_MAX */
72 
73 #endif /* MHD_LIMITS_H */
platform-specific includes for libmicrohttpd