Skip to content

Commit

Permalink
optimise .cw exporting for C client
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Aug 16, 2018
1 parent 1d6e422 commit b547d31
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 266 deletions.
11 changes: 7 additions & 4 deletions src/Client/Bitmap.c
Expand Up @@ -655,9 +655,12 @@ ReturnCode Bitmap_EncodePng(struct Bitmap* bmp, struct Stream* stream) {
UInt8* prev = (y & 1) == 0 ? prevLine : curLine;
UInt8* cur = (y & 1) == 0 ? curLine : prevLine;
Png_EncodeRow(src, cur, prev, bestLine, lineSize);
Stream_Write(&zlStream, bestLine, lineSize + 1); /* +1 for filter byte */

result = Stream_TryWrite(&zlStream, bestLine, lineSize + 1); /* +1 for filter byte */
if (result) return result;
}
zlStream.Close(&zlStream);
result = zlStream.Close(&zlStream);
if (result) return result;
}
stream = underlying;
Stream_WriteU32_BE(stream, crc32Stream.Meta.CRC32.CRC32 ^ 0xFFFFFFFFUL);
Expand All @@ -676,6 +679,6 @@ ReturnCode Bitmap_EncodePng(struct Bitmap* bmp, struct Stream* stream) {
result = stream->Seek(stream, 33, STREAM_SEEKFROM_BEGIN);
if (result) return result;

Stream_WriteU32_BE(stream, stream_len - 57);
return 0;
Stream_SetU32_BE(&tmp[0], stream_len - 57);
return Stream_TryWrite(stream, tmp, sizeof(UInt32));
}
5 changes: 4 additions & 1 deletion src/Client/Chat.c
Expand Up @@ -131,7 +131,10 @@ static void Chat_AppendLog(STRING_PURE String* text) {
String_Format3(&str, "[%p2:%p2:%p2] ", &hour, &minute, &second);
String_AppendColorless(&str, text);

Stream_WriteLine(&Chat_LogStream, &str);
ReturnCode result = Stream_WriteLine(&Chat_LogStream, &str);
if (!result) return;
ErrorHandler_LogError_Path(result, "appending to", &Chat_LogStream.Name);
Chat_DisableLogging(); return;
}

void Chat_AddRaw(const UChar* raw) {
Expand Down

0 comments on commit b547d31

Please sign in to comment.