winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2012
----- 2025 -----
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
960 discussions
Start a n
N
ew thread
Frédéric Delanoy : cmd: Add support for EQU comparison operator in if statements.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 14cd4151a93e0656b2caeae6e095b61cbb99bff1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=14cd4151a93e0656b2caeae6e…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:48:04 2012 +0200 cmd: Add support for EQU comparison operator in if statements. --- programs/cmd/builtins.c | 9 +++++++++ programs/cmd/tests/test_builtins.cmd.exp | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 3505817..3a8dfba 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2357,6 +2357,7 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato BOOL int_operands; static const WCHAR lssW[] = {'l','s','s','\0'}; static const WCHAR leqW[] = {'l','e','q','\0'}; + static const WCHAR equW[] = {'e','q','u','\0'}; /* == is a special case, as it always compares strings */ if (!lstrcmpiW(operator, eqeqW)) @@ -2385,6 +2386,14 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato : lstrcmpW (leftOperand, rightOperand) <= 0; } + if (!lstrcmpiW(operator, equW)) { + if (int_operands) + return leftOperand_int == rightOperand_int; + else + return caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) == 0 + : lstrcmpW (leftOperand, rightOperand) == 0; + } + return -1; } diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index ec85db6..009473e 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -481,12 +481,12 @@ a LEQ B@or_broken@NT4 a LEQ B insensitive A LEQ b A LEQ b insensitive -@todo_wine@A EQU A -@todo_wine@B EQU B -@todo_wine@AB EQU AB -@todo_wine@BA EQU BA -@todo_wine@AA EQU AA -@todo_wine@A EQU a insensitive +A EQU A +B EQU B +AB EQU AB +BA EQU BA +AA EQU AA +A EQU a insensitive @todo_wine@B NEQ A @todo_wine@AB NEQ A @todo_wine@BA NEQ A @@ -556,14 +556,14 @@ also in negative form 0 LEQ 9 1 LEQ 9 9 LEQ 9 -@todo_wine@0 EQU 0 -@todo_wine@1 EQU 1 -@todo_wine@10 EQU 10 -@todo_wine@9 EQU 9 -@todo_wine@octal ok -@todo_wine@hexa ok -@todo_wine@string/hexa compare ok -@todo_wine@string/hexa compare ok +0 EQU 0 +1 EQU 1 +10 EQU 10 +9 EQU 9 +octal ok +hexa ok +string/hexa compare ok +string/hexa compare ok @todo_wine@1 NEQ 0 @todo_wine@10 NEQ 0 @todo_wine@9 NEQ 0
1
0
0
0
Frédéric Delanoy : cmd: Add support for LEQ comparison operator in if statements.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 78af04f427a43b1a40c01ee98a888deec0480863 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=78af04f427a43b1a40c01ee98…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:48:03 2012 +0200 cmd: Add support for LEQ comparison operator in if statements. --- programs/cmd/builtins.c | 9 ++++ programs/cmd/tests/test_builtins.cmd.exp | 62 +++++++++++++++--------------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 95419a1..3505817 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2356,6 +2356,7 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato long int leftOperand_int, rightOperand_int; BOOL int_operands; static const WCHAR lssW[] = {'l','s','s','\0'}; + static const WCHAR leqW[] = {'l','e','q','\0'}; /* == is a special case, as it always compares strings */ if (!lstrcmpiW(operator, eqeqW)) @@ -2376,6 +2377,14 @@ static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operato : lstrcmpW (leftOperand, rightOperand) < 0; } + if (!lstrcmpiW(operator, leqW)) { + if (int_operands) + return leftOperand_int <= rightOperand_int; + else + return caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) <= 0 + : lstrcmpW (leftOperand, rightOperand) <= 0; + } + return -1; } diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index b25eb9e..ec85db6 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -460,27 +460,27 @@ a LSS B@or_broken@NT4 a LSS B insensitive A LSS b A LSS b insensitive -@todo_wine@A LEQ A -@todo_wine@A LEQ B -@todo_wine@B LEQ B -@todo_wine@AB LEQ B -@todo_wine@AA LEQ B -@todo_wine@A LEQ AB -@todo_wine@AB LEQ AB -@todo_wine@AA LEQ AB -@todo_wine@A LEQ BA -@todo_wine@B LEQ BA -@todo_wine@AB LEQ BA -@todo_wine@BA LEQ BA -@todo_wine@AA LEQ BA -@todo_wine@A LEQ AA -@todo_wine@AA LEQ AA -@todo_wine@b LEQ B@or_broken@NT4 -@todo_wine@b LEQ B insensitive -@todo_wine@a LEQ B@or_broken@NT4 -@todo_wine@a LEQ B insensitive -@todo_wine@A LEQ b -@todo_wine@A LEQ b insensitive +A LEQ A +A LEQ B +B LEQ B +AB LEQ B +AA LEQ B +A LEQ AB +AB LEQ AB +AA LEQ AB +A LEQ BA +B LEQ BA +AB LEQ BA +BA LEQ BA +AA LEQ BA +A LEQ AA +AA LEQ AA +b LEQ B@or_broken@NT4 +b LEQ B insensitive +a LEQ B@or_broken@NT4 +a LEQ B insensitive +A LEQ b +A LEQ b insensitive @todo_wine@A EQU A @todo_wine@B EQU B @todo_wine@AB EQU AB @@ -546,16 +546,16 @@ also in negative form 9 LSS 10 0 LSS 9 1 LSS 9 -@todo_wine@0 LEQ 0 -@todo_wine@0 LEQ 1 -@todo_wine@1 LEQ 1 -@todo_wine@0 LEQ 10 -@todo_wine@1 LEQ 10 -@todo_wine@10 LEQ 10 -@todo_wine@9 LEQ 10 -@todo_wine@0 LEQ 9 -@todo_wine@1 LEQ 9 -@todo_wine@9 LEQ 9 +0 LEQ 0 +0 LEQ 1 +1 LEQ 1 +0 LEQ 10 +1 LEQ 10 +10 LEQ 10 +9 LEQ 10 +0 LEQ 9 +1 LEQ 9 +9 LEQ 9 @todo_wine@0 EQU 0 @todo_wine@1 EQU 1 @todo_wine@10 EQU 10
1
0
0
0
Frédéric Delanoy : cmd: Add support for LSS comparison operator in if statements.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 154710a0932e915426b3f08356794aeb7141aa72 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=154710a0932e915426b3f0835…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:48:02 2012 +0200 cmd: Add support for LSS comparison operator in if statements. --- programs/cmd/builtins.c | 63 ++++++++++++++++++++++++++--- programs/cmd/tests/test_builtins.cmd.exp | 50 ++++++++++++------------ 2 files changed, 81 insertions(+), 32 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index af669d3..95419a1 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -104,6 +104,7 @@ static const WCHAR onW[] = {'O','N','\0'}; static const WCHAR offW[] = {'O','F','F','\0'}; static const WCHAR parmY[] = {'/','Y','\0'}; static const WCHAR parmNoY[] = {'/','-','Y','\0'}; +static const WCHAR eqeqW[] = {'=','=','\0'}; static HINSTANCE hinst; struct env_stack *saved_environment; @@ -2332,6 +2333,52 @@ void WCMD_popd (void) { LocalFree (temp); } +/******************************************************************* + * evaluate_if_comparison + * + * Evaluates an "if" comparison operation + * + * PARAMS + * leftOperand [I] left operand, non NULL + * operator [I] "if" binary comparison operator, non NULL + * rightOperand [I] right operand, non NULL + * caseInsensitive [I] 0 for case sensitive comparison, anything else for insensitive + * + * RETURNS + * Success: 1 if operator applied to the operands evaluates to TRUE + * 0 if operator applied to the operands evaluates to FALSE + * Failure: -1 if operator is not recognized + */ +static int evaluate_if_comparison(const WCHAR *leftOperand, const WCHAR *operator, + const WCHAR *rightOperand, int caseInsensitive) +{ + WCHAR *endptr_leftOp, *endptr_rightOp; + long int leftOperand_int, rightOperand_int; + BOOL int_operands; + static const WCHAR lssW[] = {'l','s','s','\0'}; + + /* == is a special case, as it always compares strings */ + if (!lstrcmpiW(operator, eqeqW)) + return caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) == 0 + : lstrcmpW (leftOperand, rightOperand) == 0; + + /* Check if we have plain integers (in decimal, octal or hexadecimal notation) */ + leftOperand_int = strtolW(leftOperand, &endptr_leftOp, 0); + rightOperand_int = strtolW(rightOperand, &endptr_rightOp, 0); + int_operands = (!*endptr_leftOp) && (!*endptr_rightOp); + + /* Perform actual (integer or string) comparison */ + if (!lstrcmpiW(operator, lssW)) { + if (int_operands) + return leftOperand_int < rightOperand_int; + else + return caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) < 0 + : lstrcmpW (leftOperand, rightOperand) < 0; + } + + return -1; +} + /**************************************************************************** * WCMD_if * @@ -2355,7 +2402,6 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) static const WCHAR errlvlW[] = {'e','r','r','o','r','l','e','v','e','l','\0'}; static const WCHAR existW[] = {'e','x','i','s','t','\0'}; static const WCHAR defdW[] = {'d','e','f','i','n','e','d','\0'}; - static const WCHAR eqeqW[] = {'=','=','\0'}; static const WCHAR parmI[] = {'/','I','\0'}; int caseInsensitive = (strstrW(quals, parmI) != NULL); @@ -2394,18 +2440,21 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) while (*p == ' ' || *p == '\t') p++; - if (strncmpW(p, eqeqW, strlenW(eqeqW))) - goto syntax_err; - - strcpyW(operator, eqeqW); + if (!strncmpW(p, eqeqW, strlenW(eqeqW))) + strcpyW(operator, eqeqW); + else { + strcpyW(operator, WCMD_parameter(p, 0, ¶mStart, FALSE, FALSE)); + if (!*operator) goto syntax_err; + } p += strlenW(operator); strcpyW(rightOperand, WCMD_parameter(p, 0, ¶mStart, TRUE, FALSE)); if (!*rightOperand) goto syntax_err; - test = caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) == 0 - : lstrcmpW (leftOperand, rightOperand) == 0; + test = evaluate_if_comparison(leftOperand, operator, rightOperand, caseInsensitive); + if (test == -1) + goto syntax_err; p = paramStart + strlenW(rightOperand); WCMD_parameter(p, 0, &command, FALSE, FALSE); diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 9b5eb3b..b25eb9e 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -441,25 +441,25 @@ quake --- comparison operators ------ for strings LSS string can be used as operand for LSS comparison -@todo_wine@floats are handled as strings -@todo_wine@numbers in quotes are handled as strings -@todo_wine@negative numbers as well@or_broken@NT4 -@todo_wine@if /i seems to work for LSS -@todo_wine@A LSS B -@todo_wine@AB LSS B -@todo_wine@AA LSS B -@todo_wine@A LSS AB -@todo_wine@AA LSS AB -@todo_wine@A LSS BA -@todo_wine@B LSS BA -@todo_wine@AB LSS BA -@todo_wine@AA LSS BA -@todo_wine@A LSS AA -@todo_wine@b LSS B@or_broken@NT4 -@todo_wine@a LSS B@or_broken@NT4 -@todo_wine@a LSS B insensitive -@todo_wine@A LSS b -@todo_wine@A LSS b insensitive +floats are handled as strings +numbers in quotes are handled as strings +negative numbers as well@or_broken@NT4 +if /i seems to work for LSS +A LSS B +AB LSS B +AA LSS B +A LSS AB +AA LSS AB +A LSS BA +B LSS BA +AB LSS BA +AA LSS BA +A LSS AA +b LSS B@or_broken@NT4 +a LSS B@or_broken@NT4 +a LSS B insensitive +A LSS b +A LSS b insensitive @todo_wine@A LEQ A @todo_wine@A LEQ B @todo_wine@B LEQ B @@ -540,12 +540,12 @@ also in negative form hexa handled also in negative form 11 LSS 101 -@todo_wine@0 LSS 1 -@todo_wine@0 LSS 10 -@todo_wine@1 LSS 10 -@todo_wine@9 LSS 10 -@todo_wine@0 LSS 9 -@todo_wine@1 LSS 9 +0 LSS 1 +0 LSS 10 +1 LSS 10 +9 LSS 10 +0 LSS 9 +1 LSS 9 @todo_wine@0 LEQ 0 @todo_wine@0 LEQ 1 @todo_wine@1 LEQ 1
1
0
0
0
Frédéric Delanoy : cmd: Avoid using strstr to match == operator in WCMD_if.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 17607b8020edb820389e22138dbda4446748eee1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=17607b8020edb820389e22138…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:48:01 2012 +0200 cmd: Avoid using strstr to match == operator in WCMD_if. --- programs/cmd/builtins.c | 46 +++++++++++++++++++++++++++++----------------- 1 files changed, 29 insertions(+), 17 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index ffdfe8d..af669d3 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2350,7 +2350,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) { int negate; /* Negate condition */ int test; /* Condition evaluation result */ - WCHAR condition[MAX_PATH], *command, *s; + WCHAR condition[MAX_PATH], *command; static const WCHAR notW[] = {'n','o','t','\0'}; static const WCHAR errlvlW[] = {'e','r','r','o','r','l','e','v','e','l','\0'}; static const WCHAR existW[] = {'e','x','i','s','t','\0'}; @@ -2381,23 +2381,35 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) NULL, 0) > 0); WCMD_parameter(p, 2+negate, &command, FALSE, FALSE); } - else if ((s = strstrW (p, eqeqW))) { - /* We need to get potential surrounding double quotes, so param1/2 can't be used */ - WCHAR *leftPart, *rightPart; - unsigned int leftPartLen, rightPartLen; - s += 2; - leftPartLen = strlenW(WCMD_parameter(p, 0+negate+caseInsensitive, &leftPart, TRUE, FALSE)); - rightPartLen = strlenW(WCMD_parameter(p, 1+negate+caseInsensitive, &rightPart, TRUE, FALSE)); - test = caseInsensitive - ? (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, - leftPart, leftPartLen, - rightPart, rightPartLen) == CSTR_EQUAL) - : (CompareStringW(LOCALE_SYSTEM_DEFAULT, 0, - leftPart, leftPartLen, - rightPart, rightPartLen) == CSTR_EQUAL); - WCMD_parameter(s, 1, &command, FALSE, FALSE); - } - else goto syntax_err; + else { /* comparison operation */ + WCHAR leftOperand[MAXSTRING], rightOperand[MAXSTRING], operator[MAXSTRING]; + WCHAR *paramStart; + + strcpyW(leftOperand, WCMD_parameter(p, negate+caseInsensitive, ¶mStart, TRUE, FALSE)); + if (!*leftOperand) + goto syntax_err; + + /* Note: '==' can't be returned by WCMD_parameter since '=' is a separator */ + p = paramStart + strlenW(leftOperand); + while (*p == ' ' || *p == '\t') + p++; + + if (strncmpW(p, eqeqW, strlenW(eqeqW))) + goto syntax_err; + + strcpyW(operator, eqeqW); + p += strlenW(operator); + + strcpyW(rightOperand, WCMD_parameter(p, 0, ¶mStart, TRUE, FALSE)); + if (!*rightOperand) + goto syntax_err; + + test = caseInsensitive ? lstrcmpiW(leftOperand, rightOperand) == 0 + : lstrcmpW (leftOperand, rightOperand) == 0; + + p = paramStart + strlenW(rightOperand); + WCMD_parameter(p, 0, &command, FALSE, FALSE); + } /* Process rest of IF statement which is on the same line Note: This may process all or some of the cmdList (eg a GOTO) */
1
0
0
0
Frédéric Delanoy : cmd: Move common error reporting code in WCMD_if.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: dd1395442448ec73b6e16c89d8e9affd554a4e8b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dd1395442448ec73b6e16c89d…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:48:00 2012 +0200 cmd: Move common error reporting code in WCMD_if. --- programs/cmd/builtins.c | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index d13cb5c..ffdfe8d 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2346,9 +2346,8 @@ void WCMD_popd (void) { * * FIXME: Much more syntax checking needed! */ - -void WCMD_if (WCHAR *p, CMD_LIST **cmdList) { - +void WCMD_if (WCHAR *p, CMD_LIST **cmdList) +{ int negate; /* Negate condition */ int test; /* Condition evaluation result */ WCHAR condition[MAX_PATH], *command, *s; @@ -2368,10 +2367,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) { WCHAR *param = WCMD_parameter(p, 1+negate, NULL, FALSE, FALSE); WCHAR *endptr; long int param_int = strtolW(param, &endptr, 10); - if (*endptr) { - WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR)); - return; - } + if (*endptr) goto syntax_err; test = ((long int)errorlevel >= param_int); WCMD_parameter(p, 2+negate, &command, FALSE, FALSE); } @@ -2401,14 +2397,15 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) { rightPart, rightPartLen) == CSTR_EQUAL); WCMD_parameter(s, 1, &command, FALSE, FALSE); } - else { - WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR)); - return; - } + else goto syntax_err; /* 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, NULL, NULL, TRUE, (test != negate)); + return; + +syntax_err: + WCMD_output_stderr(WCMD_LoadMessage(WCMD_SYNTAXERR)); } /****************************************************************************
1
0
0
0
Frédéric Delanoy : cmd: Get rid of longer needed 'end' parameter in WCMD_parameter.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: cee1652e61c4f3fd9a276954557245fd78365c9d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cee1652e61c4f3fd9a2769545…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:47:59 2012 +0200 cmd: Get rid of longer needed 'end' parameter in WCMD_parameter. --- programs/cmd/batch.c | 23 +++++++----------- programs/cmd/builtins.c | 59 +++++++++++++++++++++++---------------------- programs/cmd/directory.c | 2 +- programs/cmd/wcmd.h | 4 +- programs/cmd/wcmdmain.c | 20 +++++++------- 5 files changed, 52 insertions(+), 56 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=cee1652e61c4f3fd9a276…
1
0
0
0
Frédéric Delanoy : cmd: Correctly set the 'raw' parameter in calls to WCMD_parameter in WCMD_if.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 517ed443963e1babcc37fbeade984a5e1fc12605 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=517ed443963e1babcc37fbead…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Thu Oct 25 23:47:58 2012 +0200 cmd: Correctly set the 'raw' parameter in calls to WCMD_parameter in WCMD_if. --- programs/cmd/builtins.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 8eaa9e7..768a53b 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2389,8 +2389,8 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) { /* We need to get potential surrounding double quotes, so param1/2 can't be used */ WCHAR *leftPart, *leftPartEnd, *rightPart, *rightPartEnd; s += 2; - WCMD_parameter(p, 0+negate+caseInsensitive, &leftPart, &leftPartEnd, FALSE, FALSE); - WCMD_parameter(p, 1+negate+caseInsensitive, &rightPart, &rightPartEnd, FALSE, FALSE); + WCMD_parameter(p, 0+negate+caseInsensitive, &leftPart, &leftPartEnd, TRUE, FALSE); + WCMD_parameter(p, 1+negate+caseInsensitive, &rightPart, &rightPartEnd, TRUE, FALSE); test = caseInsensitive ? (CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, leftPart, leftPartEnd-leftPart+1,
1
0
0
0
Nikolay Sivov : dwrite: Added GetLocaleNameLength/ GetLocaleName for text format and layout.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: 51d0f61272cc2aeb3cc0aba2653174caa7dba8e9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=51d0f61272cc2aeb3cc0aba26…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Oct 26 12:50:12 2012 -0400 dwrite: Added GetLocaleNameLength/GetLocaleName for text format and layout. --- dlls/dwrite/layout.c | 35 +++++++++++++++++++++++++++-------- dlls/dwrite/tests/layout.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 76c5adb..f6bc421 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite); struct dwrite_textformat_data { WCHAR *family_name; WCHAR *locale; + UINT32 locale_len; DWRITE_FONT_WEIGHT weight; DWRITE_FONT_STYLE style; @@ -114,6 +115,7 @@ static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout *iface) if (!ref) { + release_format_data(&This->format); heap_free(This->str); heap_free(This); } @@ -289,15 +291,19 @@ static FLOAT WINAPI dwritetextlayout_GetFontSize(IDWriteTextLayout *iface) static UINT32 WINAPI dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return 0; + TRACE("(%p)\n", This); + return This->format.locale_len; } static HRESULT WINAPI dwritetextlayout_GetLocaleName(IDWriteTextLayout *iface, WCHAR *name, UINT32 size) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %u): stub\n", This, name, size); - return E_NOTIMPL; + + TRACE("(%p)->(%p %u)\n", This, name, size); + + if (size <= This->format.locale_len) return E_NOT_SUFFICIENT_BUFFER; + strcpyW(name, This->format.locale); + return S_OK; } static HRESULT WINAPI dwritetextlayout_SetMaxWidth(IDWriteTextLayout *iface, FLOAT maxWidth) @@ -668,6 +674,7 @@ static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl = { HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *format, IDWriteTextLayout **layout) { struct dwrite_textlayout *This; + UINT32 locale_len; *layout = NULL; @@ -682,6 +689,13 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *forma /* reference is not kept here, instead copy all underlying data */ IDWriteTextFormat_GetFontCollection(format, &This->format.collection); + + /* locale name and length */ + locale_len = IDWriteTextFormat_GetLocaleNameLength(format); + This->format.locale = heap_alloc((locale_len+1)*sizeof(WCHAR)); + IDWriteTextFormat_GetLocaleName(format, This->format.locale, locale_len+1); + This->format.locale_len = locale_len; + This->format.weight = IDWriteTextFormat_GetFontWeight(format); This->format.style = IDWriteTextFormat_GetFontStyle(format); This->format.stretch = IDWriteTextFormat_GetFontStretch(format); @@ -908,15 +922,19 @@ static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat *iface) static UINT32 WINAPI dwritetextformat_GetLocaleNameLength(IDWriteTextFormat *iface) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p): stub\n", This); - return 0; + TRACE("(%p)\n", This); + return This->format.locale_len; } static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat *iface, WCHAR *name, UINT32 size) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%p %u): stub\n", This, name, size); - return E_NOTIMPL; + + TRACE("(%p)->(%p %u)\n", This, name, size); + + if (size <= This->format.locale_len) return E_NOT_SUFFICIENT_BUFFER; + strcpyW(name, This->format.locale); + return S_OK; } static const IDWriteTextFormatVtbl dwritetextformatvtbl = { @@ -964,6 +982,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle This->ref = 1; This->format.family_name = heap_strdupW(family_name); This->format.locale = heap_strdupW(locale); + This->format.locale_len = strlenW(locale); This->format.weight = weight; This->format.style = style; This->format.size = size; diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 6b8dc62..9656ba6 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -134,6 +134,41 @@ if (0) /* crashes on native */ IDWriteTextFormat_Release(format); } +static void test_GetLocaleName(void) +{ + static const WCHAR strW[] = {'s','t','r','i','n','g',0}; + static const WCHAR ruW[] = {'r','u',0}; + IDWriteTextLayout *layout; + IDWriteTextFormat *format; + WCHAR buff[10]; + UINT32 len; + HRESULT hr; + + hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 0, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout); + ok(hr == S_OK, "got 0x%08x\n", hr); + len = IDWriteTextLayout_GetLocaleNameLength(layout); + ok(len == 2, "got %u\n", len); + len = IDWriteTextFormat_GetLocaleNameLength(format); + ok(len == 2, "got %u\n", len); + hr = IDWriteTextLayout_GetLocaleName(layout, buff, len); + ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr); + hr = IDWriteTextLayout_GetLocaleName(layout, buff, len+1); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(buff, ruW), "got %s\n", wine_dbgstr_w(buff)); + hr = IDWriteTextFormat_GetLocaleName(format, buff, len); + ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr); + hr = IDWriteTextFormat_GetLocaleName(format, buff, len+1); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(buff, ruW), "got %s\n", wine_dbgstr_w(buff)); + + IDWriteTextLayout_Release(layout); + IDWriteTextFormat_Release(format); +} + START_TEST(layout) { HRESULT hr; @@ -149,6 +184,7 @@ START_TEST(layout) test_CreateTextLayout(); test_CreateGdiCompatibleTextLayout(); test_CreateTextFormat(); + test_GetLocaleName(); IDWriteFactory_Release(factory); }
1
0
0
0
Nikolay Sivov : dwrite: Layout can't be created without text format.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: fcae48a08cffec0c7af37f8fe519b0b8c5821208 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fcae48a08cffec0c7af37f8fe…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Oct 26 12:10:47 2012 -0400 dwrite: Layout can't be created without text format. --- dlls/dwrite/layout.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 153716b..76c5adb 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -681,14 +681,11 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *forma memset(&This->format, 0, sizeof(This->format)); /* reference is not kept here, instead copy all underlying data */ - if (format) - { - IDWriteTextFormat_GetFontCollection(format, &This->format.collection); - This->format.weight = IDWriteTextFormat_GetFontWeight(format); - This->format.style = IDWriteTextFormat_GetFontStyle(format); - This->format.stretch = IDWriteTextFormat_GetFontStretch(format); - This->format.size = IDWriteTextFormat_GetFontSize(format); - } + IDWriteTextFormat_GetFontCollection(format, &This->format.collection); + This->format.weight = IDWriteTextFormat_GetFontWeight(format); + This->format.style = IDWriteTextFormat_GetFontStyle(format); + This->format.stretch = IDWriteTextFormat_GetFontStretch(format); + This->format.size = IDWriteTextFormat_GetFontSize(format); *layout = &This->IDWriteTextLayout_iface;
1
0
0
0
Daniel Lehman : msvcp: Sync istream<>::seekg implementations.
by Alexandre Julliard
26 Oct '12
26 Oct '12
Module: wine Branch: master Commit: bc62a7a9dbc689006c5ed2bace9be57a69324479 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc62a7a9dbc689006c5ed2bac…
Author: Daniel Lehman <dlehman(a)esri.com> Date: Thu Oct 25 10:01:12 2012 -0700 msvcp: Sync istream<>::seekg implementations. --- dlls/msvcp100/ios.c | 107 ++++++++++++++++++++++---------------------------- dlls/msvcp60/ios.c | 107 ++++++++++++++++++++++---------------------------- dlls/msvcp71/ios.c | 107 ++++++++++++++++++++++---------------------------- 3 files changed, 141 insertions(+), 180 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=bc62a7a9dbc689006c5ed…
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200