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
September 2014
----- 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
301 discussions
Start a n
N
ew thread
Jactry Zeng : mshtml: Add IHTMLStyle5::minWidth property implementation.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: 47f26eb9c0766cbc4b2597fdef846181bcf28935 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47f26eb9c0766cbc4b2597fde…
Author: Jactry Zeng <wine(a)jactry.com> Date: Tue Sep 2 10:20:01 2014 +0800 mshtml: Add IHTMLStyle5::minWidth property implementation. --- dlls/mshtml/htmlstyle.c | 3 +++ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/htmlstyle3.c | 12 ++++++---- dlls/mshtml/tests/style.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index aa19da7..f098cb0 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -146,6 +146,8 @@ static const WCHAR attrMarginTop[] = {'m','a','r','g','i','n','-','t','o','p',0}; static const WCHAR attrMinHeight[] = {'m','i','n','-','h','e','i','g','h','t',0}; +static const WCHAR attrMinWidth[] = + {'m','i','n','-','w','i','d','t','h',0}; static const WCHAR attrOutline[] = {'o','u','t','l','i','n','e',0}; static const WCHAR attrOverflow[] = @@ -263,6 +265,7 @@ static const style_tbl_entry_t style_tbl[] = { {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT}, {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP}, {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT}, + {attrMinWidth, DISPID_IHTMLSTYLE5_MINWIDTH}, {attrOutline, DISPID_IHTMLSTYLE6_OUTLINE}, {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW}, {attrOverflowX, DISPID_IHTMLSTYLE2_OVERFLOWX}, diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 3c6bb6c..1ae8d8c 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -88,6 +88,7 @@ typedef enum { STYLEID_MARGIN_RIGHT, STYLEID_MARGIN_TOP, STYLEID_MIN_HEIGHT, + STYLEID_MIN_WIDTH, STYLEID_OUTLINE, STYLEID_OVERFLOW, STYLEID_OVERFLOW_X, diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c index 1cff71b..c704f08 100644 --- a/dlls/mshtml/htmlstyle3.c +++ b/dlls/mshtml/htmlstyle3.c @@ -544,15 +544,19 @@ static HRESULT WINAPI HTMLStyle5_get_maxHeight(IHTMLStyle5 *iface, VARIANT *p) static HRESULT WINAPI HTMLStyle5_put_minWidth(IHTMLStyle5 *iface, VARIANT v) { HTMLStyle *This = impl_from_IHTMLStyle5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_WIDTH, &v, ATTR_FIX_PX); } static HRESULT WINAPI HTMLStyle5_get_minWidth(IHTMLStyle5 *iface, VARIANT *p) { HTMLStyle *This = impl_from_IHTMLStyle5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_WIDTH, p, 0); } static HRESULT WINAPI HTMLStyle5_put_maxWidth(IHTMLStyle5 *iface, VARIANT v) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 5297246..2204c5a 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -499,6 +499,57 @@ static void test_style4(IHTMLStyle4 *style4) VariantClear(&vdefault); } +static void test_style5(IHTMLStyle5 *style5) +{ + HRESULT hres; + VARIANT v; + VARIANT vdefault; + + /* minWidth */ + hres = IHTMLStyle5_get_minWidth(style5, &vdefault); + ok(hres == S_OK, "get_minWidth failed: %08x\n", hres); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("12px"); + hres = IHTMLStyle5_put_minWidth(style5, v); + ok(hres == S_OK, "put_minWidth failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle5_get_minWidth(style5, &v); + ok(hres == S_OK, "get_minWidth failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("10%"); + hres = IHTMLStyle5_put_minWidth(style5, v); + ok(hres == S_OK, "put_minWidth failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle5_get_minWidth(style5, &v); + ok(hres == S_OK, "get_minWidth failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("10"); + hres = IHTMLStyle5_put_minWidth(style5, v); + ok(hres == S_OK, "put_minWidth failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle5_get_minWidth(style5, &v); + ok(hres == S_OK, "get_minWidth failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + hres = IHTMLStyle5_put_minWidth(style5, vdefault); + ok(hres == S_OK, "put_minWidth failed: %08x\n", hres); + VariantClear(&vdefault); +} + static void test_style6(IHTMLStyle6 *style) { BSTR str; @@ -544,6 +595,7 @@ static void test_body_style(IHTMLStyle *style) IHTMLStyle2 *style2; IHTMLStyle3 *style3; IHTMLStyle4 *style4; + IHTMLStyle5 *style5; IHTMLStyle6 *style6; VARIANT_BOOL b; VARIANT v; @@ -2249,6 +2301,14 @@ static void test_body_style(IHTMLStyle *style) IHTMLStyle4_Release(style4); } + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5); + if(SUCCEEDED(hres)) { + test_style5(style5); + IHTMLStyle5_Release(style5); + }else { + win_skip("IHTMLStyle5 not available\n"); + } + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6); if(SUCCEEDED(hres)) { test_style6(style6);
1
0
0
0
Jonathan Vollebregt : reg.exe: Fix stack overflow on large registry keys.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: b823337f65213889e7b1e27e6fa5a8afc4e0f3bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b823337f65213889e7b1e27e6…
Author: Jonathan Vollebregt <jnvsor(a)gmail.com> Date: Mon Sep 1 15:05:30 2014 +0200 reg.exe: Fix stack overflow on large registry keys. --- programs/reg/reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 1b46661..d299cbf 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -28,7 +28,7 @@ static int reg_printfW(const WCHAR *msg, ...) WCHAR msg_buffer[8192]; va_start(va_args, msg); - vsprintfW(msg_buffer, msg, va_args); + vsnprintfW(msg_buffer, 8192, msg, va_args); va_end(va_args); wlen = lstrlenW(msg_buffer);
1
0
0
0
Jacek Caban : wininet: Fixed buffer size rising in get_cookie.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: 55e3ec650e43dcd01cbc5c9f87c7e8be829980ed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=55e3ec650e43dcd01cbc5c9f8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Sep 2 13:05:34 2014 +0200 wininet: Fixed buffer size rising in get_cookie. --- dlls/wininet/cookie.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index d98a127..57e5424 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -635,17 +635,18 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY)) continue; - if(res->size) { + + if(!res->size) { + res->cookies = heap_alloc(4*sizeof(*res->cookies)); + if(!res->cookies) + continue; + res->size = 4; + }else if(res->cnt == res->size) { cookie_t **new_cookies = heap_realloc(res->cookies, res->size*2*sizeof(*res->cookies)); if(!new_cookies) continue; res->cookies = new_cookies; res->size *= 2; - }else { - res->cookies = heap_alloc(4*sizeof(*res->cookies)); - if(!res->cookies) - continue; - res->size = 4; } if(res->cnt)
1
0
0
0
Alexandre Julliard : make_makefiles: Support the GIT_DIR environment variable.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: b03606c5e61ff93bcb54d64bb012cea21139610c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b03606c5e61ff93bcb54d64bb…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Sep 2 20:54:24 2014 +0200 make_makefiles: Support the GIT_DIR environment variable. --- tools/make_makefiles | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/make_makefiles b/tools/make_makefiles index 649b434..f0b40c0 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -578,7 +578,8 @@ sub update_linguas(@) } -die "needs to be run from a git checkout" unless -d ".git"; +my $git_dir = $ENV{GIT_DIR} || ".git"; +die "needs to be run from a git checkout" unless -d $git_dir; my @all_files = split /\0/, `git ls-files -c -z`; @linguas = map { (my $ret = $_) =~ s/^po\/(.*)\.po/$1/; $ret; } grep /^po\/.*\.po$/, @all_files;
1
0
0
0
Aric Stewart : dwrite: Add face data to font data.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: 8b2e666d3f94c5dcd3c3f336df82350bb7472f71 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8b2e666d3f94c5dcd3c3f336d…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 2 10:19:36 2014 -0500 dwrite: Add face data to font data. --- dlls/dwrite/font.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 7c107db..07a8b86 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -126,6 +126,8 @@ typedef struct #define MS_POST_TAG MS_MAKE_TAG('p','o','s','t') struct dwrite_fontface_data { + LONG ref; + DWRITE_FONT_FACE_TYPE type; UINT32 file_count; IDWriteFontFile ** files; @@ -140,6 +142,8 @@ struct dwrite_font_data { DWRITE_FONT_SIMULATIONS simulations; DWRITE_FONT_METRICS metrics; + struct dwrite_fontface_data *face_data; + WCHAR *facename; }; @@ -247,6 +251,11 @@ static HRESULT _dwritefontfile_GetFontFileStream(IDWriteFontFile *iface, IDWrite static VOID _free_fontface_data(struct dwrite_fontface_data *data) { int i; + if (!data) + return; + i = InterlockedDecrement(&data->ref); + if (i > 0) + return; for (i = 0; i < data->file_count; i++) IDWriteFontFile_Release(data->files[i]); heap_free(data->files); @@ -607,6 +616,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont *iface) if (This->face) IDWriteFontFace_Release(This->face); IDWriteFontFamily_Release(This->family); heap_free(This->data->facename); + _free_fontface_data(This->data->face_data); heap_free(This->data); heap_free(This); } @@ -711,11 +721,16 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont *iface, IDWriteFontF else { TRACE("(%p)->(%p)\n", This, face); - if (This->face) + + if (!This->face) { - *face = This->face; - IDWriteFontFace_AddRef(*face); + HRESULT hr = font_create_fontface(NULL, This->data->face_data->type, This->data->face_data->file_count, This->data->face_data->files, This->data->face_data->index, This->data->face_data->simulations, &This->face); + if (FAILED(hr)) return hr; } + + *face = This->face; + IDWriteFontFace_AddRef(*face); + return S_OK; } } @@ -1150,6 +1165,7 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font) This->data->simulations = DWRITE_FONT_SIMULATIONS_NONE; This->data->style = logfont->lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; This->data->facename = heap_strdupW(logfont->lfFaceName); + This->data->face_data = NULL; *font = &This->IDWriteFont_iface; @@ -1298,6 +1314,7 @@ HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facety This->IDWriteFontFace_iface.lpVtbl = &dwritefontfacevtbl; This->ref = 1; + This->data->ref = 1; This->data->type = facetype; This->data->file_count = files_number; This->data->files = heap_alloc(sizeof(*This->data->files) * files_number);
1
0
0
0
Aric Stewart : dwrite: Store fontface data in its own structure.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: e707bb6bcd78ba3676072818abd6ad9d1799defa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e707bb6bcd78ba3676072818a…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 2 10:19:31 2014 -0500 dwrite: Store fontface data in its own structure. --- dlls/dwrite/font.c | 93 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 35 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 8cb8413..7c107db 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -125,6 +125,14 @@ typedef struct #define MS_OS2_TAG MS_MAKE_TAG('O','S','/','2') #define MS_POST_TAG MS_MAKE_TAG('p','o','s','t') +struct dwrite_fontface_data { + DWRITE_FONT_FACE_TYPE type; + UINT32 file_count; + IDWriteFontFile ** files; + DWRITE_FONT_SIMULATIONS simulations; + UINT32 index; +}; + struct dwrite_font_data { DWRITE_FONT_STYLE style; DWRITE_FONT_STRETCH stretch; @@ -174,11 +182,7 @@ struct dwrite_fontface { IDWriteFontFace IDWriteFontFace_iface; LONG ref; - DWRITE_FONT_FACE_TYPE type; - UINT32 file_count; - IDWriteFontFile ** files; - DWRITE_FONT_SIMULATIONS simulations; - UINT32 index; + struct dwrite_fontface_data *data; BOOL is_system; LOGFONTW logfont; @@ -240,6 +244,15 @@ static HRESULT _dwritefontfile_GetFontFileStream(IDWriteFontFile *iface, IDWrite return E_FAIL; } +static VOID _free_fontface_data(struct dwrite_fontface_data *data) +{ + int i; + for (i = 0; i < data->file_count; i++) + IDWriteFontFile_Release(data->files[i]); + heap_free(data->files); + heap_free(data); +} + static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace *iface, REFIID riid, void **obj) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); @@ -274,10 +287,7 @@ static ULONG WINAPI dwritefontface_Release(IDWriteFontFace *iface) if (!ref) { - int i; - for (i = 0; i < This->file_count; i++) - IDWriteFontFile_Release(This->files[i]); - heap_free(This->files); + _free_fontface_data(This->data); heap_free(This); } @@ -288,7 +298,7 @@ static DWRITE_FONT_FACE_TYPE WINAPI dwritefontface_GetType(IDWriteFontFace *ifac { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); TRACE("(%p)\n", This); - return This->type; + return This->data->type; } static HRESULT WINAPI dwritefontface_GetFiles(IDWriteFontFace *iface, UINT32 *number_of_files, @@ -299,16 +309,16 @@ static HRESULT WINAPI dwritefontface_GetFiles(IDWriteFontFace *iface, UINT32 *nu TRACE("(%p)->(%p %p)\n", This, number_of_files, fontfiles); if (fontfiles == NULL) { - *number_of_files = This->file_count; + *number_of_files = This->data->file_count; return S_OK; } - if (*number_of_files < This->file_count) + if (*number_of_files < This->data->file_count) return E_INVALIDARG; - for (i = 0; i < This->file_count; i++) + for (i = 0; i < This->data->file_count; i++) { - IDWriteFontFile_AddRef(This->files[i]); - fontfiles[i] = This->files[i]; + IDWriteFontFile_AddRef(This->data->files[i]); + fontfiles[i] = This->data->files[i]; } return S_OK; @@ -318,14 +328,14 @@ static UINT32 WINAPI dwritefontface_GetIndex(IDWriteFontFace *iface) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); TRACE("(%p)\n", This); - return This->index; + return This->data->index; } static DWRITE_FONT_SIMULATIONS WINAPI dwritefontface_GetSimulations(IDWriteFontFace *iface) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); TRACE("(%p)\n", This); - return This->simulations; + return This->data->simulations; } static BOOL WINAPI dwritefontface_IsSymbolFont(IDWriteFontFace *iface) @@ -417,15 +427,15 @@ static HRESULT WINAPI dwritefontface_TryGetFontTable(IDWriteFontFace *iface, UIN return E_OUTOFMEMORY; *exists = FALSE; - for (i = 0; i < This->file_count && !(*exists); i++) + for (i = 0; i < This->data->file_count && !(*exists); i++) { IDWriteFontFileStream *stream; - hr = _dwritefontfile_GetFontFileStream(This->files[i], &stream); + hr = _dwritefontfile_GetFontFileStream(This->data->files[i], &stream); if (FAILED(hr)) continue; table->file_index = i; - hr = find_font_table(stream, This->index, table_tag, table_data, &table->context, table_size, exists); + hr = find_font_table(stream, This->data->index, table_tag, table_data, &table->context, table_size, exists); IDWriteFontFileStream_Release(stream); } @@ -451,7 +461,7 @@ static void WINAPI dwritefontface_ReleaseFontTable(IDWriteFontFace *iface, void return; } - hr = _dwritefontfile_GetFontFileStream(This->files[table->file_index], &stream); + hr = _dwritefontfile_GetFontFileStream(This->data->files[table->file_index], &stream); if (FAILED(hr)) return; IDWriteFontFileStream_ReleaseFileFragment(stream, table->context); @@ -524,14 +534,20 @@ static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace This = heap_alloc(sizeof(struct dwrite_fontface)); if (!This) return E_OUTOFMEMORY; + This->data = heap_alloc(sizeof(struct dwrite_fontface_data)); + if (!This->data) + { + heap_free(This); + return E_OUTOFMEMORY; + } This->IDWriteFontFace_iface.lpVtbl = &dwritefontfacevtbl; This->ref = 1; - This->type = DWRITE_FONT_FACE_TYPE_UNKNOWN; - This->file_count = 0; - This->files = NULL; - This->index = 0; - This->simulations = DWRITE_FONT_SIMULATIONS_NONE; + This->data->type = DWRITE_FONT_FACE_TYPE_UNKNOWN; + This->data->file_count = 0; + This->data->files = NULL; + This->data->index = 0; + This->data->simulations = DWRITE_FONT_SIMULATIONS_NONE; This->is_system = TRUE; memset(&This->logfont, 0, sizeof(This->logfont)); @@ -1273,14 +1289,20 @@ HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facety This = heap_alloc(sizeof(struct dwrite_fontface)); if (!This) return E_OUTOFMEMORY; + This->data = heap_alloc(sizeof(struct dwrite_fontface_data)); + if (!This) + { + heap_free(This); + return E_OUTOFMEMORY; + } This->IDWriteFontFace_iface.lpVtbl = &dwritefontfacevtbl; This->ref = 1; - This->type = facetype; - This->file_count = files_number; - This->files = heap_alloc(sizeof(*This->files) * files_number); + This->data->type = facetype; + This->data->file_count = files_number; + This->data->files = heap_alloc(sizeof(*This->data->files) * files_number); /* Verify font file streams */ - for (i = 0; i < This->file_count && SUCCEEDED(hr); i++) + for (i = 0; i < This->data->file_count && SUCCEEDED(hr); i++) { IDWriteFontFileStream *stream; hr = _dwritefontfile_GetFontFileStream(font_files[i], &stream); @@ -1289,18 +1311,19 @@ HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facety } if (FAILED(hr)) { - heap_free(This->files); + heap_free(This->data->files); + heap_free(This->data); heap_free(This); return hr; } - for (i = 0; i < This->file_count; i++) + for (i = 0; i < This->data->file_count; i++) { - This->files[i] = font_files[i]; + This->data->files[i] = font_files[i]; IDWriteFontFile_AddRef(font_files[i]); } - This->index = index; - This->simulations = sim_flags; + This->data->index = index; + This->data->simulations = sim_flags; This->is_system = FALSE; *font_face = &This->IDWriteFontFace_iface;
1
0
0
0
Aric Stewart : dwrite: Store font data in its own structure.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: daef5061e8ceb84b2e49dbf9cfa1333c86948221 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=daef5061e8ceb84b2e49dbf9c…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 2 10:19:25 2014 -0500 dwrite: Store font data in its own structure. --- dlls/dwrite/font.c | 88 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 5be7c83..8cb8413 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -125,6 +125,16 @@ typedef struct #define MS_OS2_TAG MS_MAKE_TAG('O','S','/','2') #define MS_POST_TAG MS_MAKE_TAG('p','o','s','t') +struct dwrite_font_data { + DWRITE_FONT_STYLE style; + DWRITE_FONT_STRETCH stretch; + DWRITE_FONT_WEIGHT weight; + DWRITE_FONT_SIMULATIONS simulations; + DWRITE_FONT_METRICS metrics; + + WCHAR *facename; +}; + struct dwrite_fontcollection { IDWriteFontCollection IDWriteFontCollection_iface; LONG ref; @@ -148,11 +158,8 @@ struct dwrite_font { BOOL is_system; IDWriteFontFamily *family; IDWriteFontFace *face; - DWRITE_FONT_STYLE style; - DWRITE_FONT_STRETCH stretch; - DWRITE_FONT_WEIGHT weight; - DWRITE_FONT_METRICS metrics; - WCHAR *facename; + + struct dwrite_font_data *data; }; #define DWRITE_FONTTABLE_MAGIC 0xededfafa @@ -528,10 +535,10 @@ static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace This->is_system = TRUE; memset(&This->logfont, 0, sizeof(This->logfont)); - This->logfont.lfItalic = font->style == DWRITE_FONT_STYLE_ITALIC; + This->logfont.lfItalic = font->data->style == DWRITE_FONT_STYLE_ITALIC; /* weight values from DWRITE_FONT_WEIGHT match values used for LOGFONT */ - This->logfont.lfWeight = font->weight; - strcpyW(This->logfont.lfFaceName, font->facename); + This->logfont.lfWeight = font->data->weight; + strcpyW(This->logfont.lfFaceName, font->data->facename); *face = &This->IDWriteFontFace_iface; @@ -583,7 +590,8 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont *iface) { if (This->face) IDWriteFontFace_Release(This->face); IDWriteFontFamily_Release(This->family); - heap_free(This->facename); + heap_free(This->data->facename); + heap_free(This->data); heap_free(This); } @@ -604,21 +612,21 @@ static DWRITE_FONT_WEIGHT WINAPI dwritefont_GetWeight(IDWriteFont *iface) { struct dwrite_font *This = impl_from_IDWriteFont(iface); TRACE("(%p)\n", This); - return This->weight; + return This->data->weight; } static DWRITE_FONT_STRETCH WINAPI dwritefont_GetStretch(IDWriteFont *iface) { struct dwrite_font *This = impl_from_IDWriteFont(iface); TRACE("(%p)\n", This); - return This->stretch; + return This->data->stretch; } static DWRITE_FONT_STYLE WINAPI dwritefont_GetStyle(IDWriteFont *iface) { struct dwrite_font *This = impl_from_IDWriteFont(iface); TRACE("(%p)\n", This); - return This->style; + return This->data->style; } static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont *iface) @@ -646,8 +654,8 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont *iface, static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont *iface) { struct dwrite_font *This = impl_from_IDWriteFont(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_SIMULATIONS_NONE; + TRACE("(%p)\n", This); + return This->data->simulations; } static void WINAPI dwritefont_GetMetrics(IDWriteFont *iface, DWRITE_FONT_METRICS *metrics) @@ -655,7 +663,7 @@ static void WINAPI dwritefont_GetMetrics(IDWriteFont *iface, DWRITE_FONT_METRICS struct dwrite_font *This = impl_from_IDWriteFont(iface); TRACE("(%p)->(%p)\n", This, metrics); - *metrics = This->metrics; + *metrics = This->data->metrics; } static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont *iface, UINT32 value, BOOL *exists) @@ -1011,10 +1019,10 @@ static void get_font_properties(struct dwrite_font *font, HDC hdc) LONG size; /* default stretch and weight to normal */ - font->stretch = DWRITE_FONT_STRETCH_NORMAL; - font->weight = DWRITE_FONT_WEIGHT_NORMAL; + font->data->stretch = DWRITE_FONT_STRETCH_NORMAL; + font->data->weight = DWRITE_FONT_WEIGHT_NORMAL; - memset(&font->metrics, 0, sizeof(font->metrics)); + memset(&font->data->metrics, 0, sizeof(font->data->metrics)); size = GetFontData(hdc, MS_OS2_TAG, 0, NULL, 0); if (size != GDI_ERROR) @@ -1026,31 +1034,31 @@ static void get_font_properties(struct dwrite_font *font, HDC hdc) /* DWRITE_FONT_STRETCH enumeration values directly match font data values */ if (GET_BE_WORD(tt_os2.usWidthClass) <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED) - font->stretch = GET_BE_WORD(tt_os2.usWidthClass); - - font->weight = GET_BE_WORD(tt_os2.usWeightClass); - TRACE("stretch=%d, weight=%d\n", font->stretch, font->weight); - - font->metrics.ascent = GET_BE_WORD(tt_os2.sTypoAscender); - font->metrics.descent = GET_BE_WORD(tt_os2.sTypoDescender); - font->metrics.lineGap = GET_BE_WORD(tt_os2.sTypoLineGap); - font->metrics.capHeight = GET_BE_WORD(tt_os2.sCapHeight); - font->metrics.xHeight = GET_BE_WORD(tt_os2.sxHeight); - font->metrics.strikethroughPosition = GET_BE_WORD(tt_os2.yStrikeoutPosition); - font->metrics.strikethroughThickness = GET_BE_WORD(tt_os2.yStrikeoutSize); + font->data->stretch = GET_BE_WORD(tt_os2.usWidthClass); + + font->data->weight = GET_BE_WORD(tt_os2.usWeightClass); + TRACE("stretch=%d, weight=%d\n", font->data->stretch, font->data->weight); + + font->data->metrics.ascent = GET_BE_WORD(tt_os2.sTypoAscender); + font->data->metrics.descent = GET_BE_WORD(tt_os2.sTypoDescender); + font->data->metrics.lineGap = GET_BE_WORD(tt_os2.sTypoLineGap); + font->data->metrics.capHeight = GET_BE_WORD(tt_os2.sCapHeight); + font->data->metrics.xHeight = GET_BE_WORD(tt_os2.sxHeight); + font->data->metrics.strikethroughPosition = GET_BE_WORD(tt_os2.yStrikeoutPosition); + font->data->metrics.strikethroughThickness = GET_BE_WORD(tt_os2.yStrikeoutSize); } memset(&tt_head, 0, sizeof(tt_head)); if (GetFontData(hdc, MS_HEAD_TAG, 0, &tt_head, sizeof(tt_head)) != GDI_ERROR) { - font->metrics.designUnitsPerEm = GET_BE_WORD(tt_head.unitsPerEm); + font->data->metrics.designUnitsPerEm = GET_BE_WORD(tt_head.unitsPerEm); } memset(&tt_post, 0, sizeof(tt_post)); if (GetFontData(hdc, MS_POST_TAG, 0, &tt_post, sizeof(tt_post)) != GDI_ERROR) { - font->metrics.underlinePosition = GET_BE_WORD(tt_post.underlinePosition); - font->metrics.underlineThickness = GET_BE_WORD(tt_post.underlineThickness); + font->data->metrics.underlinePosition = GET_BE_WORD(tt_post.underlinePosition); + font->data->metrics.underlineThickness = GET_BE_WORD(tt_post.underlineThickness); } } @@ -1069,10 +1077,17 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font) This = heap_alloc(sizeof(struct dwrite_font)); if (!This) return E_OUTOFMEMORY; + This->data = heap_alloc(sizeof(struct dwrite_font_data)); + if (!This->data) + { + heap_free(This); + return E_OUTOFMEMORY; + } hfont = CreateFontIndirectW(logfont); if (!hfont) { + heap_free(This->data); heap_free(This); return DWRITE_E_NOFONT; } @@ -1084,6 +1099,7 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font) otm = heap_alloc(ret); if (!otm) { + heap_free(This->data); heap_free(This); DeleteDC(hdc); DeleteObject(hfont); @@ -1105,6 +1121,7 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font) heap_free(otm); if (hr != S_OK) { + heap_free(This->data); heap_free(This); return hr; } @@ -1114,8 +1131,9 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font) This->face = NULL; This->is_system = TRUE; This->family = family; - This->style = logfont->lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; - This->facename = heap_strdupW(logfont->lfFaceName); + This->data->simulations = DWRITE_FONT_SIMULATIONS_NONE; + This->data->style = logfont->lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; + This->data->facename = heap_strdupW(logfont->lfFaceName); *font = &This->IDWriteFont_iface;
1
0
0
0
Aric Stewart : dwrite: Add the system font collection to the dwrite factory object.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: f49c740907d6a87fd58c1205818835a7e7ca4e87 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f49c740907d6a87fd58c12058…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Sep 2 07:17:57 2014 -0500 dwrite: Add the system font collection to the dwrite factory object. --- dlls/dwrite/dwrite_private.h | 1 - dlls/dwrite/font.c | 95 ++++++++++++++++++++------------------------ dlls/dwrite/layout.c | 11 +---- dlls/dwrite/main.c | 28 ++++++++++--- 4 files changed, 69 insertions(+), 66 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 8fda71e..e78f9bf 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -92,7 +92,6 @@ extern HRESULT get_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN; extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN; extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; extern HRESULT get_system_fontcollection(IDWriteFontCollection**) DECLSPEC_HIDDEN; -extern void release_system_fontcollection(void) DECLSPEC_HIDDEN; extern HRESULT get_textanalyzer(IDWriteTextAnalyzer**) DECLSPEC_HIDDEN; extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN; extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index c835ff4..5be7c83 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -127,14 +127,13 @@ typedef struct struct dwrite_fontcollection { IDWriteFontCollection IDWriteFontCollection_iface; + LONG ref; WCHAR **families; UINT32 count; int alloc; }; -static IDWriteFontCollection *system_collection; - struct dwrite_fontfamily { IDWriteFontFamily IDWriteFontFamily_iface; LONG ref; @@ -844,14 +843,30 @@ static HRESULT WINAPI dwritefontcollection_QueryInterface(IDWriteFontCollection return E_NOINTERFACE; } -static ULONG WINAPI dwritesysfontcollection_AddRef(IDWriteFontCollection *iface) +static ULONG WINAPI dwritefontcollection_AddRef(IDWriteFontCollection *iface) { - return 2; + struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; } -static ULONG WINAPI dwritesysfontcollection_Release(IDWriteFontCollection *iface) +static ULONG WINAPI dwritefontcollection_Release(IDWriteFontCollection *iface) { - return 1; + unsigned int i; + struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + for (i = 0; i < This->count; i++) + heap_free(This->families[i]); + heap_free(This->families); + heap_free(This); + } + + return ref; } static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollection *iface) @@ -904,10 +919,10 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec return E_NOTIMPL; } -static const IDWriteFontCollectionVtbl systemfontcollectionvtbl = { +static const IDWriteFontCollectionVtbl fontcollectionvtbl = { dwritefontcollection_QueryInterface, - dwritesysfontcollection_AddRef, - dwritesysfontcollection_Release, + dwritefontcollection_AddRef, + dwritefontcollection_Release, dwritefontcollection_GetFontFamilyCount, dwritefontcollection_GetFontFamily, dwritefontcollection_FindFamilyName, @@ -938,56 +953,34 @@ static INT CALLBACK enum_font_families(const LOGFONTW *lf, const TEXTMETRICW *tm return add_family_syscollection(collection, lf->lfFaceName) == S_OK; } -static void release_font_collection(IDWriteFontCollection *iface) -{ - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection(iface); - unsigned int i; - - for (i = 0; i < This->count; i++) - heap_free(This->families[i]); - heap_free(This->families); - heap_free(This); -} - -void release_system_fontcollection(void) -{ - if (system_collection) - release_font_collection(system_collection); -} - HRESULT get_system_fontcollection(IDWriteFontCollection **collection) { - if (!system_collection) - { - struct dwrite_fontcollection *This; - LOGFONTW lf; - HDC hdc; - - *collection = NULL; + struct dwrite_fontcollection *This; + LOGFONTW lf; + HDC hdc; - This = heap_alloc(sizeof(struct dwrite_fontcollection)); - if (!This) return E_OUTOFMEMORY; + *collection = NULL; - This->IDWriteFontCollection_iface.lpVtbl = &systemfontcollectionvtbl; - This->alloc = 50; - This->count = 0; - This->families = heap_alloc(This->alloc*sizeof(WCHAR*)); + This = heap_alloc(sizeof(struct dwrite_fontcollection)); + if (!This) return E_OUTOFMEMORY; - TRACE("building system font collection:\n"); + This->IDWriteFontCollection_iface.lpVtbl = &fontcollectionvtbl; + This->ref = 1; + This->alloc = 50; + This->count = 0; + This->families = heap_alloc(This->alloc*sizeof(WCHAR*)); - hdc = CreateCompatibleDC(0); - memset(&lf, 0, sizeof(lf)); - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfPitchAndFamily = DEFAULT_PITCH; - lf.lfFaceName[0] = 0; - EnumFontFamiliesExW(hdc, &lf, enum_font_families, (LPARAM)This, 0); - DeleteDC(hdc); + TRACE("building system font collection:\n"); - if (InterlockedCompareExchangePointer((void**)&system_collection, &This->IDWriteFontCollection_iface, NULL)) - release_font_collection(&This->IDWriteFontCollection_iface); - } + hdc = CreateCompatibleDC(0); + memset(&lf, 0, sizeof(lf)); + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfPitchAndFamily = DEFAULT_PITCH; + lf.lfFaceName[0] = 0; + EnumFontFamiliesExW(hdc, &lf, enum_font_families, (LPARAM)This, 0); + DeleteDC(hdc); - *collection = system_collection; + *collection = &This->IDWriteFontCollection_iface; return S_OK; } diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index a2da73b..82525d8 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -229,7 +229,7 @@ static struct layout_range *alloc_layout_range(struct dwrite_textlayout *layout, range->strikethrough = FALSE; range->collection = layout->format.collection; if (range->collection) - IDWriteFontCollection_Release(range->collection); + IDWriteFontCollection_AddRef(range->collection); return range; } @@ -1781,14 +1781,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle IDWriteFontCollection_AddRef(collection); } else - { - HRESULT hr = get_system_fontcollection(&This->format.collection); - if (hr != S_OK) - { - IDWriteTextFormat_Release(&This->IDWriteTextFormat_iface); - return hr; - } - } + ERR("Collection should always be set\n"); *format = &This->IDWriteTextFormat_iface; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 83f705b..01394dc 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -43,10 +43,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); break; - case DLL_PROCESS_DETACH: - if (reserved) break; - release_system_fontcollection(); - break; } return TRUE; } @@ -364,6 +360,7 @@ struct dwritefactory{ LONG ref; IDWriteLocalFontFileLoader* localfontfileloader; + IDWriteFontCollection *system_collection; IDWriteFontCollectionLoader **loaders; LONG loader_count; @@ -422,6 +419,8 @@ static ULONG WINAPI dwritefactory_Release(IDWriteFactory *iface) if (This->file_loaders[i]) IDWriteFontFileLoader_Release(This->file_loaders[i]); heap_free(This->file_loaders); + if (This->system_collection) + IDWriteFontCollection_Release(This->system_collection); heap_free(This); } @@ -431,13 +430,22 @@ static ULONG WINAPI dwritefactory_Release(IDWriteFactory *iface) static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory *iface, IDWriteFontCollection **collection, BOOL check_for_updates) { + HRESULT hr = S_OK; struct dwritefactory *This = impl_from_IDWriteFactory(iface); TRACE("(%p)->(%p %d)\n", This, collection, check_for_updates); if (check_for_updates) FIXME("checking for system font updates not implemented\n"); - return get_system_fontcollection(collection); + if (!This->system_collection) + hr = get_system_fontcollection(&This->system_collection); + + if (SUCCEEDED(hr)) + IDWriteFontCollection_AddRef(This->system_collection); + + *collection = This->system_collection; + + return hr; } static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory *iface, @@ -642,6 +650,15 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA struct dwritefactory *This = impl_from_IDWriteFactory(iface); TRACE("(%p)->(%s %p %d %d %d %f %s %p)\n", This, debugstr_w(family_name), collection, weight, style, stretch, size, debugstr_w(locale), format); + + if (!collection) + { + HRESULT hr = IDWriteFactory_GetSystemFontCollection(iface, &collection, FALSE); + if (hr != S_OK) + return hr; + /* Our ref count is 1 too many, since we will add ref in create_textformat */ + IDWriteFontCollection_Release(This->system_collection); + } return create_textformat(family_name, collection, weight, style, stretch, size, locale, format); } @@ -759,6 +776,7 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno This->loaders = heap_alloc_zero(sizeof(*This->loaders) * 2); This->file_loader_count = 2; This->file_loaders = heap_alloc_zero(sizeof(*This->file_loaders) * 2); + This->system_collection = NULL; *factory = (IUnknown*)&This->IDWriteFactory_iface;
1
0
0
0
Piotr Caban : msvcrt: Add _strnset_s implementation.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: 53869e19ebb0d74909b9efb81a54a4571b5460b8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=53869e19ebb0d74909b9efb81…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Tue Sep 2 13:50:44 2014 +0200 msvcrt: Add _strnset_s implementation. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/string.c | 24 ++++++++++++++++++++++++ dlls/msvcrt/tests/string.c | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 62 insertions(+), 5 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 7135638..f8062f9 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1350,7 +1350,7 @@ @ cdecl _strnicoll(str str long) MSVCRT__strnicoll @ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l @ cdecl _strnset(str long long) MSVCRT__strnset -@ stub _strnset_s +@ cdecl _strnset_s(str long long long) MSVCRT__strnset_s @ cdecl _strrev(str) MSVCRT__strrev @ cdecl _strset(str long) @ stub _strset_s diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 39ad037..6a328eb 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1708,7 +1708,7 @@ @ cdecl _strnicoll(str str long) MSVCRT__strnicoll @ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l @ cdecl _strnset(str long long) MSVCRT__strnset -@ stub _strnset_s +@ cdecl _strnset_s(str long long long) MSVCRT__strnset_s @ cdecl _strrev(str) MSVCRT__strrev @ cdecl _strset(str long) @ stub _strset_s diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 302abe5..3902c85 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1030,7 +1030,7 @@ @ cdecl _strnicoll(str str long) MSVCRT__strnicoll @ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l @ cdecl _strnset(str long long) MSVCRT__strnset -@ stub _strnset_s +@ cdecl _strnset_s(str long long long) MSVCRT__strnset_s @ cdecl _strrev(str) MSVCRT__strrev @ cdecl _strset(str long) @ stub _strset_s diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 28d37d1..fa19f40 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1005,7 +1005,7 @@ @ cdecl _strnicoll(str str long) MSVCRT__strnicoll @ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l @ cdecl _strnset(str long long) MSVCRT__strnset -@ stub _strnset_s +@ cdecl _strnset_s(str long long long) MSVCRT__strnset_s @ cdecl _strrev(str) MSVCRT__strrev @ cdecl _strset(str long) @ stub _strset_s diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 2349580..01788e1 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -971,7 +971,7 @@ @ cdecl _strnicoll(str str long) MSVCRT__strnicoll @ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l @ cdecl _strnset(str long long) MSVCRT__strnset -# stub _strnset_s(str long long long) +@ cdecl _strnset_s(str long long long) MSVCRT__strnset_s @ cdecl _strrev(str) MSVCRT__strrev @ cdecl _strset(str long) # stub _strset_s(str long long) diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 60e00c9..bacab00 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -174,6 +174,30 @@ char* CDECL MSVCRT__strupr(char *str) } /********************************************************************* + * _strnset_s (MSVCRT.@) + */ +int CDECL MSVCRT__strnset_s(char *str, MSVCRT_size_t size, int c, MSVCRT_size_t count) +{ + MSVCRT_size_t i; + + if(!str && !size && !count) return 0; + if(!MSVCRT_CHECK_PMT(str != NULL)) return MSVCRT_EINVAL; + if(!MSVCRT_CHECK_PMT(size > 0)) return MSVCRT_EINVAL; + + for(i=0; i<size-1 && i<count; i++) { + if(!str[i]) return 0; + str[i] = c; + } + for(; i<size; i++) + if(!str[i]) return 0; + + str[0] = 0; + MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; +} + +/********************************************************************* * _strnset (MSVCRT.@) */ char* CDECL MSVCRT__strnset(char* str, int value, MSVCRT_size_t len) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 6604819..5b9d951 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -89,6 +89,7 @@ static int (__cdecl *p_tolower)(int); static size_t (__cdecl *p_mbrlen)(const char*, size_t, mbstate_t*); static size_t (__cdecl *p_mbrtowc)(wchar_t*, const char*, size_t, mbstate_t*); static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t); +static int (__cdecl *p__strnset_s)(char*,size_t,int,size_t); #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y) #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y) @@ -2716,6 +2717,36 @@ static void test_strxfrm(void) setlocale(LC_ALL, "C"); } +static void test__strnset_s(void) +{ + char buf[5] = {0}; + int r; + + if(!p__strnset_s) { + win_skip("_strnset_s not available\n"); + return; + } + + r = p__strnset_s(NULL, 0, 'a', 0); + ok(r == 0, "r = %d\n", r); + + buf[0] = buf[1] = buf[2] = 'b'; + r = p__strnset_s(buf, sizeof(buf), 'a', 2); + ok(r == 0, "r = %d\n", r); + ok(!strcmp(buf, "aab"), "buf = %s\n", buf); + + r = p__strnset_s(buf, 0, 'a', 0); + ok(r == EINVAL, "r = %d\n", r); + + r = p__strnset_s(NULL, 0, 'a', 1); + ok(r == EINVAL, "r = %d\n", r); + + buf[3] = 'b'; + r = p__strnset_s(buf, sizeof(buf)-1, 'c', 2); + ok(r == EINVAL, "r = %d\n", r); + ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf = %s\n", buf); +} + START_TEST(string) { char mem[100]; @@ -2763,6 +2794,7 @@ START_TEST(string) p_mbrtowc = (void*)GetProcAddress(hMsvcrt, "mbrtowc"); p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs"); p__atodbl_l = (void*)GetProcAddress(hMsvcrt, "_atodbl_l"); + p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s"); /* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ @@ -2816,4 +2848,5 @@ START_TEST(string) test_atoi(); test_strncpy(); test_strxfrm(); + test__strnset_s(); }
1
0
0
0
Johannes Brandstätter : wined3d: Fix trace output of emulated_textureram.
by Alexandre Julliard
02 Sep '14
02 Sep '14
Module: wine Branch: master Commit: de3cb3af6f19477ee32bc52e71846f6302ea1329 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=de3cb3af6f19477ee32bc52e7…
Author: Johannes Brandstätter <jbrandst(a)2ds.eu> Date: Tue Sep 2 13:35:00 2014 +0200 wined3d: Fix trace output of emulated_textureram. --- dlls/wined3d/directx.c | 3 ++- dlls/wined3d/wined3d_main.c | 6 +++--- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 9f00dcf..79b2590 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1521,7 +1521,8 @@ static void init_driver_info(struct wined3d_driver_info *driver_info, if (wined3d_settings.emulated_textureram) { - TRACE("Overriding amount of video memory with %u bytes.\n", wined3d_settings.emulated_textureram); + TRACE("Overriding amount of video memory with 0x%s bytes.\n", + wine_dbgstr_longlong(wined3d_settings.emulated_textureram)); driver_info->vram_bytes = wined3d_settings.emulated_textureram; } diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 7ab2448..758ba43 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -256,10 +256,10 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) int TmpVideoMemorySize = atoi(buffer); if(TmpVideoMemorySize > 0) { - wined3d_settings.emulated_textureram = TmpVideoMemorySize *1024*1024; - TRACE("Use %iMB = %d byte for emulated_textureram\n", + wined3d_settings.emulated_textureram = (UINT64)TmpVideoMemorySize *1024*1024; + TRACE("Use %iMiB = 0x%s bytes for emulated_textureram\n", TmpVideoMemorySize, - wined3d_settings.emulated_textureram); + wine_dbgstr_longlong(wined3d_settings.emulated_textureram)); } else ERR("VideoMemorySize is %i but must be >0\n", TmpVideoMemorySize); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e99a7b4..f55b118 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -257,7 +257,7 @@ struct wined3d_settings unsigned short pci_vendor_id; unsigned short pci_device_id; /* Memory tracking and object counting. */ - unsigned int emulated_textureram; + UINT64 emulated_textureram; char *logo; int allow_multisampling; BOOL strict_draw_ordering;
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
31
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
Results per page:
10
25
50
100
200