Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
main
pyicu
Commits
471966eb
Commit
471966eb
authored
Oct 24, 2022
by
Andi Vajda
Browse files
improved max_char fix (Markus)
parent
8634a759
Changes
1
Hide whitespace changes
Inline
Side-by-side
common.cpp
View file @
471966eb
/* ====================================================================
* Copyright (c) 2005-20
19
Open Source Applications Foundation.
* Copyright (c) 2005-20
22
Open Source Applications Foundation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
...
...
@@ -33,6 +33,10 @@
#include
"bases.h"
#include
"macros.h"
// From Python's Object/unicodeobject.c
// Maximum code point of Unicode 6.0: 0x10ffff (1,114,111).
#define MAX_UNICODE 0x10ffff
static
PyObject
*
utcoffset_NAME
;
static
PyObject
*
toordinal_NAME
;
static
PyObject
*
getDefault_NAME
;
...
...
@@ -206,10 +210,11 @@ EXPORT PyObject *PyUnicode_FromUnicodeString(const UChar *utf16, int len16)
UChar32
cp
;
U16_NEXT
(
utf16
,
i
,
len16
,
cp
);
if
(
cp
>
max_char
)
max_char
=
cp
;
max_char
|=
cp
;
// we only care about the leftmost bit
len32
+=
1
;
}
if
(
max_char
>
MAX_UNICODE
)
max_char
=
MAX_UNICODE
;
PyObject
*
result
=
PyUnicode_New
(
len32
,
max_char
);
...
...
Andi Vajda
@vajda
mentioned in commit
8634a759
·
Oct 25, 2022
mentioned in commit
8634a759
mentioned in commit 8634a759c419f588fd38a156e4c8d02f931516f0
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment