Patch from Thibault Martin-Lagardette to make ASIInputStream compatible with Mac…
…Ruby (+hopefully slightly more performant)
Showing
2 changed files
with
58 additions
and
2 deletions
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | 23 | ||
24 | 24 | ||
25 | // Automatically set on build | 25 | // Automatically set on build |
26 | -NSString *ASIHTTPRequestVersion = @"v1.6.1-4 2010-03-25"; | 26 | +NSString *ASIHTTPRequestVersion = @"v1.6.1-5 2010-04-01"; |
27 | 27 | ||
28 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; | 28 | NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; |
29 | 29 |
@@ -63,7 +63,63 @@ static NSLock *readLock = nil; | @@ -63,7 +63,63 @@ static NSLock *readLock = nil; | ||
63 | return [stream read:buffer maxLength:toRead]; | 63 | return [stream read:buffer maxLength:toRead]; |
64 | } | 64 | } |
65 | 65 | ||
66 | -// If we get asked to perform a method we don't have (which is almost all of them), we'll just forward the message to our stream | 66 | +/* |
67 | + * Implement NSInputStream mandatory methods to make sure they are implemented | ||
68 | + * (necessary for MacRuby for example) and avoir the overhead of method | ||
69 | + * forwarding for these common methods. | ||
70 | + */ | ||
71 | +- (void)open | ||
72 | +{ | ||
73 | + [stream open]; | ||
74 | +} | ||
75 | + | ||
76 | +- (void)close | ||
77 | +{ | ||
78 | + [stream close]; | ||
79 | +} | ||
80 | + | ||
81 | +- (id)delegate | ||
82 | +{ | ||
83 | + return [stream delegate]; | ||
84 | +} | ||
85 | + | ||
86 | +- (void)setDelegate:(id)delegate | ||
87 | +{ | ||
88 | + [stream setDelegate:delegate]; | ||
89 | +} | ||
90 | + | ||
91 | +- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode | ||
92 | +{ | ||
93 | + [stream scheduleInRunLoop:aRunLoop forMode:mode]; | ||
94 | +} | ||
95 | + | ||
96 | +- (void)removeFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode | ||
97 | +{ | ||
98 | + [stream removeFromRunLoop:aRunLoop forMode:mode]; | ||
99 | +} | ||
100 | + | ||
101 | +- (id)propertyForKey:(NSString *)key | ||
102 | +{ | ||
103 | + return [stream propertyForKey:key]; | ||
104 | +} | ||
105 | + | ||
106 | +- (BOOL)setProperty:(id)property forKey:(NSString *)key | ||
107 | +{ | ||
108 | + return [stream setProperty:property forKey:key]; | ||
109 | +} | ||
110 | + | ||
111 | +- (NSStreamStatus)streamStatus | ||
112 | +{ | ||
113 | + return [stream streamStatus]; | ||
114 | +} | ||
115 | + | ||
116 | +- (NSError *)streamError | ||
117 | +{ | ||
118 | + return [stream streamError]; | ||
119 | +} | ||
120 | + | ||
121 | +// If we get asked to perform a method we don't have (probably internal ones), | ||
122 | +// we'll just forward the message to our stream | ||
67 | 123 | ||
68 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector | 124 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector |
69 | { | 125 | { |
-
Please register or login to post a comment