dlls/winmm/wineoss/audio.c build failure
Gerald Pfeifer
gerald at pfeifer.com
Sat Jul 31 00:51:54 CDT 2004
So, how about the following? Without this patch (or some other fix for
this very problems introduced by Francois' patch) FreeBSD simply does not
build.
Gerald
---------- Forwarded message ----------
From: Gerald Pfeifer <gerald at pfeifer.com>
To: wine-devel at winehq.com, wine-patches at winehq.com
Cc: Francois Gouget <fgouget at codeweavers.com>
Date: Sat, 24 Jul 2004 08:49:35 +0200 (CEST)
Subject: Re: dlls/winmm/wineoss/audio.c build failure
On Thu, 22 Jul 2004, Gerald Pfeifer wrote:
> The following change to dlls/winmm/wineoss/audio.c
>
> revision 1.135
> date: 2004/07/19 20:08:06; author: julliard; state: Exp; lines: +1 -1
> Francois Gouget <fgouget at codeweavers.com>
> Use round() instead of ceil() in wodGetPosition(TIME_SMPTE).
> Fixes the corresponding winmm conformance test.
>
> causes the following build failure on FreeBSD 4.9:
>
> ../../../tools/winegcc/winegcc -B../../../tools/winebuild -shared
> ./wineoss.drv.spec audio.o midi.o midipatch.o mixer.o mmaux.o oss.o
> wineoss.drv.dbg.o -o wineoss.drv.so -L../../../dlls -lwinmm -luser32
> -lkernel32 -L../../../libs/wine -lwine -ldxguid -luuid
> -L../../../libs/port -lwine_port
> audio.o: In function `wodGetPosition': /test/wine/dlls/winmm/wineoss/audio.c:2127:
> undefined reference to `round'
> collect2: ld returned 1 exit status
> winegcc: /sw/gcc-3.3.2/bin/gcc failed.
> gmake: *** [wineoss.drv.so] Error 2
...and here is why:
#define _GNU_SOURCE /* for round() in math.h */
This is not precisely a clever idea, because it is obviously unportable!
The patch below addresses this; if we really need commercial rounding
here, we simply need to add 0.5 everywhere.
Gerald
ChangeLog:
Avoid using round(), which is unportable().
Index: dlls/dsound/mixer.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/mixer.c,v
retrieving revision 1.21
diff -u -3 -p -r1.21 mixer.c
--- dlls/dsound/mixer.c 23 Jul 2004 19:06:31 -0000 1.21
+++ dlls/dsound/mixer.c 24 Jul 2004 06:47:05 -0000
@@ -20,7 +20,6 @@
*/
#include "config.h"
-#define _GNU_SOURCE /* for round() in math.h */
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@@ -85,17 +84,17 @@ void DSOUND_AmpFactorToVolPan(PDSVOLUMEP
right=600 * log(((double)volpan->dwTotalRightAmpFactor) / 0xffff) / log(2);
if (left<right)
{
- volpan->lVolume=round(right);
+ volpan->lVolume=right;
volpan->dwVolAmpFactor=volpan->dwTotalRightAmpFactor;
}
else
{
- volpan->lVolume=round(left);
+ volpan->lVolume=left;
volpan->dwVolAmpFactor=volpan->dwTotalLeftAmpFactor;
}
if (volpan->lVolume < -10000)
volpan->lVolume=-10000;
- volpan->lPan=round(right-left);
+ volpan->lPan=right-left;
if (volpan->lPan < -10000)
volpan->lPan=-10000;
More information about the wine-patches
mailing list