reg/tests: Correctly import hex values with no data.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-10-16 10:27:25 +00:00 committed by Alexandre Julliard
parent 84dda23536
commit c02dd08f91
2 changed files with 8 additions and 4 deletions

View File

@ -785,6 +785,9 @@ static WCHAR *hex_data_state(struct parser *parser, WCHAR *pos)
{ {
WCHAR *line = pos; WCHAR *line = pos;
if (!*line)
goto set_value;
if (!convert_hex_csv_to_hex(parser, &line)) if (!convert_hex_csv_to_hex(parser, &line))
goto invalid; goto invalid;
@ -796,6 +799,7 @@ static WCHAR *hex_data_state(struct parser *parser, WCHAR *pos)
prepare_hex_string_data(parser); prepare_hex_string_data(parser);
set_value:
set_state(parser, SET_VALUE); set_state(parser, SET_VALUE);
return line; return line;

View File

@ -2322,10 +2322,10 @@ static void test_import(void)
"\"Wine68i\"=hex(0):\n\n", &r); "\"Wine68i\"=hex(0):\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\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, "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, "Wine68c", REG_BINARY, NULL, 0, 0);
verify_reg(hkey, "Wine68d", REG_DWORD, 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, "Wine68f", 0x100, NULL, 0, 0);
verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
@ -3830,10 +3830,10 @@ static void test_unicode_import(void)
"\"Wine68i\"=hex(0):\n\n", &r); "\"Wine68i\"=hex(0):\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\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, "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, "Wine68c", REG_BINARY, NULL, 0, 0);
verify_reg(hkey, "Wine68d", REG_DWORD, 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, "Wine68f", 0x100, NULL, 0, 0);
verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);