1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 16:08:51 -05:00

Fix UDPSocket's debug output

This commit is contained in:
Perttu Ahola 2012-03-22 13:36:37 +02:00
parent 9bd75d5668
commit 7d0ad0f521

View File

@ -227,7 +227,8 @@ void UDPSocket::Send(const Address & destination, const void * data, int size)
dstream<<", size="<<size<<", data="; dstream<<", size="<<size<<", data=";
for(int i=0; i<size && i<20; i++){ for(int i=0; i<size && i<20; i++){
if(i%2==0) DEBUGPRINT(" "); if(i%2==0) DEBUGPRINT(" ");
DEBUGPRINT("%.2X", ((int)((const char*)data)[i])&0xff); unsigned int a = ((const unsigned char*)data)[i];
DEBUGPRINT("%.2X", a);
} }
if(size>20) if(size>20)
dstream<<"..."; dstream<<"...";
@ -289,7 +290,8 @@ int UDPSocket::Receive(Address & sender, void * data, int size)
dstream<<", size="<<received<<", data="; dstream<<", size="<<received<<", data=";
for(int i=0; i<received && i<20; i++){ for(int i=0; i<received && i<20; i++){
if(i%2==0) DEBUGPRINT(" "); if(i%2==0) DEBUGPRINT(" ");
DEBUGPRINT("%.2X", ((int)((const char*)data)[i])&0xff); unsigned int a = ((const unsigned char*)data)[i];
DEBUGPRINT("%.2X", a);
} }
if(received>20) if(received>20)
dstream<<"..."; dstream<<"...";