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