diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-11-20 23:22:53 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-11-20 23:22:53 +0100 |
commit | 47df95a73d24d0bfe4216b6fc53da17abbafa4fa (patch) | |
tree | d3e4eecd7dfe82e3f681afc6a5e0a50182db44e2 /package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch | |
parent | 17299cd0182df1b4202429a9c567765b3d2510bc (diff) | |
download | buildroot-47df95a73d24d0bfe4216b6fc53da17abbafa4fa.tar.gz buildroot-47df95a73d24d0bfe4216b6fc53da17abbafa4fa.zip |
jose: fix build with old compilers
This commit adds two patches to the jose package that fix the build
with old compilers such as gcc 4.7.
Fixes:
http://autobuild.buildroot.net/results/00d5a4b809922f8fa42c0de9d461c9754d2f8098
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch')
-rw-r--r-- | package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch b/package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch new file mode 100644 index 0000000000..0bd259ad8b --- /dev/null +++ b/package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch @@ -0,0 +1,71 @@ +From 591fc6da944ffc29936e0019b2bc225ddc81dbba Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> +Date: Mon, 20 Nov 2017 22:48:33 +0100 +Subject: [PATCH] lib/hsh.c: rename hsh local variable + +The hsh local variable name conflicts with the function prototype of +hsh() in hsh.h, causing the following build issues with old compilers +(gcc 4.7): + +hsh.c: In function 'hsh': +hsh.c:28:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] +hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] +hsh.c: In function 'hsh_buf': +hsh.c:60:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] +hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] + +Therefore, we rename this local variable to _hsh. + +Submitted-upstream: https://github.com/latchset/jose/pull/51 +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> +--- + lib/hsh.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/lib/hsh.c b/lib/hsh.c +index c59a95f..a2a891b 100644 +--- a/lib/hsh.c ++++ b/lib/hsh.c +@@ -25,7 +25,7 @@ + json_t * + hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) + { +- jose_io_auto_t *hsh = NULL; ++ jose_io_auto_t *_hsh = NULL; + jose_io_auto_t *enc = NULL; + jose_io_auto_t *buf = NULL; + char b[1024] = {}; +@@ -33,8 +33,8 @@ hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) + + buf = jose_io_buffer(cfg, b, &l); + enc = jose_b64_enc_io(buf); +- hsh = hsh_io(cfg, alg, enc); +- if (!buf || !enc || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) ++ _hsh = hsh_io(cfg, alg, enc); ++ if (!buf || !enc || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) + return NULL; + + return json_stringn(b, l); +@@ -57,7 +57,7 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, + const void *data, size_t dlen, void *hash, size_t hlen) + { + const jose_hook_alg_t *a = NULL; +- jose_io_auto_t *hsh = NULL; ++ jose_io_auto_t *_hsh = NULL; + jose_io_auto_t *buf = NULL; + + a = jose_hook_alg_find(JOSE_HOOK_ALG_KIND_HASH, alg); +@@ -71,8 +71,8 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, + return SIZE_MAX; + + buf = jose_io_buffer(cfg, hash, &hlen); +- hsh = a->hash.hsh(a, cfg, buf); +- if (!buf || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) ++ _hsh = a->hash.hsh(a, cfg, buf); ++ if (!buf || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) + return SIZE_MAX; + + return hlen; +-- +2.13.6 + |