Removed excessive statement (break after return or goto, not useful
[wine] / dlls / dmime / patterntrack.c
1 /* IDirectMusicPatternTrack Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmime_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
23
24 /* IDirectMusicPatternTrack IUnknown parts follow: */
25 HRESULT WINAPI IDirectMusicPatternTrackImpl_QueryInterface (LPDIRECTMUSICPATTERNTRACK iface, REFIID riid, LPVOID *ppobj) {
26         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
27         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
28
29         if (IsEqualIID (riid, &IID_IUnknown) || 
30             IsEqualIID (riid, &IID_IDirectMusicPatternTrack)) {
31                 IDirectMusicPatternTrackImpl_AddRef(iface);
32                 *ppobj = This;
33                 return S_OK;
34         }
35         
36         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
37         return E_NOINTERFACE;
38 }
39
40 ULONG WINAPI IDirectMusicPatternTrackImpl_AddRef (LPDIRECTMUSICPATTERNTRACK iface) {
41         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
42         TRACE("(%p): AddRef from %ld\n", This, This->ref);
43         return ++(This->ref);
44 }
45
46 ULONG WINAPI IDirectMusicPatternTrackImpl_Release (LPDIRECTMUSICPATTERNTRACK iface) {
47         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
48         ULONG ref = --This->ref;
49         TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
50         if (ref == 0) {
51                 HeapFree(GetProcessHeap(), 0, This);
52         }
53         return ref;
54 }
55
56 /* IDirectMusicPatternTrack Interface follow: */
57 HRESULT WINAPI IDirectMusicPatternTrackImpl_CreateSegment (LPDIRECTMUSICPATTERNTRACK iface, IDirectMusicStyle* pStyle, IDirectMusicSegment** ppSegment) {
58         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
59         FIXME("(%p, %p, %p): stub\n", This, pStyle, ppSegment);
60         return S_OK;
61 }
62
63 HRESULT WINAPI IDirectMusicPatternTrackImpl_SetVariation (LPDIRECTMUSICPATTERNTRACK iface, IDirectMusicSegmentState* pSegState, DWORD dwVariationFlags, DWORD dwPart) {
64         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
65         FIXME("(%p, %p, %ld, %ld): stub\n", This, pSegState, dwVariationFlags, dwPart);
66         return S_OK;
67 }
68
69 HRESULT WINAPI IDirectMusicPatternTrackImpl_SetPatternByName (LPDIRECTMUSICPATTERNTRACK iface, IDirectMusicSegmentState* pSegState, WCHAR* wszName, IDirectMusicStyle* pStyle, DWORD dwPatternType, DWORD* pdwLength) {
70         IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
71         FIXME("(%p, %p, %p, %p, %ld, %p): stub\n", This, pSegState, wszName, pStyle, dwPatternType, pdwLength);
72         return S_OK;
73 }
74
75 IDirectMusicPatternTrackVtbl DirectMusicPatternTrack_Vtbl = {
76         IDirectMusicPatternTrackImpl_QueryInterface,
77         IDirectMusicPatternTrackImpl_AddRef,
78         IDirectMusicPatternTrackImpl_Release,
79         IDirectMusicPatternTrackImpl_CreateSegment,
80         IDirectMusicPatternTrackImpl_SetVariation,
81         IDirectMusicPatternTrackImpl_SetPatternByName
82 };
83
84 /* for ClassFactory */
85 HRESULT WINAPI DMUSIC_CreateDirectMusicPatternTrackImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
86         IDirectMusicPatternTrackImpl* track;
87         
88         track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPatternTrackImpl));
89         if (NULL == track) {
90                 *ppobj = NULL;
91                 return E_OUTOFMEMORY;
92         }
93         track->lpVtbl = &DirectMusicPatternTrack_Vtbl;
94         track->ref = 0; /* will be inited by QueryInterface */
95         
96         return IDirectMusicPatternTrackImpl_QueryInterface ((LPDIRECTMUSICPATTERNTRACK)track, lpcGUID, ppobj);
97 }