Skip to content

Commit 0de58ec

Browse files
committed
connect engine: correct two uninitalized variable errors
storage/connect/tabxml.cpp:1616:46: warning: ‘*this.XMLCOL::Long’ may be used uninitialized [-Wmaybe-uninitialized] 1616 | Valbuf = (char*)PlugSubAlloc(g, NULL, n * (Long + 1)); In this case we are overriding the class 3 lines earlier. Add some constructs to preserve the value of Long as the old class being replaced with a new subclass. storage/connect/filter.cpp:1594:13: warning: ‘*this.FILTERCMP::FILTERX.FILTERX::FILTER.FILTER::Opc’ is used uninitialized [-Wuninitialized] 1594 | Bt = OpBmp(g, Opc); The construction of FILTERCMP has an Opc(ode) and this should be passed rather than relying on the uninitialized value of the parent class. Also save its value in the class.
1 parent 4f9221a commit 0de58ec

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

storage/connect/filter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
11791179
case OP_GT:
11801180
case OP_GE:
11811181
case OP_LT:
1182-
case OP_LE: new(this) FILTERCMP(g); break;
1182+
case OP_LE: new(this) FILTERCMP(g, Opc); break;
11831183
case OP_AND: new(this) FILTERAND; break;
11841184
case OP_OR: new(this) FILTEROR; break;
11851185
case OP_NOT: new(this) FILTERNOT; break;
@@ -1589,8 +1589,9 @@ void FILTER::Prints(PGLOBAL g, char *ps, uint z)
15891589
/***********************************************************************/
15901590
/* FILTERCMP constructor. */
15911591
/***********************************************************************/
1592-
FILTERCMP::FILTERCMP(PGLOBAL g)
1592+
FILTERCMP::FILTERCMP(PGLOBAL g, OPVAL Opc)
15931593
{
1594+
this->Opc= Opc;
15941595
Bt = OpBmp(g, Opc);
15951596
} // end of FILTERCMP constructor
15961597

storage/connect/filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class FILTERX : public FILTER {
120120
class FILTERCMP : public FILTERX {
121121
public:
122122
// Constructor
123-
FILTERCMP(PGLOBAL g);
123+
FILTERCMP(PGLOBAL, OPVAL);
124124

125125
// Methods
126126
bool Eval(PGLOBAL) override;

storage/connect/tabxml.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode)
16111611
if (Tdbp->Xpand)
16121612
n = Tdbp->Limit;
16131613

1614+
auto oLong = Long;
16141615
new(this) XMULCOL(Value); // Change the class of this column
1616+
Long = oLong;
16151617
} // endif Inod
16161618

16171619
Valbuf = (char*)PlugSubAlloc(g, NULL, n * (Long + 1));

0 commit comments

Comments
 (0)