Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UnsafeGetUTF8Chars()

unsafe int System.Xml.XmlStreamNodeWriter.UnsafeGetUTF8Chars ( char * chars,
int charCount,
byte[] buffer,
int offset )
inlineprotectedinherited

Definition at line 336 of file XmlStreamNodeWriter.cs.

337 {
338 if (charCount > 0)
339 {
340 fixed (byte* ptr = &buffer[offset])
341 {
342 byte* ptr2 = ptr;
343 byte* ptr3 = ptr2 + (buffer.Length - offset);
344 char* ptr4 = chars + charCount;
345 do
346 {
347 IL_0045:
348 if (chars < ptr4)
349 {
350 char c = *chars;
351 if (c < '\u0080')
352 {
353 *ptr2 = (byte)c;
354 ptr2++;
355 chars++;
356 goto IL_0045;
357 }
358 }
359 if (chars >= ptr4)
360 {
361 break;
362 }
363 char* ptr5 = chars;
364 while (chars < ptr4 && *chars >= '\u0080')
365 {
366 chars++;
367 }
368 ptr2 += (_encoding ?? s_UTF8Encoding).GetBytes(ptr5, (int)(chars - ptr5), ptr2, (int)(ptr3 - ptr2));
369 }
370 while (chars < ptr4);
371 return (int)(ptr2 - ptr);
372 }
373 }
374 return 0;
375 }
static readonly UTF8Encoding s_UTF8Encoding

References System.Xml.XmlStreamNodeWriter._encoding, System.buffer, System.charCount, System.chars, System.Xml.Dictionary, System.offset, and System.Xml.XmlStreamNodeWriter.s_UTF8Encoding.

Referenced by System.Xml.XmlBinaryNodeWriter.UnsafeWriteName(), System.Xml.XmlBinaryNodeWriter.UnsafeWriteText(), and System.Xml.XmlStreamNodeWriter.UnsafeWriteUTF8Chars().