[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.38,2.39
M.-A. Lemburg
python-dev@python.org
Fri, 7 Jul 2000 04:27:48 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv23307/Objects
Modified Files:
unicodeobject.c
Log Message:
Fix to bug #393 (UTF16 codec didn't like empty strings) and
corrected some usage of 'unsigned long' where Py_UNICODE
should have been used.
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.38
retrieving revision 2.39
diff -C2 -r2.38 -r2.39
*** unicodeobject.c 2000/07/07 09:47:24 2.38
--- unicodeobject.c 2000/07/07 11:27:45 2.39
***************
*** 954,965 ****
if (v == NULL)
return NULL;
- if (size == 0)
- goto done;
q = PyString_AS_STRING(v);
p = (Py_UNICODE *)q;
-
if (byteorder == 0)
*p++ = 0xFEFF;
if (byteorder == 0 ||
#ifdef BYTEORDER_IS_LITTLE_ENDIAN
--- 954,964 ----
if (v == NULL)
return NULL;
q = PyString_AS_STRING(v);
p = (Py_UNICODE *)q;
if (byteorder == 0)
*p++ = 0xFEFF;
+ if (size == 0)
+ goto done;
if (byteorder == 0 ||
#ifdef BYTEORDER_IS_LITTLE_ENDIAN
***************
*** 995,999 ****
static
int unicodeescape_decoding_error(const char **source,
! unsigned long *x,
const char *errors,
const char *details)
--- 994,998 ----
static
int unicodeescape_decoding_error(const char **source,
! Py_UNICODE *x,
const char *errors,
const char *details)
***************
*** 1010,1014 ****
}
else if (strcmp(errors,"replace") == 0) {
! *x = (unsigned long)Py_UNICODE_REPLACEMENT_CHARACTER;
return 0;
}
--- 1009,1013 ----
}
else if (strcmp(errors,"replace") == 0) {
! *x = Py_UNICODE_REPLACEMENT_CHARACTER;
return 0;
}
***************
*** 1064,1068 ****
while (s < end) {
unsigned char c;
! unsigned long x;
int i;
--- 1063,1067 ----
while (s < end) {
unsigned char c;
! Py_UNICODE x;
int i;
***************
*** 1373,1377 ****
while (s < end) {
unsigned char c;
! unsigned long x;
int i;
--- 1372,1376 ----
while (s < end) {
unsigned char c;
! Py_UNICODE x;
int i;