Fix faulty gcc warnings

This commit is contained in:
Werner Koch 2011-03-03 12:40:54 +01:00
parent 892793888e
commit ea41f5b4c1
5 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2011-03-03 Werner Koch <wk@g10code.com>
* armor.c (armor_filter): Don't take a copy of radbuf while
writing the checksum. This works around a faulty gcc 4.4 warning.
2011-03-02 Werner Koch <wk@g10code.com>
* call-agent.c (agent_scd_pksign, agent_scd_pkdecrypt)

View File

@ -1182,21 +1182,20 @@ armor_filter( void *opaque, int control,
crc = afx->crc;
idx = afx->idx;
idx2 = afx->idx2;
for(i=0; i < idx; i++ )
radbuf[i] = afx->radbuf[i];
if( idx ) {
c = bintoasc[(*radbuf>>2)&077];
c = bintoasc[(afx->radbuf[0]>>2)&077];
iobuf_put(a, c);
if( idx == 1 ) {
c = bintoasc[((*radbuf << 4) & 060) & 077];
c = bintoasc[((afx->radbuf[0] << 4) & 060) & 077];
iobuf_put(a, c);
iobuf_put(a, '=');
iobuf_put(a, '=');
}
else { /* 2 */
c = bintoasc[(((*radbuf<<4)&060)|((radbuf[1]>>4)&017))&077];
c = bintoasc[(((afx->radbuf[0]<<4)&060)
|((afx->radbuf[1]>>4)&017))&077];
iobuf_put(a, c);
c = bintoasc[((radbuf[1] << 2) & 074) & 077];
c = bintoasc[((afx->radbuf[1] << 2) & 074) & 077];
iobuf_put(a, c);
iobuf_put(a, '=');
}

View File

@ -1,3 +1,8 @@
2011-03-03 Werner Koch <wk@g10code.com>
* base64.c (base64_finish_write): Do not copy to radbuf to get rid
of a faulty gcc 4.4 "used uninitialized" warning.
2011-03-01 Werner Koch <wk@g10code.com>
* certreqgen.c (pSERIAL, pISSUERDN, pNOTBEFORE, pNOTAFTER)

View File

@ -484,8 +484,8 @@ plain_writer_cb (void *cb_value, const void *buffer, size_t count)
static int
base64_finish_write (struct writer_cb_parm_s *parm)
{
unsigned char radbuf[4];
int i, c, idx, quad_count;
unsigned char *radbuf;
int c, idx, quad_count;
estream_t stream = parm->stream;
if (!parm->wrote_begin)
@ -494,11 +494,10 @@ base64_finish_write (struct writer_cb_parm_s *parm)
/* flush the base64 encoding */
idx = parm->base64.idx;
quad_count = parm->base64.quad_count;
for (i=0; i < idx; i++)
radbuf[i] = parm->base64.radbuf[i];
if (idx)
{
radbuf = parm->base64.radbuf;
c = bintoasc[(*radbuf>>2)&077];
es_putc (c, stream);
if (idx == 1)

View File

@ -157,5 +157,6 @@ gcry_create_nonce (void *buffer, size_t length)
const char *
gcry_cipher_algo_name (int algo)
{
(void)algo;
return "?";
}