@@ -143,19 +143,19 @@ namespace utf8
143143
144144 // Decode the trail bytes after the UTF8 lead byte c1 but returning 0xFFFD if trail bytes are expected after end.
145145 _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 );
147147
148148 // Decode the UTF8 sequence into a UTF16 encoding. Code points outside the Unicode base plain will generate
149149 // surrogate pairs, using the 'doSecondSurrogatePair' option to remember the first word has already been returned.
150150 // If ptr == end 0x0000 is emitted. If ptr < end but the lead byte of the UTF8 sequence
151151 // expects trail bytes past end then 0xFFFD are emitted until ptr == end.
152152 _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 )
154154 {
155155 if (ptr >= end) return 0 ;
156156 utf8char_t c1 = *ptr++;
157157 if (c1 < 0x80 ) return static_cast <char16>(c1);
158- return DecodeTail (c1, ptr, end, options);
158+ return DecodeTail (c1, ptr, end, options, chunkEndsAtTruncatedSequence );
159159 }
160160
161161 // Encode ch into a UTF8 sequence ignoring surrogate pairs (which are encoded as two
@@ -274,7 +274,7 @@ namespace utf8
274274
275275 // Decode cb bytes from ptr to into buffer returning the number of characters converted and written to buffer
276276 _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 );
278278
279279 // Decode cb bytes from ptr to into buffer returning the number of characters converted and written to buffer (excluding the null terminator)
280280 size_t DecodeUnitsIntoAndNullTerminate (__out_ecount (pbEnd - pbUtf8 + 1 ) __nullterminated char16 *buffer, LPCUTF8& pbUtf8, LPCUTF8 pbEnd, DecodeOptions options = doDefault);
0 commit comments