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
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
February 2017
----- 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
838 discussions
Start a n
N
ew thread
Sebastian Lackner : wined3d: Avoid unnecessary memory allocations in nested command stream calls.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 82965692a0d16fc4f94c6a548a9ab4b1199472af URL:
http://source.winehq.org/git/wine.git/?a=commit;h=82965692a0d16fc4f94c6a548…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Feb 17 16:54:45 2017 +0100 wined3d: Avoid unnecessary memory allocations in nested command stream calls. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/cs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 10905c0..bbae5ad 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1608,15 +1608,14 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) data = cs->data; start = cs->start; cs->start = cs->end; + opcode = *(const enum wined3d_cs_op *)&data[start]; wined3d_cs_op_handlers[opcode](cs, &data[start]); - if (!start) - { - if (cs->data != data) - HeapFree(GetProcessHeap(), 0, data); - else - cs->start = cs->end = 0; - } + + if (cs->data == data) + cs->start = cs->end = start; + else if (!start) + HeapFree(GetProcessHeap(), 0, data); } static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
1
0
0
0
Piotr Caban : msvcr120: Add _except1 implementation.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 10200af74142c786ca8c7594bfc1fb3ad9cb0ab3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=10200af74142c786ca8c7594b…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Feb 17 15:54:25 2017 +0100 msvcr120: Add _except1 implementation. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-crt-math-l1-1-0.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/math.c | 92 ++++++++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- 5 files changed, 96 insertions(+), 4 deletions(-) diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec index 8ff4c58..d5ade42 100644 --- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec +++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec @@ -62,7 +62,7 @@ @ stub _dsin @ cdecl _dtest(ptr) ucrtbase._dtest @ stub _dunscale -@ stub _except1 +@ cdecl _except1(long long double double long ptr) ucrtbase._except1 @ stub _fd_int @ cdecl _fdclass(float) ucrtbase._fdclass @ stub _fdexp diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 62481c0..db2ae9c 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1124,7 +1124,7 @@ @ extern _environ MSVCRT__environ @ cdecl _eof(long) MSVCRT__eof @ cdecl _errno() MSVCRT__errno -@ stub _except1 +@ cdecl _except1(long long double double long ptr) @ cdecl -arch=i386 _except_handler2(ptr ptr ptr ptr) @ cdecl -arch=i386 _except_handler3(ptr ptr ptr ptr) @ cdecl -arch=i386 _except_handler4_common(ptr ptr ptr ptr ptr ptr) diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index a74a140..849e135 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1060,7 +1060,7 @@ @ extern _environ msvcr120._environ @ cdecl _eof(long) msvcr120._eof @ cdecl _errno() msvcr120._errno -@ stub _except1 +@ cdecl _except1(long long double double long ptr) msvcr120._except1 @ cdecl -arch=i386 _except_handler2(ptr ptr ptr ptr) msvcr120._except_handler2 @ cdecl -arch=i386 _except_handler3(ptr ptr ptr ptr) msvcr120._except_handler3 @ cdecl -arch=i386 _except_handler4_common(ptr ptr ptr ptr ptr ptr) msvcr120._except_handler4_common diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 74685d4..857561b 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2986,3 +2986,95 @@ float CDECL MSVCR120_nanf(const char *tagp) { return NAN; } + +/********************************************************************* + * _except1 (MSVCR120.@) + * TODO: + * - find meaning of ignored cw and operation bits + * - unk parameter + */ +double CDECL _except1(DWORD fpe, _FP_OPERATION_CODE op, double arg, double res, DWORD cw, void *unk) +{ + ULONG_PTR exception_arg; + DWORD exception = 0; + MSVCRT_fenv_t env; + DWORD fpword = 0; + WORD operation; + + TRACE("(%x %x %lf %lf %x %p)\n", fpe, op, arg, res, cw, unk); + +#ifdef _WIN64 + cw = ((cw >> 7) & 0x3f) | ((cw >> 3) & 0xc00); +#endif + operation = op << 5; + exception_arg = (ULONG_PTR)&operation; + + MSVCRT_fegetenv(&env); + + if (fpe & 0x1) { /* overflow */ + if ((fpe == 0x1 && (cw & 0x8)) || (fpe==0x11 && (cw & 0x28))) { + /* 32-bit version also sets SW_INEXACT here */ + env.status |= MSVCRT__SW_OVERFLOW; + if (fpe & 0x10) env.status |= MSVCRT__SW_INEXACT; + res = signbit(res) ? -INFINITY : INFINITY; + } else { + exception = EXCEPTION_FLT_OVERFLOW; + } + } else if (fpe & 0x2) { /* underflow */ + if ((fpe == 0x2 && (cw & 0x10)) || (fpe==0x12 && (cw & 0x30))) { + env.status |= MSVCRT__SW_UNDERFLOW; + if (fpe & 0x10) env.status |= MSVCRT__SW_INEXACT; + res = signbit(res) ? -0.0 : 0.0; + } else { + exception = EXCEPTION_FLT_UNDERFLOW; + } + } else if (fpe & 0x4) { /* zerodivide */ + if ((fpe == 0x4 && (cw & 0x4)) || (fpe==0x14 && (cw & 0x24))) { + env.status |= MSVCRT__SW_ZERODIVIDE; + if (fpe & 0x10) env.status |= MSVCRT__SW_INEXACT; + } else { + exception = EXCEPTION_FLT_DIVIDE_BY_ZERO; + } + } else if (fpe & 0x8) { /* invalid */ + if (fpe == 0x8 && (cw & 0x1)) { + env.status |= MSVCRT__SW_INVALID; + } else { + exception = EXCEPTION_FLT_INVALID_OPERATION; + } + } else if (fpe & 0x10) { /* inexact */ + if (fpe == 0x10 && (cw & 0x20)) { + env.status |= MSVCRT__SW_INEXACT; + } else { + exception = EXCEPTION_FLT_INEXACT_RESULT; + } + } + + if (exception) + env.status = 0; + MSVCRT_fesetenv(&env); + if (exception) + RaiseException(exception, 0, 1, &exception_arg); + + if (cw & 0x1) fpword |= MSVCRT__EM_INVALID; + if (cw & 0x2) fpword |= MSVCRT__EM_DENORMAL; + if (cw & 0x4) fpword |= MSVCRT__EM_ZERODIVIDE; + if (cw & 0x8) fpword |= MSVCRT__EM_OVERFLOW; + if (cw & 0x10) fpword |= MSVCRT__EM_UNDERFLOW; + if (cw & 0x20) fpword |= MSVCRT__EM_INEXACT; + switch (cw & 0xc00) + { + case 0xc00: fpword |= MSVCRT__RC_UP|MSVCRT__RC_DOWN; break; + case 0x800: fpword |= MSVCRT__RC_UP; break; + case 0x400: fpword |= MSVCRT__RC_DOWN; break; + } + switch (cw & 0x300) + { + case 0x0: fpword |= MSVCRT__PC_24; break; + case 0x200: fpword |= MSVCRT__PC_53; break; + case 0x300: fpword |= MSVCRT__PC_64; break; + } + if (cw & 0x1000) fpword |= MSVCRT__IC_AFFINE; + _control87(fpword, 0xffffffff); + + return res; +} diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 7602698..5c97d8b 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -271,7 +271,7 @@ @ cdecl _endthreadex(long) @ cdecl _eof(long) MSVCRT__eof @ cdecl _errno() MSVCRT__errno -@ stub _except1 +@ cdecl _except1(long long double double long ptr) @ cdecl -arch=i386 _except_handler2(ptr ptr ptr ptr) @ cdecl -arch=i386 _except_handler3(ptr ptr ptr ptr) @ cdecl -arch=i386 _except_handler4_common(ptr ptr ptr ptr ptr ptr)
1
0
0
0
Lauri Kenttä : crypt32: Remove unused parameter and dead code.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: e37612329fe4a1a6ac0a0a4a32ba5143f464dab6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e37612329fe4a1a6ac0a0a4a3…
Author: Lauri Kenttä <lauri.kentta(a)gmail.com> Date: Fri Feb 17 16:46:51 2017 +0200 crypt32: Remove unused parameter and dead code. Signed-off-by: Lauri Kenttä <lauri.kentta(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/base64.c | 90 +++++++++++++-------------------------------------- 1 file changed, 22 insertions(+), 68 deletions(-) diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c index 40ce9dc..4a904d4 100644 --- a/dlls/crypt32/base64.c +++ b/dlls/crypt32/base64.c @@ -604,7 +604,7 @@ static LONG Base64ToBinaryA(LPCSTR pszString, DWORD cchString, static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, - DWORD *pcbBinary, DWORD *pdwSkip, BOOL exactHeaderAndTrailerMatch) + DWORD *pcbBinary, DWORD *pdwSkip) { LONG ret; LPCSTR header = CERT_HEADER_START; @@ -627,43 +627,20 @@ static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString, } dataBegins = headerBegins + strlen(header); - if (!exactHeaderAndTrailerMatch) + if (!(dataBegins = strstr(dataBegins, CERT_DELIMITER))) { - if ((dataBegins = strstr(dataBegins, CERT_DELIMITER))) - { - dataBegins += strlen(CERT_DELIMITER); - } - else - { - return ERROR_INVALID_DATA; - } + return ERROR_INVALID_DATA; } + dataBegins += strlen(CERT_DELIMITER); if (*dataBegins == '\r') dataBegins++; if (*dataBegins == '\n') dataBegins++; - if (exactHeaderAndTrailerMatch) - { - trailerBegins = pszString + cchString - strlen(trailer); - if (pszString[cchString - 1] == '\n') trailerBegins--; - if (pszString[cchString - 2] == '\r') trailerBegins--; - - if (*(trailerBegins-1) == '\n') trailerBegins--; - if (*(trailerBegins-1) == '\r') trailerBegins--; - - if (!strncmp(trailerBegins, trailer, strlen(trailer))) - { - return ERROR_INVALID_DATA; - } - } - else + if (!(trailerBegins = strstr(dataBegins, trailer))) { - if (!(trailerBegins = strstr(dataBegins, trailer))) - { - return ERROR_INVALID_DATA; - } - if (*(trailerBegins-1) == '\n') trailerBegins--; - if (*(trailerBegins-1) == '\r') trailerBegins--; + return ERROR_INVALID_DATA; } + if (*(trailerBegins-1) == '\n') trailerBegins--; + if (*(trailerBegins-1) == '\r') trailerBegins--; if (pdwSkip) *pdwSkip = headerBegins - pszString; @@ -680,7 +657,7 @@ static LONG Base64HeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64HEADER; @@ -691,7 +668,7 @@ static LONG Base64RequestHeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64REQUESTHEADER; @@ -702,7 +679,7 @@ static LONG Base64X509HeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64X509CRLHEADER; @@ -838,7 +815,7 @@ static LONG Base64ToBinaryW(LPCWSTR pszString, DWORD cchString, static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, - DWORD *pcbBinary, DWORD *pdwSkip, BOOL exactHeaderAndTrailerMatch) + DWORD *pcbBinary, DWORD *pdwSkip) { LONG ret; LPCWSTR header = CERT_HEADER_START_W; @@ -861,43 +838,20 @@ static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString, } dataBegins = headerBegins + strlenW(header); - if (!exactHeaderAndTrailerMatch) + if (!(dataBegins = strstrW(dataBegins, CERT_DELIMITER_W))) { - if ((dataBegins = strstrW(dataBegins, CERT_DELIMITER_W))) - { - dataBegins += strlenW(CERT_DELIMITER_W); - } - else - { - return ERROR_INVALID_DATA; - } + return ERROR_INVALID_DATA; } + dataBegins += strlenW(CERT_DELIMITER_W); if (*dataBegins == '\r') dataBegins++; if (*dataBegins == '\n') dataBegins++; - if (exactHeaderAndTrailerMatch) - { - trailerBegins = pszString + cchString - strlenW(trailer); - if (pszString[cchString - 1] == '\n') trailerBegins--; - if (pszString[cchString - 2] == '\r') trailerBegins--; - - if (*(trailerBegins-1) == '\n') trailerBegins--; - if (*(trailerBegins-1) == '\r') trailerBegins--; - - if (!strncmpW(trailerBegins, trailer, strlenW(trailer))) - { - return ERROR_INVALID_DATA; - } - } - else + if (!(trailerBegins = strstrW(dataBegins, trailer))) { - if (!(trailerBegins = strstrW(dataBegins, trailer))) - { - return ERROR_INVALID_DATA; - } - if (*(trailerBegins-1) == '\n') trailerBegins--; - if (*(trailerBegins-1) == '\r') trailerBegins--; + return ERROR_INVALID_DATA; } + if (*(trailerBegins-1) == '\n') trailerBegins--; + if (*(trailerBegins-1) == '\r') trailerBegins--; if (pdwSkip) *pdwSkip = headerBegins - pszString; @@ -914,7 +868,7 @@ static LONG Base64HeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64HEADER; @@ -925,7 +879,7 @@ static LONG Base64RequestHeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64REQUESTHEADER; @@ -936,7 +890,7 @@ static LONG Base64X509HeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags) { LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString, - pbBinary, pcbBinary, pdwSkip, FALSE); + pbBinary, pcbBinary, pdwSkip); if (!ret && pdwFlags) *pdwFlags = CRYPT_STRING_BASE64X509CRLHEADER;
1
0
0
0
Lauri Kenttä : crypt32: Fix wrong Base64 trailer WCHAR constants.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 254eb21c6f659088b1f9e0d95b86ee33ded11474 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=254eb21c6f659088b1f9e0d95…
Author: Lauri Kenttä <lauri.kentta(a)gmail.com> Date: Fri Feb 17 16:45:54 2017 +0200 crypt32: Fix wrong Base64 trailer WCHAR constants. Signed-off-by: Lauri Kenttä <lauri.kentta(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/base64.c | 4 ++-- dlls/crypt32/tests/base64.c | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c index 6c2e252..40ce9dc 100644 --- a/dlls/crypt32/base64.c +++ b/dlls/crypt32/base64.c @@ -47,10 +47,10 @@ static const WCHAR CERT_HEADER_START_W[] = { static const WCHAR CERT_DELIMITER_W[] = { '-','-','-','-','-',0 }; static const WCHAR CERT_TRAILER_W[] = { -'-','-','-','-','-','E','N','D',' ',0 }; -static const WCHAR CERT_TRAILER_START_W[] = { '-','-','-','-','-','E','N','D',' ','C','E','R','T','I','F','I','C','A','T', 'E','-','-','-','-','-',0 }; +static const WCHAR CERT_TRAILER_START_W[] = { +'-','-','-','-','-','E','N','D',' ',0 }; static const WCHAR CERT_REQUEST_HEADER_W[] = { '-','-','-','-','-','B','E','G','I','N',' ','N','E','W',' ','C','E','R','T', 'I','F','I','C','A','T','E','R','E','Q','U','E','S','T','-','-','-','-','-',0 }; diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c index fb70ca0..2e7e488 100644 --- a/dlls/crypt32/tests/base64.c +++ b/dlls/crypt32/tests/base64.c @@ -47,6 +47,9 @@ static BOOL (WINAPI *pCryptBinaryToStringA)(const BYTE *pbBinary, static BOOL (WINAPI *pCryptStringToBinaryA)(LPCSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags); +static BOOL (WINAPI *pCryptStringToBinaryW)(LPCWSTR pszString, + DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, + DWORD *pdwSkip, DWORD *pdwFlags); struct BinTests { @@ -299,10 +302,24 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header, } } +static void decodeBase64WithLenFmtW(LPCSTR strA, int len, DWORD fmt, BOOL retA, + const BYTE *bufA, DWORD bufLenA, DWORD fmtUsedA) +{ + BYTE buf[8] = {0}; + DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef; + BOOL ret; + WCHAR strW[64]; + int i; + for (i = 0; (strW[i] = strA[i]) != 0; ++i); + ret = pCryptStringToBinaryW(strW, len, fmt, buf, &bufLen, NULL, &fmtUsed); + ok(ret == retA && bufLen == bufLenA && memcmp(bufA, buf, bufLen) == 0 + && fmtUsed == fmtUsedA, "base64 \"%s\" len %d: W and A differ\n", strA, len); +} + static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expected, int le, BOOL isBroken) { BYTE buf[8] = {0}; - DWORD bufLen = sizeof(buf)-1, fmtUsed; + DWORD bufLen = sizeof(buf)-1, fmtUsed = 0xdeadbeef; BOOL ret; SetLastError(0xdeadbeef); ret = pCryptStringToBinaryA(str, len, fmt, buf, &bufLen, NULL, &fmtUsed); @@ -320,6 +337,8 @@ static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expect "base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %d)\n", str, len, (char*)buf, ret, GetLastError()); } + if (pCryptStringToBinaryW) + decodeBase64WithLenFmtW(str, len, fmt, ret, buf, bufLen, fmtUsed); } static void decodeBase64WithLenBroken(LPCSTR str, int len, LPCSTR expected, int le) @@ -539,6 +558,7 @@ START_TEST(base64) pCryptBinaryToStringA = (void *)GetProcAddress(lib, "CryptBinaryToStringA"); pCryptStringToBinaryA = (void *)GetProcAddress(lib, "CryptStringToBinaryA"); + pCryptStringToBinaryW = (void *)GetProcAddress(lib, "CryptStringToBinaryW"); if (pCryptBinaryToStringA) testBinaryToStringA();
1
0
0
0
Jacek Caban : mshtml: Removed no longer used attr_name from event_info_t.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 794e424c2a8cb5f9930b7ed7ab635e4a9519a148 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=794e424c2a8cb5f9930b7ed7a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Feb 17 13:17:16 2017 +0100 mshtml: Removed no longer used attr_name from event_info_t. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmlevent.c | 142 ++++++++++++------------------------------------ 1 file changed, 36 insertions(+), 106 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=794e424c2a8cb5f9930b7…
1
0
0
0
Jacek Caban : mshtml: Don't use attr_name in attr_to_eid.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: e89c279d1ce7d047756e70e1013ccd930f8405fb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e89c279d1ce7d047756e70e10…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Feb 17 13:17:09 2017 +0100 mshtml: Don't use attr_name in attr_to_eid. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmlevent.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 7c25ad9..c776ee3 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -268,12 +268,15 @@ eventid_t str_to_eid(LPCWSTR str) return EVENTID_LAST; } -static eventid_t attr_to_eid(LPCWSTR str) +static eventid_t attr_to_eid(const WCHAR *str) { int i; + if((str[0] != 'o' && str[0] != 'O') || (str[1] != 'n' && str[1] != 'N')) + return EVENTID_LAST; + for(i=0; i < sizeof(event_info)/sizeof(event_info[0]); i++) { - if(!strcmpW(event_info[i].attr_name, str)) + if(!strcmpW(event_info[i].name, str+2)) return i; }
1
0
0
0
Jacek Caban : mshtml: Added get_event_dispex_ref helper that avoids using attr_name.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 607a8d0121dcdee783f808eeb9dc7e32ac47f936 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=607a8d0121dcdee783f808eeb…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Feb 17 13:17:02 2017 +0100 mshtml: Added get_event_dispex_ref helper that avoids using attr_name. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmlevent.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 13fda24..7c25ad9 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1396,13 +1396,22 @@ void detach_events(HTMLDocumentNode *doc) release_nsevents(doc); } +static HRESULT get_event_dispex_ref(EventTarget *event_target, eventid_t eid, BOOL alloc, VARIANT **ret) +{ + WCHAR buf[64]; + buf[0] = 'o'; + buf[1] = 'n'; + strcpyW(buf+2, event_info[eid].name); + return dispex_get_dprop_ref(&event_target->dispex, buf, alloc, ret); +} + static void remove_event_handler(EventTarget *event_target, eventid_t eid) { handler_vector_t *handler_vector; VARIANT *store; HRESULT hres; - hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, FALSE, &store); + hres = get_event_dispex_ref(event_target, eid, FALSE, &store); if(SUCCEEDED(hres)) VariantClear(store); @@ -1458,7 +1467,7 @@ HRESULT set_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var */ remove_event_handler(event_target, eid); - hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, TRUE, &v); + hres = get_event_dispex_ref(event_target, eid, TRUE, &v); if(FAILED(hres)) return hres; @@ -1485,7 +1494,7 @@ HRESULT get_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var VARIANT *v; HRESULT hres; - hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, FALSE, &v); + hres = get_event_dispex_ref(event_target, eid, FALSE, &v); if(SUCCEEDED(hres) && V_VT(v) != VT_EMPTY) { V_VT(var) = VT_EMPTY; return VariantCopy(var, v);
1
0
0
0
Jacek Caban : mshtml: Reimplemented check_event_attr to iterate though declared attributes instead of all known events.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 9f0be726180a9655fe2ae21092b5c1440bb55b17 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9f0be726180a9655fe2ae2109…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Feb 17 13:16:56 2017 +0100 mshtml: Reimplemented check_event_attr to iterate though declared attributes instead of all known events. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmlevent.c | 84 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 77c998f..13fda24 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1596,34 +1596,82 @@ void update_doc_cp_events(HTMLDocumentNode *doc, cp_static_data_t *cp) void check_event_attr(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) { - const PRUnichar *attr_value; - nsAString attr_value_str; + nsIDOMMozNamedAttrMap *attr_map; + const PRUnichar *name, *value; + nsAString name_str, value_str; + HTMLDOMNode *node = NULL; + cpp_bool has_attrs; + nsIDOMAttr *attr; IDispatch *disp; - HTMLDOMNode *node; - int i; + UINT32 length, i; + eventid_t eid; nsresult nsres; HRESULT hres; - for(i=0; i < EVENTID_LAST; i++) { - nsres = get_elem_attr_value(nselem, event_info[i].attr_name, &attr_value_str, &attr_value); - if(NS_SUCCEEDED(nsres)) { - if(!*attr_value) - continue; + nsres = nsIDOMHTMLElement_HasAttributes(nselem, &has_attrs); + if(NS_FAILED(nsres) || !has_attrs) + return; - TRACE("%p.%s = %s\n", nselem, debugstr_w(event_info[i].attr_name), debugstr_w(attr_value)); + nsres = nsIDOMHTMLElement_GetAttributes(nselem, &attr_map); + if(NS_FAILED(nsres)) + return; - disp = script_parse_event(doc->window, attr_value); - if(disp) { - hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node); - if(SUCCEEDED(hres)) { - set_event_handler_disp(&node->event_target, i, disp); - node_release(node); - } + nsres = nsIDOMMozNamedAttrMap_GetLength(attr_map, &length); + assert(nsres == NS_OK); + + nsAString_Init(&name_str, NULL); + nsAString_Init(&value_str, NULL); + + for(i = 0; i < length; i++) { + nsres = nsIDOMMozNamedAttrMap_Item(attr_map, i, &attr); + if(NS_FAILED(nsres)) + continue; + + nsres = nsIDOMAttr_GetName(attr, &name_str); + if(NS_FAILED(nsres)) { + nsIDOMAttr_Release(attr); + continue; + } + + nsAString_GetData(&name_str, &name); + eid = attr_to_eid(name); + if(eid == EVENTID_LAST) { + nsIDOMAttr_Release(attr); + continue; + } + + nsres = nsIDOMAttr_GetValue(attr, &value_str); + nsIDOMAttr_Release(attr); + if(NS_FAILED(nsres)) + continue; + + nsAString_GetData(&value_str, &value); + if(!*value) + continue; + + TRACE("%p.%s = %s\n", nselem, debugstr_w(name), debugstr_w(value)); + + disp = script_parse_event(doc->window, value); + if(!disp) + continue; + + if(!node) { + hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node); + if(FAILED(hres)) { IDispatch_Release(disp); + break; } - nsAString_Finish(&attr_value_str); } + + set_event_handler_disp(&node->event_target, eid, disp); + IDispatch_Release(disp); } + + if(node) + node_release(node); + nsAString_Finish(&name_str); + nsAString_Finish(&value_str); + nsIDOMMozNamedAttrMap_Release(attr_map); } HRESULT doc_init_events(HTMLDocumentNode *doc)
1
0
0
0
Henri Verbeet : wined3d: Introduce a helper function to enable lights.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: 03a046f96713cff235f3c8583e0547955070266c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=03a046f96713cff235f3c8583…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Feb 17 14:08:18 2017 +0100 wined3d: Introduce a helper function to enable lights. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 65 ++++-------------------------------------- dlls/wined3d/stateblock.c | 45 +++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 53 insertions(+), 59 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e68827c..2c8da30 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1678,6 +1678,7 @@ HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device, HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) { struct wined3d_light_info *light_info; + int prev_idx; TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable); @@ -1694,66 +1695,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN } } - if (!enable) + prev_idx = light_info->glIndex; + wined3d_state_enable_light(device->update_state, &device->adapter->d3d_info, light_info, enable); + if (!device->recording && light_info->glIndex != prev_idx) { - if (light_info->glIndex != -1) - { - if (!device->recording) - { - device_invalidate_state(device, STATE_LIGHT_TYPE); - device_invalidate_state(device, STATE_ACTIVELIGHT(light_info->glIndex)); - } - - device->update_state->lights[light_info->glIndex] = NULL; - light_info->glIndex = -1; - } - else - { - TRACE("Light already disabled, nothing to do\n"); - } - light_info->enabled = FALSE; - } - else - { - light_info->enabled = TRUE; - if (light_info->glIndex != -1) - { - TRACE("Nothing to do as light was enabled\n"); - } - else - { - unsigned int light_count = device->adapter->d3d_info.limits.active_light_count; - unsigned int i; - - /* Find a free light. */ - for (i = 0; i < light_count; ++i) - { - if (!device->update_state->lights[i]) - { - device->update_state->lights[i] = light_info; - light_info->glIndex = i; - break; - } - } - if (light_info->glIndex == -1) - { - /* Our tests show that Windows returns D3D_OK in this situation, even with - * D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices. This - * is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns TRUE - * as well for those lights. - * - * TODO: Test how this affects rendering. */ - WARN("Too many concurrently active lights\n"); - return WINED3D_OK; - } - - /* i == light_info->glIndex */ - if (!device->recording) - { - device_invalidate_state(device, STATE_LIGHT_TYPE); - device_invalidate_state(device, STATE_ACTIVELIGHT(i)); - } - } + device_invalidate_state(device, STATE_LIGHT_TYPE); + device_invalidate_state(device, STATE_ACTIVELIGHT(enable ? light_info->glIndex : prev_idx)); } return WINED3D_OK; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 70e31a2..22e511f 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -575,6 +575,51 @@ struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *s return NULL; } +void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, + struct wined3d_light_info *light_info, BOOL enable) +{ + unsigned int light_count, i; + + if (!(light_info->enabled = enable)) + { + if (light_info->glIndex == -1) + { + TRACE("Light already disabled, nothing to do.\n"); + return; + } + + state->lights[light_info->glIndex] = NULL; + light_info->glIndex = -1; + return; + } + + if (light_info->glIndex != -1) + { + TRACE("Light already enabled, nothing to do.\n"); + return; + } + + /* Find a free light. */ + light_count = d3d_info->limits.active_light_count; + for (i = 0; i < light_count; ++i) + { + if (state->lights[i]) + continue; + + state->lights[i] = light_info; + light_info->glIndex = i; + return; + } + + /* Our tests show that Windows returns D3D_OK in this situation, even with + * D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices. + * This is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns + * TRUE * as well for those lights. + * + * TODO: Test how this affects rendering. */ + WARN("Too many concurrently active lights.\n"); +} + static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state) { UINT i; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 585055c..4c70c97 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3140,6 +3140,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; +void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, + struct wined3d_light_info *light_info, BOOL enable) DECLSPEC_HIDDEN; struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state, unsigned int idx) DECLSPEC_HIDDEN; void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
1
0
0
0
Henri Verbeet : wined3d: Introduce a helper function to lookup a wined3d_light_info structure.
by Alexandre Julliard
17 Feb '17
17 Feb '17
Module: wine Branch: master Commit: e947aa4b038e6282c7c7dc6e5950a7668c16a9f8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e947aa4b038e6282c7c7dc6e5…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Feb 17 14:08:17 2017 +0100 wined3d: Introduce a helper function to lookup a wined3d_light_info structure. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 64 ++++++------------------------------------ dlls/wined3d/stateblock.c | 15 ++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 25 insertions(+), 56 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8192bf9..e68827c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1513,7 +1513,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, { UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); struct wined3d_light_info *object = NULL; - struct list *e; float rho; TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light); @@ -1547,15 +1546,7 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } - LIST_FOR_EACH(e, &device->update_state->light_map[hash_idx]) - { - object = LIST_ENTRY(e, struct wined3d_light_info, entry); - if (object->OriginalIndex == light_idx) - break; - object = NULL; - } - - if (!object) + if (!(object = wined3d_state_get_light(device->update_state, light_idx))) { TRACE("Adding new light\n"); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); @@ -1670,21 +1661,11 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device, UINT light_idx, struct wined3d_light *light) { - UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); - struct wined3d_light_info *light_info = NULL; - struct list *e; + struct wined3d_light_info *light_info; TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light); - LIST_FOR_EACH(e, &device->state.light_map[hash_idx]) - { - light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); - if (light_info->OriginalIndex == light_idx) - break; - light_info = NULL; - } - - if (!light_info) + if (!(light_info = wined3d_state_get_light(&device->state, light_idx))) { TRACE("Light information requested but light not defined\n"); return WINED3DERR_INVALIDCALL; @@ -1696,36 +1677,17 @@ HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device, HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) { - UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); - struct wined3d_light_info *light_info = NULL; - struct list *e; + struct wined3d_light_info *light_info; TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable); - LIST_FOR_EACH(e, &device->update_state->light_map[hash_idx]) - { - light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); - if (light_info->OriginalIndex == light_idx) - break; - light_info = NULL; - } - TRACE("Found light %p.\n", light_info); - /* Special case - enabling an undefined light creates one with a strict set of parameters. */ - if (!light_info) + if (!(light_info = wined3d_state_get_light(device->update_state, light_idx))) { TRACE("Light enabled requested but light not defined, so defining one!\n"); wined3d_device_set_light(device, light_idx, &WINED3D_default_light); - /* Search for it again! Should be fairly quick as near head of list. */ - LIST_FOR_EACH(e, &device->update_state->light_map[hash_idx]) - { - light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); - if (light_info->OriginalIndex == light_idx) - break; - light_info = NULL; - } - if (!light_info) + if (!(light_info = wined3d_state_get_light(device->update_state, light_idx))) { FIXME("Adding default lights has failed dismally\n"); return WINED3DERR_INVALIDCALL; @@ -1799,21 +1761,11 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN HRESULT CDECL wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable) { - UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); - struct wined3d_light_info *light_info = NULL; - struct list *e; + struct wined3d_light_info *light_info; TRACE("device %p, light_idx %u, enable %p.\n", device, light_idx, enable); - LIST_FOR_EACH(e, &device->state.light_map[hash_idx]) - { - light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); - if (light_info->OriginalIndex == light_idx) - break; - light_info = NULL; - } - - if (!light_info) + if (!(light_info = wined3d_state_get_light(&device->state, light_idx))) { TRACE("Light enabled state requested but light not defined.\n"); return WINED3DERR_INVALIDCALL; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 7ab544d..70e31a2 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -560,6 +560,21 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) return refcount; } +struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state, unsigned int idx) +{ + struct wined3d_light_info *light_info; + unsigned int hash_idx; + + hash_idx = LIGHTMAP_HASHFUNC(idx); + LIST_FOR_EACH_ENTRY(light_info, &state->light_map[hash_idx], struct wined3d_light_info, entry) + { + if (light_info->OriginalIndex == idx) + return light_info; + } + + return NULL; +} + static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state) { UINT i; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 49fba06..585055c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3140,6 +3140,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; +struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state, + unsigned int idx) DECLSPEC_HIDDEN; void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
84
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
Results per page:
10
25
50
100
200