mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
dcparser: slight code cleanup in dcPacker.cxx
This commit is contained in:
parent
618e6f3fee
commit
cd9712270b
@ -637,31 +637,27 @@ pack_object(PyObject *object) {
|
|||||||
// had to add this for basic 64 and unsigned data to get packed right .. Not
|
// had to add this for basic 64 and unsigned data to get packed right .. Not
|
||||||
// sure if we can just do the rest this way..
|
// sure if we can just do the rest this way..
|
||||||
|
|
||||||
switch(pack_type)
|
switch (pack_type) {
|
||||||
{
|
|
||||||
case PT_int64:
|
case PT_int64:
|
||||||
if(PyLong_Check(object))
|
if (PyLong_Check(object)) {
|
||||||
{
|
|
||||||
pack_int64(PyLong_AsLongLong(object));
|
pack_int64(PyLong_AsLongLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
else if (PyInt_Check(object))
|
else if (PyInt_Check(object)) {
|
||||||
{
|
|
||||||
pack_int64(PyInt_AsLong(object));
|
pack_int64(PyInt_AsLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_uint64:
|
case PT_uint64:
|
||||||
if(PyLong_Check(object))
|
if (PyLong_Check(object)) {
|
||||||
{
|
|
||||||
pack_uint64(PyLong_AsUnsignedLongLong(object));
|
pack_uint64(PyLong_AsUnsignedLongLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
else if(PyInt_Check(object))
|
else if (PyInt_Check(object)) {
|
||||||
{
|
|
||||||
PyObject *obj1 = PyNumber_Long(object);
|
PyObject *obj1 = PyNumber_Long(object);
|
||||||
pack_int(PyLong_AsUnsignedLongLong(obj1));
|
pack_int(PyLong_AsUnsignedLongLong(obj1));
|
||||||
Py_DECREF(obj1);
|
Py_DECREF(obj1);
|
||||||
@ -669,29 +665,27 @@ pack_object(PyObject *object) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_int:
|
case PT_int:
|
||||||
if(PyLong_Check(object))
|
if (PyLong_Check(object)) {
|
||||||
{
|
|
||||||
pack_int(PyLong_AsLong(object));
|
pack_int(PyLong_AsLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
else if (PyInt_Check(object))
|
else if (PyInt_Check(object)) {
|
||||||
{
|
|
||||||
pack_int(PyInt_AsLong(object));
|
pack_int(PyInt_AsLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_uint:
|
case PT_uint:
|
||||||
if(PyLong_Check(object))
|
if (PyLong_Check(object)) {
|
||||||
{
|
|
||||||
pack_uint(PyLong_AsUnsignedLong(object));
|
pack_uint(PyLong_AsUnsignedLong(object));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
else if (PyInt_Check(object))
|
else if (PyInt_Check(object)) {
|
||||||
{
|
|
||||||
PyObject *obj1 = PyNumber_Long(object);
|
PyObject *obj1 = PyNumber_Long(object);
|
||||||
pack_uint(PyLong_AsUnsignedLong(obj1));
|
pack_uint(PyLong_AsUnsignedLong(obj1));
|
||||||
Py_DECREF(obj1);
|
Py_DECREF(obj1);
|
||||||
@ -699,9 +693,11 @@ pack_object(PyObject *object) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PyLong_Check(object)) {
|
if (PyLong_Check(object)) {
|
||||||
pack_int(PyLong_AsLong(object));
|
pack_int(PyLong_AsLong(object));
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user