package/darkhttpd: fix build with gcc 4.8
PATCH 1/1 package/darkhttpd: fix build with gcc 4.8
Fix the following build failure which is raised since bump to version 0.13 in commit 88705a8c248e566f2c9ca71a8ee5353b33e368c2:
darkhttpd.c:966:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0, j = 0; i < input_length;) {
^Fixes:
- http://autobuild.buildroot.org/results/ffc/ffcb627c44d2b7202d641129b67af2dc7865c618/build-end.log
--- ...vars-outside-of-for-loop-for-std-c90.patch | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 package/darkhttpd/0001-Declare-vars-outside-of-for-loop-for-std-c90.patch
package/darkhttpd/0001-Declare-vars-outside-of-for-loop-for-std-c90.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 81b491e60affd67f4ec2feccbee1cdf98dc57b81 Mon Sep 17 00:00:00 2001 +From: Emil Mikulic <[email protected]> +Date: Sun, 21 Mar 2021 15:03:14 +1100 +Subject: [PATCH] Declare vars outside of for() loop for -std=c90. + +Fixes #2. + +[Retrieved from: +https://github.com/emikulic/darkhttpd/commit/81b491e60affd67f4ec2feccbee1cdf98dc57b81] +Signed-off-by: Fabrice Fontaine <[email protected]> +--- + darkhttpd.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/darkhttpd.c b/darkhttpd.c +index 219a8a3..268628a 100644 +--- a/darkhttpd.c ++++ b/darkhttpd.c +@@ -966,8 +966,9 @@ static char *base64_encode(char *str) { + char *encoded_data = malloc(output_length+1); + if (encoded_data == NULL) return NULL; + +- for (int i = 0, j = 0; i < input_length;) { +- ++ int i; ++ int j; ++ for (i = 0, j = 0; i < input_length;) { + uint32_t octet_a = i < input_length ? (unsigned char)str[i++] : 0; + uint32_t octet_b = i < input_length ? (unsigned char)str[i++] : 0; + uint32_t octet_c = i < input_length ? (unsigned char)str[i++] : 0; +@@ -981,7 +982,7 @@ static char *base64_encode(char *str) { + } + + const int mod_table[] = {0, 2, 1}; +- for (int i = 0; i < mod_table[input_length % 3]; i++) ++ for (i = 0; i < mod_table[input_length % 3]; i++) + encoded_data[output_length - 1 - i] = '='; + encoded_data[output_length] = '\0'; +
Signature · 1 line
2.30.2
Thomas Petazzoni
AppliedPATCH 1/1 package/darkhttpd: fix build with gcc 4.8
Quoted 7 lines · On Tue, 20 Jul 2021 22:54:08 +0200 Fabrice Fontaine…
Fix the following build failure which is raised since bump to version 0.13 in commit
88705a8c248e566f2c9ca71a8ee5353b33e368c2:darkhttpd.c:966:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0, j = 0; i < input_length;) { ^
Quoted 8 lines
Fixes:
- http://autobuild.buildroot.org/results/ffc/ffcb627c44d2b7202d641129b67af2dc7865c618/build-end.logSigned-off-by Fabrice Fontaine <[email protected]>--- ...vars-outside-of-for-loop-for-std-c90.patch | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 package/darkhttpd/0001-Declare-vars-outside-of-for-loop-for-std-c90.patch
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com