Esme Povirk (@madewokherd) commented about dlls/sane.ds/ds_image.c:
header = (BITMAPINFOHEADER *) GlobalLock(hDIB);header->biHeight = -y;p = ((BYTE *) header) + header->biSize + color_size;}/* Sane returns data in top down order. Acrobat does best witha bottom up DIB being returned. Flip image */header->biHeight *= -1;header->biSizeImage = dib_bytes;for (y = 0; y<header->biHeight / 2; y++){ptop = (DWORD *) (p + dib_bytes_per_line * y );pbot = (DWORD *) (p + dib_bytes_per_line * (header->biHeight-y-1) );for (i = dib_bytes_per_line/4; --i>=0; )
I'm not sure if this is correct or not. I think we should avoid side-effects in the loop condition.