mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-2329 always NUL-terminate the ID string for ID enumeration in C APIs
X-SVN-Rev: 12583
This commit is contained in:
parent
5b46dcd196
commit
a140572bbb
1 changed files with 12 additions and 1 deletions
|
@ -129,7 +129,11 @@ inline UBool positionIsValid(UTransPosition& index, int32_t len) {
|
|||
Transliterator::Transliterator(const UnicodeString& theID,
|
||||
UnicodeFilter* adoptedFilter) :
|
||||
UObject(), ID(theID), filter(adoptedFilter),
|
||||
maximumContextLength(0) {}
|
||||
maximumContextLength(0) {
|
||||
|
||||
// NUL-terminate the ID string
|
||||
ID.getTerminatedBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
@ -144,6 +148,10 @@ Transliterator::~Transliterator() {
|
|||
Transliterator::Transliterator(const Transliterator& other) :
|
||||
UObject(other), ID(other.ID), filter(0),
|
||||
maximumContextLength(other.maximumContextLength) {
|
||||
|
||||
// NUL-terminate the ID string
|
||||
ID.getTerminatedBuffer();
|
||||
|
||||
if (other.filter != 0) {
|
||||
// We own the filter, so we must have our own copy
|
||||
filter = (UnicodeFilter*) other.filter->clone();
|
||||
|
@ -155,6 +163,9 @@ Transliterator::Transliterator(const Transliterator& other) :
|
|||
*/
|
||||
Transliterator& Transliterator::operator=(const Transliterator& other) {
|
||||
ID = other.ID;
|
||||
// NUL-terminate the ID string
|
||||
ID.getTerminatedBuffer();
|
||||
|
||||
maximumContextLength = other.maximumContextLength;
|
||||
adoptFilter((other.filter == 0) ? 0 : (UnicodeFilter*) other.filter->clone());
|
||||
return *this;
|
||||
|
|
Loading…
Add table
Reference in a new issue