From bfcc83638d9af8aac56c8da29b3bd94c3d8e9b40 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 29 Apr 2020 13:14:39 -0500 Subject: [PATCH] uninitialized variables-core-2 (cherry picked from commit 7c329699e4e4d13a164b2483e174b5f555ea9344) --- Engine/source/core/color.h | 1 + Engine/source/core/ogg/oggTheoraDecoder.h | 4 ++-- Engine/source/core/stream/fileStream.cpp | 1 + Engine/source/core/stringBuffer.cpp | 2 ++ Engine/source/core/util/journal/journal.h | 1 + Engine/source/core/util/str.h | 5 +++-- Engine/source/core/util/tList.h | 2 +- Engine/source/core/util/tSignal.h | 2 +- 8 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Engine/source/core/color.h b/Engine/source/core/color.h index 9a21d6df2..12b590f4e 100644 --- a/Engine/source/core/color.h +++ b/Engine/source/core/color.h @@ -529,6 +529,7 @@ inline void ColorI::set(const Hsb& color) red = (U32)((((F64)r) / 100) * 255); green = (U32)((((F64)g) / 100) * 255); blue = (U32)((((F64)b) / 100) * 255); + alpha = 255; } // This is a subfunction of HSLtoRGB diff --git a/Engine/source/core/ogg/oggTheoraDecoder.h b/Engine/source/core/ogg/oggTheoraDecoder.h index f4ef5899b..b148aba1f 100644 --- a/Engine/source/core/ogg/oggTheoraDecoder.h +++ b/Engine/source/core/ogg/oggTheoraDecoder.h @@ -48,9 +48,9 @@ class OggTheoraFrame : public RawData typedef RawData Parent; - OggTheoraFrame() {} + OggTheoraFrame() :mFrameNumber(0), mFrameTime(0), mFrameDuration(0) {} OggTheoraFrame( S8* data, U32 size, bool ownMemory = false ) - : Parent( data, size, ownMemory ) {} + : Parent( data, size, ownMemory ), mFrameNumber(0), mFrameTime(0), mFrameDuration(0) {} /// Serial number of this frame in the stream. U32 mFrameNumber; diff --git a/Engine/source/core/stream/fileStream.cpp b/Engine/source/core/stream/fileStream.cpp index 3d681db4d..29ce3a933 100644 --- a/Engine/source/core/stream/fileStream.cpp +++ b/Engine/source/core/stream/fileStream.cpp @@ -31,6 +31,7 @@ //----------------------------------------------------------------------------- FileStream::FileStream() { + dMemset(mBuffer, 0, sizeof(mBuffer)); // initialize the file stream init(); } diff --git a/Engine/source/core/stringBuffer.cpp b/Engine/source/core/stringBuffer.cpp index a55446885..2bc3fb069 100644 --- a/Engine/source/core/stringBuffer.cpp +++ b/Engine/source/core/stringBuffer.cpp @@ -38,6 +38,8 @@ StringBufferManager() { + request8 = 0.0; + request16 = 0.0; VECTOR_SET_ASSOCIATION( strings ); } diff --git a/Engine/source/core/util/journal/journal.h b/Engine/source/core/util/journal/journal.h index 9db84e2f6..a6b0b8957 100644 --- a/Engine/source/core/util/journal/journal.h +++ b/Engine/source/core/util/journal/journal.h @@ -335,6 +335,7 @@ class Journal struct FuncDecl { FuncDecl* next; Id id; + FuncDecl() :next(NULL), id(0){} virtual ~FuncDecl() {} virtual bool match(VoidPtr,VoidMethod) const = 0; virtual Functor* create() const = 0; diff --git a/Engine/source/core/util/str.h b/Engine/source/core/util/str.h index 046bc1f6f..f5264cfd6 100644 --- a/Engine/source/core/util/str.h +++ b/Engine/source/core/util/str.h @@ -29,6 +29,7 @@ #include "platform/types.h" #endif +#include template< class T > class Vector; @@ -244,7 +245,7 @@ public: _dynamicSize( 0 ), _len( 0 ) { - _fixedBuffer[0] = '\0'; + strncpy(_fixedBuffer, "", 2048); } StrFormat(const char *formatStr, va_list args) @@ -269,7 +270,7 @@ public: void reset() { _len = 0; - _fixedBuffer[0] = '\0'; + strncpy(_fixedBuffer, "", 2048); } /// Copy the formatted string into the output buffer which must be at least size() characters. diff --git a/Engine/source/core/util/tList.h b/Engine/source/core/util/tList.h index 4a2bcfd34..1ed9312b4 100644 --- a/Engine/source/core/util/tList.h +++ b/Engine/source/core/util/tList.h @@ -141,7 +141,7 @@ private: { Link* next; Link* prev; - Link() {} + Link(): next(NULL), prev(NULL) {} Link(Link* p,Link* n): next(n),prev(p) {} }; diff --git a/Engine/source/core/util/tSignal.h b/Engine/source/core/util/tSignal.h index f5531e217..b249aa6fd 100644 --- a/Engine/source/core/util/tSignal.h +++ b/Engine/source/core/util/tSignal.h @@ -76,7 +76,7 @@ protected: void insert(DelegateLink* node, F32 order); void unlink(); - + DelegateLink() :next(NULL), prev(NULL), mOrder(0) {} virtual ~DelegateLink() {} };