[chronojump] Fix compiler warnings in tests



commit 451ee19ef972712e4bfbd23594ad533247482984
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jun 19 02:24:24 2014 +0200

    Fix compiler warnings in tests

 chronopic-tests/chronopic.c      |    4 ++--
 chronopic-tests/test-precision.c |    8 +++-----
 chronopic-tests/test-saltos.c    |    4 +---
 chronopic-tests/test-tramas.c    |    2 +-
 4 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/chronopic-tests/chronopic.c b/chronopic-tests/chronopic.c
index e08a4da..ebf38d3 100644
--- a/chronopic-tests/chronopic.c
+++ b/chronopic-tests/chronopic.c
@@ -187,7 +187,7 @@ int chronopic_estado(int serial_fd, int *estado)
   struct timeval timeout;
   int status;
   int ret;
-  int n;
+
   
   // Construir la trama del servicio de estado
   trama[0]='E';
@@ -206,7 +206,7 @@ int chronopic_estado(int serial_fd, int *estado)
   
   switch(ret) {
     case 1 : //--Datos listos 
-      n=read (serial_fd, respuesta, 10);
+      read (serial_fd, respuesta, 10);
       if (respuesta[0]=='E') {
         status=1;
         *estado=(int)respuesta[1];
diff --git a/chronopic-tests/test-precision.c b/chronopic-tests/test-precision.c
index ea6859c..9cc6ac9 100644
--- a/chronopic-tests/test-precision.c
+++ b/chronopic-tests/test-precision.c
@@ -108,7 +108,6 @@ void presenta()
 /*----------------*/
 int main (int argc, char **argv)
 {
-  char cad[80];
   int i;
   int serial_fd;
   int ok;
@@ -155,12 +154,11 @@ int main (int argc, char **argv)
           estado_automata=1;
           toff=t;
            //-- Sacar informacion sobre el evento ocurrido
-           sprintf (cad,"Periodo: %7.2f ms, Freq: %2.3f Hz. ",ton+toff,
+           printf ("Periodo: %7.2f ms, Freq: %2.3f Hz. ",ton+toff,
                     1000/(ton+toff));
            //sprintf (cad,"%X %X %X",trama[2],trama[3],trama[4]);
-           printf (cad);
-           for (i=0; i<strlen(cad); i++)
-             printf ("\b");
+           //for (i=0; i<strlen(cad); i++)
+           //  printf ("\b");
            fflush(stdout);
         }
       case 1:  //-- Estado ON
diff --git a/chronopic-tests/test-saltos.c b/chronopic-tests/test-saltos.c
index fde33b5..3078ddc 100644
--- a/chronopic-tests/test-saltos.c
+++ b/chronopic-tests/test-saltos.c
@@ -99,7 +99,6 @@ void presenta()
 /*----------------*/
 int main (int argc, char **argv)
 {
-  char cad[80];
   int serial_fd;
   int ok;
   double t;
@@ -187,8 +186,7 @@ int main (int argc, char **argv)
           toff=t;
           
           //-- Imprimir informacion
-          sprintf (cad,"Tiempo: %8.1f ms\n",toff);
-          printf (cad);
+          printf ("Tiempo: %8.1f ms\n",toff);
         }
       case 1:  //-- Estado ON. Usuario estaba de la plataforma
         
diff --git a/chronopic-tests/test-tramas.c b/chronopic-tests/test-tramas.c
index 1409e85..e186e18 100644
--- a/chronopic-tests/test-tramas.c
+++ b/chronopic-tests/test-tramas.c
@@ -117,7 +117,7 @@ void presenta()
 /*----------------*/
 int main (int argc, char **argv)
 {
-  unsigned char cad_estado[3];
+  char cad_estado[4];
   char cad_tiempo[80];
   double t;
   int estado;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]