mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
keep old format if there are no nul bytes to print
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38947 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
574c83e0bf
commit
f22f51b4e5
1 changed files with 30 additions and 6 deletions
|
@ -232,19 +232,43 @@ static void
|
|||
debugRead(GSHTTPURLHandle *handle, NSData *data)
|
||||
{
|
||||
unsigned len = (unsigned)[data length];
|
||||
char *esc = [data escapedRepresentation: 0];
|
||||
const char *ptr = (const char*)[data bytes];
|
||||
int pos;
|
||||
|
||||
NSLog(@"Read for %p of %u bytes - '%s'\n%@", handle, len, esc, data);
|
||||
free(esc);
|
||||
for (pos = 0; pos < len; pos++)
|
||||
{
|
||||
if (0 == ptr[pos])
|
||||
{
|
||||
char *esc = [data escapedRepresentation: 0];
|
||||
|
||||
NSLog(@"Read for %p of %u bytes (escaped) - '%s'\n%@",
|
||||
handle, len, esc, data);
|
||||
free(esc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
NSLog(@"Read for %p of %d bytes - '%*.*s'", handle, len, len, len, ptr);
|
||||
}
|
||||
static void
|
||||
debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||
{
|
||||
unsigned len = (unsigned)[data length];
|
||||
char *esc = [data escapedRepresentation: 0];
|
||||
const char *ptr = (const char*)[data bytes];
|
||||
int pos;
|
||||
|
||||
NSLog(@"Write for %p of %u bytes - '%s'\n%@", handle, len, esc, data);
|
||||
free(esc);
|
||||
for (pos = 0; pos < len; pos++)
|
||||
{
|
||||
if (0 == ptr[pos])
|
||||
{
|
||||
char *esc = [data escapedRepresentation: 0];
|
||||
|
||||
NSLog(@"Write for %p of %u bytes (escaped) - '%s'\n%@",
|
||||
handle, len, esc, data);
|
||||
free(esc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
NSLog(@"Write for %p of %d bytes - '%*.*s'", handle, len, len, len, ptr);
|
||||
}
|
||||
|
||||
+ (NSURLHandle*) cachedHandleForURL: (NSURL*)newUrl
|
||||
|
|
Loading…
Reference in a new issue