ObjFW  Diff

Differences From Artifact [e841a9f1c7]:

To Artifact [32a50ea176]:


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif

#include "platform.h"

#if !defined(OF_WINDOWS) && !defined(OF_MORPHOS)
# include <signal.h>
#endif

#import "OFStream.h"







<
<
<
<







21
22
23
24
25
26
27




28
29
30
31
32
33
34
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>





#include "platform.h"

#if !defined(OF_WINDOWS) && !defined(OF_MORPHOS)
# include <signal.h>
#endif

#import "OFStream.h"
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
- (bool)isBlocking
{
	return _blocking;
}

- (void)setBlocking: (bool)enable
{
#ifdef HAVE_FCNTL
	bool readImplemented = false, writeImplemented = false;

	@try {
		int readFlags;

		readFlags = fcntl([self fileDescriptorForReading], F_GETFL);

		readImplemented = true;

		if (readFlags == -1)
			@throw [OFSetOptionFailedException
			    exceptionWithStream: self
					  errNo: errno];

		if (enable)
			readFlags &= ~O_NONBLOCK;
		else
			readFlags |= O_NONBLOCK;

		if (fcntl([self fileDescriptorForReading], F_SETFL,
		    readFlags) == -1)
			@throw [OFSetOptionFailedException
			    exceptionWithStream: self
					  errNo: errno];
	} @catch (OFNotImplementedException *e) {
	}

	@try {
		int writeFlags;

		writeFlags = fcntl([self fileDescriptorForWriting], F_GETFL);

		writeImplemented = true;

		if (writeFlags == -1)
			@throw [OFSetOptionFailedException
			    exceptionWithStream: self
					  errNo: errno];

		if (enable)
			writeFlags &= ~O_NONBLOCK;
		else
			writeFlags |= O_NONBLOCK;

		if (fcntl([self fileDescriptorForWriting], F_SETFL,
		    writeFlags) == -1)
			@throw [OFSetOptionFailedException
			    exceptionWithStream: self
					  errNo: errno];
	} @catch (OFNotImplementedException *e) {
	}

	if (!readImplemented && !writeImplemented)
		@throw [OFNotImplementedException exceptionWithSelector: _cmd
								 object: self];

	_blocking = enable;
#else
	OF_UNRECOGNIZED_SELECTOR
#endif
}

- (int)fileDescriptorForReading
{
	OF_UNRECOGNIZED_SELECTOR
}








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<







1633
1634
1635
1636
1637
1638
1639



























































1640

1641
1642
1643
1644
1645
1646
1647
- (bool)isBlocking
{
	return _blocking;
}

- (void)setBlocking: (bool)enable
{



























































	OF_UNRECOGNIZED_SELECTOR

}

- (int)fileDescriptorForReading
{
	OF_UNRECOGNIZED_SELECTOR
}

1746
1747
1748
1749
1750
1751
1752
1753
1754
1755

	[self freeMemory: _writeBuffer];
	_writeBuffer = NULL;
	_writeBufferLength = 0;
	_writeBuffered = false;

	_waitingForDelimiter = false;
	_blocking = false;
}
@end







<


1682
1683
1684
1685
1686
1687
1688

1689
1690

	[self freeMemory: _writeBuffer];
	_writeBuffer = NULL;
	_writeBufferLength = 0;
	_writeBuffered = false;

	_waitingForDelimiter = false;

}
@end