Skip to content

Commit

Permalink
fix tc_logger snprintf compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Oct 12, 2023
1 parent a0bdac7 commit fca7031
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions unit-test/rpc/test_async_rpc.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@

#include "hello_test.h"

TEST_F(HelloTest, test)
{
{
HelloServer server;
startServer(server, (TC_EpollServer::SERVER_OPEN_COROUTINE) 1);

stopServer(server);
}
}


TEST_F(HelloTest, rpcASyncGlobalCommunicator)
{
cout << TC_Thread::CURRENT_THREADID() << endl;

{
shared_ptr<Communicator> c = getCommunicator();

transGlobalCommunicator([&](Communicator *comm) {
checkASync(comm);
}, c.get());
}

cout << getFdCounts() << endl;
}


Expand Down
9 changes: 7 additions & 2 deletions util/include/util/tc_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,9 +945,14 @@ namespace tars
if (hasFlag(TC_Logger::HAS_PID))
{
#if __WORDSIZE == 64
n += snprintf(c + n, len - n, "%ld%s", TC_Thread::CURRENT_THREADID(), _sSepar.c_str());

#if TARGET_PLATFORM_IOS
n += snprintf(c + n, len - n, "%llu%s", TC_Thread::CURRENT_THREADID(), _sSepar.c_str());
#else
n += snprintf(c + n, len - n, "%lu%s", TC_Thread::CURRENT_THREADID(), _sSepar.c_str());
#endif
#else
n += snprintf(c + n, len - n, "%lld%s", TC_Thread::CURRENT_THREADID(), _sSepar.c_str());
n += snprintf(c + n, len - n, "%llu%s", TC_Thread::CURRENT_THREADID(), _sSepar.c_str());
#endif
}

Expand Down

0 comments on commit fca7031

Please sign in to comment.