20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include <string.h>
#include <limits.h>
#import "OFDataArray.h"
#import "OFString.h"
#import "OFFile.h"
#import "OFURL.h"
#import "OFHTTPClient.h"
#import "OFHTTPRequest.h"
#import "OFHTTPRequestReply.h"
#import "OFDictionary.h"
#import "OFXMLElement.h"
#import "OFSystemInfo.h"
#import "OFHTTPRequestFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "autorelease.h"
#import "base64.h"
#import "macros.h"
/* References for static linking */
void _references_to_categories_of_OFDataArray(void)
|
>
|
|
|
>
>
|
>
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <string.h>
#include <limits.h>
#import "OFDataArray.h"
#import "OFString.h"
#import "OFFile.h"
#import "OFURL.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPClient.h"
# import "OFHTTPRequest.h"
# import "OFHTTPRequestReply.h"
#endif
#import "OFDictionary.h"
#import "OFXMLElement.h"
#import "OFSystemInfo.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPRequestFailedException.h"
#endif
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedProtocolException.h"
#import "autorelease.h"
#import "base64.h"
#import "macros.h"
/* References for static linking */
void _references_to_categories_of_OFDataArray(void)
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
return self;
}
- initWithContentsOfURL: (OFURL*)URL
{
void *pool;
OFHTTPClient *client;
OFHTTPRequest *request;
OFHTTPRequestReply *reply;
OFDictionary *headers;
OFString *contentLength;
Class c;
c = [self class];
[self release];
pool = objc_autoreleasePoolPush();
if ([[URL scheme] isEqual: @"file"]) {
self = [[c alloc] initWithContentsOfFile: [URL path]];
objc_autoreleasePoolPop(pool);
return self;
}
client = [OFHTTPClient client];
|
>
>
>
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
return self;
}
- initWithContentsOfURL: (OFURL*)URL
{
void *pool;
#ifdef OF_HAVE_SOCKETS
OFHTTPClient *client;
OFHTTPRequest *request;
OFHTTPRequestReply *reply;
OFDictionary *headers;
OFString *contentLength;
#endif
Class c;
c = [self class];
[self release];
pool = objc_autoreleasePoolPush();
#ifdef OF_HAVE_SOCKETS
if ([[URL scheme] isEqual: @"file"]) {
self = [[c alloc] initWithContentsOfFile: [URL path]];
objc_autoreleasePoolPop(pool);
return self;
}
client = [OFHTTPClient client];
|
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
self = [[reply readDataArrayTillEndOfStream] retain];
headers = [reply headers];
if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil)
if ([self count] != (size_t)[contentLength decimalValue])
@throw [OFTruncatedDataException
exceptionWithClass: [self class]];
objc_autoreleasePoolPop(pool);
return self;
}
- initWithStringRepresentation: (OFString*)string
|
>
>
>
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
self = [[reply readDataArrayTillEndOfStream] retain];
headers = [reply headers];
if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil)
if ([self count] != (size_t)[contentLength decimalValue])
@throw [OFTruncatedDataException
exceptionWithClass: [self class]];
#else
@throw [OFUnsupportedProtocolException exceptionWithClass: c];
#endif
objc_autoreleasePoolPop(pool);
return self;
}
- initWithStringRepresentation: (OFString*)string
|