From d960e869cfd548c50fe6cdbe3399b355b0ff3a00 Mon Sep 17 00:00:00 2001 From: mccallum Date: Tue, 23 Jan 1996 22:31:50 +0000 Subject: [PATCH] Use (id ) instead of (char *) where appropriate. ([MemoryStream -writeLine:]): Remove method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@768 72102866-910b-0410-8b05-ffd578937521 --- Source/MemoryStream.m | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Source/MemoryStream.m b/Source/MemoryStream.m index 496e5cd43..e1f21a27c 100644 --- a/Source/MemoryStream.m +++ b/Source/MemoryStream.m @@ -1,5 +1,5 @@ /* Implementation of GNU Objective C memory stream - Copyright (C) 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Written by: R. Andrew McCallum Date: July 1994 @@ -144,14 +144,7 @@ static BOOL debug_memory_stream = NO; return l; } -- (void) writeLine: (const char *)l -{ - [self writeBytes:l length:strlen(l)]; - [self writeBytes:"\n" length:1]; -} - -/* This malloc's the buffer pointed to by the return value */ -- (char *) readLine +- (id ) readLine { char *nl = memchr(buffer+prefix+position, '\n', eofPosition-position); char *ret = NULL; @@ -163,7 +156,7 @@ static BOOL debug_memory_stream = NO; ret[len] = '\0'; position += len+1; } - return ret; + return [NSString stringWithCStringNoCopy:ret]; } /* Making these nested functions (which is what I'd like to do) is @@ -193,7 +186,7 @@ void unchar_func(void *s, int c) } #if HAVE_VSPRINTF -- (int) writeFormat: (const char *)format, ... +- (int) writeFormat: (id )format, ... { int ret; va_list ap; @@ -207,7 +200,7 @@ void unchar_func(void *s, int c) [self setStreamBufferCapacity:size*2]; va_start(ap, format); - ret = vsprintf(buffer+prefix+position, format, ap); + ret = vsprintf(buffer+prefix+position, [format cStringNoCopy], ap); va_end(ap); position += ret; /* xxx Make sure we didn't overrun our buffer. @@ -226,13 +219,14 @@ void unchar_func(void *s, int c) } #endif -- (int) readFormat: (const char *)format, ... +- (int) readFormat: (id )format, ... { int ret; va_list ap; va_start(ap, format); - ret = objects_vscanf(self, inchar_func, unchar_func, format, ap); + ret = objects_vscanf(self, inchar_func, unchar_func, + [format cStringNoCopy], ap); va_end(ap); return ret; }