/*
******************************************************************************
*
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
illegal=1;
break;
}
- case 2: /*fall through*/
+ U_FALLTHROUGH;
+ case 2:
trail=(uint8_t)(*s++ - 0x80);
if(trail>0x3f) {
/* not a trail byte */
break;
}
c=(c<<6)|trail;
- case 1: /*fall through*/
+ U_FALLTHROUGH;
+ case 1:
trail=(uint8_t)(*s++ - 0x80);
if(trail>0x3f) {
/* not a trail byte */
illegal=1;
break;
}
- case 2: /*fall through*/
+ U_FALLTHROUGH;
+ case 2:
trail=*s++;
c=(c<<6)|(trail&0x3f);
illegal|=(trail&0xc0)^0x80;
- case 1: /*fall through*/
+ U_FALLTHROUGH;
+ case 1:
trail=*s++;
c=(c<<6)|(trail&0x3f);
illegal|=(trail&0xc0)^0x80;
/* correct sequence - all trail bytes have (b7..b6)==(10)? */
/* illegal is also set if count>=4 */
- U_ASSERT(count<sizeof(utf8_minLegal)/sizeof(utf8_minLegal[0]));
+ U_ASSERT(illegal || count<UPRV_LENGTHOF(utf8_minLegal));
if(illegal || c<utf8_minLegal[count] || U_IS_SURROGATE(c)) {
/* error handling */
/* don't go beyond this sequence */
}
/* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
- pSrcLimit = pSrc + srcLength;
+ pSrcLimit = (pSrc == NULL) ? NULL : pSrc + srcLength;
for(;;) {
count = (int32_t)(pDestLimit - pDest);
srcLength = (int32_t)(pSrcLimit - pSrc);