diff --git a/src/tabstractwebsocket.cpp b/src/tabstractwebsocket.cpp index a44062186..9d1327d69 100644 --- a/src/tabstractwebsocket.cpp +++ b/src/tabstractwebsocket.cpp @@ -167,7 +167,7 @@ bool TAbstractWebSocket::searchEndpoint(const THttpRequestHeader &header) int TAbstractWebSocket::parse(QByteArray &recvData) { - tSystemDebug("parse enter data len:%ld sid:%lld", (int64_t)recvData.length(), socketDescriptor()); + tSystemDebug("parse enter data len:%lld sid:%lld", (int64_t)recvData.length(), socketDescriptor()); if (websocketFrames().isEmpty()) { websocketFrames().append(TWebSocketFrame()); } else { @@ -259,7 +259,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData) } tSystemDebug("WebSocket parse header pos: %lld", devhdr->pos()); - tSystemDebug("WebSocket payload length:%ld", pfrm->payloadLength()); + tSystemDebug("WebSocket payload length:%lld", pfrm->payloadLength()); int hdrlen = hdr.length() - devhdr->bytesAvailable(); ds.skipRawData(hdrlen); // Forwards the pos @@ -269,7 +269,7 @@ 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:%lu current buf len:%ld", pfrm->payloadLength(), (int64_t)pfrm->payload().size()); + tSystemDebug("WebSocket parsing length to read:%llu current buf len:%lld", 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); @@ -293,14 +293,14 @@ int TAbstractWebSocket::parse(QByteArray &recvData) } } pfrm->payload().resize(pfrm->payload().size() + size); - tSystemDebug("WebSocket payload curent buf len: %ld", (int64_t)pfrm->payload().length()); + tSystemDebug("WebSocket payload curent buf len: %lld", (int64_t)pfrm->payload().length()); if ((uint64_t)pfrm->payload().size() == pfrm->payloadLength()) { pfrm->setState(TWebSocketFrame::Completed); - tSystemDebug("Parse Completed payload len: %ld", (int64_t)pfrm->payload().size()); + tSystemDebug("Parse Completed payload len: %lld", (int64_t)pfrm->payload().size()); } else { pfrm->setState(TWebSocketFrame::MoreData); - tSystemDebug("Parse MoreData payload len: %ld", (int64_t)pfrm->payload().size()); + tSystemDebug("Parse MoreData payload len: %lld", (int64_t)pfrm->payload().size()); } break; } diff --git a/src/tactioncontext.cpp b/src/tactioncontext.cpp index c6d87014e..15e9546fb 100644 --- a/src/tactioncontext.cpp +++ b/src/tactioncontext.cpp @@ -463,7 +463,7 @@ int64_t TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *bo { header.setContentLength(length); - tSystemDebug("content-length: %ld", (int64_t)header.contentLength()); + tSystemDebug("content-length: %lld", (int64_t)header.contentLength()); header.setRawHeader(QByteArrayLiteral("Server"), QByteArrayLiteral("TreeFrog server")); header.setCurrentDate(); diff --git a/src/tactionthread.cpp b/src/tactionthread.cpp index 9421f6f2a..674389044 100644 --- a/src/tactionthread.cpp +++ b/src/tactionthread.cpp @@ -112,7 +112,7 @@ void TActionThread::run() try { for (;;) { QList requests = readRequest(_httpSocket); - tSystemDebug("HTTP request count: %ld", (int64_t)requests.count()); + tSystemDebug("HTTP request count: %lld", (int64_t)requests.count()); if (requests.isEmpty()) { break; diff --git a/src/test/test.pro b/src/test/test.pro index baad5414e..992efc95a 100644 --- a/src/test/test.pro +++ b/src/test/test.pro @@ -5,9 +5,7 @@ SUBDIRS += mailmessage multipartformdata smtpmailer viewhelper paginator SUBDIRS += fieldnametovariablename rand urlrouter urlrouter2 SUBDIRS += buildtest stack queue forlist SUBDIRS += jscontext compression sqlitedb url malloc -!mac { - SUBDIRS += sharedmemoryhash sharedmemorymutex -} +SUBDIRS += sharedmemoryhash sharedmemorymutex unix { SUBDIRS += redis memcached } diff --git a/src/tkvsdatabasepool.cpp b/src/tkvsdatabasepool.cpp index d9b631b88..3bde44a80 100644 --- a/src/tkvsdatabasepool.cpp +++ b/src/tkvsdatabasepool.cpp @@ -313,7 +313,7 @@ void TKvsDatabasePool::pool(TKvsDatabase &database) if (database.isOpen()) { cachedDatabase[engine].push(database.connectionName()); lastCachedTime[engine].store((uint)std::time(nullptr)); - tSystemDebug("Pooled KVS database: %s count:%ld", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count()); + tSystemDebug("Pooled KVS database: %s count:%lld", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count()); } else { tSystemWarn("Closed KVS database connection, name: %s", qUtf8Printable(database.connectionName())); availableNames[engine].push(database.connectionName()); diff --git a/src/tpublisher.cpp b/src/tpublisher.cpp index 1f9485450..062d791b2 100644 --- a/src/tpublisher.cpp +++ b/src/tpublisher.cpp @@ -168,7 +168,7 @@ void TPublisher::unsubscribeFromAll(TAbstractWebSocket *socket) } } - tSystemDebug("total topics: %ld", (int64_t)pubobj.count()); + tSystemDebug("total topics: %lld", (int64_t)pubobj.count()); } @@ -282,6 +282,6 @@ void TPublisher::release(const QString &topic) Pub *pub = pubobj.take(topic); if (pub) { delete pub; - tSystemDebug("release topic: %s (total topics:%ld)", qUtf8Printable(topic), (int64_t)pubobj.count()); + tSystemDebug("release topic: %s (total topics:%lld)", qUtf8Printable(topic), (int64_t)pubobj.count()); } } diff --git a/src/tredisdriver.cpp b/src/tredisdriver.cpp index 3f0d7f50d..20b72fca2 100644 --- a/src/tredisdriver.cpp +++ b/src/tredisdriver.cpp @@ -46,7 +46,7 @@ bool TRedisDriver::request(const QByteArrayList &command, QVariantList &response for (;;) { if (!readReply()) { - tSystemError("Redis read error pos:%d buflen:%ld", _pos, (int64_t)_buffer.length()); + tSystemError("Redis read error pos:%d buflen:%lld", _pos, (int64_t)_buffer.length()); close(); return false; } diff --git a/src/tsharedmemory_unix.cpp b/src/tsharedmemory_unix.cpp index b1e46c3a1..8598aa328 100644 --- a/src/tsharedmemory_unix.cpp +++ b/src/tsharedmemory_unix.cpp @@ -53,7 +53,7 @@ TSharedMemory::~TSharedMemory() bool TSharedMemory::create(size_t size) { static const header_t INIT_HEADER = []() { - header_t header; + static header_t header; rwlock_init(&header.rwlock); return header; }(); diff --git a/src/tsharedmemoryallocator.cpp b/src/tsharedmemoryallocator.cpp index 7204a9148..85971e296 100644 --- a/src/tsharedmemoryallocator.cpp +++ b/src/tsharedmemoryallocator.cpp @@ -150,7 +150,7 @@ void TSharedMemoryAllocator::setbrk(bool initial) pb_header->endg = _sharedMemory->size(); pb_header->checksum = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size(); } - tSystemDebug("checksum = %lu", pb_header->checksum); + tSystemDebug("checksum = %llu", pb_header->checksum); _origin = pb_header->start() + sizeof(Tf::alloc_header_t); } @@ -427,7 +427,7 @@ void TSharedMemoryAllocator::summary() const } tSystemDebug("-- memory block summary --"); - tSystemDebug("table info: blocks = %d, free = %d, used = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used); + tSystemDebug("table info: blocks = %d, free = %d, used = %llu", countBlocks(), countFreeBlocks(), pb_header->at.used); } // Debug function to print the entire link list @@ -441,7 +441,7 @@ void TSharedMemoryAllocator::dump() const Tf::alloc_header_t *cur = pb_header->alloc_head(); tSystemDebug("-- memory block information --"); - tSystemDebug("table info: blocks = %d, free = %d, used = %lu, free-size = %lu, segment-size = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize()); + tSystemDebug("table info: blocks = %d, free = %d, used = %llu, free-size = %lu, segment-size = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize()); tSystemDebug("block info: head = %p, tail = %p", pb_header->alloc_head(), pb_header->alloc_tail()); while (cur) { tSystemDebug("addr = %p, size = %u, freed = %u, next = %p, prev = %p", diff --git a/src/tsystembus.cpp b/src/tsystembus.cpp index a5399a6f3..34f98c829 100644 --- a/src/tsystembus.cpp +++ b/src/tsystembus.cpp @@ -112,7 +112,7 @@ void TSystemBus::readBus() void TSystemBus::writeBus() { QMutexLocker locker(&mutexWrite); - tSystemDebug("TSystemBus::writeBus len:%ld", (int64_t)sendBuffer.length()); + tSystemDebug("TSystemBus::writeBus len:%lld", (int64_t)sendBuffer.length()); for (;;) { int len = busSocket->write(sendBuffer.data(), sendBuffer.length()); diff --git a/src/twebsocket.cpp b/src/twebsocket.cpp index dcc7d0c73..0623c9317 100644 --- a/src/twebsocket.cpp +++ b/src/twebsocket.cpp @@ -61,7 +61,7 @@ void TWebSocket::close() void TWebSocket::sendTextForPublish(const QString &text, const QObject *except) { - tSystemDebug("sendText text len:%ld (pid:%d)", (int64_t)text.length(), (int)QCoreApplication::applicationPid()); + tSystemDebug("sendText text len:%lld (pid:%d)", (int64_t)text.length(), (int)QCoreApplication::applicationPid()); if (except != this) { TAbstractWebSocket::sendText(text); } @@ -70,7 +70,7 @@ void TWebSocket::sendTextForPublish(const QString &text, const QObject *except) void TWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObject *except) { - tSystemDebug("sendBinary binary len:%ld (pid:%d)", (int64_t)binary.length(), (int)QCoreApplication::applicationPid()); + tSystemDebug("sendBinary binary len:%lld (pid:%d)", (int64_t)binary.length(), (int)QCoreApplication::applicationPid()); if (except != this) { TAbstractWebSocket::sendBinary(binary); } @@ -79,7 +79,7 @@ void TWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObject *e void TWebSocket::sendPong(const QByteArray &data) { - tSystemDebug("sendPong data len:%ld (pid:%d)", (int64_t)data.length(), (int)QCoreApplication::applicationPid()); + tSystemDebug("sendPong data len:%lld (pid:%d)", (int64_t)data.length(), (int)QCoreApplication::applicationPid()); TAbstractWebSocket::sendPong(data); } @@ -98,7 +98,7 @@ bool TWebSocket::canReadRequest() const void TWebSocket::readRequest() { if (myWorkerCounter > 0) { - tSystemWarn("Worker already running (sd:%ld)", (uint64_t)socketDescriptor()); + tSystemWarn("Worker already running (sd:%llu)", (uint64_t)socketDescriptor()); return; } diff --git a/tools/tfmanager/main.cpp b/tools/tfmanager/main.cpp index 8e4748338..cf7b38ead 100644 --- a/tools/tfmanager/main.cpp +++ b/tools/tfmanager/main.cpp @@ -434,7 +434,7 @@ int killTreeFrogProcess(const QString &cmd) SystemBusDaemon::releaseResource(pid); tf_unlink(pidFilePath().toLatin1().data()); tf_unlink(oldPidFilePath().toLatin1().data()); - tSystemInfo("Killed TreeFrog manager process pid:%ld", (int64_t)pid); + tSystemInfo("Killed TreeFrog manager process pid:%lld", (int64_t)pid); TProcessInfo::kill(pids); // kills the server process tSystemInfo("Killed TreeFrog application server processes"); @@ -456,7 +456,7 @@ void showProcessId() { int64_t pid = readPidOfApplication(); if (pid > 0) { - std::printf("%ld\n", pid); + std::printf("%lld\n", (int64_t)pid); } } @@ -587,7 +587,7 @@ int managerMain(int argc, char *argv[]) // Check TreeFrog processes are running int64_t pid = runningApplicationPid(); if (pid > 0) { - std::fprintf(stderr, "Already running pid:%ld\n", pid); + std::fprintf(stderr, "Already running pid:%lld\n", (int64_t)pid); return 1; } diff --git a/tools/tfmanager/systembusdaemon.cpp b/tools/tfmanager/systembusdaemon.cpp index c4b35d171..ff71fb8e5 100644 --- a/tools/tfmanager/systembusdaemon.cpp +++ b/tools/tfmanager/systembusdaemon.cpp @@ -97,7 +97,7 @@ void SystemBusDaemon::readSocket() } QByteArray buf = socket->readAll(); - tSystemDebug("SystemBusDaemon::read len : %ld", (int64_t)buf.size()); + tSystemDebug("SystemBusDaemon::read len : %lld", (int64_t)buf.size()); if (maxServers <= 1) { // do nothing return;