mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix positions for non-BMP chars in the matcher
All tests now pass on python3
This commit is contained in:
parent
c8355e17b2
commit
4f1a6c16c6
@ -164,7 +164,7 @@ static void convert_positions(int32_t *positions, int32_t *final_positions, UCha
|
|||||||
for (i = 0; i < byte_len && final_positions < end; i++) {
|
for (i = 0; i < byte_len && final_positions < end; i++) {
|
||||||
if (positions[i] == -1) continue;
|
if (positions[i] == -1) continue;
|
||||||
#if PY_VERSION_HEX >= 0x03030000
|
#if PY_VERSION_HEX >= 0x03030000
|
||||||
*final_positions = positions[i];
|
*final_positions = u_countChar32(string, positions[i]);
|
||||||
#else
|
#else
|
||||||
#ifdef Py_UNICODE_WIDE
|
#ifdef Py_UNICODE_WIDE
|
||||||
*final_positions = u_countChar32(string, positions[i]);
|
*final_positions = u_countChar32(string, positions[i]);
|
||||||
@ -538,4 +538,4 @@ CALIBRE_MODINIT_FUNC initmatcher(void) {
|
|||||||
#if PY_MAJOR_VERSION >= 3
|
#if PY_MAJOR_VERSION >= 3
|
||||||
return mod;
|
return mod;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user