bugfix release

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@33847 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-09-16 10:38:02 +00:00
parent 246d565f13
commit f8fca7a98a
8 changed files with 231 additions and 132 deletions

View file

@ -1,3 +1,35 @@
2011-09-16 Richard Frith-Macdonald <rfm@gnu.org>
* Version: Bump to 1.22.2 for bugfix release
2011-09-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSConnection.m: When getting the local type information for
comparison with that supplied by the remote system, do so by sending
-methodSignatureForSelector: to the receiver of the message.
2011-09-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFFIInvocation.m: Check that we have a typed selector
during invocation (copy types from method signature if necessary)
so that forwarding won't fail if the runtime does a callback to
us without providing the receiver for us to check ... workaround
for proxying issues with very old runtimes.
2011-08-27 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSLock.m: Fix bug #34154 ... logic error locking before date.
2011-08-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/Additions/GSMime.m: Use specific IMP type for method
returning BOOL value.
2011-08-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m:
Fix for incorrect handling of documents with empty headers.
2011-07-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileHandle.m:

View file

@ -29,6 +29,13 @@ notice and this notice are preserved.
migrate to using a newer version of the library.
</p>
<section>
<heading>Version 1.22.2</heading>
<p>A stable bugfix release ... no API changes, a couple of fixes for
MIME document handling, locking, and Distributed Objects.
</p>
</section>
<section>
<heading>Version 1.22.1</heading>
<p>A stable bugfix release ... no API changes, mostly portability fixes

View file

@ -13,6 +13,13 @@ See the @url{ReleaseNotes.html} document for more information.
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{1.22.2}
This is a stable bugfix release. There are no major changes or binary
incompatibilities.
There is a bugfix for locking with timeouts and a fix for handling distributed
objects requests going via a local proxy as well as minor fixes in GSMIME.
@section Noteworthy changes in version @samp{1.22.1}
This is a stable bugfix release. There are no major changes or binary

View file

@ -120,6 +120,8 @@ static Class NSArrayClass = 0;
static Class NSStringClass = 0;
static Class documentClass = 0;
typedef BOOL (*boolIMP)(id, SEL, id);
@interface GSMimeDocument (Private)
- (GSMimeHeader*) _lastHeaderNamed: (NSString*)name;
- (NSUInteger) _indexOfHeaderNamed: (NSString*)name;
@ -1522,6 +1524,7 @@ wordData(NSString *word)
[self parseHeaders: [NSData dataWithBytes: "\r\n\r\n" length: 4]
remaining: 0];
flags.wantEndOfLine = 0;
flags.excessData = 0;
flags.inBody = 0;
flags.complete = 1; /* Finished parsing */
return NO; /* Want no more data */
@ -1539,7 +1542,8 @@ wordData(NSString *word)
else
{
NSUInteger i = NSMaxRange(r);
i -= [data length]; // Bytes to append to headers
[data appendBytes: [d bytes] length: i];
bytes = (unsigned char*)[data bytes];
dataEnd = [data length];
@ -2578,7 +2582,8 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
while (done == NO)
{
BOOL found = NO;
BOOL found = NO;
NSUInteger eol = len;
/*
* Search data for the next boundary.
@ -2592,7 +2597,6 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|| buf[lineStart-1] == '\n')
{
BOOL lastPart = NO;
NSUInteger eol;
lineEnd = lineStart + bLength;
eol = lineEnd;
@ -2618,6 +2622,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
}
if (eol < len && buf[eol] == '\n')
{
eol++;
flags.wantEndOfLine = 0;
found = YES;
endedFinalPart = lastPart;
@ -2769,6 +2774,16 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
sectionStart = lineStart;
if (endedFinalPart == YES)
{
if (eol < len)
{
NSData *excess;
excess = [[NSData alloc] initWithBytes: buf + eol
length: len - eol];
ASSIGN(boundary, excess);
flags.excessData = 1;
[excess release];
}
lineStart = sectionStart = 0;
[data setLength: 0];
done = YES;
@ -3035,98 +3050,141 @@ unfold(const unsigned char *src, const unsigned char *end, BOOL *folded)
* range at index NSNotFound.<br />
* Permits a bare LF as a line terminator for maximum compatibility.<br />
* Also checks for an empty line overlapping the existing data and the
* new data.
* new data.<br />
* Also, handles the special case of an empty line and no further headers.
*/
- (NSRange) _endOfHeaders: (NSData*)newData
{
unsigned nl = [newData length];
unsigned int ol = [data length];
unsigned int nl = [newData length];
unsigned int len = ol + nl;
unsigned int pos = ol;
const unsigned char *op = (const unsigned char*)[data bytes];
const unsigned char *np = (const unsigned char*)[newData bytes];
char c;
if (nl > 0)
#define C(X) ((X) < ol ? op[(X)] : np[(X)-ol])
if (ol > 0)
{
unsigned int ol = [data length];
const unsigned char *np = (const unsigned char*)[newData bytes];
if (ol > 0)
/* Find the start of any trailing CRLF or LF sequence we have already
* checked.
*/
while (pos > 0)
{
const unsigned char *op = (const unsigned char*)[data bytes];
if (np[0] == '\r' && nl > 1 && np[1] == '\n')
c = C(pos - 1);
if (c != '\r' && c != '\n')
{
/* We have a CRLF in the new data, so we check for a
* newline at the end of the old data
*/
if (op[ol-1] == '\n')
{
return NSMakeRange(0, 2);
}
break;
}
else if (np[0] == '\n')
pos--;
}
}
/* Check for a document with no headers
*/
if (0 == pos)
{
if (len < 1)
{
return NSMakeRange(NSNotFound, 0);
}
c = C(0);
if ('\n' == c)
{
return NSMakeRange(0, 1); // no headers ... just an LF.
}
if (len < 2)
{
return NSMakeRange(NSNotFound, 0);
}
if ('\r' == c && '\n' == C(1))
{
return NSMakeRange(0, 2); // no headers ... just a CRLF.
}
}
/* Now check for pairs of line ends overlapping the old and new data
*/
if (pos < ol)
{
if (pos + 2 >= len)
{
return NSMakeRange(NSNotFound, 0);
}
c = C(pos);
if ('\n' == c)
{
char c1 = C(pos + 1);
if ('\n' == c1)
{
if (op[ol-1] == '\n')
return NSMakeRange(pos, 2); // LFLF
}
if ('\r' == c1 && pos + 3 <= len && '\n' == C(pos + 2))
{
return NSMakeRange(pos, 3); // LFCRLF
}
}
else if ('\r' == c)
{
char c1 = C(pos + 1);
if ('\n' == c1 && pos + 3 <= len)
{
char c2 = C(pos + 2);
if ('\n' == c2)
{
/* LF in old and LF in new data ... empty line.
*/
return NSMakeRange(0, 1);
return NSMakeRange(pos, 3); // CRLFLF
}
else if (op[ol-1] == '\r')
if ('\r' == c2 && pos + 4 <= len && '\n' == C(pos + 3))
{
/* We have a newline crossing the boundary of old and
* new data (CR in the old data and LF in new data).
*/
if (ol > 1 && op[ol-2] == '\n')
{
return NSMakeRange(0, 1);
}
else if (nl > 1)
{
if (np[1] == '\n')
{
return NSMakeRange(0, 2);
}
else if (nl > 2 && np[1] == '\r' && np[2] == '\n')
{
return NSMakeRange(0, 3);
}
}
return NSMakeRange(pos, 4); // CRLFCRLF
}
}
}
}
if (nl >= 2)
/* Now check for end of headers in new data.
*/
pos = 0;
while (pos + 2 <= nl)
{
c = np[pos];
if ('\n' == c)
{
unsigned int i;
char c1 = np[pos + 1];
for (i = 0; i < nl; i++)
if ('\n' == c1)
{
if (np[i] == '\r')
{
unsigned l = (nl - i);
if (l >= 4 && np[i+1] == '\n' && np[i+2] == '\r'
&& np[i+3] == '\n')
{
return NSMakeRange(i, 4);
}
if (l >= 3 && np[i+1] == '\n' && np[i+2] == '\n')
{
return NSMakeRange(i, 3);
}
}
else if (np[i] == '\n')
{
unsigned l = (nl - i);
if (l >= 3 && np[i+1] == '\r' && np[i+2] == '\n')
{
return NSMakeRange(i, 3);
}
if (l >= 2 && np[i+1] == '\n')
{
return NSMakeRange(i, 2);
}
}
return NSMakeRange(pos + ol, 2); // LFLF
}
if ('\r' == c1 && pos + 3 <= nl && '\n' == np[pos + 2])
{
return NSMakeRange(pos + ol, 3); // LFCRLF
}
}
else if ('\r' == c)
{
char c1 = np[pos + 1];
if ('\n' == c1 && pos + 3 <= nl)
{
char c2 = np[pos + 2];
if ('\n' == c2)
{
return NSMakeRange(pos + ol, 3); // CRLFLF
}
if ('\r' == c2 && pos + 4 <= nl && '\n' == np[pos + 3])
{
return NSMakeRange(pos + ol, 4); // CRLFCRLF
}
pos++;
}
}
pos++;
}
return NSMakeRange(NSNotFound, 0);
@ -4341,7 +4399,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
if (charsets == 0)
{
charsets = NSCreateMapTable (NSObjectMapKeyCallBacks,
NSIntMapValueCallBacks, 0);
NSIntegerMapValueCallBacks, 0);
/*
* These mappings were obtained primarily from
@ -4621,7 +4679,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
}
if (encodings == 0)
{
encodings = NSCreateMapTable (NSIntMapKeyCallBacks,
encodings = NSCreateMapTable (NSIntegerMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
/* While the charset mappings above are many to one,
@ -5315,12 +5373,12 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
if (count > 0)
{
IMP imp1;
IMP imp2;
boolIMP imp2;
name = [name lowercaseString];
imp1 = [headers methodForSelector: @selector(objectAtIndex:)];
imp2 = [name methodForSelector: @selector(isEqualToString:)];
imp2 = (boolIMP)[name methodForSelector: @selector(isEqualToString:)];
while (count-- > 0)
{
GSMimeHeader *info;
@ -5362,11 +5420,11 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
{
NSUInteger index;
IMP imp1;
IMP imp2;
boolIMP imp2;
name = [GSMimeHeader makeToken: name preservingCase: NO];
imp1 = [headers methodForSelector: @selector(objectAtIndex:)];
imp2 = [name methodForSelector: @selector(isEqualToString:)];
imp2 = (boolIMP)[name methodForSelector: @selector(isEqualToString:)];
for (index = 0; index < count; index++)
{
GSMimeHeader *info;
@ -5396,10 +5454,10 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
NSUInteger index;
NSMutableArray *array;
IMP imp1;
IMP imp2;
boolIMP imp2;
imp1 = [headers methodForSelector: @selector(objectAtIndex:)];
imp2 = [name methodForSelector: @selector(isEqualToString:)];
imp2 = (boolIMP)[name methodForSelector: @selector(isEqualToString:)];
array = [NSMutableArray array];
for (index = 0; index < count; index++)
@ -6033,7 +6091,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
[md appendData: d];
}
}
[arp release];
[arp drain];
return md;
}
@ -6195,7 +6253,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
[self setContent: newContent];
[self setHeader: hdr];
[arp release];
[arp drain];
}
/**
@ -6222,7 +6280,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
format: @"Unable to parse type information"];
}
[self setHeader: hdr];
[arp release];
[arp drain];
}
/**
@ -6273,7 +6331,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
{
NSUInteger index;
IMP imp1 = [headers methodForSelector: @selector(objectAtIndex:)];
IMP imp2 = [name methodForSelector: @selector(isEqualToString:)];
boolIMP imp2 = (boolIMP)[name methodForSelector: @selector(isEqualToString:)];
for (index = 0; index < count; index++)
{
@ -6296,7 +6354,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
if (count > 0)
{
IMP imp1 = [headers methodForSelector: @selector(objectAtIndex:)];
IMP imp2 = [name methodForSelector: @selector(isEqualToString:)];
boolIMP imp2 = (boolIMP)[name methodForSelector: @selector(isEqualToString:)];
while (count-- > 0)
{

View file

@ -23,6 +23,11 @@
*/
#import "common.h"
#if !defined (__GNU_LIBOBJC__)
# include <objc/encoding.h>
#endif
#define EXPOSE_NSInvocation_IVARS 1
#import "Foundation/NSException.h"
#import "Foundation/NSCoder.h"
@ -428,7 +433,14 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp)
return;
}
/* Make sure we have a typed selector for forwarding.
*/
NSAssert(_selector != 0, @"you must set the selector before invoking");
if (0 == GSTypesFromSelector(_selector))
{
_selector = GSSelectorFromNameAndTypes(sel_getName(_selector),
[_sig methodType]);
}
/*
* Temporarily set new target and copy it (and the selector) into the
@ -555,7 +567,8 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
sig = nil;
if (gs_protocol_selector(GSTypesFromSelector(selector)) == YES)
{
sig = [NSMethodSignature signatureWithObjCTypes: GSTypesFromSelector(selector)];
sig = [NSMethodSignature signatureWithObjCTypes:
GSTypesFromSelector(selector)];
}
if (sig == nil)
{

View file

@ -31,6 +31,10 @@
#import "common.h"
#if !defined (__GNU_LIBOBJC__)
# include <objc/encoding.h>
#endif
#define GS_NSConnection_IVARS \
BOOL _isValid; \
BOOL _independentQueueing; \
@ -361,7 +365,7 @@ static BOOL cacheCoders = NO;
static int debug_connection = 0;
static NSHashTable *connection_table;
static NSLock *connection_table_gate = nil;
static GSLazyRecursiveLock *connection_table_gate = nil;
/*
* Locate an existing connection with the specified send and receive ports.
@ -658,7 +662,7 @@ static NSLock *cached_proxies_gate = nil;
NSCreateHashTable(NSNonRetainedObjectHashCallBacks, 0);
targetToCached =
NSCreateMapTable(NSIntMapKeyCallBacks,
NSCreateMapTable(NSIntegerMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
root_object_map =
@ -717,7 +721,7 @@ static NSLock *cached_proxies_gate = nil;
{
proxy = [[connection rootProxy] retain];
}
[arp release];
[arp drain];
return [proxy autorelease];
}
@ -745,7 +749,7 @@ static NSLock *cached_proxies_gate = nil;
{
proxy = RETAIN([connection rootProxy]);
}
[arp release];
[arp drain];
return AUTORELEASE(proxy);
}
@ -1310,7 +1314,7 @@ static NSLock *cached_proxies_gate = nil;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSConnectionDidDieNotification
object: self];
[arp release];
[arp drain];
}
/*
@ -1489,7 +1493,7 @@ static NSLock *cached_proxies_gate = nil;
return result;
}
- (void) release
- (oneway void) release
{
/* We lock the connection table while checking, to prevent
* another thread from grabbing this connection while we are
@ -1950,7 +1954,7 @@ static NSLock *cached_proxies_gate = nil;
DESTROY(IrefGate);
[arp release];
[arp drain];
}
/*
@ -2505,7 +2509,6 @@ static NSLock *cached_proxies_gate = nil;
id tmp;
id object;
SEL selector;
GSMethod meth = 0;
BOOL is_exception = NO;
unsigned flags;
int argnum;
@ -2563,35 +2566,15 @@ static NSLock *cached_proxies_gate = nil;
as the ENCODED_TYPES string, but it will have different register
and stack locations if the ENCODED_TYPES came from a machine of a
different architecture. */
if (GSObjCIsClass(object))
{
meth = GSGetMethod(object, selector, NO, YES);
}
else if (GSObjCIsInstance(object))
{
meth = GSGetMethod(object_getClass(object), selector, YES, YES);
}
else
sig = [object methodSignatureForSelector: selector];
if (nil == sig)
{
[NSException raise: NSInvalidArgumentException
format: @"decoded object %p is invalid", object];
format: @"decoded object %p doesn't handle %s",
object, sel_getName(selector)];
}
type = [sig methodType];
if (meth != 0)
{
type = method_getTypeEncoding(meth);
}
else
{
NSDebugLog(@"Local object <%p %s> doesn't implement: %s directly. "
@"Will search for arbitrary signature.",
object,
class_getName(GSObjCIsClass(object)
? object : (id)object_getClass(object)),
sel_getName(selector));
type = GSTypesFromSelector(selector);
}
/* Make sure we successfully got the method type, and that its
types match the ENCODED_TYPES. */
NSCParameterAssert (type);
@ -2602,7 +2585,6 @@ static NSLock *cached_proxies_gate = nil;
encoded_types, type, sel_getName(selector)];
}
sig = [NSMethodSignature signatureWithObjCTypes: type];
inv = [[NSInvocation alloc] initWithMethodSignature: sig];
tmptype = skip_argspec (type);
@ -3521,8 +3503,8 @@ static NSLock *cached_proxies_gate = nil;
(GSIMapKey)(NSUInteger)target, (GSIMapVal)((id)anObj));
if (debug_connection > 2)
NSLog(@"add local object (0x%x) target (0x%x) "
@"to connection (%@)", (uintptr_t)object, target, self);
NSLog(@"add local object (%p) target (0x%x) "
@"to connection (%@)", object, target, self);
M_UNLOCK(IrefGate);
}
@ -3599,8 +3581,8 @@ static NSLock *cached_proxies_gate = nil;
M_UNLOCK(cached_proxies_gate);
RELEASE(item);
if (debug_connection > 3)
NSLog(@"placed local object (0x%x) target (0x%x) in cache",
(uintptr_t)anObj, target);
NSLog(@"placed local object (%p) target (0x%x) in cache",
anObj, target);
}
/*
@ -3615,8 +3597,8 @@ static NSLock *cached_proxies_gate = nil;
GSIMapRemoveKey(IlocalTargets, (GSIMapKey)(NSUInteger)target);
if (debug_connection > 2)
NSLog(@"removed local object (0x%x) target (0x%x) "
@"from connection (%@) (ref %d)", (uintptr_t)anObj, target, self, val);
NSLog(@"removed local object (%p) target (0x%x) "
@"from connection (%@) (ref %d)", anObj, target, self, val);
}
M_UNLOCK(IrefGate);
}

View file

@ -106,7 +106,7 @@
return YES;\
}\
sched_yield();\
} while([limit timeIntervalSinceNow] < 0);\
} while ([limit timeIntervalSinceNow] > 0);\
return NO;\
}
#define MTRYLOCK \
@ -219,7 +219,7 @@ MLOCK
_NSLockError(self, _cmd, NO);
}
sched_yield();
} while([limit timeIntervalSinceNow] < 0);
} while ([limit timeIntervalSinceNow] > 0);
return NO;
}

View file

@ -7,9 +7,9 @@ GCC_VERSION=2.9.5
# The version number of this release.
MAJOR_VERSION=1
MINOR_VERSION=22
SUBMINOR_VERSION=1
SUBMINOR_VERSION=2
# numeric value should match above
VERSION_NUMBER=122.1
VERSION_NUMBER=122.2
GNUSTEP_BASE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${GNUSTEP_BASE_VERSION}