Commit 2443c7f6 authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

Allow negative numbers in RCDATA resources like RC.EXE does.

Fix false out of 16 bits range warning.
parent c26d15f8
......@@ -1788,11 +1788,15 @@ raw_data: opt_lvc tBEGIN raw_elements tEND {
raw_elements
: tRAWDATA { $$ = $1; }
| tNUMBER { $$ = int2raw_data($1); }
| '-' tNUMBER { $$ = int2raw_data(-($2)); }
| tLNUMBER { $$ = long2raw_data($1); }
| '-' tLNUMBER { $$ = long2raw_data(-($2)); }
| tSTRING { $$ = str2raw_data($1); }
| raw_elements opt_comma tRAWDATA { $$ = merge_raw_data($1, $3); free($3->data); free($3); }
| raw_elements opt_comma tNUMBER { $$ = merge_raw_data_int($1, $3); }
| raw_elements opt_comma '-' tNUMBER { $$ = merge_raw_data_int($1, -($4)); }
| raw_elements opt_comma tLNUMBER { $$ = merge_raw_data_long($1, $3); }
| raw_elements opt_comma '-' tLNUMBER { $$ = merge_raw_data_long($1, -($4)); }
| raw_elements opt_comma tSTRING { $$ = merge_raw_data_str($1, $3); }
;
......@@ -2314,7 +2318,8 @@ static raw_data_t *int2raw_data(int i)
{
raw_data_t *rd;
if((int)((short)i) != i)
if( ( i >= 0 && (int)((unsigned short)i) != i) ||
( i < 0 && (int)((short)i) != i) )
yywarning("Integer constant out of 16bit range (%d), truncated to %d\n", i, (short)i);
rd = new_raw_data();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment