From 6c36e166d7e8777dbafa668ce30d250a8f0771aa Mon Sep 17 00:00:00 2001 From: Andrew McCallum Date: Sun, 12 Mar 1995 21:50:07 +0000 Subject: [PATCH] Use String* instead of char*. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@112 72102866-910b-0410-8b05-ffd578937521 --- Headers/gnustep/base/Invocation.h | 2 +- Headers/gnustep/base/Port.h | 4 ++-- Headers/gnustep/base/SocketPort.h | 2 +- Source/Connection.m | 6 +++--- Source/Port.m | 4 ++-- Source/SocketPort.m | 27 +++++++++++++++------------ Source/objects/Invocation.h | 2 +- Source/objects/Port.h | 4 ++-- Source/objects/SocketPort.h | 2 +- 9 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Headers/gnustep/base/Invocation.h b/Headers/gnustep/base/Invocation.h index 708e9f583..24d2cb20a 100644 --- a/Headers/gnustep/base/Invocation.h +++ b/Headers/gnustep/base/Invocation.h @@ -69,7 +69,7 @@ @end @interface TclInvocation -- initWithTcl: (Tcl*)t command: (const char*)c; +- initWithTcl: (Tcl*)t command: (String*)c; @end @interface Collection (Invokes) diff --git a/Headers/gnustep/base/Port.h b/Headers/gnustep/base/Port.h index 48c948f6c..11f1061dd 100644 --- a/Headers/gnustep/base/Port.h +++ b/Headers/gnustep/base/Port.h @@ -33,8 +33,8 @@ @interface Port : RetainingNotifier /* xxx These will probably change */ -+ newRegisteredPortWithName: (const char *)n; -+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host; ++ newRegisteredPortWithName: (String*)n; ++ newPortFromRegisterWithName: (String*)n onHost: (String*)host; + newPort; /* xxx These sending and receiving interfaces will change */ diff --git a/Headers/gnustep/base/SocketPort.h b/Headers/gnustep/base/SocketPort.h index 19e90d464..d85b27e7b 100644 --- a/Headers/gnustep/base/SocketPort.h +++ b/Headers/gnustep/base/SocketPort.h @@ -45,7 +45,7 @@ typedef struct sockaddr_in sockport_t; + newForSockPort: (sockport_t)s; + newLocalWithNumber: (int)n; + newLocal; -+ newRemoteWithNumber: (int)n onHost: (const char*)h; ++ newRemoteWithNumber: (int)n onHost: (String*)h; - (sockport_t) sockPort; diff --git a/Source/Connection.m b/Source/Connection.m index 321a74bbb..1b5bfc39e 100644 --- a/Source/Connection.m +++ b/Source/Connection.m @@ -448,7 +448,7 @@ static int messagesReceivedCount; if we're connecting to another Connection that already registered with that name. */ -+ (Connection*) newRegisteringAtName: (const char*)n withRootObject: anObj ++ (Connection*) newRegisteringAtName: (String*)n withRootObject: anObj { id newPort; id newConn; @@ -460,12 +460,12 @@ static int messagesReceivedCount; return newConn; } -+ (Proxy*) rootProxyAtName: (const char*)n; ++ (Proxy*) rootProxyAtName: (String*)n;f { return [self rootProxyAtName:n onHost:""]; } -+ (Proxy*) rootProxyAtName: (const char*)n onHost: (const char*)h; ++ (Proxy*) rootProxyAtName: (String*)n onHost: (String*)h; { id p = [default_port_class newPortFromRegisterWithName:n onHost:h]; return [self rootProxyAtPort:p]; diff --git a/Source/Port.m b/Source/Port.m index c50a4634c..d01f36984 100644 --- a/Source/Port.m +++ b/Source/Port.m @@ -26,13 +26,13 @@ @implementation Port -+ newRegisteredPortWithName: (const char *)n ++ newRegisteredPortWithName: (String*)n { [self notImplemented:_cmd]; return nil; } -+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host ++ newPortFromRegisterWithName: (String*)n onHost: (String*)host { [self notImplemented:_cmd]; return nil; diff --git a/Source/SocketPort.m b/Source/SocketPort.m index 038957bfc..83a1f0f34 100644 --- a/Source/SocketPort.m +++ b/Source/SocketPort.m @@ -93,30 +93,30 @@ name_to_port_number (const char *name) return self; } -+ newPortFromRegisterWithName: (const char *)name onHost: (const char *)h ++ newPortFromRegisterWithName: (String*)name onHost: (String*)h { id p; int n; #if SOCKETPORT_NUMBER_NAMES_ONLY - if ((n = atoi(name)) == 0) - [self error:"Name (%s) is not a number", name]; + if ((n = atoi([name cString])) == 0) + [self error:"Name (%s) is not a number", [name cString]]; #else - n = name_to_port_number(name); + n = name_to_port_number([name cString]); #endif p = [SocketPort newRemoteWithNumber:n onHost:h]; return p; } -+ newRegisteredPortWithName: (const char *)name ++ newRegisteredPortWithName: (String*)name { int n; #if SOCKET_NUMBER_NAMES_ONLY - if ((n = atoi(name)) == 0) + if ((n = atoi([name cString])) == 0) return nil; #else - n = name_to_port_number(name); + n = name_to_port_number([name cString]); #endif return [SocketPort newLocalWithNumber:n]; } @@ -241,22 +241,25 @@ s1.sin_addr.s_addr == s2.sin_addr.s_addr) return sp; } -+ newRemoteWithNumber: (int)n onHost: (const char*)h ++ newRemoteWithNumber: (int)n onHost: (String*)h { struct sockaddr_in remote_addr; struct hostent *hp; + const char *hs; /* xxx clean this up */ if (n > 65535 - IPPORT_USERRESERVED - 1) [self error:"port number too high"]; n += IPPORT_USERRESERVED + 1; - if (!h || !(*h)) - h = "localhost"; + if (!h || ![h length]) + hs = "localhost"; + else + hs = [h cString]; - hp = gethostbyname((char*)h); + hp = gethostbyname((char*)hs); if (hp == 0) - [self error:"unknown host: \"%s\"", h]; + [self error:"unknown host: \"%s\"", hs]; bcopy(hp->h_addr, &remote_addr.sin_addr, hp->h_length); remote_addr.sin_family = AF_INET; remote_addr.sin_port = htons(n); diff --git a/Source/objects/Invocation.h b/Source/objects/Invocation.h index 708e9f583..24d2cb20a 100644 --- a/Source/objects/Invocation.h +++ b/Source/objects/Invocation.h @@ -69,7 +69,7 @@ @end @interface TclInvocation -- initWithTcl: (Tcl*)t command: (const char*)c; +- initWithTcl: (Tcl*)t command: (String*)c; @end @interface Collection (Invokes) diff --git a/Source/objects/Port.h b/Source/objects/Port.h index 48c948f6c..11f1061dd 100644 --- a/Source/objects/Port.h +++ b/Source/objects/Port.h @@ -33,8 +33,8 @@ @interface Port : RetainingNotifier /* xxx These will probably change */ -+ newRegisteredPortWithName: (const char *)n; -+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host; ++ newRegisteredPortWithName: (String*)n; ++ newPortFromRegisterWithName: (String*)n onHost: (String*)host; + newPort; /* xxx These sending and receiving interfaces will change */ diff --git a/Source/objects/SocketPort.h b/Source/objects/SocketPort.h index 19e90d464..d85b27e7b 100644 --- a/Source/objects/SocketPort.h +++ b/Source/objects/SocketPort.h @@ -45,7 +45,7 @@ typedef struct sockaddr_in sockport_t; + newForSockPort: (sockport_t)s; + newLocalWithNumber: (int)n; + newLocal; -+ newRemoteWithNumber: (int)n onHost: (const char*)h; ++ newRemoteWithNumber: (int)n onHost: (String*)h; - (sockport_t) sockPort;