Make sure all variables are initialized.
From: Erik Hovland <erik@hovland.org>
---
libs/libmythfreemheg/BaseClasses.h | 4 ++--
libs/libmythfreemheg/Bitmap.cpp | 2 ++
libs/libmythfreemheg/Groups.cpp | 1 +
libs/libmythfreemheg/Groups.h | 2 +-
libs/libmythfreemheg/Ingredients.cpp | 4 ++++
libs/libmythfreemheg/Ingredients.h | 3 ++-
libs/libmythfreemheg/Link.cpp | 1 +
libs/libmythfreemheg/Stream.cpp | 2 ++
libs/libmythfreemheg/Text.cpp | 18 ++++++++++--------
libs/libmythfreemheg/Text.h | 2 +-
libs/libmythfreemheg/Variables.h | 6 +++---
libs/libmythfreemheg/Visible.cpp | 10 ++++++++++
12 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/libs/libmythfreemheg/BaseClasses.h b/libs/libmythfreemheg/BaseClasses.h
index 635fca5..84c7f2b 100644
a
|
b
|
protected: |
192 | 192 | class MHGenericBoolean: public MHGenericBase |
193 | 193 | { |
194 | 194 | public: |
195 | | MHGenericBoolean() {} |
| 195 | MHGenericBoolean() : m_fDirect(false) {} |
196 | 196 | void Initialise(MHParseNode *p, MHEngine *engine); |
197 | 197 | void PrintMe(FILE *fd, int nTabs) const; |
198 | 198 | bool GetValue(MHEngine *engine) const; // Return the value, looking up any indirect ref. |
… |
… |
protected: |
203 | 203 | class MHGenericInteger: public MHGenericBase |
204 | 204 | { |
205 | 205 | public: |
206 | | MHGenericInteger() {} |
| 206 | MHGenericInteger() : m_nDirect(-1) {} |
207 | 207 | void Initialise(MHParseNode *p, MHEngine *engine); |
208 | 208 | void PrintMe(FILE *fd, int nTabs) const; |
209 | 209 | int GetValue(MHEngine *engine) const; // Return the value, looking up any indirect ref. |
diff --git a/libs/libmythfreemheg/Bitmap.cpp b/libs/libmythfreemheg/Bitmap.cpp
index aa94f69..14bb103 100644
a
|
b
|
MHBitmap::MHBitmap() |
41 | 41 | { |
42 | 42 | m_fTiling = false; |
43 | 43 | m_nOrigTransparency = 0; |
| 44 | m_nTransparency = 0; |
44 | 45 | m_nXDecodeOffset = 0; |
45 | 46 | m_nYDecodeOffset = 0; |
46 | 47 | m_pContent = NULL; |
… |
… |
MHBitmap::MHBitmap(const MHBitmap &ref): MHVisible(ref) |
50 | 51 | { |
51 | 52 | m_fTiling = ref.m_fTiling; |
52 | 53 | m_nOrigTransparency = ref.m_nOrigTransparency; |
| 54 | m_nTransparency = 0; |
53 | 55 | m_nXDecodeOffset = 0; |
54 | 56 | m_nYDecodeOffset = 0; |
55 | 57 | m_pContent = NULL; |
diff --git a/libs/libmythfreemheg/Groups.cpp b/libs/libmythfreemheg/Groups.cpp
index 2240366..7c3290d 100644
a
|
b
|
|
40 | 40 | MHGroup::MHGroup() |
41 | 41 | { |
42 | 42 | m_nOrigGCPriority = 127; // Default. |
| 43 | m_fIsApp = false; |
43 | 44 | m_nLastId = 0; |
44 | 45 | } |
45 | 46 | |
diff --git a/libs/libmythfreemheg/Groups.h b/libs/libmythfreemheg/Groups.h
index 324880b..be80db3 100644
a
|
b
|
public: |
157 | 157 | class MHSendEvent: public MHElemAction |
158 | 158 | { |
159 | 159 | public: |
160 | | MHSendEvent(): MHElemAction(":SendEvent") {} |
| 160 | MHSendEvent(): MHElemAction(":SendEvent"), m_EventType(EventIsAvailable) {} |
161 | 161 | virtual void Initialise(MHParseNode *p, MHEngine *engine); |
162 | 162 | virtual void Perform(MHEngine *engine); |
163 | 163 | virtual void PrintArgs(FILE *fd, int nTabs) const; |
diff --git a/libs/libmythfreemheg/Ingredients.cpp b/libs/libmythfreemheg/Ingredients.cpp
index 6694e13..8798163 100644
a
|
b
|
MHIngredient::MHIngredient() |
36 | 36 | m_fShared = false; |
37 | 37 | m_nOrigContentSize = 0; |
38 | 38 | m_nOrigCCPrio = 127; // Default. |
| 39 | m_nContentSize = 0; |
| 40 | m_nCCPrio = 0; |
39 | 41 | m_ContentType = IN_NoContent; |
40 | 42 | } |
41 | 43 | |
… |
… |
MHIngredient::MHIngredient(const MHIngredient &ref): MHRoot(ref) |
51 | 53 | m_nOrigContentSize = ref.m_nOrigContentSize; |
52 | 54 | m_nOrigCCPrio = ref.m_nOrigCCPrio; |
53 | 55 | m_fShared = ref.m_fShared; |
| 56 | m_nContentSize = ref.m_nContentSize; |
| 57 | m_nCCPrio = ref.m_nCCPrio; |
54 | 58 | } |
55 | 59 | |
56 | 60 | |
diff --git a/libs/libmythfreemheg/Ingredients.h b/libs/libmythfreemheg/Ingredients.h
index 76630c2..fefd833 100644
a
|
b
|
protected: |
120 | 120 | class MHSetData: public MHElemAction |
121 | 121 | { |
122 | 122 | public: |
123 | | MHSetData(): MHElemAction(":SetData") {} |
| 123 | MHSetData(): MHElemAction(":SetData"), m_fIsIncluded(false) |
| 124 | ,m_fSizePresent(false), m_fCCPriorityPresent(false) {} |
124 | 125 | virtual void Initialise(MHParseNode *p, MHEngine *engine); |
125 | 126 | virtual void Perform(MHEngine *engine); |
126 | 127 | virtual void PrintArgs(FILE *fd, int nTabs) const; |
diff --git a/libs/libmythfreemheg/Link.cpp b/libs/libmythfreemheg/Link.cpp
index 30d0878..f889af7 100644
a
|
b
|
|
32 | 32 | MHLink::MHLink() |
33 | 33 | { |
34 | 34 | m_EventData.m_Type = MHUnion::U_None; |
| 35 | m_nEventType = EventIsAvailable; |
35 | 36 | } |
36 | 37 | |
37 | 38 | void MHLink::Initialise(MHParseNode *p, MHEngine *engine) |
diff --git a/libs/libmythfreemheg/Stream.cpp b/libs/libmythfreemheg/Stream.cpp
index 9dda175..a25bee7 100644
a
|
b
|
MHRoot *MHStream::FindByObjectNo(int n) |
145 | 145 | |
146 | 146 | MHAudio::MHAudio() |
147 | 147 | { |
| 148 | m_nComponentTag = 0; |
148 | 149 | m_nOriginalVol = 0; |
149 | 150 | m_fStreamPlaying = false; |
150 | 151 | } |
… |
… |
void MHAudio::StopPlaying(MHEngine *engine) |
223 | 224 | |
224 | 225 | MHVideo::MHVideo() |
225 | 226 | { |
| 227 | m_nComponentTag = 0; |
226 | 228 | m_Termination = VI_Disappear; |
227 | 229 | m_nXDecodeOffset = 0; |
228 | 230 | m_nYDecodeOffset = 0; |
diff --git a/libs/libmythfreemheg/Text.cpp b/libs/libmythfreemheg/Text.cpp
index 4b48b4b..84a09d5 100644
a
|
b
|
MHText::MHText() |
38 | 38 | m_StartCorner = UpperLeft; |
39 | 39 | m_fTextWrap = false; |
40 | 40 | m_pDisplay = NULL; |
| 41 | m_fNeedsRedraw = false; |
41 | 42 | } |
42 | 43 | |
43 | 44 | MHText::MHText(const MHText &ref): MHVisible(ref) // Copy constructor for cloning. |
… |
… |
MHText::MHText(const MHText &ref): MHVisible(ref) // Copy constructor for clonin |
53 | 54 | m_StartCorner = ref.m_StartCorner; |
54 | 55 | m_fTextWrap = ref.m_fTextWrap; |
55 | 56 | m_pDisplay = NULL; |
| 57 | m_fNeedsRedraw = ref.m_fNeedsRedraw; |
56 | 58 | } |
57 | 59 | |
58 | 60 | MHText::~MHText() |
… |
… |
void MHText::Initialise(MHParseNode *p, MHEngine *engine) |
93 | 95 | if (pTextWrap) m_fTextWrap = pTextWrap->GetArgN(0)->GetBoolValue(); |
94 | 96 | |
95 | 97 | m_pDisplay = engine->GetContext()->CreateText(); |
96 | | m_NeedsRedraw = true; |
| 98 | m_fNeedsRedraw = true; |
97 | 99 | } |
98 | 100 | |
99 | 101 | static const char *rchJustification[] = |
… |
… |
void MHText::Preparation(MHEngine *engine) |
175 | 177 | MHVisible::Preparation(engine); |
176 | 178 | |
177 | 179 | m_pDisplay->SetSize(m_nBoxWidth, m_nBoxHeight); |
178 | | m_NeedsRedraw = true; |
| 180 | m_fNeedsRedraw = true; |
179 | 181 | } |
180 | 182 | |
181 | 183 | // Content preparation. If it's included we can set up the content. |
… |
… |
void MHText::ContentArrived(const unsigned char *data, int length, MHEngine *eng |
193 | 195 | CreateContent(data, length, engine); |
194 | 196 | // Now signal that the content is available. |
195 | 197 | engine->EventTriggered(this, EventContentAvailable); |
196 | | m_NeedsRedraw = true; |
| 198 | m_fNeedsRedraw = true; |
197 | 199 | } |
198 | 200 | |
199 | 201 | // |
… |
… |
void MHText::CreateContent(const unsigned char *p, int s, MHEngine *engine) |
201 | 203 | { |
202 | 204 | m_Content.Copy(MHOctetString((const char *)p, s)); |
203 | 205 | engine->Redraw(GetVisibleArea()); // Have to redraw if the content has changed. |
204 | | m_NeedsRedraw = true; |
| 206 | m_fNeedsRedraw = true; |
205 | 207 | // fprintf(fd, "Text content is now "); m_Content.PrintMe(0); fprintf(fd, "\n"); |
206 | 208 | } |
207 | 209 | |
208 | 210 | void MHText::SetTextColour(const MHColour &colour, MHEngine *engine) |
209 | 211 | { |
210 | 212 | m_textColour.Copy(colour); |
211 | | m_NeedsRedraw = true; |
| 213 | m_fNeedsRedraw = true; |
212 | 214 | engine->Redraw(GetVisibleArea()); |
213 | 215 | } |
214 | 216 | |
… |
… |
void MHText::SetBackgroundColour(const MHColour &colour, MHEngine *engine) |
223 | 225 | void MHText::SetFontAttributes(const MHOctetString &fontAttrs, MHEngine *engine) |
224 | 226 | { |
225 | 227 | m_fontAttrs.Copy(fontAttrs); |
226 | | m_NeedsRedraw = true; |
| 228 | m_fNeedsRedraw = true; |
227 | 229 | engine->Redraw(GetVisibleArea()); |
228 | 230 | } |
229 | 231 | |
… |
… |
void MHText::Display(MHEngine *engine) |
516 | 518 | { |
517 | 519 | if (! m_fRunning || ! m_pDisplay || m_nBoxWidth == 0 || m_nBoxHeight == 0) return; // Can't draw zero sized boxes. |
518 | 520 | // We only need to recreate the display if something has changed. |
519 | | if ( m_NeedsRedraw) |
| 521 | if ( m_fNeedsRedraw) |
520 | 522 | { |
521 | 523 | Redraw(); |
522 | | m_NeedsRedraw = false; |
| 524 | m_fNeedsRedraw = false; |
523 | 525 | } |
524 | 526 | // Draw the background first, then the text. |
525 | 527 | engine->GetContext()->DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight, GetColour(m_bgColour)); |
diff --git a/libs/libmythfreemheg/Text.h b/libs/libmythfreemheg/Text.h
index caaa820..b1c353c 100644
a
|
b
|
protected: |
84 | 84 | MHOctetString m_Content; // The content as an octet string |
85 | 85 | |
86 | 86 | MHTextDisplay *m_pDisplay; // Pointer to the display object. |
87 | | bool m_NeedsRedraw; |
| 87 | bool m_fNeedsRedraw; |
88 | 88 | |
89 | 89 | // Create the Unicode content from the character input. |
90 | 90 | void CreateContent(const unsigned char *p, int s, MHEngine *engine); |
diff --git a/libs/libmythfreemheg/Variables.h b/libs/libmythfreemheg/Variables.h
index d6bf71c..3071cd2 100644
a
|
b
|
public: |
41 | 41 | class MHBooleanVar : public MHVariable |
42 | 42 | { |
43 | 43 | public: |
44 | | MHBooleanVar() {} |
| 44 | MHBooleanVar(): m_fOriginalValue(false), m_fValue(false) {} |
45 | 45 | virtual const char *ClassName() { return "BooleanVariable"; } |
46 | 46 | virtual void Initialise(MHParseNode *p, MHEngine *engine); |
47 | 47 | virtual void PrintMe(FILE *fd, int nTabs) const; |
… |
… |
protected: |
62 | 62 | class MHIntegerVar : public MHVariable |
63 | 63 | { |
64 | 64 | public: |
65 | | MHIntegerVar() {} |
| 65 | MHIntegerVar(): m_nOriginalValue(0), m_nValue(0) {} |
66 | 66 | virtual const char *ClassName() { return "IntegerVariable"; } |
67 | 67 | virtual void Initialise(MHParseNode *p, MHEngine *engine); |
68 | 68 | virtual void PrintMe(FILE *fd, int nTabs) const; |
… |
… |
protected: |
156 | 156 | class MHTestVariable: public MHElemAction |
157 | 157 | { |
158 | 158 | public: |
159 | | MHTestVariable(): MHElemAction(":TestVariable") {} |
| 159 | MHTestVariable(): MHElemAction(":TestVariable"), m_nOperator(0) {} |
160 | 160 | virtual void Initialise(MHParseNode *p, MHEngine *engine); |
161 | 161 | virtual void Perform(MHEngine *engine); |
162 | 162 | protected: |
diff --git a/libs/libmythfreemheg/Visible.cpp b/libs/libmythfreemheg/Visible.cpp
index ab8031e..bcae2e2 100644
a
|
b
|
MHVisible::MHVisible() |
35 | 35 | { |
36 | 36 | m_nOriginalBoxWidth = m_nOriginalBoxHeight = -1; // Should always be specified. |
37 | 37 | m_nOriginalPosX = m_nOriginalPosY = 0; // Default values. |
| 38 | m_nBoxWidth = m_nBoxHeight = 0; |
| 39 | m_nPosX = m_nPosY = 0; |
38 | 40 | } |
39 | 41 | |
40 | 42 | // Copy constructor for cloning |
… |
… |
MHVisible::MHVisible(const MHVisible &ref): MHPresentable(ref) |
44 | 46 | m_nOriginalBoxHeight = ref.m_nOriginalBoxHeight; |
45 | 47 | m_nOriginalPosX = ref.m_nOriginalPosX; |
46 | 48 | m_nOriginalPosY = ref.m_nOriginalPosY; |
| 49 | m_nBoxWidth = ref.m_nBoxWidth; |
| 50 | m_nBoxHeight = ref.m_nBoxHeight; |
| 51 | m_nPosX = ref.m_nPosX; |
| 52 | m_nPosY = ref.m_nPosY; |
47 | 53 | m_OriginalPaletteRef.Copy(ref.m_OriginalPaletteRef); |
48 | 54 | } |
49 | 55 | |
… |
… |
MHLineArt::MHLineArt() |
205 | 211 | m_fBorderedBBox = true; |
206 | 212 | m_nOriginalLineWidth = 1; |
207 | 213 | m_OriginalLineStyle = LineStyleSolid; |
| 214 | m_nLineWidth = 0; |
| 215 | m_LineStyle = 0; |
208 | 216 | // Colour defaults to empty. |
209 | 217 | } |
210 | 218 | |
… |
… |
MHLineArt::MHLineArt(const MHLineArt &ref): MHVisible(ref) |
216 | 224 | m_OriginalLineStyle = ref.m_OriginalLineStyle; |
217 | 225 | m_OrigLineColour = ref.m_OrigLineColour; |
218 | 226 | m_OrigFillColour = ref.m_OrigFillColour; |
| 227 | m_nLineWidth = ref.m_nLineWidth; |
| 228 | m_LineStyle = ref.m_LineStyle; |
219 | 229 | } |
220 | 230 | |
221 | 231 | void MHLineArt::Initialise(MHParseNode *p, MHEngine *engine) |