mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
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:
parent
71faa85784
commit
6c36e166d7
9 changed files with 28 additions and 25 deletions
|
@ -69,7 +69,7 @@
|
|||
@end
|
||||
|
||||
@interface TclInvocation
|
||||
- initWithTcl: (Tcl*)t command: (const char*)c;
|
||||
- initWithTcl: (Tcl*)t command: (String*)c;
|
||||
@end
|
||||
|
||||
@interface Collection (Invokes)
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
@interface Port : RetainingNotifier <Coding>
|
||||
|
||||
/* 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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
@end
|
||||
|
||||
@interface TclInvocation
|
||||
- initWithTcl: (Tcl*)t command: (const char*)c;
|
||||
- initWithTcl: (Tcl*)t command: (String*)c;
|
||||
@end
|
||||
|
||||
@interface Collection (Invokes)
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
@interface Port : RetainingNotifier <Coding>
|
||||
|
||||
/* 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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue