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
July 2015
----- 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
567 discussions
Start a n
N
ew thread
Nikolay Sivov : dwrite: Implement leading and trailing text alignment modes.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 44c135dd179637076c53166485362e7e45ca7d62 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=44c135dd179637076c5316648…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Jul 6 09:05:41 2015 +0300 dwrite: Implement leading and trailing text alignment modes. --- dlls/dwrite/layout.c | 127 ++++++++++++++++++++++++++++++++++++++++++--- dlls/dwrite/tests/layout.c | 54 ++++++++++++++++++- 2 files changed, 173 insertions(+), 8 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=44c135dd179637076c531…
1
0
0
0
Nikolay Sivov : dwrite: Make it possible to set text alignment on created layout.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: de46f610fe61ed5f1ff99908682d33a32e8c9f82 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=de46f610fe61ed5f1ff999086…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Jul 6 09:05:10 2015 +0300 dwrite: Make it possible to set text alignment on created layout. --- dlls/dwrite/layout.c | 22 ++++++++--------- dlls/dwrite/tests/layout.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 693f046..13a9ce0 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -328,6 +328,14 @@ static inline const char *debugstr_run(const struct regular_layout_run *run) run->descr.stringLength); } +static inline HRESULT format_set_textalignment(struct dwrite_textformat_data *format, DWRITE_TEXT_ALIGNMENT alignment) +{ + if ((UINT32)alignment > DWRITE_TEXT_ALIGNMENT_JUSTIFIED) + return E_INVALIDARG; + format->textalignment = alignment; + return S_OK; +} + static HRESULT get_fontfallback_from_format(const struct dwrite_textformat_data *format, IDWriteFontFallback **fallback) { *fallback = format->fallback; @@ -1955,7 +1963,6 @@ static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout2 *iface) static HRESULT WINAPI dwritetextlayout_SetTextAlignment(IDWriteTextLayout2 *iface, DWRITE_TEXT_ALIGNMENT alignment) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface); - TRACE("(%p)->(%d)\n", This, alignment); return IDWriteTextFormat1_SetTextAlignment(&This->IDWriteTextFormat1_iface, alignment); } @@ -2013,7 +2020,6 @@ static HRESULT WINAPI dwritetextlayout_SetLineSpacing(IDWriteTextLayout2 *iface, static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextlayout_GetTextAlignment(IDWriteTextLayout2 *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface); - TRACE("(%p)\n", This); return IDWriteTextFormat1_GetTextAlignment(&This->IDWriteTextFormat1_iface); } @@ -2972,8 +2978,8 @@ static ULONG WINAPI dwritetextformat1_layout_Release(IDWriteTextFormat1 *iface) static HRESULT WINAPI dwritetextformat1_layout_SetTextAlignment(IDWriteTextFormat1 *iface, DWRITE_TEXT_ALIGNMENT alignment) { struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface); - FIXME("(%p)->(%d): stub\n", This, alignment); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, alignment); + return format_set_textalignment(&This->format, alignment); } static HRESULT WINAPI dwritetextformat1_layout_SetParagraphAlignment(IDWriteTextFormat1 *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment) @@ -3846,14 +3852,8 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat1 *iface) static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat1 *iface, DWRITE_TEXT_ALIGNMENT alignment) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface); - TRACE("(%p)->(%d)\n", This, alignment); - - if ((UINT32)alignment > DWRITE_TEXT_ALIGNMENT_JUSTIFIED) - return E_INVALIDARG; - - This->format.textalignment = alignment; - return S_OK; + return format_set_textalignment(&This->format, alignment); } static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat1 *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index eee86a9..57d3a34 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -2863,6 +2863,65 @@ todo_wine { IDWriteFactory_Release(factory); } +static void test_SetTextAlignment(void) +{ + static const WCHAR strW[] = {'a','b','c','d',0}; + IDWriteTextFormat1 *format1; + IDWriteTextFormat *format; + IDWriteTextLayout *layout; + IDWriteFactory *factory; + DWRITE_TEXT_ALIGNMENT v; + HRESULT hr; + + factory = create_factory(); + + hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextFormat_GetTextAlignment(format); + ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v); + + hr = IDWriteFactory_CreateTextLayout(factory, strW, 4, format, 300.0, 100.0, &layout); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextLayout_GetTextAlignment(layout); + ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v); + + hr = IDWriteTextLayout_SetTextAlignment(layout, DWRITE_TEXT_ALIGNMENT_TRAILING); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextFormat_GetTextAlignment(format); + ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v); + + v = IDWriteTextLayout_GetTextAlignment(layout); + ok(v == DWRITE_TEXT_ALIGNMENT_TRAILING, "got %d\n", v); + + hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextFormat1, (void**)&format1); + if (hr == S_OK) { + hr = IDWriteTextFormat1_SetTextAlignment(format1, DWRITE_TEXT_ALIGNMENT_CENTER); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextFormat_GetTextAlignment(format); + ok(v == DWRITE_TEXT_ALIGNMENT_LEADING, "got %d\n", v); + + v = IDWriteTextLayout_GetTextAlignment(layout); + ok(v == DWRITE_TEXT_ALIGNMENT_CENTER, "got %d\n", v); + + v = IDWriteTextFormat1_GetTextAlignment(format1); + ok(v == DWRITE_TEXT_ALIGNMENT_CENTER, "got %d\n", v); + + IDWriteTextFormat1_Release(format1); + } + else + win_skip("IDWriteTextFormat1 is not supported\n"); + + + IDWriteTextLayout_Release(layout); + IDWriteTextFormat_Release(format); + IDWriteFactory_Release(factory); +} + START_TEST(layout) { static const WCHAR ctrlstrW[] = {0x202a,0}; @@ -2903,6 +2962,7 @@ START_TEST(layout) test_SetFlowDirection(); test_SetDrawingEffect(); test_GetLineMetrics(); + test_SetTextAlignment(); IDWriteFactory_Release(factory); }
1
0
0
0
Nikolay Sivov : dwrite: Remove separate line count layout field.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 7a64715be3720bc1663c21e33d7f60b49d027239 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a64715be3720bc1663c21e33…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Jul 6 09:04:43 2015 +0300 dwrite: Remove separate line count layout field. --- dlls/dwrite/layout.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 980eff5..693f046 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -243,7 +243,6 @@ struct dwrite_textlayout { FLOAT minwidth; DWRITE_LINE_METRICS *lines; - UINT32 line_count; UINT32 line_alloc; DWRITE_TEXT_METRICS1 metrics; @@ -1028,7 +1027,7 @@ static HRESULT layout_set_line_metrics(struct dwrite_textlayout *layout, DWRITE_ return E_OUTOFMEMORY; } - if (layout->line_count == layout->line_alloc) { + if (layout->metrics.lineCount == layout->line_alloc) { DWRITE_LINE_METRICS *l = heap_realloc(layout->lines, layout->line_alloc*2*sizeof(*layout->lines)); if (!l) return E_OUTOFMEMORY; @@ -1037,7 +1036,7 @@ static HRESULT layout_set_line_metrics(struct dwrite_textlayout *layout, DWRITE_ } layout->lines[*line] = *metrics; - layout->line_count += 1; + layout->metrics.lineCount += 1; *line += 1; return S_OK; } @@ -1094,7 +1093,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) if (FAILED(hr)) return hr; - layout->line_count = 0; + layout->metrics.lineCount = 0; origin_x = 0.0; line = 0; run = layout->clusters[0].run; @@ -1214,7 +1213,6 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) layout->metrics.left = layout->metrics.top = 0.0; layout->metrics.maxBidiReorderingDepth = 1; /* FIXME */ - layout->metrics.lineCount = layout->line_count; layout->metrics.height = 0.0; /* Now all line info is here, update effective runs positions in flow direction */ @@ -1222,7 +1220,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) inrun = layout_get_next_inline_run(layout, NULL); origin_y = 0.0; - for (line = 0; line < layout->line_count; line++) { + for (line = 0; line < layout->metrics.lineCount; line++) { origin_y += layout->lines[line].baseline; @@ -2599,10 +2597,10 @@ static HRESULT WINAPI dwritetextlayout_GetLineMetrics(IDWriteTextLayout2 *iface, return hr; if (metrics) - memcpy(metrics, This->lines, sizeof(DWRITE_LINE_METRICS)*min(max_count, This->line_count)); + memcpy(metrics, This->lines, sizeof(*metrics)*min(max_count, This->metrics.lineCount)); - *count = This->line_count; - return max_count >= This->line_count ? S_OK : E_NOT_SUFFICIENT_BUFFER; + *count = This->metrics.lineCount; + return max_count >= This->metrics.lineCount ? S_OK : E_NOT_SUFFICIENT_BUFFER; } static HRESULT WINAPI dwritetextlayout_GetMetrics(IDWriteTextLayout2 *iface, DWRITE_TEXT_METRICS *metrics) @@ -3556,7 +3554,6 @@ static HRESULT init_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat * layout->clustermetrics = NULL; layout->clusters = NULL; layout->lines = NULL; - layout->line_count = 0; layout->line_alloc = 0; layout->minwidth = 0.0; list_init(&layout->eruns);
1
0
0
0
Michael Stefaniuc : dmsynth: Remove a now unused macro.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 7b5f3188345dce26c746420da216e1c224509eed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7b5f3188345dce26c746420da…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:34:58 2015 +0200 dmsynth: Remove a now unused macro. --- dlls/dmsynth/dmsynth_private.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dlls/dmsynth/dmsynth_private.h b/dlls/dmsynth/dmsynth_private.h index 3635aed..f056581 100644 --- a/dlls/dmsynth/dmsynth_private.h +++ b/dlls/dmsynth/dmsynth_private.h @@ -104,12 +104,6 @@ typedef struct { } guid_info; /* used for initialising structs (primarily for DMUS_OBJECTDESC) */ -#define DM_STRUCT_INIT(x) \ - do { \ - memset((x), 0, sizeof(*(x))); \ - (x)->dwSize = sizeof(*x); \ - } while (0) - #define FE(x) { x, #x } #define GE(x) { &x, #x }
1
0
0
0
Michael Stefaniuc : dmime: Use the generic IPersistStream for DMTempoTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: f78ed39b986b85f355332831f369dd4d3c8453a1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f78ed39b986b85f355332831f…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:24:07 2015 +0200 dmime: Use the generic IPersistStream for DMTempoTrack. --- dlls/dmime/dmutils.h | 8 ----- dlls/dmime/tempotrack.c | 79 +++++++++++++------------------------------------ 2 files changed, 21 insertions(+), 66 deletions(-) diff --git a/dlls/dmime/dmutils.h b/dlls/dmime/dmutils.h index 9f2f98e..e290287 100644 --- a/dlls/dmime/dmutils.h +++ b/dlls/dmime/dmutils.h @@ -27,8 +27,6 @@ typedef struct _DMUS_PRIVATE_CHUNK { DWORD dwSize; /* size of the chunk */ } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK; -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) - /** * Parsing utilities */ @@ -51,12 +49,6 @@ typedef struct { } guid_info; /* used for initialising structs */ -#define DM_STRUCT_INIT(x) \ - do { \ - memset((x), 0, sizeof(*(x))); \ - (x)->dwSize = sizeof(*x); \ - } while (0) - #define FE(x) { x, #x } #define GE(x) { &x, #x } diff --git a/dlls/dmime/tempotrack.c b/dlls/dmime/tempotrack.c index 4270b84..70de442 100644 --- a/dlls/dmime/tempotrack.c +++ b/dlls/dmime/tempotrack.c @@ -19,6 +19,7 @@ */ #include "dmime_private.h" +#include "dmobject.h" WINE_DEFAULT_DEBUG_CHANNEL(dmime); WINE_DECLARE_DEBUG_CHANNEL(dmfile); @@ -28,9 +29,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); */ typedef struct IDirectMusicTempoTrack { IDirectMusicTrack8 IDirectMusicTrack8_iface; - const IPersistStreamVtbl *PersistStreamVtbl; + struct dmobject dmobj; /* IPersistStream only */ LONG ref; - DMUS_OBJECTDESC *pDesc; BOOL enabled; struct list Items; } IDirectMusicTempoTrack; @@ -54,7 +54,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 * IsEqualIID(riid, &IID_IDirectMusicTrack8)) *ret_iface = iface; else if (IsEqualIID(riid, &IID_IPersistStream)) - *ret_iface = &This->PersistStreamVtbl; + *ret_iface = &This->dmobj.IPersistStream_iface; else { WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); return E_NOINTERFACE; @@ -315,37 +315,14 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { IDirectMusicTrack8Impl_Join }; -/* IDirectMusicTempoTrack IPersistStream part: */ -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); -} - -static ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); -} - -static ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); -} - -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - TRACE("(%p, %p)\n", This, pClassID); - *pClassID = CLSID_DirectMusicTempoTrack; - return S_OK; -} - -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - FIXME("(%p): stub, always S_FALSE\n", This); - return S_FALSE; +static inline IDirectMusicTempoTrack *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicTempoTrack, dmobj.IPersistStream_iface); } -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) +{ + IDirectMusicTempoTrack *This = impl_from_IPersistStream(iface); DMUS_PRIVATE_CHUNK Chunk; DWORD StreamSize, StreamCount; LARGE_INTEGER liMove; @@ -392,27 +369,15 @@ static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Load (LPPERSISTSTREA return S_OK; } -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - FIXME("(%p): Saving not implemented yet\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - FIXME("(%p, %p): stub\n", This, pcbSize); - return E_NOTIMPL; -} - -static const IPersistStreamVtbl DirectMusicTempoTrack_PersistStream_Vtbl = { - IDirectMusicTempoTrack_IPersistStream_QueryInterface, - IDirectMusicTempoTrack_IPersistStream_AddRef, - IDirectMusicTempoTrack_IPersistStream_Release, - IDirectMusicTempoTrack_IPersistStream_GetClassID, - IDirectMusicTempoTrack_IPersistStream_IsDirty, - IDirectMusicTempoTrack_IPersistStream_Load, - IDirectMusicTempoTrack_IPersistStream_Save, - IDirectMusicTempoTrack_IPersistStream_GetSizeMax +static const IPersistStreamVtbl persiststream_vtbl = { + dmobj_IPersistStream_QueryInterface, + dmobj_IPersistStream_AddRef, + dmobj_IPersistStream_Release, + dmobj_IPersistStream_GetClassID, + unimpl_IPersistStream_IsDirty, + IPersistStreamImpl_Load, + unimpl_IPersistStream_Save, + unimpl_IPersistStream_GetSizeMax }; /* for ClassFactory */ @@ -427,12 +392,10 @@ HRESULT WINAPI create_dmtempotrack(REFIID lpcGUID, void **ppobj) return E_OUTOFMEMORY; } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; - track->PersistStreamVtbl = &DirectMusicTempoTrack_PersistStream_Vtbl; - track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(track->pDesc); - track->pDesc->dwValidData |= DMUS_OBJ_CLASS; - track->pDesc->guidClass = CLSID_DirectMusicTempoTrack; track->ref = 1; + dmobject_init(&track->dmobj, &CLSID_DirectMusicTempoTrack, + (IUnknown *)&track->IDirectMusicTrack8_iface); + track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; track->enabled = TRUE; list_init(&track->Items);
1
0
0
0
Michael Stefaniuc : dmime: Remove the extraneous IUnknown from DMTempoTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: ee09310345f321a936f2d83c85f9eee06588ffa4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ee09310345f321a936f2d83c8…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:11:42 2015 +0200 dmime: Remove the extraneous IUnknown from DMTempoTrack. --- dlls/dmime/tempotrack.c | 127 ++++++++++++++++++++---------------------------- 1 file changed, 52 insertions(+), 75 deletions(-) diff --git a/dlls/dmime/tempotrack.c b/dlls/dmime/tempotrack.c index cff875e..4270b84 100644 --- a/dlls/dmime/tempotrack.c +++ b/dlls/dmime/tempotrack.c @@ -27,7 +27,6 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); * IDirectMusicTempoTrack implementation */ typedef struct IDirectMusicTempoTrack { - const IUnknownVtbl *UnknownVtbl; IDirectMusicTrack8 IDirectMusicTrack8_iface; const IPersistStreamVtbl *PersistStreamVtbl; LONG ref; @@ -36,61 +35,6 @@ typedef struct IDirectMusicTempoTrack { struct list Items; } IDirectMusicTempoTrack; -/* IDirectMusicTempoTrack IUnknown part: */ -static HRESULT WINAPI IDirectMusicTempoTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicTrack) - || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { - *ppobj = &This->IDirectMusicTrack8_iface; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IUnknown_AddRef (iface); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p): AddRef from %d\n", This, ref - 1); - - DMIME_LockModule(); - - return ref; -} - -static ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMIME_UnlockModule(); - - return ref; -} - -static const IUnknownVtbl DirectMusicTempoTrack_Unknown_Vtbl = { - IDirectMusicTempoTrack_IUnknown_QueryInterface, - IDirectMusicTempoTrack_IUnknown_AddRef, - IDirectMusicTempoTrack_IUnknown_Release -}; - /* IDirectMusicTempoTrack IDirectMusicTrack8 part: */ static inline IDirectMusicTempoTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface) { @@ -98,22 +42,51 @@ static inline IDirectMusicTempoTrack *impl_from_IDirectMusicTrack8(IDirectMusicT } static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid, - void **ppobj) + void **ret_iface) { IDirectMusicTempoTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); + + *ret_iface = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) || + IsEqualIID(riid, &IID_IDirectMusicTrack8)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->PersistStreamVtbl; + else { + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface) { IDirectMusicTempoTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface) { IDirectMusicTempoTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + HeapFree(GetProcessHeap(), 0, This); + DMIME_UnlockModule(); + } + + return ref; } static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface, @@ -345,17 +318,17 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { /* IDirectMusicTempoTrack IPersistStream part: */ static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); } static ULONG WINAPI IDirectMusicTempoTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, PersistStreamVtbl, iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); } static HRESULT WINAPI IDirectMusicTempoTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { @@ -445,23 +418,27 @@ static const IPersistStreamVtbl DirectMusicTempoTrack_PersistStream_Vtbl = { /* for ClassFactory */ HRESULT WINAPI create_dmtempotrack(REFIID lpcGUID, void **ppobj) { - IDirectMusicTempoTrack* track; - - track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTempoTrack)); - if (NULL == track) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - track->UnknownVtbl = &DirectMusicTempoTrack_Unknown_Vtbl; + IDirectMusicTempoTrack *track; + HRESULT hr; + + track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track)); + if (!track) { + *ppobj = NULL; + return E_OUTOFMEMORY; + } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->PersistStreamVtbl = &DirectMusicTempoTrack_PersistStream_Vtbl; track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(track->pDesc); track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->guidClass = CLSID_DirectMusicTempoTrack; - track->ref = 0; /* will be inited by QueryInterface */ - track->enabled = TRUE; - list_init (&track->Items); + track->ref = 1; + track->enabled = TRUE; + list_init(&track->Items); - return IDirectMusicTempoTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); + DMIME_LockModule(); + hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj); + IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface); + + return hr; }
1
0
0
0
Michael Stefaniuc : dmime: COM cleanup for IDirectMusicTrack of DMTempoTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 3ef8e015177b97f3a10e25db19a74bf31a2b5ac0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3ef8e015177b97f3a10e25db1…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:11:28 2015 +0200 dmime: COM cleanup for IDirectMusicTrack of DMTempoTrack. --- dlls/dmime/tempotrack.c | 128 +++++++++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 50 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=3ef8e015177b97f3a10e2…
1
0
0
0
Michael Stefaniuc : dmime: Use the generic IPersistStream for DMSegTriggerTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: cfd84f16627b602f116ffa47c2738791e3ebf7ba URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cfd84f16627b602f116ffa47c…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:10:57 2015 +0200 dmime: Use the generic IPersistStream for DMSegTriggerTrack. --- dlls/dmime/segtriggertrack.c | 86 +++++++++++++------------------------------- 1 file changed, 24 insertions(+), 62 deletions(-) diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c index c8f932d..d1b208a 100644 --- a/dlls/dmime/segtriggertrack.c +++ b/dlls/dmime/segtriggertrack.c @@ -19,6 +19,7 @@ */ #include "dmime_private.h" +#include "dmobject.h" WINE_DEFAULT_DEBUG_CHANNEL(dmime); WINE_DECLARE_DEBUG_CHANNEL(dmfile); @@ -28,9 +29,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); */ typedef struct IDirectMusicSegTriggerTrack { IDirectMusicTrack8 IDirectMusicTrack8_iface; - const IPersistStreamVtbl *PersistStreamVtbl; + struct dmobject dmobj;/* IPersistStream only */ LONG ref; - DMUS_OBJECTDESC *pDesc; struct list Items; } IDirectMusicSegTriggerTrack; @@ -53,7 +53,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 * IsEqualIID(riid, &IID_IDirectMusicTrack8)) *ret_iface = iface; else if (IsEqualIID(riid, &IID_IPersistStream)) - *ret_iface = &This->PersistStreamVtbl; + *ret_iface = &This->dmobj.IPersistStream_iface; else { WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); return E_NOINTERFACE; @@ -243,35 +243,6 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { IDirectMusicTrack8Impl_Join }; -/* IDirectMusicSegTriggerTrack IPersistStream part: */ -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); -} - -static ULONG WINAPI IDirectMusicSegTriggerTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); -} - -static ULONG WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); -} - -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - TRACE("(%p, %p)\n", This, pClassID); - *pClassID = CLSID_DirectMusicSegTriggerTrack; - return S_OK; -} - -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - FIXME("(%p): stub, always S_FALSE\n", This); - return S_FALSE; -} - static HRESULT parse_segment(IDirectMusicSegTriggerTrack *This, DMUS_PRIVATE_CHUNK *pChunk, IStream *pStm) { @@ -329,7 +300,7 @@ static HRESULT parse_segment(IDirectMusicSegTriggerTrack *This, DMUS_PRIVATE_CHU switch (Chunk.fccID) { case DMUS_FOURCC_REF_LIST: { FIXME_(dmfile)(": DMRF (DM References) list\n"); - hr = IDirectMusicUtils_IPersistStream_ParseReference((IPersistStream*)&This->PersistStreamVtbl, + hr = IDirectMusicUtils_IPersistStream_ParseReference(&This->dmobj.IPersistStream_iface, &Chunk, pStm, &pObject); if (FAILED(hr)) { ERR(": could not load Reference\n"); @@ -480,9 +451,14 @@ static HRESULT parse_seqtrack_list(IDirectMusicSegTriggerTrack *This, DMUS_PRIVA return S_OK; } -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); +static inline IDirectMusicSegTriggerTrack *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicSegTriggerTrack, dmobj.IPersistStream_iface); +} +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) +{ + IDirectMusicSegTriggerTrack *This = impl_from_IPersistStream(iface); DMUS_PRIVATE_CHUNK Chunk; LARGE_INTEGER liMove; HRESULT hr; @@ -523,27 +499,15 @@ static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Load (LPPERSIST return S_OK; } -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - FIXME("(%p): Saving not implemented yet\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - FIXME("(%p, %p): stub\n", This, pcbSize); - return E_NOTIMPL; -} - -static const IPersistStreamVtbl DirectMusicSegTriggerTrack_PersistStream_Vtbl = { - IDirectMusicSegTriggerTrack_IPersistStream_QueryInterface, - IDirectMusicSegTriggerTrack_IPersistStream_AddRef, - IDirectMusicSegTriggerTrack_IPersistStream_Release, - IDirectMusicSegTriggerTrack_IPersistStream_GetClassID, - IDirectMusicSegTriggerTrack_IPersistStream_IsDirty, - IDirectMusicSegTriggerTrack_IPersistStream_Load, - IDirectMusicSegTriggerTrack_IPersistStream_Save, - IDirectMusicSegTriggerTrack_IPersistStream_GetSizeMax +static const IPersistStreamVtbl persiststream_vtbl = { + dmobj_IPersistStream_QueryInterface, + dmobj_IPersistStream_AddRef, + dmobj_IPersistStream_Release, + dmobj_IPersistStream_GetClassID, + unimpl_IPersistStream_IsDirty, + IPersistStreamImpl_Load, + unimpl_IPersistStream_Save, + unimpl_IPersistStream_GetSizeMax }; /* for ClassFactory */ @@ -558,13 +522,11 @@ HRESULT WINAPI create_dmsegtriggertrack(REFIID lpcGUID, void **ppobj) return E_OUTOFMEMORY; } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; - track->PersistStreamVtbl = &DirectMusicSegTriggerTrack_PersistStream_Vtbl; - track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(track->pDesc); - track->pDesc->dwValidData |= DMUS_OBJ_CLASS; - track->pDesc->guidClass = CLSID_DirectMusicSegTriggerTrack; track->ref = 1; - list_init (&track->Items); + dmobject_init(&track->dmobj, &CLSID_DirectMusicSegTriggerTrack, + (IUnknown *)&track->IDirectMusicTrack8_iface); + track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; + list_init(&track->Items); DMIME_LockModule(); hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
1
0
0
0
Michael Stefaniuc : dmime: Remove the extraneous IUnknown from DMSegTriggerTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 0c0df2f8d22bce6fb510c603dd109949409c6e69 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0c0df2f8d22bce6fb510c603d…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:10:17 2015 +0200 dmime: Remove the extraneous IUnknown from DMSegTriggerTrack. Also lock/unlock the module only on creation/destruction of the object. --- dlls/dmime/segtriggertrack.c | 125 ++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 74 deletions(-) diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c index 1f43d0f..c8f932d 100644 --- a/dlls/dmime/segtriggertrack.c +++ b/dlls/dmime/segtriggertrack.c @@ -27,7 +27,6 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); * IDirectMusicSegTriggerTrack implementation */ typedef struct IDirectMusicSegTriggerTrack { - const IUnknownVtbl *UnknownVtbl; IDirectMusicTrack8 IDirectMusicTrack8_iface; const IPersistStreamVtbl *PersistStreamVtbl; LONG ref; @@ -35,61 +34,6 @@ typedef struct IDirectMusicSegTriggerTrack { struct list Items; } IDirectMusicSegTriggerTrack; -/* IDirectMusicSegTriggerTrack IUnknown part: */ -static HRESULT WINAPI IDirectMusicSegTriggerTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicTrack) - || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { - *ppobj = &This->IDirectMusicTrack8_iface; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IUnknown_AddRef (iface); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p): AddRef from %d\n", This, ref - 1); - - DMIME_LockModule(); - - return ref; -} - -static ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMIME_UnlockModule(); - - return ref; -} - -static const IUnknownVtbl DirectMusicSegTriggerTrack_Unknown_Vtbl = { - IDirectMusicSegTriggerTrack_IUnknown_QueryInterface, - IDirectMusicSegTriggerTrack_IUnknown_AddRef, - IDirectMusicSegTriggerTrack_IUnknown_Release -}; - /* IDirectMusicSegTriggerTrack IDirectMusicTrack8 part: */ static inline IDirectMusicSegTriggerTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface) { @@ -97,22 +41,51 @@ static inline IDirectMusicSegTriggerTrack *impl_from_IDirectMusicTrack8(IDirectM } static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid, - void **ppobj) + void **ret_iface) { IDirectMusicSegTriggerTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); + + *ret_iface = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) || + IsEqualIID(riid, &IID_IDirectMusicTrack8)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->PersistStreamVtbl; + else { + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface) { IDirectMusicSegTriggerTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface) { IDirectMusicSegTriggerTrack *This = impl_from_IDirectMusicTrack8(iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + HeapFree(GetProcessHeap(), 0, This); + DMIME_UnlockModule(); + } + + return ref; } static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface, @@ -273,17 +246,17 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { /* IDirectMusicSegTriggerTrack IPersistStream part: */ static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicSegTriggerTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); } static ULONG WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); } static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { @@ -576,22 +549,26 @@ static const IPersistStreamVtbl DirectMusicSegTriggerTrack_PersistStream_Vtbl = /* for ClassFactory */ HRESULT WINAPI create_dmsegtriggertrack(REFIID lpcGUID, void **ppobj) { - IDirectMusicSegTriggerTrack* track; - - track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrack)); - if (NULL == track) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - track->UnknownVtbl = &DirectMusicSegTriggerTrack_Unknown_Vtbl; + IDirectMusicSegTriggerTrack *track; + HRESULT hr; + + track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track)); + if (!track) { + *ppobj = NULL; + return E_OUTOFMEMORY; + } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->PersistStreamVtbl = &DirectMusicSegTriggerTrack_PersistStream_Vtbl; track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(track->pDesc); track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->guidClass = CLSID_DirectMusicSegTriggerTrack; - track->ref = 0; /* will be inited by QueryInterface */ - list_init (&track->Items); + track->ref = 1; + list_init (&track->Items); + + DMIME_LockModule(); + hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj); + IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface); - return IDirectMusicSegTriggerTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); + return hr; }
1
0
0
0
Michael Stefaniuc : dmime: COM cleanup for IDirectMusicTrack of DMSegTriggerTrack.
by Alexandre Julliard
06 Jul '15
06 Jul '15
Module: wine Branch: master Commit: 360a24670f6885404260208b4e0d8ef00ffaf4e2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=360a24670f6885404260208b4…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Jul 6 00:07:43 2015 +0200 dmime: COM cleanup for IDirectMusicTrack of DMSegTriggerTrack. --- dlls/dmime/segtriggertrack.c | 119 ++++++++++++++++++++++++++----------------- 1 file changed, 72 insertions(+), 47 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=360a24670f68854042602…
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
57
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
Results per page:
10
25
50
100
200