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@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
Gerald
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@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;
On Sat, Jul 24, 2004 at 08:49:35AM +0200, Gerald Pfeifer wrote:
...and here is why:
#define _GNU_SOURCE /* for round() in math.h */
This is not precisely a clever idea, because it is obviously unportable!
round() is a C99 function anyway. I would file a bug against your C library if it isn't pulled in with <math.h>.