AudioDeviceUtility::WaitForKey() pulls two characters if the first one is a newline, but discards the final value.
The current code assigns that second value to a local variable, which generates a set-but-unused warning on gcc 4.6.0. Instead, cast the result away. I also refactor the code a bit by adding the right indentation and removing empty lines. Bug=http://code.google.com/p/webrtc/issues/detail?id=53 Test=none Review URL: http://webrtc-codereview.appspot.com/135005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@486 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
3fcabbe45c
commit
e74a9ea303
@ -69,42 +69,28 @@ namespace webrtc
|
||||
void AudioDeviceUtility::WaitForKey()
|
||||
{
|
||||
|
||||
struct termios oldt, newt;
|
||||
struct termios oldt, newt;
|
||||
|
||||
int ch;
|
||||
tcgetattr( STDIN_FILENO, &oldt );
|
||||
|
||||
// we don't want getchar to echo!
|
||||
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~( ICANON | ECHO );
|
||||
tcsetattr( STDIN_FILENO, TCSANOW, &newt );
|
||||
|
||||
tcgetattr( STDIN_FILENO, &oldt );
|
||||
// catch any newline that's hanging around...
|
||||
|
||||
// you'll have to hit enter twice if you
|
||||
|
||||
// choose enter out of all available keys
|
||||
|
||||
// we don't want getchar to echo!
|
||||
if (getchar() == '\n')
|
||||
{
|
||||
getchar();
|
||||
}
|
||||
|
||||
newt = oldt;
|
||||
|
||||
newt.c_lflag &= ~( ICANON | ECHO );
|
||||
|
||||
tcsetattr( STDIN_FILENO, TCSANOW, &newt );
|
||||
|
||||
|
||||
|
||||
// catch any newline that's hanging around...
|
||||
|
||||
// you'll have to hit enter twice if you
|
||||
|
||||
// choose enter out of all available keys
|
||||
|
||||
if (getchar() == '\n')
|
||||
|
||||
{
|
||||
|
||||
ch = getchar();
|
||||
|
||||
}
|
||||
|
||||
|
||||
tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
|
||||
tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
|
||||
}
|
||||
|
||||
WebRtc_UWord32 AudioDeviceUtility::GetTimeInMS()
|
||||
|
Loading…
Reference in New Issue
Block a user