Andrew Talbot : quartz: Assign to structs instead of using memcpy.

Alexandre Julliard julliard at winehq.org
Thu Mar 13 14:55:24 CDT 2008


Module: wine
Branch: master
Commit: 442f29ab4947faf9fb23e30d7f080550c7baf2a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=442f29ab4947faf9fb23e30d7f080550c7baf2a6

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Wed Mar 12 20:32:07 2008 +0000

quartz: Assign to structs instead of using memcpy.

---

 dlls/quartz/avisplit.c     |   12 ++++++------
 dlls/quartz/enummedia.c    |    2 +-
 dlls/quartz/filesource.c   |    2 +-
 dlls/quartz/memallocator.c |    6 +++---
 dlls/quartz/mpegsplit.c    |    6 +++---
 dlls/quartz/pin.c          |    2 +-
 dlls/quartz/waveparser.c   |    6 +++---
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c
index 3121ead..5f601a6 100644
--- a/dlls/quartz/avisplit.c
+++ b/dlls/quartz/avisplit.c
@@ -365,19 +365,19 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
                 switch (pStrHdr->fccType)
                 {
                 case streamtypeVIDEO:
-                    memcpy(&amt.formattype, &FORMAT_VideoInfo, sizeof(GUID));
+                    amt.formattype = FORMAT_VideoInfo;
                     amt.pbFormat = NULL;
                     amt.cbFormat = 0;
                     break;
                 case streamtypeAUDIO:
-                    memcpy(&amt.formattype, &FORMAT_WaveFormatEx, sizeof(GUID));
+                    amt.formattype = FORMAT_WaveFormatEx;
                     break;
                 default:
-                    memcpy(&amt.formattype, &FORMAT_None, sizeof(GUID));
+                    amt.formattype = FORMAT_None;
                 }
-                memcpy(&amt.majortype, &MEDIATYPE_Video, sizeof(GUID));
+                amt.majortype = MEDIATYPE_Video;
                 amt.majortype.Data1 = pStrHdr->fccType;
-                memcpy(&amt.subtype, &MEDIATYPE_Video, sizeof(GUID));
+                amt.subtype = MEDIATYPE_Video;
                 amt.subtype.Data1 = pStrHdr->fccHandler;
                 TRACE("Subtype FCC: %.04s\n", (LPCSTR)&pStrHdr->fccHandler);
                 amt.lSampleSize = pStrHdr->dwSampleSize;
@@ -448,7 +448,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
 
     if (IsEqualGUID(&amt.formattype, &FORMAT_WaveFormatEx))
     {
-        memcpy(&amt.subtype, &MEDIATYPE_Video, sizeof(GUID));
+        amt.subtype = MEDIATYPE_Video;
         amt.subtype.Data1 = ((WAVEFORMATEX *)amt.pbFormat)->wFormatTag;
     }
 
diff --git a/dlls/quartz/enummedia.c b/dlls/quartz/enummedia.c
index 2f207d6..ed5edb3 100644
--- a/dlls/quartz/enummedia.c
+++ b/dlls/quartz/enummedia.c
@@ -26,7 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
 HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc)
 {
-    memcpy(pDest, pSrc, sizeof(AM_MEDIA_TYPE));
+    *pDest = *pSrc;
     if (!pSrc->pbFormat) return S_OK;
     if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat)))
         return E_OUTOFMEMORY;
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 73c92b2..1200802 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -609,7 +609,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
             This->pmt->pbFormat = NULL;
             This->pmt->pUnk = NULL;
             This->pmt->lSampleSize = 0;
-            memcpy(&This->pmt->formattype, &FORMAT_None, sizeof(FORMAT_None));
+            This->pmt->formattype = FORMAT_None;
             hr = GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype);
             if (FAILED(hr))
             {
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index f1700aa..6b68cf5 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -188,9 +188,9 @@ static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator * iface, ALLO
                 hr = E_OUTOFMEMORY;
             else
             {
-                memcpy(This->pProps, pRequest, sizeof(*This->pProps));
-                    
-                memcpy(pActual, pRequest, sizeof(*pActual));
+                *This->pProps = *pRequest;
+
+                *pActual = *pRequest;
 
                 hr = S_OK;
             }
diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c
index 205f645..edf39b3 100644
--- a/dlls/quartz/mpegsplit.c
+++ b/dlls/quartz/mpegsplit.c
@@ -317,9 +317,9 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
     ppiOutput->pFilter = (IBaseFilter*)This;
     wsprintfW(ppiOutput->achName, wszAudioStream);
 
-    memcpy(&pamt->formattype, &FORMAT_WaveFormatEx, sizeof(GUID));
-    memcpy(&pamt->majortype, &MEDIATYPE_Audio, sizeof(GUID));
-    memcpy(&pamt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload, sizeof(GUID));
+    pamt->formattype = FORMAT_WaveFormatEx;
+    pamt->majortype = MEDIATYPE_Audio;
+    pamt->subtype = MEDIASUBTYPE_MPEG1AudioPayload;
 
     pamt->lSampleSize = 0;
     pamt->bFixedSizeSamples = TRUE;
diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index 08ddcef..1cb379f 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -200,7 +200,7 @@ HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, const ALLOCATOR_PROPERTIES * p
     pPinImpl->pConnectSpecific = OutputPin_ConnectSpecific;
     if (props)
     {
-        memcpy(&pPinImpl->allocProps, props, sizeof(pPinImpl->allocProps));
+        pPinImpl->allocProps = *props;
         if (pPinImpl->allocProps.cbAlign == 0)
             pPinImpl->allocProps.cbAlign = 1;
     }
diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c
index cbb387e..fabd0d6 100644
--- a/dlls/quartz/waveparser.c
+++ b/dlls/quartz/waveparser.c
@@ -256,13 +256,13 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
         return E_FAIL;
     }
 
-    memcpy(&amt.majortype, &MEDIATYPE_Audio, sizeof(GUID));
-    memcpy(&amt.formattype, &FORMAT_WaveFormatEx, sizeof(GUID));
+    amt.majortype = MEDIATYPE_Audio;
+    amt.formattype = FORMAT_WaveFormatEx;
     amt.cbFormat = chunk.cb;
     amt.pbFormat = CoTaskMemAlloc(amt.cbFormat);
     amt.pUnk = NULL;
     hr = IAsyncReader_SyncRead(This->pReader, pos, amt.cbFormat, amt.pbFormat);
-    memcpy(&amt.subtype, &MEDIATYPE_Audio, sizeof(GUID));
+    amt.subtype = MEDIATYPE_Audio;
     amt.subtype.Data1 = ((WAVEFORMATEX*)amt.pbFormat)->wFormatTag;
 
     pos += chunk.cb;




More information about the wine-cvs mailing list