+// © 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
*
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if U_HAVE_STD_STRING
#include <vector>
-#endif
#include "unicode/errorcode.h"
#include "unicode/localpointer.h"
#include "unicode/putil.h"
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;
}
(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: "
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;
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<length) {
}
udata_writeBlock(pData, indexes, sizeof(indexes));
udata_writeBlock(pData, norm16TrieBytes.getAlias(), norm16TrieLength);
- udata_writeUString(pData, extraData.getBuffer(), extraData.length());
+ udata_writeUString(pData, toUCharPtr(extraData.getBuffer()), extraData.length());
udata_writeBlock(pData, smallFCD, sizeof(smallFCD));
int32_t writtenSize=udata_finish(pData, errorCode);
if(errorCode.isFailure()) {
exit(U_FILE_ACCESS_ERROR);
return;
}
+ fputs("#ifdef INCLUDED_FROM_NORMALIZER2_CPP\n\n", f);
char line[100];
sprintf(line, "static const UVersionInfo %s_formatVersion={", dataName.data());
usrc_writeArray(f, line, dataInfo.formatVersion, 8, 4, "};\n");
line,
norm16Trie, line2, NULL,
"};\n");
+ fputs("\n#endif // INCLUDED_FROM_NORMALIZER2_CPP\n", f);
fclose(f);
}