From fd9e1db26c3a91ddf54298ae49e23a180791d2ff Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 8 Jan 2013 21:59:38 +0000 Subject: [PATCH] fix range error in last substring creation change git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35940 72102866-910b-0410-8b05-ffd578937521 --- Headers/GNUstepBase/NSStream+GNUstepBase.h | 28 ++++++++++++++-------- Source/GSString.m | 2 ++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Headers/GNUstepBase/NSStream+GNUstepBase.h b/Headers/GNUstepBase/NSStream+GNUstepBase.h index ac78b617e..0762ca8a7 100644 --- a/Headers/GNUstepBase/NSStream+GNUstepBase.h +++ b/Headers/GNUstepBase/NSStream+GNUstepBase.h @@ -36,7 +36,7 @@ extern "C" { #if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) /** - * The additionalinterface defined for GNUstep.
+ * The additional interface defined for GNUstep.
* Currently NOT implemented when using the Apple Foundation!
* Please contribute an Apple implementation. */ @@ -63,7 +63,7 @@ extern "C" { /** * GSServerStream is a subclass of NSStream that encapsulate a "server" - * stream; * that is a stream that binds to a socket and accepts incoming + * stream; that is a stream that binds to a socket and accepts incoming * connections.
* Currently NOT implemented when using the Apple Foundation!
* Please contribute an Apple implementation. @@ -71,32 +71,40 @@ extern "C" { @interface GSServerStream : NSStream /** - * Createe a ip (ipv6) server stream + * Create an IP (ipv4 or ipv6) server stream.
+ * The addr argument must be a string object containing a standard text + * representation of an internet address (either the dot separated ipv4 + * syntax or the colon separated ipv6 syntax). */ + (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port; /** - * Create a local (unix domain or named pipe) server stream + * Create a local (unix domain or named pipe) server stream. */ + (id) serverStreamToAddr: (NSString*)addr; /** * This is the method that accepts a connection and generates two streams - * as the server side inputStream and OutputStream. - * Although you still need to open them, the open will be - * instantanious, and no NSStreamEventOpenCompleted event will be delivered. + * as the server side inputStream and OutputStream.
+ * You call this when you receive an event on the server stream signalling + * that it is 'readable' (bytes available).
+ * Although you still need to open them, the open will be instantaneous, + * and no NSStreamEventOpenCompleted event will be delivered. */ - (void) acceptWithInputStream: (NSInputStream **)inputStream outputStream: (NSOutputStream **)outputStream; /** - * the designated initializer for a ip (ipv6) server stream + * The designated initializer for an IP (ipv4 or ipv6) server stream.
+ * The addr argument must be a string object containing a standard text + * representation of an internet address (either the dot separated ipv4 + * syntax or the colon separated ipv6 syntax). */ - (id) initToAddr: (NSString*)addr port: (NSInteger)port; /** - * the designated initializer for a local (unix domain or named pipe) - * server stream + * The designated initializer for a local (unix domain or named pipe) + * server stream. */ - (id) initToAddr: (NSString*)addr; diff --git a/Source/GSString.m b/Source/GSString.m index c4021e270..285b21c09 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -3855,6 +3855,7 @@ agree, create a new GSCInlineString otherwise. s = createTinyString((char*)_contents.c + aRange.location, aRange.length); if (nil == s) { + aRange.location += (_contents.c - _parent->_contents.c); s = substring_c((GSStr)_parent, aRange); } return s; @@ -3868,6 +3869,7 @@ agree, create a new GSCInlineString otherwise. s = createTinyString((char*)_contents.c + aRange.location, aRange.length); if (nil == s) { + aRange.location += (_contents.c - _parent->_contents.c); s = substring_c((GSStr)_parent, aRange); } return s;