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:
@@ -78,8 +78,8 @@ Branding::XmlConfig Branding::getUserDefines() const
|
||||
if (!root.isNull()) {
|
||||
child = root.firstChildElement();
|
||||
while (!child.isNull()) {
|
||||
std::string name = (const char*)child.localName().toLatin1();
|
||||
std::string value = (const char*)child.text().toUtf8();
|
||||
std::string name = child.localName().toLatin1().constData();
|
||||
std::string value = child.text().toUtf8().constData();
|
||||
if (std::find(filter.begin(), filter.end(), name) != filter.end())
|
||||
cfg[name] = value;
|
||||
child = child.nextSiblingElement();
|
||||
|
||||
@@ -40,12 +40,12 @@ TYPESYSTEM_SOURCE_ABSTRACT(Data::Segment , Base::BaseClass)
|
||||
TYPESYSTEM_SOURCE_ABSTRACT(Data::ComplexGeoData , Base::Persistence)
|
||||
|
||||
|
||||
ComplexGeoData::ComplexGeoData(void)
|
||||
ComplexGeoData::ComplexGeoData()
|
||||
:Tag(0)
|
||||
{
|
||||
}
|
||||
|
||||
ComplexGeoData::~ComplexGeoData(void)
|
||||
ComplexGeoData::~ComplexGeoData()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ Data::Segment* ComplexGeoData::getSubElementByName(const char* name) const
|
||||
std::string::size_type pos = element.find_first_of("0123456789");
|
||||
if (pos != std::string::npos) {
|
||||
index = std::atoi(element.substr(pos).c_str());
|
||||
element = element.substr(0,pos);
|
||||
element = element.substr(0, pos);
|
||||
}
|
||||
|
||||
return getSubElement(element.c_str(),index);
|
||||
return getSubElement(element.c_str(), static_cast<unsigned long>(index));
|
||||
}
|
||||
|
||||
void ComplexGeoData::applyTransform(const Base::Matrix4D& rclTrf)
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
};
|
||||
|
||||
/// Constructor
|
||||
ComplexGeoData(void);
|
||||
ComplexGeoData();
|
||||
/// Destructor
|
||||
virtual ~ComplexGeoData();
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
* List of different subelement types
|
||||
* its NOT a list of the subelements itself
|
||||
*/
|
||||
virtual std::vector<const char*> getElementTypes(void) const=0;
|
||||
virtual std::vector<const char*> getElementTypes() const=0;
|
||||
virtual unsigned long countSubElements(const char* Type) const=0;
|
||||
/// get the subelement by type and number
|
||||
virtual Segment* getSubElement(const char* Type, unsigned long) const=0;
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
* This method has to be handled by the child classes.
|
||||
* the actual placement and matrix is not part of this class.
|
||||
*/
|
||||
virtual Base::Matrix4D getTransform(void) const = 0;
|
||||
virtual Base::Matrix4D getTransform() const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Modification */
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
/** @name Getting basic geometric entities */
|
||||
//@{
|
||||
/// Get the bound box
|
||||
virtual Base::BoundBox3d getBoundBox(void)const=0;
|
||||
virtual Base::BoundBox3d getBoundBox()const=0;
|
||||
/** Get point from line object intersection */
|
||||
virtual Base::Vector3d getPointFromLineIntersection(
|
||||
const Base::Vector3f& base,
|
||||
@@ -196,7 +196,9 @@ protected:
|
||||
/// from local to outside
|
||||
inline Base::Vector3d transformToOutside(const Base::Vector3f& vec) const
|
||||
{
|
||||
return getTransform() * Base::Vector3d(vec.x,vec.y,vec.z);
|
||||
return getTransform() * Base::Vector3d(static_cast<double>(vec.x),
|
||||
static_cast<double>(vec.y),
|
||||
static_cast<double>(vec.z));
|
||||
}
|
||||
/// from local to inside
|
||||
inline Base::Vector3f transformToInside(const Base::Vector3d& vec) const
|
||||
@@ -204,7 +206,9 @@ protected:
|
||||
Base::Matrix4D tmpM(getTransform());
|
||||
tmpM.inverse();
|
||||
Base::Vector3d tmp = tmpM * vec;
|
||||
return Base::Vector3f((float)tmp.x,(float)tmp.y,(float)tmp.z);
|
||||
return Base::Vector3f(static_cast<float>(tmp.x),
|
||||
static_cast<float>(tmp.y),
|
||||
static_cast<float>(tmp.z));
|
||||
}
|
||||
public:
|
||||
mutable long Tag;
|
||||
|
||||
@@ -171,8 +171,8 @@ public:
|
||||
bool isRemoving() const {return StatusBits.test(ObjectStatus::Remove);}
|
||||
/// return the status bits
|
||||
unsigned long getStatus() const {return StatusBits.to_ulong();}
|
||||
bool testStatus(ObjectStatus pos) const {return StatusBits.test((size_t)pos);}
|
||||
void setStatus(ObjectStatus pos, bool on) {StatusBits.set((size_t)pos, on);}
|
||||
bool testStatus(ObjectStatus pos) const {return StatusBits.test(size_t(pos));}
|
||||
void setStatus(ObjectStatus pos, bool on) {StatusBits.set(size_t(pos), on);}
|
||||
//@}
|
||||
|
||||
int isExporting() const;
|
||||
|
||||
@@ -160,7 +160,7 @@ void Enumeration::setEnums(const std::vector<std::string> &values)
|
||||
_EnumArray[i] = 0; // null termination
|
||||
|
||||
// Other state variables
|
||||
_maxVal = values.size() - 1;
|
||||
_maxVal = static_cast<int>(values.size() - 1);
|
||||
_ownEnumArray = true;
|
||||
if (_index < 0)
|
||||
_index = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ using namespace App;
|
||||
//===========================================================================
|
||||
// Material
|
||||
//===========================================================================
|
||||
Material::Material(void)
|
||||
Material::Material()
|
||||
{
|
||||
setType(STEEL);
|
||||
setType(USER_DEFINED);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define APP_MATERIAL_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
# include <stdint.h>
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
@@ -100,10 +100,10 @@ public:
|
||||
*/
|
||||
uint32_t getPackedValue() const
|
||||
{
|
||||
return ((uint32_t)(r*255.0f + 0.5f) << 24 |
|
||||
(uint32_t)(g*255.0f + 0.5f) << 16 |
|
||||
(uint32_t)(b*255.0f + 0.5f) << 8 |
|
||||
(uint32_t)(a*255.0f + 0.5f));
|
||||
return (static_cast<uint32_t>(r*255.0f + 0.5f) << 24 |
|
||||
static_cast<uint32_t>(g*255.0f + 0.5f) << 16 |
|
||||
static_cast<uint32_t>(b*255.0f + 0.5f) << 8 |
|
||||
static_cast<uint32_t>(a*255.0f + 0.5f));
|
||||
}
|
||||
/**
|
||||
* creates FC Color from template type, e.g. Qt QColor
|
||||
@@ -116,8 +116,8 @@ public:
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
inline T asValue(void) const {
|
||||
return(T(int(r*255.0),int(g*255.0),int(b*255.0)));
|
||||
inline T asValue() const {
|
||||
return(T(int(r*255.0f),int(g*255.0f),int(b*255.0f)));
|
||||
}
|
||||
/**
|
||||
* returns color as hex color "#RRGGBB"
|
||||
@@ -125,9 +125,9 @@ public:
|
||||
*/
|
||||
std::string asHexString() const {
|
||||
std::stringstream ss;
|
||||
ss << "#" << std::hex << std::uppercase << std::setfill('0') << std::setw(2) << int(r*255.0)
|
||||
<< std::setw(2) << int(g*255.0)
|
||||
<< std::setw(2) << int(b*255.0);
|
||||
ss << "#" << std::hex << std::uppercase << std::setfill('0') << std::setw(2) << int(r*255.0f)
|
||||
<< std::setw(2) << int(g*255.0f)
|
||||
<< std::setw(2) << int(b*255.0f);
|
||||
return ss.str();
|
||||
}
|
||||
/**
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
*/
|
||||
//@{
|
||||
/** Sets the USER_DEFINED material type. The user must set the colors afterwards. */
|
||||
Material(void);
|
||||
Material();
|
||||
/** Defines the colors and shininess for the material \a MatName. If \a MatName isn't defined then USER_DEFINED is
|
||||
* set and the user must define the colors itself.
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -44,10 +44,10 @@ class AppExport PropertyFile : public PropertyString
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
PropertyFile(void);
|
||||
PropertyFile();
|
||||
virtual ~PropertyFile();
|
||||
|
||||
virtual const char* getEditorName(void) const
|
||||
virtual const char* getEditorName() const
|
||||
{ return "Gui::PropertyEditor::PropertyFileItem"; }
|
||||
|
||||
virtual void setFilter(const std::string filter);
|
||||
@@ -76,15 +76,15 @@ class AppExport PropertyFileIncluded : public Property
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
PropertyFileIncluded(void);
|
||||
PropertyFileIncluded();
|
||||
virtual ~PropertyFileIncluded();
|
||||
|
||||
void setValue(const char* sFile, const char* sName=0);
|
||||
const char* getValue(void) const;
|
||||
void setValue(const char* sFile, const char* sName=nullptr);
|
||||
const char* getValue() const;
|
||||
|
||||
virtual const char* getEditorName(void) const
|
||||
virtual const char* getEditorName() const
|
||||
{ return "Gui::PropertyEditor::PropertyTransientFileItem"; }
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual PyObject *getPyObject();
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
virtual void Save (Base::Writer &writer) const;
|
||||
@@ -93,9 +93,9 @@ public:
|
||||
virtual void SaveDocFile (Base::Writer &writer) const;
|
||||
virtual void RestoreDocFile(Base::Reader &reader);
|
||||
|
||||
virtual Property *Copy(void) const;
|
||||
virtual Property *Copy() const;
|
||||
virtual void Paste(const Property &from);
|
||||
virtual unsigned int getMemSize (void) const;
|
||||
virtual unsigned int getMemSize () const;
|
||||
|
||||
virtual bool isSame(const Property &other) const {
|
||||
if (&other == this)
|
||||
@@ -111,16 +111,16 @@ public:
|
||||
* this file with setValue() is the fastest way to change
|
||||
* the File.
|
||||
*/
|
||||
std::string getExchangeTempFile(void) const;
|
||||
std::string getOriginalFileName(void) const;
|
||||
std::string getExchangeTempFile() const;
|
||||
std::string getOriginalFileName() const;
|
||||
|
||||
bool isEmpty(void) const {return _cValue.empty();}
|
||||
|
||||
protected:
|
||||
// get the transient path if the property is in a DocumentObject
|
||||
std::string getDocTransientPath(void) const;
|
||||
std::string getDocTransientPath() const;
|
||||
std::string getUniqueFileName(const std::string&, const std::string&) const;
|
||||
void aboutToSetValue(void);
|
||||
void aboutToSetValue();
|
||||
|
||||
protected:
|
||||
mutable std::string _cValue;
|
||||
|
||||
@@ -74,7 +74,7 @@ Base::Quantity PropertyQuantity::createQuantityFromPy(PyObject *value)
|
||||
else if (PyFloat_Check(value))
|
||||
quant = Quantity(PyFloat_AsDouble(value),_Unit);
|
||||
else if (PyLong_Check(value))
|
||||
quant = Quantity((double)PyLong_AsLong(value),_Unit);
|
||||
quant = Quantity(double(PyLong_AsLong(value)),_Unit);
|
||||
else if (PyObject_TypeCheck(value, &(QuantityPy::Type))) {
|
||||
Base::QuantityPy *pcObject = static_cast<Base::QuantityPy*>(value);
|
||||
quant = *(pcObject->getQuantityPtr());
|
||||
|
||||
@@ -42,9 +42,9 @@ Range::Range(const char * range)
|
||||
std::string from;
|
||||
std::string to;
|
||||
|
||||
assert(range != NULL);
|
||||
assert(range != nullptr);
|
||||
|
||||
if (strchr(range, ':') == NULL) {
|
||||
if (strchr(range, ':') == nullptr) {
|
||||
from = range;
|
||||
to = range;
|
||||
}
|
||||
@@ -247,13 +247,13 @@ std::string App::CellAddress::toString(Cell cell) const
|
||||
if (_absCol && flags.testFlag(Cell::Absolute))
|
||||
s << '$';
|
||||
if (col() < 26) {
|
||||
s << (char)('A' + col());
|
||||
s << static_cast<char>('A' + col());
|
||||
}
|
||||
else {
|
||||
int colnum = col() - 26;
|
||||
|
||||
s << (char)('A' + (colnum / 26));
|
||||
s << (char)('A' + (colnum % 26));
|
||||
s << static_cast<char>('A' + (colnum / 26));
|
||||
s << static_cast<char>('A' + (colnum % 26));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@ using namespace Base;
|
||||
std::string ConvertFromWideString(const std::wstring& string)
|
||||
{
|
||||
int neededSize = WideCharToMultiByte(CP_UTF8, 0, string.c_str(), -1, 0, 0,0,0);
|
||||
char * CharString = new char[neededSize];
|
||||
char * CharString = new char[static_cast<size_t>(neededSize)];
|
||||
WideCharToMultiByte(CP_UTF8, 0, string.c_str(), -1, CharString, neededSize,0,0);
|
||||
std::string String((char*)CharString);
|
||||
std::string String(CharString);
|
||||
delete [] CharString;
|
||||
CharString = NULL;
|
||||
return String;
|
||||
@@ -77,7 +77,7 @@ std::string ConvertFromWideString(const std::wstring& string)
|
||||
std::wstring ConvertToWideString(const std::string& string)
|
||||
{
|
||||
int neededSize = MultiByteToWideChar(CP_UTF8, 0, string.c_str(), -1, 0, 0);
|
||||
wchar_t* wideCharString = new wchar_t[neededSize];
|
||||
wchar_t* wideCharString = new wchar_t[static_cast<size_t>(neededSize)];
|
||||
MultiByteToWideChar(CP_UTF8, 0, string.c_str(), -1, wideCharString, neededSize);
|
||||
std::wstring wideString(wideCharString);
|
||||
delete [] wideCharString;
|
||||
@@ -110,7 +110,7 @@ const std::string &FileInfo::getTempPath()
|
||||
wchar_t buf[MAX_PATH + 2];
|
||||
GetTempPathW(MAX_PATH + 1,buf);
|
||||
int neededSize = WideCharToMultiByte(CP_UTF8, 0, buf, -1, 0, 0, 0, 0);
|
||||
char* dest = new char[neededSize];
|
||||
char* dest = new char[static_cast<size_t>(neededSize)];
|
||||
WideCharToMultiByte(CP_UTF8, 0, buf, -1,dest, neededSize, 0, 0);
|
||||
tempPath = dest;
|
||||
delete [] dest;
|
||||
@@ -383,14 +383,15 @@ bool FileInfo::isDir () const
|
||||
return false;
|
||||
}
|
||||
return S_ISDIR(st.st_mode);
|
||||
#endif
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
// TODO: Check for valid path name
|
||||
return true;
|
||||
//return true;
|
||||
}
|
||||
|
||||
unsigned int FileInfo::size () const
|
||||
|
||||
@@ -40,7 +40,7 @@ void FutureWatcherProgress::progressValueChanged(int v)
|
||||
{
|
||||
if (steps == 0)
|
||||
return;
|
||||
unsigned int step = (100 * v) / steps;
|
||||
unsigned int step = (100 * static_cast<unsigned int>(v)) / steps;
|
||||
if (step > current) {
|
||||
current = step;
|
||||
seq.next();
|
||||
|
||||
@@ -127,7 +127,8 @@ Py::Object Vector2dPy::repr()
|
||||
Py::Float y(v.y);
|
||||
std::stringstream str;
|
||||
str << "Vector2 (";
|
||||
str << (std::string)x.repr() << ", "<< (std::string)y.repr();
|
||||
str << static_cast<std::string>(x.repr()) << ", "
|
||||
<< static_cast<std::string>(y.repr());
|
||||
str << ")";
|
||||
|
||||
return Py::String(str.str());
|
||||
|
||||
@@ -89,28 +89,28 @@ unsigned int StdInputStream::readBytes( XMLByte* const toFill, const unsigned i
|
||||
#else
|
||||
XMLFilePos StdInputStream::curPos() const
|
||||
{
|
||||
return stream.tellg();
|
||||
return static_cast<XMLFilePos>(stream.tellg());
|
||||
}
|
||||
|
||||
XMLSize_t StdInputStream::readBytes( XMLByte* const toFill, const XMLSize_t maxToRead )
|
||||
XMLSize_t StdInputStream::readBytes(XMLByte* const toFill, const XMLSize_t maxToRead)
|
||||
{
|
||||
//
|
||||
// Read up to the maximum bytes requested. We return the number
|
||||
// actually read.
|
||||
//
|
||||
|
||||
stream.read((char *)toFill,maxToRead);
|
||||
XMLSize_t len = stream.gcount();
|
||||
stream.read(reinterpret_cast<char *>(toFill), static_cast<std::streamsize>(maxToRead));
|
||||
std::streamsize len = stream.gcount();
|
||||
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
const QString text = codec->toUnicode((char *)toFill, len, &state);
|
||||
const QString text = codec->toUnicode(reinterpret_cast<char *>(toFill), static_cast<int>(len), &state);
|
||||
if (state.invalidChars > 0) {
|
||||
// In case invalid characters were found decode back to 'utf-8' and replace
|
||||
// them with '?'
|
||||
// First, Qt replaces invalid characters with '\0' (see ConvertInvalidToNull)
|
||||
// but Xerces doesn't like this because it handles this as termination. Thus,
|
||||
// we have to go through the array and replace '\0' with '?'.
|
||||
XMLSize_t pos = 0;
|
||||
std::streamsize pos = 0;
|
||||
QByteArray ba = codec->fromUnicode(text);
|
||||
for (int i=0; i<ba.length(); i++, pos++) {
|
||||
if (pos < len && ba[i] == '\0')
|
||||
@@ -118,7 +118,7 @@ XMLSize_t StdInputStream::readBytes( XMLByte* const toFill, const XMLSize_t max
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
return static_cast<XMLSize_t>(len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -289,16 +289,16 @@ void PlacementPy::setRotation(Py::Object arg)
|
||||
{
|
||||
Py::Rotation rot;
|
||||
if (rot.accepts(arg.ptr())) {
|
||||
getPlacementPtr()->setRotation((Base::Rotation)Py::Rotation(arg));
|
||||
getPlacementPtr()->setRotation(static_cast<Base::Rotation>(Py::Rotation(arg)));
|
||||
return;
|
||||
}
|
||||
Py::Tuple tuple;
|
||||
if (tuple.accepts(arg.ptr())) {
|
||||
tuple = arg;
|
||||
getPlacementPtr()->setRotation(Base::Rotation((double)Py::Float(tuple[0]),
|
||||
(double)Py::Float(tuple[1]),
|
||||
(double)Py::Float(tuple[2]),
|
||||
(double)Py::Float(tuple[3])
|
||||
getPlacementPtr()->setRotation(Base::Rotation(static_cast<double>(Py::Float(tuple[0])),
|
||||
static_cast<double>(Py::Float(tuple[1])),
|
||||
static_cast<double>(Py::Float(tuple[2])),
|
||||
static_cast<double>(Py::Float(tuple[3]))
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -438,12 +438,21 @@ double num_change(char* yytext,char dez_delim,char grp_delim)
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wmissing-noreturn"
|
||||
#endif
|
||||
|
||||
// error func
|
||||
void Quantity_yyerror(char *errorinfo)
|
||||
{
|
||||
throw Base::ParserError(errorinfo);
|
||||
}
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
// for VC9 (isatty and fileno not supported anymore)
|
||||
//#ifdef _MSC_VER
|
||||
|
||||
@@ -115,8 +115,15 @@ int QuantityPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
int i8=0;
|
||||
PyErr_Clear(); // set by PyArg_ParseTuple()
|
||||
if (PyArg_ParseTuple(args, "|diiiiiiii", &f,&i1,&i2,&i3,&i4,&i5,&i6,&i7,&i8)) {
|
||||
if (f != DOUBLE_MAX) {
|
||||
*self = Quantity(f,Unit(i1,i2,i3,i4,i5,i6,i7,i8));
|
||||
if (f < DOUBLE_MAX) {
|
||||
*self = Quantity(f,Unit{static_cast<int8_t>(i1),
|
||||
static_cast<int8_t>(i2),
|
||||
static_cast<int8_t>(i3),
|
||||
static_cast<int8_t>(i4),
|
||||
static_cast<int8_t>(i5),
|
||||
static_cast<int8_t>(i6),
|
||||
static_cast<int8_t>(i7),
|
||||
static_cast<int8_t>(i8)});
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -218,8 +225,15 @@ PyObject* QuantityPy::getValueAs(PyObject *args)
|
||||
int i8=0;
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "d|iiiiiiii", &f,&i1,&i2,&i3,&i4,&i5,&i6,&i7,&i8)) {
|
||||
if (f!=DOUBLE_MAX) {
|
||||
quant = Quantity(f,Unit(i1,i2,i3,i4,i5,i6,i7,i8));
|
||||
if (f < DOUBLE_MAX) {
|
||||
quant = Quantity(f,Unit{static_cast<int8_t>(i1),
|
||||
static_cast<int8_t>(i2),
|
||||
static_cast<int8_t>(i3),
|
||||
static_cast<int8_t>(i4),
|
||||
static_cast<int8_t>(i5),
|
||||
static_cast<int8_t>(i6),
|
||||
static_cast<int8_t>(i7),
|
||||
static_cast<int8_t>(i8)});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,7 +292,7 @@ PyObject * QuantityPy::number_int_handler (PyObject *self)
|
||||
}
|
||||
|
||||
QuantityPy* q = static_cast<QuantityPy*>(self);
|
||||
return PyLong_FromLong((long)q->getValue());
|
||||
return PyLong_FromLong(long(q->getValue()));
|
||||
}
|
||||
|
||||
PyObject * QuantityPy::number_negative_handler (PyObject *self)
|
||||
|
||||
@@ -515,7 +515,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
|
||||
|
||||
auto dropPriority = [&order](int index){
|
||||
char tmp;
|
||||
int tmp;
|
||||
if (index == 0){
|
||||
tmp = order[0];
|
||||
order[0] = order[1];
|
||||
@@ -531,7 +531,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
//pick up the strict direction
|
||||
Vector3d mainDir;
|
||||
for (int i = 0; i < 3; ++i){
|
||||
mainDir = *(dirs[order[0]]);
|
||||
mainDir = *(dirs[size_t(order[0])]);
|
||||
if (mainDir.Length() > tol)
|
||||
break;
|
||||
else
|
||||
@@ -544,7 +544,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
//pick up the 2nd priority direction, "hint" direction.
|
||||
Vector3d hintDir;
|
||||
for (int i = 0; i < 2; ++i){
|
||||
hintDir = *(dirs[order[1]]);
|
||||
hintDir = *(dirs[size_t(order[1])]);
|
||||
if ((hintDir.Cross(mainDir)).Length() > tol)
|
||||
break;
|
||||
else
|
||||
|
||||
@@ -166,7 +166,7 @@ std::string Base::Tools::escapedUnicodeToUtf8(const std::string& s)
|
||||
Base::PyGILStateLocker lock;
|
||||
std::string string;
|
||||
|
||||
PyObject* unicode = PyUnicode_DecodeUnicodeEscape(s.c_str(), s.size(), "strict");
|
||||
PyObject* unicode = PyUnicode_DecodeUnicodeEscape(s.c_str(), static_cast<Py_ssize_t>(s.size()), "strict");
|
||||
if (!unicode)
|
||||
return string;
|
||||
if (PyUnicode_Check(unicode)) {
|
||||
|
||||
@@ -263,14 +263,19 @@ struct BaseExport Tools
|
||||
* @param s String to convert.
|
||||
* @return A std::string encoded as UTF-8.
|
||||
*/
|
||||
static inline std::string toStdString(const QString& s) { QByteArray tmp = s.toUtf8(); return std::string(tmp.constData(), tmp.size()); }
|
||||
static inline std::string toStdString(const QString& s) {
|
||||
QByteArray tmp = s.toUtf8();
|
||||
return std::string(tmp.constData(), static_cast<size_t>(tmp.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief fromStdString Convert a std::string encoded as UTF-8 into a QString.
|
||||
* @param s std::string, expected to be UTF-8 encoded.
|
||||
* @return String represented as a QString.
|
||||
*/
|
||||
static inline QString fromStdString(const std::string & s) { return QString::fromUtf8(s.c_str(), s.size()); }
|
||||
static inline QString fromStdString(const std::string & s) {
|
||||
return QString::fromUtf8(s.c_str(), static_cast<int>(s.size()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ double Vector2d::GetAngle (const Vector2d &rclVect) const
|
||||
{
|
||||
fNum = (*this * rclVect) / fDivid;
|
||||
if (fNum < -1)
|
||||
return F_PI;
|
||||
return D_PI;
|
||||
else
|
||||
if (fNum > 1)
|
||||
return 0.0;
|
||||
@@ -186,11 +186,11 @@ bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const
|
||||
if (fabs (clV2.x - clV1.x) > 1e-10)
|
||||
m1 = (clV2.y - clV1.y) / (clV2.x - clV1.x);
|
||||
else
|
||||
m1 = FLOAT_MAX;
|
||||
m1 = DOUBLE_MAX;
|
||||
if (fabs (rclLine.clV2.x - rclLine.clV1.x) > 1e-10)
|
||||
m2 = (rclLine.clV2.y - rclLine.clV1.y) / (rclLine.clV2.x - rclLine.clV1.x);
|
||||
else
|
||||
m2 = FLOAT_MAX;
|
||||
m2 = DOUBLE_MAX;
|
||||
if (m1 == m2) /****** RETURN ERR (parallel lines) *************/
|
||||
return false;
|
||||
|
||||
@@ -198,13 +198,13 @@ bool Line2d::Intersect (const Line2d& rclLine, Vector2d &rclV) const
|
||||
b2 = rclLine.clV1.y - m2 * rclLine.clV1.x;
|
||||
|
||||
// calc intersection
|
||||
if (m1 == FLOAT_MAX)
|
||||
if (m1 == DOUBLE_MAX)
|
||||
{
|
||||
rclV.x = clV1.x;
|
||||
rclV.y = m2 * rclV.x + b2;
|
||||
}
|
||||
else
|
||||
if (m2 == FLOAT_MAX)
|
||||
if (m2 == DOUBLE_MAX)
|
||||
{
|
||||
rclV.x = rclLine.clV1.x;
|
||||
rclV.y = m1 * rclV.x + b1;
|
||||
|
||||
@@ -176,8 +176,10 @@ public:
|
||||
// admin-interface
|
||||
inline size_t GetCtVectors () const;
|
||||
inline bool Add (const Vector2d &rclVct);
|
||||
inline Vector2d& operator[] (size_t ulNdx) const;
|
||||
inline Vector2d& At (size_t ulNdx) const;
|
||||
inline const Vector2d& operator[] (size_t ulNdx) const;
|
||||
inline const Vector2d& At (size_t ulNdx) const;
|
||||
inline Vector2d& operator[] (size_t ulNdx);
|
||||
inline Vector2d& At (size_t ulNdx);
|
||||
inline bool Delete (size_t ulNdx);
|
||||
inline void DeleteAll ();
|
||||
|
||||
@@ -200,7 +202,7 @@ inline Vector2d::Vector2d()
|
||||
}
|
||||
|
||||
inline Vector2d::Vector2d(float x, float y)
|
||||
: x(x), y(y)
|
||||
: x(double(x)), y(double(y))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -410,7 +412,8 @@ inline bool Polygon2d::Delete (size_t ulNdx)
|
||||
{
|
||||
if ( ulNdx < _aclVct.size() )
|
||||
{
|
||||
std::vector<Vector2d>::iterator it = _aclVct.begin() + ulNdx;
|
||||
std::vector<Vector2d>::iterator it = _aclVct.begin();
|
||||
std::advance(it, ulNdx);
|
||||
_aclVct.erase ( it );
|
||||
return true;
|
||||
}
|
||||
@@ -418,16 +421,27 @@ inline bool Polygon2d::Delete (size_t ulNdx)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline Vector2d& Polygon2d::operator[] (size_t ulNdx) const
|
||||
inline const Vector2d& Polygon2d::operator[] (size_t ulNdx) const
|
||||
{
|
||||
return (Vector2d&) _aclVct[ulNdx];
|
||||
return _aclVct[ulNdx];
|
||||
}
|
||||
|
||||
inline Vector2d& Polygon2d::At (size_t ulNdx) const
|
||||
inline const Vector2d& Polygon2d::At (size_t ulNdx) const
|
||||
{
|
||||
return (Vector2d&) _aclVct[ulNdx];
|
||||
return _aclVct.at(ulNdx);
|
||||
}
|
||||
|
||||
inline Vector2d& Polygon2d::operator[] (size_t ulNdx)
|
||||
{
|
||||
return _aclVct[ulNdx];
|
||||
}
|
||||
|
||||
inline Vector2d& Polygon2d::At (size_t ulNdx)
|
||||
{
|
||||
return _aclVct.at(ulNdx);
|
||||
}
|
||||
|
||||
|
||||
inline Line2d::Line2d (const Line2d &rclLine)
|
||||
: clV1 (rclLine.clV1),
|
||||
clV2 (rclLine.clV2)
|
||||
|
||||
@@ -142,7 +142,7 @@ Type Type::badType()
|
||||
const Type Type::createType(const Type parent, const char *name, instantiationMethod method)
|
||||
{
|
||||
Type newType;
|
||||
newType.index = Type::typedata.size();
|
||||
newType.index = static_cast<unsigned int>(Type::typedata.size());
|
||||
TypeData * typeData = new TypeData(name, newType, parent,method);
|
||||
Type::typedata.push_back(typeData);
|
||||
|
||||
@@ -232,7 +232,7 @@ int Type::getAllDerivedFrom(const Type type, std::vector<Type> & List)
|
||||
|
||||
int Type::getNumTypes()
|
||||
{
|
||||
return typedata.size();
|
||||
return static_cast<int>(typedata.size());
|
||||
}
|
||||
|
||||
Type Type::getTypeIfDerivedFrom(const char* name , const Type parent, bool bLoadModule)
|
||||
|
||||
@@ -65,14 +65,14 @@ Unit::Unit(int8_t Length,
|
||||
int8_t Angle)
|
||||
{
|
||||
checkRange("unit",
|
||||
(int32_t)Length,
|
||||
(int32_t)Mass,
|
||||
(int32_t)Time,
|
||||
(int32_t)ElectricCurrent,
|
||||
(int32_t)ThermodynamicTemperature,
|
||||
(int32_t)AmountOfSubstance,
|
||||
(int32_t)LuminousIntensity,
|
||||
(int32_t)Angle);
|
||||
Length,
|
||||
Mass,
|
||||
Time,
|
||||
ElectricCurrent,
|
||||
ThermodynamicTemperature,
|
||||
AmountOfSubstance,
|
||||
LuminousIntensity,
|
||||
Angle);
|
||||
|
||||
Sig.Length = Length;
|
||||
Sig.Mass = Mass;
|
||||
@@ -122,14 +122,14 @@ Unit::Unit(const QString& expr)
|
||||
Unit Unit::pow(signed char exp) const
|
||||
{
|
||||
checkRange("pow()",
|
||||
(int32_t)Sig.Length * (int32_t)exp,
|
||||
(int32_t)Sig.Mass * (int32_t)exp,
|
||||
(int32_t)Sig.Time * (int32_t)exp,
|
||||
(int32_t)Sig.ElectricCurrent * (int32_t)exp,
|
||||
(int32_t)Sig.ThermodynamicTemperature * (int32_t)exp,
|
||||
(int32_t)Sig.AmountOfSubstance * (int32_t)exp,
|
||||
(int32_t)Sig.LuminousIntensity * (int32_t)exp,
|
||||
(int32_t)Sig.Angle * (int32_t)exp);
|
||||
Sig.Length * exp,
|
||||
Sig.Mass * exp,
|
||||
Sig.Time * exp,
|
||||
Sig.ElectricCurrent * exp,
|
||||
Sig.ThermodynamicTemperature * exp,
|
||||
Sig.AmountOfSubstance * exp,
|
||||
Sig.LuminousIntensity * exp,
|
||||
Sig.Angle * exp);
|
||||
|
||||
Unit result;
|
||||
result.Sig.Length = Sig.Length * exp;
|
||||
@@ -172,14 +172,14 @@ bool Unit::operator ==(const Unit& that) const
|
||||
Unit Unit::operator *(const Unit &right) const
|
||||
{
|
||||
checkRange("* operator",
|
||||
(int32_t)Sig.Length + (int32_t)right.Sig.Length,
|
||||
(int32_t)Sig.Mass + (int32_t)right.Sig.Mass,
|
||||
(int32_t)Sig.Time + (int32_t)right.Sig.Time,
|
||||
(int32_t)Sig.ElectricCurrent + (int32_t)right.Sig.ElectricCurrent,
|
||||
(int32_t)Sig.ThermodynamicTemperature + (int32_t)right.Sig.ThermodynamicTemperature,
|
||||
(int32_t)Sig.AmountOfSubstance + (int32_t)right.Sig.AmountOfSubstance,
|
||||
(int32_t)Sig.LuminousIntensity + (int32_t)right.Sig.LuminousIntensity,
|
||||
(int32_t)Sig.Angle + (int32_t)right.Sig.Angle);
|
||||
Sig.Length +right.Sig.Length,
|
||||
Sig.Mass + right.Sig.Mass,
|
||||
Sig.Time + right.Sig.Time,
|
||||
Sig.ElectricCurrent + right.Sig.ElectricCurrent,
|
||||
Sig.ThermodynamicTemperature + right.Sig.ThermodynamicTemperature,
|
||||
Sig.AmountOfSubstance + right.Sig.AmountOfSubstance,
|
||||
Sig.LuminousIntensity + right.Sig.LuminousIntensity,
|
||||
Sig.Angle + right.Sig.Angle);
|
||||
|
||||
Unit result;
|
||||
result.Sig.Length = Sig.Length + right.Sig.Length;
|
||||
@@ -197,14 +197,14 @@ Unit Unit::operator *(const Unit &right) const
|
||||
Unit Unit::operator /(const Unit &right) const
|
||||
{
|
||||
checkRange("/ operator",
|
||||
(int32_t)Sig.Length - (int32_t)right.Sig.Length,
|
||||
(int32_t)Sig.Mass - (int32_t)right.Sig.Mass,
|
||||
(int32_t)Sig.Time - (int32_t)right.Sig.Time,
|
||||
(int32_t)Sig.ElectricCurrent - (int32_t)right.Sig.ElectricCurrent,
|
||||
(int32_t)Sig.ThermodynamicTemperature - (int32_t)right.Sig.ThermodynamicTemperature,
|
||||
(int32_t)Sig.AmountOfSubstance - (int32_t)right.Sig.AmountOfSubstance,
|
||||
(int32_t)Sig.LuminousIntensity - (int32_t)right.Sig.LuminousIntensity,
|
||||
(int32_t)Sig.Angle - (int32_t)right.Sig.Angle);
|
||||
Sig.Length - right.Sig.Length,
|
||||
Sig.Mass - right.Sig.Mass,
|
||||
Sig.Time - right.Sig.Time,
|
||||
Sig.ElectricCurrent - right.Sig.ElectricCurrent,
|
||||
Sig.ThermodynamicTemperature - right.Sig.ThermodynamicTemperature,
|
||||
Sig.AmountOfSubstance - right.Sig.AmountOfSubstance,
|
||||
Sig.LuminousIntensity - right.Sig.LuminousIntensity,
|
||||
Sig.Angle - right.Sig.Angle);
|
||||
|
||||
Unit result;
|
||||
result.Sig.Length = Sig.Length - right.Sig.Length;
|
||||
|
||||
@@ -140,7 +140,7 @@ PyObject* UnitsApi::sSetSchema(PyObject * /*self*/, PyObject *args)
|
||||
PyErr_SetString(PyExc_ValueError, "invalid schema value");
|
||||
return nullptr;
|
||||
}
|
||||
setSchema((UnitSystem)index);
|
||||
setSchema(static_cast<UnitSystem>(index));
|
||||
}
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ QString UnitsSchema::toLocale(const Base::Quantity& quant, double factor, const
|
||||
QLocale Lc;
|
||||
const QuantityFormat& format = quant.getFormat();
|
||||
if (format.option != QuantityFormat::None) {
|
||||
uint opt = static_cast<uint>(format.option);
|
||||
int opt = format.option;
|
||||
Lc.setNumberOptions(static_cast<QLocale::NumberOptions>(opt));
|
||||
}
|
||||
|
||||
|
||||
@@ -235,18 +235,18 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity &quant, doub
|
||||
minden = quant.getFormat().getDenominator();
|
||||
|
||||
// Compute and round the total number of fractional units
|
||||
ntot = (int)std::round(totalInches * (double)minden);
|
||||
ntot = static_cast<int>(std::round(totalInches * static_cast<double>(minden)));
|
||||
|
||||
// If this is zero, nothing to do but return
|
||||
if( ntot==0 )
|
||||
return QString::fromLatin1("0");
|
||||
|
||||
// Compute the whole number of feet and remaining units
|
||||
feet = (int)std::floor(ntot / (12*minden));
|
||||
feet = static_cast<int>(std::floor(ntot / (12*minden)));
|
||||
ntot = ntot - 12*minden*feet;
|
||||
|
||||
// Compute the remaining number of whole inches
|
||||
inches = (int)std::floor(ntot/minden);
|
||||
inches = static_cast<int>(std::floor(ntot/minden));
|
||||
|
||||
// Lastly the fractional quantities
|
||||
num = ntot - inches*minden;
|
||||
@@ -387,9 +387,9 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, d
|
||||
// double wholeSeconds = std::floor(rawSeconds);
|
||||
// double remainSeconds = rawSeconds - wholeSeconds;
|
||||
|
||||
int outDeg = (int) wholeDegrees;
|
||||
int outMin = (int) wholeMinutes;
|
||||
int outSec = (int) std::round(rawSeconds);
|
||||
int outDeg = static_cast<int>(wholeDegrees);
|
||||
int outMin = static_cast<int>(wholeMinutes);
|
||||
int outSec = static_cast<int>(std::round(rawSeconds));
|
||||
|
||||
std::stringstream output;
|
||||
output << outDeg << degreeString.toUtf8().constData();
|
||||
|
||||
@@ -47,7 +47,9 @@ std::string VectorPy::representation() const
|
||||
Py::Float z(ptr->z);
|
||||
std::stringstream str;
|
||||
str << "Vector (";
|
||||
str << (std::string)x.repr() << ", "<< (std::string)y.repr() << ", "<< (std::string)z.repr();
|
||||
str << static_cast<std::string>(x.repr()) << ", "
|
||||
<< static_cast<std::string>(y.repr()) << ", "
|
||||
<< static_cast<std::string>(z.repr());
|
||||
str << ")";
|
||||
|
||||
return str.str();
|
||||
@@ -192,8 +194,10 @@ PyObject * VectorPy::sequence_item (PyObject *self, Py_ssize_t index)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned short pos = index % 3;
|
||||
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
return Py_BuildValue("d", a[index]);
|
||||
return Py_BuildValue("d", a[pos]);
|
||||
}
|
||||
|
||||
int VectorPy::sequence_ass_item(PyObject *self, Py_ssize_t index, PyObject *value)
|
||||
@@ -207,9 +211,11 @@ int VectorPy::sequence_ass_item(PyObject *self, Py_ssize_t index, PyObject *valu
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned short pos = index % 3;
|
||||
|
||||
if (PyNumber_Check(value)) {
|
||||
VectorPy::PointerType ptr = static_cast<VectorPy*>(self)->getVectorPtr();
|
||||
(*ptr)[index] = PyFloat_AsDouble(value);
|
||||
(*ptr)[pos] = PyFloat_AsDouble(value);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "value must be float");
|
||||
@@ -255,11 +261,11 @@ PyObject * VectorPy::mapping_subscript(PyObject *self, PyObject *item)
|
||||
}
|
||||
else if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d v = static_cast<VectorPy*>(self) ->value();
|
||||
Py::Tuple xyz(slicelength);
|
||||
Py::Tuple xyz(static_cast<size_t>(slicelength));
|
||||
|
||||
for (cur = start, i = 0; i < slicelength;
|
||||
cur += step, i++) {
|
||||
xyz.setItem(i, Py::Float(v[cur]));
|
||||
for (cur = start, i = 0; i < slicelength; cur += step, i++) {
|
||||
unsigned short pos = cur % 3;
|
||||
xyz.setItem(static_cast<Py::sequence_index_type>(i), Py::Float(v[pos]));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(xyz);
|
||||
@@ -622,7 +628,7 @@ void VectorPy::setLength(Py::Float arg)
|
||||
throw Py::RuntimeError(std::string("Cannot set length of null vector"));
|
||||
}
|
||||
|
||||
double val = (double)arg/len;
|
||||
double val = static_cast<double>(arg)/len;
|
||||
ptr->x *= val;
|
||||
ptr->y *= val;
|
||||
ptr->z *= val;
|
||||
@@ -637,7 +643,7 @@ Py::Float VectorPy::getx() const
|
||||
void VectorPy::setx(Py::Float arg)
|
||||
{
|
||||
VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
|
||||
ptr->x = (double)arg;
|
||||
ptr->x = static_cast<double>(arg);
|
||||
}
|
||||
|
||||
Py::Float VectorPy::gety() const
|
||||
@@ -649,7 +655,7 @@ Py::Float VectorPy::gety() const
|
||||
void VectorPy::sety(Py::Float arg)
|
||||
{
|
||||
VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
|
||||
ptr->y = (double)arg;
|
||||
ptr->y = static_cast<double>(arg);
|
||||
}
|
||||
|
||||
Py::Float VectorPy::getz() const
|
||||
@@ -661,7 +667,7 @@ Py::Float VectorPy::getz() const
|
||||
void VectorPy::setz(Py::Float arg)
|
||||
{
|
||||
VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
|
||||
ptr->z = (double)arg;
|
||||
ptr->z = static_cast<double>(arg);
|
||||
}
|
||||
|
||||
PyObject *VectorPy::getCustomAttributes(const char* /*attr*/) const
|
||||
@@ -693,7 +699,7 @@ PyObject * VectorPy::number_divide_handler (PyObject* self, PyObject* other)
|
||||
|
||||
Base::Vector3d vec = static_cast<VectorPy*>(self) ->value();
|
||||
double div = PyFloat_AsDouble(other);
|
||||
if (div == 0) {
|
||||
if (div == 0.0) {
|
||||
PyErr_Format(PyExc_ZeroDivisionError, "'%s' division by zero",
|
||||
Py_TYPE(self)->tp_name);
|
||||
return nullptr;
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#ifndef VISITOR_H
|
||||
#define VISITOR_H
|
||||
|
||||
#include "Definitions.h"
|
||||
#include <vector>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Mod/Mesh/MeshGlobal.h>
|
||||
|
||||
namespace MeshCore {
|
||||
@@ -32,6 +33,7 @@ namespace MeshCore {
|
||||
class MeshFacet;
|
||||
class MeshKernel;
|
||||
class MeshFacetVisitor;
|
||||
class MeshPoint;
|
||||
class PlaneFit;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user