Cleanup: rename Byte to Bytes in Python string utilities

These functions operate on byte arrays, not a single byte,
match naming for CPython's PyBytes_AS_STRING.
This commit is contained in:
2023-02-15 16:15:59 +11:00
parent 6661342dc5
commit e424931cf7
10 changed files with 33 additions and 33 deletions

View File

@@ -54,7 +54,7 @@ static PyObject *idprop_py_from_idp_string(const IDProperty *prop)
}
#ifdef USE_STRING_COERCE
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
return PyC_UnicodeFromBytesAndSize(IDP_Array(prop), prop->len - 1);
#else
return PyUnicode_FromStringAndSize(IDP_String(prop), prop->len - 1);
#endif
@@ -192,7 +192,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
int alloc_len;
PyObject *value_coerce = NULL;
st = (char *)PyC_UnicodeAsByte(value, &value_coerce);
st = (char *)PyC_UnicodeAsBytes(value, &value_coerce);
alloc_len = strlen(st) + 1;
st = PyUnicode_AsUTF8(value);
@@ -433,7 +433,7 @@ static IDProperty *idp_from_PyUnicode(const char *name, PyObject *ob)
#ifdef USE_STRING_COERCE
Py_ssize_t value_size;
PyObject *value_coerce = NULL;
val.string.str = PyC_UnicodeAsByteAndSize(ob, &value_size, &value_coerce);
val.string.str = PyC_UnicodeAsBytesAndSize(ob, &value_size, &value_coerce);
val.string.len = (int)value_size + 1;
val.string.subtype = IDP_STRING_SUB_UTF8;
prop = IDP_New(IDP_STRING, &val, name);