Changed the format parameters in some of the debug printf to

be more cross-platform enabled.
This commit is contained in:
Juan Carlos Luciani
2006-11-15 06:32:25 +00:00
parent 0d7915de0e
commit 027e884407
9 changed files with 124 additions and 124 deletions

View File

@@ -90,7 +90,7 @@ SChannel::SChannel(
// L2
//=======================================================================--
{
DbgTrace(1, "SChannel::SChannel- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::SChannel- Start, Obj = %0X\n", this);
// Initialize the mutex
if (pthread_mutex_init(&m_mutex, NULL) != 0)
@@ -123,7 +123,7 @@ SChannel::~SChannel(void)
// L2
//=======================================================================--
{
DbgTrace(1, "SChannel::~SChannel- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::~SChannel- Start, Obj = %0X\n", this);
// Cleanup resources allocated for the object
pthread_mutex_destroy(&m_mutex);
@@ -163,7 +163,7 @@ SChannel::init(void)
int retStatus = -1;
SmartSChannel *pSmartSChannel = NULL;
DbgTrace(1, "SChannel::init- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::init- Start, Obj = %0X\n", this);
// Verify the state of the object
if (m_state == State_Connected)
@@ -187,7 +187,7 @@ SChannel::init(void)
}
else
{
DbgTrace(0, "SChannel::init- Unable to create channel connection thread, error = %08X\n", threadCreateStatus);
DbgTrace(0, "SChannel::init- Unable to create channel connection thread, error = %0X\n", threadCreateStatus);
}
}
catch (...) {
@@ -209,7 +209,7 @@ SChannel::init(void)
delete pSmartSChannel;
}
DbgTrace(1, "SChannel::init- End, status = %08X\n", retStatus);
DbgTrace(1, "SChannel::init- End, status = %0X\n", retStatus);
return retStatus;
@@ -244,7 +244,7 @@ SChannel::connectionThread(
char *pRecvBuff;
ServerReq *pServerReq;
DbgTrace(1, "SChannel::connectionThread- Start, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- Start, Obj = %0X\n", pSChannel);
// Set the thread in the detached state so that it is cleaned up when it exits
pthread_detach(pthread_self());
@@ -255,7 +255,7 @@ SChannel::connectionThread(
// Receive and process channel data
while (!doneReceivingData)
{
DbgTrace(2, "SChannel::connectionThread- Receive Loop, Obj = %08X\n", pSChannel);
DbgTrace(2, "SChannel::connectionThread- Receive Loop, Obj = %0X\n", pSChannel);
// Receive the ReqDataPktHdr. Note, if we add other packet types and if the
// packet types have different header lengths, then we will need to modify
@@ -289,7 +289,7 @@ SChannel::connectionThread(
{
case ChannelProto::ReqDataCarrierPacketType:
DbgTrace(2, "SChannel::connectionThread- Processing Request Data Packet, Obj = %08X\n", pSChannel);
DbgTrace(2, "SChannel::connectionThread- Processing Request Data Packet, Obj = %0X\n", pSChannel);
// Allocate a buffer big enough to receive the payload. Allow space to NULL terminate.
pRecvBuff = new char[payloadLength + 1];
@@ -343,7 +343,7 @@ SChannel::connectionThread(
if (ServiceRequest(pServerReq) != 0)
{
// Failed to start processing of the Request, delete the ServerReq object.
DbgTrace(0, "SChannel::connectionThread- StartRequest failed, Obj = %08X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- StartRequest failed, Obj = %0X\n", pSChannel);
delete pServerReq;
}
else
@@ -353,8 +353,8 @@ SChannel::connectionThread(
}
else
{
//DbgTrace(1, "SChannel::connectionThread- Failed to obtain idle ServerReq, Obj = %08X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- Failed to obtain idle ServerReq, Obj = %08X\n", pSChannel);
//DbgTrace(1, "SChannel::connectionThread- Failed to obtain idle ServerReq, Obj = %0X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- Failed to obtain idle ServerReq, Obj = %0X\n", pSChannel);
}
// Check if we must send an Request Error packet back to the client
@@ -372,14 +372,14 @@ SChannel::connectionThread(
MSG_NOSIGNAL);
if (bytesSent != sizeof(reqErrorPktHdr))
{
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %08X\n", pSChannel);
//printf("SChannel::connectionThread- 1Connection aborted prematurely, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %0X\n", pSChannel);
//printf("SChannel::connectionThread- 1Connection aborted prematurely, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
}
else
{
DbgTrace(0, "SChannel::connectionThread- Error building Req End Pkt Header, Obj = %08X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- Error building Req End Pkt Header, Obj = %0X\n", pSChannel);
}
}
@@ -388,17 +388,17 @@ SChannel::connectionThread(
}
else
{
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %0X\n", pSChannel);
//printf("bytesReceived = %d, payloadLength = %d\n", bytesReceived, payloadLength);
//printf("SChannel::connectionThread- 2Connection aborted prematurely, Obj = %08X\n", pSChannel);
//printf("SChannel::connectionThread- 2Connection aborted prematurely, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
}
else
{
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- Connection aborted prematurely, Obj = %0X\n", pSChannel);
//printf("Socket error = %d\n", errno);
//printf("SChannel::connectionThread- 3Connection aborted prematurely, Obj = %08X\n", pSChannel);
//printf("SChannel::connectionThread- 3Connection aborted prematurely, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
@@ -408,37 +408,37 @@ SChannel::connectionThread(
}
else
{
DbgTrace(0, "SChannel::connectionThread- Unable to allocate receive buffer, Obj = %08X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- Unable to allocate receive buffer, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
break;
default:
DbgTrace(0, "SChannel::connectionThread- Unknown Packet Type, Obj = %08X\n", pSChannel);
DbgTrace(0, "SChannel::connectionThread- Unknown Packet Type, Obj = %0X\n", pSChannel);
doneReceivingData = true;
break;
}
}
else
{
DbgTrace(1, "SChannel::connectionThread- Unable to obtain payload length, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- Unable to obtain payload length, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
}
else
{
DbgTrace(1, "SChannel::connectionThread- The channel connection was terminated, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- The channel connection was terminated, Obj = %0X\n", pSChannel);
//printf("bytesReceived = %d, expected = %d\n", bytesReceived, ReqDataPktHdrTemplate.length());
//printf("SChannel::connectionThread- 4The channel connection was terminated, Obj = %08X\n", pSChannel);
//printf("SChannel::connectionThread- 4The channel connection was terminated, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
}
else
{
DbgTrace(1, "SChannel::connectionThread- The channel connection was aborted, Obj = %08X\n", pSChannel);
DbgTrace(1, "SChannel::connectionThread- The channel connection was aborted, Obj = %0X\n", pSChannel);
//printf("Socket error = %d\n", errno);
//printf("SChannel::connectionThread- 5The channel connection was aborted, Obj = %08X\n", pSChannel);
//printf("SChannel::connectionThread- 5The channel connection was aborted, Obj = %0X\n", pSChannel);
doneReceivingData = true;
}
}
@@ -486,7 +486,7 @@ SChannel::closeChannel(void)
//=======================================================================--
{
DbgTrace(1, "SChannel::closeChannel- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::closeChannel- Start, Obj = %0X\n", this);
// Acquire SChannel mutex
pthread_mutex_lock(&m_mutex);
@@ -543,7 +543,7 @@ SChannel::sendReplyData(
unsigned long totalBytesSent = 0;
unsigned long bytesToSend = sizeof(reqDataPktHdr) + serverDataLen;
DbgTrace(1, "SChannel::sendReplyData- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::sendReplyData- Start, Obj = %0X\n", this);
// Acquire exclusive access to the channel object
pthread_mutex_lock(&m_mutex);
@@ -634,18 +634,18 @@ SChannel::sendReplyData(
}
else
{
DbgTrace(0, "SChannel::sendReplyData- Error building Req Data Pkt Header, Obj = %08X\n", this);
DbgTrace(0, "SChannel::sendReplyData- Error building Req Data Pkt Header, Obj = %0X\n", this);
}
}
else
{
DbgTrace(1, "SChannel::sendReplyData- Channel not connected, state = %08X\n", m_state);
DbgTrace(1, "SChannel::sendReplyData- Channel not connected, state = %0X\n", m_state);
}
// Release exclusive access to the channel object
pthread_mutex_unlock(&m_mutex);
DbgTrace(1, "SChannel::sendReplyData- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "SChannel::sendReplyData- End, retStatus = %0X\n", retStatus);
return retStatus;
@@ -678,7 +678,7 @@ SChannel::sendReplyError(
unsigned long totalBytesSent = 0;
unsigned long bytesToSend = sizeof(reqErrorPktHdr);
DbgTrace(1, "SChannel::sendReplyError- Start, Obj = %08X\n", this);
DbgTrace(1, "SChannel::sendReplyError- Start, Obj = %0X\n", this);
// Acquire exclusive access to the channel object
pthread_mutex_lock(&m_mutex);
@@ -752,18 +752,18 @@ SChannel::sendReplyError(
}
else
{
DbgTrace(0, "SChannel::sendReplyError- Error building Req Data Pkt Header, Obj = %08X\n", this);
DbgTrace(0, "SChannel::sendReplyError- Error building Req Data Pkt Header, Obj = %0X\n", this);
}
}
else
{
DbgTrace(1, "SChannel::sendReplyError- Channel not connected, state = %08X\n", m_state);
DbgTrace(1, "SChannel::sendReplyError- Channel not connected, state = %0X\n", m_state);
}
// Release exclusive access to the channel object
pthread_mutex_unlock(&m_mutex);
DbgTrace(1, "SChannel::sendReplyError- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "SChannel::sendReplyError- End, retStatus = %0X\n", retStatus);
return retStatus;

View File

@@ -178,7 +178,7 @@ ServiceRequest(
// Release server mutex
pthread_mutex_unlock(&serverMutex);
DbgTrace(1, "ServiceRequest- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "ServiceRequest- End, retStatus = %0X\n", retStatus);
return retStatus;
@@ -284,7 +284,7 @@ RemoveFromSChannelList(
list<SChannel*>::iterator iter;
bool objectRemoved = false;
DbgTrace(1, "RemoveFromSChannelList- Start, Obj = %08X\n", pSChannel);
DbgTrace(1, "RemoveFromSChannelList- Start, Obj = %0X\n", pSChannel);
// Obtain server mutex
pthread_mutex_lock(&serverMutex);
@@ -802,7 +802,7 @@ IpcServerGetRequest(void)
exit:
DbgTrace(1, "IpcServerGetRequest- End, requestId = %08X\n", requestId);
DbgTrace(1, "IpcServerGetRequest- End, requestId = %0X\n", requestId);
return requestId;
@@ -839,7 +839,7 @@ IpcServerGetRequestData(
{
int32_t reqDataLen = 0;
DbgTrace(1, "IpcServerGetRequestData- Start, requestId = %08X\n", requestId);
DbgTrace(1, "IpcServerGetRequestData- Start, requestId = %0X\n", requestId);
// Make sure that the service has been started
if (svcStarted)
@@ -873,7 +873,7 @@ IpcServerGetRequestData(
DbgTrace(0, "IpcServerGetRequestData- Service has not been started\n", 0);
}
DbgTrace(1, "IpcServerGetRequestData- End, reqDataLen = %08X\n", reqDataLen);
DbgTrace(1, "IpcServerGetRequestData- End, reqDataLen = %0X\n", reqDataLen);
return reqDataLen;
@@ -903,7 +903,7 @@ IpcServerCompleteRequest(
// L2
//=======================================================================--
{
DbgTrace(1, "IpcServerCompleteRequest- Start, requestId = %08X\n", requestId);
DbgTrace(1, "IpcServerCompleteRequest- Start, requestId = %0X\n", requestId);
// Make sure that the service has been started
if (svcStarted)
@@ -965,7 +965,7 @@ IpcServerAbortRequest(
// L2
//=======================================================================--
{
DbgTrace(1, "IpcServerAbortRequest- Start, requestId = %08X\n", requestId);
DbgTrace(1, "IpcServerAbortRequest- Start, requestId = %0X\n", requestId);
// Make sure that the service has been started
if (svcStarted)
@@ -1047,7 +1047,7 @@ IpcServerStart(void)
(void*)NULL);
if (threadCreateStatus != 0)
{
DbgTrace(0, "IpcServerStart- Unable to create service connections thread, error = %08X\n", threadCreateStatus);
DbgTrace(0, "IpcServerStart- Unable to create service connections thread, error = %0X\n", threadCreateStatus);
retStatus = -1;
}
else
@@ -1063,7 +1063,7 @@ IpcServerStart(void)
DbgTrace(0, "IpcServerStart- Either not initialized or the address has not been set\n", 0);
}
DbgTrace(1, "IpcServerStart- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "IpcServerStart- End, retStatus = %0X\n", retStatus);
return retStatus;
@@ -1133,7 +1133,7 @@ IpcServerSetUnAddress(
exit:
DbgTrace(1, "IpcServerSetUnAddress- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "IpcServerSetUnAddress- End, retStatus = %0X\n", retStatus);
return retStatus;
@@ -1201,7 +1201,7 @@ IpcServerSetInAddress(
exit:
DbgTrace(1, "IpcServerSetInAddress- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "IpcServerSetInAddress- End, retStatus = %0X\n", retStatus);
return retStatus;
@@ -1278,7 +1278,7 @@ IpcServerInit(
exit:
DbgTrace(1, "IpcServerInit- End, retStatus = %08X\n", retStatus);
DbgTrace(1, "IpcServerInit- End, retStatus = %0X\n", retStatus);
return retStatus;

View File

@@ -79,7 +79,7 @@ ServerReq::ServerReq(
// L2
//=======================================================================--
{
DbgTrace(1, "ServerReq::ServerReq- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerReq::ServerReq- Start, Obj = %0X\n", this);
// Create a SmartSChannel object to keep the SChannel object from
// going away while we process the request.
@@ -107,7 +107,7 @@ ServerReq::~ServerReq(void)
// L2
//=======================================================================--
{
DbgTrace(1, "ServerReq::~ServerReq- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerReq::~ServerReq- Start, Obj = %0X\n", this);
// Free any client data that may be hanging around
if (m_pClientData)
@@ -140,7 +140,7 @@ ServerReq::getReqData(
// L2
//=======================================================================--
{
DbgTrace(1, "ServerReq::getReqData- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerReq::getReqData- Start, Obj = %0X\n", this);
#if DEBUG
assert(m_signature == SERVER_REQ_SIGNATURE);
@@ -149,7 +149,7 @@ ServerReq::getReqData(
// Return pointer to the client data
*ppClientData = m_pClientData;
DbgTrace(1, "ServerReq::getReqData- End, reqDataLen = %08X\n", m_clientDataLength);
DbgTrace(1, "ServerReq::getReqData- End, reqDataLen = %0X\n", m_clientDataLength);
return m_clientDataLength;
}
@@ -173,7 +173,7 @@ ServerReq::complete(
{
SChannel *pSChannel = *m_pSmartSChannel;
DbgTrace(1, "ServerReq::complete- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerReq::complete- Start, Obj = %0X\n", this);
#if DEBUG
assert(m_signature == SERVER_REQ_SIGNATURE);
@@ -206,7 +206,7 @@ ServerReq::abort(void)
{
SChannel *pSChannel = *m_pSmartSChannel;
DbgTrace(1, "ServerReq::abort- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerReq::abort- Start, Obj = %0X\n", this);
#if DEBUG
assert(m_signature == SERVER_REQ_SIGNATURE);

View File

@@ -71,7 +71,7 @@ ServerThread::ServerThread(void) :
// L2
//=======================================================================--
{
DbgTrace(1, "ServerThread::ServerThread- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerThread::ServerThread- Start, Obj = %0X\n", this);
// Initialize the condition
if (pthread_cond_init(&m_condition, NULL) != 0)
@@ -104,7 +104,7 @@ ServerThread::~ServerThread(void)
// L2
//=======================================================================--
{
DbgTrace(1, "ServerThread::~ServerThread- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerThread::~ServerThread- Start, Obj = %0X\n", this);
// Cleanup resources allocated for the object
pthread_cond_destroy(&m_condition);
@@ -132,7 +132,7 @@ ServerThread::awaken(void)
// L2
//=======================================================================--
{
DbgTrace(1, "ServerThread::awaken- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerThread::awaken- Start, Obj = %0X\n", this);
#if DEBUG
assert(m_signature == SERVER_THREAD_SIGNATURE);
@@ -162,7 +162,7 @@ ServerThread::suspend(
// L2
//=======================================================================--
{
DbgTrace(1, "ServerThread::suspend- Start, Obj = %08X\n", this);
DbgTrace(1, "ServerThread::suspend- Start, Obj = %0X\n", this);
#if DEBUG
assert(m_signature == SERVER_THREAD_SIGNATURE);