Fix all compilation issues after enabling QT_DISABLE_DEPRECATED_UP_TO

This commit is contained in:
luisangelsm
2026-03-30 15:48:02 +02:00
parent 12a5949b16
commit e6cbfa634b
49 changed files with 227 additions and 204 deletions

View File

@ -5,6 +5,7 @@
#include <QSslConfiguration>
#endif
#include <QDir>
#include <utility>
#include "httpconnectionhandlerpool.h"
using namespace stefanfrings;
@ -25,7 +26,7 @@ HttpConnectionHandlerPool::HttpConnectionHandlerPool(const QSettings *settings,
HttpConnectionHandlerPool::~HttpConnectionHandlerPool()
{
// delete all connection handlers and wait until their threads are closed
foreach(HttpConnectionHandler* handler, pool)
for (HttpConnectionHandler *handler : std::as_const(pool))
{
delete handler;
}
@ -39,7 +40,7 @@ HttpConnectionHandler* HttpConnectionHandlerPool::getConnectionHandler()
HttpConnectionHandler* freeHandler=0;
mutex.lock();
// find a free handler in pool
foreach(HttpConnectionHandler* handler, pool)
for (HttpConnectionHandler *handler : std::as_const(pool))
{
if (!handler->isBusy())
{
@ -69,7 +70,7 @@ void HttpConnectionHandlerPool::cleanup()
int maxIdleHandlers=settings->value("minThreads",1).toInt();
int idleCounter=0;
mutex.lock();
foreach(HttpConnectionHandler* handler, pool)
for (HttpConnectionHandler *handler : std::as_const(pool))
{
if (!handler->isBusy())
{

View File

@ -4,6 +4,7 @@
*/
#include "httpcookie.h"
#include <utility>
using namespace stefanfrings;
@ -37,7 +38,7 @@ HttpCookie::HttpCookie(const QByteArray source)
secure=false;
httpOnly=false;
QList<QByteArray> list=splitCSV(source);
foreach(QByteArray part, list)
for (const QByteArray &part : std::as_const(list))
{
// Split the part into name and value

View File

@ -6,6 +6,7 @@
#include "httprequest.h"
#include <QList>
#include <QDir>
#include <utility>
#include "httpcookie.h"
using namespace stefanfrings;
@ -239,7 +240,7 @@ void HttpRequest::decodeRequestParams()
}
// Split the parameters into pairs of value and name
QList<QByteArray> list=rawParameters.split('&');
foreach (QByteArray part, list)
for (const QByteArray &part : std::as_const(list))
{
int equalsChar=part.indexOf('=');
if (equalsChar>=0)
@ -261,10 +262,10 @@ void HttpRequest::extractCookies()
#ifdef SUPERVERBOSE
qDebug("HttpRequest: extract cookies");
#endif
foreach(QByteArray cookieStr, headers.values("cookie"))
for (const QByteArray &cookieStr : headers.values("cookie"))
{
QList<QByteArray> list=HttpCookie::splitCSV(cookieStr);
foreach(QByteArray part, list)
for (const QByteArray &part : std::as_const(list))
{
#ifdef SUPERVERBOSE
qDebug("HttpRequest: found cookie %s",part.data());
@ -532,7 +533,7 @@ void HttpRequest::parseMultiPartFile()
HttpRequest::~HttpRequest()
{
foreach(QByteArray key, uploadedFiles.keys())
for (const QByteArray &key : uploadedFiles.keys())
{
QTemporaryFile* file=uploadedFiles.value(key);
if (file->isOpen())

View File

@ -4,6 +4,7 @@
*/
#include "httpresponse.h"
#include <utility>
using namespace stefanfrings;
@ -54,14 +55,14 @@ void HttpResponse::writeHeaders()
buffer.append(' ');
buffer.append(statusText);
buffer.append("\r\n");
foreach(QByteArray name, headers.keys())
for (const QByteArray &name : headers.keys())
{
buffer.append(name);
buffer.append(": ");
buffer.append(headers.value(name));
buffer.append("\r\n");
}
foreach(HttpCookie cookie,cookies.values())
for (const HttpCookie &cookie : cookies.values())
{
buffer.append("Set-Cookie: ");
buffer.append(cookie.toByteArray());