[Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204,
2.205
perky at users.sourceforge.net
perky at users.sourceforge.net
Thu Dec 18 20:59:58 EST 2003
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects
Modified Files:
unicodeobject.c
Log Message:
SF #859573: Reduce compiler warnings on gcc 3.2 and above.
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.204
retrieving revision 2.205
diff -C2 -d -r2.204 -r2.205
*** unicodeobject.c 15 Dec 2003 18:49:19 -0000 2.204
--- unicodeobject.c 19 Dec 2003 01:59:56 -0000 2.205
***************
*** 1557,1561 ****
--- 1557,1565 ----
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
***************
*** 1572,1578 ****
--- 1576,1584 ----
} 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)));
***************
*** 1600,1607 ****
--- 1606,1615 ----
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)
***************
*** 2204,2208 ****
/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */
! if (size == 1 && *(unsigned char*)s < 256) {
Py_UNICODE r = *(unsigned char*)s;
return PyUnicode_FromUnicode(&r, 1);
--- 2212,2216 ----
/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */
! if (size == 1) {
Py_UNICODE r = *(unsigned char*)s;
return PyUnicode_FromUnicode(&r, 1);
***************
*** 2406,2409 ****
--- 2414,2421 ----
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;
***************
*** 2414,2417 ****
--- 2426,2430 ----
else
repsize += 2+7+1;
+ #endif
}
requiredsize = respos+repsize+(endp-collend);
More information about the Python-checkins
mailing list