]> sigrok.org Git - libsigrok.git/commitdiff
C++: Add spaces in Device::description().
authorMartin Ling <redacted>
Tue, 30 Sep 2014 12:19:27 +0000 (13:19 +0100)
committerMartin Ling <redacted>
Tue, 30 Sep 2014 12:19:27 +0000 (13:19 +0100)
bindings/cxx/classes.cpp

index 8735302c570fe6bdb10c375a9b4ce0662909496b..66b79a93a1f31b6f29f421eebc2a99c27b0dfe43 100644 (file)
@@ -442,16 +442,20 @@ string Device::description()
        ostringstream s;
 
        vector<string> parts =
-               {vendor(), model(), version()};
+               {vendor(), model(), version(), serial_number()};
 
-       for (string part : parts)
-               if (part.length() > 0)
-                       s << part;
+       for (size_t i = 0; i < parts.size(); i++)
+       {
+               if (parts[i].length() > 0)
+               {
+                       if (i != 0)
+                               s << " ";
+                       s << parts[i];
+               }
+       }
 
-       if (serial_number().length() > 0)
-               s << serial_number();
-       else
-               s << connection_id();
+       if (serial_number().length() == 0 && connection_id().length() > 0)
+               s << " " << connection_id();
 
        return s.str();
 }