From 3016e7fb6d5e00616fa75d2d2eeafa266382f953 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 4 Nov 2013 11:43:54 +0100 Subject: Unwarn on clang qdeclarativebluetoothservice.cpp:279:14: warning: variable 'serverType' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Change-Id: I67e6e58c7729d09492a7913e83b4bc94acf5d057 Reviewed-by: Joerg Bornemann --- src/imports/bluetooth/qdeclarativebluetoothservice.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index be8f90c0..7559968d 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -272,13 +272,11 @@ int QDeclarativeBluetoothServicePrivate::listen() { qWarning() << "Unknown protocol, can't make service" << m_protocol; return -1; } - QBluetoothServiceInfo::Protocol serverType; - if (m_service->socketProtocol() == QBluetoothServiceInfo::L2capProtocol) { + QBluetoothServiceInfo::Protocol serverType = QBluetoothServiceInfo::UnknownProtocol; + if (m_service->socketProtocol() == QBluetoothServiceInfo::L2capProtocol) serverType = QBluetoothServiceInfo::L2capProtocol; - } - else if (m_service->socketProtocol() == QBluetoothServiceInfo::RfcommProtocol) { + else if (m_service->socketProtocol() == QBluetoothServiceInfo::RfcommProtocol) serverType = QBluetoothServiceInfo::RfcommProtocol; - } QBluetoothServer *server = new QBluetoothServer(serverType); server->setMaxPendingConnections(1); -- cgit v1.2.3