From 9bba31c6ce54290011a96723f720d872ecdbabca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 18 May 2014 11:29:04 +0200
Subject: Fix uninitialized variables

Change-Id: I95b6b67dcafe338561d3dfb28664bc3bba6d1159

diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index d730236..5732382 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -4,6 +4,13 @@
  * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
+/*
+ * Copyright (c) 2014 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+
 #include <Swift/Controllers/HistoryController.h>
 #include <Swiften/History/HistoryStorage.h>
 #include <Swiften/History/HistoryMessage.h>
@@ -11,7 +18,7 @@
 
 namespace Swift {
 
-HistoryController::HistoryController(HistoryStorage* localHistoryStorage) : localHistory_(localHistoryStorage) {
+HistoryController::HistoryController(HistoryStorage* localHistoryStorage) : localHistory_(localHistoryStorage), remoteArchiveSupported_(false) {
 }
 
 HistoryController::~HistoryController() {
diff --git a/Swift/Controllers/Roster/ItemOperations/SetMUC.h b/Swift/Controllers/Roster/ItemOperations/SetMUC.h
index de40e04..598e5f5 100644
--- a/Swift/Controllers/Roster/ItemOperations/SetMUC.h
+++ b/Swift/Controllers/Roster/ItemOperations/SetMUC.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Kevin Smith and Remko Tronçon
+ * Copyright (c) 2013-2014 Kevin Smith and Remko Tronçon
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
@@ -31,7 +31,6 @@ class SetMUC : public RosterItemOperation {
 
 	private:
 		JID jid_;
-		bool mucParticipant_;
 		MUCOccupant::Role mucRole_;
 		MUCOccupant::Affiliation mucAffiliation_;
 };
diff --git a/Swift/Controllers/Storages/FileStorages.cpp b/Swift/Controllers/Storages/FileStorages.cpp
index 52a5e00..e1b681f 100644
--- a/Swift/Controllers/Storages/FileStorages.cpp
+++ b/Swift/Controllers/Storages/FileStorages.cpp
@@ -22,6 +22,8 @@ FileStorages::FileStorages(const boost::filesystem::path& baseDir, const JID& ji
 	rosterStorage = new RosterFileStorage(baseDir / profile / "roster.xml");
 #ifdef SWIFT_EXPERIMENTAL_HISTORY
 	historyStorage = new SQLiteHistoryStorage(baseDir / "history.db");
+#else
+	historyStorage = NULL;
 #endif
 }
 
@@ -30,9 +32,7 @@ FileStorages::~FileStorages() {
 	delete avatarStorage;
 	delete capsStorage;
 	delete vcardStorage;
-#ifdef SWIFT_EXPERIMENTAL_HISTORY
 	delete historyStorage;
-#endif
 }
 
 VCardStorage* FileStorages::getVCardStorage() const {
diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp
index 50aba6f..d8d89eb 100644
--- a/Swift/Controllers/WhiteboardManager.cpp
+++ b/Swift/Controllers/WhiteboardManager.cpp
@@ -125,7 +125,9 @@ namespace Swift {
 
 	void WhiteboardManager::handleSessionAccept(const JID& contact) {
 		WhiteboardWindow* window = findWhiteboardWindow(contact);
-		window->show();
+		if (window != NULL) {
+			window->show();
+		}
 		onRequestAccepted(contact);
 	}
 
diff --git a/Swift/QtUI/QtAvatarWidget.cpp b/Swift/QtUI/QtAvatarWidget.cpp
index 015c2da..fa08c27 100644
--- a/Swift/QtUI/QtAvatarWidget.cpp
+++ b/Swift/QtUI/QtAvatarWidget.cpp
@@ -1,9 +1,11 @@
 /*
- * Copyright (c) 2011-2013 Remko Tronçon
+ * Copyright (c) 2011-2014 Remko Tronçon
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
 
+
+
 #include "QtAvatarWidget.h"
 
 #include <QLabel>
@@ -23,7 +25,7 @@
 
 namespace Swift {
 
-QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent) {
+QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent), editable(false) {
 	QVBoxLayout* layout = new QVBoxLayout(this);
 	layout->setContentsMargins(0,0,0,0);
 
diff --git a/Swift/QtUI/QtPlainChatView.h b/Swift/QtUI/QtPlainChatView.h
index 01b5925..cf65fb3 100644
--- a/Swift/QtUI/QtPlainChatView.h
+++ b/Swift/QtUI/QtPlainChatView.h
@@ -124,7 +124,6 @@ namespace Swift {
 			QtChatWindow* window_;
 			UIEventStream* eventStream_;
 			LogTextEdit* log_;
-			QMenu* logMenu_;
 			FileTransferMap fileTransfers_;
 			std::map<std::string, boost::shared_ptr<SecurityLabel> > lastMessageLabel_;
 			int idGenerator_;
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
index 44459d5..b9e7798 100644
--- a/Swift/QtUI/QtRosterHeader.cpp
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2014 Kevin Smith
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
@@ -23,7 +23,7 @@
 #include "QtScaledAvatarCache.h"
 
 namespace Swift {
-QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent) {
+QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent), statusEdit_(false) {
 	QHBoxLayout* topLayout = new QHBoxLayout();
 	topLayout->setSpacing(3);
 	topLayout->setContentsMargins(4,4,4,4);
diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp
index 456a56f..83018b8 100644
--- a/Swift/QtUI/QtSystemTray.cpp
+++ b/Swift/QtUI/QtSystemTray.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2014 Kevin Smith
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
@@ -19,7 +19,7 @@
 #include <QAction>
 
 namespace Swift {
-QtSystemTray::QtSystemTray() : QObject(), trayMenu_(0), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) {
+QtSystemTray::QtSystemTray() : QObject(), statusType_(StatusShow::None), trayMenu_(0), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) {
 	trayIcon_ = new QSystemTrayIcon(offlineIcon_);
 	trayIcon_->setToolTip("Swift");
 	connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason)));
diff --git a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.cpp b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.cpp
index 4f1d3ab..877a598 100644
--- a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.cpp
@@ -4,12 +4,19 @@
  * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
+/*
+ * Copyright (c) 2014 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+
 #include "QtResizableLineEdit.h"
 
 namespace Swift {
 
 QtResizableLineEdit::QtResizableLineEdit(QWidget* parent) :
-	QLineEdit(parent) {
+	QLineEdit(parent), editable(false) {
 	connect(this, SIGNAL(textChanged(QString)), SLOT(textChanged(QString)));
 	setMinimumWidth(30);
 }
diff --git a/Swiften/Client/MemoryStorages.cpp b/Swiften/Client/MemoryStorages.cpp
index 885d74f..850c1b2 100644
--- a/Swiften/Client/MemoryStorages.cpp
+++ b/Swiften/Client/MemoryStorages.cpp
@@ -20,6 +20,8 @@ MemoryStorages::MemoryStorages(CryptoProvider* crypto) {
 	rosterStorage = new RosterMemoryStorage();
 #ifdef SWIFT_EXPERIMENTAL_HISTORY
 	historyStorage = new SQLiteHistoryStorage(":memory:");
+#else
+	historyStorage = NULL;
 #endif
 }
 
@@ -28,9 +30,7 @@ MemoryStorages::~MemoryStorages() {
 	delete avatarStorage;
 	delete capsStorage;
 	delete vcardStorage;
-#ifdef SWIFT_EXPERIMENTAL_HISTORY
 	delete historyStorage;
-#endif
 }
 
 VCardStorage* MemoryStorages::getVCardStorage() const {
diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h
index 547fc70..ac62866 100644
--- a/Swiften/Elements/JingleContentPayload.h
+++ b/Swiften/Elements/JingleContentPayload.h
@@ -26,6 +26,9 @@ namespace Swift {
 				ResponderCreator
 			};
 
+			JingleContentPayload() : creator(UnknownCreator) {
+			}
+
 			/*enum Senders {
 				NoSenders,
 				InitiatorSender,
diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h
index a329ff0..5704c00 100644
--- a/Swiften/Elements/JingleIBBTransportPayload.h
+++ b/Swiften/Elements/JingleIBBTransportPayload.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013 Remko Tronçon
+ * Copyright (c) 2011-2014 Remko Tronçon
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
@@ -22,6 +22,9 @@ namespace Swift {
 				MessageStanza
 			};
 
+			JingleIBBTransportPayload() : stanzaType(IQStanza) {
+			}
+
 			void setStanzaType(StanzaType stanzaType) {
 				this->stanzaType = stanzaType;
 			}
diff --git a/Swiften/Elements/PubSubRetract.cpp b/Swiften/Elements/PubSubRetract.cpp
index 7e5b720..41b9346 100644
--- a/Swiften/Elements/PubSubRetract.cpp
+++ b/Swiften/Elements/PubSubRetract.cpp
@@ -8,7 +8,7 @@
 
 using namespace Swift;
 
-PubSubRetract::PubSubRetract() {
+PubSubRetract::PubSubRetract() : notify(false) {
 }
 
 PubSubRetract::~PubSubRetract() {
diff --git a/Swiften/Elements/PubSubSubscribeOptions.cpp b/Swiften/Elements/PubSubSubscribeOptions.cpp
index 3423d02..19cf084 100644
--- a/Swiften/Elements/PubSubSubscribeOptions.cpp
+++ b/Swiften/Elements/PubSubSubscribeOptions.cpp
@@ -8,7 +8,7 @@
 
 using namespace Swift;
 
-PubSubSubscribeOptions::PubSubSubscribeOptions() {
+PubSubSubscribeOptions::PubSubSubscribeOptions() : required(false) {
 }
 
 PubSubSubscribeOptions::~PubSubSubscribeOptions() {
diff --git a/Swiften/Elements/StreamManagementEnabled.cpp b/Swiften/Elements/StreamManagementEnabled.cpp
index bab7516..1f1a1f5 100644
--- a/Swiften/Elements/StreamManagementEnabled.cpp
+++ b/Swiften/Elements/StreamManagementEnabled.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2014 Remko Tronçon
  * Licensed under the GNU General Public License v3.
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
@@ -8,7 +8,7 @@
 
 using namespace Swift;
 
-StreamManagementEnabled::StreamManagementEnabled() {
+StreamManagementEnabled::StreamManagementEnabled() : resumeSupported(false) {
 }
 
 StreamManagementEnabled::~StreamManagementEnabled() {
diff --git a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h
index 3c63afc..df6e7d6 100644
--- a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h
+++ b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h
@@ -4,6 +4,13 @@
  * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
+/*
+ * Copyright (c) 2014 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+
 #pragma once
 
 #include <Swiften/Elements/Whiteboard/WhiteboardElement.h>
@@ -14,7 +21,7 @@ namespace Swift {
 	public:
 		typedef boost::shared_ptr<WhiteboardLineElement> ref;
 	public:
-		WhiteboardLineElement(int x1, int y1, int x2, int y2) {
+		WhiteboardLineElement(int x1, int y1, int x2, int y2) : penWidth_(1) {
 			x1_ = x1;
 			y1_ = y1;
 			x2_ = x2;
diff --git a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h
index 233b3fa..0fd1338 100644
--- a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h
+++ b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h
@@ -4,6 +4,12 @@
  * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
+/*
+ * Copyright (c) 2014 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
 #pragma once
 
 #include <Swiften/Elements/Whiteboard/WhiteboardElement.h>
@@ -14,7 +20,7 @@ namespace Swift {
 	public:
 		typedef boost::shared_ptr<WhiteboardRectElement> ref;
 	public:
-		WhiteboardRectElement(int x, int y, int width, int height) {
+		WhiteboardRectElement(int x, int y, int width, int height) : penWidth_(1) {
 			x_ = x;
 			y_ = y;
 			width_ = width;
diff --git a/Swiften/FileTransfer/FileTransfer.cpp b/Swiften/FileTransfer/FileTransfer.cpp
index c11e8e4..912a78a 100644
--- a/Swiften/FileTransfer/FileTransfer.cpp
+++ b/Swiften/FileTransfer/FileTransfer.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Remko Tronçon
+ * Copyright (c) 2013-2014 Remko Tronçon
  * Licensed under the GNU General Public License.
  * See the COPYING file for more information.
  */
@@ -8,7 +8,7 @@
 
 using namespace Swift;
 
-FileTransfer::FileTransfer() {
+FileTransfer::FileTransfer() : fileSizeInBytes(0) {
 }
 
 FileTransfer::~FileTransfer() {
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index 83f12f7..bde689e 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -32,6 +32,7 @@ BOSHConnection::BOSHConnection(const URL& boshURL, Connector::ref connector, XML
 	  parserFactory_(parserFactory),
 	  sid_(),
 	  waitingForStartResponse_(false),
+		rid_(~0ULL),
 	  pending_(false),
 	  connectionReady_(false)
 {
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.cpp b/Swiften/Network/SOCKS5ProxiedConnection.cpp
index a9243d6..3fd8184 100644
--- a/Swiften/Network/SOCKS5ProxiedConnection.cpp
+++ b/Swiften/Network/SOCKS5ProxiedConnection.cpp
@@ -4,6 +4,12 @@
  * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
+/*
+ * Copyright (c) 2014 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
 #include <Swiften/Network/SOCKS5ProxiedConnection.h>
 
 #include <iostream>
@@ -24,7 +30,8 @@ SOCKS5ProxiedConnection::SOCKS5ProxiedConnection(
 		TimerFactory* timerFactory, 
 		const std::string& proxyHost, 
 		int proxyPort) :
-			ProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort) {
+			ProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort),
+			proxyState_(Initial) {
 			}
 
 void SOCKS5ProxiedConnection::initializeProxy() {
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.h b/Swiften/Network/SOCKS5ProxiedConnection.h
index 7906879..2c93468 100644
--- a/Swiften/Network/SOCKS5ProxiedConnection.h
+++ b/Swiften/Network/SOCKS5ProxiedConnection.h
@@ -29,7 +29,8 @@ namespace Swift {
 
 		private:
 			enum {
-				ProxyAuthenticating = 0,
+				Initial = 0,
+				ProxyAuthenticating,
 				ProxyConnecting
 			} proxyState_;
 	};
-- 
cgit v0.10.2-6-g49f6