File 0001-Correctly-initialise-and-compare-pa_cvolume-structs.patch of Package plasma5-pa

From 618d97a68904cbd4351bf86659e31b60d0e2256f Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Mon, 19 Dec 2016 17:27:26 +0000
Subject: [PATCH 1/4] Correctly initialise and compare pa_cvolume structs

Summary:
Previously m_volume was uninitialised, resulting in a comparison on
garbage data when first run.
By using the proper pulse audio methods we can make sure to initialise
the variable and use a faster compare than memcmp.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3739
---
 src/volumeobject.cpp | 1 +
 src/volumeobject.h   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/volumeobject.cpp b/src/volumeobject.cpp
index e86ce1e..ea580af 100644
--- a/src/volumeobject.cpp
+++ b/src/volumeobject.cpp
@@ -29,6 +29,7 @@ VolumeObject::VolumeObject(QObject *parent)
     , m_hasVolume(true)
     , m_volumeWritable(true)
 {
+    pa_cvolume_init(&m_volume);
 }
 
 VolumeObject::~VolumeObject()
diff --git a/src/volumeobject.h b/src/volumeobject.h
index b1185b1..5824391 100644
--- a/src/volumeobject.h
+++ b/src/volumeobject.h
@@ -49,7 +49,7 @@ public:
             m_muted = info->mute;
             emit mutedChanged();
         }
-        if (memcmp(&m_volume, &info->volume, sizeof(pa_cvolume)) != 0) {
+        if (pa_cvolume_equal(&m_volume, &info->volume) != 0) {
             m_volume = info->volume;
             emit volumeChanged();
             emit channelVolumesChanged();
-- 
2.12.0

openSUSE Build Service is sponsored by