ObjFW  Diff

Differences From Artifact [f7281a04f1]:

To Artifact [64dbc40d09]:


26
27
28
29
30
31
32





33
34
35





36
37
38

39
40
41

42
43
44
45
46
47
48

#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







>
>
>
>
>



>
>
>
>
>



>



>







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
52
53
54
55
56
57
58
59
60

#import "OFExceptions.h"
#import "OFTCPSocket.h"

#ifndef _WIN32
#include <errno.h>
#define GET_ERR	     errno
#ifndef HAVE_GETADDRINFO
#define GET_AT_ERR   h_errno
#else
#define GET_AT_ERR   errno
#endif
#define GET_SOCK_ERR errno
#define ERRFMT	     "Error string was: %s"
#define ERRPARAM     strerror(err)
#ifndef HAVE_GETADDRINFO
#define AT_ERRPARAM  hstrerror(err)
#else
#define AT_ERRPARAM  strerror(err)
#endif
#else
#include <windows.h>
#define GET_ERR	     GetLastError()
#define GET_AT_ERR   WSAGetLastError()
#define GET_SOCK_ERR WSAGetLastError()
#define ERRFMT	     "Error code was: %d"
#define ERRPARAM     err
#define AT_ERRPARAM  err
#endif

#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFAllocFailedException
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
	andNode: (OFString*)node_
     andService: (OFString*)service_
{
	self = [super initWithClass: class_];

	node = [node_ retain];
	service = [service_ retain];
	err = GET_SOCK_ERR;

	return self;
}

- (void)dealloc
{
	[node release];







|







533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
	andNode: (OFString*)node_
     andService: (OFString*)service_
{
	self = [super initWithClass: class_];

	node = [node_ retain];
	service = [service_ retain];
	err = GET_AT_ERR;

	return self;
}

- (void)dealloc
{
	[node release];
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
			    @"an address in class %s. This means that either "
			    @"the node was not found, there is no such service "
			    @"on the node, there was a problem with the name "
			    @"server, there was a problem with your network "
			    @"connection or you specified an invalid node or "
			    @"service. " ERRFMT,
			    [service cString], [node cString], [class name],
			    ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
			    @"an address in class %s. This means that either "
			    @"the node was not found, there is no such service "
			    @"on the node, there was a problem with the name "
			    @"server, there was a problem with your network "
			    @"connection or you specified an invalid node or "
			    @"service. " ERRFMT,
			    [service cString], [node cString], [class name],
			    AT_ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;