[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] branch master updated: avoid c99-style comm
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] branch master updated: avoid c99-style comments in examples, fix missed VLA |
Date: |
Wed, 12 Dec 2018 01:21:10 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 7ea8a331 avoid c99-style comments in examples, fix missed VLA
7ea8a331 is described below
commit 7ea8a3310e44d1ee3f455c3c1a1c630ca54057b3
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Dec 12 01:21:05 2018 +0100
avoid c99-style comments in examples, fix missed VLA
---
src/examples/suspend_resume_epoll.c | 14 +++++++-------
src/microhttpd/digestauth.c | 18 +++++++++++++++++-
w32/common/MHD_config.h | 2 ++
3 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/examples/suspend_resume_epoll.c
b/src/examples/suspend_resume_epoll.c
index 0f9f66bf..903dcd81 100644
--- a/src/examples/suspend_resume_epoll.c
+++ b/src/examples/suspend_resume_epoll.c
@@ -74,7 +74,7 @@ ahc_echo (void *cls,
if (-1 != req->timerfd)
{
- // send response (echo request url)
+ /* send response (echo request url) */
response = MHD_create_response_from_buffer (strlen (url),
(void *) url,
MHD_RESPMEM_MUST_COPY);
@@ -86,7 +86,7 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- // create timer and suspend connection
+ /* create timer and suspend connection */
req->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
if (-1 == req->timerfd)
{
@@ -183,24 +183,24 @@ main (int argc,
{
if (events_list[0].data.ptr)
{
- // A timer has timed out
+ /* A timer has timed out */
req = events_list[0].data.ptr;
- // read from the fd so the system knows we heard the notice
+ /* read from the fd so the system knows we heard the notice */
if (-1 == read(req->timerfd, &timer_expirations,
sizeof(timer_expirations)))
{
return 1;
}
- // Now resume the connection
+ /* Now resume the connection */
MHD_resume_connection(req->connection);
}
}
else if (0 == current_event_count)
{
- // no events: continue
+ /* no events: continue */
}
else
{
- // error
+ /* error */
return 1;
}
if (! MHD_run(d))
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index af146c31..1eea4446 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -59,6 +59,8 @@
*/
#define MAX_DIGEST SHA256_DIGEST_SIZE
+#define MAX_NONCE NONCE_STD_LEN((MAX_DIGEST)+1)
+
/**
* Macro to avoid using VLAs if the compiler does not support them.
*/
@@ -69,6 +71,13 @@
* @param n length of the digest to be used for a VLA
*/
#define VLA_ARRAY_LEN_DIGEST(n) (((n) <=
MAX_DIGEST?1:(mhd_panic(mhd_panic_cls, __FILE__, __LINE__, "VLA too
big"),1)),MAX_DIGEST)
+
+/**
+ * Check that @a n is below #MAX_NONCE, then return #MAX_NONCE.
+ *
+ * @param n length of the digest to be used for a VLA
+ */
+#define VLA_ARRAY_LEN_NONCE(n) (((n) <= MAX_NONCE?1:(mhd_panic(mhd_panic_cls,
__FILE__, __LINE__, "VLA too big"),1)),MAX_NONCE)
#else
/**
* Check that @a n is below #MAX_DIGEST, then return @a n.
@@ -76,6 +85,13 @@
* @param n length of the digest to be used for a VLA
*/
#define VLA_ARRAY_LEN_DIGEST(n) (((n) <=
MAX_DIGEST?1:(mhd_panic(mhd_panic_cls, __FILE__, __LINE__, "VLA too big"),1)),n)
+
+/**
+ * Check that @a n is below #MAX_NONCE, then return @a n.
+ *
+ * @param n length of the digest to be used for a VLA
+ */
+#define VLA_ARRAY_LEN_NONCE(n) (((n) <= MAX_NONCE?1:(mhd_panic(mhd_panic_cls,
__FILE__, __LINE__, "VLA too big"),1)),n)
#endif
/**
@@ -1320,7 +1336,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection
*connection,
SETUP_DA (algo, da);
{
- char nonce[NONCE_STD_LEN(da.digest_size) + 1];
+ char nonce[VLA_ARRAY_LEN_NONCE (NONCE_STD_LEN(da.digest_size) + 1)];
/* Generating the server nonce */
calculate_nonce ((uint32_t) MHD_monotonic_sec_counter(),
connection->method,
diff --git a/w32/common/MHD_config.h b/w32/common/MHD_config.h
index 964df10d..191a6cf9 100644
--- a/w32/common/MHD_config.h
+++ b/w32/common/MHD_config.h
@@ -10,7 +10,9 @@
#define MSVC 1
/* Define that MS VC does not support VLAs */
+#ifndef __clang__
#define __STDC_NO_VLA__ 1
+#endif
/* Define to 1 if your C compiler supports inline functions. */
#define INLINE_FUNC 1
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libmicrohttpd] branch master updated: avoid c99-style comments in examples, fix missed VLA,
gnunet <=