Skip to content
Snippets Groups Projects
Commit 932fbae8 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

misc: clean warnings

Change-Id: I749159077ac20da0862dcfc774729bff4a356404
parent b34b373d
No related branches found
No related tags found
No related merge requests found
......@@ -238,6 +238,7 @@ endif()
set(LIBCLIENT_SOURCES
# data objects
uri.cpp
vcard.cpp
# models
contactmodel.cpp
......
......@@ -42,7 +42,7 @@
#ifdef ENABLE_LIBWRAP
// For the debugMessageReceived connection that queues const std::string refs
// when not using dbus
Q_DECLARE_METATYPE(std::string);
Q_DECLARE_METATYPE(std::string)
#endif
namespace lrc {
......
......@@ -101,7 +101,7 @@ CallParticipants::removeParticipant(int index)
{
{
std::lock_guard<std::mutex> lk(participantsMtx_);
auto it = participants_.begin() + index;
auto it = std::next(participants_.begin(), index);
participants_.erase(it);
}
Q_EMIT linked_.participantRemoved(callId_, idx_);
......@@ -115,7 +115,7 @@ CallParticipants::addParticipant(const ParticipantInfos& participant)
std::lock_guard<std::mutex> lk(participantsMtx_);
auto it = participants_.find(participant.sinkId);
if (it == participants_.end()) {
participants_.insert(participants_.begin() + idx_, participant.sinkId, participant);
participants_.insert(std::next(participants_.begin(), idx_), participant.sinkId, participant);
added = true;
} else {
if (participant == (*it))
......@@ -179,7 +179,7 @@ CallParticipants::toQJsonObject(uint index) const
return {};
QJsonObject ret;
const auto& participant = participants_.begin() + index;
const auto& participant = std::next(participants_.begin(), index);
ret[ParticipantsInfosStrings::URI] = participant->uri;
ret[ParticipantsInfosStrings::DEVICE] = participant->device;
......
/*
* Copyright (C) 2018-2022 Savoir-faire Linux Inc.
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vcard.h"
namespace lrc {
namespace vCard {
namespace utils {
QHash<QByteArray, QByteArray>
toHashMap(const QByteArray& content)
{
// TODO without Qt
QHash<QByteArray, QByteArray> vCard;
QByteArray previousKey, previousValue;
const QList<QByteArray> lines = content.split('\n');
Q_FOREACH (const QByteArray& property, lines) {
// Ignore empty lines
if (property.size()) {
// Some properties are over multiple lines
if (property[0] == ' ' && previousKey.size()) {
previousValue += property.right(property.size() - 1);
}
// Do not use split, URIs can have : in them
const int dblptPos = property.indexOf(':');
const QByteArray k(property.left(dblptPos)),
v(property.right(property.size() - dblptPos - 1));
vCard[k] = v;
}
}
return vCard;
}
} // namespace utils
} // namespace vCard
} // namespace lrc
......@@ -79,31 +79,8 @@ namespace utils {
* @param content payload
* @return the vCard representation
*/
static QHash<QByteArray, QByteArray>
toHashMap(const QByteArray& content)
{
// TODO without Qt
QHash<QByteArray, QByteArray> vCard;
QByteArray previousKey, previousValue;
const QList<QByteArray> lines = content.split('\n');
Q_FOREACH (const QByteArray& property, lines) {
// Ignore empty lines
if (property.size()) {
// Some properties are over multiple lines
if (property[0] == ' ' && previousKey.size()) {
previousValue += property.right(property.size() - 1);
}
QHash<QByteArray, QByteArray> toHashMap(const QByteArray& content);
// Do not use split, URIs can have : in them
const int dblptPos = property.indexOf(':');
const QByteArray k(property.left(dblptPos)),
v(property.right(property.size() - dblptPos - 1));
vCard[k] = v;
}
}
return vCard;
}
} // namespace utils
} // namespace vCard
} // namespace lrc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment