From 5f12a043fafe64bc748b5299f481001d92b0cdbf Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 8 Nov 2016 14:31:08 +0100 Subject: [PATCH] fix several gcc warnings --- src/App/ApplicationPy.cpp | 2 +- src/App/ExtensionContainerPyImp.cpp | 10 +++++----- src/App/PropertyFile.cpp | 4 ++-- src/Base/FileInfo.cpp | 4 +--- src/Base/FileInfo.h | 2 +- src/Gui/Macro.cpp | 6 +++++- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/App/ApplicationPy.cpp b/src/App/ApplicationPy.cpp index bc0e0c928..cdfeff0d5 100644 --- a/src/App/ApplicationPy.cpp +++ b/src/App/ApplicationPy.cpp @@ -148,7 +148,7 @@ PyObject* Application::sLoadFile(PyObject * /*self*/, PyObject *args,PyObject * std::string module = mod; if (module.empty()) { - std::string ext = fi.extension(false); + std::string ext = fi.extension(); std::vector modules = GetApplication().getImportModules(ext.c_str()); if (modules.empty()) { PyErr_Format(PyExc_IOError, "Filetype %s is not supported.", ext.c_str()); diff --git a/src/App/ExtensionContainerPyImp.cpp b/src/App/ExtensionContainerPyImp.cpp index 570f3740f..a0bf6382c 100644 --- a/src/App/ExtensionContainerPyImp.cpp +++ b/src/App/ExtensionContainerPyImp.cpp @@ -116,12 +116,12 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) { throw Py::Exception(Base::BaseExceptionFreeCADError,str.str()); } - if(getExtensionContainerPtr()->hasExtension(extension)) { - Py_INCREF(Py_True); - return Py_True; + bool val = false; + if (getExtensionContainerPtr()->hasExtension(extension)) { + val = true; } - Py_INCREF(Py_False); - return Py_False; + + return PyBool_FromLong(val ? 1 : 0); } PyObject* ExtensionContainerPy::addExtension(PyObject *args) { diff --git a/src/App/PropertyFile.cpp b/src/App/PropertyFile.cpp index 26919ad64..f5a1137ff 100644 --- a/src/App/PropertyFile.cpp +++ b/src/App/PropertyFile.cpp @@ -153,7 +153,7 @@ void PropertyFileIncluded::setValue(const char* sFile, const char* sName) // if a file with this name already exists search for a new one std::string dir = pathTrans; std::string fnp = fi.fileNamePure(); - std::string ext = fi.extension(false); + std::string ext = fi.extension(); int i=0; do { i++; @@ -207,7 +207,7 @@ void PropertyFileIncluded::setValue(const char* sFile, const char* sName) // if a file with this name already exists search for a new one std::string dir = fi.dirPath(); std::string fnp = fi.fileNamePure(); - std::string ext = fi.extension(false); + std::string ext = fi.extension(); int i=0; do { i++; diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 86dfaa244..51cb32ba9 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -272,10 +272,8 @@ std::wstring FileInfo::toStdWString() const #endif } -std::string FileInfo::extension (bool complete) const +std::string FileInfo::extension () const { - // complete not implemented - assert(complete==false); std::string::size_type pos = FileName.find_last_of('.'); if (pos == std::string::npos) return std::string(); diff --git a/src/Base/FileInfo.h b/src/Base/FileInfo.h index a457e9878..fe6c0bf3c 100644 --- a/src/Base/FileInfo.h +++ b/src/Base/FileInfo.h @@ -82,7 +82,7 @@ public: * ext = fi.extension(); // ext = "gz" *@endcode */ - std::string extension (bool complete = false) const; + std::string extension () const; /// Checks for a special extension, NOT case sensetive bool hasExtension (const char* Ext) const; //@} diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index b22e24da0..dd4999024 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -80,9 +80,13 @@ void MacroManager::OnChange(Base::Subject &rCaller, const char * sR void MacroManager::open(MacroType eType, const char *sName) { - // check + // check +#if _DEBUG assert(!this->openMacro); assert(eType == File); +#else + Q_UNUSED(eType); +#endif // Convert from Utf-8 this->macroName = QString::fromUtf8(sName);