1From 591fc6da944ffc29936e0019b2bc225ddc81dbba Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3Date: Mon, 20 Nov 2017 22:48:33 +0100 4Subject: [PATCH] lib/hsh.c: rename hsh local variable 5 6The hsh local variable name conflicts with the function prototype of 7hsh() in hsh.h, causing the following build issues with old compilers 8(gcc 4.7): 9 10hsh.c: In function 'hsh': 11hsh.c:28:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] 12hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] 13hsh.c: In function 'hsh_buf': 14hsh.c:60:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] 15hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] 16 17Therefore, we rename this local variable to _hsh. 18 19Submitted-upstream: https://github.com/latchset/jose/pull/51 20Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 21--- 22 lib/hsh.c | 12 ++++++------ 23 1 file changed, 6 insertions(+), 6 deletions(-) 24 25diff --git a/lib/hsh.c b/lib/hsh.c 26index c59a95f..a2a891b 100644 27--- a/lib/hsh.c 28+++ b/lib/hsh.c 29@@ -25,7 +25,7 @@ 30 json_t * 31 hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) 32 { 33- jose_io_auto_t *hsh = NULL; 34+ jose_io_auto_t *_hsh = NULL; 35 jose_io_auto_t *enc = NULL; 36 jose_io_auto_t *buf = NULL; 37 char b[1024] = {}; 38@@ -33,8 +33,8 @@ hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) 39 40 buf = jose_io_buffer(cfg, b, &l); 41 enc = jose_b64_enc_io(buf); 42- hsh = hsh_io(cfg, alg, enc); 43- if (!buf || !enc || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) 44+ _hsh = hsh_io(cfg, alg, enc); 45+ if (!buf || !enc || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) 46 return NULL; 47 48 return json_stringn(b, l); 49@@ -57,7 +57,7 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, 50 const void *data, size_t dlen, void *hash, size_t hlen) 51 { 52 const jose_hook_alg_t *a = NULL; 53- jose_io_auto_t *hsh = NULL; 54+ jose_io_auto_t *_hsh = NULL; 55 jose_io_auto_t *buf = NULL; 56 57 a = jose_hook_alg_find(JOSE_HOOK_ALG_KIND_HASH, alg); 58@@ -71,8 +71,8 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, 59 return SIZE_MAX; 60 61 buf = jose_io_buffer(cfg, hash, &hlen); 62- hsh = a->hash.hsh(a, cfg, buf); 63- if (!buf || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) 64+ _hsh = a->hash.hsh(a, cfg, buf); 65+ if (!buf || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) 66 return SIZE_MAX; 67 68 return hlen; 69-- 702.13.6 71 72