[Python-checkins] python/dist/src/Python codecs.c,2.21,2.22
perky at users.sourceforge.net
perky at users.sourceforge.net
Sun Dec 28 20:36:04 EST 2003
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv16253/Python
Modified Files:
codecs.c
Log Message:
Fix gcc 3.3 warnings related to Py_UNICODE_WIDE.
Index: codecs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v
retrieving revision 2.21
retrieving revision 2.22
diff -C2 -d -r2.21 -r2.22
*** codecs.c 19 Mar 2003 00:35:35 -0000 2.21
--- codecs.c 29 Dec 2003 01:36:01 -0000 2.22
***************
*** 564,567 ****
--- 564,571 ----
else if (*p<10000)
ressize += 2+4+1;
+ #ifndef Py_UNICODE_WIDE
+ else
+ ressize += 2+5+1;
+ #else
else if (*p<100000)
ressize += 2+5+1;
***************
*** 570,573 ****
--- 574,578 ----
else
ressize += 2+7+1;
+ #endif
}
/* allocate replacement */
***************
*** 601,604 ****
--- 606,615 ----
base = 1000;
}
+ #ifndef Py_UNICODE_WIDE
+ else {
+ digits = 5;
+ base = 10000;
+ }
+ #else
else if (*p<100000) {
digits = 5;
***************
*** 613,616 ****
--- 624,628 ----
base = 1000000;
}
+ #endif
while (digits-->0) {
*outp++ = '0' + c/base;
***************
*** 656,662 ****
startp = PyUnicode_AS_UNICODE(object);
for (p = startp+start, ressize = 0; p < startp+end; ++p) {
if (*p >= 0x00010000)
ressize += 1+1+8;
! else if (*p >= 0x100) {
ressize += 1+1+4;
}
--- 668,677 ----
startp = PyUnicode_AS_UNICODE(object);
for (p = startp+start, ressize = 0; p < startp+end; ++p) {
+ #ifdef Py_UNICODE_WIDE
if (*p >= 0x00010000)
ressize += 1+1+8;
! else
! #endif
! if (*p >= 0x100) {
ressize += 1+1+4;
}
***************
*** 671,674 ****
--- 686,690 ----
Py_UNICODE c = *p;
*outp++ = '\\';
+ #ifdef Py_UNICODE_WIDE
if (c >= 0x00010000) {
*outp++ = 'U';
***************
*** 680,684 ****
*outp++ = hexdigits[(c>>8)&0xf];
}
! else if (c >= 0x100) {
*outp++ = 'u';
*outp++ = hexdigits[(c>>12)&0xf];
--- 696,702 ----
*outp++ = hexdigits[(c>>8)&0xf];
}
! else
! #endif
! if (c >= 0x100) {
*outp++ = 'u';
*outp++ = hexdigits[(c>>12)&0xf];
More information about the Python-checkins
mailing list