dsound: Constify some variables

Andrew Talbot Andrew.Talbot at talbotville.com
Sat Apr 28 09:39:28 CDT 2007


Changelog:
    dsound: Constify some variables.

diff -urN a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
--- a/dlls/dsound/mixer.c	2007-02-22 11:57:55.000000000 +0000
+++ b/dlls/dsound/mixer.c	2007-04-28 14:41:18.000000000 +0100
@@ -175,7 +175,7 @@
  * 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 @@
                 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 @@
  *
  * 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 -urN a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
--- a/dlls/dsound/sound3d.c	2007-01-09 12:11:37.000000000 +0000
+++ b/dlls/dsound/sound3d.c	2007-04-28 14:41:31.000000000 +0100
@@ -66,7 +66,7 @@
  */
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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-patches mailing list