Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/gzip Fix numerous uninitalized variables.



details:   https://anonhg.NetBSD.org/src/rev/11c1e607d57a
branches:  trunk
changeset: 581480:11c1e607d57a
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jun 02 01:51:58 2005 +0000

description:
Fix numerous uninitalized variables.
Detected with gcc -Wuninitialized.

diffstat:

 usr.bin/gzip/gzip.c    |  16 ++++++++--------
 usr.bin/gzip/unbzip2.c |   4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r e458896ed372 -r 11c1e607d57a usr.bin/gzip/gzip.c
--- a/usr.bin/gzip/gzip.c       Thu Jun 02 01:42:11 2005 +0000
+++ b/usr.bin/gzip/gzip.c       Thu Jun 02 01:51:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gzip.c,v 1.71 2005/02/22 21:45:44 yamt Exp $   */
+/*     $NetBSD: gzip.c,v 1.72 2005/06/02 01:51:58 lukem Exp $  */
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green
@@ -32,7 +32,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green\n\
      All rights reserved.\n");
-__RCSID("$NetBSD: gzip.c,v 1.71 2005/02/22 21:45:44 yamt Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.72 2005/06/02 01:51:58 lukem Exp $");
 #endif /* not lint */
 
 /*
@@ -664,8 +664,8 @@
 {
        z_stream z;
        char *outbufp, *inbufp;
-       off_t out_tot, in_tot;
-       uint32_t out_sub_tot;
+       off_t out_tot = -1, in_tot = 0;
+       uint32_t out_sub_tot = 0;
        enum {
                GZSTATE_MAGIC0,
                GZSTATE_MAGIC1,
@@ -685,8 +685,8 @@
                GZSTATE_LEN,
        } state = GZSTATE_MAGIC0;
        int flags = 0, skip_count = 0;
-       int error, done_reading = 0;
-       uLong crc;
+       int error = Z_STREAM_ERROR, done_reading = 0;
+       uLong crc = 0;
        ssize_t wr;
        int needmore = 0;
 
@@ -1827,9 +1827,9 @@
        static int first = 1;
 #ifndef SMALL
        static off_t in_tot, out_tot;
-       uint32_t crc;
+       uint32_t crc = 0;
 #endif
-       off_t in;
+       off_t in = 0;
        int rv;
 
        if (first) {
diff -r e458896ed372 -r 11c1e607d57a usr.bin/gzip/unbzip2.c
--- a/usr.bin/gzip/unbzip2.c    Thu Jun 02 01:42:11 2005 +0000
+++ b/usr.bin/gzip/unbzip2.c    Thu Jun 02 01:51:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unbzip2.c,v 1.6 2004/09/05 21:32:30 dsl Exp $  */
+/*     $NetBSD: unbzip2.c,v 1.7 2005/06/02 01:51:58 lukem Exp $        */
 
 /* This file is #included by gzip.c */
 
@@ -6,7 +6,7 @@
 unbzip2(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
 {
        int             ret, end_of_file;
-       size_t          n;
+       size_t          n = 0;
        off_t           bytes_out = 0;
        bz_stream       bzs;
        static char     *inbuf, *outbuf;



Home | Main Index | Thread Index | Old Index