diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-12-20 20:24:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-12-20 20:24:17 +0000 |
commit | 46a4adb3a2abf2666eaa5586884ac543ec2e283d (patch) | |
tree | 368514d335a48cc19071927a5898cdce31929f90 | |
parent | 45e7e0d0e95962c90b78eea44981774634c52893 (diff) | |
download | libmicrohttpd-46a4adb3a2abf2666eaa5586884ac543ec2e283d.tar.gz libmicrohttpd-46a4adb3a2abf2666eaa5586884ac543ec2e283d.zip |
mantis 1631
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | doc/microhttpd.texi | 14 | ||||
-rw-r--r-- | src/daemon/connection.c | 8 | ||||
-rw-r--r-- | src/daemon/daemon.c | 4 | ||||
-rw-r--r-- | src/examples/fileserver_example_external_select.c | 2 | ||||
-rw-r--r-- | src/include/microhttpd.h | 19 |
6 files changed, 44 insertions, 8 deletions
@@ -1,3 +1,8 @@ | |||
1 | Mon Dec 20 21:22:57 CET 2010 | ||
2 | Added macro MHD_LONG_LONG to allow change of MHD's "long long" use | ||
3 | to some other type on platforms that do not support "long long" | ||
4 | (Mantis #1631). -CG/bplant | ||
5 | |||
1 | Sun Dec 19 19:54:15 CET 2010 | 6 | Sun Dec 19 19:54:15 CET 2010 |
2 | Added 'MHD_create_response_from_fd_at_offset'. -CG | 7 | Added 'MHD_create_response_from_fd_at_offset'. -CG |
3 | 8 | ||
diff --git a/doc/microhttpd.texi b/doc/microhttpd.texi index 0298dfde..507490d0 100644 --- a/doc/microhttpd.texi +++ b/doc/microhttpd.texi | |||
@@ -245,6 +245,20 @@ ignore_sigpipe () | |||
245 | } | 245 | } |
246 | @end verbatim | 246 | @end verbatim |
247 | 247 | ||
248 | @section MHD_LONG_LONG | ||
249 | @cindex long long | ||
250 | @cindex IAR | ||
251 | @cindex ARM | ||
252 | @cindex cortex m3 | ||
253 | |||
254 | Some platforms do not support @code{long long}. Hence MHD defines | ||
255 | a macro @code{MHD_LONG_LONG} which will default to @code{long long}. | ||
256 | If your platform does not support @code{long long}, you should | ||
257 | change "platform.h" to define @code{MHD_LONG_LONG} to an appropriate | ||
258 | alternative type and also define @code{MHD_LONG_LONG_PRINTF} to the | ||
259 | corresponding format string for printing such a data type (without | ||
260 | the percent sign). | ||
261 | |||
248 | 262 | ||
249 | @c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 263 | @c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
250 | 264 | ||
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index c7e16bac..7a05037d 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -526,8 +526,8 @@ add_extra_headers (struct MHD_Connection *connection) | |||
526 | MHD_HTTP_HEADER_CONTENT_LENGTH)) | 526 | MHD_HTTP_HEADER_CONTENT_LENGTH)) |
527 | { | 527 | { |
528 | SPRINTF (buf, | 528 | SPRINTF (buf, |
529 | "%llu", | 529 | "%" MHD_LONG_LONG_PRINTF "u", |
530 | (unsigned long long)connection->response->total_size); | 530 | (unsigned MHD_LONG_LONG)connection->response->total_size); |
531 | MHD_add_response_header (connection->response, | 531 | MHD_add_response_header (connection->response, |
532 | MHD_HTTP_HEADER_CONTENT_LENGTH, buf); | 532 | MHD_HTTP_HEADER_CONTENT_LENGTH, buf); |
533 | } | 533 | } |
@@ -1641,7 +1641,7 @@ static void | |||
1641 | parse_connection_headers (struct MHD_Connection *connection) | 1641 | parse_connection_headers (struct MHD_Connection *connection) |
1642 | { | 1642 | { |
1643 | const char *clen; | 1643 | const char *clen; |
1644 | unsigned long long cval; | 1644 | unsigned MHD_LONG_LONG cval; |
1645 | struct MHD_Response *response; | 1645 | struct MHD_Response *response; |
1646 | const char *enc; | 1646 | const char *enc; |
1647 | 1647 | ||
@@ -1675,7 +1675,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
1675 | MHD_HTTP_HEADER_CONTENT_LENGTH); | 1675 | MHD_HTTP_HEADER_CONTENT_LENGTH); |
1676 | if (clen != NULL) | 1676 | if (clen != NULL) |
1677 | { | 1677 | { |
1678 | if (1 != SSCANF (clen, "%llu", &cval)) | 1678 | if (1 != SSCANF (clen, "%" MHD_LONG_LONG_PRINTF "u", &cval)) |
1679 | { | 1679 | { |
1680 | #if HAVE_MESSAGES | 1680 | #if HAVE_MESSAGES |
1681 | MHD_DLOG (connection->daemon, | 1681 | MHD_DLOG (connection->daemon, |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 31a87bf0..8119dfbf 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1088,7 +1088,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
1088 | * necessiate the use of a timeout right now). | 1088 | * necessiate the use of a timeout right now). |
1089 | */ | 1089 | */ |
1090 | int | 1090 | int |
1091 | MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) | 1091 | MHD_get_timeout (struct MHD_Daemon *daemon, unsigned MHD_LONG_LONG *timeout) |
1092 | { | 1092 | { |
1093 | time_t earliest_deadline; | 1093 | time_t earliest_deadline; |
1094 | time_t now; | 1094 | time_t now; |
@@ -1140,7 +1140,7 @@ MHD_select (struct MHD_Daemon *daemon, int may_block) | |||
1140 | fd_set es; | 1140 | fd_set es; |
1141 | int max; | 1141 | int max; |
1142 | struct timeval timeout; | 1142 | struct timeval timeout; |
1143 | unsigned long long ltimeout; | 1143 | unsigned MHD_LONG_LONG ltimeout; |
1144 | int ds; | 1144 | int ds; |
1145 | 1145 | ||
1146 | timeout.tv_sec = 0; | 1146 | timeout.tv_sec = 0; |
diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c index aabe1d96..a4dfcc1c 100644 --- a/src/examples/fileserver_example_external_select.c +++ b/src/examples/fileserver_example_external_select.c | |||
@@ -110,7 +110,7 @@ main (int argc, char *const *argv) | |||
110 | fd_set ws; | 110 | fd_set ws; |
111 | fd_set es; | 111 | fd_set es; |
112 | int max; | 112 | int max; |
113 | unsigned long long mhd_timeout; | 113 | unsigned MHD_LONG_LONG mhd_timeout; |
114 | 114 | ||
115 | if (argc != 3) | 115 | if (argc != 3) |
116 | { | 116 | { |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 5edf8f98..e97e1abd 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -141,6 +141,22 @@ extern "C" | |||
141 | #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1) | 141 | #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1) |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | /** | ||
145 | * Not all architectures and printf's support the long long type. | ||
146 | * This gives the ability to replace long long with just a long, | ||
147 | * standard int or a short. | ||
148 | */ | ||
149 | #ifndef MHD_LONG_LONG | ||
150 | #define MHD_LONG_LONG long long | ||
151 | #endif | ||
152 | #ifndef MHD_LONG_LONG_PRINTF | ||
153 | /** | ||
154 | * Format string for printing a variable of type 'MHD_LONG_LONG'. | ||
155 | * You should only redefine this if you also define MHD_LONG_LONG. | ||
156 | */ | ||
157 | #define MHD_LONG_LONG_PRINTF "ll" | ||
158 | #endif | ||
159 | |||
144 | 160 | ||
145 | /** | 161 | /** |
146 | * HTTP response codes. | 162 | * HTTP response codes. |
@@ -1035,7 +1051,8 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
1035 | * not used (or no connections exist that would | 1051 | * not used (or no connections exist that would |
1036 | * necessiate the use of a timeout right now). | 1052 | * necessiate the use of a timeout right now). |
1037 | */ | 1053 | */ |
1038 | int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout); | 1054 | int MHD_get_timeout (struct MHD_Daemon *daemon, |
1055 | unsigned MHD_LONG_LONG *timeout); | ||
1039 | 1056 | ||
1040 | 1057 | ||
1041 | /** | 1058 | /** |