Get rid of the ADM test warnings.

Review URL: http://webrtc-codereview.appspot.com/116001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@375 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
xians@google.com 2011-08-16 09:30:51 +00:00
parent e66a0c0ce7
commit 0134facd53
4 changed files with 121 additions and 126 deletions

View File

@ -484,8 +484,6 @@ int api_test()
nDevices = audioDevice->RecordingDevices();
WebRtc_UWord16 nRecordingDevices(audioDevice->RecordingDevices());
// fail tests
TEST(audioDevice->SetRecordingDevice(-1) == -1);
TEST(audioDevice->SetRecordingDevice(nDevices) == -1);
@ -811,7 +809,7 @@ int api_test()
}
}
int vol(0);
WebRtc_UWord32 vol(0);
#if defined(_WIN32) && !defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
@ -1332,7 +1330,7 @@ int api_test()
TEST(audioDevice->MaxMicrophoneVolume(&maxVolume) == 0);
TEST(audioDevice->MinMicrophoneVolume(&minVolume) == 0);
TEST(audioDevice->MicrophoneVolumeStepSize(&stepSize) == 0);
for (vol = minVolume; vol < (int) maxVolume; vol += 10 * stepSize)
for (vol = minVolume; vol < maxVolume; vol += 10 * stepSize)
{
TEST(audioDevice->SetMicrophoneVolume(vol) == 0);
TEST(audioDevice->MicrophoneVolume(&volume) == 0);
@ -1352,7 +1350,7 @@ int api_test()
TEST(audioDevice->MaxMicrophoneVolume(&maxVolume) == 0);
TEST(audioDevice->MinMicrophoneVolume(&minVolume) == 0);
TEST(audioDevice->MicrophoneVolumeStepSize(&stepSize) == 0);
for (vol = minVolume; vol < (int) maxVolume; vol += 20 * stepSize)
for (vol = minVolume; vol < maxVolume; vol += 20 * stepSize)
{
TEST(audioDevice->SetMicrophoneVolume(vol) == 0);
TEST(audioDevice->MicrophoneVolume(&volume) == 0);
@ -2192,7 +2190,9 @@ int api_test()
#endif
TEST(audioDevice->StopPlayout() == 0);
#ifdef _WIN32
Exit:
#endif
// ------------------------------------------------------------------------
// Terminate the module when all tests are done:

View File

@ -102,7 +102,6 @@ static int warningCount = 0;
} \
} while(0)
// Helper functions
// For iPhone, they are defined in iPhone specific test code.
// For Android, they are defined in API test only (since both

View File

@ -12,8 +12,10 @@
#include "audio_device_test_defines.h"
#include "func_test_manager.h"
#ifndef __GNUC__
// Disable warning message 4996 ('scanf': This function or variable may be unsafe)
#pragma warning( disable : 4996 )
#endif
using namespace webrtc;
@ -40,6 +42,11 @@ int func_test(int sel)
TEST_LOG("Func Test of the WebRtcAudioDevice Module\n");
TEST_LOG("=========================================\n\n");
// Initialize the counters here to get rid of "unused variables" warnings.
testCount = 0;
errorCount = 0;
warningCount = 0;
FuncTestManager funcMgr;
funcMgr.Init();
@ -142,7 +149,7 @@ SHOW_MENU:
break;
}
WebRtc_Word32 ret = funcMgr.DoTest(testType);
funcMgr.DoTest(testType);
if (sel > 0)
{

View File

@ -17,10 +17,12 @@
#include "../source/audio_device_config.h"
#ifndef __GNUC__
// Disable warning message ('sprintf': name was marked as #pragma deprecated)
#pragma warning( disable : 4995 )
// Disable warning message 4996 ('scanf': This function or variable may be unsafe)
#pragma warning( disable : 4996 )
#endif
const WebRtc_Word8 PlayoutFile48[] = "audio_short48.pcm";
const WebRtc_Word8 PlayoutFile44[] = "audio_short44.pcm";
@ -192,9 +194,6 @@ WebRtc_Word32 AudioTransportImpl::RecordedDataIsAvailable(
const WebRtc_UWord32 currentMicLevel,
WebRtc_UWord32& newMicLevel)
{
WebRtc_UWord32 samples(nSamples);
WebRtc_UWord32 fs(samplesPerSec);
if (_fullDuplex && _audioList.GetSize() < 15)
{
AudioPacket* packet = new AudioPacket();
@ -356,8 +355,6 @@ WebRtc_Word32 AudioTransportImpl::NeedMorePlayData(
WebRtc_Word16* ptr16Out = NULL;
const WebRtc_UWord16 nSamplesIn = packet->nSamples;
const WebRtc_UWord16 nBytesIn = nSamplesIn
* packet->nBytesPerSample;
const WebRtc_UWord8 nChannelsIn = packet->nChannels;
const WebRtc_UWord32 samplesPerSecIn = packet->samplesPerSec;
const WebRtc_UWord16 nBytesPerSampleIn =
@ -619,7 +616,6 @@ WebRtc_Word32 FuncTestManager::Init()
WebRtc_Word8 version[256];
WebRtc_UWord32 remainingBufferInBytes = 256;
WebRtc_UWord32 tooFewBytes = 10;
WebRtc_UWord32 position = 0;
// log version
@ -771,7 +767,6 @@ WebRtc_Word32 FuncTestManager::TestAudioLayerSelection()
}
char ch;
int dummy(0);
bool tryWinWave(false);
bool tryWinCore(false);
@ -779,7 +774,7 @@ WebRtc_Word32 FuncTestManager::TestAudioLayerSelection()
{
TEST_LOG("Would you like to try kWindowsCoreAudio instead "
"[requires Win Vista or Win 7] (Y/N)?\n: ");
dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -788,7 +783,7 @@ WebRtc_Word32 FuncTestManager::TestAudioLayerSelection()
} else if (audioLayer == AudioDeviceModule::kWindowsCoreAudio)
{
TEST_LOG("Would you like to try kWindowsWaveAudio instead (Y/N)?\n: ");
int dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -1009,7 +1004,7 @@ WebRtc_Word32 FuncTestManager::TestDeviceSelection()
{ \
char str[128]; \
(b == true) ? (sprintf(str, " %-17s: available\n", #a)) : (sprintf(str, " %-17s: NA\n", #a)); \
TEST_LOG(str); \
TEST_LOG("%s", str); \
} \
AudioDeviceModule* audioDevice = _audioDevice;
@ -1690,7 +1685,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneVolume()
RecordedMicrophoneVolumeFile);
char ch;
bool fileRecording(false);
int dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -1829,7 +1824,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneMute()
RecordedMicrophoneMuteFile);
char ch;
bool fileRecording(false);
int dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -1965,7 +1960,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneBoost()
RecordedMicrophoneBoostFile);
char ch;
bool fileRecording(false);
int dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -2102,7 +2097,7 @@ WebRtc_Word32 FuncTestManager::TestMicrophoneAGC()
RecordedMicrophoneAGCFile);
char ch;
bool fileRecording(false);
int dummy = scanf(" %c", &ch);
scanf(" %c", &ch);
ch = toupper(ch);
if (ch == 'Y')
{
@ -2367,13 +2362,11 @@ WebRtc_Word32 FuncTestManager::TestDeviceRemoval()
bool available(false);
bool enabled(false);
WebRtc_UWord32 samplesPerSec(0);
if (recIsAvailable && playIsAvailable)
{
WebRtc_UWord32 playSamplesPerSec(0);
WebRtc_UWord32 recSamplesPerSecRec(0);
WebRtc_UWord32 maxVolume(0);
TEST(audioDevice->RegisterAudioCallback(_audioTransport) == 0);
@ -2535,10 +2528,9 @@ WebRtc_Word32 FuncTestManager::SelectRecordingDevice()
}
TEST_LOG("\n: ");
int dummy(0);
int sel(0);
dummy = scanf("%u", &sel);
scanf("%u", &sel);
if (sel == 0)
{
@ -2566,10 +2558,9 @@ WebRtc_Word32 FuncTestManager::SelectRecordingDevice()
}
TEST_LOG("\n: ");
int dummy(0);
int sel(0);
dummy = scanf("%u", &sel);
scanf("%u", &sel);
if (sel < (nDevices))
{
@ -2601,10 +2592,9 @@ WebRtc_Word32 FuncTestManager::SelectPlayoutDevice()
}
TEST_LOG("\n: ");
int dummy(0);
int sel(0);
dummy = scanf("%u", &sel);
scanf("%u", &sel);
WebRtc_Word32 ret(0);
@ -2635,10 +2625,9 @@ WebRtc_Word32 FuncTestManager::SelectPlayoutDevice()
}
TEST_LOG("\n: ");
int dummy(0);
int sel(0);
dummy = scanf("%u", &sel);
scanf("%u", &sel);
WebRtc_Word32 ret(0);