Address unitialized variable compiler warnings

Either initialize unitialized variables to sensible values, or supress
the warning in case the variable is always correctly initialized.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka 2011-01-11 17:14:16 -02:00
parent e906b5fd72
commit a2d9196f41
3 changed files with 8 additions and 3 deletions

@ -106,6 +106,9 @@ exit(1);
}
/* Don't warn on unitialized expected_width and expected_endmark */
#pragma GCC diagnostic ignored "-Wuninitialized"
void readchar()
{
int i,expected_width,k,len,newlen,diff,l;

@ -1539,6 +1539,7 @@ void splitline()
part1 = (inchr*)myalloc(sizeof(inchr)*(inchrlinelen+1));
part2 = (inchr*)myalloc(sizeof(inchr)*(inchrlinelen+1));
gotspace = 0;
lastspace = inchrlinelen-1;
for (i=inchrlinelen-1;i>=0;i--) {
if (!gotspace && inchrline[i]==' ') {
gotspace = 1;

@ -35,6 +35,7 @@
*
* Changes from 1.1.1 to 1.1.2:
* Relicensed under the MIT license, with consent of the copyright holders.
* Avoid usage of unitialized "length" variable in _Zgetc
* Claudio Matsuoka (Jan 11 2011)
*/
@ -681,11 +682,11 @@ int _Zgetc(ZFILE *stream)
/* If data isn't in current outbuf, get it */
offset = ZS->fileposition & ~((long) (OUTBUFSIZE-1));
length = ZS->usiz - offset;
if (length > OUTBUFSIZE) length = OUTBUFSIZE;
if (ZS->getoff != offset)
{
length = ZS->usiz - offset;
if (length > OUTBUFSIZE) length = OUTBUFSIZE;
if (BufferRead(ZS, offset, ZS->getbuf, length)) return -1;
ZS->getoff = offset;