Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/codeql_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Build script for CodeQL on Ubuntu 22.04

sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev gcc g++ clang make cmake
sudo apt-get install -y --no-install-recommends qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc2 libmongoc-dev libbson-dev gcc g++ clang make cmake

./configure --spec=linux-clang
make -j4 -C src && sudo make -C src install && make -j4 -C tools && sudo make -C tools install
19 changes: 11 additions & 8 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:

jobs:
build-ubuntu:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@main
- name: apt
run: |
sudo apt-get update -qq
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev gcc g++ clang make cmake
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc2 libmongoc-dev libbson-dev gcc g++ clang make cmake
- name: qmake version
run: |
sudo rm -f /usr/bin/qmake
Expand Down Expand Up @@ -51,13 +51,13 @@ jobs:
$GITHUB_WORKSPACE/tools/test/releasetest/releasetest

build-ubuntu-sharedlink:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@main
- name: apt
run: |
sudo apt-get update -qq
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev liblz4-dev gcc g++ clang make cmake
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc2 libmongoc-dev libbson-dev liblz4-dev gcc g++ clang make cmake
- name: qmake version
run: |
sudo rm -f /usr/bin/qmake
Expand Down Expand Up @@ -93,19 +93,22 @@ jobs:
run: |
$GITHUB_WORKSPACE/tools/test/releasetest/releasetest

build-ubuntu20:
runs-on: ubuntu-20.04
build-ubuntu22:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@main
- name: apt
run: |
sudo apt-get update -qq
sudo apt install -y --no-install-recommends pkg-config qtbase5-dev qt5-default qt5-qmake qttools5-dev-tools qtdeclarative5-dev qtdeclarative5-dev-tools libqt5sql5 libqt5sql5-sqlite libsqlite3-dev libmongoc-dev libbson-dev gcc g++ clang make cmake
sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc2 libmongoc-dev libbson-dev liblz4-dev gcc g++ clang make cmake
- name: qmake version
run: |
sudo rm -f /usr/bin/qmake
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
qmake -v
- name: configure
run: ./configure --prefix=/usr/local --spec=linux-g++
run: |
./configure --prefix=/usr/local --spec=linux-g++
- name: make
run: |
make -j4 -C src
Expand Down
4 changes: 2 additions & 2 deletions defaults/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.1)

project(appname CXX)

# C++14
set(CMAKE_CXX_STANDARD 14)
# C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# cxx options
if (MSVC)
Expand Down
9 changes: 2 additions & 7 deletions defaults/appbase.pri
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
lessThan(QT_MAJOR_VERSION, 6) {
CONFIG += c++14
windows:QMAKE_CXXFLAGS += /std:c++14
} else {
CONFIG += c++17
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++17
}
CONFIG += c++20
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++20

windows {
INCLUDEPATH += $$quote($$(TFDIR)\\include)
Expand Down
2 changes: 0 additions & 2 deletions include/TreeFrogModel
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include "thttprequest.h"
#include "tsession.h"

#if QT_VERSION >= 0x050000
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#endif
2 changes: 0 additions & 2 deletions include/TreeFrogView
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include "tviewhelper.h"
#include "twebapplication.h"

#if QT_VERSION >= 0x050000
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
#endif
4 changes: 2 additions & 2 deletions src/corelib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ lessThan(QT_MAJOR_VERSION, 6) {
CONFIG += c++14
windows:QMAKE_CXXFLAGS += /std:c++14
} else {
CONFIG += c++17
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++17 /permissive-
CONFIG += c++20
windows:QMAKE_CXXFLAGS += /Zc:__cplusplus /std:c++20 /permissive-
}

DEFINES *= QT_USE_QSTRINGBUILDER
Expand Down
6 changes: 1 addition & 5 deletions src/tabstractcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TAbstractController::TAbstractController() :
void TAbstractController::exportVariant(const QString &name, const QVariant &value, bool overwrite)
{
if (!value.isValid()) {
tSystemWarn("An invalid QVariant object for exportVariant(), name:%s", qUtf8Printable(name));
tSystemWarn("An invalid QVariant object for exportVariant(), name:{}", qUtf8Printable(name));
return;
}

Expand All @@ -48,13 +48,9 @@ void TAbstractController::exportVariants(const QVariantMap &map)
if (_exportVars.isEmpty()) {
_exportVars = map;
} else {
#if QT_VERSION >= 0x050f00 // 5.15.0
auto tmp = _exportVars;
_exportVars = map;
_exportVars.insert(tmp);
#else
_exportVars.unite(map);
#endif
}
}

Expand Down
26 changes: 13 additions & 13 deletions src/tabstractwebsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TAbstractWebSocket::TAbstractWebSocket(const THttpRequestHeader &header) :
TAbstractWebSocket::~TAbstractWebSocket()
{
if (!closing.load()) {
tSystemWarn("Logic warning [%s:%d]", __FILE__, __LINE__);
tSystemWarn("Logic warning [{}:{}]", __FILE__, __LINE__);
}

delete keepAliveTimer;
Expand Down Expand Up @@ -167,7 +167,7 @@ bool TAbstractWebSocket::searchEndpoint(const THttpRequestHeader &header)

int TAbstractWebSocket::parse(QByteArray &recvData)
{
tSystemDebug("parse enter data len:%lld sid:%lld", (int64_t)recvData.length(), socketDescriptor());
tSystemDebug("parse enter data len:{} sid:{}", (int64_t)recvData.length(), socketDescriptor());
if (websocketFrames().isEmpty()) {
websocketFrames().append(TWebSocketFrame());
} else {
Expand Down Expand Up @@ -214,7 +214,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
}
dshdr >> w;
if (Q_UNLIKELY(w < 126)) {
tSystemError("WebSocket protocol error [%s:%d]", __FILE__, __LINE__);
tSystemError("WebSocket protocol error [{}:{}]", __FILE__, __LINE__);
return -1;
}
pfrm->setPayloadLength(w);
Expand All @@ -226,7 +226,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
}
dshdr >> d;
if (Q_UNLIKELY(d <= 0xFFFF)) {
tSystemError("WebSocket protocol error [%s:%d]", __FILE__, __LINE__);
tSystemError("WebSocket protocol error [{}:{}]", __FILE__, __LINE__);
return -1;
}
pfrm->setPayloadLength(d);
Expand All @@ -251,15 +251,15 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
} else {
pfrm->setState(TWebSocketFrame::HeaderParsed);
if (pfrm->payloadLength() >= 2 * 1024 * 1024 * 1024ULL) {
tSystemError("Too big frame [%s:%d]", __FILE__, __LINE__);
tSystemError("Too big frame [{}:{}]", __FILE__, __LINE__);
pfrm->clear();
} else {
pfrm->payload().reserve(pfrm->payloadLength());
}
}

tSystemDebug("WebSocket parse header pos: %lld", devhdr->pos());
tSystemDebug("WebSocket payload length:%lld", pfrm->payloadLength());
tSystemDebug("WebSocket parse header pos: {}", devhdr->pos());
tSystemDebug("WebSocket payload length:{}", pfrm->payloadLength());

int hdrlen = hdr.length() - devhdr->bytesAvailable();
ds.skipRawData(hdrlen); // Forwards the pos
Expand All @@ -268,8 +268,8 @@ int TAbstractWebSocket::parse(QByteArray &recvData)

case TWebSocketFrame::HeaderParsed: // fall through
case TWebSocketFrame::MoreData: {
tSystemDebug("WebSocket reading payload: available length:%lld", dev->bytesAvailable());
tSystemDebug("WebSocket parsing length to read:%llu current buf len:%lld", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
tSystemDebug("WebSocket reading payload: available length:{}", dev->bytesAvailable());
tSystemDebug("WebSocket parsing length to read:{} current buf len:{}", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
uint64_t size = std::min((uint64_t)(pfrm->payloadLength() - pfrm->payload().size()), (uint64_t)dev->bytesAvailable());
if (Q_UNLIKELY(size == 0)) {
Q_ASSERT(0);
Expand All @@ -293,14 +293,14 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
}
}
pfrm->payload().resize(pfrm->payload().size() + size);
tSystemDebug("WebSocket payload curent buf len: %lld", (int64_t)pfrm->payload().length());
tSystemDebug("WebSocket payload curent buf len: {}", (int64_t)pfrm->payload().length());

if ((uint64_t)pfrm->payload().size() == pfrm->payloadLength()) {
pfrm->setState(TWebSocketFrame::Completed);
tSystemDebug("Parse Completed payload len: %lld", (int64_t)pfrm->payload().size());
tSystemDebug("Parse Completed payload len: {}", (int64_t)pfrm->payload().size());
} else {
pfrm->setState(TWebSocketFrame::MoreData);
tSystemDebug("Parse MoreData payload len: %lld", (int64_t)pfrm->payload().size());
tSystemDebug("Parse MoreData payload len: {}", (int64_t)pfrm->payload().size());
}
break;
}
Expand All @@ -323,7 +323,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
const TWebSocketFrame &before = websocketFrames()[websocketFrames().count() - 2];
if (before.isFinalFrame() || before.isControlFrame()) {
pfrm->clear();
tSystemWarn("Invalid continuation frame detected [%s:%d]", __FILE__, __LINE__);
tSystemWarn("Invalid continuation frame detected [{}:{}]", __FILE__, __LINE__);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/taccesslog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QByteArray TAccessLog::toByteArray(const QByteArray &layout, const QByteArray &d
message.append(remoteHost);
break;

case 'd': // %d : timestamp
case 'd': // timestamp
if (!dateTimeFormat.isEmpty()) {
message.append(timestamp.toString(dateTimeFormat).toLocal8Bit());
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/taccessvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool TAccessValidator::validate(const TAbstractUser *user, const TActionControll
Q_ASSERT(controller);

if (accessRules.isEmpty()) {
tWarn("No rule for access validation: %s", qUtf8Printable(controller->className()));
Tf::warn("No rule for access validation: {}", qUtf8Printable(controller->className()));
return ret;
}

Expand All @@ -163,9 +163,9 @@ bool TAccessValidator::validate(const TAbstractUser *user, const TActionControll
}
}
if (ret) {
tSystemDebug("Access '%s' action by an unauthenticated user : Allow", qUtf8Printable(controller->activeAction()));
tSystemDebug("Access '{}' action by an unauthenticated user : Allow", qUtf8Printable(controller->activeAction()));
} else {
tSystemWarn("Access '%s' action by an unauthenticated user : Deny", qUtf8Printable(controller->activeAction()));
tSystemWarn("Access '{}' action by an unauthenticated user : Deny", qUtf8Printable(controller->activeAction()));
}

} else {
Expand All @@ -178,9 +178,9 @@ bool TAccessValidator::validate(const TAbstractUser *user, const TActionControll
}
}
if (ret) {
tSystemDebug("Access '%s' action by '%s' user : Allow", qUtf8Printable(controller->activeAction()), qUtf8Printable(user->identityKey()));
tSystemDebug("Access '{}' action by '{}' user : Allow", qUtf8Printable(controller->activeAction()), qUtf8Printable(user->identityKey()));
} else {
tSystemWarn("Access '%s' action by '%s' user : Deny", qUtf8Printable(controller->activeAction()), qUtf8Printable(user->identityKey()));
tSystemWarn("Access '{}' action by '{}' user : Deny", qUtf8Printable(controller->activeAction()), qUtf8Printable(user->identityKey()));
}
}

Expand Down
28 changes: 14 additions & 14 deletions src/tactioncontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ void TActionContext::execute(THttpRequest &request)
accessLogger.startElapsedTimer();
}

tSystemDebug("method : %s", reqHeader.method().data());
tSystemDebug("path : %s", reqHeader.path().data());
tSystemDebug("method : {}", reqHeader.method().data());
tSystemDebug("path : {}", reqHeader.path().data());

// HTTP method
Tf::HttpMethod method = _httpRequest->method();
Expand All @@ -94,7 +94,7 @@ void TActionContext::execute(THttpRequest &request)
QStringList components = TUrlRoute::splitPath(path);
TRouting route = TUrlRoute::instance().findRouting(method, components);

tSystemDebug("Routing: controller:%s action:%s", route.controller.data(),
tSystemDebug("Routing: controller:{} action:{}", route.controller.data(),
route.action.data());

if (!route.exists) {
Expand All @@ -112,7 +112,7 @@ void TActionContext::execute(THttpRequest &request)
route.setRouting(c + QByteArrayLiteral("controller"), action, components.mid(2));
}
}
tSystemDebug("Active Controller : %s", route.controller.data());
tSystemDebug("Active Controller : {}", route.controller.data());
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ void TActionContext::execute(THttpRequest &request)
TSessionManager::instance().remove(_currController->session().sessionId); // Removes the old session
// Re-generate session ID
_currController->session().sessionId = TSessionManager::instance().generateId();
tSystemDebug("Re-generate session ID: %s", _currController->session().sessionId.data());
tSystemDebug("Re-generate session ID: {}", _currController->session().sessionId.data());
}

if (EnableCsrfProtectionModuleFlag && _currController->csrfProtectionEnabled()) {
Expand Down Expand Up @@ -199,7 +199,7 @@ void TActionContext::execute(THttpRequest &request)
QString canonicalPath = QUrl(QStringLiteral(".")).resolved(QUrl(path)).toString().mid(1);
QFile reqPath(Tf::app()->publicPath() + canonicalPath);
QFileInfo fi(reqPath);
tSystemDebug("canonicalPath : %s", qUtf8Printable(canonicalPath));
tSystemDebug("canonicalPath : {}", qUtf8Printable(canonicalPath));

if (fi.isFile() && fi.isReadable()) {
// Check "If-Modified-Since" header for caching
Expand Down Expand Up @@ -244,20 +244,20 @@ void TActionContext::execute(THttpRequest &request)
}

} catch (ClientErrorException &e) {
tWarn("Caught %s: status code:%d", qUtf8Printable(e.className()), e.statusCode());
tSystemWarn("Caught %s: status code:%d", qUtf8Printable(e.className()), e.statusCode());
Tf::warn("Caught {}: status code:{}", qUtf8Printable(e.className()), e.statusCode());
tSystemWarn("Caught {}: status code:{}", qUtf8Printable(e.className()), e.statusCode());
int responseBytes = writeResponse(e.statusCode(), responseHeader);
accessLogger.setResponseBytes(responseBytes);
accessLogger.setStatusCode(e.statusCode());
} catch (TfException &e) {
tError("Caught %s: %s [%s:%d]", qUtf8Printable(e.className()), qUtf8Printable(e.message()), qUtf8Printable(e.fileName()), e.lineNumber());
tSystemError("Caught %s: %s [%s:%d]", qUtf8Printable(e.className()), qUtf8Printable(e.message()), qUtf8Printable(e.fileName()), e.lineNumber());
Tf::error("Caught {}: {} [{}:{}]", qUtf8Printable(e.className()), qUtf8Printable(e.message()), qUtf8Printable(e.fileName()), e.lineNumber());
tSystemError("Caught {}: {} [{}:{}]", qUtf8Printable(e.className()), qUtf8Printable(e.message()), qUtf8Printable(e.fileName()), e.lineNumber());
closeSocket();
accessLogger.setResponseBytes(0);
accessLogger.setStatusCode(Tf::InternalServerError);
} catch (std::exception &e) {
tError("Caught Exception: %s", e.what());
tSystemError("Caught Exception: %s", e.what());
Tf::error("Caught Exception: {}", e.what());
tSystemError("Caught Exception: {}", e.what());
closeSocket();
accessLogger.setResponseBytes(0);
accessLogger.setStatusCode(Tf::InternalServerError);
Expand Down Expand Up @@ -374,7 +374,7 @@ void TActionContext::flushResponse(TActionController *controller, bool immediate
} break;

default:
tSystemError("Invalid logic [%s:%d]", __FILE__, __LINE__);
tSystemError("Invalid logic [{}:{}]", __FILE__, __LINE__);
break;
}
}
Expand Down Expand Up @@ -463,7 +463,7 @@ int64_t TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *bo
{

header.setContentLength(length);
tSystemDebug("content-length: %lld", (int64_t)header.contentLength());
tSystemDebug("content-length: {}", (int64_t)header.contentLength());
header.setRawHeader(QByteArrayLiteral("Server"), QByteArrayLiteral("TreeFrog server"));
header.setCurrentDate();

Expand Down
Loading
Loading