Kaydet (Commit) aea6aab9 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1130200 Unchecked dynamic_cast

Change-Id: I9a6cfc27b1076fa682c591d920a7db8ec6f8a6ff
üst ba33cb1d
...@@ -49,7 +49,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -49,7 +49,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur0->GetType() == formula::svSingleVectorRef) if(tmpCur0->GetType() == formula::svSingleVectorRef)
{ {
const formula::SingleVectorRefToken*tmpCurSVR0 = const formula::SingleVectorRefToken*tmpCurSVR0 =
dynamic_cast<const formula::SingleVectorRefToken *>(tmpCur0); static_cast<const formula::SingleVectorRefToken *>(tmpCur0);
#ifdef ISNAN #ifdef ISNAN
ss << " if (gid0 < " << tmpCurSVR0->GetArrayLength() << ")\n"; ss << " if (gid0 < " << tmpCurSVR0->GetArrayLength() << ")\n";
ss << " {\n"; ss << " {\n";
...@@ -85,7 +85,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -85,7 +85,7 @@ void OpBesselj::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur1->GetType() == formula::svSingleVectorRef) if(tmpCur1->GetType() == formula::svSingleVectorRef)
{ {
const formula::SingleVectorRefToken*tmpCurSVR1 = const formula::SingleVectorRefToken*tmpCurSVR1 =
dynamic_cast<const formula::SingleVectorRefToken *>(tmpCur1); static_cast<const formula::SingleVectorRefToken *>(tmpCur1);
#ifdef ISNAN #ifdef ISNAN
ss << " if (gid0 < " << tmpCurSVR1->GetArrayLength() << ")\n"; ss << " if (gid0 < " << tmpCurSVR1->GetArrayLength() << ")\n";
ss << " {\n"; ss << " {\n";
......
...@@ -41,7 +41,7 @@ void OpSumX2MY2::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -41,7 +41,7 @@ void OpSumX2MY2::GenSlidingWindowFunction(std::stringstream &ss,
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur); formula::DoubleVectorRefToken *>(tmpCur);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
...@@ -98,7 +98,7 @@ void OpSumX2PY2::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -98,7 +98,7 @@ void OpSumX2PY2::GenSlidingWindowFunction(std::stringstream &ss,
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur); formula::DoubleVectorRefToken *>(tmpCur);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
...@@ -154,7 +154,7 @@ void OpSumXMY2::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -154,7 +154,7 @@ void OpSumXMY2::GenSlidingWindowFunction(std::stringstream &ss,
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur); formula::DoubleVectorRefToken *>(tmpCur);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
......
...@@ -43,7 +43,7 @@ void OpAnd::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -43,7 +43,7 @@ void OpAnd::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur0->GetType() == formula::svSingleVectorRef) if(tmpCur0->GetType() == formula::svSingleVectorRef)
{ {
#ifdef ISNAN #ifdef ISNAN
const formula::SingleVectorRefToken*pCurDVR= dynamic_cast<const const formula::SingleVectorRefToken*pCurDVR= static_cast<const
formula::SingleVectorRefToken *>(tmpCur0); formula::SingleVectorRefToken *>(tmpCur0);
ss<< " int buffer_len"<<j<<" = "<<pCurDVR->GetArrayLength(); ss<< " int buffer_len"<<j<<" = "<<pCurDVR->GetArrayLength();
ss<< ";\n"; ss<< ";\n";
...@@ -64,7 +64,7 @@ void OpAnd::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -64,7 +64,7 @@ void OpAnd::GenSlidingWindowFunction(std::stringstream &ss,
} }
else if(tmpCur0->GetType() == formula::svDoubleVectorRef) else if(tmpCur0->GetType() == formula::svDoubleVectorRef)
{ {
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur0); formula::DoubleVectorRefToken *>(tmpCur0);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
...@@ -127,7 +127,7 @@ void OpOr::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -127,7 +127,7 @@ void OpOr::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur0->GetType() == formula::svSingleVectorRef) if(tmpCur0->GetType() == formula::svSingleVectorRef)
{ {
#ifdef ISNAN #ifdef ISNAN
const formula::SingleVectorRefToken*pCurDVR= dynamic_cast<const const formula::SingleVectorRefToken*pCurDVR= static_cast<const
formula::SingleVectorRefToken *>(tmpCur0); formula::SingleVectorRefToken *>(tmpCur0);
ss<< " int buffer_len"<<j<<" = "<<pCurDVR->GetArrayLength(); ss<< " int buffer_len"<<j<<" = "<<pCurDVR->GetArrayLength();
ss<< ";\n"; ss<< ";\n";
...@@ -148,7 +148,7 @@ void OpOr::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -148,7 +148,7 @@ void OpOr::GenSlidingWindowFunction(std::stringstream &ss,
} }
else if(tmpCur0->GetType() == formula::svDoubleVectorRef) else if(tmpCur0->GetType() == formula::svDoubleVectorRef)
{ {
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur0); formula::DoubleVectorRefToken *>(tmpCur0);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
...@@ -207,7 +207,7 @@ void OpNot::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -207,7 +207,7 @@ void OpNot::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur0->GetType() == formula::svSingleVectorRef) if(tmpCur0->GetType() == formula::svSingleVectorRef)
{ {
#ifdef ISNAN #ifdef ISNAN
const formula::SingleVectorRefToken*pCurDVR= dynamic_cast<const const formula::SingleVectorRefToken*pCurDVR= static_cast<const
formula::SingleVectorRefToken *>(tmpCur0); formula::SingleVectorRefToken *>(tmpCur0);
ss <<" if(gid0 >= "<<pCurDVR->GetArrayLength()<<" || isNan("; ss <<" if(gid0 >= "<<pCurDVR->GetArrayLength()<<" || isNan(";
ss <<vSubArguments[0]->GenSlidingWindowDeclRef(); ss <<vSubArguments[0]->GenSlidingWindowDeclRef();
...@@ -249,7 +249,7 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -249,7 +249,7 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss,
if(tmpCur0->GetType() == formula::svSingleVectorRef) if(tmpCur0->GetType() == formula::svSingleVectorRef)
{ {
#ifdef ISNAN #ifdef ISNAN
const formula::SingleVectorRefToken*pCurDVR= dynamic_cast<const const formula::SingleVectorRefToken*pCurDVR= static_cast<const
formula::SingleVectorRefToken *>(tmpCur0); formula::SingleVectorRefToken *>(tmpCur0);
ss <<" if(gid0 >= "<<pCurDVR->GetArrayLength()<<" || isNan("; ss <<" if(gid0 >= "<<pCurDVR->GetArrayLength()<<" || isNan(";
ss <<vSubArguments[j]->GenSlidingWindowDeclRef(); ss <<vSubArguments[j]->GenSlidingWindowDeclRef();
...@@ -270,7 +270,7 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -270,7 +270,7 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss,
} }
else if(tmpCur0->GetType() == formula::svDoubleVectorRef) else if(tmpCur0->GetType() == formula::svDoubleVectorRef)
{ {
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur0); formula::DoubleVectorRefToken *>(tmpCur0);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
......
...@@ -47,7 +47,7 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -47,7 +47,7 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream &ss,
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
FormulaToken *tmpCur = vSubArguments[1]->GetFormulaToken(); FormulaToken *tmpCur = vSubArguments[1]->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur); formula::DoubleVectorRefToken *>(tmpCur);
secondParaWidth = pCurDVR->GetArrays().size(); secondParaWidth = pCurDVR->GetArrays().size();
} }
...@@ -68,7 +68,7 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream &ss, ...@@ -68,7 +68,7 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream &ss,
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
FormulaToken *tmpCur = vSubArguments[1]->GetFormulaToken(); FormulaToken *tmpCur = vSubArguments[1]->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= dynamic_cast<const const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur); formula::DoubleVectorRefToken *>(tmpCur);
size_t nCurWindowSize = pCurDVR->GetArrayLength() < size_t nCurWindowSize = pCurDVR->GetArrayLength() <
pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength():
......
...@@ -136,7 +136,7 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss, ...@@ -136,7 +136,7 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss,
if(vSubArguments[i]->GetFormulaToken()->GetType() == if(vSubArguments[i]->GetFormulaToken()->GetType() ==
formula::svSingleVectorRef) formula::svSingleVectorRef)
{ {
const formula::SingleVectorRefToken*pTmpDVR1= dynamic_cast<const const formula::SingleVectorRefToken*pTmpDVR1= static_cast<const
formula::SingleVectorRefToken *>(vSubArguments[i]->GetFormulaToken()); formula::SingleVectorRefToken *>(vSubArguments[i]->GetFormulaToken());
ss<< " if(singleIndex>="; ss<< " if(singleIndex>=";
ss<< pTmpDVR1->GetArrayLength(); ss<< pTmpDVR1->GetArrayLength();
...@@ -145,7 +145,7 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss, ...@@ -145,7 +145,7 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss,
if(vSubArguments[i]->GetFormulaToken()->GetType() == if(vSubArguments[i]->GetFormulaToken()->GetType() ==
formula::svDoubleVectorRef) formula::svDoubleVectorRef)
{ {
const formula::DoubleVectorRefToken*pTmpDVR2= dynamic_cast<const const formula::DoubleVectorRefToken*pTmpDVR2= static_cast<const
formula::DoubleVectorRefToken *>(vSubArguments[i]->GetFormulaToken()); formula::DoubleVectorRefToken *>(vSubArguments[i]->GetFormulaToken());
ss<< " if(doubleIndex>="; ss<< " if(doubleIndex>=";
ss<< pTmpDVR2->GetArrayLength(); ss<< pTmpDVR2->GetArrayLength();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment