Fix uninitialized variable warnings.
gcc 6 displays these when compiling in release mode; all of these warnings except the rankOk one were benign because there would have been an error about the incomplete switch statement. The rankOk warning highlighted a real problem: bailing early to didnt_converge would have branched on an uninitialized variable.
This commit is contained in:
parent
802d092b13
commit
ea0a1b743a
|
@ -142,7 +142,7 @@ bool SolveSpaceUI::PruneConstraints(hGroup hg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox) {
|
void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox) {
|
||||||
int first, last, i, j;
|
int first = 0, last = 0, i, j;
|
||||||
|
|
||||||
uint64_t startMillis = GetMilliseconds(),
|
uint64_t startMillis = GetMilliseconds(),
|
||||||
endMillis;
|
endMillis;
|
||||||
|
@ -355,7 +355,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
|
||||||
endMillis = GetMilliseconds();
|
endMillis = GetMilliseconds();
|
||||||
|
|
||||||
if(endMillis - startMillis > 30) {
|
if(endMillis - startMillis > 30) {
|
||||||
const char *typeStr;
|
const char *typeStr = "";
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case Generate::DIRTY: typeStr = "DIRTY"; break;
|
case Generate::DIRTY: typeStr = "DIRTY"; break;
|
||||||
case Generate::ALL: typeStr = "ALL"; break;
|
case Generate::ALL: typeStr = "ALL"; break;
|
||||||
|
|
|
@ -308,7 +308,7 @@ void OpenGl1Renderer::SelectTexture(std::shared_ptr<const Pixmap> pm) {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
|
|
||||||
GLenum format;
|
GLenum format = 0;
|
||||||
switch(pm->format) {
|
switch(pm->format) {
|
||||||
case Pixmap::Format::RGBA: format = GL_RGBA; break;
|
case Pixmap::Format::RGBA: format = GL_RGBA; break;
|
||||||
case Pixmap::Format::RGB: format = GL_RGB; break;
|
case Pixmap::Format::RGB: format = GL_RGB; break;
|
||||||
|
|
|
@ -81,7 +81,7 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
||||||
IdList<Param,hParam> *param)
|
IdList<Param,hParam> *param)
|
||||||
{
|
{
|
||||||
int points = 0;
|
int points = 0;
|
||||||
Entity::Type et;
|
Entity::Type et = (Entity::Type)0;
|
||||||
bool hasNormal = false;
|
bool hasNormal = false;
|
||||||
bool hasDistance = false;
|
bool hasDistance = false;
|
||||||
int i;
|
int i;
|
||||||
|
@ -190,7 +190,7 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Request::DescriptionString() const {
|
std::string Request::DescriptionString() const {
|
||||||
const char *s;
|
const char *s = "";
|
||||||
if(h.v == Request::HREQUEST_REFERENCE_XY.v) {
|
if(h.v == Request::HREQUEST_REFERENCE_XY.v) {
|
||||||
s = "#XY";
|
s = "#XY";
|
||||||
} else if(h.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
} else if(h.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
||||||
|
|
|
@ -264,8 +264,8 @@ std::shared_ptr<Pixmap> Pixmap::ReadPng(const std::string &filename, bool flip)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pixmap::WritePng(FILE *f, bool flip) {
|
bool Pixmap::WritePng(FILE *f, bool flip) {
|
||||||
int colorType;
|
int colorType = 0;
|
||||||
bool bgr;
|
bool bgr = false;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case Format::RGBA: colorType = PNG_COLOR_TYPE_RGBA; bgr = false; break;
|
case Format::RGBA: colorType = PNG_COLOR_TYPE_RGBA; bgr = false; break;
|
||||||
case Format::BGRA: colorType = PNG_COLOR_TYPE_RGBA; bgr = true; break;
|
case Format::BGRA: colorType = PNG_COLOR_TYPE_RGBA; bgr = true; break;
|
||||||
|
|
|
@ -440,6 +440,9 @@ SolveResult System::Solve(Group *g, int *dof, List<hConstraint> *bad,
|
||||||
p->tag = alone;
|
p->tag = alone;
|
||||||
WriteJacobian(alone);
|
WriteJacobian(alone);
|
||||||
if(!NewtonSolve(alone)) {
|
if(!NewtonSolve(alone)) {
|
||||||
|
// We don't do the rank test, so let's arbitrarily return
|
||||||
|
// the DIDNT_CONVERGE result here.
|
||||||
|
rankOk = true;
|
||||||
// Failed to converge, bail out early
|
// Failed to converge, bail out early
|
||||||
goto didnt_converge;
|
goto didnt_converge;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user