Author: rfm
Date: Sun Aug 30 12:25:52 2015
New Revision: 38955
URL: http://svn.gna.org/viewcvs/gnustep?rev=38955&view=rev
Log:
fixup for nul termination of debug output
Modified:
libs/base/trunk/Source/GSHTTPURLHandle.m
libs/base/trunk/Source/NSURLProtocol.m
Modified: libs/base/trunk/Source/GSHTTPURLHandle.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSHTTPURLHandle.m?rev=38955&r1=38954&r2=38955&view=diff
==============================================================================
--- libs/base/trunk/Source/GSHTTPURLHandle.m (original)
+++ libs/base/trunk/Source/GSHTTPURLHandle.m Sun Aug 30 12:25:52 2015
@@ -231,7 +231,7 @@
static void
debugRead(GSHTTPURLHandle *handle, NSData *data)
{
- NSUInteger len = [data length];
+ int len = (int)[data length];
const uint8_t *ptr = (const uint8_t*)[data bytes];
uint8_t *hex;
NSUInteger hl;
@@ -240,28 +240,28 @@
hl = ((len + 2) / 3) * 4;
hex = malloc(hl + 1);
hex[hl] = '\0';
- GSPrivateEncodeBase64(ptr, len, hex);
+ GSPrivateEncodeBase64(ptr, (NSUInteger)len, hex);
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<[%*.*s]>",
- handle, (unsigned)len, esc, hex);
+ NSLog(@"Read for %p of %d bytes (escaped) - '%s'\n<[%s]>",
+ handle, len, esc, hex);
free(esc);
free(hex);
return;
}
}
- NSLog(@"Read for %p of %d bytes - '%s'\n<[%*.*s]>",
- handle, (unsigned)len, ptr, hex);
+ NSLog(@"Read for %p of %d bytes - '%*.*s'\n<[%s]>",
+ handle, len, len, len, ptr, hex);
free(hex);
}
static void
debugWrite(GSHTTPURLHandle *handle, NSData *data)
{
- NSUInteger len = [data length];
+ int len = (int)[data length];
const uint8_t *ptr = (const uint8_t*)[data bytes];
uint8_t *hex;
NSUInteger hl;
@@ -270,22 +270,22 @@
hl = ((len + 2) / 3) * 4;
hex = malloc(hl + 1);
hex[hl] = '\0';
- GSPrivateEncodeBase64(ptr, len, hex);
+ GSPrivateEncodeBase64(ptr, (NSUInteger)len, hex);
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<[%s]>",
- handle, (unsigned)len, esc, hex);
+ NSLog(@"Write for %p of %d bytes (escaped) - '%s'\n<[%s]>",
+ handle, len, esc, hex);
free(esc);
free(hex);
return;
}
}
- NSLog(@"Write for %p of %d bytes - '%s'\n<[%s]>",
- handle, (unsigned)len, ptr, hex);
+ NSLog(@"Write for %p of %d bytes - '%*.*s'\n<[%s]>",
+ handle, len, len, len, ptr, hex);
free(hex);
}
Modified: libs/base/trunk/Source/NSURLProtocol.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSURLProtocol.m?rev=38955&r1=38954&r2=38955&view=diff
==============================================================================
--- libs/base/trunk/Source/NSURLProtocol.m (original)
+++ libs/base/trunk/Source/NSURLProtocol.m Sun Aug 30 12:25:52 2015
@@ -69,7 +69,7 @@
#endif
static void
-debugRead(id handle, unsigned len, const unsigned char *ptr)
+debugRead(id handle, int len, const unsigned char *ptr)
{
int pos;
uint8_t *hex;
@@ -78,7 +78,7 @@
hl = ((len + 2) / 3) * 4;
hex = malloc(hl + 1);
hex[hl] = '\0';
- GSPrivateEncodeBase64(ptr, len, hex);
+ GSPrivateEncodeBase64(ptr, (NSUInteger)len, hex);
for (pos = 0; pos < len; pos++)
{
@@ -92,7 +92,7 @@
freeWhenDone: NO];
esc = [data escapedRepresentation: 0];
- NSLog(@"Read for %p of %u bytes (escaped) - '%s'\n<[%s]>",
+ NSLog(@"Read for %p of %d bytes (escaped) - '%s'\n<[%s]>",
handle, len, esc, hex);
free(esc);
RELEASE(data);
@@ -100,11 +100,12 @@
return;
}
}
- NSLog(@"Read for %p of %d bytes - '%s'\n<[%s]>", handle, len, ptr, hex);
+ NSLog(@"Read for %p of %d bytes - '%*.*s'\n<[%s]>",
+ handle, len, len, len, ptr, hex);
free(hex);
}
static void
-debugWrite(id handle, unsigned len, const unsigned char *ptr)
+debugWrite(id handle, int len, const unsigned char *ptr)
{
int pos;
uint8_t *hex;
@@ -113,7 +114,7 @@
hl = ((len + 2) / 3) * 4;
hex = malloc(hl + 1);
hex[hl] = '\0';
- GSPrivateEncodeBase64(ptr, len, hex);
+ GSPrivateEncodeBase64(ptr, (NSUInteger)len, hex);
for (pos = 0; pos < len; pos++)
{
@@ -126,7 +127,7 @@
length: len
freeWhenDone: NO];
esc = [data escapedRepresentation: 0];
- NSLog(@"Write for %p of %u bytes (escaped) - '%s'\n<[%s]>",
+ NSLog(@"Write for %p of %d bytes (escaped) - '%s'\n<[%s]>",
handle, len, esc, hex);
free(esc);
RELEASE(data);
@@ -134,7 +135,8 @@
return;
}
}
- NSLog(@"Write for %p of %d bytes - '%s'\n<[%s]>", handle, len, ptr, hex);
+ NSLog(@"Write for %p of %d bytes - '%*.*s'\n<[%s]>",
+ handle, len, len, len, ptr, hex);
free(hex);
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs