Skip to content

Commit

Permalink
[XrdCl] Fix wrong type of arguments to formatting function
Browse files Browse the repository at this point in the history
- Use %llu instead of %d for size_t
- Use %p format for pointer types instead of 0x%x
  • Loading branch information
amadio committed Nov 26, 2024
1 parent a1bcd44 commit bb6c75b
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 158 deletions.
8 changes: 4 additions & 4 deletions src/XrdCl/XrdClAsyncMsgReader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ namespace XrdCl
if( !st.IsOK() || st.code == suRetry )
return st;

log->Dump( AsyncSockMsg, "[%s] Received message header for 0x%x size: %d",
log->Dump( AsyncSockMsg, "[%s] Received message header for %p size: %d",
strmname.c_str(), inmsg.get(), inmsg->GetCursor() );

ServerResponse *rsp = (ServerResponse*)inmsg->GetBuffer();
if( rsp->hdr.status == kXR_attn )
{
log->Dump( AsyncSockMsg, "[%s] Will readout the attn action code "
"of message 0x%x", strmname.c_str(), inmsg.get() );
"of message %p", strmname.c_str(), inmsg.get() );
inmsg->ReAllocate( 16 ); // header (bytes 8) + action code (8 bytes)
readstage = ReadAttn;
continue;
Expand All @@ -128,7 +128,7 @@ namespace XrdCl
if( inhandler )
{
log->Dump( AsyncSockMsg, "[%s] Will use the raw handler to read body "
"of message 0x%x", strmname.c_str(), inmsg.get() );
"of message %p", strmname.c_str(), inmsg.get() );
//--------------------------------------------------------------
// The next step is to read raw data
//--------------------------------------------------------------
Expand Down Expand Up @@ -260,7 +260,7 @@ namespace XrdCl
//----------------------------------------------------------------
// Report the incoming message
//----------------------------------------------------------------
log->Dump( AsyncSockMsg, "[%s] Received message 0x%x of %d bytes",
log->Dump( AsyncSockMsg, "[%s] Received message %p of %d bytes",
strmname.c_str(), inmsg.get(), inmsgsize );

strm.OnIncoming( substrmnb, std::move( inmsg ), inmsgsize );
Expand Down
4 changes: 2 additions & 2 deletions src/XrdCl/XrdClAsyncMsgWriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace XrdCl
if( !st.IsOK() || st.code == suRetry ) return st;
outmsgsize += wrtcnt;
log->Dump( AsyncSockMsg, "[%s] Wrote %d bytes of raw data of message"
"(0x%x) body.", strmname.c_str(), wrtcnt, outmsg );
"(%p) body.", strmname.c_str(), wrtcnt, outmsg );
}
//----------------------------------------------------------------
// The next step is to finalize the write operation
Expand All @@ -182,7 +182,7 @@ namespace XrdCl
return st;
}

log->Dump( AsyncSockMsg, "[%s] Successfully sent message: %s (0x%x).",
log->Dump( AsyncSockMsg, "[%s] Successfully sent message: %s (%p).",
strmname.c_str(), outmsg->GetObfuscatedDescription().c_str(), outmsg );

strm.OnMessageSent( substrmnb, outmsg, outmsgsize );
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClCopyProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ namespace XrdCl
Log *log = DefaultEnv::GetLog();
std::vector<PropertyList>::iterator it;

log->Debug( UtilityMsg, "CopyProcess: %d jobs to prepare",
log->Debug( UtilityMsg, "CopyProcess: %llu jobs to prepare",
pImpl->pJobProperties.size() );

std::map<std::string, uint32_t> targetFlags;
Expand Down
157 changes: 78 additions & 79 deletions src/XrdCl/XrdClFileStateHandler.cc

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/XrdCl/XrdClFileSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ namespace
//----------------------------------------------------------------------
if( !status->IsOK() )
{
log->Dump( FileSystemMsg, "[0x%x@DeepLocate(%s)] Got error "
log->Dump( FileSystemMsg, "[%p@DeepLocate(%s)] Got error "
"response: %s", this, pPath.c_str(),
status->ToStr().c_str() );

Expand All @@ -317,7 +317,7 @@ namespace
//--------------------------------------------------------------------
if( pFirstTime )
{
log->Debug( FileSystemMsg, "[0x%x@DeepLocate(%s)] Failed to get "
log->Debug( FileSystemMsg, "[%p@DeepLocate(%s)] Failed to get "
"the initial location list: %s", this, pPath.c_str(),
status->ToStr().c_str() );
pHandler->HandleResponse( status, response );
Expand All @@ -334,7 +334,7 @@ namespace
//--------------------------------------------------------------------
if( !pOutstanding )
{
log->Debug( FileSystemMsg, "[0x%x@DeepLocate(%s)] No outstanding "
log->Debug( FileSystemMsg, "[%p@DeepLocate(%s)] No outstanding "
"requests, give out what we've got", this,
pPath.c_str() );
scopedLock.UnLock();
Expand All @@ -352,7 +352,7 @@ namespace
response->Get( info );
LocationInfo::Iterator it;

log->Dump( FileSystemMsg, "[0x%x@DeepLocate(%s)] Got %d locations",
log->Dump( FileSystemMsg, "[%p@DeepLocate(%s)] Got %d locations",
this, pPath.c_str(), info->GetSize() );

for( it = info->Begin(); it != info->End(); ++it )
Expand Down Expand Up @@ -944,7 +944,7 @@ namespace XrdCl
Log *log = DefaultEnv::GetLog();
XrdSysMutexHelper scopedLock( fs->pMutex );

log->Dump( FileSystemMsg, "[0x%x@%s] Sending %s", fs.get(),
log->Dump( FileSystemMsg, "[%p@%s] Sending %s", fs.get(),
fs->pUrl->GetHostId().c_str(), msg->GetObfuscatedDescription().c_str() );

AssignLastURLHandler *lastUrlHandler = new AssignLastURLHandler( fs, handler );
Expand Down Expand Up @@ -980,7 +980,7 @@ namespace XrdCl
if( pLoadBalancerLookupDone )
return;

log->Dump( FileSystemMsg, "[0x%x@%s] Assigning %s as load balancer", this,
log->Dump( FileSystemMsg, "[%p@%s] Assigning %s as load balancer", this,
pUrl->GetHostId().c_str(), url.GetHostId().c_str() );

pUrl.reset( new URL( url ) );
Expand All @@ -995,7 +995,7 @@ namespace XrdCl
Log *log = DefaultEnv::GetLog();
XrdSysMutexHelper scopedLock( pMutex );

log->Dump( FileSystemMsg, "[0x%x@%s] Assigning %s as last URL", this,
log->Dump( FileSystemMsg, "[%p@%s] Assigning %s as last URL", this,
pUrl->GetHostId().c_str(), url.GetHostId().c_str() );

pLastUrl.reset( new URL( url ) );
Expand Down
6 changes: 3 additions & 3 deletions src/XrdCl/XrdClInQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ namespace XrdCl
handler = it->second.first;
act = handler->Examine( msg );
exp = it->second.second;
log->Debug( ExDbgMsg, "[msg: 0x%x] Assigned MsgHandler: 0x%x.",
log->Debug( ExDbgMsg, "[msg: %p] Assigned MsgHandler: %p.",
msg.get(), handler );


if( act & MsgHandler::RemoveHandler )
{
pHandlers.erase( it );
log->Debug( ExDbgMsg, "[handler: 0x%x] Removed MsgHandler: 0x%x from the in-queue.",
log->Debug( ExDbgMsg, "[handler: %p] Removed MsgHandler: %p from the in-queue.",
handler, handler );
}
}
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace XrdCl
XrdSysMutexHelper scopedLock( pMutex );
pHandlers.erase(handlerSid);
Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[handler: 0x%x] Removed MsgHandler: 0x%x from the in-queue.",
log->Debug( ExDbgMsg, "[handler: %p] Removed MsgHandler: %p from the in-queue.",
handler, handler );

}
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClJobManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace XrdCl
}
}
pRunning = true;
log->Debug( JobMgrMsg, "Job manager started, %d workers", pWorkers.size() );
log->Debug( JobMgrMsg, "Job manager started, %llu workers", pWorkers.size() );
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClPollerBuiltIn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ namespace XrdCl
return false;
}

log->Debug( PollerMsg, "Adding socket 0x%x to the poller", socket );
log->Debug( PollerMsg, "Adding socket %p to the poller", socket );

//--------------------------------------------------------------------------
// Check if the socket is already registered
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClSocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ namespace XrdCl
// We have written the message successfully
//----------------------------------------------------------------------
Log *log = DefaultEnv::GetLog();
log->Dump( AsyncSockMsg, "[%s] Wrote a message: %s (0x%x), %d bytes",
log->Dump( AsyncSockMsg, "[%s] Wrote a message: %s (%p), %d bytes",
strmname.c_str(), msg.GetObfuscatedDescription().c_str(),
&msg, msg.GetSize() );
return XRootDStatus();
Expand Down
20 changes: 10 additions & 10 deletions src/XrdCl/XrdClStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ namespace XrdCl
path.up = 0;
}

log->Dump( PostMasterMsg, "[%s] Sending message %s (0x%x) through "
log->Dump( PostMasterMsg, "[%s] Sending message %s (%p) through "
"substream %d expecting answer at %d", pStreamName.c_str(),
msg->GetObfuscatedDescription().c_str(), msg, path.up, path.down );

Expand Down Expand Up @@ -506,7 +506,7 @@ namespace XrdCl
if( !handler )
{
ServerResponse *rsp = (ServerResponse*)msg->GetBuffer();
log->Warning( PostMasterMsg, "[%s] Discarding received message: 0x%x "
log->Warning( PostMasterMsg, "[%s] Discarding received message: %p "
"(status=%d, SID=[%d,%d]), no MsgHandler found.",
pStreamName.c_str(), msg.get(), rsp->hdr.status,
rsp->hdr.streamid[0], rsp->hdr.streamid[1] );
Expand All @@ -516,12 +516,12 @@ namespace XrdCl
//--------------------------------------------------------------------------
// We have a handler, so we call the callback
//--------------------------------------------------------------------------
log->Dump( PostMasterMsg, "[%s] Handling received message: 0x%x.",
log->Dump( PostMasterMsg, "[%s] Handling received message: %p.",
pStreamName.c_str(), msg.get() );

if( action & (MsgHandler::NoProcess|MsgHandler::Ignore) )
{
log->Dump( PostMasterMsg, "[%s] Ignoring the processing handler for: 0x%x.",
log->Dump( PostMasterMsg, "[%s] Ignoring the processing handler for: %s.",
pStreamName.c_str(), msg->GetObfuscatedDescription().c_str() );

// if we are handling partial response we have to take down the timeout fence
Expand Down Expand Up @@ -647,8 +647,8 @@ namespace XrdCl
//------------------------------------------------------------------------
if( pSubStreams.size() > 1 )
{
log->Debug( PostMasterMsg, "[%s] Attempting to connect %d additional "
"streams.", pStreamName.c_str(), pSubStreams.size()-1 );
log->Debug( PostMasterMsg, "[%s] Attempting to connect %llu additional streams.",
pStreamName.c_str(), pSubStreams.size()-1 );
for( size_t i = 1; i < pSubStreams.size(); ++i )
{
pSubStreams[i]->socket->SetAddress( pSubStreams[0]->socket->GetAddress() );
Expand Down Expand Up @@ -745,8 +745,8 @@ namespace XrdCl
// Check if we still have time to try and do something in the current window
//--------------------------------------------------------------------------
time_t elapsed = now-pConnectionInitTime;
log->Error( PostMasterMsg, "[%s] elapsed = %d, pConnectionWindow = %d "
"seconds.", pStreamName.c_str(), elapsed, pConnectionWindow );
log->Error( PostMasterMsg, "[%s] elapsed = %ld, pConnectionWindow = %d seconds.",
pStreamName.c_str(), elapsed, pConnectionWindow );

//------------------------------------------------------------------------
// If we have some IP addresses left we try them
Expand Down Expand Up @@ -775,8 +775,8 @@ namespace XrdCl
else if( elapsed < pConnectionWindow && pConnectionCount < pConnectionRetry
&& !status.IsFatal() )
{
log->Info( PostMasterMsg, "[%s] Attempting reconnection in %d "
"seconds.", pStreamName.c_str(), pConnectionWindow-elapsed );
log->Info( PostMasterMsg, "[%s] Attempting reconnection in %ld seconds.",
pStreamName.c_str(), pConnectionWindow-elapsed );

Task *task = new ::StreamConnectorTask( *pUrl, pStreamName );
pTaskManager->RegisterTask( task, pConnectionInitTime+pConnectionWindow );
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace XrdCl
addrStr += ", ";
}
addrStr.erase( addrStr.length()-2, 2 );
log->Debug( type, "[%s] Found %d address(es): %s",
log->Debug( type, "[%s] Found %llu address(es): %s",
hostId.c_str(), addresses.size(), addrStr.c_str() );
}

Expand Down
18 changes: 9 additions & 9 deletions src/XrdCl/XrdClXRootDMsgHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace XrdCl
{
Log *log = DefaultEnv::GetLog();
log->Warning( ExDbgMsg, "[%s] MsgHandler is examining a response although "
"it already owns a response: 0x%x (message: %s ).",
"it already owns a response: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );
}
Expand Down Expand Up @@ -795,7 +795,7 @@ namespace XrdCl

if( resendTime < pExpiration )
{
log->Debug( ExDbgMsg, "[%s] Scheduling WaitTask for MsgHandler: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] Scheduling WaitTask for MsgHandler: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );

Expand Down Expand Up @@ -906,7 +906,7 @@ namespace XrdCl
log->Dump( XRootDMsg, "[%s] Message %s has been successfully sent.",
pUrl.GetHostId().c_str(), message->GetObfuscatedDescription().c_str() );

log->Debug( ExDbgMsg, "[%s] Moving MsgHandler: 0x%x (message: %s ) from out-queue to in-queue.",
log->Debug( ExDbgMsg, "[%s] Moving MsgHandler: %p (message: %s ) from out-queue to in-queue.",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );

Expand Down Expand Up @@ -1121,7 +1121,7 @@ namespace XrdCl
AnyObject *response = 0;

Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[%s] Calling MsgHandler: 0x%x (message: %s ) "
log->Debug( ExDbgMsg, "[%s] Calling MsgHandler: %p (message: %s ) "
"with status: %s.",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str(),
Expand Down Expand Up @@ -1659,7 +1659,7 @@ namespace XrdCl
//------------------------------------------------------------------------
case kXR_readv:
{
log->Dump( XRootDMsg, "[%s] Parsing the response to 0x%x as "
log->Dump( XRootDMsg, "[%s] Parsing the response to %p as "
"VectorReadInfo", pUrl.GetHostId().c_str(),
pRequest->GetObfuscatedDescription().c_str() );

Expand Down Expand Up @@ -2132,7 +2132,7 @@ namespace XrdCl

if( pUrl.IsMetalink() && pFollowMetalink )
{
log->Debug( ExDbgMsg, "[%s] Metaling redirection for MsgHandler: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] Metaling redirection for MsgHandler: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );

Expand All @@ -2145,7 +2145,7 @@ namespace XrdCl
}
else
{
log->Debug( ExDbgMsg, "[%s] Retry at server MsgHandler: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] Retry at server MsgHandler: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );
return pPostMaster->Send( pUrl, pRequest, this, true, pExpiration );
Expand Down Expand Up @@ -2249,7 +2249,7 @@ namespace XrdCl
else
{
Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[%s] Passing to the thread-pool MsgHandler: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] Passing to the thread-pool MsgHandler: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );
jobMgr->QueueJob( new HandleRspJob( this ), 0 );
Expand All @@ -2262,7 +2262,7 @@ namespace XrdCl
void XRootDMsgHandler::HandleLocalRedirect( URL *url )
{
Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[%s] Handling local redirect - MsgHandler: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] Handling local redirect - MsgHandler: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );

Expand Down
4 changes: 2 additions & 2 deletions src/XrdCl/XrdClXRootDMsgHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace XrdCl
pHasSessionId = true;

Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[%s] MsgHandler created: 0x%x (message: %s ).",
log->Debug( ExDbgMsg, "[%s] MsgHandler created: %p (message: %s ).",
pUrl.GetHostId().c_str(), this,
pRequest->GetObfuscatedDescription().c_str() );

Expand Down Expand Up @@ -222,7 +222,7 @@ namespace XrdCl
pEffectiveDataServerUrl = reinterpret_cast<URL*>( 0xDEADBEEF );

Log *log = DefaultEnv::GetLog();
log->Debug( ExDbgMsg, "[%s] Destroying MsgHandler: 0x%x.",
log->Debug( ExDbgMsg, "[%s] Destroying MsgHandler: %p.",
pUrl.GetHostId().c_str(), this );
}

Expand Down
Loading

0 comments on commit bb6c75b

Please sign in to comment.