gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13950 - in libmicrohttpd: . doc src/daemon src/examples sr


From: gnunet
Subject: [GNUnet-SVN] r13950 - in libmicrohttpd: . doc src/daemon src/examples src/include
Date: Mon, 20 Dec 2010 21:24:17 +0100

Author: grothoff
Date: 2010-12-20 21:24:17 +0100 (Mon, 20 Dec 2010)
New Revision: 13950

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/doc/microhttpd.texi
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/examples/fileserver_example_external_select.c
   libmicrohttpd/src/include/microhttpd.h
Log:
mantis 1631

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2010-12-20 20:10:05 UTC (rev 13949)
+++ libmicrohttpd/ChangeLog     2010-12-20 20:24:17 UTC (rev 13950)
@@ -1,3 +1,8 @@
+Mon Dec 20 21:22:57 CET 2010
+       Added macro MHD_LONG_LONG to allow change of MHD's "long long" use
+       to some other type on platforms that do not support "long long"
+       (Mantis #1631). -CG/bplant
+
 Sun Dec 19 19:54:15 CET 2010
        Added 'MHD_create_response_from_fd_at_offset'. -CG
 

Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi   2010-12-20 20:10:05 UTC (rev 13949)
+++ libmicrohttpd/doc/microhttpd.texi   2010-12-20 20:24:17 UTC (rev 13950)
@@ -245,7 +245,21 @@
 }
 @end verbatim
 
address@hidden MHD_LONG_LONG
address@hidden long long
address@hidden IAR
address@hidden ARM
address@hidden cortex m3
 
+Some platforms do not support @code{long long}.  Hence MHD defines
+a macro @code{MHD_LONG_LONG} which will default to @code{long long}.
+If your platform does not support @code{long long}, you should
+change "platform.h" to define @code{MHD_LONG_LONG} to an appropriate
+alternative type and also define @code{MHD_LONG_LONG_PRINTF} to the
+corresponding format string for printing such a data type (without
+the percent sign).
+
+
 @c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 @c ------------------------------------------------------------

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2010-12-20 20:10:05 UTC (rev 
13949)
+++ libmicrohttpd/src/daemon/connection.c       2010-12-20 20:24:17 UTC (rev 
13950)
@@ -526,8 +526,8 @@
                                             MHD_HTTP_HEADER_CONTENT_LENGTH))
     {
       SPRINTF (buf,
-               "%llu",
-              (unsigned long long)connection->response->total_size);
+               "%" MHD_LONG_LONG_PRINTF "u",
+              (unsigned MHD_LONG_LONG)connection->response->total_size);
       MHD_add_response_header (connection->response,
                                MHD_HTTP_HEADER_CONTENT_LENGTH, buf);
     }
@@ -1641,7 +1641,7 @@
 parse_connection_headers (struct MHD_Connection *connection)
 {
   const char *clen;
-  unsigned long long cval;
+  unsigned MHD_LONG_LONG cval;
   struct MHD_Response *response;
   const char *enc;
 
@@ -1675,7 +1675,7 @@
                                       MHD_HTTP_HEADER_CONTENT_LENGTH);
   if (clen != NULL)
     {
-      if (1 != SSCANF (clen, "%llu", &cval))
+      if (1 != SSCANF (clen, "%" MHD_LONG_LONG_PRINTF "u", &cval))
         {
 #if HAVE_MESSAGES
           MHD_DLOG (connection->daemon,

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2010-12-20 20:10:05 UTC (rev 13949)
+++ libmicrohttpd/src/daemon/daemon.c   2010-12-20 20:24:17 UTC (rev 13950)
@@ -1088,7 +1088,7 @@
  *        necessiate the use of a timeout right now).
  */
 int
-MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)
+MHD_get_timeout (struct MHD_Daemon *daemon, unsigned MHD_LONG_LONG *timeout)
 {
   time_t earliest_deadline;
   time_t now;
@@ -1140,7 +1140,7 @@
   fd_set es;
   int max;
   struct timeval timeout;
-  unsigned long long ltimeout;
+  unsigned MHD_LONG_LONG ltimeout;
   int ds;
 
   timeout.tv_sec = 0;

Modified: libmicrohttpd/src/examples/fileserver_example_external_select.c
===================================================================
--- libmicrohttpd/src/examples/fileserver_example_external_select.c     
2010-12-20 20:10:05 UTC (rev 13949)
+++ libmicrohttpd/src/examples/fileserver_example_external_select.c     
2010-12-20 20:24:17 UTC (rev 13950)
@@ -110,7 +110,7 @@
   fd_set ws;
   fd_set es;
   int max;
-  unsigned long long mhd_timeout;
+  unsigned MHD_LONG_LONG mhd_timeout;
 
   if (argc != 3)
     {

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2010-12-20 20:10:05 UTC (rev 
13949)
+++ libmicrohttpd/src/include/microhttpd.h      2010-12-20 20:24:17 UTC (rev 
13950)
@@ -141,7 +141,23 @@
 #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1)
 #endif
 
+/**
+ * Not all architectures and printf's support the long long type.
+ * This gives the ability to replace long long with just a long,
+ * standard int or a short.
+ */
+#ifndef MHD_LONG_LONG
+#define MHD_LONG_LONG long long
+#endif
+#ifndef MHD_LONG_LONG_PRINTF
+/**
+ * Format string for printing a variable of type 'MHD_LONG_LONG'.
+ * You should only redefine this if you also define MHD_LONG_LONG.
+ */
+#define MHD_LONG_LONG_PRINTF "ll"
+#endif
 
+
 /**
  * HTTP response codes.
  */
@@ -1035,7 +1051,8 @@
  *        not used (or no connections exist that would
  *        necessiate the use of a timeout right now).
  */
-int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout);
+int MHD_get_timeout (struct MHD_Daemon *daemon, 
+                    unsigned MHD_LONG_LONG *timeout);
 
 
 /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]