[X2Go-Commits] [x2goclient] 174/280: src/pulsemanager.cpp: don't overwrite the temporary string variable for the current line with what was supposed to hold new data in fetch_pulseaudio_version ().

git-admin at x2go.org git-admin at x2go.org
Wed Jan 18 12:25:41 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit f206423941d6963509e3f1e02940196edf48de3b
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jun 2 00:46:20 2016 +0200

    src/pulsemanager.cpp: don't overwrite the temporary string variable for the current line with what was supposed to hold new data in fetch_pulseaudio_version ().
---
 debian/changelog     |    3 +++
 src/pulsemanager.cpp |   31 ++++++++++++++++++-------------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 745b217..3b6aac6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -318,6 +318,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - src/pulsemanager.cpp: fix typo in fetch_pulseaudio_version (). Read
       standard output from temporary process, not our "main" server process
       (which at this point is not even started yet.)
+    - src/pulsemanager.cpp: don't overwrite the temporary string variable for
+      the current line with what was supposed to hold new data in
+      fetch_pulseaudio_version ().
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp
index d19494d..032c018 100644
--- a/src/pulsemanager.cpp
+++ b/src/pulsemanager.cpp
@@ -259,24 +259,24 @@ void PulseManager::fetch_pulseaudio_version () {
 
         /* We should be at a digit now. */
         bool numbers_found[3] = { false, false, false };
-        QString tmp_str = QString ("");
+        QString tmp_ret_str = QString ("");
         for (QString::const_iterator cit = tmp_str.begin (); cit != tmp_str.end (); ++cit) {
           if (!(numbers_found[0])) {
             if (((*cit) >= '0') && ((*cit) <= '9')) {
-              tmp_str.append (*cit);
+              tmp_ret_str.append (*cit);
             }
             else if ((*cit) == '.') {
               /* First number part complete, let's convert the string and skip the period. */
               numbers_found[0] = true;
               bool convert_success = false;
-              pulse_version_major_ = tmp_str.toUInt (&convert_success, 10);
+              pulse_version_major_ = tmp_ret_str.toUInt (&convert_success, 10);
 
               if (!convert_success) {
                 x2goErrorf (20) << "Unable to convert major version number string to integer.";
                 abort ();
               }
 
-              tmp_str = QString ("");
+              tmp_ret_str = QString ("");
             }
             else {
               x2goErrorf (21) << "Unexpected character found when parsing version string for major version number: '" << QString (*cit) << "'.";
@@ -285,7 +285,7 @@ void PulseManager::fetch_pulseaudio_version () {
           }
           else if (!(numbers_found[1])) {
             if (((*cit) >= '0') && ((*cit) <= '9')) {
-              tmp_str.append (*cit);
+              tmp_ret_str.append (*cit);
             }
             else if (((*cit) == '.') || ((*cit) == '-')) {
               /*
@@ -294,14 +294,14 @@ void PulseManager::fetch_pulseaudio_version () {
                */
               numbers_found[1] = true;
               bool convert_success = false;
-              pulse_version_minor_ = tmp_str.toUInt (&convert_success, 10);
+              pulse_version_minor_ = tmp_ret_str.toUInt (&convert_success, 10);
 
               if (!convert_success) {
                 x2goErrorf (22) << "Unable to convert minor version number string to integer.";
                 abort ();
               }
 
-              tmp_str = QString ("");
+              tmp_ret_str = QString ("");
 
               if ((*cit) == '-') {
                 /*
@@ -318,20 +318,20 @@ void PulseManager::fetch_pulseaudio_version () {
           }
           else if (!(numbers_found[2])) {
             if (((*cit) >= '0') && ((*cit) <= '9')) {
-              tmp_str.append (*cit);
+              tmp_ret_str.append (*cit);
             }
             else if ((*cit) == '-') {
               /* Third number part complete, let's convert the string and skip the period. */
               numbers_found[2] = true;
               bool convert_success = false;
-              pulse_version_micro_ = tmp_str.toUInt (&convert_success, 10);
+              pulse_version_micro_ = tmp_ret_str.toUInt (&convert_success, 10);
 
               if (!convert_success) {
                 x2goErrorf (24) << "Unable to convert micro version number string to integer.";
                 abort ();
               }
 
-              tmp_str = QString ("");
+              tmp_ret_str = QString ("");
             }
             else {
               x2goErrorf (25) << "Unexpected character found when parsing version string for micro version number: '" << QString (*cit) << "'.";
@@ -340,12 +340,17 @@ void PulseManager::fetch_pulseaudio_version () {
           }
           else {
             /* Numbers should be good by now, let's fetch everything else. */
-            tmp_str.append (*cit);
+            tmp_ret_str.append (*cit);
           }
         }
 
-        /* Misc version part will be set to the trailing string. */
-        pulse_version_misc_ = tmp_str;
+        found = ((numbers_found[0]) && (numbers_found[1]) && (numbers_found[2]));
+
+        if (found) {
+          /* Misc version part will be set to the trailing string. */
+          pulse_version_misc_ = tmp_ret_str;
+          break;
+        }
       }
       else {
         /* No need to look any further. */

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list