Fix cell_as_unicode
This commit is contained in:
parent
1481fb4fe9
commit
7ff7947ab3
2 changed files with 5 additions and 1 deletions
|
|
@ -59,6 +59,7 @@ static inline PyObject* Py_XNewRef(PyObject *o) { Py_XINCREF(o); return o; }
|
|||
|
||||
typedef unsigned long long id_type;
|
||||
typedef uint32_t char_type;
|
||||
static_assert(sizeof(Py_UCS4) == sizeof(char_type), "PyUCS4 and char_type dont match");
|
||||
#define MAX_CHAR_TYPE_VALUE UINT32_MAX
|
||||
typedef uint32_t color_type;
|
||||
typedef uint16_t hyperlink_id_type;
|
||||
|
|
|
|||
|
|
@ -229,7 +229,10 @@ static size_t
|
|||
cell_as_unicode(ListOfChars *lc, bool include_cc, Py_UCS4 *buf, char_type zero_char) {
|
||||
size_t n = 1;
|
||||
buf[0] = lc->chars[0] ? lc->chars[0] : zero_char;
|
||||
if (include_cc && lc->count > 1) memcpy(buf + 1, lc->chars + 1, lc->count - 1);
|
||||
if (include_cc && lc->count > 1) {
|
||||
memcpy(buf + 1, lc->chars + 1, (lc->count - 1) * sizeof(lc->chars[0]));
|
||||
n += lc->count - 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue