Fix "ignoring return value" in ViE tests.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@538 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org
2011-09-06 16:46:25 +00:00
parent e4c4d4f0e9
commit f6478958a4
2 changed files with 13 additions and 4 deletions

View File

@ -153,7 +153,11 @@ int VideoEngineSampleCode(void* window1, void* window2)
captureIdx = 0; captureIdx = 0;
printf("0\n"); printf("0\n");
#else #else
scanf("%d", &captureIdx); if (scanf("%d", &captureIdx) != 1)
{
printf("Error in scanf()\n");
return -1;
}
getchar(); getchar();
captureIdx = captureIdx - 1; // Compensate for idx start at 1. captureIdx = captureIdx - 1; // Compensate for idx start at 1.
#endif #endif
@ -311,7 +315,11 @@ int VideoEngineSampleCode(void* window1, void* window2)
codecIdx = 0; codecIdx = 0;
printf("0\n"); printf("0\n");
#else #else
scanf("%d", &codecIdx); if (scanf("%d", &codecIdx) != 1)
{
printf("Error in scanf()\n");
return -1;
}
getchar(); getchar();
codecIdx = codecIdx - 1; // Compensate for idx start at 1. codecIdx = codecIdx - 1; // Compensate for idx start at 1.
#endif #endif

View File

@ -331,17 +331,18 @@ int ViEAutoTestMain::GetClassTestSelection()
ViETest::Log("\t 11. Go back to previous menu"); ViETest::Log("\t 11. Go back to previous menu");
ViETest::Log("Select type of test: "); ViETest::Log("Select type of test: ");
int items_read = 0;
if (_useAnswerFile) if (_useAnswerFile)
{ {
//GetNextAnswer(answer); //GetNextAnswer(answer);
} }
else else
{ {
scanf("%d", &testType); items_read = scanf("%d", &testType);
getchar(); getchar();
} }
ViETest::Log("\n"); ViETest::Log("\n");
if (testType >= 1 && testType <= 13) if (items_read == 1 && testType >= 1 && testType <= 13)
{ {
return testType; return testType;
} }