Base/App: fix warnings from code analysers:

* convert old-style-casts to explicit C++ casts where possible
* make some implicit conversions explicit
This commit is contained in:
wmayer
2022-03-06 23:49:30 +01:00
parent 1be4ed57ae
commit e4435cdcba
30 changed files with 211 additions and 155 deletions

View File

@@ -64,7 +64,7 @@ PropertyFileIncluded::~PropertyFileIncluded()
}
}
void PropertyFileIncluded::aboutToSetValue(void)
void PropertyFileIncluded::aboutToSetValue()
{
// This is a trick to check in Copy() if it is called
// directly from outside or by the Undo/Redo mechanism.
@@ -78,7 +78,7 @@ void PropertyFileIncluded::aboutToSetValue(void)
this->StatusBits.reset(10);
}
std::string PropertyFileIncluded::getDocTransientPath(void) const
std::string PropertyFileIncluded::getDocTransientPath() const
{
std::string path;
PropertyContainer *co = getContainer();
@@ -100,13 +100,13 @@ std::string PropertyFileIncluded::getUniqueFileName(const std::string& path, con
return fi.filePath();
}
std::string PropertyFileIncluded::getExchangeTempFile(void) const
std::string PropertyFileIncluded::getExchangeTempFile() const
{
return Base::FileInfo::getTempFileName(Base::FileInfo
(getValue()).fileName().c_str(), getDocTransientPath().c_str());
}
std::string PropertyFileIncluded::getOriginalFileName(void) const
std::string PropertyFileIncluded::getOriginalFileName() const
{
return _OriginalName;
}
@@ -232,14 +232,14 @@ void PropertyFileIncluded::setValue(const char* sFile, const char* sName)
}
}
const char* PropertyFileIncluded::getValue(void) const
const char* PropertyFileIncluded::getValue() const
{
return _cValue.c_str();
}
PyObject *PropertyFileIncluded::getPyObject(void)
PyObject *PropertyFileIncluded::getPyObject()
{
PyObject *p = PyUnicode_DecodeUTF8(_cValue.c_str(),_cValue.size(),0);
PyObject *p = PyUnicode_DecodeUTF8(_cValue.c_str(),_cValue.size(),nullptr);
if (!p) {
throw Base::UnicodeError("PropertyFileIncluded: UTF-8 conversion failure");
}
@@ -249,7 +249,7 @@ PyObject *PropertyFileIncluded::getPyObject(void)
namespace App {
const char* getNameFromFile(PyObject* value)
{
const char* string = 0;
const char* string = nullptr;
PyObject *oname = PyObject_GetAttrString (value, "name");
if (oname) {
if (PyUnicode_Check (oname)) {
@@ -464,7 +464,7 @@ void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader)
hasSetValue();
}
Property *PropertyFileIncluded::Copy(void) const
Property *PropertyFileIncluded::Copy() const
{
std::unique_ptr<PropertyFileIncluded> prop(new PropertyFileIncluded());
@@ -564,7 +564,7 @@ void PropertyFileIncluded::Paste(const Property &from)
hasSetValue();
}
unsigned int PropertyFileIncluded::getMemSize (void) const
unsigned int PropertyFileIncluded::getMemSize () const
{
unsigned int mem = Property::getMemSize();
mem += _cValue.size();