@@ -143,19 +143,19 @@ namespace utf8
143
143
144
144
// Decode the trail bytes after the UTF8 lead byte c1 but returning 0xFFFD if trail bytes are expected after end.
145
145
_At_ (ptr, _In_reads_ (end - ptr) _Post_satisfies_ (ptr >= _Old_ (ptr) - 1 && ptr <= end))
146
- char16 DecodeTail (char16 c1, LPCUTF8& ptr, LPCUTF8 end, DecodeOptions& options);
146
+ char16 DecodeTail (char16 c1, LPCUTF8& ptr, LPCUTF8 end, DecodeOptions& options, bool *chunkEndsAtTruncatedSequence = nullptr );
147
147
148
148
// Decode the UTF8 sequence into a UTF16 encoding. Code points outside the Unicode base plain will generate
149
149
// surrogate pairs, using the 'doSecondSurrogatePair' option to remember the first word has already been returned.
150
150
// If ptr == end 0x0000 is emitted. If ptr < end but the lead byte of the UTF8 sequence
151
151
// expects trail bytes past end then 0xFFFD are emitted until ptr == end.
152
152
_At_ (ptr, _In_reads_ (end - ptr) _Post_satisfies_ (ptr >= _Old_ (ptr) && ptr <= end))
153
- inline char16 Decode (LPCUTF8& ptr, LPCUTF8 end, DecodeOptions& options)
153
+ inline char16 Decode (LPCUTF8& ptr, LPCUTF8 end, DecodeOptions& options, bool *chunkEndsAtTruncatedSequence = nullptr )
154
154
{
155
155
if (ptr >= end) return 0 ;
156
156
utf8char_t c1 = *ptr++;
157
157
if (c1 < 0x80 ) return static_cast <char16>(c1);
158
- return DecodeTail (c1, ptr, end, options);
158
+ return DecodeTail (c1, ptr, end, options, chunkEndsAtTruncatedSequence );
159
159
}
160
160
161
161
// Encode ch into a UTF8 sequence ignoring surrogate pairs (which are encoded as two
@@ -274,7 +274,7 @@ namespace utf8
274
274
275
275
// Decode cb bytes from ptr to into buffer returning the number of characters converted and written to buffer
276
276
_Ret_range_ (0 , pbEnd - _Old_ (pbUtf8))
277
- size_t DecodeUnitsInto (_Out_writes_ (pbEnd - pbUtf8) char16 *buffer, LPCUTF8& pbUtf8, LPCUTF8 pbEnd, DecodeOptions options = doDefault);
277
+ size_t DecodeUnitsInto (_Out_writes_ (pbEnd - pbUtf8) char16 *buffer, LPCUTF8& pbUtf8, LPCUTF8 pbEnd, DecodeOptions options = doDefault, bool *chunkEndsAtTruncatedSequence = nullptr );
278
278
279
279
// Decode cb bytes from ptr to into buffer returning the number of characters converted and written to buffer (excluding the null terminator)
280
280
size_t DecodeUnitsIntoAndNullTerminate (__out_ecount (pbEnd - pbUtf8 + 1 ) __nullterminated char16 *buffer, LPCUTF8& pbUtf8, LPCUTF8 pbEnd, DecodeOptions options = doDefault);
0 commit comments