mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
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:
parent
1a0efaad7c
commit
0806cb068b
27 changed files with 143 additions and 149 deletions
31
ChangeLog
31
ChangeLog
|
@ -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>
|
Tue Sep 29 13:05:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* src/include/Foundation.h: Added some missing files.
|
* src/include/Foundation.h: Added some missing files.
|
||||||
|
|
|
@ -473,7 +473,7 @@ static id nilBinaryTreeNode;
|
||||||
- _tmpPrintFromNode: aNode indent: (int)count
|
- _tmpPrintFromNode: aNode indent: (int)count
|
||||||
{
|
{
|
||||||
printf("%-*s", count, "");
|
printf("%-*s", count, "");
|
||||||
printf("%s\n", [[aNode description] cStringNoCopy]);
|
printf("%s\n", [[aNode description] cString]);
|
||||||
printf("%-*s.", count, "");
|
printf("%-*s.", count, "");
|
||||||
if ([aNode leftNode] != [self nilNode])
|
if ([aNode leftNode] != [self nilNode])
|
||||||
[self _tmpPrintFromNode:[aNode leftNode] indent:count+2];
|
[self _tmpPrintFromNode:[aNode leftNode] indent:count+2];
|
||||||
|
|
|
@ -589,7 +589,7 @@
|
||||||
id o;
|
id o;
|
||||||
FOR_COLLECTION(self, o)
|
FOR_COLLECTION(self, o)
|
||||||
{
|
{
|
||||||
printf("%s ", [[o description] cStringNoCopy]);
|
printf("%s ", [[o description] cString]);
|
||||||
}
|
}
|
||||||
END_FOR_COLLECTION(self);
|
END_FOR_COLLECTION(self);
|
||||||
printf(": %s\n", object_get_class_name (self));
|
printf(": %s\n", object_get_class_name (self));
|
||||||
|
|
|
@ -855,7 +855,7 @@ my_object_is_class(id object)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (classname_2_classname)
|
if (classname_2_classname)
|
||||||
return NSMapGet (classname_2_classname, [trueName cStringNoCopy]);
|
return NSMapGet (classname_2_classname, [trueName cString]);
|
||||||
return trueName;
|
return trueName;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,9 +231,7 @@
|
||||||
|
|
||||||
FOR_KEYED_COLLECTION(self, o, k)
|
FOR_KEYED_COLLECTION(self, o, k)
|
||||||
{
|
{
|
||||||
[s appendFormat: @"(%s,%s) ",
|
[s appendFormat: @"(%@,%@) ", [k description], [o description]];
|
||||||
[[k description] cStringNoCopy],
|
|
||||||
[[o description] cStringNoCopy]];
|
|
||||||
}
|
}
|
||||||
END_FOR_KEYED_COLLECTION(self);
|
END_FOR_KEYED_COLLECTION(self);
|
||||||
[s appendFormat: @" :%s\n", object_get_class_name (self)];
|
[s appendFormat: @" :%s\n", object_get_class_name (self)];
|
||||||
|
|
|
@ -319,7 +319,7 @@ void unchar_func(void *s, int c)
|
||||||
[data setLength: size];
|
[data setLength: size];
|
||||||
|
|
||||||
ret = VSPRINTF_LENGTH (vsprintf([data mutableBytes]+prefix+position,
|
ret = VSPRINTF_LENGTH (vsprintf([data mutableBytes]+prefix+position,
|
||||||
[format cStringNoCopy], arg));
|
[format cString], arg));
|
||||||
position += ret;
|
position += ret;
|
||||||
/* xxx Make sure we didn't overrun our buffer.
|
/* xxx Make sure we didn't overrun our buffer.
|
||||||
As per above kludge, this would happen if we happen to have more than
|
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);
|
va_start(ap, format);
|
||||||
ret = o_vscanf(self, inchar_func, unchar_func,
|
ret = o_vscanf(self, inchar_func, unchar_func,
|
||||||
[format cStringNoCopy], ap);
|
[format cString], ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -941,7 +941,7 @@ static id long_day[7] = {@"Sunday",
|
||||||
case 'Z':
|
case 'Z':
|
||||||
++i;
|
++i;
|
||||||
k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%s",
|
k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%s",
|
||||||
[[time_zone timeZoneAbbreviation] cStringNoCopy]));
|
[[time_zone timeZoneAbbreviation] cString]));
|
||||||
j += k;
|
j += k;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = malloc(fileLength);
|
tmp = objc_malloc(fileLength);
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
{
|
{
|
||||||
NSLog(@"Malloc failed for file of length %d- %s",
|
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. */
|
/* Just in case the failure action needs to be changed. */
|
||||||
failure:
|
failure:
|
||||||
if (tmp)
|
if (tmp)
|
||||||
free(tmp);
|
objc_free(tmp);
|
||||||
if (theFile)
|
if (theFile)
|
||||||
fclose(theFile);
|
fclose(theFile);
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -394,7 +394,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
format: @"Range: (%u, %u) Size: %d",
|
format: @"Range: (%u, %u) Size: %d",
|
||||||
aRange.location, aRange.length, l];
|
aRange.location, aRange.length, l];
|
||||||
|
|
||||||
buffer = malloc(aRange.length);
|
buffer = objc_malloc(aRange.length);
|
||||||
if (buffer == 0)
|
if (buffer == 0)
|
||||||
[NSException raise:NSMallocException
|
[NSException raise:NSMallocException
|
||||||
format:@"No memory for subdata of NSData object"];
|
format:@"No memory for subdata of NSData object"];
|
||||||
|
@ -797,7 +797,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
|
|
||||||
- (void*) relinquishAllocatedBytes
|
- (void*) relinquishAllocatedBytes
|
||||||
{
|
{
|
||||||
return 0; /* No data from malloc - return nul pointer */
|
return 0; /* No data from objc_malloc - return nul pointer */
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -1186,7 +1186,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
{
|
{
|
||||||
if (bytes)
|
if (bytes)
|
||||||
{
|
{
|
||||||
free(bytes);
|
objc_free(bytes);
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1210,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
|
|
||||||
if (aBuffer != 0 && bufferSize > 0)
|
if (aBuffer != 0 && bufferSize > 0)
|
||||||
{
|
{
|
||||||
tmp = malloc(bufferSize);
|
tmp = objc_malloc(bufferSize);
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
{
|
{
|
||||||
NSLog(@"[NSDataMalloc -initWithBytes:length:] unable to allocate %lu bytes", bufferSize);
|
NSLog(@"[NSDataMalloc -initWithBytes:length:] unable to allocate %lu bytes", bufferSize);
|
||||||
|
@ -1238,7 +1238,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (aBuffer)
|
if (aBuffer)
|
||||||
free(aBuffer);
|
objc_free(aBuffer);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
void* b;
|
void* b;
|
||||||
|
|
||||||
[aCoder decodeValueOfObjCType:"I" at: &l];
|
[aCoder decodeValueOfObjCType:"I" at: &l];
|
||||||
b = malloc(l);
|
b = objc_malloc(l);
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
{
|
{
|
||||||
NSLog(@"[NSDataMalloc -initWithCode:] unable to allocate %lu bytes", l);
|
NSLog(@"[NSDataMalloc -initWithCode:] unable to allocate %lu bytes", l);
|
||||||
|
@ -1544,7 +1544,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
{
|
{
|
||||||
if (bytes)
|
if (bytes)
|
||||||
{
|
{
|
||||||
free(bytes);
|
objc_free(bytes);
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
capacity = 0;
|
capacity = 0;
|
||||||
|
@ -1592,7 +1592,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (aBuffer)
|
if (aBuffer)
|
||||||
free(aBuffer);
|
objc_free(aBuffer);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,7 +1606,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
{
|
{
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
bytes = malloc(size);
|
bytes = objc_malloc(size);
|
||||||
if (bytes == 0)
|
if (bytes == 0)
|
||||||
{
|
{
|
||||||
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory for %u bytes - %s", size, strerror(errno));
|
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;
|
void* tmp;
|
||||||
|
|
||||||
if (bytes)
|
if (bytes)
|
||||||
tmp = realloc(bytes, size);
|
tmp = objc_realloc(bytes, size);
|
||||||
else
|
else
|
||||||
tmp = malloc(size);
|
tmp = objc_malloc(size);
|
||||||
|
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
[NSException raise:NSMallocException
|
[NSException raise:NSMallocException
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
#include <Foundation/NSData.h>
|
||||||
#include <gnustep/base/NSString.h>
|
#include <gnustep/base/NSString.h>
|
||||||
#include <gnustep/base/IndexedCollection.h>
|
#include <gnustep/base/IndexedCollection.h>
|
||||||
#include <gnustep/base/IndexedCollectionPrivate.h>
|
#include <gnustep/base/IndexedCollectionPrivate.h>
|
||||||
#include <gnustep/base/MallocAddress.h>
|
|
||||||
#include <Foundation/NSValue.h>
|
#include <Foundation/NSValue.h>
|
||||||
#include <gnustep/base/behavior.h>
|
#include <gnustep/base/behavior.h>
|
||||||
/* memcpy(), strlen(), strcmp() are gcc builtin's */
|
/* memcpy(), strlen(), strcmp() are gcc builtin's */
|
||||||
|
@ -144,7 +144,7 @@ static Class mutableClass;
|
||||||
OBJC_MALLOC(r, char, _count+1);
|
OBJC_MALLOC(r, char, _count+1);
|
||||||
memcpy(r, _contents_chars, _count);
|
memcpy(r, _contents_chars, _count);
|
||||||
r[_count] = '\0';
|
r[_count] = '\0';
|
||||||
[[[MallocAddress alloc] initWithAddress:r] autorelease];
|
[NSData dataWithBytesNoCopy:r length: _count+1];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ static Class mutableClass;
|
||||||
|
|
||||||
- (id) initWithString: (NSString*)string
|
- (id) initWithString: (NSString*)string
|
||||||
{
|
{
|
||||||
return [self initWithCString:[string cStringNoCopy]];
|
return [self initWithCString:[string cString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -399,7 +399,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
||||||
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
||||||
}
|
}
|
||||||
stringIncrementCountAndMakeHoleAt((NSGMutableCStringStruct*)self, index, c);
|
stringIncrementCountAndMakeHoleAt((NSGMutableCStringStruct*)self, index, c);
|
||||||
memcpy(_contents_chars + index, [aString cStringNoCopy], c);
|
[aString getCString: _contents_chars + index];
|
||||||
_contents_chars[_count] = '\0';
|
_contents_chars[_count] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
||||||
_capacity = MAX(_capacity*2, _count+c);
|
_capacity = MAX(_capacity*2, _count+c);
|
||||||
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
||||||
}
|
}
|
||||||
memcpy(_contents_chars + _count, [aString cStringNoCopy], c);
|
[aString getCString: _contents_chars + _count];
|
||||||
_count += c;
|
_count += c;
|
||||||
_contents_chars[_count] = '\0';
|
_contents_chars[_count] = '\0';
|
||||||
_hash = 0;
|
_hash = 0;
|
||||||
|
@ -419,28 +419,13 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
||||||
|
|
||||||
- (void) setString: (NSString*)aString
|
- (void) setString: (NSString*)aString
|
||||||
{
|
{
|
||||||
const char *s = [aString cStringNoCopy];
|
unsigned length = [aString cStringLength];
|
||||||
unsigned length = strlen(s);
|
|
||||||
if (_capacity < length)
|
if (_capacity < length)
|
||||||
{
|
{
|
||||||
_capacity = length;
|
_capacity = length;
|
||||||
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
OBJC_REALLOC(_contents_chars, char, _capacity+1);
|
||||||
}
|
}
|
||||||
memcpy(_contents_chars, s, length);
|
[aString getCString: _contents_chars];
|
||||||
_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);
|
|
||||||
_contents_chars[length] = '\0';
|
_contents_chars[length] = '\0';
|
||||||
_count = length;
|
_count = length;
|
||||||
_hash = 0;
|
_hash = 0;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Written by Stevo Crvenkovski <stevo@btinternet.com>
|
Written by Stevo Crvenkovski <stevo@btinternet.com>
|
||||||
Date: February 1997
|
Date: February 1997
|
||||||
|
|
||||||
Based on NSGCSting and NSString
|
Based on NSGCString and NSString
|
||||||
Written by: Andrew Kachites McCallum
|
Written by: Andrew Kachites McCallum
|
||||||
<mccallum@gnu.ai.mit.edu>
|
<mccallum@gnu.ai.mit.edu>
|
||||||
Date: March 1995
|
Date: March 1995
|
||||||
|
@ -29,12 +29,10 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <gnustep/base/NSString.h>
|
|
||||||
#include <Foundation/NSGString.h>
|
#include <Foundation/NSGString.h>
|
||||||
#include <gnustep/base/NSGString.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <gnustep/base/IndexedCollection.h>
|
#include <gnustep/base/IndexedCollection.h>
|
||||||
#include <gnustep/base/IndexedCollectionPrivate.h>
|
#include <gnustep/base/IndexedCollectionPrivate.h>
|
||||||
#include <gnustep/base/MallocAddress.h>
|
|
||||||
#include <Foundation/NSValue.h>
|
#include <Foundation/NSValue.h>
|
||||||
#include <gnustep/base/behavior.h>
|
#include <gnustep/base/behavior.h>
|
||||||
#include <gnustep/base/NSGSequence.h>
|
#include <gnustep/base/NSGSequence.h>
|
||||||
|
@ -156,7 +154,7 @@
|
||||||
if (_count > 0)
|
if (_count > 0)
|
||||||
ustrtostr(r,_contents_chars, _count);
|
ustrtostr(r,_contents_chars, _count);
|
||||||
r[_count] = '\0';
|
r[_count] = '\0';
|
||||||
[[[MallocAddress alloc] initWithAddress:r] autorelease];
|
[NSData dataWithBytesNoCopy: r length: _count+1];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +197,7 @@
|
||||||
OBJC_MALLOC(r, char, _count+1);
|
OBJC_MALLOC(r, char, _count+1);
|
||||||
ustrtostr(r,_contents_chars, _count);
|
ustrtostr(r,_contents_chars, _count);
|
||||||
r[_count] = '\0';
|
r[_count] = '\0';
|
||||||
[[[MallocAddress alloc] initWithAddress:r] autorelease];
|
[NSData dataWithBytesNoCopy: r length: _count+1];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
// #endif /* NO_GNUSTEP */
|
// #endif /* NO_GNUSTEP */
|
||||||
|
@ -437,21 +435,6 @@ stringDecrementCountAndFillHoleAt(NSGMutableStringStruct *self,
|
||||||
|
|
||||||
// ************ Stuff from NSGCString *********
|
// ************ 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. */
|
/* Override NSString's designated initializer for CStrings. */
|
||||||
- (id) initWithCStringNoCopy: (char*)byteString
|
- (id) initWithCStringNoCopy: (char*)byteString
|
||||||
length: (unsigned int)length
|
length: (unsigned int)length
|
||||||
|
|
|
@ -304,7 +304,7 @@ NSHashInsertKnownAbsent(NSHashTable *table, const void *element)
|
||||||
* date. */
|
* date. */
|
||||||
[NSException raise:NSInvalidArgumentException
|
[NSException raise:NSInvalidArgumentException
|
||||||
format:@"NSHashTable: illegal reinsertion of: %s",
|
format:@"NSHashTable: illegal reinsertion of: %s",
|
||||||
[NSHT_DESCRIBE(table, element) cStringNoCopy]];
|
[NSHT_DESCRIBE(table, element) cString]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -358,7 +358,7 @@ NSStringFromHashTable(NSHashTable *table)
|
||||||
* each to the mutable string STRING. */
|
* each to the mutable string STRING. */
|
||||||
while ((pointer = NSNextHashEnumeratorItem(&enumerator)) != 0)
|
while ((pointer = NSNextHashEnumeratorItem(&enumerator)) != 0)
|
||||||
[string appendFormat:@"%s;\n",
|
[string appendFormat:@"%s;\n",
|
||||||
[NSHT_DESCRIBE(table, pointer) cStringNoCopy]];
|
[NSHT_DESCRIBE(table, pointer) cString]];
|
||||||
|
|
||||||
/* STRING is already autoreleased. */
|
/* STRING is already autoreleased. */
|
||||||
return (NSString *) string;
|
return (NSString *) string;
|
||||||
|
|
|
@ -37,7 +37,7 @@ NSLog_printf_handler *_NSLog_printf_handler;
|
||||||
static void
|
static void
|
||||||
_NSLog_standard_printf_handler (NSString* message)
|
_NSLog_standard_printf_handler (NSString* message)
|
||||||
{
|
{
|
||||||
fprintf (stderr, [message cStringNoCopy]);
|
fprintf (stderr, [message cString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -398,8 +398,8 @@ NSMapInsertKnownAbsent(NSMapTable *table, const void *key, const void *value)
|
||||||
* date. */
|
* date. */
|
||||||
[NSException raise:NSInvalidArgumentException
|
[NSException raise:NSInvalidArgumentException
|
||||||
format:@"NSMapTable: illegal reinsertion of: %s -> %s",
|
format:@"NSMapTable: illegal reinsertion of: %s -> %s",
|
||||||
[NSMT_DESCRIBE_KEY(table, key) cStringNoCopy],
|
[NSMT_DESCRIBE_KEY(table, key) cString],
|
||||||
[NSMT_DESCRIBE_VALUE(table, value) cStringNoCopy]];
|
[NSMT_DESCRIBE_VALUE(table, value) cString]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -445,8 +445,8 @@ NSStringFromMapTable(NSMapTable *table)
|
||||||
* descriptions to the string. */
|
* descriptions to the string. */
|
||||||
while (NSNextMapEnumeratorPair(&enumerator, &key, &value))
|
while (NSNextMapEnumeratorPair(&enumerator, &key, &value))
|
||||||
[string appendFormat:@"%@ = %@;",
|
[string appendFormat:@"%@ = %@;",
|
||||||
[(keyCallBacks.describe)(table, key) cStringNoCopy],
|
[(keyCallBacks.describe)(table, key) cString],
|
||||||
[(valueCallBacks.describe)(table, value) cStringNoCopy]];
|
[(valueCallBacks.describe)(table, value) cString]];
|
||||||
|
|
||||||
/* Note that this string'll need to be `retain'ed. */
|
/* Note that this string'll need to be `retain'ed. */
|
||||||
return string;
|
return string;
|
||||||
|
|
|
@ -116,7 +116,7 @@ static BOOL debug_connected_coder = NO;
|
||||||
if (debug_connected_coder)
|
if (debug_connected_coder)
|
||||||
fprintf(stderr, "dismiss 0x%x: #=%d i=%d write failed - %s\n",
|
fprintf(stderr, "dismiss 0x%x: #=%d i=%d write failed - %s\n",
|
||||||
(unsigned)self, sequence_number, identifier,
|
(unsigned)self, sequence_number, identifier,
|
||||||
[[localException reason] cStringNoCopy]);
|
[[localException reason] cString]);
|
||||||
if ([[connection sendPort] isValid])
|
if ([[connection sendPort] isValid])
|
||||||
[[connection sendPort] invalidate];
|
[[connection sendPort] invalidate];
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <gnustep/base/MallocAddress.h>
|
|
||||||
#include <gnustep/base/behavior.h>
|
#include <gnustep/base/behavior.h>
|
||||||
|
|
||||||
#include <gnustep/base/NSGSequence.h>
|
#include <gnustep/base/NSGSequence.h>
|
||||||
|
@ -210,7 +209,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
#endif
|
#endif
|
||||||
len = fprintf(stream, "%*s",
|
len = fprintf(stream, "%*s",
|
||||||
(info->left ? - info->width : info->width),
|
(info->left ? - info->width : info->width),
|
||||||
[[string_object description] cStringNoCopy]);
|
[[string_object description] cString]);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
|
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
|
||||||
|
@ -380,7 +379,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
arguments: (va_list)arg_list
|
arguments: (va_list)arg_list
|
||||||
{
|
{
|
||||||
#if HAVE_VSPRINTF
|
#if HAVE_VSPRINTF
|
||||||
const char *format_cp = [format cStringNoCopy];
|
const char *format_cp = [format cString];
|
||||||
int format_len = strlen (format_cp);
|
int format_len = strlen (format_cp);
|
||||||
/* xxx horrible disgusting BUFFER_EXTRA arbitrary limit; fix this! */
|
/* xxx horrible disgusting BUFFER_EXTRA arbitrary limit; fix this! */
|
||||||
#define BUFFER_EXTRA 1024*500
|
#define BUFFER_EXTRA 1024*500
|
||||||
|
@ -455,7 +454,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
format_to_go = spec_pos+1;
|
format_to_go = spec_pos+1;
|
||||||
}
|
}
|
||||||
/* Get a C-string (char*) from the String object, and print it. */
|
/* 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)
|
if (!cstring)
|
||||||
cstring = "<null string>";
|
cstring = "<null string>";
|
||||||
strcat (buf+printed_len, cstring);
|
strcat (buf+printed_len, cstring);
|
||||||
|
@ -1261,7 +1260,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
{
|
{
|
||||||
id obj;
|
id obj;
|
||||||
void *bufstate;
|
void *bufstate;
|
||||||
bufstate = (void *)pl_scan_string([self cStringNoCopy]);
|
bufstate = (void *)pl_scan_string([self cString]);
|
||||||
obj = (id)plparse();
|
obj = (id)plparse();
|
||||||
pl_delete_buffer(bufstate);
|
pl_delete_buffer(bufstate);
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -1273,7 +1272,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
id dict = [[[NSMutableDictionary alloc] init] autorelease];
|
id dict = [[[NSMutableDictionary alloc] init] autorelease];
|
||||||
void *bufstate;
|
void *bufstate;
|
||||||
|
|
||||||
bufstate = (void *)sf_scan_string([self cStringNoCopy]);
|
bufstate = (void *)sf_scan_string([self cString]);
|
||||||
sfSetDict(dict);
|
sfSetDict(dict);
|
||||||
sfparse(dict);
|
sfparse(dict);
|
||||||
sf_delete_buffer(bufstate);
|
sf_delete_buffer(bufstate);
|
||||||
|
@ -1949,17 +1948,17 @@ else
|
||||||
|
|
||||||
- (double) doubleValue
|
- (double) doubleValue
|
||||||
{
|
{
|
||||||
return atof([self cStringNoCopy]);
|
return atof([self cString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (float) floatValue
|
- (float) floatValue
|
||||||
{
|
{
|
||||||
return (float) atof([self cStringNoCopy]);
|
return (float) atof([self cString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) intValue
|
- (int) intValue
|
||||||
{
|
{
|
||||||
return atoi([self cStringNoCopy]);
|
return atoi([self cString]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Working With Encodings
|
// Working With Encodings
|
||||||
|
@ -2097,7 +2096,7 @@ else
|
||||||
|
|
||||||
- (BOOL)getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)size
|
- (BOOL)getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)size
|
||||||
{
|
{
|
||||||
const char* ptr = [self cStringNoCopy];
|
const char* ptr = [self cString];
|
||||||
if (strlen(ptr) > size)
|
if (strlen(ptr) > size)
|
||||||
return NO;
|
return NO;
|
||||||
strcpy(buffer, ptr);
|
strcpy(buffer, ptr);
|
||||||
|
@ -2520,7 +2519,7 @@ else
|
||||||
|
|
||||||
if ([self length] == 0 ||
|
if ([self length] == 0 ||
|
||||||
[self rangeOfCharacterFromSet: quotables].length > 0) {
|
[self rangeOfCharacterFromSet: quotables].length > 0) {
|
||||||
const char *cstring = [self cStringNoCopy];
|
const char *cstring = [self cString];
|
||||||
const char *from;
|
const char *from;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
@ -2640,12 +2639,6 @@ else
|
||||||
return [super allocWithZone:z];
|
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
|
// Creating Temporary Strings
|
||||||
|
|
||||||
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity
|
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity
|
||||||
|
@ -2668,12 +2661,12 @@ else
|
||||||
return [self stringWithCString:byteString length:strlen(byteString)];
|
return [self stringWithCString:byteString length:strlen(byteString)];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString*) stringWithCString: (const char*)bytes
|
+ (NSString*) stringWithCString: (const char*)byteString
|
||||||
length:(unsigned)length
|
length: (unsigned int)length
|
||||||
{
|
{
|
||||||
id n = [[self alloc] initWithCapacity:length];
|
return [[[self alloc]
|
||||||
[n setCString:bytes length:length];
|
initWithCString:byteString length:length]
|
||||||
return n;
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* xxx Change this when we have non-CString classes */
|
/* xxx Change this when we have non-CString classes */
|
||||||
|
|
|
@ -544,7 +544,7 @@ decode (const void *ptr)
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
fp = fopen([f cStringNoCopy], "r");
|
fp = fopen([f cString], "r");
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
{
|
{
|
||||||
if (fscanf(fp, "%79s", zone_name) == 1)
|
if (fscanf(fp, "%79s", zone_name) == 1)
|
||||||
|
@ -645,8 +645,8 @@ decode (const void *ptr)
|
||||||
/* Make sure that only time zone files are accessed.
|
/* Make sure that only time zone files are accessed.
|
||||||
FIXME: Make this more robust. */
|
FIXME: Make this more robust. */
|
||||||
if ([aTimeZoneName length] == 0
|
if ([aTimeZoneName length] == 0
|
||||||
|| ([aTimeZoneName cStringNoCopy])[0] == '/'
|
|| ([aTimeZoneName cString])[0] == '/'
|
||||||
|| strchr([aTimeZoneName cStringNoCopy], '.') != NULL)
|
|| strchr([aTimeZoneName cString], '.') != NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"Disallowed time zone name `%@'.", aTimeZoneName);
|
NSLog(@"Disallowed time zone name `%@'.", aTimeZoneName);
|
||||||
[zone_mutex unlock];
|
[zone_mutex unlock];
|
||||||
|
@ -658,7 +658,7 @@ decode (const void *ptr)
|
||||||
|
|
||||||
/* Open file. */
|
/* Open file. */
|
||||||
fileName = [NSTimeZone getTimeZoneFile: aTimeZoneName];
|
fileName = [NSTimeZone getTimeZoneFile: aTimeZoneName];
|
||||||
file = fopen([fileName cStringNoCopy], "rb");
|
file = fopen([fileName cString], "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
[NSException raise: fileException format: errMess];
|
[NSException raise: fileException format: errMess];
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ decode (const void *ptr)
|
||||||
/* Read dictionary from file. */
|
/* Read dictionary from file. */
|
||||||
abbreviationDictionary = [[NSMutableDictionary alloc] init];
|
abbreviationDictionary = [[NSMutableDictionary alloc] init];
|
||||||
fileName = [NSTimeZone getAbbreviationFile];
|
fileName = [NSTimeZone getAbbreviationFile];
|
||||||
file = fopen([fileName cStringNoCopy], "r");
|
file = fopen([fileName cString], "r");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
[NSException
|
[NSException
|
||||||
raise: NSInternalInconsistencyException
|
raise: NSInternalInconsistencyException
|
||||||
|
@ -826,7 +826,7 @@ decode (const void *ptr)
|
||||||
temp_array[i] = [[NSMutableArray alloc] init];
|
temp_array[i] = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
fileName = [NSTimeZone getRegionsFile];
|
fileName = [NSTimeZone getRegionsFile];
|
||||||
file = fopen([fileName cStringNoCopy], "r");
|
file = fopen([fileName cString], "r");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
[NSException
|
[NSException
|
||||||
raise: NSInternalInconsistencyException
|
raise: NSInternalInconsistencyException
|
||||||
|
|
|
@ -82,7 +82,7 @@ NSHomeDirectoryForUser (NSString *login_name)
|
||||||
{
|
{
|
||||||
#if !defined(__WIN32__) && !defined(_WIN32)
|
#if !defined(__WIN32__) && !defined(_WIN32)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
pw = getpwnam ([login_name cStringNoCopy]);
|
pw = getpwnam ([login_name cString]);
|
||||||
return [NSString stringWithCString: pw->pw_dir];
|
return [NSString stringWithCString: pw->pw_dir];
|
||||||
#else
|
#else
|
||||||
/* Then environment variable HOMEPATH holds the home directory
|
/* Then environment variable HOMEPATH holds the home directory
|
||||||
|
|
|
@ -365,7 +365,7 @@ fmalloc (NSZone *zone, size_t size)
|
||||||
if (zone->name != nil)
|
if (zone->name != nil)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Zone %s has run out of memory",
|
format: @"Zone %s has run out of memory",
|
||||||
[zone->name cStringNoCopy]];
|
[zone->name cString]];
|
||||||
else
|
else
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Out of memory"];
|
format: @"Out of memory"];
|
||||||
|
@ -456,7 +456,7 @@ frealloc (NSZone *zone, void *ptr, size_t size)
|
||||||
if (zone->name != nil)
|
if (zone->name != nil)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Zone %s has run out of memory",
|
format: @"Zone %s has run out of memory",
|
||||||
[zone->name cStringNoCopy]];
|
[zone->name cString]];
|
||||||
else
|
else
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Out of memory"];
|
format: @"Out of memory"];
|
||||||
|
@ -987,7 +987,7 @@ nmalloc (NSZone *zone, size_t size)
|
||||||
if (zone->name != nil)
|
if (zone->name != nil)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Zone %s has run out of memory",
|
format: @"Zone %s has run out of memory",
|
||||||
[zone->name cStringNoCopy]];
|
[zone->name cString]];
|
||||||
else
|
else
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Out of memory"];
|
format: @"Out of memory"];
|
||||||
|
@ -1031,7 +1031,7 @@ nrealloc (NSZone *zone, void *ptr, size_t size)
|
||||||
if (zone->name != nil)
|
if (zone->name != nil)
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"Trying to reallocate in nonfreeable zone %s",
|
format: @"Trying to reallocate in nonfreeable zone %s",
|
||||||
[zone->name cStringNoCopy]];
|
[zone->name cString]];
|
||||||
else
|
else
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"Trying to reallocate in nonfreeable zone"];
|
format: @"Trying to reallocate in nonfreeable zone"];
|
||||||
|
@ -1044,7 +1044,7 @@ nfree (NSZone *zone, void *ptr)
|
||||||
if (zone->name != nil)
|
if (zone->name != nil)
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"Trying to free memory from nonfreeable zone %s",
|
format: @"Trying to free memory from nonfreeable zone %s",
|
||||||
[zone->name cStringNoCopy]];
|
[zone->name cString]];
|
||||||
else
|
else
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
format: @"Trying to free memory from nonfreeable zone"];
|
format: @"Trying to free memory from nonfreeable zone"];
|
||||||
|
|
|
@ -114,7 +114,7 @@ o_vscanf (void *stream,
|
||||||
|
|
||||||
- initWithFilename: (NSString*)name fmode: (const char *)m
|
- initWithFilename: (NSString*)name fmode: (const char *)m
|
||||||
{
|
{
|
||||||
FILE *afp = fopen([name cStringNoCopy], (char*)m);
|
FILE *afp = fopen([name cString], (char*)m);
|
||||||
if (!afp)
|
if (!afp)
|
||||||
{
|
{
|
||||||
id message;
|
id message;
|
||||||
|
@ -152,7 +152,7 @@ o_vscanf (void *stream,
|
||||||
return nil;
|
return nil;
|
||||||
#else
|
#else
|
||||||
return [self initWithFilePointer:
|
return [self initWithFilePointer:
|
||||||
popen([systemCommand cStringNoCopy], "w")
|
popen([systemCommand cString], "w")
|
||||||
fmode:"w"];
|
fmode:"w"];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ o_vscanf (void *stream,
|
||||||
return nil;
|
return nil;
|
||||||
#else
|
#else
|
||||||
return [self initWithFilePointer:
|
return [self initWithFilePointer:
|
||||||
popen([systemCommand cStringNoCopy], "r")
|
popen([systemCommand cString], "r")
|
||||||
fmode:"r"];
|
fmode:"r"];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ o_vscanf (void *stream,
|
||||||
- (int) writeFormat: (NSString*)format
|
- (int) writeFormat: (NSString*)format
|
||||||
arguments: (va_list)arg
|
arguments: (va_list)arg
|
||||||
{
|
{
|
||||||
return vfprintf(fp, [format cStringNoCopy], arg);
|
return vfprintf(fp, [format cString], arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -236,7 +236,7 @@ stdio_unchar_func(void *s, int c)
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
ret = o_vscanf(fp, stdio_inchar_func, stdio_unchar_func,
|
ret = o_vscanf(fp, stdio_inchar_func, stdio_unchar_func,
|
||||||
[format cStringNoCopy], ap);
|
[format cString], ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
|
|
||||||
- (void) writeLine: (NSString*)l
|
- (void) writeLine: (NSString*)l
|
||||||
{
|
{
|
||||||
const char *s = [l cStringNoCopy];
|
const char *s = [l cString];
|
||||||
[self writeBytes:s length:strlen(s)];
|
[self writeBytes:s length:strlen(s)];
|
||||||
[self writeBytes:"\n" length:1];
|
[self writeBytes:"\n" length:1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,50 +67,50 @@ static BOOL debug_textcoder = NO;
|
||||||
{
|
{
|
||||||
case _C_LNG:
|
case _C_LNG:
|
||||||
[stream writeFormat:@"%*s<%s> (long) = %ld\n",
|
[stream writeFormat:@"%*s<%s> (long) = %ld\n",
|
||||||
indentation, "", [name cStringNoCopy], *(long*)d];
|
indentation, "", [name cString], *(long*)d];
|
||||||
break;
|
break;
|
||||||
case _C_ULNG:
|
case _C_ULNG:
|
||||||
[stream writeFormat:@"%*s<%s> (unsigned long) = %lu\n",
|
[stream writeFormat:@"%*s<%s> (unsigned long) = %lu\n",
|
||||||
indentation, "", [name cStringNoCopy], *(unsigned long*)d];
|
indentation, "", [name cString], *(unsigned long*)d];
|
||||||
break;
|
break;
|
||||||
case _C_INT:
|
case _C_INT:
|
||||||
[stream writeFormat:@"%*s<%s> (int) = %d\n",
|
[stream writeFormat:@"%*s<%s> (int) = %d\n",
|
||||||
indentation, "", [name cStringNoCopy], *(int*)d];
|
indentation, "", [name cString], *(int*)d];
|
||||||
break;
|
break;
|
||||||
case _C_UINT:
|
case _C_UINT:
|
||||||
[stream writeFormat:@"%*s<%s> (unsigned int) = %u\n",
|
[stream writeFormat:@"%*s<%s> (unsigned int) = %u\n",
|
||||||
indentation, "", [name cStringNoCopy], *(unsigned int*)d];
|
indentation, "", [name cString], *(unsigned int*)d];
|
||||||
break;
|
break;
|
||||||
case _C_SHT:
|
case _C_SHT:
|
||||||
[stream writeFormat:@"%*s<%s> (short) = %d\n",
|
[stream writeFormat:@"%*s<%s> (short) = %d\n",
|
||||||
indentation, "", [name cStringNoCopy], (int)*(short*)d];
|
indentation, "", [name cString], (int)*(short*)d];
|
||||||
break;
|
break;
|
||||||
case _C_USHT:
|
case _C_USHT:
|
||||||
[stream writeFormat:@"%*s<%s> (unsigned short) = %u\n",
|
[stream writeFormat:@"%*s<%s> (unsigned short) = %u\n",
|
||||||
indentation, "", [name cStringNoCopy],
|
indentation, "", [name cString],
|
||||||
(unsigned)*(unsigned short*)d];
|
(unsigned)*(unsigned short*)d];
|
||||||
break;
|
break;
|
||||||
case _C_CHR:
|
case _C_CHR:
|
||||||
[stream writeFormat:@"%*s<%s> (char) = %c (0x%x)\n",
|
[stream writeFormat:@"%*s<%s> (char) = %c (0x%x)\n",
|
||||||
indentation, "", [name cStringNoCopy],
|
indentation, "", [name cString],
|
||||||
*(char*)d, (unsigned)*(char*)d];
|
*(char*)d, (unsigned)*(char*)d];
|
||||||
break;
|
break;
|
||||||
case _C_UCHR:
|
case _C_UCHR:
|
||||||
[stream writeFormat:@"%*s<%s> (unsigned char) = 0x%x\n",
|
[stream writeFormat:@"%*s<%s> (unsigned char) = 0x%x\n",
|
||||||
indentation, "", [name cStringNoCopy],
|
indentation, "", [name cString],
|
||||||
(unsigned)*(unsigned char*)d];
|
(unsigned)*(unsigned char*)d];
|
||||||
break;
|
break;
|
||||||
case _C_FLT:
|
case _C_FLT:
|
||||||
[stream writeFormat:@"%*s<%s> (float) = %g\n",
|
[stream writeFormat:@"%*s<%s> (float) = %g\n",
|
||||||
indentation, "", [name cStringNoCopy], *(float*)d];
|
indentation, "", [name cString], *(float*)d];
|
||||||
break;
|
break;
|
||||||
case _C_DBL:
|
case _C_DBL:
|
||||||
[stream writeFormat:@"%*s<%s> (double) = %g\n",
|
[stream writeFormat:@"%*s<%s> (double) = %g\n",
|
||||||
indentation, "", [name cStringNoCopy], *(double*)d];
|
indentation, "", [name cString], *(double*)d];
|
||||||
break;
|
break;
|
||||||
case _C_CHARPTR:
|
case _C_CHARPTR:
|
||||||
[stream writeFormat:@"%*s<%s> (char*) = \"%s\"\n",
|
[stream writeFormat:@"%*s<%s> (char*) = \"%s\"\n",
|
||||||
indentation, "", [name cStringNoCopy], *(char**)d];
|
indentation, "", [name cString], *(char**)d];
|
||||||
break;
|
break;
|
||||||
case _C_ARY_B:
|
case _C_ARY_B:
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ static BOOL debug_textcoder = NO;
|
||||||
[NSException raise: NSGenericException \
|
[NSException raise: NSGenericException \
|
||||||
format: @"bad format decoding " ATXSTR(TYPE) @".\n" \
|
format: @"bad format decoding " ATXSTR(TYPE) @".\n" \
|
||||||
@"Looking at %s\n.", \
|
@"Looking at %s\n.", \
|
||||||
[line cStringNoCopy]]; \
|
[line cString]]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ if (debug_textcoder) \
|
||||||
const char *lp;
|
const char *lp;
|
||||||
|
|
||||||
line = [stream readLine];
|
line = [stream readLine];
|
||||||
lp = [line cStringNoCopy];
|
lp = [line cString];
|
||||||
while (*lp == ' ') lp++;
|
while (*lp == ' ') lp++;
|
||||||
if (*lp != '{')
|
if (*lp != '{')
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
|
@ -374,7 +374,7 @@ if (debug_textcoder) \
|
||||||
const char *lp;
|
const char *lp;
|
||||||
|
|
||||||
line = [stream readLine];
|
line = [stream readLine];
|
||||||
lp = [line cStringNoCopy];
|
lp = [line cString];
|
||||||
while (*lp == ' ') lp++;
|
while (*lp == ' ') lp++;
|
||||||
if (*lp != '}')
|
if (*lp != '}')
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
|
@ -384,7 +384,7 @@ if (debug_textcoder) \
|
||||||
- (void) encodeName: (NSString*) n
|
- (void) encodeName: (NSString*) n
|
||||||
{
|
{
|
||||||
if (n)
|
if (n)
|
||||||
[stream writeFormat:@"%*s<%s>\n", indentation, "", [n cStringNoCopy]];
|
[stream writeFormat:@"%*s<%s>\n", indentation, "", [n cString]];
|
||||||
else
|
else
|
||||||
[stream writeFormat:@"%*s<NULL>\n", indentation, ""];
|
[stream writeFormat:@"%*s<NULL>\n", indentation, ""];
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ static NSMapTable *port_number_2_in_port = NULL;
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = name_2_port_number ([name cStringNoCopy]);
|
n = name_2_port_number ([name cString]);
|
||||||
return [self newForReceivingFromPortNumber: n];
|
return [self newForReceivingFromPortNumber: n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ static Array *udp_out_port_array;
|
||||||
if (!hostname || ![hostname length])
|
if (!hostname || ![hostname length])
|
||||||
host_cstring = "localhost";
|
host_cstring = "localhost";
|
||||||
else
|
else
|
||||||
host_cstring = [hostname cStringNoCopy];
|
host_cstring = [hostname cString];
|
||||||
hp = gethostbyname ((char*)host_cstring);
|
hp = gethostbyname ((char*)host_cstring);
|
||||||
if (hp == 0)
|
if (hp == 0)
|
||||||
[self error: "unknown host: \"%s\"", host_cstring];
|
[self error: "unknown host: \"%s\"", host_cstring];
|
||||||
|
|
|
@ -89,7 +89,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
||||||
struct servent* sp;
|
struct servent* sp;
|
||||||
|
|
||||||
if (pcl)
|
if (pcl)
|
||||||
proto = [pcl cStringNoCopy];
|
proto = [pcl cString];
|
||||||
|
|
||||||
memset(sin, '\0', sizeof(*sin));
|
memset(sin, '\0', sizeof(*sin));
|
||||||
sin->sin_family = AF_INET;
|
sin->sin_family = AF_INET;
|
||||||
|
@ -107,9 +107,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
||||||
name = [host address];
|
name = [host address];
|
||||||
|
|
||||||
#ifndef HAVE_INET_ATON
|
#ifndef HAVE_INET_ATON
|
||||||
sin->sin_addr.s_addr = inet_addr([name cStringNoCopy]);
|
sin->sin_addr.s_addr = inet_addr([name cString]);
|
||||||
#else
|
#else
|
||||||
if (inet_aton([name cStringNoCopy], &sin->sin_addr) == 0)
|
if (inet_aton([name cString], &sin->sin_addr) == 0)
|
||||||
return NO;
|
return NO;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -121,9 +121,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
||||||
sin->sin_port = 0;
|
sin->sin_port = 0;
|
||||||
return YES;
|
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);
|
int val = atoi(ptr);
|
||||||
|
|
||||||
while (isdigit(*ptr))
|
while (isdigit(*ptr))
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <gnustep/base/mframe.h>
|
#include <gnustep/base/mframe.h>
|
||||||
#include <gnustep/base/MallocAddress.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.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
|
-decodeValueOfCType:at:withName: to decode a char* string, you
|
||||||
should remember that -decodeValueOfCType:at:withName: malloc's
|
should remember that -decodeValueOfCType:at:withName: malloc's
|
||||||
new memory to hold the string, and DECODER should autorelease the
|
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
|
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
|
Note: the decoder allocates memory for holding the
|
||||||
string, and it is also responsible for making sure that
|
string, and it is also responsible for making sure that
|
||||||
the memory gets freed eventually, (usually through the
|
the memory gets freed eventually, (usually through the
|
||||||
autorelease of MallocAddress object). */
|
autorelease of NSData object). */
|
||||||
if ((flags & _F_IN) || !(flags & _F_OUT))
|
if ((flags & _F_IN) || !(flags & _F_OUT))
|
||||||
(*decoder) (argnum, datum, tmptype);
|
(*decoder) (argnum, datum, tmptype);
|
||||||
|
|
||||||
|
@ -1283,15 +1283,19 @@ mframe_build_return_opts (arglist_t argframe,
|
||||||
(*decoder) (-1, retframe, tmptype, flags);
|
(*decoder) (-1, retframe, tmptype, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
unsigned retLength;
|
||||||
|
|
||||||
/* We are returning a pointer to something. */
|
/* We are returning a pointer to something. */
|
||||||
/* Increment TYPE so we can see what it is a pointer to. */
|
/* Increment TYPE so we can see what it is a pointer to. */
|
||||||
tmptype++;
|
tmptype++;
|
||||||
|
retLength = objc_sizeof_type(tmptype);
|
||||||
/* Allocate some memory to hold the value we're pointing to. */
|
/* Allocate some memory to hold the value we're pointing to. */
|
||||||
*(void**)retframe =
|
*(void**)retframe =
|
||||||
objc_malloc (objc_sizeof_type (tmptype));
|
objc_malloc (retLength);
|
||||||
/* We are responsible for making sure this memory gets free'd
|
/* We are responsible for making sure this memory gets free'd
|
||||||
eventually. Ask MallocAddress class to autorelease it. */
|
eventually. Ask NSData class to autorelease it. */
|
||||||
[MallocAddress autoreleaseMallocAddress: *(void**)retframe];
|
[NSData dataWithBytesNoCopy: *(void**)retframe
|
||||||
|
length: retLength];
|
||||||
/* Decode the return value into the memory we allocated. */
|
/* Decode the return value into the memory we allocated. */
|
||||||
(*decoder) (-1, *(void**)retframe, tmptype, flags);
|
(*decoder) (-1, *(void**)retframe, tmptype, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1110,14 +1110,14 @@ o_hash_description(o_hash_t *hash)
|
||||||
|
|
||||||
[string appendFormat:@"element_count = %d;\n", o_hash_count(hash)];
|
[string appendFormat:@"element_count = %d;\n", o_hash_count(hash)];
|
||||||
[string appendFormat:@"not_an_element_marker = %s;\n",
|
[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"];
|
[string appendString:@"elements = {\n"];
|
||||||
|
|
||||||
while (o_hash_enumerator_next_element(&enumerator, &element))
|
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",
|
[string appendFormat:@"%s};\n",
|
||||||
[DESCRIBE(o_hash_not_an_element_marker(hash)) cStringNoCopy]];
|
[DESCRIBE(o_hash_not_an_element_marker(hash)) cString]];
|
||||||
|
|
||||||
#undef DESCRIBE
|
#undef DESCRIBE
|
||||||
|
|
||||||
|
|
|
@ -256,8 +256,8 @@ _o_@XX@_description(o_@XX@_t *xx)
|
||||||
@"name = %s;\nextra = %s;\nzone = %s;\n",
|
@"name = %s;\nextra = %s;\nzone = %s;\n",
|
||||||
o_@XX@_magic_number(xx),
|
o_@XX@_magic_number(xx),
|
||||||
o_@XX@_serial_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)
|
[o_describe(o_@XX@_extra_callbacks(xx), o_@XX@_extra(xx), xx)
|
||||||
cStringNoCopy],
|
cString],
|
||||||
[NSZoneName(o_@XX@_zone(xx)) cStringNoCopy]];
|
[NSZoneName(o_@XX@_zone(xx)) cString]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = [args objectAtIndex: ++i];
|
value = [args objectAtIndex: ++i];
|
||||||
text = [value cStringNoCopy];
|
text = [value cString];
|
||||||
if (*text == '(' || *text == '{' || *text == '<') {
|
if (*text == '(' || *text == '{' || *text == '<') {
|
||||||
obj = [value propertyList];
|
obj = [value propertyList];
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = [args objectAtIndex: ++i];
|
value = [args objectAtIndex: ++i];
|
||||||
text = [value cStringNoCopy];
|
text = [value cString];
|
||||||
if (*text == '(' || *text == '{' || *text == '<') {
|
if (*text == '(' || *text == '{' || *text == '<') {
|
||||||
obj = [value propertyList];
|
obj = [value propertyList];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue