From 95bc03e7f4b8b5552d6a2abc5faa1de4ca4c0170 Mon Sep 17 00:00:00 2001 From: mccallum Date: Mon, 3 Apr 1995 03:23:45 +0000 Subject: [PATCH] Use (id ) instead of (String*) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@241 72102866-910b-0410-8b05-ffd578937521 --- Source/Connection.m | 8 ++++---- Source/MutableString.m | 1 + Source/NSString.m | 2 ++ Source/Port.m | 4 ++-- Source/SocketPort.m | 6 +++--- Source/String.m | 45 ++++++++++++++++++++++-------------------- 6 files changed, 36 insertions(+), 30 deletions(-) diff --git a/Source/Connection.m b/Source/Connection.m index 8f98c0e22..11cd0b7a5 100644 --- a/Source/Connection.m +++ b/Source/Connection.m @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @interface Connection (GettingCoderInterface) @@ -448,7 +448,7 @@ static int messagesReceivedCount; if we're connecting to another Connection that already registered with that name. */ -+ (Connection*) newRegisteringAtName: (String*)n withRootObject: anObj ++ (Connection*) newRegisteringAtName: (id )n withRootObject: anObj { id newPort; id newConn; @@ -460,12 +460,12 @@ static int messagesReceivedCount; return newConn; } -+ (Proxy*) rootProxyAtName: (String*)n ++ (Proxy*) rootProxyAtName: (id )n { return [self rootProxyAtName:n onHost:@""]; } -+ (Proxy*) rootProxyAtName: (String*)n onHost: (String*)h ++ (Proxy*) rootProxyAtName: (id )n onHost: (id )h { id p = [default_port_class newPortFromRegisterWithName:n onHost:h]; return [self rootProxyAtPort:p]; diff --git a/Source/MutableString.m b/Source/MutableString.m index 5abb84b4f..1fb7448d5 100644 --- a/Source/MutableString.m +++ b/Source/MutableString.m @@ -23,6 +23,7 @@ #include #include +#include /* memcpy(), strlen(), strcmp() are gcc builtin's */ #include diff --git a/Source/NSString.m b/Source/NSString.m index e8b6b22b1..f33530608 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -36,6 +36,7 @@ #include #include #include +#include #include @implementation NSString @@ -45,6 +46,7 @@ static done = 0; if (!done) { + class_add_behavior([NSString class], [String class]); class_add_behavior([NSString class], [IndexedCollection class]); done = 1; } diff --git a/Source/Port.m b/Source/Port.m index d01f36984..da47fb409 100644 --- a/Source/Port.m +++ b/Source/Port.m @@ -26,13 +26,13 @@ @implementation Port -+ newRegisteredPortWithName: (String*)n ++ newRegisteredPortWithName: (id )n { [self notImplemented:_cmd]; return nil; } -+ newPortFromRegisterWithName: (String*)n onHost: (String*)host ++ newPortFromRegisterWithName: (id )n onHost: (id )host { [self notImplemented:_cmd]; return nil; diff --git a/Source/SocketPort.m b/Source/SocketPort.m index 83b6b596e..670e939c5 100644 --- a/Source/SocketPort.m +++ b/Source/SocketPort.m @@ -93,7 +93,7 @@ name_to_port_number (const char *name) return self; } -+ newPortFromRegisterWithName: (String*)name onHost: (String*)h ++ newPortFromRegisterWithName: (id )name onHost: (id )h { id p; int n; @@ -108,7 +108,7 @@ name_to_port_number (const char *name) return p; } -+ newRegisteredPortWithName: (String*)name ++ newRegisteredPortWithName: (id )name { int n; @@ -241,7 +241,7 @@ s1.sin_addr.s_addr == s2.sin_addr.s_addr) return sp; } -+ newRemoteWithNumber: (int)n onHost: (String*)h ++ newRemoteWithNumber: (int)n onHost: (id )h { struct sockaddr_in remote_addr; struct hostent *hp; diff --git a/Source/String.m b/Source/String.m index 6f580ffe2..77ed817c4 100644 --- a/Source/String.m +++ b/Source/String.m @@ -49,7 +49,10 @@ + (void) initialize { if (self == [String class]) - [self setVersion:0]; /* beta release */ + { + [self setVersion:0]; /* beta release */ + /* xxx eventually: class_add_behavior_category(NSStringStuff) */ + } } // INITIALIZING; @@ -97,7 +100,7 @@ } #if HAVE_VSPRINTF -- initWithFormat: (String*)aFormatString arguments: (va_list)arg +- initWithFormat: (id )aFormatString arguments: (va_list)arg { char buf[128]; /* xxx horrible, disgusting, fix this */ vsprintf(buf, [aFormatString cString], arg); @@ -112,7 +115,7 @@ } #endif /* HAVE_VSPRINTF */ -- initWithFormat: (String*)aFormatString, ... +- initWithFormat: (id )aFormatString, ... { va_list ap; va_start(ap, aFormatString); @@ -135,17 +138,17 @@ return [self initWithCString:""]; } -- initWithString: (String*)aString range: (IndexRange)aRange +- initWithString: (id )aString range: (IndexRange)aRange { return [self initWithCString:[aString cString] range:aRange]; } -- initWithString: (String*)aString length: (unsigned)aLength +- initWithString: (id )aString length: (unsigned)aLength { return [self initWithCString:[aString cString]]; } -- initWithString: (String*)aString +- initWithString: (id )aString { return [self initWithCString:[aString cString]]; } @@ -153,19 +156,19 @@ // GETTING NEW, AUTORELEASED STRING OBJECTS, NO NEED TO RELEASE THESE; -+ (String*) stringWithString: (String*)aString range: (IndexRange)aRange ++ stringWithString: (id )aString range: (IndexRange)aRange { return [[[CString alloc] initWithString:aString range:aRange] autorelease]; } -+ (String*) stringWithString: (String*)aString ++ stringWithString: (id )aString { return [[[CString alloc] initWithString:aString] autorelease]; } -+ (String*) stringWithFormat: (String*)aFormatString, ... ++ stringWithFormat: (id )aFormatString, ... { va_list ap; id ret; @@ -177,56 +180,56 @@ return ret; } -+ (String*) stringWithFormat: (String*)aFormatString arguments: (va_list)arg ++ stringWithFormat: (id )aFormatString arguments: (va_list)arg { return [[[CString alloc] initWithFormat:aFormatString arguments:arg] autorelease]; } -+ (String*) stringWithCString: (const char*)cp range: (IndexRange)r ++ stringWithCString: (const char*)cp range: (IndexRange)r { return [[[CString alloc] initWithCString:cp range:r] autorelease]; } -+ (String*) stringWithCString: (const char*)aCharPtr ++ stringWithCString: (const char*)aCharPtr { return [[[CString alloc] initWithCString:aCharPtr] autorelease]; } -- (String*) stringByAppendingFormat: (String*)aString, ... +- stringByAppendingFormat: (id )aString, ... { [self notImplemented:_cmd]; return nil; } -- (String*) stringByAppendingFormat: (String*)aString arguments: (va_list)arg +- stringByAppendingFormat: (id )aString arguments: (va_list)arg { [self notImplemented:_cmd]; return nil; } -- (String*) stringByPrependingFormat: (String*)aString, ... +- stringByPrependingFormat: (id )aString, ... { [self notImplemented:_cmd]; return nil; } -- (String*) stringByPrependingFormat: (String*)aString arguments: (va_list)arg +- stringByPrependingFormat: (id )aString arguments: (va_list)arg { [self notImplemented:_cmd]; return nil; } -- (String*) stringByAppendingString: (String*)aString +- stringByAppendingString: (id )aString { [self notImplemented:_cmd]; return nil; } -- (String*) stringByPrependingString: (String*)aString +- stringByPrependingString: (id )aString { [self notImplemented:_cmd]; return nil; @@ -255,12 +258,12 @@ - copy { - return [[[self class] alloc] initWithString:self]; + return [[[self class] alloc] initWithString:(NSString*)self]; } - mutableCopy { - return [[MutableCString alloc] initWithString:self]; + return [[MutableCString alloc] initWithString:(NSString*)self]; } // TESTING; @@ -330,7 +333,7 @@ return (strrchr(s, aChar) - s); } -- (unsigned) indexOfString: (String*)aString +- (unsigned) indexOfString: (id )aString { const char *s = [self cString]; return (strstr(s, [aString cString]) - s);