diff options
Diffstat (limited to 'sources/shiboken2/libshiboken/sbkstring.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/sbkstring.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp index a3ffcdabb..d3c337524 100644 --- a/sources/shiboken2/libshiboken/sbkstring.cpp +++ b/sources/shiboken2/libshiboken/sbkstring.cpp @@ -46,7 +46,7 @@ namespace Shiboken namespace String { -bool checkType(PyTypeObject* type) +bool checkType(PyTypeObject *type) { return type == &PyUnicode_Type #if PY_MAJOR_VERSION < 3 @@ -55,7 +55,7 @@ bool checkType(PyTypeObject* type) ; } -bool check(PyObject* obj) +bool check(PyObject *obj) { return obj == Py_None || #if PY_MAJOR_VERSION < 3 @@ -64,17 +64,17 @@ bool check(PyObject* obj) PyUnicode_Check(obj); } -bool checkChar(PyObject* pyobj) +bool checkChar(PyObject *pyobj) { return check(pyobj) && (len(pyobj) == 1); } -bool isConvertible(PyObject* obj) +bool isConvertible(PyObject *obj) { return check(obj); } -PyObject* fromCString(const char* value) +PyObject *fromCString(const char *value) { #ifdef IS_PY3K return PyUnicode_FromString(value); @@ -83,7 +83,7 @@ PyObject* fromCString(const char* value) #endif } -PyObject* fromCString(const char* value, int len) +PyObject *fromCString(const char *value, int len) { #ifdef IS_PY3K return PyUnicode_FromStringAndSize(value, len); @@ -92,13 +92,13 @@ PyObject* fromCString(const char* value, int len) #endif } -const char* toCString(PyObject* str, Py_ssize_t* len) +const char *toCString(PyObject *str, Py_ssize_t *len) { if (str == Py_None) return NULL; if (PyUnicode_Check(str)) { if (len) { - // We need to encode the unicode string into utf8 to know the size of returned char*. + // We need to encode the unicode string into utf8 to know the size of returned char *. Shiboken::AutoDecRef uniStr(PyUnicode_AsUTF8String(str)); *len = PyBytes_GET_SIZE(uniStr.object()); } @@ -122,10 +122,10 @@ const char* toCString(PyObject* str, Py_ssize_t* len) return 0; } -bool concat(PyObject** val1, PyObject* val2) +bool concat(PyObject **val1, PyObject *val2) { if (PyUnicode_Check(*val1) && PyUnicode_Check(val2)) { - PyObject* result = PyUnicode_Concat(*val1, val2); + PyObject *result = PyUnicode_Concat(*val1, val2); Py_DECREF(*val1); *val1 = result; return true; @@ -145,11 +145,11 @@ bool concat(PyObject** val1, PyObject* val2) return false; } -PyObject* fromFormat(const char* format, ...) +PyObject *fromFormat(const char *format, ...) { va_list argp; va_start(argp, format); - PyObject* result = 0; + PyObject *result = nullptr; #ifdef IS_PY3K result = PyUnicode_FromFormatV(format, argp); #else @@ -159,7 +159,7 @@ PyObject* fromFormat(const char* format, ...) return result; } -PyObject* fromStringAndSize(const char* str, Py_ssize_t size) +PyObject *fromStringAndSize(const char *str, Py_ssize_t size) { #ifdef IS_PY3K return PyUnicode_FromStringAndSize(str, size); @@ -168,15 +168,15 @@ PyObject* fromStringAndSize(const char* str, Py_ssize_t size) #endif } -int compare(PyObject* val1, const char* val2) +int compare(PyObject *val1, const char *val2) { if (PyUnicode_Check(val1)) #ifdef IS_PY3K return PyUnicode_CompareWithASCIIString(val1, val2); #else { - PyObject* uVal2 = PyUnicode_FromString(val2); - bool result = PyUnicode_Compare(val1, uVal2); + PyObject *uVal2 = PyUnicode_FromString(val2); + bool result = PyUnicode_Compare(val1, uVal2); Py_XDECREF(uVal2); return result; } @@ -187,7 +187,7 @@ int compare(PyObject* val1, const char* val2) } -Py_ssize_t len(PyObject* str) +Py_ssize_t len(PyObject *str) { if (str == Py_None) return 0; |