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
November 2020
----- 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
1 participants
851 discussions
Start a n
N
ew thread
Chip Davis : msvcrt: Share locale names between threadlocinfo instances.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: 9cb112ca25cd8fea8e010d9019f7a5fc6a6ffea2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9cb112ca25cd8fea8e010d90…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Wed Nov 18 17:25:50 2020 +0100 msvcrt: Share locale names between threadlocinfo instances. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/locale.c | 57 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index a305f88e808..b6c36ac4cf1 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -380,6 +380,24 @@ LCID MSVCRT_locale_to_LCID(const char *locale, unsigned short *codepage, BOOL *s return lcid; } +static void copy_threadlocinfo_category(MSVCRT_pthreadlocinfo locinfo, + const MSVCRT_threadlocinfo *old_locinfo, int category) +{ + locinfo->lc_handle[category] = old_locinfo->lc_handle[category]; + locinfo->lc_id[category] = old_locinfo->lc_id[category]; + if(!locinfo->lc_category[category].locale) { + locinfo->lc_category[category].locale = old_locinfo->lc_category[category].locale; + locinfo->lc_category[category].refcount = old_locinfo->lc_category[category].refcount; + InterlockedIncrement(locinfo->lc_category[category].refcount); + } +#if _MSVCR_VER >= 110 + locinfo->lc_name[category] = old_locinfo->lc_name[category]; + locinfo->lc_category[category].wrefcount = old_locinfo->lc_category[category].wrefcount; + if(locinfo->lc_category[category].wrefcount) + InterlockedIncrement(locinfo->lc_category[category].wrefcount); +#endif +} + static BOOL init_category_name(const char *name, int len, MSVCRT_pthreadlocinfo locinfo, int category) { @@ -934,12 +952,18 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo) return; for(i=MSVCRT_LC_MIN+1; i<=MSVCRT_LC_MAX; i++) { - MSVCRT_free(locinfo->lc_category[i].locale); - MSVCRT_free(locinfo->lc_category[i].refcount); - MSVCRT_free(locinfo->lc_category[i].wrefcount); + if(!locinfo->lc_category[i].refcount + || !InterlockedDecrement(locinfo->lc_category[i].refcount)) { + MSVCRT_free(locinfo->lc_category[i].locale); + MSVCRT_free(locinfo->lc_category[i].refcount); + } + if(!locinfo->lc_category[i].wrefcount + || !InterlockedDecrement(locinfo->lc_category[i].wrefcount)) { #if _MSVCR_VER >= 110 - MSVCRT_free(locinfo->lc_name[i]); + MSVCRT_free(locinfo->lc_name[i]); #endif + MSVCRT_free(locinfo->lc_category[i].wrefcount); + } } if(locinfo->lconv) { @@ -1240,8 +1264,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, if(!category_needs_update(MSVCRT_LC_COLLATE, category, old_locinfo, lcid[MSVCRT_LC_COLLATE], cp[MSVCRT_LC_COLLATE])) { - locinfo->lc_handle[MSVCRT_LC_COLLATE] = old_locinfo->lc_handle[MSVCRT_LC_COLLATE]; - locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage = old_locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage; + copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_COLLATE); } else if(lcid[MSVCRT_LC_COLLATE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_COLLATE)) { if(!update_threadlocinfo_category(lcid[MSVCRT_LC_COLLATE], cp[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) { @@ -1266,8 +1289,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, if(!category_needs_update(MSVCRT_LC_CTYPE, category, old_locinfo, lcid[MSVCRT_LC_CTYPE], cp[MSVCRT_LC_CTYPE])) { - locinfo->lc_handle[MSVCRT_LC_CTYPE] = old_locinfo->lc_handle[MSVCRT_LC_CTYPE]; - locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage = old_locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage; + copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_CTYPE); } else if(lcid[MSVCRT_LC_CTYPE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_CTYPE)) { CPINFO cp_info; int j; @@ -1354,8 +1376,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, if(!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo, lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])) { - locinfo->lc_handle[MSVCRT_LC_MONETARY] = old_locinfo->lc_handle[MSVCRT_LC_MONETARY]; - locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage = old_locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage; + copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_MONETARY); } else if(lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY)) { if(!update_threadlocinfo_category(lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) { @@ -1632,8 +1653,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, if(!category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo, lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) { - locinfo->lc_handle[MSVCRT_LC_NUMERIC] = old_locinfo->lc_handle[MSVCRT_LC_NUMERIC]; - locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage = old_locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage; + copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_NUMERIC); } else if(lcid[MSVCRT_LC_NUMERIC] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_NUMERIC)) { if(!update_threadlocinfo_category(lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC)) { @@ -1748,8 +1768,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, if(!category_needs_update(MSVCRT_LC_TIME, category, old_locinfo, lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME])) { - locinfo->lc_handle[MSVCRT_LC_TIME] = old_locinfo->lc_handle[MSVCRT_LC_TIME]; - locinfo->lc_id[MSVCRT_LC_TIME].wCodePage = old_locinfo->lc_id[MSVCRT_LC_TIME].wCodePage; + copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_TIME); } else if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) { if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME)) { @@ -1883,6 +1902,8 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale) locinfo->lc_id[MSVCRT_LC_COLLATE] = newlocinfo->lc_id[MSVCRT_LC_COLLATE]; + swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_COLLATE].wrefcount, + (void**)&newlocinfo->lc_category[MSVCRT_LC_COLLATE].wrefcount); #if _MSVCR_VER >= 110 swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_COLLATE], (void**)&newlocinfo->lc_name[MSVCRT_LC_COLLATE]); @@ -1913,6 +1934,8 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale) swap_pointers((void**)&locinfo->pclmap, (void**)&newlocinfo->pclmap); swap_pointers((void**)&locinfo->pcumap, (void**)&newlocinfo->pcumap); + swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_CTYPE].wrefcount, + (void**)&newlocinfo->lc_category[MSVCRT_LC_CTYPE].wrefcount); #if _MSVCR_VER >= 110 swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_CTYPE], (void**)&newlocinfo->lc_name[MSVCRT_LC_CTYPE]); @@ -1971,6 +1994,8 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale) locinfo->lconv->p_sign_posn = newlocinfo->lconv->p_sign_posn; locinfo->lconv->n_sign_posn = newlocinfo->lconv->n_sign_posn; + swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_MONETARY].wrefcount, + (void**)&newlocinfo->lc_category[MSVCRT_LC_MONETARY].wrefcount); #if _MSVCR_VER >= 110 swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_MONETARY], (void**)&newlocinfo->lc_name[MSVCRT_LC_MONETARY]); @@ -2004,6 +2029,8 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale) (void**)&newlocinfo->lconv->_W_thousands_sep); #endif + swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_NUMERIC].wrefcount, + (void**)&newlocinfo->lc_category[MSVCRT_LC_NUMERIC].wrefcount); #if _MSVCR_VER >= 110 swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_NUMERIC], (void**)&newlocinfo->lc_name[MSVCRT_LC_NUMERIC]); @@ -2025,6 +2052,8 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale) swap_pointers((void**)&locinfo->lc_time_curr, (void**)&newlocinfo->lc_time_curr); + swap_pointers((void**)&locinfo->lc_category[MSVCRT_LC_TIME].wrefcount, + (void**)&newlocinfo->lc_category[MSVCRT_LC_TIME].wrefcount); #if _MSVCR_VER >= 110 swap_pointers((void**)&locinfo->lc_name[MSVCRT_LC_TIME], (void**)&newlocinfo->lc_name[MSVCRT_LC_TIME]);
1
0
0
0
Piotr Caban : msvcrt: locinfo->lc_name should be guarded by lc_category->wrefcount.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: 84559266626938582b065cbb52e1b2a221116f02 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=84559266626938582b065cbb…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Nov 18 17:25:47 2020 +0100 msvcrt: locinfo->lc_name should be guarded by lc_category->wrefcount. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/locale.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index ca50fc7e390..a305f88e808 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -407,6 +407,11 @@ static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) WCHAR buf[100]; int len; + locinfo->lc_category[cat].wrefcount = MSVCRT_malloc(sizeof(int)); + if(!locinfo->lc_category[cat].wrefcount) + return FALSE; + *locinfo->lc_category[cat].wrefcount = 1; + len = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME |LOCALE_NOUSEROVERRIDE, buf, 100); if(!len) return FALSE; @@ -931,6 +936,7 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo) for(i=MSVCRT_LC_MIN+1; i<=MSVCRT_LC_MAX; i++) { MSVCRT_free(locinfo->lc_category[i].locale); MSVCRT_free(locinfo->lc_category[i].refcount); + MSVCRT_free(locinfo->lc_category[i].wrefcount); #if _MSVCR_VER >= 110 MSVCRT_free(locinfo->lc_name[i]); #endif
1
0
0
0
Piotr Caban : msvcrt: Call set_lc_locale_name in update_threadlocinfo_category.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: 3ecede0c613feb1573061e1cbd518d9a5b13735a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3ecede0c613feb1573061e1c…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Nov 18 17:25:44 2020 +0100 msvcrt: Call set_lc_locale_name in update_threadlocinfo_category. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/locale.c | 81 +++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 52 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 4b20f097758..ca50fc7e390 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -400,6 +400,33 @@ static BOOL init_category_name(const char *name, int len, return TRUE; } +#if _MSVCR_VER >= 110 +static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) +{ + LCID lcid = locinfo->lc_handle[cat]; + WCHAR buf[100]; + int len; + + len = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME + |LOCALE_NOUSEROVERRIDE, buf, 100); + if(!len) return FALSE; + + if(LocaleNameToLCID(buf, 0) != lcid) + len = LCIDToLocaleName(lcid, buf, 100, 0); + + if(!len || !(locinfo->lc_name[cat] = MSVCRT_malloc(len*sizeof(MSVCRT_wchar_t)))) + return FALSE; + + memcpy(locinfo->lc_name[cat], buf, len*sizeof(MSVCRT_wchar_t)); + return TRUE; +} +#else +static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) +{ + return TRUE; +} +#endif + /* INTERNAL: Set lc_handle, lc_id and lc_category in threadlocinfo struct */ static BOOL update_threadlocinfo_category(LCID lcid, unsigned short cp, MSVCRT_pthreadlocinfo locinfo, int category) @@ -429,6 +456,8 @@ static BOOL update_threadlocinfo_category(LCID lcid, unsigned short cp, locinfo->lc_handle[category] = lcid; + set_lc_locale_name(locinfo, category); + if(!locinfo->lc_category[category].locale) { int len = 0; @@ -1007,33 +1036,6 @@ void CDECL MSVCRT__free_locale(MSVCRT__locale_t locale) MSVCRT_free(locale); } -#if _MSVCR_VER >= 110 -static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) -{ - LCID lcid = locinfo->lc_handle[cat]; - WCHAR buf[100]; - int len; - - len = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME - |LOCALE_NOUSEROVERRIDE, buf, 100); - if(!len) return FALSE; - - if(LocaleNameToLCID(buf, 0) != lcid) - len = LCIDToLocaleName(lcid, buf, 100, 0); - - if(!len || !(locinfo->lc_name[cat] = MSVCRT_malloc(len*sizeof(MSVCRT_wchar_t)))) - return FALSE; - - memcpy(locinfo->lc_name[cat], buf, len*sizeof(MSVCRT_wchar_t)); - return TRUE; -} -#else -static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) -{ - return TRUE; -} -#endif - static inline BOOL category_needs_update(int cat, int user_cat, const MSVCRT_threadlocinfo *locinfo, LCID lcid, unsigned short cp) { @@ -1242,11 +1244,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, } locinfo->lc_collate_cp = locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage; - - if(!set_lc_locale_name(locinfo, MSVCRT_LC_COLLATE)) { - free_locinfo(locinfo); - return NULL; - } } else { if(!init_category_name("C", 1, locinfo, MSVCRT_LC_COLLATE)) { free_locinfo(locinfo); @@ -1309,11 +1306,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, for(j=cp_info.LeadByte[i]; j<=cp_info.LeadByte[i+1]; j++) locinfo->ctype1[j+1] |= MSVCRT__LEADBYTE; - if(!set_lc_locale_name(locinfo, MSVCRT_LC_CTYPE)) { - free_locinfo(locinfo); - return NULL; - } - for(i=0; i<256; i++) { if(locinfo->pctype[i] & MSVCRT__LEADBYTE) buf[i] = ' '; @@ -1563,11 +1555,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, return NULL; } #endif - - if(!set_lc_locale_name(locinfo, MSVCRT_LC_MONETARY)) { - free_locinfo(locinfo); - return NULL; - } } else { locinfo->lconv->int_curr_symbol = MSVCRT_malloc(sizeof(char)); locinfo->lconv->currency_symbol = MSVCRT_malloc(sizeof(char)); @@ -1711,11 +1698,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, return NULL; } #endif - - if(!set_lc_locale_name(locinfo, MSVCRT_LC_NUMERIC)) { - free_locinfo(locinfo); - return NULL; - } } else { locinfo->lconv->decimal_point = MSVCRT_malloc(sizeof(char[2])); locinfo->lconv->thousands_sep = MSVCRT_malloc(sizeof(char)); @@ -1769,11 +1751,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, return NULL; } - if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME)) { - free_locinfo(locinfo); - return NULL; - } - locinfo->lc_time_curr = create_time_data(lcid[MSVCRT_LC_TIME]); if(!locinfo->lc_time_curr) { free_locinfo(locinfo);
1
0
0
0
Charles Davis : msvcrt: Make locale name string refcounted for C locale.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: db55e0701628b08050fb479acb399e6eebf2e42f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=db55e0701628b08050fb479a…
Author: Charles Davis <cdavis(a)codeweavers.com> Date: Wed Nov 18 17:25:39 2020 +0100 msvcrt: Make locale name string refcounted for C locale. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr90/tests/msvcr90.c | 64 +++++++++++++++----------------------------- dlls/msvcrt/locale.c | 28 ++++++++++++++----- 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c index 504dbf53d8f..476ad222fcf 100644 --- a/dlls/msvcr90/tests/msvcr90.c +++ b/dlls/msvcr90/tests/msvcr90.c @@ -2036,15 +2036,11 @@ static void test__get_current_locale(void) "same locale name pointers for LC_COLLATE\n"); ok(l->locinfo->lc_category[LC_COLLATE].refcount != l2->locinfo->lc_category[LC_COLLATE].refcount, "same refcount pointers for LC_COLLATE\n"); - ok(!!l->locinfo->lc_category[LC_COLLATE].refcount, "null refcount pointer for LC_COLLATE\n"); - if(l->locinfo->lc_category[LC_COLLATE].refcount) - ok(*l->locinfo->lc_category[LC_COLLATE].refcount == 1, "refcount = %d\n", - *l->locinfo->lc_category[LC_COLLATE].refcount); - ok(!!l2->locinfo->lc_category[LC_COLLATE].refcount, "null refcount pointer for LC_COLLATE\n"); - if(l2->locinfo->lc_category[LC_COLLATE].refcount) - ok(*l2->locinfo->lc_category[LC_COLLATE].refcount == 2, "refcount = %d\n", - *l2->locinfo->lc_category[LC_COLLATE].refcount); + ok(*l2->locinfo->lc_category[LC_COLLATE].refcount == 2, "refcount = %d\n", + *l2->locinfo->lc_category[LC_COLLATE].refcount); } + ok(*l->locinfo->lc_category[LC_COLLATE].refcount == 1, "refcount = %d\n", + *l->locinfo->lc_category[LC_COLLATE].refcount); for(i = LC_CTYPE; i <= LC_MAX; i++) { ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale, "different locale name pointers for category %d\n", i); @@ -2107,15 +2103,11 @@ static void test__get_current_locale(void) "same locale name pointers for category %d\n", i); ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount, "same refcount pointers for category %d\n", i); - ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l->locinfo->lc_category[i].refcount) - ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", - *l->locinfo->lc_category[i].refcount, i); - ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l2->locinfo->lc_category[i].refcount) - ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", - *l2->locinfo->lc_category[i].refcount, i); + ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", + *l2->locinfo->lc_category[i].refcount, i); } + ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", + *l->locinfo->lc_category[i].refcount, i); } for(i = LC_MONETARY; i <= LC_MAX; i++) { ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale, @@ -2186,15 +2178,11 @@ static void test__get_current_locale(void) "same locale name pointers for category %d\n", i); ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount, "same refcount pointers for category %d\n", i); - ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l->locinfo->lc_category[i].refcount) - ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", - *l->locinfo->lc_category[i].refcount, i); - ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l2->locinfo->lc_category[i].refcount) - ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", - *l2->locinfo->lc_category[i].refcount, i); + ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", + *l2->locinfo->lc_category[i].refcount, i); } + ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", + *l->locinfo->lc_category[i].refcount, i); } for(i = LC_NUMERIC; i <= LC_MAX; i++) { ok(l->locinfo->lc_category[i].locale == l2->locinfo->lc_category[i].locale, @@ -2273,15 +2261,11 @@ static void test__get_current_locale(void) "same locale name pointers for category %d\n", i); ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount, "same refcount pointers for category %d\n", i); - ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l->locinfo->lc_category[i].refcount) - ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", - *l->locinfo->lc_category[i].refcount, i); - ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l2->locinfo->lc_category[i].refcount) - ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", - *l2->locinfo->lc_category[i].refcount, i); + ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", + *l2->locinfo->lc_category[i].refcount, i); } + ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", + *l->locinfo->lc_category[i].refcount, i); } ok(l->locinfo->lc_category[LC_TIME].locale == l2->locinfo->lc_category[LC_TIME].locale, "different locale name pointers for LC_TIME\n"); @@ -2353,21 +2337,17 @@ static void test__get_current_locale(void) ok(l2->locinfo->refcount == 2, "refcount = %d\n", l2->locinfo->refcount); } - todo_wine { - for(i = LC_MIN+1; i <= LC_MAX; i++) { + for(i = LC_MIN+1; i <= LC_MAX; i++) { + todo_wine { ok(l->locinfo->lc_category[i].locale != l2->locinfo->lc_category[i].locale, "same locale name pointers for category %d\n", i); ok(l->locinfo->lc_category[i].refcount != l2->locinfo->lc_category[i].refcount, "same refcount pointers for category %d\n", i); - ok(!!l->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l->locinfo->lc_category[i].refcount) - ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", - *l->locinfo->lc_category[i].refcount, i); - ok(!!l2->locinfo->lc_category[i].refcount, "null refcount pointer for category %d\n", i); - if(l2->locinfo->lc_category[i].refcount) - ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", - *l2->locinfo->lc_category[i].refcount, i); + ok(*l2->locinfo->lc_category[i].refcount == 2, "refcount = %d for category %d\n", + *l2->locinfo->lc_category[i].refcount, i); } + ok(*l->locinfo->lc_category[i].refcount == 1, "refcount = %d for category %d\n", + *l->locinfo->lc_category[i].refcount, i); } todo_wine { diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index b24871b9cd7..4b20f097758 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -1247,8 +1247,12 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, free_locinfo(locinfo); return NULL; } - } else - locinfo->lc_category[MSVCRT_LC_COLLATE].locale = MSVCRT__strdup("C"); + } else { + if(!init_category_name("C", 1, locinfo, MSVCRT_LC_COLLATE)) { + free_locinfo(locinfo); + return NULL; + } + } if(locale_name[MSVCRT_LC_CTYPE] && !init_category_name(locale_name[MSVCRT_LC_CTYPE], @@ -1325,7 +1329,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, locinfo->lc_clike = 1; locinfo->mb_cur_max = 1; locinfo->pctype = MSVCRT__ctype+1; - locinfo->lc_category[MSVCRT_LC_CTYPE].locale = MSVCRT__strdup("C"); + if(!init_category_name("C", 1, locinfo, MSVCRT_LC_CTYPE)) { + free_locinfo(locinfo); + return NULL; + } for(i=0; i<256; i++) { if(locinfo->pctype[i] & MSVCRT__LEADBYTE) @@ -1617,7 +1624,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, locinfo->lconv->_W_negative_sign[0] = '\0'; #endif - locinfo->lc_category[MSVCRT_LC_MONETARY].locale = MSVCRT__strdup("C"); + if(!init_category_name("C", 1, locinfo, MSVCRT_LC_MONETARY)) { + free_locinfo(locinfo); + return NULL; + } } if(locale_name[MSVCRT_LC_NUMERIC] && @@ -1735,7 +1745,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, locinfo->lconv->_W_thousands_sep[0] = '\0'; #endif - locinfo->lc_category[MSVCRT_LC_NUMERIC].locale = MSVCRT__strdup("C"); + if (!init_category_name("C", 1, locinfo, MSVCRT_LC_NUMERIC)) { + free_locinfo(locinfo); + return NULL; + } } if(locale_name[MSVCRT_LC_TIME] && @@ -1767,7 +1780,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, return NULL; } } else { - locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C"); + if(!init_category_name("C", 1, locinfo, MSVCRT_LC_TIME)) { + free_locinfo(locinfo); + return NULL; + } locinfo->lc_time_curr = &cloc_time_data; }
1
0
0
0
Chip Davis : msvcr90/tests: Test _get_current_locale()/setlocale() interaction.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: f71f16319816f9108f93ec65ebfcdc8c6b7fbcb6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f71f16319816f9108f93ec65…
Author: Chip Davis <cdavis(a)codeweavers.com> Date: Wed Nov 18 17:25:36 2020 +0100 msvcr90/tests: Test _get_current_locale()/setlocale() interaction. Signed-off-by: Chip Davis <cdavis(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr90/tests/msvcr90.c | 473 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 473 insertions(+) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=f71f16319816f9108f93…
1
0
0
0
Piotr Caban : msvcrt: Mark old_locinfo as const in create_locinfo.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: b0622bb49a419567d7b4d7bbbebed9d74cdd34e6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b0622bb49a419567d7b4d7bb…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Nov 18 17:25:32 2020 +0100 msvcrt: Mark old_locinfo as const in create_locinfo. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 32f2c9b4624..b24871b9cd7 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -1035,7 +1035,7 @@ static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) #endif static inline BOOL category_needs_update(int cat, int user_cat, - MSVCRT_pthreadlocinfo locinfo, LCID lcid, unsigned short cp) + const MSVCRT_threadlocinfo *locinfo, LCID lcid, unsigned short cp) { if(!locinfo) return TRUE; if(user_cat!=cat && user_cat!=MSVCRT_LC_ALL) return FALSE; @@ -1106,7 +1106,7 @@ static MSVCRT___lc_time_data* create_time_data(LCID lcid) } static MSVCRT_pthreadlocinfo create_locinfo(int category, - const char *locale, MSVCRT_pthreadlocinfo old_locinfo) + const char *locale, const MSVCRT_threadlocinfo *old_locinfo) { static const char collate[] = "COLLATE="; static const char ctype[] = "CTYPE=";
1
0
0
0
Alex Henrie : urlmon: Reimplement canonicalize_ipv6address on top of ntdll functions.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: dcdbe44d04906401049e406c7729b133e49c7946 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dcdbe44d04906401049e406c…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Nov 18 20:02:17 2020 +0100 urlmon: Reimplement canonicalize_ipv6address on top of ntdll functions. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/urlmon/tests/uri.c | 25 +++ dlls/urlmon/uri.c | 438 +++--------------------------------------------- 2 files changed, 45 insertions(+), 418 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=dcdbe44d04906401049e…
1
0
0
0
Robert Wilhelm : vbscript: Support properties with parameters.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: a839ac952a8d5673b0aff6307cc7ecc0eabb3d99 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a839ac952a8d5673b0aff630…
Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Tue Nov 17 21:11:32 2020 +0100 vbscript: Support properties with parameters. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=33996
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/parser.y | 2 +- dlls/vbscript/tests/lang.vbs | 21 +++++++++++++++++++++ dlls/vbscript/vbdisp.c | 35 +++++++++++++++++++++++++---------- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index a9f4c540fcb..8f1c1307794 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -454,7 +454,7 @@ ClassBody PropertyDecl : Storage_opt tPROPERTY tGET Identifier ArgumentsDecl_opt StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $7); CHECK_ERROR; } - | Storage_opt tPROPERTY tLET Identifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY + | Storage_opt tPROPERTY tLET Identifier '(' ArgumentDeclList ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } | Storage_opt tPROPERTY tSET Identifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 53f36b6e710..ed89906c9cf 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1770,6 +1770,27 @@ class TestPropSyntax end property end class +Class TestPropParam + Public oDict + Public Property Let Key(oldKey,newKey) + oDict = oldKey & newKey + End Property + Public Property Let three(uno,due,tre) + oDict = uno & due & tre + End Property + Public Property Let ten(a,b,c,d,e,f,g,h,i,j) + oDict = a & b & c & d & e & f & g & h & i & j + End Property +End Class + +Set x = new TestPropParam +x.key("old") = "new" +call ok(x.oDict = "oldnew","x.oDict = " & x.oDict & " expected oldnew") +x.three(1,2) = 3 +call ok(x.oDict = "123","x.oDict = " & x.oDict & " expected 123") +x.ten(1,2,3,4,5,6,7,8,9) = 0 +call ok(x.oDict = "1234567890","x.oDict = " & x.oDict & " expected 1234567890") + set x = new TestPropSyntax set x.prop = new TestPropSyntax set x.prop.prop = new TestPropSyntax diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 5f493d420bd..ee4875f4e01 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -197,28 +197,43 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern case DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF: { DISPPARAMS dp = {NULL, NULL, 1, 0}; BOOL needs_release; - VARIANT put_val; + VARIANT buf[6]; HRESULT hres; - - if(arg_cnt(params)) { - FIXME("arguments not implemented\n"); - return E_NOTIMPL; + INT i; + + dp.cArgs = arg_cnt(params) + 1; + if(dp.cArgs > ARRAY_SIZE(buf)) { + dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT)); + if(!dp.rgvarg) + return E_OUTOFMEMORY; + }else { + dp.rgvarg = buf; } - hres = get_propput_arg(This->desc->ctx, params, flags, &put_val, &needs_release); - if(FAILED(hres)) + hres = get_propput_arg(This->desc->ctx, params, flags, dp.rgvarg, &needs_release); + if(FAILED(hres)) { + if(dp.rgvarg != buf) + heap_free(dp.rgvarg); return hres; + } - dp.rgvarg = &put_val; - func = This->desc->funcs[id].entries[V_VT(&put_val) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; + func = This->desc->funcs[id].entries[V_VT(dp.rgvarg) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; if(!func) { FIXME("no letter/setter\n"); + if(dp.rgvarg != buf) + heap_free(dp.rgvarg); return DISP_E_MEMBERNOTFOUND; } + for(i=1; i < dp.cArgs; i++) { + dp.rgvarg[i]=params->rgvarg[params->cNamedArgs+i-1]; + } + hres = exec_script(This->desc->ctx, extern_caller, func, This, &dp, NULL); if(needs_release) - VariantClear(&put_val); + VariantClear(dp.rgvarg); + if(dp.rgvarg != buf) + heap_free(dp.rgvarg); return hres; } default:
1
0
0
0
Paul Gofman : msvcrt: Save and restore rounding mode in fegetenv() / fesetenv().
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: 3acd68b24171e7c4b9fd82b4449dbe879df29884 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3acd68b24171e7c4b9fd82b4…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Tue Nov 17 23:07:49 2020 +0300 msvcrt: Save and restore rounding mode in fegetenv() / fesetenv(). Fixes Serious Sam 4 flickering in Vulkan mode. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr120/tests/msvcr120.c | 23 ++++++++++++++++++++--- dlls/msvcrt/math.c | 19 +++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 52531ddad72..8663fc81ee8 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -23,6 +23,7 @@ #include <stdio.h> #include <float.h> #include <math.h> +#include <fenv.h> #include <limits.h> #include <wctype.h> @@ -183,6 +184,9 @@ static float (CDECL *p_wcstof)(const wchar_t*, wchar_t**); static double (CDECL *p_remainder)(double, double); static int* (CDECL *p_errno)(void); static int (CDECL *p_fegetenv)(fenv_t*); +static int (CDECL *p_fesetenv)(const fenv_t*); +static int (CDECL *p_fegetround)(void); +static int (CDECL *p_fesetround)(int); static int (CDECL *p__clearfp)(void); static _locale_t (__cdecl *p_wcreate_locale)(int, const wchar_t *); static void (__cdecl *p_free_locale)(_locale_t); @@ -254,6 +258,10 @@ static BOOL init(void) p_free_locale = (void*)GetProcAddress(module, "_free_locale"); SET(p_wctype, "wctype"); SET(p_fegetenv, "fegetenv"); + SET(p_fesetenv, "fesetenv"); + SET(p_fegetround, "fegetround"); + SET(p_fesetround, "fesetround"); + SET(p__clearfp, "_clearfp"); SET(p_vsscanf, "vsscanf"); SET(p__Cbuild, "_Cbuild"); @@ -780,18 +788,27 @@ static void test_critical_section(void) call_func1(p_critical_section_dtor, &cs); } -static void test_fegetenv(void) +static void test_feenv(void) { + fenv_t env, env2; int ret; - fenv_t env; p__clearfp(); ret = p_fegetenv(&env); ok(!ret, "fegetenv returned %x\n", ret); + p_fesetround(FE_UPWARD); ok(env.control == (_EM_INEXACT|_EM_UNDERFLOW|_EM_OVERFLOW|_EM_ZERODIVIDE|_EM_INVALID), "env.control = %x\n", env.control); ok(!env.status, "env.status = %x\n", env.status); + ret = p_fegetenv(&env2); + ok(!ret, "fegetenv returned %x\n", ret); + ok(env2.control == (_EM_INEXACT|_EM_UNDERFLOW|_EM_OVERFLOW|_EM_ZERODIVIDE|_EM_INVALID | FE_UPWARD), + "env2.control = %x\n", env2.control); + ret = p_fesetenv(&env); + ok(!ret, "fesetenv returned %x\n", ret); + ret = p_fegetround(); + ok(ret == FE_TONEAREST, "Got unexpected round mode %#x.\n", ret); } static void test__wcreate_locale(void) @@ -1110,7 +1127,7 @@ START_TEST(msvcr120) test__strtof(); test_remainder(); test_critical_section(); - test_fegetenv(); + test_feenv(); test__wcreate_locale(); test__Condition_variable(); test_wctype(); diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index af6216e0ea8..25a9b5e096d 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2074,7 +2074,7 @@ int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask int CDECL MSVCRT_fegetenv(MSVCRT_fenv_t *env) { env->control = _controlfp(0, 0) & (MSVCRT__EM_INEXACT | MSVCRT__EM_UNDERFLOW | - MSVCRT__EM_OVERFLOW | MSVCRT__EM_ZERODIVIDE | MSVCRT__EM_INVALID); + MSVCRT__EM_OVERFLOW | MSVCRT__EM_ZERODIVIDE | MSVCRT__EM_INVALID | MSVCRT__RC_CHOP); env->status = _statusfp(); return 0; } @@ -2193,12 +2193,18 @@ int CDECL MSVCRT_fesetenv(const MSVCRT_fenv_t *env) __asm__ __volatile__( "fnstenv %0" : "=m" (fenv) ); - fenv.control_word &= ~0x3d; + fenv.control_word &= ~0xc3d; if (env->control & MSVCRT__EM_INVALID) fenv.control_word |= 0x1; if (env->control & MSVCRT__EM_ZERODIVIDE) fenv.control_word |= 0x4; if (env->control & MSVCRT__EM_OVERFLOW) fenv.control_word |= 0x8; if (env->control & MSVCRT__EM_UNDERFLOW) fenv.control_word |= 0x10; if (env->control & MSVCRT__EM_INEXACT) fenv.control_word |= 0x20; + switch (env->control & MSVCRT__MCW_RC) + { + case MSVCRT__RC_UP|MSVCRT__RC_DOWN: fenv.control_word |= 0xc00; break; + case MSVCRT__RC_UP: fenv.control_word |= 0x800; break; + case MSVCRT__RC_DOWN: fenv.control_word |= 0x400; break; + } fenv.status_word &= ~0x3d; if (env->status & MSVCRT__SW_INVALID) fenv.status_word |= 0x1; @@ -2213,14 +2219,19 @@ int CDECL MSVCRT_fesetenv(const MSVCRT_fenv_t *env) if (sse2_supported) { DWORD fpword; - __asm__ __volatile__( "stmxcsr %0" : "=m" (fpword) ); - fpword &= ~0x1e80; + fpword &= ~0x7e80; if (env->control & MSVCRT__EM_INVALID) fpword |= 0x80; if (env->control & MSVCRT__EM_ZERODIVIDE) fpword |= 0x200; if (env->control & MSVCRT__EM_OVERFLOW) fpword |= 0x400; if (env->control & MSVCRT__EM_UNDERFLOW) fpword |= 0x800; if (env->control & MSVCRT__EM_INEXACT) fpword |= 0x1000; + switch (env->control & MSVCRT__MCW_RC) + { + case MSVCRT__RC_CHOP: fpword |= 0x6000; break; + case MSVCRT__RC_UP: fpword |= 0x4000; break; + case MSVCRT__RC_DOWN: fpword |= 0x2000; break; + } __asm__ __volatile__( "ldmxcsr %0" : : "m" (fpword) ); }
1
0
0
0
Alexandre Julliard : msvcrt: Move math functions to a new Unix library.
by Alexandre Julliard
18 Nov '20
18 Nov '20
Module: wine Branch: master Commit: c72e1b096d16a1e9a36b86fbc8c403ec3653a504 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c72e1b096d16a1e9a36b86fb…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Nov 18 16:14:50 2020 +0100 msvcrt: Move math functions to a new Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crtdll/Makefile.in | 1 + dlls/msvcr100/Makefile.in | 1 + dlls/msvcr110/Makefile.in | 1 + dlls/msvcr120/Makefile.in | 1 + dlls/msvcr70/Makefile.in | 1 + dlls/msvcr71/Makefile.in | 1 + dlls/msvcr80/Makefile.in | 1 + dlls/msvcr90/Makefile.in | 1 + dlls/msvcrt/Makefile.in | 1 + dlls/msvcrt/main.c | 2 +- dlls/msvcrt/math.c | 443 +++++------------- dlls/msvcrt/msvcrt.h | 2 +- dlls/msvcrt/unixlib.c | 1096 +++++++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/unixlib.h | 121 +++++ dlls/msvcrtd/Makefile.in | 1 + dlls/ucrtbase/Makefile.in | 1 + 16 files changed, 1342 insertions(+), 333 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=c72e1b096d16a1e9a36b…
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
86
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
Results per page:
10
25
50
100
200