Base: modernize C++11
* use nullptr
This commit is contained in:
@@ -80,7 +80,7 @@ PyException::PyException()
|
||||
// destroyed, so we don't keep reference here to save book-keeping in
|
||||
// our copy constructor and destructor
|
||||
Py_DECREF(PP_last_exception_type);
|
||||
PP_last_exception_type = 0;
|
||||
PP_last_exception_type = nullptr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -116,14 +116,14 @@ protected:
|
||||
PyObject *_exceptionType;
|
||||
};
|
||||
|
||||
inline Py::Object pyCall(PyObject *callable, PyObject *args=0) {
|
||||
inline Py::Object pyCall(PyObject *callable, PyObject *args=nullptr) {
|
||||
PyObject *result = PyObject_CallObject(callable, args);
|
||||
if(!result)
|
||||
throw Py::Exception();
|
||||
return Py::asObject(result);
|
||||
}
|
||||
|
||||
inline Py::Object pyCallWithKeywords(PyObject *callable, PyObject *args, PyObject *kwds=0) {
|
||||
inline Py::Object pyCallWithKeywords(PyObject *callable, PyObject *args, PyObject *kwds=nullptr) {
|
||||
PyObject *result = PyObject_Call(callable, args, kwds);
|
||||
if(!result)
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -595,7 +595,7 @@ std::vector<std::pair<std::string,unsigned long> > ParameterGrp::GetUnsignedMap(
|
||||
while ( pcTemp ) {
|
||||
Name = StrX(static_cast<DOMElement*>(pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str();
|
||||
// check on filter condition
|
||||
if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) {
|
||||
if (sFilter == nullptr || Name.find(sFilter)!= std::string::npos) {
|
||||
vrValues.emplace_back(Name,
|
||||
( strtoul (StrX(static_cast<DOMElement*>(pcTemp)->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10) ));
|
||||
}
|
||||
@@ -940,7 +940,7 @@ void ParameterGrp::Clear(void)
|
||||
}
|
||||
|
||||
// searching all non-group nodes
|
||||
for (DOMNode *child = _pGroupNode->getFirstChild(); child != 0; child = child->getNextSibling()) {
|
||||
for (DOMNode *child = _pGroupNode->getFirstChild(); child != nullptr; child = child->getNextSibling()) {
|
||||
if (XMLString::compareString(child->getNodeName(), XStr("FCParamGroup").unicodeForm()) != 0)
|
||||
vecNodes.push_back(child);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ PyObject* PlacementPy::rotate(PyObject *args) {
|
||||
PyObject *obj1, *obj2;
|
||||
double angle;
|
||||
if (!PyArg_ParseTuple(args, "OOd", &obj1, &obj2, &angle))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Py::Sequence p1(obj1), p2(obj2);
|
||||
@@ -182,7 +182,7 @@ PyObject* PlacementPy::rotate(PyObject *args) {
|
||||
Py_Return;
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,13 +103,13 @@ static void
|
||||
PyBaseProxy_dealloc(PyObject* self)
|
||||
{
|
||||
/* Clear weakrefs first before calling any destructors */
|
||||
if (reinterpret_cast<PyBaseProxy*>(self)->weakreflist != NULL)
|
||||
if (reinterpret_cast<PyBaseProxy*>(self)->weakreflist != nullptr)
|
||||
PyObject_ClearWeakRefs(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyTypeObject PyBaseProxyType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
PyVarObject_HEAD_INIT(nullptr, 0)
|
||||
"PyBaseProxy", /*tp_name*/
|
||||
sizeof(PyBaseProxy), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
|
||||
@@ -345,7 +345,7 @@ static Quantity &pyToQuantity(Quantity &q, PyObject *pyobj) {
|
||||
|
||||
PyObject* QuantityPy::number_add_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
Quantity *pa=0, *pb=0;
|
||||
Quantity *pa=nullptr, *pb=nullptr;
|
||||
Quantity a,b;
|
||||
PY_TRY {
|
||||
if (PyObject_TypeCheck(self, &(QuantityPy::Type)))
|
||||
@@ -363,7 +363,7 @@ PyObject* QuantityPy::number_add_handler(PyObject *self, PyObject *other)
|
||||
|
||||
PyObject* QuantityPy::number_subtract_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
Quantity *pa=0, *pb=0;
|
||||
Quantity *pa=nullptr, *pb=nullptr;
|
||||
Quantity a,b;
|
||||
PY_TRY {
|
||||
if (PyObject_TypeCheck(self, &(QuantityPy::Type)))
|
||||
@@ -381,7 +381,7 @@ PyObject* QuantityPy::number_subtract_handler(PyObject *self, PyObject *other)
|
||||
|
||||
PyObject* QuantityPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
{
|
||||
Quantity *pa=0, *pb=0;
|
||||
Quantity *pa=nullptr, *pb=nullptr;
|
||||
Quantity a,b;
|
||||
PY_TRY {
|
||||
if (PyObject_TypeCheck(self, &(QuantityPy::Type)))
|
||||
@@ -399,7 +399,7 @@ PyObject* QuantityPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
|
||||
PyObject * QuantityPy::number_divide_handler (PyObject *self, PyObject *other)
|
||||
{
|
||||
Quantity *pa=0, *pb=0;
|
||||
Quantity *pa=nullptr, *pb=nullptr;
|
||||
Quantity a,b;
|
||||
PY_TRY {
|
||||
if (PyObject_TypeCheck(self, &(QuantityPy::Type)))
|
||||
|
||||
@@ -849,7 +849,7 @@ const char *EulerSequenceNames[] = {
|
||||
const char * Rotation::eulerSequenceName(EulerSequence seq)
|
||||
{
|
||||
if (seq == Invalid || seq >= EulerSequenceLast)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return EulerSequenceNames[seq-1];
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ PyObject* RotationPy::slerp(PyObject * args)
|
||||
PyObject *rot;
|
||||
double t;
|
||||
if (!PyArg_ParseTuple(args, "O!d", &(RotationPy::Type), &rot, &t))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Rotation *rot0 = this->getRotationPtr();
|
||||
Rotation *rot1 = static_cast<RotationPy*>(rot)->getRotationPtr();
|
||||
Rotation sl = Rotation::slerp(*rot0, *rot1, t);
|
||||
@@ -357,7 +357,7 @@ PyObject* RotationPy::toEulerAngles(PyObject * args)
|
||||
PyObject* RotationPy::toMatrix(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
Base::Matrix4D mat;
|
||||
getRotationPtr()->getValue(mat);
|
||||
return new MatrixPy(new Matrix4D(mat));
|
||||
|
||||
@@ -62,7 +62,7 @@ void TimeInfo::setCurrent()
|
||||
{
|
||||
#if defined (FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
gettimeofday(&t, nullptr);
|
||||
timebuffer.time = t.tv_sec;
|
||||
timebuffer.millitm = t.tv_usec / 1000;
|
||||
#elif defined(FC_OS_WIN32)
|
||||
|
||||
Reference in New Issue
Block a user