From: Martin Ling Date: Tue, 30 Sep 2014 12:19:27 +0000 (+0100) Subject: C++: Add spaces in Device::description(). X-Git-Tag: libsigrok-0.4.0~912 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=584f76a78a9d687dcf396f0c620fe3093b38e70a;p=libsigrok.git C++: Add spaces in Device::description(). --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 8735302c..66b79a93 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -442,16 +442,20 @@ string Device::description() ostringstream s; vector 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(); }