aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-12-20 20:24:17 +0000
committerChristian Grothoff <christian@grothoff.org>2010-12-20 20:24:17 +0000
commit46a4adb3a2abf2666eaa5586884ac543ec2e283d (patch)
tree368514d335a48cc19071927a5898cdce31929f90
parent45e7e0d0e95962c90b78eea44981774634c52893 (diff)
downloadlibmicrohttpd-46a4adb3a2abf2666eaa5586884ac543ec2e283d.tar.gz
libmicrohttpd-46a4adb3a2abf2666eaa5586884ac543ec2e283d.zip
mantis 1631
-rw-r--r--ChangeLog5
-rw-r--r--doc/microhttpd.texi14
-rw-r--r--src/daemon/connection.c8
-rw-r--r--src/daemon/daemon.c4
-rw-r--r--src/examples/fileserver_example_external_select.c2
-rw-r--r--src/include/microhttpd.h19
6 files changed, 44 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 96c787d1..5377f8ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Mon 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
1Sun Dec 19 19:54:15 CET 2010 6Sun 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
254Some platforms do not support @code{long long}. Hence MHD defines
255a macro @code{MHD_LONG_LONG} which will default to @code{long long}.
256If your platform does not support @code{long long}, you should
257change "platform.h" to define @code{MHD_LONG_LONG} to an appropriate
258alternative type and also define @code{MHD_LONG_LONG_PRINTF} to the
259corresponding format string for printing such a data type (without
260the 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
1641parse_connection_headers (struct MHD_Connection *connection) 1641parse_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 */
1090int 1090int
1091MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) 1091MHD_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 */
1038int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout); 1054int MHD_get_timeout (struct MHD_Daemon *daemon,
1055 unsigned MHD_LONG_LONG *timeout);
1039 1056
1040 1057
1041/** 1058/**