From: Eric S. Raymond Date: Tue, 27 Nov 2012 06:19:20 +0000 (-0500) Subject: Partial cppcheck cleanup. Some sscanf warnings remain. X-Git-Tag: 2.5~3 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=7a3313a50a2077740d3c71bd6acfc9b39cfb2691;p=morse-classic.git Partial cppcheck cleanup. Some sscanf warnings remain. --- diff --git a/morse.d/beepALSA.c b/morse.d/beepALSA.c index e9cb9d3..b7bbb03 100644 --- a/morse.d/beepALSA.c +++ b/morse.d/beepALSA.c @@ -60,10 +60,7 @@ int BeepInit (void) int Beep (int time, int volume, int pitch) { - static int last_pitch = -1, last_n = -1, last_volume = -1; - int i, n, first_len, down_len, cycle; - double dt; - + int n; /* * Finagle the number of samples */ @@ -81,6 +78,8 @@ int Beep (int time, int volume, int pitch) if (volume <= 0) { snd_pcm_writei(handle, silence, channels*n); } else { + static int last_pitch = -1, last_n = -1, last_volume = -1; + int first_len, down_len, cycle; /* * clip to Nyquist * (Of course this means that if you ask for too high a frequency you @@ -119,6 +118,8 @@ int Beep (int time, int volume, int pitch) last_pitch = pitch; last_n = n; last_volume = volume; + double dt; + int i; dt = 2. * M_PI / cycle; /* sine scale factor */ diff --git a/morse.d/beepOSS.c b/morse.d/beepOSS.c index 6573539..aeea766 100644 --- a/morse.d/beepOSS.c +++ b/morse.d/beepOSS.c @@ -91,10 +91,7 @@ int BeepInit (void) int Beep (int time, int volume, int pitch) { - static int last_pitch = -1, last_n = -1, last_volume = -1; - int i, n, first_len, down_len, cycle; - double dt; - + int n; /* * Finagle the number of samples */ @@ -114,6 +111,8 @@ int Beep (int time, int volume, int pitch) } else { + static int last_pitch = -1, last_n = -1, last_volume = -1; + int first_len, down_len, cycle; /* * clip to Nyquist * (Of course this means that if you ask for too high a frequency you @@ -148,7 +147,9 @@ int Beep (int time, int volume, int pitch) last_pitch = pitch; last_n = n; last_volume = volume; - + int i; + double dt; + dt = 2. * M_PI / cycle; /* sine scale factor */ /* Ramp up; begin with silence */ Reading git-diff-tree failed