diff mbox

[FFmpeg-devel] Fix audiomatch complie warning

Message ID CADxeRwn9WBwjoN=kaAG_8DL9QiTey68qvhQ133JnqZ_=CXwaEA@mail.gmail.com
State Superseded
Headers show

Commit Message

Steven Liu Aug. 24, 2016, 2:20 p.m. UTC
Making sure bestpos is initialized to zero to prevent gcc from kvetching.
It's harmless (although it's not obvious that it's harmless)
from code inspection:
tests/audiomatch.c: In function ‘main’:
tests/audiomatch.c:40: warning: ‘bestpos’ may be used uninitialized in this
function

Thanks to Moritz Barsnick for first bringing this to the attention.

Signed-off-by: LiuQi <liuqi@gosun.com>
---
 tests/audiomatch.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

--
1.7.1

Comments

Michael Niedermayer Aug. 25, 2016, 12:08 a.m. UTC | #1
On Wed, Aug 24, 2016 at 10:20:11PM +0800, Steven Liu wrote:
> Making sure bestpos is initialized to zero to prevent gcc from kvetching.
> It's harmless (although it's not obvious that it's harmless)
> from code inspection:
> tests/audiomatch.c: In function ‘main’:
> tests/audiomatch.c:40: warning: ‘bestpos’ may be used uninitialized in this
> function
> 
> Thanks to Moritz Barsnick for first bringing this to the attention.
> 
> Signed-off-by: LiuQi <liuqi@gosun.com>
> ---
>  tests/audiomatch.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/audiomatch.c b/tests/audiomatch.c
> index 9752f68..9fb511f 100644
> --- a/tests/audiomatch.c
> +++ b/tests/audiomatch.c
> @@ -37,11 +37,11 @@ int main(int argc, char **argv){
>      FILE *f[2];
>      int i, pos;
>      int siglen, datlen;
> -    int bestpos;
> +    int bestpos = 0;

> -    double bestc=0;
> -    double sigamp= 0;
> +    double bestc = 0;
> +    double sigamp = 0;
>      int16_t *signal, *data;
> -    int maxshift= 16384;
> +    int maxshift = 16384;

unrelated changes
(these belong in a seperate patch)

thx

[...]
diff mbox

Patch

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index 9752f68..9fb511f 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -37,11 +37,11 @@  int main(int argc, char **argv){
     FILE *f[2];
     int i, pos;
     int siglen, datlen;
-    int bestpos;
-    double bestc=0;
-    double sigamp= 0;
+    int bestpos = 0;
+    double bestc = 0;
+    double sigamp = 0;
     int16_t *signal, *data;
-    int maxshift= 16384;
+    int maxshift = 16384;

     if (argc < 3) {
         printf("audiomatch <testfile> <reffile>\n");