<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2013/4/23 Rico Schüller <span dir="ltr"><<a href="mailto:kgbricola@web.de" target="_blank">kgbricola@web.de</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">On 22.04.2013 23:08, Christian Costa wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+typedef struct {<br>
+    DWORD bc2Size;<br>
+    DWORD bc2Width;<br>
+    DWORD bc2Height;<br>
+    WORD  bc2Planes;<br>
+    WORD  bc2BitCount;<br>
+    DWORD bc2Compression;<br>
+    DWORD bc2SizeImage;<br>
+    DWORD bc2XRes;<br>
+    DWORD bc2YRes;<br>
+    DWORD bc2ClrUsed;<br>
+    DWORD bc2ClrImportant;<br>
+    /* same as BITMAPINFOHEADER until this point */<br>
+    WORD  bc2ResUnit;<br>
+    WORD  bc2Reserved;<br>
+    WORD  bc2Orientation;<br>
+    WORD  bc2Halftoning;<br>
+    DWORD bc2HalftoneSize1;<br>
+    DWORD bc2HalftoneSize2;<br>
+    DWORD bc2ColorSpace;<br>
+    DWORD bc2AppData;<br>
+} BITMAPCOREHEADER2;<br>
</blockquote>
<br></div>
Do we really need a typedef here? For only locally used structs, I think we shouldn't use a typedef. Also the struct is only used to determine the size and for nothing else? There may be a better way to do that... Maybe something like in dlls/windowscodecs/icoformat.c ?<br>

<br>
I think you got inspired by dlls/windowscodecs/bmpdecode.<u></u>c, there is the same issue. Why do we need a typedef, if we only use it in one file to calculate the size?<br></blockquote><div><br></div><div>This is correct. Indeed using header_size == 64 /* sizeof(BITMAPCOREHEADER2) */ would be better.<br>
 <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
+    BITMAPFILEHEADER *header;<div class="im"><br>
<br>
+    if ((header_size == sizeof(BITMAPINFOHEADER)) ||<br>
+        (header_size == sizeof(BITMAPV4HEADER)) ||<br>
+        (header_size == sizeof(BITMAPV5HEADER)) ||<br>
+        (header_size == sizeof(BITMAPCOREHEADER2)))<br>
+    {<br>
+        /* All structures have the same memory layout as BITMAPINFOHEADER */<br></div>
+        BITMAPINFOHEADER*header = (BITMAPINFOHEADER*)*data;<div class="im"><br>
+        ULONG count = header->biClrUsed;<br>
<br></div><div class="im">
+    else if (header_size == sizeof(BITMAPCOREHEADER))<br>
+    {<br>
+        BITMAPCOREHEADER*header = (BITMAPCOREHEADER*)*data;<br>
</div></blockquote>
<br>
I don't think it's a good idea to use variable names multiple times. While this works fine it may be a bit confusing...<br>
<br>
</blockquote><div><br></div><div>I don't find it confusing but I don't mind changing it.<br></div></div><br></div></div>