Don't pass %@ directives to printf(); use %s and -cStringNoCopy instead.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1835 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1996-09-25 13:44:33 +00:00
parent 1345326c69
commit 92a7802f1b
2 changed files with 22 additions and 13 deletions

View file

@ -66,18 +66,18 @@ int main(int argc, char *argv[])
}
}
/* Cause an exception, and watch it return to us. */
/* Cause an exception in the server, and watch it return to us. */
NS_DURING
{
[remote_array objectAtIndex: 99];
}
NS_HANDLER
{
printf("Caught our exception\n"
"NAME: %@\n"
"REASON: %@\n",
[localException name],
[localException reason]);
printf("Exceptions are working; caught exception:\n"
"NAME: %s\n"
"REASON: %s\n",
[[localException name] cStringNoCopy],
[[localException reason] cStringNoCopy]);
[localException release];
}
NS_ENDHANDLER

View file

@ -12,8 +12,9 @@ id announce_new_port (id notification)
{
id in_port = [notification object];
id out_port = [notification userInfo];
printf ("{%@}\n\tconnected to\n\t{%@}\n",
[out_port description], [in_port description]);
printf ("{%s}\n\tconnected to\n\t{%s}\n",
[[out_port description] cStringNoCopy],
[[in_port description] cStringNoCopy]);
printf ("Now servicing %d connection(s).\n",
[in_port numberOfConnectedOutPorts]);
return nil;
@ -25,8 +26,9 @@ id announce_broken_port (id notification)
{
id in_port = [notification object];
id out_port = [notification userInfo];
printf ("{%@}\n\tdisconnected from\n\t{%@}\n",
[out_port description], [in_port description]);
printf ("{%s}\n\tdisconnected from\n\t{%s}\n",
[[out_port description] cStringNoCopy],
[[in_port description] cStringNoCopy]);
printf ("Now servicing %d connection(s).\n",
[in_port numberOfConnectedOutPorts]);
return nil;
@ -125,11 +127,18 @@ int main(int argc, char *argv[])
object: nil];
if (argc > 1)
c = [Connection newRegisteringAtName: [String stringWithCString: argv[1]]
{
c = [Connection newRegisteringAtName: [String stringWithCString: argv[1]]
withRootObject:s];
printf("Regsitered server object on localhost with "
"name `%s'\n", argv[1]);
}
else
c = [Connection newRegisteringAtName: @"secondserver" withRootObject: s];
printf("Regsitered server object on localhost with name `secondserver'\n");
{
c = [Connection newRegisteringAtName: @"secondserver" withRootObject: s];
printf("Regsitered server object on localhost with "
"name `secondserver'\n");
}
[c setDelegate:s];
[NotificationDispatcher