/*
*******************************************************************************
*
-* Copyright (C) 2003-2007, International Business Machines
+* Copyright (C) 2003-2013, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
return result;
}
- if(0<=mb->f && mb->f<=2) {
+ if((0<=mb->f && mb->f<=2) || mb->f==4) {
break;
}
return result;
}
- if(0<=me->f && me->f<=2) {
+ if((0<=me->f && me->f<=2) || me->f==4) {
break;
}
break;
} else if(*s=='|') {
f=(int8_t)(s[1]-'0');
- if((uint8_t)f>3) {
- fprintf(stderr, "ucm error: fallback indicator must be |0..|3 - \"%s\"\n", line);
+ if((uint8_t)f>4) {
+ fprintf(stderr, "ucm error: fallback indicator must be |0..|4 - \"%s\"\n", line);
return FALSE;
}
break;
uint8_t bytes[UCNV_EXT_MAX_BYTES]) {
UCMapping *tm;
UChar32 c;
- int32_t index;
+ int32_t idx;
if(table->mappingsLength>=table->mappingsCapacity) {
/* make the mappings array larger */
}
if(m->uLen>1) {
- index=table->codePointsLength;
+ idx=table->codePointsLength;
table->codePointsLength+=m->uLen;
if(table->codePointsLength>table->codePointsCapacity) {
fprintf(stderr, "ucm error: too many code points in multiple-code point mappings\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
- uprv_memcpy(table->codePoints+index, codePoints, m->uLen*4);
- m->u=index;
+ uprv_memcpy(table->codePoints+idx, codePoints, m->uLen*4);
+ m->u=idx;
}
if(m->bLen>4) {
- index=table->bytesLength;
+ idx=table->bytesLength;
table->bytesLength+=m->bLen;
if(table->bytesLength>table->bytesCapacity) {
fprintf(stderr, "ucm error: too many bytes in mappings with >4 charset bytes\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
- uprv_memcpy(table->bytes+index, bytes, m->bLen);
- m->b.index=index;
+ uprv_memcpy(table->bytes+idx, bytes, m->bLen);
+ m->b.idx=idx;
}
/* set unicodeMask */
- for(index=0; index<m->uLen; ++index) {
- c=codePoints[index];
+ for(idx=0; idx<m->uLen; ++idx) {
+ c=codePoints[idx];
if(c>=0x10000) {
table->unicodeMask|=UCNV_HAS_SUPPLEMENTARY; /* there are supplementary code points */
} else if(U_IS_SURROGATE(c)) {
U_CAPI void U_EXPORT2
ucm_close(UCMFile *ucm) {
if(ucm!=NULL) {
- uprv_free(ucm->base);
- uprv_free(ucm->ext);
+ ucm_closeTable(ucm->base);
+ ucm_closeTable(ucm->ext);
uprv_free(ucm);
}
}
/*
* Suitable for an ICU conversion base table means:
* - a 1:1 mapping (1 Unicode code point : 1 byte sequence)
+ * - precision flag 0..3
* - SBCS: any 1:1 mapping
* (the table stores additional bits to distinguish mapping types)
* - MBCS: not a |2 SUB mapping for <subchar1>
* makeconv uses a hack for moving mappings only for the fromUnicode table
* that only works with non-negative values of f.
*/
- if( m->uLen==1 && count==1 &&
+ if( m->uLen==1 && count==1 && m->f<=3 &&
(baseStates->maxCharLength==1 ||
!((m->f==2 && m->bLen==1) ||
(m->f==1 && bytes[0]==0) ||
char line[500];
char *end;
UBool isOK;
-
+
if(U_FAILURE(*pErrorCode)) {
return;
}