fix several gcc warnings

This commit is contained in:
wmayer 2016-11-08 14:31:08 +01:00
parent 17c8b2c813
commit 5f12a043fa
6 changed files with 15 additions and 13 deletions

View File

@ -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<std::string> modules = GetApplication().getImportModules(ext.c_str());
if (modules.empty()) {
PyErr_Format(PyExc_IOError, "Filetype %s is not supported.", ext.c_str());

View File

@ -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) {

View File

@ -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++;

View File

@ -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();

View File

@ -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;
//@}

View File

@ -80,9 +80,13 @@ void MacroManager::OnChange(Base::Subject<const char*> &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);