Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2022-07-30 08:49:22 +08:00
commit 1822f2031e
3280 changed files with 281114 additions and 237673 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utext.cpp
* encoding: US-ASCII
* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@ -1201,9 +1201,9 @@ fillForward:
// Swap the UText buffers.
// We want to fill what was previously the alternate buffer,
// and make what was the current buffer be the new alternate.
UTF8Buf *u8b = (UTF8Buf *)ut->q;
UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
ut->q = ut->p;
ut->p = u8b;
ut->p = u8b_swap;
int32_t strLen = ut->b;
UBool nulTerminated = FALSE;
@ -1212,9 +1212,9 @@ fillForward:
nulTerminated = TRUE;
}
UChar *buf = u8b->buf;
uint8_t *mapToNative = u8b->mapToNative;
uint8_t *mapToUChars = u8b->mapToUChars;
UChar *buf = u8b_swap->buf;
uint8_t *mapToNative = u8b_swap->mapToNative;
uint8_t *mapToUChars = u8b_swap->mapToUChars;
int32_t destIx = 0;
int32_t srcIx = ix;
UBool seenNonAscii = FALSE;
@ -1235,7 +1235,7 @@ fillForward:
// General case, handle everything.
if (seenNonAscii == FALSE) {
seenNonAscii = TRUE;
u8b->bufNILimit = destIx;
u8b_swap->bufNILimit = destIx;
}
int32_t cIx = srcIx;
@ -1268,22 +1268,22 @@ fillForward:
mapToUChars[srcIx - ix] = (uint8_t)destIx;
// fill in Buffer descriptor
u8b->bufNativeStart = ix;
u8b->bufNativeLimit = srcIx;
u8b->bufStartIdx = 0;
u8b->bufLimitIdx = destIx;
u8b_swap->bufNativeStart = ix;
u8b_swap->bufNativeLimit = srcIx;
u8b_swap->bufStartIdx = 0;
u8b_swap->bufLimitIdx = destIx;
if (seenNonAscii == FALSE) {
u8b->bufNILimit = destIx;
u8b_swap->bufNILimit = destIx;
}
u8b->toUCharsMapStart = u8b->bufNativeStart;
u8b_swap->toUCharsMapStart = u8b_swap->bufNativeStart;
// Set UText chunk to refer to this buffer.
ut->chunkContents = buf;
ut->chunkOffset = 0;
ut->chunkLength = u8b->bufLimitIdx;
ut->chunkNativeStart = u8b->bufNativeStart;
ut->chunkNativeLimit = u8b->bufNativeLimit;
ut->nativeIndexingLimit = u8b->bufNILimit;
ut->chunkLength = u8b_swap->bufLimitIdx;
ut->chunkNativeStart = u8b_swap->bufNativeStart;
ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
ut->nativeIndexingLimit = u8b_swap->bufNILimit;
// For zero terminated strings, keep track of the maximum point
// scanned so far.
@ -1316,7 +1316,7 @@ fillReverse:
// Swap the UText buffers.
// We want to fill what was previously the alternate buffer,
// and make what was the current buffer be the new alternate.
UTF8Buf *u8b = (UTF8Buf *)ut->q;
UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
ut->q = ut->p;
ut->p = u8b;
@ -1392,19 +1392,19 @@ fillReverse:
bufNILimit = destIx;
}
}
u8b->bufNativeStart = srcIx;
u8b->bufNativeLimit = ix;
u8b->bufStartIdx = destIx;
u8b->bufLimitIdx = UTF8_TEXT_CHUNK_SIZE+2;
u8b->bufNILimit = bufNILimit - u8b->bufStartIdx;
u8b->toUCharsMapStart = toUCharsMapStart;
u8b_swap->bufNativeStart = srcIx;
u8b_swap->bufNativeLimit = ix;
u8b_swap->bufStartIdx = destIx;
u8b_swap->bufLimitIdx = UTF8_TEXT_CHUNK_SIZE+2;
u8b_swap->bufNILimit = bufNILimit - u8b_swap->bufStartIdx;
u8b_swap->toUCharsMapStart = toUCharsMapStart;
ut->chunkContents = &buf[u8b->bufStartIdx];
ut->chunkLength = u8b->bufLimitIdx - u8b->bufStartIdx;
ut->chunkContents = &buf[u8b_swap->bufStartIdx];
ut->chunkLength = u8b_swap->bufLimitIdx - u8b_swap->bufStartIdx;
ut->chunkOffset = ut->chunkLength;
ut->chunkNativeStart = u8b->bufNativeStart;
ut->chunkNativeLimit = u8b->bufNativeLimit;
ut->nativeIndexingLimit = u8b->bufNILimit;
ut->chunkNativeStart = u8b_swap->bufNativeStart;
ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
ut->nativeIndexingLimit = u8b_swap->bufNILimit;
return TRUE;
}
@ -2243,13 +2243,13 @@ unistrTextCopy(UText *ut,
}
if(move) {
// move: copy to destIndex, then replace original with nothing
// move: copy to destIndex, then remove original
int32_t segLength=limit32-start32;
us->copy(start32, limit32, destIndex32);
if(destIndex32<start32) {
start32+=segLength;
}
us->replace(start32, segLength, NULL, 0);
us->remove(start32, segLength);
} else {
// copy
us->copy(start32, limit32, destIndex32);