+ fix many minor warnings, activate -Wall for gcc

This commit is contained in:
wwmayer 2015-08-02 22:32:18 +02:00
parent 92a65a8b5b
commit e7441149f0
20 changed files with 33 additions and 34 deletions

View File

@ -52,7 +52,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(cMake/ConfigureChecks.cmake) include(cMake/ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-write-strings") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated -Wno-write-strings")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# get linker errors as soon as possible and not at runtime e.g. for modules # get linker errors as soon as possible and not at runtime e.g. for modules
if(UNIX) if(UNIX)

View File

@ -338,7 +338,7 @@ QString Unit::getString(void) const
Sig.ThermodynamicTemperature<0?1:2 + Sig.ThermodynamicTemperature<0?1:2 +
Sig.AmountOfSubstance<0?1:2 + Sig.AmountOfSubstance<0?1:2 +
Sig.LuminoseIntensity<0?1:2 + Sig.LuminoseIntensity<0?1:2 +
Sig.Angle<0?1:2 ; Sig.Angle<0?1:2 +
Sig.Density<0?1:2 ; Sig.Density<0?1:2 ;
if (nnom > 1) ret << '('; if (nnom > 1) ret << '(';
bool mult=false; bool mult=false;

View File

@ -494,7 +494,6 @@ StdCmdRevert::StdCmdRevert()
void StdCmdRevert::activated(int iMsg) void StdCmdRevert::activated(int iMsg)
{ {
App::Document* doc = App::GetApplication().getActiveDocument();
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(qApp->translate("Std_Revert","This will discard all the changes since last file save.")); msgBox.setText(qApp->translate("Std_Revert","This will discard all the changes since last file save."));
msgBox.setInformativeText(qApp->translate("Std_Revert","Are you sure?")); msgBox.setInformativeText(qApp->translate("Std_Revert","Are you sure?"));
@ -1009,7 +1008,6 @@ void StdCmdDelete::activated(int iMsg)
if (vpedit) { if (vpedit) {
// check if the edited view provider is selected // check if the edited view provider is selected
for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) { for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
App::DocumentObject* obj = ft->getObject();
Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject()); Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject());
if (vp == vpedit) { if (vp == vpedit) {
if (!ft->getSubNames().empty()) { if (!ft->getSubNames().empty()) {
@ -1031,7 +1029,6 @@ void StdCmdDelete::activated(int iMsg)
// check if we can delete the object // check if we can delete the object
for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) { for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
App::DocumentObject* obj = ft->getObject(); App::DocumentObject* obj = ft->getObject();
Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject());
std::vector<App::DocumentObject*> links = obj->getInList(); std::vector<App::DocumentObject*> links = obj->getInList();
if (!links.empty()) { if (!links.empty()) {
// check if the referenced objects are groups or are selected too // check if the referenced objects are groups or are selected too

View File

@ -496,7 +496,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop
SoGroup* childGroup = viewProvider->getChildRoot(); SoGroup* childGroup = viewProvider->getChildRoot();
// size not the same -> build up the list new // size not the same -> build up the list new
if(childGroup->getNumChildren() != children.size()){ if(childGroup->getNumChildren() != static_cast<int>(children.size())){
childGroup->removeAllChildren(); childGroup->removeAllChildren();

View File

@ -294,6 +294,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
} }
} }
break; break;
default:
break;
} }
} }
if (processed) if (processed)
@ -343,6 +345,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
} }
processed = TRUE; processed = TRUE;
break; break;
default:
break;
}//switch key }//switch key
} }
if (processed) if (processed)
@ -474,8 +478,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
if (evIsButton) { if (evIsButton) {
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev; const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
const int button = event->getButton(); const int button = event->getButton();
const SbBool press //the button was pressed (if false -> released) //const SbBool press //the button was pressed (if false -> released)
= event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE; // = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
switch(button){ switch(button){
case SoMouseButtonEvent::BUTTON1: case SoMouseButtonEvent::BUTTON1:
case SoMouseButtonEvent::BUTTON2: case SoMouseButtonEvent::BUTTON2:
@ -495,7 +499,7 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
//the essence part 1! //the essence part 1!
//mouse movement into camera motion. Suppress if in gesture. Ignore until threshold is surpassed. //mouse movement into camera motion. Suppress if in gesture. Ignore until threshold is surpassed.
if (evIsLoc2 && ! this->inGesture && this->mouseMoveThresholdBroken) { if (evIsLoc2 && ! this->inGesture && this->mouseMoveThresholdBroken) {
const SoLocation2Event * const event = (const SoLocation2Event *) ev; //const SoLocation2Event * const event = (const SoLocation2Event *) ev;
if (curmode == NavigationStyle::ZOOMING) {//doesn't happen if (curmode == NavigationStyle::ZOOMING) {//doesn't happen
this->zoomByCursor(posn, prevnormalized); this->zoomByCursor(posn, prevnormalized);
processed = TRUE; processed = TRUE;

View File

@ -66,6 +66,8 @@ FocusHandler::eventFilter(QObject * obj, QEvent * event)
case QEvent::FocusOut: case QEvent::FocusOut:
this->focusEvent("sim.coin3d.coin.InputFocus.OUT"); this->focusEvent("sim.coin3d.coin.InputFocus.OUT");
break; break;
default:
break;
} }
return QObject::eventFilter(obj, event); return QObject::eventFilter(obj, event);
} }

View File

@ -54,9 +54,9 @@ ImageReader::readImage(const SbString & filename, SbImage & sbimage) const
{ {
QImage image; QImage image;
if (image.load(filename.getString())) { if (image.load(filename.getString())) {
int c; //int c;
int w = image.width(); //int w = image.width();
int h = image.height(); //int h = image.height();
// Keep in 8-bits mode if that was what we read // Keep in 8-bits mode if that was what we read
if (image.depth() != 8 || !image.isGrayscale()) { if (image.depth() != 8 || !image.isGrayscale()) {

View File

@ -76,13 +76,13 @@ QuarterWidgetP::QuarterWidgetP(QuarterWidget * masterptr, const QGLWidget * shar
initialsoeventmanager(false), initialsoeventmanager(false),
headlight(NULL), headlight(NULL),
cachecontext(NULL), cachecontext(NULL),
contextmenu(NULL),
contextmenuenabled(true), contextmenuenabled(true),
autoredrawenabled(true), autoredrawenabled(true),
interactionmodeenabled(false), interactionmodeenabled(false),
clearzbuffer(true), clearzbuffer(true),
clearwindow(true), clearwindow(true),
addactions(true) addactions(true),
contextmenu(NULL)
{ {
this->cachecontext = findCacheContext(masterptr, sharewidget); this->cachecontext = findCacheContext(masterptr, sharewidget);

View File

@ -164,7 +164,7 @@ void TaskGroup::actionEvent (QActionEvent* e)
switch (e->type()) { switch (e->type()) {
case QEvent::ActionAdded: case QEvent::ActionAdded:
{ {
QSint::ActionLabel *label = this->createItem(action); this->createItem(action);
break; break;
} }
case QEvent::ActionChanged: case QEvent::ActionChanged:

View File

@ -1297,9 +1297,6 @@ void View3DInventorViewer::setRenderType(const RenderType type)
break; break;
case Image: case Image:
{ {
const SbViewportRegion vp = this->getSoRenderManager()->getViewportRegion();
SbVec2s size = vp.getViewportSizePixels();
QGLWidget* gl = static_cast<QGLWidget*>(this->viewport()); QGLWidget* gl = static_cast<QGLWidget*>(this->viewport());
gl->makeCurrent(); gl->makeCurrent();
int w = gl->width(); int w = gl->width();

View File

@ -1709,7 +1709,7 @@ QVariant PropertyEnumItem::value(const App::Property* prop) const
const std::vector<std::string>& value = prop_enum->getEnumVector(); const std::vector<std::string>& value = prop_enum->getEnumVector();
long currentItem = prop_enum->getValue(); long currentItem = prop_enum->getValue();
if (currentItem < 0 || currentItem >= value.size()) if (currentItem < 0 || currentItem >= static_cast<long>(value.size()))
return QVariant(QString()); return QVariant(QString());
return QVariant(QString::fromUtf8(value[currentItem].c_str())); return QVariant(QString::fromUtf8(value[currentItem].c_str()));
} }

View File

@ -396,7 +396,7 @@ bool MeshProjection::projectLineOnMesh(const MeshFacetGrid& grid,
// cut all facets with plane // cut all facets with plane
std::list< std::pair<Base::Vector3f, Base::Vector3f> > cutLine; std::list< std::pair<Base::Vector3f, Base::Vector3f> > cutLine;
unsigned long start = 0, end = 0; //unsigned long start = 0, end = 0;
for (std::vector<unsigned long>::iterator it = facets.begin(); it != facets.end(); ++it) { for (std::vector<unsigned long>::iterator it = facets.begin(); it != facets.end(); ++it) {
Base::Vector3f e1, e2; Base::Vector3f e1, e2;
MeshGeomFacet tria = kernel.GetFacet(*it); MeshGeomFacet tria = kernel.GetFacet(*it);
@ -418,7 +418,7 @@ bool MeshProjection::projectLineOnMesh(const MeshFacetGrid& grid,
else else
cutLine.push_back(std::pair<Base::Vector3f, Base::Vector3f>(v1, e1)); cutLine.push_back(std::pair<Base::Vector3f, Base::Vector3f>(v1, e1));
start = it - facets.begin(); //start = it - facets.begin();
} }
if (*it == f2) { // end facet if (*it == f2) { // end facet
@ -427,7 +427,7 @@ bool MeshProjection::projectLineOnMesh(const MeshFacetGrid& grid,
else else
cutLine.push_back(std::pair<Base::Vector3f, Base::Vector3f>(v2, e1)); cutLine.push_back(std::pair<Base::Vector3f, Base::Vector3f>(v2, e1));
end = it - facets.begin(); //end = it - facets.begin();
} }
} }
} }

View File

@ -568,10 +568,10 @@ bool ViewProviderMesh::exportToVrml(const char* filename, const MeshCore::Materi
SoMaterialBinding* binding = new SoMaterialBinding; SoMaterialBinding* binding = new SoMaterialBinding;
SoMaterial* material = new SoMaterial; SoMaterial* material = new SoMaterial;
if (mat.diffuseColor.size() == coords->point.getNum()) { if (static_cast<int>(mat.diffuseColor.size()) == coords->point.getNum()) {
binding->value = SoMaterialBinding::PER_VERTEX_INDEXED; binding->value = SoMaterialBinding::PER_VERTEX_INDEXED;
} }
else if (mat.diffuseColor.size() == faces->coordIndex.getNum()/4) { else if (static_cast<int>(mat.diffuseColor.size()) == faces->coordIndex.getNum()/4) {
binding->value = SoMaterialBinding::PER_FACE_INDEXED; binding->value = SoMaterialBinding::PER_FACE_INDEXED;
} }

View File

@ -826,7 +826,7 @@ App::DocumentObjectExecReturn *Helix::execute(void)
Standard_Real myRadius = Radius.getValue(); Standard_Real myRadius = Radius.getValue();
Standard_Real myAngle = Angle.getValue(); Standard_Real myAngle = Angle.getValue();
Standard_Boolean myLocalCS = LocalCoord.getValue() ? Standard_True : Standard_False; Standard_Boolean myLocalCS = LocalCoord.getValue() ? Standard_True : Standard_False;
Standard_Boolean myStyle = Style.getValue() ? Standard_True : Standard_False; //Standard_Boolean myStyle = Style.getValue() ? Standard_True : Standard_False;
TopoShape helix; TopoShape helix;
// work around for OCC bug #23314 (FC #0954) // work around for OCC bug #23314 (FC #0954)
// the exact conditions for failure are unknown. building the helix 1 turn at a time // the exact conditions for failure are unknown. building the helix 1 turn at a time

View File

@ -866,6 +866,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
break; break;
} }
v4 = viptr < viendptr ? *viptr++ : -1; v4 = viptr < viendptr ? *viptr++ : -1;
(void)v4;
/* vertex 1 *********************************************************/ /* vertex 1 *********************************************************/
if (mbind == PER_PART) { if (mbind == PER_PART) {

View File

@ -106,7 +106,7 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
colBool.resize(boolMap.Extent(), this->ShapeColor.getValue()); colBool.resize(boolMap.Extent(), this->ShapeColor.getValue());
bool setColor=false; bool setColor=false;
if (colBase.size() == baseMap.Extent()) { if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[0], colBase, colBool); applyColor(hist[0], colBase, colBool);
setColor = true; setColor = true;
} }
@ -115,7 +115,7 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
applyColor(hist[0], colBase, colBool); applyColor(hist[0], colBase, colBool);
setColor = true; setColor = true;
} }
if (colTool.size() == toolMap.Extent()) { if (static_cast<int>(colTool.size()) == toolMap.Extent()) {
applyColor(hist[1], colTool, colBool); applyColor(hist[1], colTool, colBool);
setColor = true; setColor = true;
} }
@ -199,7 +199,7 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase); Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase);
std::vector<App::Color> colBase = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues(); std::vector<App::Color> colBase = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues();
if (colBase.size() == baseMap.Extent()) { if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[index], colBase, colBool); applyColor(hist[index], colBase, colBool);
setColor = true; setColor = true;
} }
@ -316,7 +316,7 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase); Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase);
std::vector<App::Color> colBase = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues(); std::vector<App::Color> colBase = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues();
if (colBase.size() == baseMap.Extent()) { if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[index], colBase, colBool); applyColor(hist[index], colBase, colBool);
setColor = true; setColor = true;
} }

View File

@ -92,7 +92,7 @@ void ViewProviderCompound::updateData(const App::Property* prop)
Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase); Gui::ViewProvider* vpBase = Gui::Application::Instance->getViewProvider(objBase);
std::vector<App::Color> baseCol = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues(); std::vector<App::Color> baseCol = static_cast<PartGui::ViewProviderPart*>(vpBase)->DiffuseColor.getValues();
if (baseCol.size() == baseMap.Extent()) { if (static_cast<int>(baseCol.size()) == baseMap.Extent()) {
applyColor(hist[index], baseCol, compCol); applyColor(hist[index], baseCol, compCol);
setColor = true; setColor = true;
} }

View File

@ -762,7 +762,6 @@ void ViewProviderPartExt::updateVisual(const TopoDS_Shape& inputShape)
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 *
Deviation.getValue(); Deviation.getValue();
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
// create or use the mesh on the data structure // create or use the mesh on the data structure
#if OCC_VERSION_HEX >= 0x060600 #if OCC_VERSION_HEX >= 0x060600

View File

@ -253,7 +253,7 @@ void ViewProviderFillet::updateData(const App::Property* prop)
colFill.resize(fillMap.Extent(), static_cast<PartGui::ViewProviderPart*>(vpBase)->ShapeColor.getValue()); colFill.resize(fillMap.Extent(), static_cast<PartGui::ViewProviderPart*>(vpBase)->ShapeColor.getValue());
bool setColor=false; bool setColor=false;
if (colBase.size() == baseMap.Extent()) { if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[0], colBase, colFill); applyColor(hist[0], colBase, colFill);
setColor = true; setColor = true;
} }
@ -356,7 +356,7 @@ void ViewProviderChamfer::updateData(const App::Property* prop)
colCham.resize(chamMap.Extent(), static_cast<PartGui::ViewProviderPart*>(vpBase)->ShapeColor.getValue()); colCham.resize(chamMap.Extent(), static_cast<PartGui::ViewProviderPart*>(vpBase)->ShapeColor.getValue());
bool setColor=false; bool setColor=false;
if (colBase.size() == baseMap.Extent()) { if (static_cast<int>(colBase.size()) == baseMap.Extent()) {
applyColor(hist[0], colBase, colCham); applyColor(hist[0], colBase, colCham);
setColor = true; setColor = true;
} }

View File

@ -250,7 +250,6 @@ void ViewProviderTransformed::recomputeFeature(void)
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
} }
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Deviation.getValue(); Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Deviation.getValue();
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
// create or use the mesh on the data structure // create or use the mesh on the data structure
#if OCC_VERSION_HEX >= 0x060600 #if OCC_VERSION_HEX >= 0x060600