Coverity fixes

151677
151789  - OK as is
152005
152508
154871  - false positive
156593
163235
This commit is contained in:
WandererFan
2017-06-25 19:22:53 -04:00
committed by Yorik van Havre
parent 033242ead8
commit cbf42ad3b0
5 changed files with 8 additions and 2 deletions

View File

@@ -173,7 +173,8 @@ App::DocumentObjectExecReturn * DrawSVGTemplate::execute(void)
//double t0, t1,t2,t3;
float t0, t1,t2,t3;
if(line.find("<!-- Title block") != std::string::npos) {
sscanf(line.c_str(), "%*s %*s %*s %f %f %f %f", &t0, &t1, &t2, &t3); //eg " <!-- Working space 10 10 410 287 -->"
(void) sscanf(line.c_str(), "%*s %*s %*s %f %f %f %f", &t0, &t1, &t2, &t3); //eg " <!-- Working space 10 10 410 287 -->"
//coverity 151677
blockDimensions = QRectF(t0, t1, t2 - t0, t3 - t1);
}

View File

@@ -383,6 +383,7 @@ void CmdTechDrawNewDiameterDimension::activated(int iMsg)
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
std::string diamSym = hGrp->GetASCII("DiameterSymbol","\xe2\x8c\x80");
diamSym = diamSym.substr (0,79); //coverity 156593
const char * format = "%value%";
char formatSpec[80];
std::strcpy (formatSpec,diamSym.c_str());

View File

@@ -41,6 +41,7 @@ using namespace TechDrawGui;
QGIHighlight::QGIHighlight()
{
m_refText = "";
m_refSize = 0.0;
m_circle = new QGraphicsEllipseItem();
addToGroup(m_circle);

View File

@@ -41,6 +41,9 @@ using namespace TechDrawGui;
QGISectionLine::QGISectionLine()
{
m_symbol = "";
m_symSize = 0.0;
m_extLen = Rez::guiX(8.0);
m_arrowSize = 0.0;

View File

@@ -279,7 +279,7 @@ void TaskProjGroup::nearestFraction(double val, int &n, int &d) const
n = 1; // numerator
d = 1; // denominator
double fraction = n / d;
double fraction = 1.0; //coverity 152005
//double m = fabs(fraction - val);
while (fabs(fraction - val) > 0.001) {