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
4a264fb0
Commit
4a264fb0
authored
Dec 19, 2003
by
Hye-Shik Chang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF #859573: Reduce compiler warnings on gcc 3.2 and above.
parent
8d2e08dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+14
-1
No files found.
Objects/unicodeobject.c
View file @
4a264fb0
...
...
@@ -1556,7 +1556,11 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
{
PyObject
*
v
;
unsigned
char
*
p
;
#ifdef Py_UNICODE_WIDE
int
i
,
pairs
;
#else
const
int
pairs
=
0
;
#endif
/* Offsets from p for storing byte pairs in the right order. */
#ifdef BYTEORDER_IS_LITTLE_ENDIAN
int
ihi
=
1
,
ilo
=
0
;
...
...
@@ -1571,9 +1575,11 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
p += 2; \
} while(0)
#ifdef Py_UNICODE_WIDE
for
(
i
=
pairs
=
0
;
i
<
size
;
i
++
)
if
(
s
[
i
]
>=
0x10000
)
pairs
++
;
#endif
v
=
PyString_FromStringAndSize
(
NULL
,
2
*
(
size
+
pairs
+
(
byteorder
==
0
)));
if
(
v
==
NULL
)
...
...
@@ -1599,10 +1605,12 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
while
(
size
--
>
0
)
{
Py_UNICODE
ch
=
*
s
++
;
Py_UNICODE
ch2
=
0
;
#ifdef Py_UNICODE_WIDE
if
(
ch
>=
0x10000
)
{
ch2
=
0xDC00
|
((
ch
-
0x10000
)
&
0x3FF
);
ch
=
0xD800
|
((
ch
-
0x10000
)
>>
10
);
}
#endif
STORECHAR
(
ch
);
if
(
ch2
)
STORECHAR
(
ch2
);
...
...
@@ -2203,7 +2211,7 @@ PyObject *PyUnicode_DecodeLatin1(const char *s,
Py_UNICODE
*
p
;
/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */
if
(
size
==
1
&&
*
(
unsigned
char
*
)
s
<
256
)
{
if
(
size
==
1
)
{
Py_UNICODE
r
=
*
(
unsigned
char
*
)
s
;
return
PyUnicode_FromUnicode
(
&
r
,
1
);
}
...
...
@@ -2405,6 +2413,10 @@ static PyObject *unicode_encode_ucs1(const Py_UNICODE *p,
repsize
+=
2
+
2
+
1
;
else
if
(
*
p
<
1000
)
repsize
+=
2
+
3
+
1
;
#ifndef Py_UNICODE_WIDE
else
repsize
+=
2
+
4
+
1
;
#else
else
if
(
*
p
<
10000
)
repsize
+=
2
+
4
+
1
;
else
if
(
*
p
<
100000
)
...
...
@@ -2413,6 +2425,7 @@ static PyObject *unicode_encode_ucs1(const Py_UNICODE *p,
repsize
+=
2
+
6
+
1
;
else
repsize
+=
2
+
7
+
1
;
#endif
}
requiredsize
=
respos
+
repsize
+
(
endp
-
collend
);
if
(
requiredsize
>
ressize
)
{
...
...
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