Skip to content

Commit

Permalink
Address unitialized variable compiler warnings
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cmatsuoka committed Jan 11, 2011
1 parent e906b5f commit a2d9196
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions chkfont.c
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions figlet.c
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions zipio.c
Expand Up @@ -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)
*/

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a2d9196

Please sign in to comment.