Skip to content

Commit

Permalink
Fixed deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Mar 17, 2024
1 parent 126cdb5 commit 09dd48f
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 55 deletions.
8 changes: 5 additions & 3 deletions 3rdparty/stringprep/stringprep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int stringprep_apply_table_to_string(QVector<uint> &ucs4, const Stringpre
{
std::ptrdiff_t pos;
size_t i, maplen;
uint32_t * src = ucs4.data(); /* points to unprocessed data */
uint32_t *src = ucs4.data(); /* points to unprocessed data */
size_t srclen = ucs4.size(); /* length of unprocessed data */

while ((pos = stringprep_find_string_in_table(src, srclen, &i, table, table_size)) != -1) {
Expand Down Expand Up @@ -177,7 +177,8 @@ int stringprep_4i(QString &input, Stringprep_profile_flags flags, const Stringpr
/* Profile requires NFKC, but callee asked for no NFKC. */
return STRINGPREP_FLAG_ERROR;

ucs4vector = QString::fromUcs4(ucs4vector.data(), ucs4vector.length())
static_assert(sizeof(char32_t) == sizeof(uint));
ucs4vector = QString::fromUcs4(reinterpret_cast<char32_t *>(ucs4vector.data()), ucs4vector.length())
.normalized(QString::NormalizationForm_KC)
.toUcs4();
break;
Expand Down Expand Up @@ -264,7 +265,8 @@ int stringprep_4i(QString &input, Stringprep_profile_flags flags, const Stringpr
}
}

input = QString::fromUcs4(ucs4vector.data(), ucs4vector.size());
static_assert(sizeof(char32_t) == sizeof(uint));
input = QString::fromUcs4(reinterpret_cast<char32_t *>(ucs4vector.data()), ucs4vector.size());

return STRINGPREP_OK;
}
Expand Down
12 changes: 12 additions & 0 deletions src/irisnet/corelib/objectsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ class ObjectSessionPrivate : public QObject {
void clearArgs()
{
for (int n = 0; n < args.count(); ++n)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QMetaType::destroy(args[n].type, args[n].data);
#else
QMetaType(args[n].type).destroy(args[n].data);
#endif
args.clear();
}

Expand All @@ -78,7 +82,11 @@ class ObjectSessionPrivate : public QObject {
break;

Argument arg;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
arg.type = QMetaType::type(arg_name[n]);
#else
arg.type = QMetaType::fromName(arg_name[n]).id();
#endif
if (!arg.type) {
clearArgs();
return false;
Expand Down Expand Up @@ -149,7 +157,11 @@ private slots:

QGenericArgument arg[10];
for (int n = 0; n < call->args.count(); ++n)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
arg[n] = QGenericArgument(QMetaType::typeName(call->args[n].type), call->args[n].data);
#else
arg[n] = QGenericArgument(QMetaType(call->args[n].type).name(), call->args[n].data);
#endif

bool ok;
ok = QMetaObject::invokeMethod(call->obj, call->method.data(), Qt::DirectConnection, arg[0], arg[1], arg[2],
Expand Down
2 changes: 1 addition & 1 deletion src/irisnet/noncore/cutestuff/httppoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ void HttpProxyGetStream::sock_readyRead()

void HttpProxyGetStream::processData(const QByteArray &block)
{
printf("processData: %d bytes\n", block.size());
printf("processData: %lld bytes\n", block.size());
if (!d->inHeader) {
emit dataReady(block);
return;
Expand Down
6 changes: 3 additions & 3 deletions src/irisnet/noncore/ice176.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class Ice176::Private : public QObject {
}
this->remoteCandidates += remoteCandidates;

iceDebug("adding %d remote candidates. total=%d", remoteCandidates.count(), this->remoteCandidates.count());
iceDebug("adding %lld remote candidates. total=%lld", remoteCandidates.count(), this->remoteCandidates.count());
doPairing(localCandidates, remoteCandidates);
}

Expand Down Expand Up @@ -508,7 +508,7 @@ class Ice176::Private : public QObject {
void addChecklistPairs(const QList<QSharedPointer<CandidatePair>> &pairs)
{
#ifdef ICE_DEBUG
iceDebug("%d new pairs", pairs.count());
iceDebug("%lld new pairs", pairs.count());
for (auto &p : pairs)
p->logNew = true;
#endif
Expand Down Expand Up @@ -549,7 +549,7 @@ class Ice176::Private : public QObject {
while (checkList.pairs.count() > max_pairs)
checkList.pairs.removeLast();
#ifdef ICE_DEBUG
iceDebug("%d after pruning (just new below):", checkList.pairs.count());
iceDebug("%lld after pruning (just new below):", checkList.pairs.count());
for (auto &p : checkList.pairs) {
if (p->logNew)
iceDebug("C%d, %s", p->local->componentId, qPrintable(*p));
Expand Down
20 changes: 10 additions & 10 deletions src/irisnet/noncore/stunbinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class StunBinding::Private : public QObject {
Q_OBJECT

public:
StunBinding *q;
StunTransactionPool::Ptr pool;
QScopedPointer<StunTransaction> trans;
TransportAddress stunAddr;
TransportAddress addr;
QString errorString;
StunBinding *q;
StunTransactionPool::Ptr pool;
std::unique_ptr<StunTransaction> trans;
TransportAddress stunAddr;
TransportAddress addr;
QString errorString;
bool use_extPriority = false, use_extIceControlling = false, use_extIceControlled = false;
quint32 extPriority = 0;
bool extUseCandidate = false;
Expand All @@ -52,9 +52,9 @@ class StunBinding::Private : public QObject {
stunAddr = _addr;

trans.reset(new StunTransaction());
connect(trans.data(), &StunTransaction::createMessage, this, &Private::trans_createMessage);
connect(trans.data(), &StunTransaction::finished, this, &Private::trans_finished);
connect(trans.data(), &StunTransaction::error, this, &Private::trans_error);
connect(trans.get(), &StunTransaction::createMessage, this, &Private::trans_createMessage);
connect(trans.get(), &StunTransaction::finished, this, &Private::trans_finished);
connect(trans.get(), &StunTransaction::error, this, &Private::trans_error);

if (!stuser.isEmpty()) {
trans->setShortTermUsername(stuser);
Expand All @@ -70,7 +70,7 @@ class StunBinding::Private : public QObject {
{
if (!trans)
return;
auto t = trans.take();
auto t = trans.release();
t->disconnect(this);
t->cancel(); // will self-delete the transaction either on incoming or timeout
// just in case those too
Expand Down
2 changes: 1 addition & 1 deletion src/irisnet/noncore/stuntypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ namespace StunTypes {
if (!val.isEmpty())
out += QString(" = %1").arg(val);
} else
out += QString::asprintf(" Unknown attribute (0x%04x) of %d bytes", a.type, a.value.size());
out += QString::asprintf(" Unknown attribute (0x%04x) of %lld bytes", a.type, a.value.size());
}
} else
out += "\n (None)";
Expand Down
2 changes: 1 addition & 1 deletion src/irisnet/noncore/tcpportreserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class TcpPortScope : public QObject {

private:
struct Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/xmpp/jid/jid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace XMPP;
//----------------------------------------------------------------------------
// StringPrepCache
//----------------------------------------------------------------------------
QScopedPointer<StringPrepCache> StringPrepCache::_instance;
std::unique_ptr<StringPrepCache> StringPrepCache::_instance;

bool StringPrepCache::nameprep(const QString &in, int maxbytes, QString &out)
{
Expand Down Expand Up @@ -155,7 +155,7 @@ StringPrepCache *StringPrepCache::instance()
irisNetAddPostRoutine(cleanup); // REVIEW probably not necessary since heap will be deallocated with destructors
#endif
}
return _instance.data();
return _instance.get();
}

StringPrepCache::StringPrepCache() { }
Expand Down
5 changes: 2 additions & 3 deletions src/xmpp/jid/jid.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <QByteArray>
#include <QHash>
#include <QScopedPointer>
#include <QString>

namespace XMPP {
Expand All @@ -41,8 +40,8 @@ class StringPrepCache {
QHash<QString, QString> resourceprep_table;
QHash<QString, QString> saslprep_table;

static QScopedPointer<StringPrepCache> _instance;
static StringPrepCache *instance();
static std::unique_ptr<StringPrepCache> _instance;
static StringPrepCache *instance();

StringPrepCache();
};
Expand Down
6 changes: 3 additions & 3 deletions src/xmpp/xmpp-im/jingle-application.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace XMPP { namespace Jingle {
inline Origin senders() const { return _senders; }
inline QString contentName() const { return _contentName; }
inline QSharedPointer<Transport> transport() const { return _transport; }
inline TransportSelector *transportSelector() const { return _transportSelector.data(); }
inline TransportSelector *transportSelector() const { return _transportSelector.get(); }
bool isRemote() const;
inline bool isLocal() const { return !isRemote(); }
inline ApplicationFlags flags() const { return _flags; }
Expand Down Expand Up @@ -185,8 +185,8 @@ namespace XMPP { namespace Jingle {
Origin _senders;

// current transport. either local or remote. has info about origin and state
QSharedPointer<Transport> _transport;
QScopedPointer<TransportSelector> _transportSelector;
QSharedPointer<Transport> _transport;
std::unique_ptr<TransportSelector> _transportSelector;

// if transport-replace is in progress. will be set to true when accepted by both sides.
PendingTransportReplace _pendingTransportReplace = PendingTransportReplace::None;
Expand Down
2 changes: 1 addition & 1 deletion src/xmpp/xmpp-im/jingle-ft.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {

private:
class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};

class Manager : public XMPP::Jingle::ApplicationManager {
Expand Down
4 changes: 2 additions & 2 deletions src/xmpp/xmpp-im/jingle-ibb.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Jingle { namespace IBB {
friend class Manager;

struct Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};

class Manager;
Expand Down Expand Up @@ -91,7 +91,7 @@ namespace Jingle { namespace IBB {

private:
struct Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};
} // namespace IBB
} // namespace Jingle
Expand Down
11 changes: 4 additions & 7 deletions src/xmpp/xmpp-im/jingle-ice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
#include "xmpp_client.h"
#include "xmpp_externalservicediscovery.h"
#include "xmpp_serverinfomanager.h"
#include "xmpp_xmlcommon.h"

#include <array>
#include <chrono>
#include <memory>

#include <QElapsedTimer>
Expand Down Expand Up @@ -452,7 +449,7 @@ namespace XMPP { namespace Jingle { namespace ICE {
int proxiesInDiscoCount = 0;
QVector<Component> components;
QList<XMPP::Ice176::Candidate> pendingLocalCandidates; // cid to candidate mapping
QScopedPointer<Element> remoteState;
std::unique_ptr<Element> remoteState;

// QString sid;
// Transport::Mode mode = Transport::Tcp;
Expand Down Expand Up @@ -638,7 +635,7 @@ namespace XMPP { namespace Jingle { namespace ICE {
return;
}

auto manager = dynamic_cast<Manager *>(q->pad()->manager())->d.data();
auto manager = dynamic_cast<Manager *>(q->pad()->manager())->d.get();
stunBindPort = manager->stunBindPort;
stunRelayUdpPort = manager->stunRelayUdpPort;
stunRelayTcpPort = manager->stunRelayTcpPort;
Expand All @@ -659,7 +656,7 @@ namespace XMPP { namespace Jingle { namespace ICE {

void startIce()
{
auto manager = dynamic_cast<Manager *>(q->_pad->manager())->d.data();
auto manager = dynamic_cast<Manager *>(q->_pad->manager())->d.get();

if (!stunBindAddr.isNull() && stunBindPort > 0)
qDebug("STUN service: %s;%d", qPrintable(stunBindAddr.toString()), stunBindPort);
Expand Down Expand Up @@ -707,7 +704,7 @@ namespace XMPP { namespace Jingle { namespace ICE {
[this](const QList<XMPP::Ice176::Candidate> &candidates) {
pendingActions |= NewCandidate;
pendingLocalCandidates += candidates;
qDebug("discovered %d local candidates", candidates.size());
qDebug("discovered %lld local candidates", candidates.size());
for (auto const &c : candidates) {
qDebug(" - %s:%d", qPrintable(c.ip.toString()), c.port);
}
Expand Down
4 changes: 2 additions & 2 deletions src/xmpp/xmpp-im/jingle-ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace Jingle { namespace ICE {
friend class Manager;

class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};

class Pad : public TransportManagerPad {
Expand Down Expand Up @@ -129,7 +129,7 @@ namespace Jingle { namespace ICE {
private:
friend class Transport;
class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};
} // namespace Ice
} // namespace Jingle
Expand Down
4 changes: 2 additions & 2 deletions src/xmpp/xmpp-im/jingle-s5b.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace Jingle { namespace S5B {
friend class Manager;

class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};

class Pad : public TransportManagerPad {
Expand Down Expand Up @@ -212,7 +212,7 @@ namespace Jingle { namespace S5B {

private:
class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};
} // namespace S5B
} // namespace Jingle
Expand Down
3 changes: 1 addition & 2 deletions src/xmpp/xmpp-im/jingle-sctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <QAbstractSocket>
#include <QDomElement>
#include <QObject>
#include <QScopedPointer>

#include <memory>

Expand Down Expand Up @@ -95,7 +94,7 @@ namespace XMPP { namespace Jingle { namespace SCTP {
void newIncomingChannel();

private:
QScopedPointer<AssociationPrivate> d;
std::unique_ptr<AssociationPrivate> d;
};

}}}
Expand Down
8 changes: 4 additions & 4 deletions src/xmpp/xmpp-im/jingle-session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ namespace XMPP { namespace Jingle {
}

QMultiMap<Application::Update, Application *> updates;
qDebug("jingle-doStep: %d applications have updates", signalingContent.size());
qDebug("jingle-doStep: %lld applications have updates", signalingContent.size());
for (auto app : std::as_const(signalingContent)) {
auto updateType = app->evaluateOutgoingUpdate();
if (updateType.action != Action::NoAction) {
Expand Down Expand Up @@ -510,7 +510,7 @@ namespace XMPP { namespace Jingle {
return result { Unsupported, trReason == Reason::NoReason ? Reason::UnsupportedApplications : trReason,
nullptr };
}
QScopedPointer<Application> app(appPad->manager()->startApplication(appPad, c.name, c.creator, c.senders));
std::unique_ptr<Application> app(appPad->manager()->startApplication(appPad, c.name, c.creator, c.senders));
if (!app)
return result { Unparsed, Reason::Success, nullptr };

Expand All @@ -522,10 +522,10 @@ namespace XMPP { namespace Jingle {
}

if (app->setTransport(std::get<2>(trpr))) {
return result { Ok, Reason::Success, app.take() };
return result { Ok, Reason::Success, app.release() };
}
// TODO We can do transport-replace in all cases where std::get<1>(trpr) != NoReason
return result { Unsupported, Reason::IncompatibleParameters, app.take() };
return result { Unsupported, Reason::IncompatibleParameters, app.release() };
}

typedef std::tuple<AddContentError, Reason::Condition, QList<Application *>, QList<QDomElement>>
Expand Down
2 changes: 1 addition & 1 deletion src/xmpp/xmpp-im/jingle-session.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace XMPP { namespace Jingle {
bool updateFromXml(Action action, const QDomElement &jingleEl);

class Private;
QScopedPointer<Private> d;
std::unique_ptr<Private> d;
};
}}

Expand Down
6 changes: 3 additions & 3 deletions src/xmpp/xmpp-im/jingle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,9 @@ namespace XMPP { namespace Jingle {
//----------------------------------------------------------------------------
class Manager::Private {
public:
XMPP::Client *client;
Manager *manager;
QScopedPointer<JTPush> pushTask;
XMPP::Client *client;
Manager *manager;
std::unique_ptr<JTPush> pushTask;
// ns -> application
std::map<QString, QPointer<ApplicationManager>> applicationManagers;
// ns -> parser function
Expand Down
Loading

0 comments on commit 09dd48f

Please sign in to comment.