Skip to content

Commit

Permalink
reg/tests: Correctly import hex values with no data.
Browse files Browse the repository at this point in the history
Signed-off-by: Hugh McMaster <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>
  • Loading branch information
hughmcmaster authored and julliard committed Oct 16, 2017
1 parent 84dda23 commit c02dd08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions programs/reg/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@ static WCHAR *hex_data_state(struct parser *parser, WCHAR *pos)
{
WCHAR *line = pos;

if (!*line)
goto set_value;

if (!convert_hex_csv_to_hex(parser, &line))
goto invalid;

Expand All @@ -796,6 +799,7 @@ static WCHAR *hex_data_state(struct parser *parser, WCHAR *pos)

prepare_hex_string_data(parser);

set_value:
set_state(parser, SET_VALUE);
return line;

Expand Down
8 changes: 4 additions & 4 deletions programs/reg/tests/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2322,10 +2322,10 @@ static void test_import(void)
"\"Wine68i\"=hex(0):\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, TODO_REG_SIZE);
verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, TODO_REG_SIZE);
verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
Expand Down Expand Up @@ -3830,10 +3830,10 @@ static void test_unicode_import(void)
"\"Wine68i\"=hex(0):\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, TODO_REG_SIZE);
verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, TODO_REG_SIZE);
verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
Expand Down

0 comments on commit c02dd08

Please sign in to comment.