Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
17222160
Commit
17222160
authored
Sep 28, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark _PyUnicode_FindMaxCharAndNumSurrogatePairs() as private
parent
fd85c3aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
19 deletions
+10
-19
Include/unicodeobject.h
Include/unicodeobject.h
+0
-12
Objects/unicodeobject.c
Objects/unicodeobject.c
+10
-7
No files found.
Include/unicodeobject.h
View file @
17222160
...
...
@@ -543,18 +543,6 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
);
#endif
/* Find the maximum code point and count the number of surrogate pairs so a
correct string length can be computed before converting a string to UCS4.
This function counts single surrogates as a character and not as a pair. */
#ifndef Py_LIMITED_API
PyAPI_FUNC
(
int
)
_PyUnicode_FindMaxCharAndNumSurrogatePairs
(
const
wchar_t
*
begin
,
const
wchar_t
*
end
,
Py_UCS4
*
maxchar
,
Py_ssize_t
*
num_surrogates
);
#endif
/* Create a Unicode Object from the Py_UNICODE buffer u of the given
size.
...
...
Objects/unicodeobject.c
View file @
17222160
...
...
@@ -708,11 +708,14 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
return
-
1
;
}
int
_PyUnicode_FindMaxCharAndNumSurrogatePairs
(
const
wchar_t
*
begin
,
const
wchar_t
*
end
,
Py_UCS4
*
maxchar
,
Py_ssize_t
*
num_surrogates
)
/* Find the maximum code point and count the number of surrogate pairs so a
correct string length can be computed before converting a string to UCS4.
This function counts single surrogates as a character and not as a pair.
Return 0 on success, or -1 on error. */
static
int
find_maxchar_surrogates
(
const
wchar_t
*
begin
,
const
wchar_t
*
end
,
Py_UCS4
*
maxchar
,
Py_ssize_t
*
num_surrogates
)
{
const
wchar_t
*
iter
;
...
...
@@ -789,7 +792,7 @@ _PyUnicode_Ready(PyUnicodeObject *unicode)
#endif
end
=
_PyUnicode_WSTR
(
unicode
)
+
_PyUnicode_WSTR_LENGTH
(
unicode
);
if
(
_PyUnicode_FindMaxCharAndNumSurrogatePair
s
(
_PyUnicode_WSTR
(
unicode
),
end
,
if
(
find_maxchar_surrogate
s
(
_PyUnicode_WSTR
(
unicode
),
end
,
&
maxchar
,
&
num_surrogates
)
==
-
1
)
{
assert
(
0
&&
"PyUnicode_FindMaxCharAndNumSurrogatePairs failed"
);
...
...
@@ -1022,7 +1025,7 @@ PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
/* If not empty and not single character, copy the Unicode data
into the new object */
if
(
_PyUnicode_FindMaxCharAndNumSurrogatePair
s
(
u
,
u
+
size
,
&
maxchar
,
if
(
find_maxchar_surrogate
s
(
u
,
u
+
size
,
&
maxchar
,
&
num_surrogates
)
==
-
1
)
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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