Examples of errors detected by the V1051 diagnostic
V1051. It is possible that an assigned variable should be checked in the next condition. Consider checking for typos.
FreeCAD
V1051 [CWE-754] Consider checking for misprints. It's possible that the 'CutLinkList' should be checked here. SectionCutting.cpp 691
void SectionCut::startCutting(bool isInitial)
{
....
App::PropertyLinkList* CutLinkList =
dynamic_cast<App::PropertyLinkList*>(
CutCompoundBF->getPropertyByName("Objects"));
if (!CutCompoundBF) {
Base::Console().Error((std::string("SectionCut error: ")
+ std::string(CompoundName)
+ std::string(" could not be added\n")).c_str());
return;
}
CutLinkList->setValue(ObjectsListLinks);
....
}
Dagor Engine
V1051 Consider checking for misprints. It's possible that the 'lod.numInstancesInCell' should be checked here. DagorEngine/prog/gameLibs/render/editorGrass.cpp:135:1, DagorEngine/prog/gameLibs/render/editorGrass.cpp 133
struct RElem
{
....
int numv; // number of vertices
....
}
GrassLod &lod = layer->lods[lodIdx];
unsigned int numInstancesInCell = (unsigned int)(
baseNumInstances * lod.density / (GRID_SIZE * GRID_SIZE) + 0.5f
);
const ShaderMesh::RElem &elem = lod.mesh->getAllElems()[0];
lod.numInstancesInCell = min(
numInstancesInCell,
(unsigned int)MAX_VERTICES_IN_CELL / elem.numv
);
if (numInstancesInCell == 0)
return;
lod.singleVb = (lod.numInstancesInCell >= INSTANCES_IN_SINGLE_VB);
....