12
13
14
15
16
17
18
19
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
|
#import "config.h"
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <errno.h>
#define GET_ERR errno
#define GET_SOCK_ERR errno
#define ERRFMT "Error string was: %s"
#define ERRPARAM strerror(err)
#else
#include <windows.h>
#define GET_ERR GetLastError()
#define GET_SOCK_ERR WSAGetLastError()
#define ERRFMT "Error code was: %d"
#define ERRPARAM err
#endif
#import <objc/objc-api.h>
#ifdef __objc_INCLUDE_GNU
#define SEL_NAME(x) sel_get_name(x)
#else
#import <objc/runtime.h>
#define SEL_NAME(x) sel_getName(x)
#endif
#import "OFExceptions.h"
#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif
@implementation OFAllocFailedException
+ (Class)class
{
|
>
>
>
>
>
>
>
>
>
>
>
<
<
<
<
<
<
<
<
<
<
|
12
13
14
15
16
17
18
19
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
|
#import "config.h"
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#import <objc/objc-api.h>
#ifdef __objc_INCLUDE_GNU
#define SEL_NAME(x) sel_get_name(x)
#else
#import <objc/runtime.h>
#define SEL_NAME(x) sel_getName(x)
#endif
#import "OFExceptions.h"
#import "OFTCPSocket.h"
#ifndef _WIN32
#include <errno.h>
#define GET_ERR errno
#define GET_SOCK_ERR errno
#define ERRFMT "Error string was: %s"
#define ERRPARAM strerror(err)
#else
#include <windows.h>
#define GET_ERR GetLastError()
#define GET_SOCK_ERR WSAGetLastError()
#define ERRFMT "Error code was: %d"
#define ERRPARAM err
#endif
#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif
@implementation OFAllocFailedException
+ (Class)class
{
|
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
andNItems: (size_t)nitems
{
self = [super initWithClass: class_];
req_size = size;
req_items = nitems;
has_items = YES;
err = GET_ERR;
return self;
}
- initWithClass: (Class)class_
andSize: (size_t)size
{
self = [super initWithClass: class_];
req_size = size;
req_items = 0;
has_items = NO;
err = GET_ERR;
return self;
}
- (int)errNo
{
return err;
|
>
>
>
>
|
>
>
>
>
|
|
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
andNItems: (size_t)nitems
{
self = [super initWithClass: class_];
req_size = size;
req_items = nitems;
has_items = YES;
if (class_ == [OFTCPSocket class])
err = GET_SOCK_ERR;
else
err = GET_ERR;
return self;
}
- initWithClass: (Class)class_
andSize: (size_t)size
{
self = [super initWithClass: class_];
req_size = size;
req_items = 0;
has_items = NO;
if (class_ == [OFTCPSocket class])
err = GET_SOCK_ERR;
else
err = GET_ERR;
return self;
}
- (int)errNo
{
return err;
|