From cb767f738d636b23290220f5988e3724d619b64b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 2 Jan 2014 14:16:49 +0100 Subject: [PATCH] msrle32: Append EOI instead of replacing EOL. --- dlls/msrle32/msrle32.c | 10 +++++---- dlls/msrle32/tests/msrle.c | 43 +++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/dlls/msrle32/msrle32.c b/dlls/msrle32/msrle32.c index 645e323cec0..d22b4129138 100644 --- a/dlls/msrle32/msrle32.c +++ b/dlls/msrle32/msrle32.c @@ -256,7 +256,7 @@ static LONG MSRLE32_GetMaxCompressedSize(LPCBITMAPINFOHEADER lpbi) } size = (2 + a * (2 + ((a + 2) & ~2)) + b * (2 + ((b + 2) & ~2))); - return size * lpbi->biHeight; + return size * lpbi->biHeight + 2; } /* lpP => current pos in previous frame @@ -820,14 +820,16 @@ LRESULT MSRLE32_CompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn, } } - /* add EOL -- will be changed to EOI */ + /* add EOL */ lpbiOut->biSizeImage += 2; *((LPWORD)lpOut) = 0; lpOut += sizeof(WORD); } - /* change EOL to EOI -- end of image */ - lpOut[-1] = 1; + /* add EOI -- end of image */ + lpbiOut->biSizeImage += 2; + *lpOut++ = 0; + *lpOut++ = 1; assert(lpOut == (lpOutStart + lpbiOut->biSizeImage)); return ICERR_OK; diff --git a/dlls/msrle32/tests/msrle.c b/dlls/msrle32/tests/msrle.c index 58dcc415a4c..1b7e68087ba 100644 --- a/dlls/msrle32/tests/msrle.c +++ b/dlls/msrle32/tests/msrle.c @@ -24,13 +24,40 @@ #include "wine/test.h" +static void test_output(const BYTE *output, int out_size, const BYTE *expect, int size) +{ + char buf[512], *ptr; + int i; + + i = out_size == size && !memcmp(output, expect, size); + ok(i, "Unexpected output\n"); + if(i) + return; + + for(i=0, ptr=buf; ibiSizeImage, output1, sizeof(output1)); + todo_wine ok(flags == (AVIIF_TWOCC|AVIIF_KEYFRAME), "flags = %x\n", flags); + + HeapFree(GetProcessHeap(), 0, output_header); + ICClose(hic); }