From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 54 +++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index bb44d63a2e0..99fcca672c5 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -605,6 +605,26 @@ static HRESULT parse_pttn_list(struct style *This, IStream *stream, struct chunk return hr; }
+static HRESULT parse_style_band(struct style *This, IStream *stream, struct chunk_entry *chunk) +{ + struct style_band *band; + HRESULT hr; + + if (!(band = calloc(1, sizeof(*band)))) + return E_OUTOFMEMORY; + + /* Can be application provided IStream without Clone method */ + if (FAILED(hr = stream_reset_chunk_start(stream, chunk)) || + FAILED(hr = load_band(stream, &band->pBand))) + { + free(band); + return hr; + } + list_add_tail(&This->bands, &band->entry); + + return S_OK; +} + static HRESULT parse_style_form(struct style *This, DMUS_PRIVATE_CHUNK *pChunk, IStream *pStm) { HRESULT hr = E_FAIL; @@ -612,8 +632,6 @@ static HRESULT parse_style_form(struct style *This, DMUS_PRIVATE_CHUNK *pChunk, DWORD StreamSize, StreamCount, ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */
- IDirectMusicBand* pBand = NULL; - if (pChunk->fccID != DMUS_FOURCC_STYLE_FORM) { ERR_(dmfile)(": %s chunk should be a STYLE form\n", debugstr_fourcc (pChunk->fccID)); return E_FAIL; @@ -649,33 +667,13 @@ static HRESULT parse_style_form(struct style *This, DMUS_PRIVATE_CHUNK *pChunk, ListCount[0] = 0; switch (Chunk.fccID) { case DMUS_FOURCC_BAND_FORM: { - ULARGE_INTEGER save; - struct style_band *pNewBand; - + static const LARGE_INTEGER zero = {0}; + struct chunk_entry chunk = {FOURCC_LIST, .size = Chunk.dwSize, .type = Chunk.fccID}; TRACE_(dmfile)(": BAND RIFF\n"); - - /* Can be application provided IStream without Clone method */ - liMove.QuadPart = 0; - liMove.QuadPart -= sizeof(FOURCC) + (sizeof(FOURCC)+sizeof(DWORD)); - IStream_Seek(pStm, liMove, STREAM_SEEK_CUR, &save); - - hr = load_band(pStm, &pBand); - if (FAILED(hr)) { - ERR(": could not load track\n"); - return hr; - } - - if (!(pNewBand = calloc(1, sizeof(*pNewBand)))) return E_OUTOFMEMORY; - pNewBand->pBand = pBand; - IDirectMusicBand_AddRef(pBand); - list_add_tail(&This->bands, &pNewBand->entry); - - IDirectMusicTrack_Release(pBand); pBand = NULL; /* now we can release it as it's inserted */ - - /** now safely move the cursor */ - liMove.QuadPart = save.QuadPart - liMove.QuadPart + ListSize[0]; - IStream_Seek(pStm, liMove, STREAM_SEEK_SET, NULL); - + IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &chunk.offset); + chunk.offset.QuadPart -= 12; + hr = parse_style_band(This, pStm, &chunk); + if (FAILED(hr)) return hr; break; } default: {
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index 99fcca672c5..cb00722c551 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -25,7 +25,7 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
struct style_band { struct list entry; - IDirectMusicBand *pBand; + IDirectMusicBand *band; };
struct style_part_ref @@ -153,8 +153,8 @@ static ULONG WINAPI style_Release(IDirectMusicStyle8 *iface)
LIST_FOR_EACH_ENTRY_SAFE(band, band2, &This->bands, struct style_band, entry) { list_remove(&band->entry); - if (band->pBand) - IDirectMusicBand_Release(band->pBand); + if (band->band) + IDirectMusicBand_Release(band->band); free(band); }
@@ -191,15 +191,15 @@ static HRESULT WINAPI style_GetBand(IDirectMusicStyle8 *iface, WCHAR *name, LIST_FOR_EACH_ENTRY(sband, &This->bands, struct style_band, entry) { IDirectMusicObject *obj;
- hr = IDirectMusicBand_QueryInterface(sband->pBand, &IID_IDirectMusicObject, (void**)&obj); + hr = IDirectMusicBand_QueryInterface(sband->band, &IID_IDirectMusicObject, (void **)&obj); if (SUCCEEDED(hr)) { DMUS_OBJECTDESC desc;
if (IDirectMusicObject_GetDescriptor(obj, &desc) == S_OK) { if (desc.dwValidData & DMUS_OBJ_NAME && !lstrcmpW(name, desc.wszName)) { IDirectMusicObject_Release(obj); - IDirectMusicBand_AddRef(sband->pBand); - *band = sband->pBand; + IDirectMusicBand_AddRef(sband->band); + *band = sband->band; return S_OK; } } @@ -615,7 +615,7 @@ static HRESULT parse_style_band(struct style *This, IStream *stream, struct chun
/* Can be application provided IStream without Clone method */ if (FAILED(hr = stream_reset_chunk_start(stream, chunk)) || - FAILED(hr = load_band(stream, &band->pBand))) + FAILED(hr = load_band(stream, &band->band))) { free(band); return hr;
From: Michael Stefaniuc mstefani@winehq.org
And avoid a DirectMusicBand object leak on load failure. --- dlls/dmstyle/style.c | 45 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index cb00722c551..c221c5c8dc2 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -393,33 +393,28 @@ static inline struct style *impl_from_IPersistStream(IPersistStream *iface) return CONTAINING_RECORD(iface, struct style, dmobj.IPersistStream_iface); }
-static HRESULT load_band(IStream *pClonedStream, IDirectMusicBand **ppBand) +static HRESULT load_band(IStream *stream, IDirectMusicBand **band) { - HRESULT hr = E_FAIL; - IPersistStream* pPersistStream = NULL; - - hr = CoCreateInstance (&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand, (LPVOID*) ppBand); - if (FAILED(hr)) { - ERR(": could not create object\n"); - return hr; - } - /* acquire PersistStream interface */ - hr = IDirectMusicBand_QueryInterface (*ppBand, &IID_IPersistStream, (LPVOID*) &pPersistStream); - if (FAILED(hr)) { - ERR(": could not acquire IPersistStream\n"); - return hr; - } - /* load */ - hr = IPersistStream_Load (pPersistStream, pClonedStream); - if (FAILED(hr)) { - ERR(": failed to load object\n"); - return hr; - } - - /* release all loading-related stuff */ - IPersistStream_Release (pPersistStream); + IPersistStream *persist; + HRESULT hr;
- return S_OK; + hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand, (void **)band); + if (FAILED(hr)) + return hr; + if (SUCCEEDED(hr = IDirectMusicBand_QueryInterface(*band, &IID_IPersistStream, (void **)&persist))) + { + hr = IPersistStream_Load(persist, stream); + IPersistStream_Release(persist); + } + + if (FAILED(hr)) + { + ERR("Failed to load the band, hr %#lx.\n", hr); + IDirectMusicBand_Release(*band); + *band = NULL; + return hr; + } + return S_OK; }
static HRESULT parse_pref_list(struct style *This, IStream *stream, struct chunk_entry *parent,
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index c221c5c8dc2..e28948cd2c6 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -393,7 +393,7 @@ static inline struct style *impl_from_IPersistStream(IPersistStream *iface) return CONTAINING_RECORD(iface, struct style, dmobj.IPersistStream_iface); }
-static HRESULT load_band(IStream *stream, IDirectMusicBand **band) +static HRESULT load_band(IStream *stream, IDirectMusicBand **band, struct chunk_entry *chunk) { IPersistStream *persist; HRESULT hr; @@ -403,7 +403,9 @@ static HRESULT load_band(IStream *stream, IDirectMusicBand **band) return hr; if (SUCCEEDED(hr = IDirectMusicBand_QueryInterface(*band, &IID_IPersistStream, (void **)&persist))) { - hr = IPersistStream_Load(persist, stream); + /* Can be application provided IStream without Clone method */ + if (SUCCEEDED(hr = stream_reset_chunk_start(stream, chunk))) + hr = IPersistStream_Load(persist, stream); IPersistStream_Release(persist); }
@@ -608,9 +610,7 @@ static HRESULT parse_style_band(struct style *This, IStream *stream, struct chun if (!(band = calloc(1, sizeof(*band)))) return E_OUTOFMEMORY;
- /* Can be application provided IStream without Clone method */ - if (FAILED(hr = stream_reset_chunk_start(stream, chunk)) || - FAILED(hr = load_band(stream, &band->band))) + if (FAILED(hr = load_band(stream, &band->band, chunk))) { free(band); return hr;
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index e28948cd2c6..bc298bbe74d 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -565,24 +565,9 @@ static HRESULT parse_pttn_list(struct style *This, IStream *stream, struct chunk break;
case MAKE_IDTYPE(FOURCC_RIFF, DMUS_FOURCC_BAND_FORM): - { - IPersistStream *persist; - if (pattern->band) IDirectMusicBand_Release(pattern->band); - - if (FAILED(hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, - &IID_IDirectMusicBand, (void **)&pattern->band))) - break; - - if (SUCCEEDED(hr = IDirectMusicBand_QueryInterface(pattern->band, &IID_IPersistStream, (void **)&persist))) - { - if (SUCCEEDED(hr = stream_reset_chunk_start(stream, &chunk))) - hr = IPersistStream_Load(persist, stream); - IPersistStream_Release(persist); - } - + hr = load_band(stream, &pattern->band, &chunk); break; - }
case MAKE_IDTYPE(FOURCC_LIST, DMUS_FOURCC_PARTREF_LIST): hr = parse_pref_list(This, stream, &chunk, &pattern->part_refs);
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 234 ++++++++++++------------------------------- 1 file changed, 62 insertions(+), 172 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index bc298bbe74d..4d82115a1e0 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -21,7 +21,6 @@ #include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); -WINE_DECLARE_DEBUG_CHANNEL(dmfile);
struct style_band { struct list entry; @@ -605,180 +604,71 @@ static HRESULT parse_style_band(struct style *This, IStream *stream, struct chun return S_OK; }
-static HRESULT parse_style_form(struct style *This, DMUS_PRIVATE_CHUNK *pChunk, IStream *pStm) -{ - HRESULT hr = E_FAIL; - DMUS_PRIVATE_CHUNK Chunk; - DWORD StreamSize, StreamCount, ListSize[3], ListCount[3]; - LARGE_INTEGER liMove; /* used when skipping chunks */ - - if (pChunk->fccID != DMUS_FOURCC_STYLE_FORM) { - ERR_(dmfile)(": %s chunk should be a STYLE form\n", debugstr_fourcc (pChunk->fccID)); - return E_FAIL; - } - - StreamSize = pChunk->dwSize - sizeof(FOURCC); - StreamCount = 0; - - do { - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - - hr = IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk, pStm, &This->dmobj.desc); - if (FAILED(hr)) return hr; - - if (hr == S_FALSE) { - switch (Chunk.fccID) { - case DMUS_FOURCC_STYLE_CHUNK: { - TRACE_(dmfile)(": Style chunk\n"); - IStream_Read (pStm, &This->style, sizeof(DMUS_IO_STYLE), NULL); - /** TODO dump DMUS_IO_TIMESIG style.timeSig */ - TRACE_(dmfile)(" - dblTempo: %g\n", This->style.dblTempo); - break; - } - case FOURCC_RIFF: { - /** - * should be embedded Bands into style - */ - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID)); - ListSize[0] = Chunk.dwSize - sizeof(FOURCC); - ListCount[0] = 0; - switch (Chunk.fccID) { - case DMUS_FOURCC_BAND_FORM: { - static const LARGE_INTEGER zero = {0}; - struct chunk_entry chunk = {FOURCC_LIST, .size = Chunk.dwSize, .type = Chunk.fccID}; - TRACE_(dmfile)(": BAND RIFF\n"); - IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &chunk.offset); - chunk.offset.QuadPart -= 12; - hr = parse_style_band(This, pStm, &chunk); - if (FAILED(hr)) return hr; - break; - } - default: { - TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = ListSize[0]; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - break; - } - case FOURCC_LIST: { - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID)); - ListSize[0] = Chunk.dwSize - sizeof(FOURCC); - ListCount[0] = 0; - switch (Chunk.fccID) { - case DMUS_FOURCC_UNFO_LIST: { - TRACE_(dmfile)(": UNFO list\n"); - do { - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - - hr = IDirectMusicUtils_IPersistStream_ParseUNFOGeneric(&Chunk, pStm, &This->dmobj.desc); - if (FAILED(hr)) return hr; - - if (hr == S_FALSE) { - switch (Chunk.fccID) { - default: { - TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - } - TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); - } while (ListCount[0] < ListSize[0]); - break; - } - case DMUS_FOURCC_PART_LIST: { - static const LARGE_INTEGER zero = {0}; - struct chunk_entry chunk = {FOURCC_LIST, .size = Chunk.dwSize, .type = Chunk.fccID}; - TRACE_(dmfile)(": PART list\n"); - IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &chunk.offset); - chunk.offset.QuadPart -= 12; - hr = parse_part_list(This, pStm, &chunk); - if (FAILED(hr)) return hr; - break; - } - case DMUS_FOURCC_PATTERN_LIST: { - static const LARGE_INTEGER zero = {0}; - struct chunk_entry chunk = {FOURCC_LIST, .size = Chunk.dwSize, .type = Chunk.fccID}; - TRACE_(dmfile)(": PATTERN list\n"); - IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &chunk.offset); - chunk.offset.QuadPart -= 12; - hr = parse_pttn_list(This, pStm, &chunk); - if (FAILED(hr)) return hr; - break; - } - default: { - TRACE_(dmfile)(": unknown (skipping)\n"); - liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC); - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - break; - } - default: { - TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - } - TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); - } while (StreamCount < StreamSize); - - return S_OK; +static inline void dump_timesig(DMUS_IO_TIMESIG *timesig) +{ + TRACE("Time signature: %d beats/measure, 1/%d note beat, %d grids/beat\n", + timesig->bBeatsPerMeasure, timesig->bBeat ? timesig->bBeat : 256, timesig->wGridsPerBeat); }
-static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) -{ - struct style *This = impl_from_IPersistStream(iface); - DMUS_PRIVATE_CHUNK Chunk; - LARGE_INTEGER liMove; /* used when skipping chunks */ - HRESULT hr; - - FIXME("(%p, %p): Loading\n", This, pStm); - - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case FOURCC_RIFF: { - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case DMUS_FOURCC_STYLE_FORM: { - TRACE_(dmfile)(": Style form\n"); - hr = parse_style_form(This, &Chunk, pStm); - if (FAILED(hr)) return hr; - break; - } - default: { - TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ - return E_FAIL; +static HRESULT WINAPI style_persist_stream_Load(IPersistStream *iface, IStream *stream) +{ + struct style *This = impl_from_IPersistStream(iface); + struct chunk_entry style = {0}; + struct chunk_entry chunk = {.parent = &style}; + HRESULT hr = E_FAIL; + + TRACE("(%p, %p): Loading\n", This, stream); + + if (!stream) + return E_POINTER; + + if (stream_get_chunk(stream, &style) != S_OK || style.id != FOURCC_RIFF || + style.type != DMUS_FOURCC_STYLE_FORM) + { + WARN("Invalid chunk %s\n", debugstr_chunk(&style)); + return DMUS_E_UNSUPPORTED_STREAM; } + + if (FAILED(hr = dmobj_parsedescriptor(stream, &style, &This->dmobj.desc, DMUS_OBJ_OBJECT)) + || FAILED(hr = stream_reset_chunk_data(stream, &style))) + return hr; + + while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) + { + switch (MAKE_IDTYPE(chunk.id, chunk.type)) + { + case DMUS_FOURCC_GUID_CHUNK: + case DMUS_FOURCC_VERSION_CHUNK: + case MAKE_IDTYPE(FOURCC_LIST, DMUS_FOURCC_UNFO_LIST): + /* already parsed/ignored by dmobj_parsedescriptor */ + break; + case DMUS_FOURCC_STYLE_CHUNK: + hr = stream_chunk_get_data(stream, &chunk, &This->style, sizeof(This->style)); + if (SUCCEEDED(hr)) + { + dump_timesig(&This->style.timeSig); + TRACE("Tempo: %g\n", This->style.dblTempo); + } + break; + case MAKE_IDTYPE(FOURCC_LIST, DMUS_FOURCC_PART_LIST): + hr = parse_part_list(This, stream, &chunk); + break; + case MAKE_IDTYPE(FOURCC_LIST, DMUS_FOURCC_PATTERN_LIST): + hr = parse_pttn_list(This, stream, &chunk); + break; + case MAKE_IDTYPE(FOURCC_RIFF, DMUS_FOURCC_BAND_FORM): + hr = parse_style_band(This, stream, &chunk); + break; + default: + WARN("Ignoring chunk %s\n", debugstr_chunk(&chunk)); + break; + } + + if (FAILED(hr)) + return hr; } - TRACE_(dmfile)(": reading finished\n"); - break; - } - default: { - TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ - return E_FAIL; - } - } - - return S_OK; + + return S_OK; }
static const IPersistStreamVtbl persiststream_vtbl = { @@ -787,7 +677,7 @@ static const IPersistStreamVtbl persiststream_vtbl = { dmobj_IPersistStream_Release, dmobj_IPersistStream_GetClassID, unimpl_IPersistStream_IsDirty, - IPersistStreamImpl_Load, + style_persist_stream_Load, unimpl_IPersistStream_Save, unimpl_IPersistStream_GetSizeMax };
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/Makefile.in | 1 - dlls/dmstyle/dmutils.c | 145 --------------------------------------- dlls/dmstyle/dmutils.h | 6 -- 3 files changed, 152 deletions(-) delete mode 100644 dlls/dmstyle/dmutils.c
diff --git a/dlls/dmstyle/Makefile.in b/dlls/dmstyle/Makefile.in index a5e4c5da289..1ab0a7f33ae 100644 --- a/dlls/dmstyle/Makefile.in +++ b/dlls/dmstyle/Makefile.in @@ -9,7 +9,6 @@ SOURCES = \ dmobject.c \ dmstyle.idl \ dmstyle_main.c \ - dmutils.c \ motiftrack.c \ mutetrack.c \ style.c \ diff --git a/dlls/dmstyle/dmutils.c b/dlls/dmstyle/dmutils.c deleted file mode 100644 index 4b9101e675a..00000000000 --- a/dlls/dmstyle/dmutils.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Debug and Helper Functions - * - * Copyright (C) 2004 Rok Mandeljc - * Copyright (C) 2004 Raphael Junqueira - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <stdio.h> -#include <stdarg.h> -#include <string.h> - -#define COBJMACROS - -#include "windef.h" -#include "winbase.h" -#include "winnt.h" -#include "wingdi.h" -#include "winuser.h" - -#include "wine/debug.h" -#include "objbase.h" - -#include "dmusici.h" -#include "dmusicf.h" -#include "dmusics.h" - -#include "dmutils.h" -#include "dmobject.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmfile); - -HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) { - - switch (pChunk->fccID) { - case DMUS_FOURCC_GUID_CHUNK: { - TRACE(": GUID chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_OBJECT; - IStream_Read (pStm, &pDesc->guidObject, pChunk->dwSize, NULL); - break; - } - case DMUS_FOURCC_DATE_CHUNK: { - TRACE(": file date chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_DATE; - IStream_Read (pStm, &pDesc->ftDate, pChunk->dwSize, NULL); - break; - } - case DMUS_FOURCC_NAME_CHUNK: { - TRACE(": name chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_NAME; - IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL); - break; - } - case DMUS_FOURCC_FILE_CHUNK: { - TRACE(": file name chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_FILENAME; - IStream_Read (pStm, pDesc->wszFileName, pChunk->dwSize, NULL); - break; - } - case DMUS_FOURCC_VERSION_CHUNK: { - TRACE(": version chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_VERSION; - IStream_Read (pStm, &pDesc->vVersion, pChunk->dwSize, NULL); - break; - } - case DMUS_FOURCC_CATEGORY_CHUNK: { - TRACE(": category chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_CATEGORY; - IStream_Read (pStm, pDesc->wszCategory, pChunk->dwSize, NULL); - break; - } - default: - /* not handled */ - return S_FALSE; - } - - return S_OK; -} - -HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) { - - LARGE_INTEGER liMove; /* used when skipping chunks */ - - /** - * don't ask me why, but M$ puts INFO elements in UNFO list sometimes - * (though strings seem to be valid unicode) - */ - switch (pChunk->fccID) { - - case mmioFOURCC('I','N','A','M'): - case DMUS_FOURCC_UNAM_CHUNK: { - TRACE(": name chunk\n"); - pDesc->dwValidData |= DMUS_OBJ_NAME; - IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL); - TRACE(" - wszName: %s\n", debugstr_w(pDesc->wszName)); - break; - } - - case mmioFOURCC('I','A','R','T'): - case DMUS_FOURCC_UART_CHUNK: { - TRACE(": artist chunk (ignored)\n"); - liMove.QuadPart = pChunk->dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - case mmioFOURCC('I','C','O','P'): - case DMUS_FOURCC_UCOP_CHUNK: { - TRACE(": copyright chunk (ignored)\n"); - liMove.QuadPart = pChunk->dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - case mmioFOURCC('I','S','B','J'): - case DMUS_FOURCC_USBJ_CHUNK: { - TRACE(": subject chunk (ignored)\n"); - liMove.QuadPart = pChunk->dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - case mmioFOURCC('I','C','M','T'): - case DMUS_FOURCC_UCMT_CHUNK: { - TRACE(": comment chunk (ignored)\n"); - liMove.QuadPart = pChunk->dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - default: - /* not handled */ - return S_FALSE; - } - - return S_OK; -} diff --git a/dlls/dmstyle/dmutils.h b/dlls/dmstyle/dmutils.h index 4f50bb0bfce..521b148604a 100644 --- a/dlls/dmstyle/dmutils.h +++ b/dlls/dmstyle/dmutils.h @@ -27,10 +27,4 @@ typedef struct _DMUS_PRIVATE_CHUNK { DWORD dwSize; /* size of the chunk */ } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
-/** - * Parsing utilities - */ -extern HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc); -extern HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc); - #endif /* __WINE_DMUTILS_H */
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/style.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index 4d82115a1e0..a9bcd61ed01 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -659,6 +659,9 @@ static HRESULT WINAPI style_persist_stream_Load(IPersistStream *iface, IStream * case MAKE_IDTYPE(FOURCC_RIFF, DMUS_FOURCC_BAND_FORM): hr = parse_style_band(This, stream, &chunk); break; + case MAKE_IDTYPE(FOURCC_LIST, DMUS_FOURCC_STYLE_PERS_REF_LIST): + FIXME("Unhandled chordmap reference chunk %s\n", debugstr_chunk(&chunk)); + break; default: WARN("Ignoring chunk %s\n", debugstr_chunk(&chunk)); break;