X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f59164e3d128c7675a4d3934206346a3384e53a5..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/tools/gennorm2/n2builder.cpp diff --git a/icuSources/tools/gennorm2/n2builder.cpp b/icuSources/tools/gennorm2/n2builder.cpp index a2c47f4a..66ccd700 100644 --- a/icuSources/tools/gennorm2/n2builder.cpp +++ b/icuSources/tools/gennorm2/n2builder.cpp @@ -1,12 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * -* Copyright (C) 2009-2014, International Business Machines +* Copyright (C) 2009-2016, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: n2builder.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -23,9 +25,7 @@ #include #include #include -#if U_HAVE_STD_STRING #include -#endif #include "unicode/errorcode.h" #include "unicode/localpointer.h" #include "unicode/putil.h" @@ -280,7 +280,7 @@ uint8_t Normalizer2DataBuilder::getCC(UChar32 c) const { static UBool isWellFormed(const UnicodeString &s) { UErrorCode errorCode=U_ZERO_ERROR; - u_strToUTF8(NULL, 0, NULL, s.getBuffer(), s.length(), &errorCode); + u_strToUTF8(NULL, 0, NULL, toUCharPtr(s.getBuffer()), s.length(), &errorCode); return U_SUCCESS(errorCode) || errorCode==U_BUFFER_OVERFLOW_ERROR; } @@ -313,7 +313,7 @@ void Normalizer2DataBuilder::setRoundTripMapping(UChar32 c, const UnicodeString (int)phase, (long)c); exit(U_INVALID_FORMAT_ERROR); } - int32_t numCP=u_countChar32(m.getBuffer(), m.length()); + int32_t numCP=u_countChar32(toUCharPtr(m.getBuffer()), m.length()); if(numCP!=2) { fprintf(stderr, "error in gennorm2 phase %d: " @@ -450,7 +450,7 @@ Normalizer2DataBuilder::decompose(UChar32 start, UChar32 end, uint32_t value) { Norm &norm=norms[value]; const UnicodeString &m=*norm.mapping; UnicodeString *decomposed=NULL; - const UChar *s=m.getBuffer(); + const UChar *s=toUCharPtr(m.getBuffer()); int32_t length=m.length(); int32_t prev, i=0; UChar32 c; @@ -605,7 +605,7 @@ Normalizer2DataBuilder::reorder(Norm *p, BuilderReorderingBuffer &buffer) { if(length>Normalizer2Impl::MAPPING_LENGTH_MASK) { return; // writeMapping() will complain about it and print the code point. } - const UChar *s=m.getBuffer(); + const UChar *s=toUCharPtr(m.getBuffer()); int32_t i=0; UChar32 c; while(i