[PATCH 3/4] regedit: Handle comment-only lines during line concatenation
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Apr 5 06:48:42 CDT 2017
If the comment-only line begins with a hash character, we
should not continue to concatenate or import the current line.
If the comment-only line begins with a semicolon, we convert
the semicolon into a backslash to continue the concatenation
sequence automatically.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/regproc.c | 16 ++++++++++++++++
programs/regedit/tests/regedit.c | 2 +-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 2d628c3..675a7cf 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -750,6 +750,14 @@ static char *get_lineA(FILE *fp)
line = next;
continue;
}
+ p = next;
+ while (*p == ' ' || *p == '\t') p++;
+ if (*p == ';') *p = '\\';
+ else if (*p == '#')
+ {
+ line = next;
+ continue;
+ }
memmove(s, next, strlen(next) + 1);
next = line;
continue;
@@ -869,6 +877,14 @@ static WCHAR *get_lineW(FILE *fp)
line = next;
continue;
}
+ p = next;
+ while (*p == ' ' || *p == '\t') p++;
+ if (*p == ';') *p = '\\';
+ else if (*p == '#')
+ {
+ line = next;
+ continue;
+ }
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 33943b3..a37d869 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -546,7 +546,7 @@ static void test_comments(void)
"\"Wine10\"=\"Another valid line\"\n\n");
verify_reg_nonexist(hkey, "Wine7");
verify_reg(hkey, "Wine8", REG_SZ, "A valid line", 13, 0);
- todo_wine verify_reg(hkey, "Wine9", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
+ verify_reg(hkey, "Wine9", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
verify_reg(hkey, "Wine10", REG_SZ, "Another valid line", 19, 0);
exec_import_str("REGEDIT4\n\n"
--
2.7.4
More information about the wine-patches
mailing list