mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Attempt fix for bug #24978
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27183 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f75821ae08
commit
1d51e83998
5 changed files with 66 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-12-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSKeyValueCoding.m:
|
||||
* Source/NSURLProtocol.m:
|
||||
* Headers/Additions/GNUstepBase/GSObjCRuntime.h:
|
||||
* Testing/nsconnection_client.m:
|
||||
When working with abstract selectors, try to use untyped ones so that
|
||||
we don't confuse checks we put into the method signature code.
|
||||
|
||||
2008-11-30 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* install.sh: Fix header syntax and provide default for make
|
||||
|
|
|
@ -312,7 +312,7 @@ GSSelectorFromName(const char *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
return sel_get_any_uid(name);
|
||||
return sel_get_uid(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -603,13 +603,13 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
buf[4] = hi;
|
||||
|
||||
name = buf; // _getKey
|
||||
sel = sel_get_any_uid(name);
|
||||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
buf[3] = '_';
|
||||
buf[4] = lo;
|
||||
name = &buf[3]; // _key
|
||||
sel = sel_get_any_uid(name);
|
||||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
sel = 0;
|
||||
|
@ -631,12 +631,12 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
buf[3] = 't';
|
||||
buf[4] = hi;
|
||||
name = &buf[1]; // getKey
|
||||
sel = sel_get_any_uid(name);
|
||||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
buf[4] = lo;
|
||||
name = &buf[4]; // key
|
||||
sel = sel_get_any_uid(name);
|
||||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
sel = 0;
|
||||
|
|
|
@ -32,6 +32,20 @@
|
|||
#import "GSPrivate.h"
|
||||
#import "GSURLPrivate.h"
|
||||
|
||||
#if defined(HAVE_ZLIB_H)
|
||||
#include <zlib.h>
|
||||
|
||||
static void*
|
||||
zalloc(void *opaque, size_t size)
|
||||
{
|
||||
return objc_malloc(size);
|
||||
}
|
||||
static void
|
||||
zfree(void *opaque, void *mem)
|
||||
{
|
||||
objc_free(mem);
|
||||
}
|
||||
#endif
|
||||
|
||||
@interface _NSAboutURLProtocol : NSURLProtocol
|
||||
@end
|
||||
|
@ -74,6 +88,12 @@ typedef struct {
|
|||
NSCachedURLResponse *cachedResponse;
|
||||
id <NSURLProtocolClient> client; // Not retained
|
||||
NSURLRequest *request;
|
||||
#if defined(HAVE_ZLIB_H)
|
||||
z_stream z; // context for decompress
|
||||
BOOL compressing; // are we compressing?
|
||||
BOOL decompressing; // are we decompressing?
|
||||
NSData *compressed; // only partially decompressed
|
||||
#endif
|
||||
} Internal;
|
||||
|
||||
typedef struct {
|
||||
|
@ -181,6 +201,17 @@ static NSURLProtocol *placeholder = nil;
|
|||
RELEASE(this->output);
|
||||
RELEASE(this->cachedResponse);
|
||||
RELEASE(this->request);
|
||||
#if defined(HAVE_ZLIB_H)
|
||||
if (this->compressing == YES)
|
||||
{
|
||||
deflateEnd(&this->z);
|
||||
}
|
||||
else if (this->decompressing == YES)
|
||||
{
|
||||
inflateEnd(&this->z);
|
||||
}
|
||||
RELEASE(this->compressed);
|
||||
#endif
|
||||
NSZoneFree([self zone], this);
|
||||
_NSURLProtocolInternal = 0;
|
||||
}
|
||||
|
@ -515,6 +546,10 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) _didLoad: (NSData*)d
|
||||
{
|
||||
[this->client URLProtocol: self didLoadData: d];
|
||||
}
|
||||
|
||||
- (void) _got: (NSStream*)stream
|
||||
{
|
||||
|
@ -695,6 +730,20 @@ static NSURLProtocol *placeholder = nil;
|
|||
didReceiveResponse: _response
|
||||
cacheStoragePolicy: policy];
|
||||
}
|
||||
|
||||
#if defined(HAVE_ZLIB_H)
|
||||
s = [[document headerNamed: @"content-encoding"] value];
|
||||
if ([s isEqualToString: @"gzip"] || [s isEqualToString: @"x-gzip"])
|
||||
{
|
||||
this->decompressing = YES;
|
||||
this->z.opaque = 0;
|
||||
this->z.zalloc = zalloc;
|
||||
this->z.zfree = zfree;
|
||||
this->z.next_in = 0;
|
||||
this->z.avail_in = 0;
|
||||
inflateInit2(&this->z, 1); // FIXME
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_complete == YES)
|
||||
|
@ -884,7 +933,7 @@ static NSURLProtocol *placeholder = nil;
|
|||
NSMakeRange(_parseOffset, bodyLength - _parseOffset)];
|
||||
}
|
||||
_parseOffset = bodyLength;
|
||||
[this->client URLProtocol: self didLoadData: d];
|
||||
[self _didLoad: d];
|
||||
}
|
||||
|
||||
/* Check again in case the client cancelled the load inside
|
||||
|
@ -914,7 +963,7 @@ static NSURLProtocol *placeholder = nil;
|
|||
NSMakeRange(_parseOffset, [d length] - _parseOffset)];
|
||||
}
|
||||
_parseOffset = bodyLength;
|
||||
[this->client URLProtocol: self didLoadData: d];
|
||||
[self _didLoad: d];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ con_messages (id prx)
|
|||
printf(" ok\n");
|
||||
|
||||
printf("performSelector:\n");
|
||||
if (prx != [prx performSelector:sel_get_any_uid("self")])
|
||||
if (prx != [prx performSelector: GSSelectorFromName("self")])
|
||||
printf(" ERROR\n");
|
||||
else
|
||||
printf(" ok\n");
|
||||
|
|
Loading…
Reference in a new issue