Removed references to cStringNoCopy.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2990 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-09-30 07:42:38 +00:00
parent 1a0efaad7c
commit 0806cb068b
27 changed files with 143 additions and 149 deletions

View file

@ -1,3 +1,34 @@
Wed Sep 30 9:05:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/dwrite.m: Removed references to cStringNoCopy
* src/BinaryTree.m: Removed references to cStringNoCopy
* src/Collection.m: Removed references to cStringNoCopy
* src/Encoder.m: Removed references to cStringNoCopy
* src/KeyedCollection.m: Removed references to cStringNoCopy
* src/MemoryStream.m: Removed references to cStringNoCopy
* src/NSCalendarDate.m: Removed references to cStringNoCopy
* src/NSData.m: Removed references to cStringNoCopy
* src/NSGCString.m: Removed references to cStringNoCopy
* src/NSGString.m: Removed references to cStringNoCopy
* src/NSHashTable.m: Removed references to cStringNoCopy
* src/NSLog.m: Removed references to cStringNoCopy
* src/NSMapTable.m: Removed references to cStringNoCopy
* src/NSPortCoder.m: Removed references to cStringNoCopy
* src/NSString.m: Removed references to cStringNoCopy
* src/NSTimeZone.m: Removed references to cStringNoCopy
* src/NSUser.m: Removed references to cStringNoCopy
* src/NSZone.m: Removed references to cStringNoCopy
* src/StdioStream.m: Removed references to cStringNoCopy
* src/Stream.m: Removed references to cStringNoCopy
* src/TextCStream.m: Removed references to cStringNoCopy
* src/UdpPort.m: Removed references to cStringNoCopy
* src/UnixFileHandle.m: Removed references to cStringNoCopy
* src/lex.pl.m: Removed references to cStringNoCopy
* src/lex.sf.m: Removed references to cStringNoCopy
* src/mframe.m: Removed references to cStringNoCopy
* src/o_hash.m: Removed references to cStringNoCopy
* src/o_x_base.m.in: Removed references to cStringNoCopy
Tue Sep 29 13:05:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/include/Foundation.h: Added some missing files.

View file

@ -473,7 +473,7 @@ static id nilBinaryTreeNode;
- _tmpPrintFromNode: aNode indent: (int)count
{
printf("%-*s", count, "");
printf("%s\n", [[aNode description] cStringNoCopy]);
printf("%s\n", [[aNode description] cString]);
printf("%-*s.", count, "");
if ([aNode leftNode] != [self nilNode])
[self _tmpPrintFromNode:[aNode leftNode] indent:count+2];

View file

@ -589,7 +589,7 @@
id o;
FOR_COLLECTION(self, o)
{
printf("%s ", [[o description] cStringNoCopy]);
printf("%s ", [[o description] cString]);
}
END_FOR_COLLECTION(self);
printf(": %s\n", object_get_class_name (self));

View file

@ -855,7 +855,7 @@ my_object_is_class(id object)
#if 0
if (classname_2_classname)
return NSMapGet (classname_2_classname, [trueName cStringNoCopy]);
return NSMapGet (classname_2_classname, [trueName cString]);
return trueName;
#endif
}

View file

@ -231,9 +231,7 @@
FOR_KEYED_COLLECTION(self, o, k)
{
[s appendFormat: @"(%s,%s) ",
[[k description] cStringNoCopy],
[[o description] cStringNoCopy]];
[s appendFormat: @"(%@,%@) ", [k description], [o description]];
}
END_FOR_KEYED_COLLECTION(self);
[s appendFormat: @" :%s\n", object_get_class_name (self)];

View file

@ -319,7 +319,7 @@ void unchar_func(void *s, int c)
[data setLength: size];
ret = VSPRINTF_LENGTH (vsprintf([data mutableBytes]+prefix+position,
[format cStringNoCopy], arg));
[format cString], arg));
position += ret;
/* xxx Make sure we didn't overrun our buffer.
As per above kludge, this would happen if we happen to have more than
@ -345,7 +345,7 @@ void unchar_func(void *s, int c)
va_start(ap, format);
ret = o_vscanf(self, inchar_func, unchar_func,
[format cStringNoCopy], ap);
[format cString], ap);
va_end(ap);
return ret;
}

View file

@ -941,7 +941,7 @@ static id long_day[7] = {@"Sunday",
case 'Z':
++i;
k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%s",
[[time_zone timeZoneAbbreviation] cStringNoCopy]));
[[time_zone timeZoneAbbreviation] cString]));
j += k;
break;

View file

@ -141,7 +141,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
goto failure;
}
tmp = malloc(fileLength);
tmp = objc_malloc(fileLength);
if (tmp == 0)
{
NSLog(@"Malloc failed for file of length %d- %s",
@ -173,7 +173,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
/* Just in case the failure action needs to be changed. */
failure:
if (tmp)
free(tmp);
objc_free(tmp);
if (theFile)
fclose(theFile);
return NO;
@ -394,7 +394,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
format: @"Range: (%u, %u) Size: %d",
aRange.location, aRange.length, l];
buffer = malloc(aRange.length);
buffer = objc_malloc(aRange.length);
if (buffer == 0)
[NSException raise:NSMallocException
format:@"No memory for subdata of NSData object"];
@ -797,7 +797,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
- (void*) relinquishAllocatedBytes
{
return 0; /* No data from malloc - return nul pointer */
return 0; /* No data from objc_malloc - return nul pointer */
}
@end
@ -1186,7 +1186,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
{
if (bytes)
{
free(bytes);
objc_free(bytes);
bytes = 0;
length = 0;
}
@ -1210,7 +1210,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
if (aBuffer != 0 && bufferSize > 0)
{
tmp = malloc(bufferSize);
tmp = objc_malloc(bufferSize);
if (tmp == 0)
{
NSLog(@"[NSDataMalloc -initWithBytes:length:] unable to allocate %lu bytes", bufferSize);
@ -1238,7 +1238,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
}
else
if (aBuffer)
free(aBuffer);
objc_free(aBuffer);
return self;
}
@ -1248,7 +1248,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
void* b;
[aCoder decodeValueOfObjCType:"I" at: &l];
b = malloc(l);
b = objc_malloc(l);
if (b == 0)
{
NSLog(@"[NSDataMalloc -initWithCode:] unable to allocate %lu bytes", l);
@ -1544,7 +1544,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
{
if (bytes)
{
free(bytes);
objc_free(bytes);
bytes = 0;
length = 0;
capacity = 0;
@ -1592,7 +1592,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
}
else
if (aBuffer)
free(aBuffer);
objc_free(aBuffer);
return self;
}
@ -1606,7 +1606,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
{
if (size)
{
bytes = malloc(size);
bytes = objc_malloc(size);
if (bytes == 0)
{
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory for %u bytes - %s", size, strerror(errno));
@ -1696,9 +1696,9 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
void* tmp;
if (bytes)
tmp = realloc(bytes, size);
tmp = objc_realloc(bytes, size);
else
tmp = malloc(size);
tmp = objc_malloc(size);
if (tmp == 0)
[NSException raise:NSMallocException

View file

@ -24,10 +24,10 @@
#include <config.h>
#include <gnustep/base/preface.h>
#include <Foundation/NSString.h>
#include <Foundation/NSData.h>
#include <gnustep/base/NSString.h>
#include <gnustep/base/IndexedCollection.h>
#include <gnustep/base/IndexedCollectionPrivate.h>
#include <gnustep/base/MallocAddress.h>
#include <Foundation/NSValue.h>
#include <gnustep/base/behavior.h>
/* memcpy(), strlen(), strcmp() are gcc builtin's */
@ -144,7 +144,7 @@ static Class mutableClass;
OBJC_MALLOC(r, char, _count+1);
memcpy(r, _contents_chars, _count);
r[_count] = '\0';
[[[MallocAddress alloc] initWithAddress:r] autorelease];
[NSData dataWithBytesNoCopy:r length: _count+1];
return r;
}
@ -303,7 +303,7 @@ static Class mutableClass;
- (id) initWithString: (NSString*)string
{
return [self initWithCString:[string cStringNoCopy]];
return [self initWithCString:[string cString]];
}
@end
@ -399,7 +399,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
OBJC_REALLOC(_contents_chars, char, _capacity+1);
}
stringIncrementCountAndMakeHoleAt((NSGMutableCStringStruct*)self, index, c);
memcpy(_contents_chars + index, [aString cStringNoCopy], c);
[aString getCString: _contents_chars + index];
_contents_chars[_count] = '\0';
}
@ -411,7 +411,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
_capacity = MAX(_capacity*2, _count+c);
OBJC_REALLOC(_contents_chars, char, _capacity+1);
}
memcpy(_contents_chars + _count, [aString cStringNoCopy], c);
[aString getCString: _contents_chars + _count];
_count += c;
_contents_chars[_count] = '\0';
_hash = 0;
@ -419,28 +419,13 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
- (void) setString: (NSString*)aString
{
const char *s = [aString cStringNoCopy];
unsigned length = strlen(s);
unsigned length = [aString cStringLength];
if (_capacity < length)
{
_capacity = length;
OBJC_REALLOC(_contents_chars, char, _capacity+1);
}
memcpy(_contents_chars, s, length);
_contents_chars[length] = '\0';
_count = length;
_hash = 0;
}
/* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length
{
if (_capacity < length)
{
_capacity = length;
OBJC_REALLOC(_contents_chars, char, _capacity+1);
}
memcpy(_contents_chars, byteString, length);
[aString getCString: _contents_chars];
_contents_chars[length] = '\0';
_count = length;
_hash = 0;

View file

@ -4,7 +4,7 @@
Written by Stevo Crvenkovski <stevo@btinternet.com>
Date: February 1997
Based on NSGCSting and NSString
Based on NSGCString and NSString
Written by: Andrew Kachites McCallum
<mccallum@gnu.ai.mit.edu>
Date: March 1995
@ -29,12 +29,10 @@
#include <config.h>
#include <gnustep/base/preface.h>
#include <Foundation/NSString.h>
#include <gnustep/base/NSString.h>
#include <Foundation/NSGString.h>
#include <gnustep/base/NSGString.h>
#include <Foundation/NSData.h>
#include <gnustep/base/IndexedCollection.h>
#include <gnustep/base/IndexedCollectionPrivate.h>
#include <gnustep/base/MallocAddress.h>
#include <Foundation/NSValue.h>
#include <gnustep/base/behavior.h>
#include <gnustep/base/NSGSequence.h>
@ -156,7 +154,7 @@
if (_count > 0)
ustrtostr(r,_contents_chars, _count);
r[_count] = '\0';
[[[MallocAddress alloc] initWithAddress:r] autorelease];
[NSData dataWithBytesNoCopy: r length: _count+1];
return r;
}
@ -199,7 +197,7 @@
OBJC_MALLOC(r, char, _count+1);
ustrtostr(r,_contents_chars, _count);
r[_count] = '\0';
[[[MallocAddress alloc] initWithAddress:r] autorelease];
[NSData dataWithBytesNoCopy: r length: _count+1];
return r;
}
// #endif /* NO_GNUSTEP */
@ -437,21 +435,6 @@ stringDecrementCountAndFillHoleAt(NSGMutableStringStruct *self,
// ************ Stuff from NSGCString *********
/* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length
{
if (_capacity < length)
{
_capacity = length;
if (_capacity < 2)
_capacity = 2;
OBJC_REALLOC(_contents_chars, unichar, _capacity);
}
strtoustr(_contents_chars, byteString, length);
_count = length;
_hash = 0;
}
/* Override NSString's designated initializer for CStrings. */
- (id) initWithCStringNoCopy: (char*)byteString
length: (unsigned int)length

View file

@ -304,7 +304,7 @@ NSHashInsertKnownAbsent(NSHashTable *table, const void *element)
* date. */
[NSException raise:NSInvalidArgumentException
format:@"NSHashTable: illegal reinsertion of: %s",
[NSHT_DESCRIBE(table, element) cStringNoCopy]];
[NSHT_DESCRIBE(table, element) cString]];
}
else
{
@ -358,7 +358,7 @@ NSStringFromHashTable(NSHashTable *table)
* each to the mutable string STRING. */
while ((pointer = NSNextHashEnumeratorItem(&enumerator)) != 0)
[string appendFormat:@"%s;\n",
[NSHT_DESCRIBE(table, pointer) cStringNoCopy]];
[NSHT_DESCRIBE(table, pointer) cString]];
/* STRING is already autoreleased. */
return (NSString *) string;

View file

@ -37,7 +37,7 @@ NSLog_printf_handler *_NSLog_printf_handler;
static void
_NSLog_standard_printf_handler (NSString* message)
{
fprintf (stderr, [message cStringNoCopy]);
fprintf (stderr, [message cString]);
}
void

View file

@ -398,8 +398,8 @@ NSMapInsertKnownAbsent(NSMapTable *table, const void *key, const void *value)
* date. */
[NSException raise:NSInvalidArgumentException
format:@"NSMapTable: illegal reinsertion of: %s -> %s",
[NSMT_DESCRIBE_KEY(table, key) cStringNoCopy],
[NSMT_DESCRIBE_VALUE(table, value) cStringNoCopy]];
[NSMT_DESCRIBE_KEY(table, key) cString],
[NSMT_DESCRIBE_VALUE(table, value) cString]];
}
else
{
@ -445,8 +445,8 @@ NSStringFromMapTable(NSMapTable *table)
* descriptions to the string. */
while (NSNextMapEnumeratorPair(&enumerator, &key, &value))
[string appendFormat:@"%@ = %@;",
[(keyCallBacks.describe)(table, key) cStringNoCopy],
[(valueCallBacks.describe)(table, value) cStringNoCopy]];
[(keyCallBacks.describe)(table, key) cString],
[(valueCallBacks.describe)(table, value) cString]];
/* Note that this string'll need to be `retain'ed. */
return string;

View file

@ -116,7 +116,7 @@ static BOOL debug_connected_coder = NO;
if (debug_connected_coder)
fprintf(stderr, "dismiss 0x%x: #=%d i=%d write failed - %s\n",
(unsigned)self, sequence_number, identifier,
[[localException reason] cStringNoCopy]);
[[localException reason] cString]);
if ([[connection sendPort] isValid])
[[connection sendPort] invalidate];
}

View file

@ -58,7 +58,6 @@
#include <fcntl.h>
#include <stdio.h>
#include <gnustep/base/MallocAddress.h>
#include <gnustep/base/behavior.h>
#include <gnustep/base/NSGSequence.h>
@ -210,7 +209,7 @@ handle_printf_atsign (FILE *stream,
#endif
len = fprintf(stream, "%*s",
(info->left ? - info->width : info->width),
[[string_object description] cStringNoCopy]);
[[string_object description] cString]);
return len;
}
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
@ -380,7 +379,7 @@ handle_printf_atsign (FILE *stream,
arguments: (va_list)arg_list
{
#if HAVE_VSPRINTF
const char *format_cp = [format cStringNoCopy];
const char *format_cp = [format cString];
int format_len = strlen (format_cp);
/* xxx horrible disgusting BUFFER_EXTRA arbitrary limit; fix this! */
#define BUFFER_EXTRA 1024*500
@ -455,7 +454,7 @@ handle_printf_atsign (FILE *stream,
format_to_go = spec_pos+1;
}
/* Get a C-string (char*) from the String object, and print it. */
cstring = [[(id) va_arg (arg_list, id) description] cStringNoCopy];
cstring = [[(id) va_arg (arg_list, id) description] cString];
if (!cstring)
cstring = "<null string>";
strcat (buf+printed_len, cstring);
@ -1261,7 +1260,7 @@ handle_printf_atsign (FILE *stream,
{
id obj;
void *bufstate;
bufstate = (void *)pl_scan_string([self cStringNoCopy]);
bufstate = (void *)pl_scan_string([self cString]);
obj = (id)plparse();
pl_delete_buffer(bufstate);
return obj;
@ -1273,7 +1272,7 @@ handle_printf_atsign (FILE *stream,
id dict = [[[NSMutableDictionary alloc] init] autorelease];
void *bufstate;
bufstate = (void *)sf_scan_string([self cStringNoCopy]);
bufstate = (void *)sf_scan_string([self cString]);
sfSetDict(dict);
sfparse(dict);
sf_delete_buffer(bufstate);
@ -1949,17 +1948,17 @@ else
- (double) doubleValue
{
return atof([self cStringNoCopy]);
return atof([self cString]);
}
- (float) floatValue
{
return (float) atof([self cStringNoCopy]);
return (float) atof([self cString]);
}
- (int) intValue
{
return atoi([self cStringNoCopy]);
return atoi([self cString]);
}
// Working With Encodings
@ -2097,7 +2096,7 @@ else
- (BOOL)getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)size
{
const char* ptr = [self cStringNoCopy];
const char* ptr = [self cString];
if (strlen(ptr) > size)
return NO;
strcpy(buffer, ptr);
@ -2520,7 +2519,7 @@ else
if ([self length] == 0 ||
[self rangeOfCharacterFromSet: quotables].length > 0) {
const char *cstring = [self cStringNoCopy];
const char *cstring = [self cString];
const char *from;
int len = 0;
@ -2640,12 +2639,6 @@ else
return [super allocWithZone:z];
}
/* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length
{
[self subclassResponsibility:_cmd];
}
// Creating Temporary Strings
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity
@ -2668,12 +2661,12 @@ else
return [self stringWithCString:byteString length:strlen(byteString)];
}
+ (NSString*) stringWithCString: (const char*)bytes
length:(unsigned)length
+ (NSString*) stringWithCString: (const char*)byteString
length: (unsigned int)length
{
id n = [[self alloc] initWithCapacity:length];
[n setCString:bytes length:length];
return n;
return [[[self alloc]
initWithCString:byteString length:length]
autorelease];
}
/* xxx Change this when we have non-CString classes */

View file

@ -544,7 +544,7 @@ decode (const void *ptr)
if (f)
{
fp = fopen([f cStringNoCopy], "r");
fp = fopen([f cString], "r");
if (fp != NULL)
{
if (fscanf(fp, "%79s", zone_name) == 1)
@ -645,8 +645,8 @@ decode (const void *ptr)
/* Make sure that only time zone files are accessed.
FIXME: Make this more robust. */
if ([aTimeZoneName length] == 0
|| ([aTimeZoneName cStringNoCopy])[0] == '/'
|| strchr([aTimeZoneName cStringNoCopy], '.') != NULL)
|| ([aTimeZoneName cString])[0] == '/'
|| strchr([aTimeZoneName cString], '.') != NULL)
{
NSLog(@"Disallowed time zone name `%@'.", aTimeZoneName);
[zone_mutex unlock];
@ -658,7 +658,7 @@ decode (const void *ptr)
/* Open file. */
fileName = [NSTimeZone getTimeZoneFile: aTimeZoneName];
file = fopen([fileName cStringNoCopy], "rb");
file = fopen([fileName cString], "rb");
if (file == NULL)
[NSException raise: fileException format: errMess];
@ -779,7 +779,7 @@ decode (const void *ptr)
/* Read dictionary from file. */
abbreviationDictionary = [[NSMutableDictionary alloc] init];
fileName = [NSTimeZone getAbbreviationFile];
file = fopen([fileName cStringNoCopy], "r");
file = fopen([fileName cString], "r");
if (file == NULL)
[NSException
raise: NSInternalInconsistencyException
@ -826,7 +826,7 @@ decode (const void *ptr)
temp_array[i] = [[NSMutableArray alloc] init];
fileName = [NSTimeZone getRegionsFile];
file = fopen([fileName cStringNoCopy], "r");
file = fopen([fileName cString], "r");
if (file == NULL)
[NSException
raise: NSInternalInconsistencyException

View file

@ -82,7 +82,7 @@ NSHomeDirectoryForUser (NSString *login_name)
{
#if !defined(__WIN32__) && !defined(_WIN32)
struct passwd *pw;
pw = getpwnam ([login_name cStringNoCopy]);
pw = getpwnam ([login_name cString]);
return [NSString stringWithCString: pw->pw_dir];
#else
/* Then environment variable HOMEPATH holds the home directory

View file

@ -365,7 +365,7 @@ fmalloc (NSZone *zone, size_t size)
if (zone->name != nil)
[NSException raise: NSMallocException
format: @"Zone %s has run out of memory",
[zone->name cStringNoCopy]];
[zone->name cString]];
else
[NSException raise: NSMallocException
format: @"Out of memory"];
@ -456,7 +456,7 @@ frealloc (NSZone *zone, void *ptr, size_t size)
if (zone->name != nil)
[NSException raise: NSMallocException
format: @"Zone %s has run out of memory",
[zone->name cStringNoCopy]];
[zone->name cString]];
else
[NSException raise: NSMallocException
format: @"Out of memory"];
@ -987,7 +987,7 @@ nmalloc (NSZone *zone, size_t size)
if (zone->name != nil)
[NSException raise: NSMallocException
format: @"Zone %s has run out of memory",
[zone->name cStringNoCopy]];
[zone->name cString]];
else
[NSException raise: NSMallocException
format: @"Out of memory"];
@ -1031,7 +1031,7 @@ nrealloc (NSZone *zone, void *ptr, size_t size)
if (zone->name != nil)
[NSException raise: NSGenericException
format: @"Trying to reallocate in nonfreeable zone %s",
[zone->name cStringNoCopy]];
[zone->name cString]];
else
[NSException raise: NSGenericException
format: @"Trying to reallocate in nonfreeable zone"];
@ -1044,7 +1044,7 @@ nfree (NSZone *zone, void *ptr)
if (zone->name != nil)
[NSException raise: NSGenericException
format: @"Trying to free memory from nonfreeable zone %s",
[zone->name cStringNoCopy]];
[zone->name cString]];
else
[NSException raise: NSGenericException
format: @"Trying to free memory from nonfreeable zone"];

View file

@ -114,7 +114,7 @@ o_vscanf (void *stream,
- initWithFilename: (NSString*)name fmode: (const char *)m
{
FILE *afp = fopen([name cStringNoCopy], (char*)m);
FILE *afp = fopen([name cString], (char*)m);
if (!afp)
{
id message;
@ -152,7 +152,7 @@ o_vscanf (void *stream,
return nil;
#else
return [self initWithFilePointer:
popen([systemCommand cStringNoCopy], "w")
popen([systemCommand cString], "w")
fmode:"w"];
#endif
}
@ -163,7 +163,7 @@ o_vscanf (void *stream,
return nil;
#else
return [self initWithFilePointer:
popen([systemCommand cStringNoCopy], "r")
popen([systemCommand cString], "r")
fmode:"r"];
#endif
}
@ -203,7 +203,7 @@ o_vscanf (void *stream,
- (int) writeFormat: (NSString*)format
arguments: (va_list)arg
{
return vfprintf(fp, [format cStringNoCopy], arg);
return vfprintf(fp, [format cString], arg);
}
static int
@ -236,7 +236,7 @@ stdio_unchar_func(void *s, int c)
va_start(ap, format);
ret = o_vscanf(fp, stdio_inchar_func, stdio_unchar_func,
[format cStringNoCopy], ap);
[format cString], ap);
va_end(ap);
return ret;
}

View file

@ -91,7 +91,7 @@
- (void) writeLine: (NSString*)l
{
const char *s = [l cStringNoCopy];
const char *s = [l cString];
[self writeBytes:s length:strlen(s)];
[self writeBytes:"\n" length:1];
}

View file

@ -67,50 +67,50 @@ static BOOL debug_textcoder = NO;
{
case _C_LNG:
[stream writeFormat:@"%*s<%s> (long) = %ld\n",
indentation, "", [name cStringNoCopy], *(long*)d];
indentation, "", [name cString], *(long*)d];
break;
case _C_ULNG:
[stream writeFormat:@"%*s<%s> (unsigned long) = %lu\n",
indentation, "", [name cStringNoCopy], *(unsigned long*)d];
indentation, "", [name cString], *(unsigned long*)d];
break;
case _C_INT:
[stream writeFormat:@"%*s<%s> (int) = %d\n",
indentation, "", [name cStringNoCopy], *(int*)d];
indentation, "", [name cString], *(int*)d];
break;
case _C_UINT:
[stream writeFormat:@"%*s<%s> (unsigned int) = %u\n",
indentation, "", [name cStringNoCopy], *(unsigned int*)d];
indentation, "", [name cString], *(unsigned int*)d];
break;
case _C_SHT:
[stream writeFormat:@"%*s<%s> (short) = %d\n",
indentation, "", [name cStringNoCopy], (int)*(short*)d];
indentation, "", [name cString], (int)*(short*)d];
break;
case _C_USHT:
[stream writeFormat:@"%*s<%s> (unsigned short) = %u\n",
indentation, "", [name cStringNoCopy],
indentation, "", [name cString],
(unsigned)*(unsigned short*)d];
break;
case _C_CHR:
[stream writeFormat:@"%*s<%s> (char) = %c (0x%x)\n",
indentation, "", [name cStringNoCopy],
indentation, "", [name cString],
*(char*)d, (unsigned)*(char*)d];
break;
case _C_UCHR:
[stream writeFormat:@"%*s<%s> (unsigned char) = 0x%x\n",
indentation, "", [name cStringNoCopy],
indentation, "", [name cString],
(unsigned)*(unsigned char*)d];
break;
case _C_FLT:
[stream writeFormat:@"%*s<%s> (float) = %g\n",
indentation, "", [name cStringNoCopy], *(float*)d];
indentation, "", [name cString], *(float*)d];
break;
case _C_DBL:
[stream writeFormat:@"%*s<%s> (double) = %g\n",
indentation, "", [name cStringNoCopy], *(double*)d];
indentation, "", [name cString], *(double*)d];
break;
case _C_CHARPTR:
[stream writeFormat:@"%*s<%s> (char*) = \"%s\"\n",
indentation, "", [name cStringNoCopy], *(char**)d];
indentation, "", [name cString], *(char**)d];
break;
case _C_ARY_B:
{
@ -176,7 +176,7 @@ static BOOL debug_textcoder = NO;
[NSException raise: NSGenericException \
format: @"bad format decoding " ATXSTR(TYPE) @".\n" \
@"Looking at %s\n.", \
[line cStringNoCopy]]; \
[line cString]]; \
}
@ -361,7 +361,7 @@ if (debug_textcoder) \
const char *lp;
line = [stream readLine];
lp = [line cStringNoCopy];
lp = [line cString];
while (*lp == ' ') lp++;
if (*lp != '{')
[NSException raise: NSGenericException
@ -374,7 +374,7 @@ if (debug_textcoder) \
const char *lp;
line = [stream readLine];
lp = [line cStringNoCopy];
lp = [line cString];
while (*lp == ' ') lp++;
if (*lp != '}')
[NSException raise: NSGenericException
@ -384,7 +384,7 @@ if (debug_textcoder) \
- (void) encodeName: (NSString*) n
{
if (n)
[stream writeFormat:@"%*s<%s>\n", indentation, "", [n cStringNoCopy]];
[stream writeFormat:@"%*s<%s>\n", indentation, "", [n cString]];
else
[stream writeFormat:@"%*s<NULL>\n", indentation, ""];
}

View file

@ -190,7 +190,7 @@ static NSMapTable *port_number_2_in_port = NULL;
{
int n;
n = name_2_port_number ([name cStringNoCopy]);
n = name_2_port_number ([name cString]);
return [self newForReceivingFromPortNumber: n];
}
@ -397,7 +397,7 @@ static Array *udp_out_port_array;
if (!hostname || ![hostname length])
host_cstring = "localhost";
else
host_cstring = [hostname cStringNoCopy];
host_cstring = [hostname cString];
hp = gethostbyname ((char*)host_cstring);
if (hp == 0)
[self error: "unknown host: \"%s\"", host_cstring];

View file

@ -89,7 +89,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
struct servent* sp;
if (pcl)
proto = [pcl cStringNoCopy];
proto = [pcl cString];
memset(sin, '\0', sizeof(*sin));
sin->sin_family = AF_INET;
@ -107,9 +107,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
name = [host address];
#ifndef HAVE_INET_ATON
sin->sin_addr.s_addr = inet_addr([name cStringNoCopy]);
sin->sin_addr.s_addr = inet_addr([name cString]);
#else
if (inet_aton([name cStringNoCopy], &sin->sin_addr) == 0)
if (inet_aton([name cString], &sin->sin_addr) == 0)
return NO;
#endif
}
@ -121,9 +121,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
sin->sin_port = 0;
return YES;
}
else if ((sp = getservbyname([svc cStringNoCopy], proto)) == 0)
else if ((sp = getservbyname([svc cString], proto)) == 0)
{
const char* ptr = [svc cStringNoCopy];
const char* ptr = [svc cString];
int val = atoi(ptr);
while (isdigit(*ptr))

View file

@ -31,7 +31,7 @@
#include <config.h>
#include <gnustep/base/preface.h>
#include <gnustep/base/mframe.h>
#include <gnustep/base/MallocAddress.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
#include <stdlib.h>
#include <assert.h>
@ -675,7 +675,7 @@ mframe_dissect_call (arglist_t argframe, const char *type,
-decodeValueOfCType:at:withName: to decode a char* string, you
should remember that -decodeValueOfCType:at:withName: malloc's
new memory to hold the string, and DECODER should autorelease the
malloc'ed pointer, using the MallocAddress class.
malloc'ed pointer, using the NSData class.
ENCODER should be a pointer to a function that records the method's
@ -901,7 +901,7 @@ mframe_do_call_opts (const char *encoded_types,
Note: the decoder allocates memory for holding the
string, and it is also responsible for making sure that
the memory gets freed eventually, (usually through the
autorelease of MallocAddress object). */
autorelease of NSData object). */
if ((flags & _F_IN) || !(flags & _F_OUT))
(*decoder) (argnum, datum, tmptype);
@ -1283,15 +1283,19 @@ mframe_build_return_opts (arglist_t argframe,
(*decoder) (-1, retframe, tmptype, flags);
}
else {
unsigned retLength;
/* We are returning a pointer to something. */
/* Increment TYPE so we can see what it is a pointer to. */
tmptype++;
retLength = objc_sizeof_type(tmptype);
/* Allocate some memory to hold the value we're pointing to. */
*(void**)retframe =
objc_malloc (objc_sizeof_type (tmptype));
objc_malloc (retLength);
/* We are responsible for making sure this memory gets free'd
eventually. Ask MallocAddress class to autorelease it. */
[MallocAddress autoreleaseMallocAddress: *(void**)retframe];
eventually. Ask NSData class to autorelease it. */
[NSData dataWithBytesNoCopy: *(void**)retframe
length: retLength];
/* Decode the return value into the memory we allocated. */
(*decoder) (-1, *(void**)retframe, tmptype, flags);
}

View file

@ -1110,14 +1110,14 @@ o_hash_description(o_hash_t *hash)
[string appendFormat:@"element_count = %d;\n", o_hash_count(hash)];
[string appendFormat:@"not_an_element_marker = %s;\n",
[DESCRIBE(o_hash_not_an_element_marker(hash)) cStringNoCopy]];
[DESCRIBE(o_hash_not_an_element_marker(hash)) cString]];
[string appendString:@"elements = {\n"];
while (o_hash_enumerator_next_element(&enumerator, &element))
[string appendFormat:@"%s,\n", [DESCRIBE(element) cStringNoCopy]];
[string appendFormat:@"%s,\n", [DESCRIBE(element) cString]];
[string appendFormat:@"%s};\n",
[DESCRIBE(o_hash_not_an_element_marker(hash)) cStringNoCopy]];
[DESCRIBE(o_hash_not_an_element_marker(hash)) cString]];
#undef DESCRIBE

View file

@ -256,8 +256,8 @@ _o_@XX@_description(o_@XX@_t *xx)
@"name = %s;\nextra = %s;\nzone = %s;\n",
o_@XX@_magic_number(xx),
o_@XX@_serial_number(xx),
[o_@XX@_name(xx) cStringNoCopy],
[o_@XX@_name(xx) cString],
[o_describe(o_@XX@_extra_callbacks(xx), o_@XX@_extra(xx), xx)
cStringNoCopy],
[NSZoneName(o_@XX@_zone(xx)) cStringNoCopy]];
cString],
[NSZoneName(o_@XX@_zone(xx)) cString]];
}

View file

@ -223,7 +223,7 @@ main(int argc, char** argv)
}
}
value = [args objectAtIndex: ++i];
text = [value cStringNoCopy];
text = [value cString];
if (*text == '(' || *text == '{' || *text == '<') {
obj = [value propertyList];
}
@ -263,7 +263,7 @@ main(int argc, char** argv)
}
}
value = [args objectAtIndex: ++i];
text = [value cStringNoCopy];
text = [value cString];
if (*text == '(' || *text == '{' || *text == '<') {
obj = [value propertyList];
}