test_dds_decoder_frame_count() and test_dds_decoder_image_parameters() have the same structure. They have a same loop, they use same test data, which makes code duplicate.
This patch move the loop to test_dds_decoder() so that there is only one loop. Also, make the test data a global array rather than two local arrays.
PATCH 1 and PATCH 2 in this patches set used to be one patch. I split them to make the patches look clearer. (PATCH 2 is still not too clear to review but better than before)
…
[View More]Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/windowscodecs/tests/ddsformat.c | 177 ++++++++++-----------------
1 file changed, 67 insertions(+), 110 deletions(-)
[View Less]
Regression introduced in f238e846e701d2039eceb51f2f6e9d936f8c791c.
Therefore if conditions got influenced by values of the previous line.
Previous submission:
https://www.winehq.org/pipermail/wine-devel/2020-March/162158.html
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738
Signed-off-by: Bernhard Übelacker <bernhardu(a)mailbox.org>
---
programs/cmd/builtins.c | 6 ++++++
programs/cmd/wcmdmain.c | 15 +++++++--------
2 …
[View More]files changed, 13 insertions(+), 8 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 43c4d9efef3..8911a597eb9 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2938,9 +2938,15 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList)
int test; /* Condition evaluation result */
WCHAR *command;
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2
+ set in a call to WCMD_parse before */
if (evaluate_if_condition(p, &command, &test, &negate) == -1)
goto syntax_err;
+ WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s\n",
+ wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1),
+ wine_dbgstr_w(param2), wine_dbgstr_w(command));
+
/* Process rest of IF statement which is on the same line
Note: This may process all or some of the cmdList (eg a GOTO) */
WCMD_part_execute(cmdList, command, TRUE, (test != negate));
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 2834986bf9e..6efc1c677d2 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1947,8 +1947,6 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
To be able to handle ('s in the condition part take as much as evaluate_if_condition
would take and skip parsing it here. */
} else if (WCMD_keyword_ws_found(ifCmd, ARRAY_SIZE(ifCmd), curPos)) {
- static const WCHAR parmI[] = {'/','I','\0'};
- static const WCHAR notW[] = {'n','o','t','\0'};
int negate; /* Negate condition */
int test; /* Condition evaluation result */
WCHAR *p, *command;
@@ -1956,17 +1954,18 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
inIf = TRUE;
p = curPos+(ARRAY_SIZE(ifCmd));
- while (*p == ' ' || *p == '\t') {
+ while (*p == ' ' || *p == '\t')
p++;
- if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), notW) == 0)
- p += lstrlenW(notW);
- if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), parmI) == 0)
- p += lstrlenW(parmI);
- }
+ WCMD_parse (p, quals, param1, param2);
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2
+ set in a call to WCMD_parse before */
if (evaluate_if_condition(p, &command, &test, &negate) != -1)
{
int if_condition_len = command - curPos;
+ WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s, if_condition_len: %d\n",
+ wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1),
+ wine_dbgstr_w(param2), wine_dbgstr_w(command), if_condition_len);
memcpy(&curCopyTo[*curLen], curPos, if_condition_len*sizeof(WCHAR));
(*curLen)+=if_condition_len;
curPos+=if_condition_len;
--
2.20.1
[View Less]
Added more checks and tests.
Also fixed warnings.
>From : Christian Costa <titan.costa(a)gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>