wrc: Remove duplicate code (PVS-Studio).

This commit is contained in:
André Hentschel 2014-10-28 00:02:09 +01:00 committed by Alexandre Julliard
parent 88e8102570
commit 9b810cd6e8
1 changed files with 61 additions and 117 deletions

View File

@ -960,86 +960,48 @@ static res_t *cursorgroup2res(name_id_t *name, cursor_group_t *curg)
res = new_res();
restag = put_res_header(res, WRC_RT_GROUP_CURSOR, NULL, name, curg->memopt, &(curg->lvc));
if(win32)
{
put_word(res, 0); /* Reserved */
/* FIXME: The ResType in the NEWHEADER structure should
* contain 14 according to the MS win32 doc. This is
* not the case with the BRC compiler and I really doubt
* the latter. Putting one here is compliant to win16 spec,
* but who knows the true value?
*/
put_word(res, 2); /* ResType */
put_word(res, curg->ncursor);
put_word(res, 0); /* Reserved */
/* FIXME: The ResType in the NEWHEADER structure should
* contain 14 according to the MS win32 doc. This is
* not the case with the BRC compiler and I really doubt
* the latter. Putting one here is compliant to win16 spec,
* but who knows the true value?
*/
put_word(res, 2); /* ResType */
put_word(res, curg->ncursor);
#if 0
for(cur = curg->cursorlist; cur; cur = cur->next)
for(cur = curg->cursorlist; cur; cur = cur->next)
#else
cur = curg->cursorlist;
while(cur->next)
cur = cur->next;
for(; cur; cur = cur->prev)
cur = curg->cursorlist;
while(cur->next)
cur = cur->next;
for(; cur; cur = cur->prev)
#endif
{
put_word(res, cur->width);
/* FIXME: The height of a cursor is half the size of
* the bitmap's height. BRC puts the height from the
* BITMAPINFOHEADER here instead of the cursorfile's
* height. MS doesn't seem to care...
*/
put_word(res, cur->height);
/* FIXME: The next two are reversed in BRC and I don't
* know why. Probably a bug. But, we can safely ignore
* it because win16 does not support color cursors.
* A warning should have been generated by the parser.
*/
put_word(res, cur->planes);
put_word(res, cur->bits);
/* FIXME: The +4 is the hotspot in the cursor resource.
* However, I could not find this in the documentation.
* The hotspot bytes must either be included or MS
* doesn't care.
*/
put_dword(res, cur->data->size +4);
put_word(res, cur->id);
}
}
else /* win16 */
{
put_word(res, 0); /* Reserved */
put_word(res, 2); /* ResType */
put_word(res, curg->ncursor);
#if 0
for(cur = curg->cursorlist; cur; cur = cur->next)
#else
cur = curg->cursorlist;
while(cur->next)
cur = cur->next;
for(; cur; cur = cur->prev)
#endif
{
put_word(res, cur->width);
/* FIXME: The height of a cursor is half the size of
* the bitmap's height. BRC puts the height from the
* BITMAPINFOHEADER here instead of the cursorfile's
* height. MS doesn't seem to care...
*/
put_word(res, cur->height);
/* FIXME: The next two are reversed in BRC and I don't
* know why. Probably a bug. But, we can safely ignore
* it because win16 does not support color cursors.
* A warning should have been generated by the parser.
*/
put_word(res, cur->planes);
put_word(res, cur->bits);
/* FIXME: The +4 is the hotspot in the cursor resource.
* However, I could not find this in the documentation.
* The hotspot bytes must either be included or MS
* doesn't care.
*/
put_dword(res, cur->data->size +4);
put_word(res, cur->id);
}
}
{
put_word(res, cur->width);
/* FIXME: The height of a cursor is half the size of
* the bitmap's height. BRC puts the height from the
* BITMAPINFOHEADER here instead of the cursorfile's
* height. MS doesn't seem to care...
*/
put_word(res, cur->height);
/* FIXME: The next two are reversed in BRC and I don't
* know why. Probably a bug. But, we can safely ignore
* it because win16 does not support color cursors.
* A warning should have been generated by the parser.
*/
put_word(res, cur->planes);
put_word(res, cur->bits);
/* FIXME: The +4 is the hotspot in the cursor resource.
* However, I could not find this in the documentation.
* The hotspot bytes must either be included or MS
* doesn't care.
*/
put_dword(res, cur->data->size +4);
put_word(res, cur->id);
}
SetResSize(res, restag); /* Set ResourceSize */
if(win32)
put_pad(res);
@ -1103,46 +1065,28 @@ static res_t *icongroup2res(name_id_t *name, icon_group_t *icog)
res = new_res();
restag = put_res_header(res, WRC_RT_GROUP_ICON, NULL, name, icog->memopt, &(icog->lvc));
if(win32)
{
put_word(res, 0); /* Reserved */
/* FIXME: The ResType in the NEWHEADER structure should
* contain 14 according to the MS win32 doc. This is
* not the case with the BRC compiler and I really doubt
* the latter. Putting one here is compliant to win16 spec,
* but who knows the true value?
*/
put_word(res, 1); /* ResType */
put_word(res, icog->nicon);
for(ico = icog->iconlist; ico; ico = ico->next)
{
put_byte(res, ico->width);
put_byte(res, ico->height);
put_byte(res, ico->nclr);
put_byte(res, 0); /* Reserved */
put_word(res, ico->planes);
put_word(res, ico->bits);
put_dword(res, ico->data->size);
put_word(res, ico->id);
}
}
else /* win16 */
{
put_word(res, 0); /* Reserved */
put_word(res, 1); /* ResType */
put_word(res, icog->nicon);
for(ico = icog->iconlist; ico; ico = ico->next)
{
put_byte(res, ico->width);
put_byte(res, ico->height);
put_byte(res, ico->nclr);
put_byte(res, 0); /* Reserved */
put_word(res, ico->planes);
put_word(res, ico->bits);
put_dword(res, ico->data->size);
put_word(res, ico->id);
}
}
put_word(res, 0); /* Reserved */
/* FIXME: The ResType in the NEWHEADER structure should
* contain 14 according to the MS win32 doc. This is
* not the case with the BRC compiler and I really doubt
* the latter. Putting one here is compliant to win16 spec,
* but who knows the true value?
*/
put_word(res, 1); /* ResType */
put_word(res, icog->nicon);
for(ico = icog->iconlist; ico; ico = ico->next)
{
put_byte(res, ico->width);
put_byte(res, ico->height);
put_byte(res, ico->nclr);
put_byte(res, 0); /* Reserved */
put_word(res, ico->planes);
put_word(res, ico->bits);
put_dword(res, ico->data->size);
put_word(res, ico->id);
}
SetResSize(res, restag); /* Set ResourceSize */
if(win32)
put_pad(res);