MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Stream_WriteLine

Function Stream_WriteLine

src/Stream.c:499–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499cc_result Stream_WriteLine(struct Stream* s, cc_string* text) {
500 cc_uint8 buffer[2048 + 10]; /* some space for newline */
501 const char* nl;
502 cc_uint8* cur;
503 cc_result res;
504 int i, len = 0;
505
506 for (i = 0; i < text->length; i++) {
507 /* For extremely large strings */
508 if (len >= 2048) {
509 if ((res = Stream_Write(s, buffer, len))) return res;
510 len = 0;
511 }
512
513 cur = buffer + len;
514 len += Convert_CP437ToUtf8(text->buffer[i], cur);
515 }
516
517 nl = _NL;
518 while (*nl) { buffer[len++] = *nl++; }
519 return Stream_Write(s, buffer, len);
520}

Callers 2

AppendChatLogFunction · 0.85
EntryList_SaveFunction · 0.85

Calls 2

Stream_WriteFunction · 0.85
Convert_CP437ToUtf8Function · 0.85

Tested by

no test coverage detected