+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2016, International Business Machines Corporation and
#include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "unicode/uset.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
#include "cintltst.h"
#include "cmemory.h"
if (currCh == SURROGATE_HIGH_START) {
currCh = SURROGATE_LOW_END + 1; /* Skip surrogate range */
}
- UTF16_APPEND_CHAR_SAFE(standardForm, offset16, MAX_LENGTH, currCh);
- UTF8_APPEND_CHAR_SAFE(utf8, offset8, MAX_LENGTH, currCh);
+ U16_APPEND_UNSAFE(standardForm, offset16, currCh);
+ U8_APPEND_UNSAFE(utf8, offset8, currCh);
currCh++;
}
if(!convertFromU(standardForm, offset16,
if (currCh == SURROGATE_HIGH_START) {
currCh = SURROGATE_LOW_END + 1; /* Skip surrogate range */
}
- UTF16_APPEND_CHAR_SAFE(standardForm, offset16, MAX_LENGTH, currCh);
- UTF32_APPEND_CHAR_SAFE(utf32, offset32, MAX_LENGTH, currCh);
+ U16_APPEND_UNSAFE(standardForm, offset16, currCh);
+ utf32[offset32++] = currCh;
currCh++;
}
if(!convertFromU(standardForm, offset16,
{
const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c,
0xe0, 0x80, 0x61};
- UChar expected1[] = { 0x0031, 0x4e8c, 0xfffd, 0x0061};
- int32_t offsets1[] = { 0x0000, 0x0001, 0x0004, 0x0006};
+ UChar expected1[] = { 0x0031, 0x4e8c, 0xfffd, 0xfffd, 0x0061};
+ int32_t offsets1[] = { 0x0000, 0x0001, 0x0004, 0x0005, 0x0006};
if(!testConvertToU(sampleText1, sizeof(sampleText1),
expected1, UPRV_LENGTHOF(expected1),"utf8", UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets1,FALSE))