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
8fa2f16f
Commit
8fa2f16f
authored
Dec 29, 2003
by
Hye-Shik Chang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gcc 3.3 warnings related to Py_UNICODE_WIDE.
parent
4474fdf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
Objects/unicodectype.c
Objects/unicodectype.c
+4
-1
Python/codecs.c
Python/codecs.c
+20
-2
No files found.
Objects/unicodectype.c
View file @
8fa2f16f
...
@@ -36,9 +36,12 @@ gettyperecord(Py_UNICODE code)
...
@@ -36,9 +36,12 @@ gettyperecord(Py_UNICODE code)
{
{
int
index
;
int
index
;
#ifdef Py_UNICODE_WIDE
if
(
code
>=
0x110000
)
if
(
code
>=
0x110000
)
index
=
0
;
index
=
0
;
else
{
else
#endif
{
index
=
index1
[(
code
>>
SHIFT
)];
index
=
index1
[(
code
>>
SHIFT
)];
index
=
index2
[(
index
<<
SHIFT
)
+
(
code
&
((
1
<<
SHIFT
)
-
1
))];
index
=
index2
[(
index
<<
SHIFT
)
+
(
code
&
((
1
<<
SHIFT
)
-
1
))];
}
}
...
...
Python/codecs.c
View file @
8fa2f16f
...
@@ -563,12 +563,17 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
...
@@ -563,12 +563,17 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
ressize
+=
2
+
3
+
1
;
ressize
+=
2
+
3
+
1
;
else
if
(
*
p
<
10000
)
else
if
(
*
p
<
10000
)
ressize
+=
2
+
4
+
1
;
ressize
+=
2
+
4
+
1
;
#ifndef Py_UNICODE_WIDE
else
ressize
+=
2
+
5
+
1
;
#else
else
if
(
*
p
<
100000
)
else
if
(
*
p
<
100000
)
ressize
+=
2
+
5
+
1
;
ressize
+=
2
+
5
+
1
;
else
if
(
*
p
<
1000000
)
else
if
(
*
p
<
1000000
)
ressize
+=
2
+
6
+
1
;
ressize
+=
2
+
6
+
1
;
else
else
ressize
+=
2
+
7
+
1
;
ressize
+=
2
+
7
+
1
;
#endif
}
}
/* allocate replacement */
/* allocate replacement */
res
=
PyUnicode_FromUnicode
(
NULL
,
ressize
);
res
=
PyUnicode_FromUnicode
(
NULL
,
ressize
);
...
@@ -600,6 +605,12 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
...
@@ -600,6 +605,12 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
digits
=
4
;
digits
=
4
;
base
=
1000
;
base
=
1000
;
}
}
#ifndef Py_UNICODE_WIDE
else
{
digits
=
5
;
base
=
10000
;
}
#else
else
if
(
*
p
<
100000
)
{
else
if
(
*
p
<
100000
)
{
digits
=
5
;
digits
=
5
;
base
=
10000
;
base
=
10000
;
...
@@ -612,6 +623,7 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
...
@@ -612,6 +623,7 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
digits
=
7
;
digits
=
7
;
base
=
1000000
;
base
=
1000000
;
}
}
#endif
while
(
digits
-->
0
)
{
while
(
digits
-->
0
)
{
*
outp
++
=
'0'
+
c
/
base
;
*
outp
++
=
'0'
+
c
/
base
;
c
%=
base
;
c
%=
base
;
...
@@ -655,9 +667,12 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
...
@@ -655,9 +667,12 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
return
NULL
;
return
NULL
;
startp
=
PyUnicode_AS_UNICODE
(
object
);
startp
=
PyUnicode_AS_UNICODE
(
object
);
for
(
p
=
startp
+
start
,
ressize
=
0
;
p
<
startp
+
end
;
++
p
)
{
for
(
p
=
startp
+
start
,
ressize
=
0
;
p
<
startp
+
end
;
++
p
)
{
#ifdef Py_UNICODE_WIDE
if
(
*
p
>=
0x00010000
)
if
(
*
p
>=
0x00010000
)
ressize
+=
1
+
1
+
8
;
ressize
+=
1
+
1
+
8
;
else
if
(
*
p
>=
0x100
)
{
else
#endif
if
(
*
p
>=
0x100
)
{
ressize
+=
1
+
1
+
4
;
ressize
+=
1
+
1
+
4
;
}
}
else
else
...
@@ -670,6 +685,7 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
...
@@ -670,6 +685,7 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
p
<
startp
+
end
;
++
p
)
{
p
<
startp
+
end
;
++
p
)
{
Py_UNICODE
c
=
*
p
;
Py_UNICODE
c
=
*
p
;
*
outp
++
=
'\\'
;
*
outp
++
=
'\\'
;
#ifdef Py_UNICODE_WIDE
if
(
c
>=
0x00010000
)
{
if
(
c
>=
0x00010000
)
{
*
outp
++
=
'U'
;
*
outp
++
=
'U'
;
*
outp
++
=
hexdigits
[(
c
>>
28
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
28
)
&
0xf
];
...
@@ -679,7 +695,9 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
...
@@ -679,7 +695,9 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
*
outp
++
=
hexdigits
[(
c
>>
12
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
12
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
8
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
8
)
&
0xf
];
}
}
else
if
(
c
>=
0x100
)
{
else
#endif
if
(
c
>=
0x100
)
{
*
outp
++
=
'u'
;
*
outp
++
=
'u'
;
*
outp
++
=
hexdigits
[(
c
>>
12
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
12
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
8
)
&
0xf
];
*
outp
++
=
hexdigits
[(
c
>>
8
)
&
0xf
];
...
...
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