Use String* instead of char*.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@112 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1995-03-12 21:50:07 +00:00
parent 71faa85784
commit 6c36e166d7
9 changed files with 28 additions and 25 deletions

View file

@ -69,7 +69,7 @@
@end @end
@interface TclInvocation @interface TclInvocation
- initWithTcl: (Tcl*)t command: (const char*)c; - initWithTcl: (Tcl*)t command: (String*)c;
@end @end
@interface Collection (Invokes) @interface Collection (Invokes)

View file

@ -33,8 +33,8 @@
@interface Port : RetainingNotifier <Coding> @interface Port : RetainingNotifier <Coding>
/* xxx These will probably change */ /* xxx These will probably change */
+ newRegisteredPortWithName: (const char *)n; + newRegisteredPortWithName: (String*)n;
+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host; + newPortFromRegisterWithName: (String*)n onHost: (String*)host;
+ newPort; + newPort;
/* xxx These sending and receiving interfaces will change */ /* xxx These sending and receiving interfaces will change */

View file

@ -45,7 +45,7 @@ typedef struct sockaddr_in sockport_t;
+ newForSockPort: (sockport_t)s; + newForSockPort: (sockport_t)s;
+ newLocalWithNumber: (int)n; + newLocalWithNumber: (int)n;
+ newLocal; + newLocal;
+ newRemoteWithNumber: (int)n onHost: (const char*)h; + newRemoteWithNumber: (int)n onHost: (String*)h;
- (sockport_t) sockPort; - (sockport_t) sockPort;

View file

@ -448,7 +448,7 @@ static int messagesReceivedCount;
if we're connecting to another Connection that already registered if we're connecting to another Connection that already registered
with that name. */ with that name. */
+ (Connection*) newRegisteringAtName: (const char*)n withRootObject: anObj + (Connection*) newRegisteringAtName: (String*)n withRootObject: anObj
{ {
id newPort; id newPort;
id newConn; id newConn;
@ -460,12 +460,12 @@ static int messagesReceivedCount;
return newConn; return newConn;
} }
+ (Proxy*) rootProxyAtName: (const char*)n; + (Proxy*) rootProxyAtName: (String*)n;f
{ {
return [self rootProxyAtName:n onHost:""]; 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]; id p = [default_port_class newPortFromRegisterWithName:n onHost:h];
return [self rootProxyAtPort:p]; return [self rootProxyAtPort:p];

View file

@ -26,13 +26,13 @@
@implementation Port @implementation Port
+ newRegisteredPortWithName: (const char *)n + newRegisteredPortWithName: (String*)n
{ {
[self notImplemented:_cmd]; [self notImplemented:_cmd];
return nil; return nil;
} }
+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host + newPortFromRegisterWithName: (String*)n onHost: (String*)host
{ {
[self notImplemented:_cmd]; [self notImplemented:_cmd];
return nil; return nil;

View file

@ -93,30 +93,30 @@ name_to_port_number (const char *name)
return self; return self;
} }
+ newPortFromRegisterWithName: (const char *)name onHost: (const char *)h + newPortFromRegisterWithName: (String*)name onHost: (String*)h
{ {
id p; id p;
int n; int n;
#if SOCKETPORT_NUMBER_NAMES_ONLY #if SOCKETPORT_NUMBER_NAMES_ONLY
if ((n = atoi(name)) == 0) if ((n = atoi([name cString])) == 0)
[self error:"Name (%s) is not a number", name]; [self error:"Name (%s) is not a number", [name cString]];
#else #else
n = name_to_port_number(name); n = name_to_port_number([name cString]);
#endif #endif
p = [SocketPort newRemoteWithNumber:n onHost:h]; p = [SocketPort newRemoteWithNumber:n onHost:h];
return p; return p;
} }
+ newRegisteredPortWithName: (const char *)name + newRegisteredPortWithName: (String*)name
{ {
int n; int n;
#if SOCKET_NUMBER_NAMES_ONLY #if SOCKET_NUMBER_NAMES_ONLY
if ((n = atoi(name)) == 0) if ((n = atoi([name cString])) == 0)
return nil; return nil;
#else #else
n = name_to_port_number(name); n = name_to_port_number([name cString]);
#endif #endif
return [SocketPort newLocalWithNumber:n]; return [SocketPort newLocalWithNumber:n];
} }
@ -241,22 +241,25 @@ s1.sin_addr.s_addr == s2.sin_addr.s_addr)
return sp; return sp;
} }
+ newRemoteWithNumber: (int)n onHost: (const char*)h + newRemoteWithNumber: (int)n onHost: (String*)h
{ {
struct sockaddr_in remote_addr; struct sockaddr_in remote_addr;
struct hostent *hp; struct hostent *hp;
const char *hs;
/* xxx clean this up */ /* xxx clean this up */
if (n > 65535 - IPPORT_USERRESERVED - 1) if (n > 65535 - IPPORT_USERRESERVED - 1)
[self error:"port number too high"]; [self error:"port number too high"];
n += IPPORT_USERRESERVED + 1; n += IPPORT_USERRESERVED + 1;
if (!h || !(*h)) if (!h || ![h length])
h = "localhost"; hs = "localhost";
else
hs = [h cString];
hp = gethostbyname((char*)h); hp = gethostbyname((char*)hs);
if (hp == 0) 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); bcopy(hp->h_addr, &remote_addr.sin_addr, hp->h_length);
remote_addr.sin_family = AF_INET; remote_addr.sin_family = AF_INET;
remote_addr.sin_port = htons(n); remote_addr.sin_port = htons(n);

View file

@ -69,7 +69,7 @@
@end @end
@interface TclInvocation @interface TclInvocation
- initWithTcl: (Tcl*)t command: (const char*)c; - initWithTcl: (Tcl*)t command: (String*)c;
@end @end
@interface Collection (Invokes) @interface Collection (Invokes)

View file

@ -33,8 +33,8 @@
@interface Port : RetainingNotifier <Coding> @interface Port : RetainingNotifier <Coding>
/* xxx These will probably change */ /* xxx These will probably change */
+ newRegisteredPortWithName: (const char *)n; + newRegisteredPortWithName: (String*)n;
+ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host; + newPortFromRegisterWithName: (String*)n onHost: (String*)host;
+ newPort; + newPort;
/* xxx These sending and receiving interfaces will change */ /* xxx These sending and receiving interfaces will change */

View file

@ -45,7 +45,7 @@ typedef struct sockaddr_in sockport_t;
+ newForSockPort: (sockport_t)s; + newForSockPort: (sockport_t)s;
+ newLocalWithNumber: (int)n; + newLocalWithNumber: (int)n;
+ newLocal; + newLocal;
+ newRemoteWithNumber: (int)n onHost: (const char*)h; + newRemoteWithNumber: (int)n onHost: (String*)h;
- (sockport_t) sockPort; - (sockport_t) sockPort;