From a18a99bb2d43f7c4fc19b30a8f12d81e8ab996af Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 14 Aug 2008 16:21:56 +0000 Subject: Avoid returning non-initialized value on EOF. --- lib/Handle.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Handle.cc b/lib/Handle.cc index cd2ec16..5b48040 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.85 2008-08-11 16:23:52 pixel Exp $ */ +/* $Id: Handle.cc,v 1.86 2008-08-14 16:21:56 pixel Exp $ */ #include #include @@ -488,13 +488,13 @@ off_t Handle::seek(off_t offset, int whence) throw(GeneralException) { } Uint8 Handle::readU8() { - Uint8 r; + Uint8 r = 0; read(&r, 1); return r; } Uint16 Handle::readU16() { - Uint16 r; + Uint16 r = 0; read(&r, 2); #ifdef WORDS_BIGENDIAN return bswap_16(r); @@ -504,7 +504,7 @@ Uint16 Handle::readU16() { } Uint32 Handle::readU32() { - Uint32 r; + Uint32 r = 0; read(&r, 4); #ifdef WORDS_BIGENDIAN return bswap_32(r); @@ -515,12 +515,12 @@ Uint32 Handle::readU32() { float Handle::readFloat() { #ifdef WORDS_BIGENDIAN - Uint32 t; + Uint32 t = 0; read(&t, 4); t = bswap_32(t); return *((float *)&t); #else - float r; + float r = 0; read(&r, 4); return r; #endif @@ -528,14 +528,14 @@ float Handle::readFloat() { double Handle::readDouble() { #ifdef WORDS_BIGENDIAN - Uint32 t[3]; + Uint32 t[3] = { 0, 0 }; read(t, 8); t[2] = bswap_32(t[0]); t[0] = bswap_32(t[1]); t[1] = t[2]; return *((double *)t); #else - double r; + double r = 0; read(&r, 8); return r; #endif -- cgit v1.2.3