summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-08-14 16:21:56 +0000
committerpixel <pixel>2008-08-14 16:21:56 +0000
commita18a99bb2d43f7c4fc19b30a8f12d81e8ab996af (patch)
treec559623c2b1c2a61c93636abbffde806ef40ef60
parentcd968704b4f0db7029953fe1d52c2f3070077639 (diff)
Avoid returning non-initialized value on EOF.
-rw-r--r--lib/Handle.cc16
1 files 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 <stdio.h>
#include <string.h>
@@ -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