improve diagnostic output

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37272 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-10-22 11:37:01 +00:00
parent f4270e4e0f
commit f8d4ae3dfe

View file

@ -232,15 +232,33 @@ debugRead(GSHTTPURLHandle *handle, NSData *data)
{
int len = (int)[data length];
const char *ptr = (const char*)[data bytes];
int pos;
NSLog(@"Read for %p of %d bytes -'%*.*s'", handle, len, len, len, ptr);
for (pos = 0; pos < len; pos++)
{
if (0 == ptr[pos])
{
NSLog(@"Read for %p of %d bytes - %@", handle, len, data);
return;
}
}
NSLog(@"Read for %p of %d bytes - '%*.*s'", handle, len, len, len, ptr);
}
static void
debugWrite(GSHTTPURLHandle *handle, NSData *data)
{
int len = (int)[data length];
const char *ptr = (const char*)[data bytes];
int pos = len;
for (pos = 0; pos < len; pos++)
{
if (0 == ptr[pos])
{
NSLog(@"Write for %p of %d bytes - %@", handle, len, data);
return;
}
}
NSLog(@"Write for %p of %d bytes -'%*.*s'", handle, len, len, len, ptr);
}