winmm: Replace malloc with HeapAlloc.
This commit is contained in:
parent
da1f67a30d
commit
d14da0763d
|
@ -191,7 +191,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
|
|||
/* Check that the position is 0 at start */
|
||||
check_position(device, win, 0, pwfx);
|
||||
|
||||
frag.lpData=malloc(pwfx->nAvgBytesPerSec);
|
||||
frag.lpData=HeapAlloc(GetProcessHeap(), 0, pwfx->nAvgBytesPerSec);
|
||||
frag.dwBufferLength=pwfx->nAvgBytesPerSec;
|
||||
frag.dwBytesRecorded=0;
|
||||
frag.dwUser=0;
|
||||
|
@ -291,7 +291,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
|
|||
trace("Unable to play back the recorded sound\n");
|
||||
}
|
||||
|
||||
free(frag.lpData);
|
||||
HeapFree(GetProcessHeap(), 0, frag.lpData);
|
||||
CloseHandle(hevent);
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ static void wave_in_test_device(int device)
|
|||
"waveInMessage(%s): failed to get interface size: rc=%s\n",
|
||||
dev_name(device),wave_in_error(rc));
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
nameW = (WCHAR *)malloc(size);
|
||||
nameW = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
rc=waveInMessage((HWAVEIN)device, DRV_QUERYDEVICEINTERFACE,
|
||||
(DWORD_PTR)nameW, size);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveInMessage(%s): failed to get interface "
|
||||
|
@ -379,11 +379,11 @@ static void wave_in_test_device(int device)
|
|||
ok(lstrlenW(nameW)+1==size/sizeof(WCHAR),
|
||||
"got an incorrect size %d\n", size);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
nameA = malloc(size/sizeof(WCHAR));
|
||||
nameA = HeapAlloc(GetProcessHeap(), 0, size/sizeof(WCHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, nameW, size/sizeof(WCHAR),
|
||||
nameA, size/sizeof(WCHAR), NULL, NULL);
|
||||
}
|
||||
free(nameW);
|
||||
HeapFree(GetProcessHeap(), 0, nameW);
|
||||
} else if (rc==MMSYSERR_NOTSUPPORTED) {
|
||||
nameA=strdup("not supported");
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ static void wave_in_test_device(int device)
|
|||
trace(" channels=%d formats=%05x\n",
|
||||
capsA.wChannels,capsA.dwFormats);
|
||||
|
||||
free(nameA);
|
||||
HeapFree(GetProcessHeap(), 0, nameA);
|
||||
|
||||
for (f=0;f<NB_WIN_FORMATS;f++) {
|
||||
format.wFormatTag=WAVE_FORMAT_PCM;
|
||||
|
|
|
@ -58,7 +58,7 @@ static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
|
|||
|
||||
nb_samples=(int)(duration*wfx->nSamplesPerSec);
|
||||
*size=nb_samples*wfx->nBlockAlign;
|
||||
b=buf=malloc(*size);
|
||||
b=buf=HeapAlloc(GetProcessHeap(), 0, *size);
|
||||
for (i=0;i<nb_samples;i++) {
|
||||
double y=sin(440.0*2*PI*i/wfx->nSamplesPerSec);
|
||||
if (wfx->wBitsPerSample==8) {
|
||||
|
@ -117,7 +117,7 @@ static char* wave_generate_silence(WAVEFORMATEX* wfx, double duration, DWORD* si
|
|||
|
||||
nb_samples=(int)(duration*wfx->nSamplesPerSec);
|
||||
*size=nb_samples*wfx->nBlockAlign;
|
||||
b=buf=malloc(*size);
|
||||
b=buf=HeapAlloc(GetProcessHeap(), 0, *size);
|
||||
for (i=0;i<nb_samples;i++) {
|
||||
if (wfx->wBitsPerSample==8) {
|
||||
for (j = 0; j < wfx->nChannels; j++)
|
||||
|
@ -656,7 +656,7 @@ static void wave_out_test_deviceOut(int device, double duration,
|
|||
pwfx->nSamplesPerSec, pwfx->wBitsPerSample,
|
||||
pwfx->nChannels, nSamplesPerSec, wBitsPerSample, nChannels);
|
||||
|
||||
frags = malloc(headers * sizeof(WAVEHDR));
|
||||
frags = HeapAlloc(GetProcessHeap(), 0, headers * sizeof(WAVEHDR));
|
||||
|
||||
if (sine)
|
||||
buffer=wave_generate_la(pwfx,duration / (loops + 1),&length);
|
||||
|
@ -779,7 +779,7 @@ static void wave_out_test_deviceOut(int device, double duration,
|
|||
"waveOutUnprepareHeader(%s): rc=%s\n",dev_name(device),
|
||||
wave_out_error(rc));
|
||||
}
|
||||
free(buffer);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
|
||||
rc=waveOutClose(wout);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveOutClose(%s): rc=%s\n",dev_name(device),
|
||||
|
@ -791,7 +791,7 @@ EXIT:
|
|||
WaitForSingleObject(hevent,INFINITE);
|
||||
}
|
||||
CloseHandle(hevent);
|
||||
free(frags);
|
||||
HeapFree(GetProcessHeap(), 0, frags);
|
||||
}
|
||||
|
||||
static void wave_out_test_device(int device)
|
||||
|
@ -870,18 +870,18 @@ static void wave_out_test_device(int device)
|
|||
"waveOutMessage(%s): failed to get interface size, rc=%s\n",
|
||||
dev_name(device),wave_out_error(rc));
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
nameW = (WCHAR *)malloc(size);
|
||||
nameW = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
rc=waveOutMessage((HWAVEOUT)device, DRV_QUERYDEVICEINTERFACE,
|
||||
(DWORD_PTR)nameW, size);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveOutMessage(%s): failed to get interface "
|
||||
"name, rc=%s\n",dev_name(device),wave_out_error(rc));
|
||||
ok(lstrlenW(nameW)+1==size/sizeof(WCHAR),"got an incorrect size %d\n",size);
|
||||
if (rc==MMSYSERR_NOERROR) {
|
||||
nameA = malloc(size/sizeof(WCHAR));
|
||||
nameA = HeapAlloc(GetProcessHeap(), 0, size/sizeof(WCHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, nameW, size/sizeof(WCHAR), nameA,
|
||||
size/sizeof(WCHAR), NULL, NULL);
|
||||
}
|
||||
free(nameW);
|
||||
HeapFree(GetProcessHeap(), 0, nameW);
|
||||
}
|
||||
else if (rc==MMSYSERR_NOTSUPPORTED) {
|
||||
nameA=strdup("not supported");
|
||||
|
@ -893,7 +893,7 @@ static void wave_out_test_device(int device)
|
|||
trace(" channels=%d formats=%05x support=%04x\n",
|
||||
capsA.wChannels,capsA.dwFormats,capsA.dwSupport);
|
||||
trace(" %s\n",wave_out_caps(capsA.dwSupport));
|
||||
free(nameA);
|
||||
HeapFree(GetProcessHeap(), 0, nameA);
|
||||
|
||||
if (winetest_interactive && (device != WAVE_MAPPER))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue