[PATCH 1/4] regedit: Concatenate the next line when a comment follows the backslash
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Apr 5 06:48:16 CDT 2017
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/regproc.c | 18 ++++++++++--------
programs/regedit/tests/regedit.c | 16 ++++++++--------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index e0049c6..8a4fe73 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -715,7 +715,7 @@ static char *get_lineA(FILE *fp)
while (next)
{
- char *p = strpbrk(line, "\r\n");
+ char *p = strpbrk(line, "\r\n"), *s;
if (!p)
{
size_t len, count;
@@ -741,10 +741,11 @@ static char *get_lineA(FILE *fp)
next = p + 1;
if (*p == '\r' && *(p + 1) == '\n') next++;
*p = 0;
- if (p > buf && *(p - 1) == '\\')
+ if ((s = strchr(line, ':')) && (*(s - 1) == 'x' || *(s - 1) == ')'))
{
- while (*next == ' ' || *next == '\t') next++;
- memmove(p - 1, next, strlen(next) + 1);
+ s = strchr(s, '\\');
+ if (!s) return line;
+ memmove(s, next, strlen(next) + 1);
next = line;
continue;
}
@@ -827,7 +828,7 @@ static WCHAR *get_lineW(FILE *fp)
while (next)
{
static const WCHAR line_endings[] = {'\r','\n',0};
- WCHAR *p = strpbrkW(line, line_endings);
+ WCHAR *p = strpbrkW(line, line_endings), *s;
if (!p)
{
size_t len, count;
@@ -853,10 +854,11 @@ static WCHAR *get_lineW(FILE *fp)
next = p + 1;
if (*p == '\r' && *(p + 1) == '\n') next++;
*p = 0;
- if (p > buf && *(p - 1) == '\\')
+ if ((s = strchrW(line, ':')) && (*(s - 1) == 'x' || *(s - 1) == ')'))
{
- while (*next == ' ' || *next == '\t') next++;
- memmove(p - 1, next, (strlenW(next) + 1) * sizeof(WCHAR));
+ s = strchrW(s, '\\');
+ if (!s) return line;
+ memmove(s, next, (strlenW(next) + 1) * sizeof(WCHAR));
next = line;
continue;
}
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index bbe5c4b..6b40190 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -482,7 +482,7 @@ static void test_invalid_import(void)
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Multi-Line2\"=hex(7):4c,69,6e,65,20\\\n"
" ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg_nonexist(hkey, "Multi-Line2");
+ verify_reg_nonexist(hkey, "Multi-Line2");
exec_import_str("Windows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -494,7 +494,7 @@ static void test_invalid_import(void)
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
" ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg_nonexist(hkey, "Multi-Line4");
+ verify_reg_nonexist(hkey, "Multi-Line4");
RegCloseKey(hkey);
@@ -519,8 +519,8 @@ static void test_comments(void)
"\"Wine2\"=\"Line 2\"\n\n");
lr = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey);
ok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", lr);
- todo_wine verify_reg(hkey, "Wine1", REG_SZ, "Line 1", 7, 0);
- todo_wine verify_reg(hkey, "Wine2", REG_SZ, "Line 2", 7, 0);
+ verify_reg(hkey, "Wine1", REG_SZ, "Line 1", 7, 0);
+ verify_reg(hkey, "Wine2", REG_SZ, "Line 2", 7, 0);
exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -600,7 +600,7 @@ static void test_comments(void)
" 63,6f,6e,\\;comment\n"
" 63,61,74,\\;comment\n"
" 65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
+ verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -617,7 +617,7 @@ static void test_comments(void)
" 63,6f,6e,\\;comment\n"
" 63,61,74,\\;comment\n"
" 65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg(hkey, "Multi-Line3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
+ verify_reg(hkey, "Multi-Line3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -626,7 +626,7 @@ static void test_comments(void)
" 63,6f,6e,\\;#comment\n"
" 63,61,74,\\;#comment\n"
" 65,6e,61,74,69,6f,6e,00,00\n\n");
- todo_wine verify_reg(hkey, "Multi-Line4", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
+ verify_reg(hkey, "Multi-Line4", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -635,7 +635,7 @@ static void test_comments(void)
" 63,6f,6e,\\;comment\n"
" 63,61,74,\\#comment\n"
" 65,6e,61,74,69,6f,6e,00,00\n\n");
- verify_reg_nonexist(hkey, "Multi-Line5");
+ todo_wine verify_reg_nonexist(hkey, "Multi-Line5");
RegCloseKey(hkey);
--
2.7.4
More information about the wine-patches
mailing list