Andrew Talbot : dsound: Constify some variables.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 30 07:11:17 CDT 2007


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

Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date:   Sat Apr 28 15:39:28 2007 +0100

dsound: Constify some variables.

---

 dlls/dsound/mixer.c   |    9 +++++----
 dlls/dsound/sound3d.c |   14 +++++++-------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index b961cf6..adbee9e 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -175,7 +175,7 @@ static inline BYTE cvtS16toU8(INT16 s)
  * Copy a single frame from the given input buffer to the given output buffer.
  * Translate 8 <-> 16 bits and mono <-> stereo
  */
-static inline void cp_fields(const IDirectSoundBufferImpl *dsb, BYTE *ibuf, BYTE *obuf )
+static inline void cp_fields(const IDirectSoundBufferImpl *dsb, const BYTE *ibuf, BYTE *obuf )
 {
 	DirectSoundDevice * device = dsb->device;
         INT fl,fr;
@@ -192,8 +192,8 @@ static inline void cp_fields(const IDirectSoundBufferImpl *dsb, BYTE *ibuf, BYTE
                 fl = cvtU8toS16(*ibuf);
                 fr = (dsb->pwfx->nChannels==2 ? cvtU8toS16(*(ibuf + 1)) : fl);
         } else {
-                fl = *((INT16 *)ibuf);
-                fr = (dsb->pwfx->nChannels==2 ? *(((INT16 *)ibuf) + 1)  : fl);
+                fl = *((const INT16 *)ibuf);
+                fr = (dsb->pwfx->nChannels==2 ? *(((const INT16 *)ibuf) + 1)  : fl);
         }
 
         if (device->pwfx->nChannels == 2) {
@@ -910,7 +910,8 @@ post_mix:
  *
  * Returns:  the length beyond the writepos that was mixed to.
  */
-static DWORD DSOUND_MixToPrimary(DirectSoundDevice *device, DWORD playpos, DWORD writepos, DWORD mixlen, BOOL recover)
+static DWORD DSOUND_MixToPrimary(const DirectSoundDevice *device, DWORD playpos, DWORD writepos,
+                                 DWORD mixlen, BOOL recover)
 {
 	INT			i, len, maxlen = 0;
 	IDirectSoundBufferImpl	*dsb;
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index 234c40b..6145cff 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -66,7 +66,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound3d);
  */
 
 /* scalar product (i believe it's called dot product in english) */
-static inline D3DVALUE ScalarProduct (LPD3DVECTOR a, LPD3DVECTOR b)
+static inline D3DVALUE ScalarProduct (const D3DVECTOR *a, const D3DVECTOR *b)
 {
 	D3DVALUE c;
 	c = (a->x*b->x) + (a->y*b->y) + (a->z*b->z);
@@ -76,7 +76,7 @@ static inline D3DVALUE ScalarProduct (LPD3DVECTOR a, LPD3DVECTOR b)
 }
 
 /* vector product (i believe it's called cross product in english */
-static inline D3DVECTOR VectorProduct (LPD3DVECTOR a, LPD3DVECTOR b)
+static inline D3DVECTOR VectorProduct (const D3DVECTOR *a, const D3DVECTOR *b)
 {
 	D3DVECTOR c;
 	c.x = (a->y*b->z) - (a->z*b->y);
@@ -88,7 +88,7 @@ static inline D3DVECTOR VectorProduct (LPD3DVECTOR a, LPD3DVECTOR b)
 }
 
 /* magnitude (length) of vector */
-static inline D3DVALUE VectorMagnitude (LPD3DVECTOR a)
+static inline D3DVALUE VectorMagnitude (const D3DVECTOR *a)
 {
 	D3DVALUE l;
 	l = sqrt (ScalarProduct (a, a));
@@ -106,7 +106,7 @@ static inline D3DVALUE RadToDeg (D3DVALUE angle)
 }
 
 /* angle between vectors - deg version */
-static inline D3DVALUE AngleBetweenVectorsDeg (LPD3DVECTOR a, LPD3DVECTOR b)
+static inline D3DVALUE AngleBetweenVectorsDeg (const D3DVECTOR *a, const D3DVECTOR *b)
 {
 	D3DVALUE la, lb, product, angle, cos;
 	/* definition of scalar product: a*b = |a|*|b|*cos...therefore: */
@@ -123,7 +123,7 @@ static inline D3DVALUE AngleBetweenVectorsDeg (LPD3DVECTOR a, LPD3DVECTOR b)
 }
 
 /* angle between vectors - rad version */
-static inline D3DVALUE AngleBetweenVectorsRad (LPD3DVECTOR a, LPD3DVECTOR b)
+static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECTOR *b)
 {
 	D3DVALUE la, lb, product, angle, cos;
 	/* definition of scalar product: a*b = |a|*|b|*cos...therefore: */
@@ -138,7 +138,7 @@ static inline D3DVALUE AngleBetweenVectorsRad (LPD3DVECTOR a, LPD3DVECTOR b)
 }
 
 /* calculates vector between two points */
-static inline D3DVECTOR VectorBetweenTwoPoints (LPD3DVECTOR a, LPD3DVECTOR b)
+static inline D3DVECTOR VectorBetweenTwoPoints (const D3DVECTOR *a, const D3DVECTOR *b)
 {
 	D3DVECTOR c;
 	c.x = b->x - a->x;
@@ -150,7 +150,7 @@ static inline D3DVECTOR VectorBetweenTwoPoints (LPD3DVECTOR a, LPD3DVECTOR b)
 }
 
 /* calculates the length of vector's projection on another vector */
-static inline D3DVALUE ProjectVector (LPD3DVECTOR a, LPD3DVECTOR p)
+static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
 {
 	D3DVALUE prod, result;
 	prod = ScalarProduct(a, p);




More information about the wine-cvs mailing list