Use long, not long long, when getting/setting numeric attributes.
We use int or long, not long long, in the Python plugin.
This commit is contained in:
@@ -522,20 +522,20 @@ py_object_get_optional_attr_string(PyObject *py_object, const char *attr_name)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long
|
long
|
||||||
py_object_get_optional_attr_number(PyObject *py_object, const char *attr_name)
|
py_object_get_optional_attr_number(PyObject *py_object, const char *attr_name)
|
||||||
{
|
{
|
||||||
PyObject *py_value = py_object_get_optional_attr(py_object, attr_name, NULL);
|
PyObject *py_value = py_object_get_optional_attr(py_object, attr_name, NULL);
|
||||||
if (py_value == NULL)
|
if (py_value == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
long long value = PyLong_AsLongLong(py_value);
|
long value = PyLong_AsLong(py_value);
|
||||||
Py_CLEAR(py_value);
|
Py_CLEAR(py_value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
py_object_set_attr_number(PyObject *py_object, const char *attr_name, long long number)
|
py_object_set_attr_number(PyObject *py_object, const char *attr_name, long number)
|
||||||
{
|
{
|
||||||
PyObject *py_number = PyLong_FromLong(number);
|
PyObject *py_number = PyLong_FromLong(number);
|
||||||
if (py_number == NULL)
|
if (py_number == NULL)
|
||||||
|
@@ -85,10 +85,10 @@ CPYCHECKER_RETURNS_BORROWED_REF
|
|||||||
PyObject *py_tuple_get(PyObject *py_tuple, Py_ssize_t index, PyTypeObject *expected_type);
|
PyObject *py_tuple_get(PyObject *py_tuple, Py_ssize_t index, PyTypeObject *expected_type);
|
||||||
|
|
||||||
PyObject *py_object_get_optional_attr(PyObject *py_object, const char *attr, PyObject *py_default);
|
PyObject *py_object_get_optional_attr(PyObject *py_object, const char *attr, PyObject *py_default);
|
||||||
long long py_object_get_optional_attr_number(PyObject *py_object, const char *attr_name);
|
long py_object_get_optional_attr_number(PyObject *py_object, const char *attr_name);
|
||||||
const char *py_object_get_optional_attr_string(PyObject *py_object, const char *attr_name);
|
const char *py_object_get_optional_attr_string(PyObject *py_object, const char *attr_name);
|
||||||
|
|
||||||
void py_object_set_attr_number(PyObject *py_object, const char *attr_name, long long number);
|
void py_object_set_attr_number(PyObject *py_object, const char *attr_name, long number);
|
||||||
void py_object_set_attr_string(PyObject *py_object, const char *attr_name, const char *value);
|
void py_object_set_attr_string(PyObject *py_object, const char *attr_name, const char *value);
|
||||||
|
|
||||||
PyObject *py_create_version(unsigned int version);
|
PyObject *py_create_version(unsigned int version);
|
||||||
|
Reference in New Issue
Block a user