[Python-checkins] python/dist/src/Objects unicodectype.c,2.12,2.13

loewis@users.sourceforge.net loewis@users.sourceforge.net
2002年10月18日 09:40:39 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv21136/Objects
Modified Files:
	unicodectype.c 
Log Message:
Make lower/upper/title work for non-BMP characters.
Index: unicodectype.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodectype.c,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -d -r2.12 -r2.13
*** unicodectype.c	18 Oct 2002 16:11:53 -0000	2.12
--- unicodectype.c	18 Oct 2002 16:40:36 -0000	2.13
***************
*** 63,78 ****
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
 
 if (ctype->title)
! ch += ctype->title;
 else
! 	ch += ctype->upper;
 
! #ifdef Py_UNICODE_WIDE
! /* The database assumes that the values wrap around at 0x10000. */
! if (ch > 0x10000)
! 	ch -= 0x10000;
! #endif
! return ch;
 }
 
--- 63,77 ----
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
+ int delta;
 
 if (ctype->title)
! delta = ctype->title;
 else
! 	delta = ctype->upper;
 
! if (delta >= 32768)
! 	 delta -= 65536;
! 
! return ch + delta;
 }
 
***************
*** 359,370 ****
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
! 
! ch += ctype->upper;
! #ifdef Py_UNICODE_WIDE
! /* The database assumes that the values wrap around at 0x10000. */
! if (ch > 0x10000)
! 	ch -= 0x10000;
! #endif
! return ch;
 }
 
--- 358,365 ----
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
! int delta = ctype->upper;
! if (delta >= 32768)
! 	 delta -= 65536;
! return ch + delta;
 }
 
***************
*** 375,386 ****
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
! 
! ch += ctype->lower;
! #ifdef Py_UNICODE_WIDE
! /* The database assumes that the values wrap around at 0x10000. */
! if (ch > 0x10000)
! 	ch -= 0x10000;
! #endif
! return ch;
 }
 
--- 370,377 ----
 {
 const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
! int delta = ctype->lower;
! if (delta >= 32768)
! 	 delta -= 65536;
! return ch + delta;
 }
 

AltStyle によって変換されたページ (->オリジナル) /