/*
******************************************************************************
*
-* Copyright (C) 2007-2011, International Business Machines
+* Copyright (C) 2007-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
// limit<=0x800. If limit==0x800 then limitLead=32 and limitTrail=0.
// In that case, bits=1<<limitLead is undefined but the bits value
// is not used because trail<limitTrail is already false.
- bits=1<<limitLead;
+ bits=(uint32_t)1<<((limitLead == 0x20) ? (limitLead - 1) : limitLead);
for(trail=0; trail<limitTrail; ++trail) {
table[trail]|=bits;
}
int32_t prev=length;
UChar32 c;
- if(b<0xc0) {
- // trail byte: collect a multi-byte character
- c=utf8_prevCharSafeBody(s, 0, &length, b, -1);
- if(c<0) {
- c=0xfffd;
- }
- } else {
- // lead byte in last-trail position
- c=0xfffd;
- }
+ // trail byte: collect a multi-byte character
+ // (or lead byte in last-trail position)
+ c=utf8_prevCharSafeBody(s, 0, &length, b, -3);
// c is a valid code point, not ASCII, not a surrogate
if(c<=0x7ff) {
if((USetSpanCondition)((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0) != spanCondition) {