[chronojump] Fixes warning - a variable was assigned and never used.



commit 2420cc5f7102d37aac4a32231bc707c51c3c2eb9
Author: Carles Pina i Estany <carles pina cat>
Date:   Mon Oct 17 11:04:35 2016 +0200

    Fixes warning - a variable was assigned and never used.

 src/chronopicDetect.cs |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/chronopicDetect.cs b/src/chronopicDetect.cs
index 8d7c5d5..47237b2 100644
--- a/src/chronopicDetect.cs
+++ b/src/chronopicDetect.cs
@@ -260,7 +260,10 @@ public class ChronopicAutoDetect
                        SerialPort sp = new SerialPort(port);
                        
                        LogB.Information("searching normal Chronopic at port: ", port);
-                       string readed = caNormal.Read(sp);
+
+                       // caNormal.Read() returns a string (not used) but also changes caNormal.Found.
+                       // So we call it even if we don't use the result directly.
+                       caNormal.Read(sp);
 
                        if(caNormal.Found == ChronopicType.NORMAL) //We found a normal Chronopic
                        {
@@ -287,7 +290,10 @@ public class ChronopicAutoDetect
                                caEncoder.IsEncoder = true;    //for the bauds.
                        
                                LogB.Information("searching encoder Chronopic at port: ", port);
-                               readed = caEncoder.Read(sp);
+
+                               // caNormal.Read() returns a string (not used) but also changes 
caNormal.Found.
+                               // So we call it even if we don't use the result directly.
+                               caEncoder.Read(sp);
                                if(caEncoder.Found == ChronopicType.ENCODER) 
                                {
                                        Detected = port;


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