ICU-2329 always NUL-terminate the ID string for ID enumeration in C APIs

X-SVN-Rev: 12587
This commit is contained in:
Markus Scherer 2003-07-02 21:23:39 +00:00
parent 9ec6b45611
commit bd62571a6c
2 changed files with 6 additions and 1 deletions

View File

@ -655,7 +655,10 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
if (visible) {
registerSTV(source, target, variant);
if (!availableIDs.contains((void*) &ID)) {
availableIDs.addElement(new UnicodeString(ID), status);
UnicodeString *newID = (UnicodeString *)ID.clone();
// NUL-terminate the ID string
newID->getTerminatedBuffer();
availableIDs.addElement(newID, status);
}
} else {
removeSTV(source, target, variant);

View File

@ -1241,6 +1241,8 @@ inline int32_t Transliterator::getMaximumContextLength(void) const {
inline void Transliterator::setID(const UnicodeString& id) {
ID = id;
// NUL-terminate the ID string
ID.getTerminatedBuffer();
}
inline Transliterator::Token Transliterator::integerToken(int32_t i) {