Minor tweaks.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-11-10 03:01:45 +00:00
parent 2be7da8ea9
commit 4c6b1d6d75
4 changed files with 56 additions and 23 deletions

View file

@ -1,3 +1,8 @@
2000-11-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpPort.m: Added some locking tweaks for writing data.
* Source/GSString.m: Fix for decoding obsolete string classes.
2000-11-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPort.m: ([-setDelegate:]) corrected assertion to allow

View file

@ -2935,8 +2935,9 @@ transmute(ivars self, NSString *aString)
{
unsigned count;
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
self = (id)NSAllocateObject(GSCStringClass, 0, GSObjCZone(self));
self = (id)NSAllocateObject(GSCStringClass, 0, NSDefaultMallocZone());
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
if (count > 0)
{
@ -2965,8 +2966,9 @@ transmute(ivars self, NSString *aString)
{
unsigned count;
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
self = (id)NSAllocateObject(GSMutableStringClass, 0, GSObjCZone(self));
self = (id)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone());
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
if (count > 0)
{
@ -2995,8 +2997,9 @@ transmute(ivars self, NSString *aString)
{
unsigned count;
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
self = (id)NSAllocateObject(GSUnicodeStringClass, 0, GSObjCZone(self));
self = (id)NSAllocateObject(GSUnicodeStringClass, 0, NSDefaultMallocZone());
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
if (count > 0)
{
@ -3025,8 +3028,9 @@ transmute(ivars self, NSString *aString)
{
unsigned count;
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
RELEASE(self);
self = (id)NSAllocateObject(GSMutableStringClass, 0, GSObjCZone(self));
self = (id)NSAllocateObject(GSMutableStringClass, 0, NSDefaultMallocZone());
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
if (count > 0)
{

View file

@ -720,7 +720,6 @@ static Class runLoopClass;
NSDebugMLLog(@"GSTcpHandle", @"read %d bytes", res);
rLength += res;
while (valid == YES && rLength >= rWant)
{
switch (rType)
@ -1004,12 +1003,14 @@ static Class runLoopClass;
}
b = [wData bytes];
l = [wData length];
DO_LOCK(myLock);
res = write(desc, b + wLength, l - wLength);
if (res < 0)
{
if (errno != EINTR && errno != EAGAIN)
{
NSLog(@"write attempt failed - %s", strerror(errno));
DO_UNLOCK(myLock);
[self invalidate];
return;
}
@ -1056,6 +1057,7 @@ static Class runLoopClass;
}
}
}
DO_UNLOCK(myLock);
}
}
}

View file

@ -328,11 +328,12 @@ usage(const char *program)
printf(" -m - Messaging test\n");
printf(" -l - Loop test\n");
printf(" -o - Objects test\n");
printf(" -c - Connect test\n");
}
typedef enum {
NO_TEST, TYPE_TEST, BENCHMARK_TEST, MESSAGE_TEST,
LOOP_TEST, OBJECT_TEST
LOOP_TEST, OBJECT_TEST, CONNECT_TEST
} test_t;
int main (int argc, char *argv[], char **env)
@ -340,6 +341,7 @@ int main (int argc, char *argv[], char **env)
int c, debug, stats;
test_t type_test;
id cobj, prx;
unsigned connect_attempts;
NSAutoreleasePool *arp;
Auth *auth;
#ifndef __MINGW__
@ -355,7 +357,7 @@ int main (int argc, char *argv[], char **env)
debug = 0;
type_test = 0;
stats = 0;
while ((c = getopt(argc, argv, "hdtbmslo")) != EOF)
while ((c = getopt(argc, argv, "hdtbmsloc")) != EOF)
switch (c)
{
case 'd':
@ -379,6 +381,9 @@ int main (int argc, char *argv[], char **env)
case 'o':
type_test = OBJECT_TEST;
break;
case 'c':
type_test = CONNECT_TEST;
break;
case 'h':
usage(argv[0]);
exit(0);
@ -398,25 +403,42 @@ int main (int argc, char *argv[], char **env)
//[NSPort setDebug: 10];
}
if (optind < argc)
if (type_test == CONNECT_TEST)
connect_attempts = 100000;
else
connect_attempts = 1;
while (connect_attempts-- > 0)
{
if (optind+1 < argc)
prx = [NSConnection rootProxyForConnectionWithRegisteredName:
[NSString stringWithCString: argv[optind+1]]
host: [NSString stringWithCString:argv[optind]]];
if (optind < argc)
{
if (optind+1 < argc)
prx = [NSConnection rootProxyForConnectionWithRegisteredName:
[NSString stringWithCString: argv[optind+1]]
host: [NSString stringWithCString:argv[optind]]];
else
prx = [NSConnection rootProxyForConnectionWithRegisteredName:
@"test2server"
host:[NSString stringWithCString:argv[optind]]];
}
else
prx = [NSConnection rootProxyForConnectionWithRegisteredName:
@"test2server"
host:[NSString stringWithCString:argv[optind]]];
}
else
prx = [NSConnection rootProxyForConnectionWithRegisteredName:@"test2server"
host:nil];
if (prx == nil)
{
printf("ERROR: Failed to connect to server\n");
return -1;
@"test2server"
host:nil];
if (prx == nil)
{
printf("ERROR: Failed to connect to server\n");
return -1;
}
if (type_test == CONNECT_TEST)
{
NSLog(@"Made connection\n");
if (connect_attempts > 0)
{
RELEASE(arp);
arp = [NSAutoreleasePool new];
}
}
}
cobj = [prx connectionForProxy];