Skip to content

Commit fea0455

Browse files
Merge pull request #403 from treefrogframework/bugfix_mac
Bugfix of tsharedmemory initiation on mac
2 parents 004c983 + 763af9d commit fea0455

13 files changed

+26
-28
lines changed

src/tabstractwebsocket.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool TAbstractWebSocket::searchEndpoint(const THttpRequestHeader &header)
167167

168168
int TAbstractWebSocket::parse(QByteArray &recvData)
169169
{
170-
tSystemDebug("parse enter data len:%ld sid:%lld", (int64_t)recvData.length(), socketDescriptor());
170+
tSystemDebug("parse enter data len:%lld sid:%lld", (int64_t)recvData.length(), socketDescriptor());
171171
if (websocketFrames().isEmpty()) {
172172
websocketFrames().append(TWebSocketFrame());
173173
} else {
@@ -259,7 +259,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
259259
}
260260

261261
tSystemDebug("WebSocket parse header pos: %lld", devhdr->pos());
262-
tSystemDebug("WebSocket payload length:%ld", pfrm->payloadLength());
262+
tSystemDebug("WebSocket payload length:%lld", pfrm->payloadLength());
263263

264264
int hdrlen = hdr.length() - devhdr->bytesAvailable();
265265
ds.skipRawData(hdrlen); // Forwards the pos
@@ -269,7 +269,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
269269
case TWebSocketFrame::HeaderParsed: // fall through
270270
case TWebSocketFrame::MoreData: {
271271
tSystemDebug("WebSocket reading payload: available length:%lld", dev->bytesAvailable());
272-
tSystemDebug("WebSocket parsing length to read:%lu current buf len:%ld", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
272+
tSystemDebug("WebSocket parsing length to read:%llu current buf len:%lld", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
273273
uint64_t size = std::min((uint64_t)(pfrm->payloadLength() - pfrm->payload().size()), (uint64_t)dev->bytesAvailable());
274274
if (Q_UNLIKELY(size == 0)) {
275275
Q_ASSERT(0);
@@ -293,14 +293,14 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
293293
}
294294
}
295295
pfrm->payload().resize(pfrm->payload().size() + size);
296-
tSystemDebug("WebSocket payload curent buf len: %ld", (int64_t)pfrm->payload().length());
296+
tSystemDebug("WebSocket payload curent buf len: %lld", (int64_t)pfrm->payload().length());
297297

298298
if ((uint64_t)pfrm->payload().size() == pfrm->payloadLength()) {
299299
pfrm->setState(TWebSocketFrame::Completed);
300-
tSystemDebug("Parse Completed payload len: %ld", (int64_t)pfrm->payload().size());
300+
tSystemDebug("Parse Completed payload len: %lld", (int64_t)pfrm->payload().size());
301301
} else {
302302
pfrm->setState(TWebSocketFrame::MoreData);
303-
tSystemDebug("Parse MoreData payload len: %ld", (int64_t)pfrm->payload().size());
303+
tSystemDebug("Parse MoreData payload len: %lld", (int64_t)pfrm->payload().size());
304304
}
305305
break;
306306
}

src/tactioncontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ int64_t TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *bo
463463
{
464464

465465
header.setContentLength(length);
466-
tSystemDebug("content-length: %ld", (int64_t)header.contentLength());
466+
tSystemDebug("content-length: %lld", (int64_t)header.contentLength());
467467
header.setRawHeader(QByteArrayLiteral("Server"), QByteArrayLiteral("TreeFrog server"));
468468
header.setCurrentDate();
469469

src/tactionthread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void TActionThread::run()
112112
try {
113113
for (;;) {
114114
QList<THttpRequest> requests = readRequest(_httpSocket);
115-
tSystemDebug("HTTP request count: %ld", (int64_t)requests.count());
115+
tSystemDebug("HTTP request count: %lld", (int64_t)requests.count());
116116

117117
if (requests.isEmpty()) {
118118
break;

src/test/test.pro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ SUBDIRS += mailmessage multipartformdata smtpmailer viewhelper paginator
55
SUBDIRS += fieldnametovariablename rand urlrouter urlrouter2
66
SUBDIRS += buildtest stack queue forlist
77
SUBDIRS += jscontext compression sqlitedb url malloc
8-
!mac {
9-
SUBDIRS += sharedmemoryhash sharedmemorymutex
10-
}
8+
SUBDIRS += sharedmemoryhash sharedmemorymutex
119
unix {
1210
SUBDIRS += redis memcached
1311
}

src/tkvsdatabasepool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void TKvsDatabasePool::pool(TKvsDatabase &database)
313313
if (database.isOpen()) {
314314
cachedDatabase[engine].push(database.connectionName());
315315
lastCachedTime[engine].store((uint)std::time(nullptr));
316-
tSystemDebug("Pooled KVS database: %s count:%ld", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count());
316+
tSystemDebug("Pooled KVS database: %s count:%lld", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count());
317317
} else {
318318
tSystemWarn("Closed KVS database connection, name: %s", qUtf8Printable(database.connectionName()));
319319
availableNames[engine].push(database.connectionName());

src/tpublisher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void TPublisher::unsubscribeFromAll(TAbstractWebSocket *socket)
168168
}
169169
}
170170

171-
tSystemDebug("total topics: %ld", (int64_t)pubobj.count());
171+
tSystemDebug("total topics: %lld", (int64_t)pubobj.count());
172172
}
173173

174174

@@ -282,6 +282,6 @@ void TPublisher::release(const QString &topic)
282282
Pub *pub = pubobj.take(topic);
283283
if (pub) {
284284
delete pub;
285-
tSystemDebug("release topic: %s (total topics:%ld)", qUtf8Printable(topic), (int64_t)pubobj.count());
285+
tSystemDebug("release topic: %s (total topics:%lld)", qUtf8Printable(topic), (int64_t)pubobj.count());
286286
}
287287
}

src/tredisdriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ bool TRedisDriver::request(const QByteArrayList &command, QVariantList &response
4646

4747
for (;;) {
4848
if (!readReply()) {
49-
tSystemError("Redis read error pos:%d buflen:%ld", _pos, (int64_t)_buffer.length());
49+
tSystemError("Redis read error pos:%d buflen:%lld", _pos, (int64_t)_buffer.length());
5050
close();
5151
return false;
5252
}

src/tsharedmemory_unix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TSharedMemory::~TSharedMemory()
5353
bool TSharedMemory::create(size_t size)
5454
{
5555
static const header_t INIT_HEADER = []() {
56-
header_t header;
56+
static header_t header;
5757
rwlock_init(&header.rwlock);
5858
return header;
5959
}();

src/tsharedmemoryallocator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void TSharedMemoryAllocator::setbrk(bool initial)
150150
pb_header->endg = _sharedMemory->size();
151151
pb_header->checksum = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size();
152152
}
153-
tSystemDebug("checksum = %lu", pb_header->checksum);
153+
tSystemDebug("checksum = %llu", pb_header->checksum);
154154

155155
_origin = pb_header->start() + sizeof(Tf::alloc_header_t);
156156
}
@@ -427,7 +427,7 @@ void TSharedMemoryAllocator::summary() const
427427
}
428428

429429
tSystemDebug("-- memory block summary --");
430-
tSystemDebug("table info: blocks = %d, free = %d, used = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used);
430+
tSystemDebug("table info: blocks = %d, free = %d, used = %llu", countBlocks(), countFreeBlocks(), pb_header->at.used);
431431
}
432432

433433
// Debug function to print the entire link list
@@ -441,7 +441,7 @@ void TSharedMemoryAllocator::dump() const
441441
Tf::alloc_header_t *cur = pb_header->alloc_head();
442442

443443
tSystemDebug("-- memory block information --");
444-
tSystemDebug("table info: blocks = %d, free = %d, used = %lu, free-size = %lu, segment-size = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize());
444+
tSystemDebug("table info: blocks = %d, free = %d, used = %llu, free-size = %lu, segment-size = %lu", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize());
445445
tSystemDebug("block info: head = %p, tail = %p", pb_header->alloc_head(), pb_header->alloc_tail());
446446
while (cur) {
447447
tSystemDebug("addr = %p, size = %u, freed = %u, next = %p, prev = %p",

src/tsystembus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void TSystemBus::readBus()
112112
void TSystemBus::writeBus()
113113
{
114114
QMutexLocker locker(&mutexWrite);
115-
tSystemDebug("TSystemBus::writeBus len:%ld", (int64_t)sendBuffer.length());
115+
tSystemDebug("TSystemBus::writeBus len:%lld", (int64_t)sendBuffer.length());
116116

117117
for (;;) {
118118
int len = busSocket->write(sendBuffer.data(), sendBuffer.length());

0 commit comments

Comments
 (0)