Skip to content
Snippets Groups Projects
Commit 2e2ab251 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix some warnings.

We can't use const protection for the sample buffer because the Win32
API takes non-const buffers.  For standard implicit conversions,
simply disable the warning where it occurs on purpose.  It appears
that MSVC builds use the equivilent of -Wconversion (which isn't even
part of -Wall).
parent 1c15e56f
No related branches found
No related tags found
No related merge requests found
Pipeline #5737 passed
......@@ -239,6 +239,10 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
inc=8.0*atan(1.0);
inc *= ((double)freq / (double)S_RATE);
#ifdef MSVC
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
for(i=0;i<samples;i++) {
pos=(inc*(double)i);
pos -= (int)(pos/WAVE_TPI)*WAVE_TPI;
......@@ -272,6 +276,9 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
break;
}
}
#ifdef MSVC
#pragma warning(pop)
#endif
/* Now we have a "perfect" wave...
* we must clean it up now to avoid click/pop
......@@ -823,10 +830,11 @@ xptone_close(void)
return ret;
}
// This can't be const because the Win32 API is not const.
static bool
do_xp_play_sample(const unsigned char *sampo, size_t sz, int *freed)
{
const unsigned char *samp;
unsigned char *samp;
int need_copy = 0;
#ifdef AFMT_U8
int wr;
......@@ -1152,8 +1160,15 @@ bool xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
freq=17;
samples=S_RATE*duration/1000;
if(freq) {
#ifdef MSVC
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
if(samples<=S_RATE/freq*2)
samples=S_RATE/freq*2;
#ifdef MSVC
#pragma warning(pop)
#endif
}
if(freq==0 || samples > S_RATE/freq*2) {
int sample_len;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment