Overview
Comment: | Move -[setBlocking] to OFStream. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
beb4a0d0368e23056e59657c50bbd2bb |
User & Date: | js on 2010-12-09 19:04:15 |
Other Links: | manifest | tags |
Context
2010-12-09
| ||
19:19 | Add -[parseStream] to OFXMLParser. check-in: 964b6c41f0 user: js tags: trunk | |
19:04 | Move -[setBlocking] to OFStream. check-in: beb4a0d036 user: js tags: trunk | |
2010-12-08
| ||
23:18 | Fix local labels in inline assembly. check-in: c10cc0f9e2 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [d7703b509d] to [bd24a85393].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | { @public char *cache; @protected char *wBuffer; size_t cacheLen, wBufferLen; BOOL buffersWrites; } /** * Returns a boolean whether the end of the stream has been reached. * * \return A boolean whether the end of the stream has been reached */ - (BOOL)isAtEndOfStream; | > > > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | { @public char *cache; @protected char *wBuffer; size_t cacheLen, wBufferLen; BOOL buffersWrites; BOOL isBlocking; } #ifdef OF_HAVE_PROPERTIES @property (assign, setter=setBlocking) BOOL isBlocking; #endif /** * Returns a boolean whether the end of the stream has been reached. * * \return A boolean whether the end of the stream has been reached */ - (BOOL)isAtEndOfStream; |
︙ | ︙ | |||
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | * \param fmt A string used as format * \param args The arguments used in the format string * \return The number of bytes written */ - (size_t)writeFormat: (OFString*)fmt withArguments: (va_list)args; /** * \return The file descriptor for the stream. */ - (int)fileDescriptor; /** * Closes the stream. */ - (void)close; @end | > > > > > > > > > > > > > > > | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | * \param fmt A string used as format * \param args The arguments used in the format string * \return The number of bytes written */ - (size_t)writeFormat: (OFString*)fmt withArguments: (va_list)args; /** * \return Whether the stream is in blocking mode */ - (BOOL)isBlocking; /** * Enables or disables non-blocking I/O. * * By default, a stream is in blocking mode. * On Win32, this currently only works for sockets! * * \param enable Whether the stream should be blocking */ - (void)setBlocking: (BOOL)enable; /** * \return The file descriptor for the stream. */ - (int)fileDescriptor; /** * Closes the stream. */ - (void)close; @end |
Modified src/OFStream.m from [9e9b9829fb] to [97d3571cc4].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #define _GNU_SOURCE #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #import "OFStream.h" #import "OFString.h" #import "OFDataArray.h" #import "OFExceptions.h" #import "macros.h" | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #define _GNU_SOURCE #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <fcntl.h> #import "OFStream.h" #import "OFString.h" #import "OFDataArray.h" #import "OFExceptions.h" #import "macros.h" |
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | selector: _cmd]; } self = [super init]; cache = NULL; wBuffer = NULL; return self; } - (BOOL)_isAtEndOfStream { @throw [OFNotImplementedException newWithClass: isa | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | selector: _cmd]; } self = [super init]; cache = NULL; wBuffer = NULL; isBlocking = YES; return self; } - (BOOL)_isAtEndOfStream { @throw [OFNotImplementedException newWithClass: isa |
︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | } @finally { free(t); } /* Get rid of a warning, never reached anyway */ assert(0); } - (int)fileDescriptor { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - (void)close { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | } @finally { free(t); } /* Get rid of a warning, never reached anyway */ assert(0); } - (BOOL)isBlocking { return isBlocking; } - (void)setBlocking: (BOOL)enable { #ifndef _WIN32 int flags; isBlocking = enable; if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1) @throw [OFSetOptionFailedException newWithClass: isa]; if (enable) flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; if (fcntl([self fileDescriptor], F_SETFL, flags) == -1) @throw [OFSetOptionFailedException newWithClass: isa]; #else @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; #endif } - (int)fileDescriptor { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - (void)close { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } @end |
Modified src/OFStreamSocket.h from [84f2318fe8] to [8e3aaf671c].
︙ | ︙ | |||
34 35 36 37 38 39 40 | BOOL eos; } /** * \return A new autoreleased OFTCPSocket */ + socket; | < < < < < | 34 35 36 37 38 39 40 41 | BOOL eos; } /** * \return A new autoreleased OFTCPSocket */ + socket; @end |
Modified src/OFStreamSocket.m from [a907635fe9] to [fc3b5a9ea7].
︙ | ︙ | |||
9 10 11 12 13 14 15 | * the packaging of this file. */ #include "config.h" #include <string.h> #include <unistd.h> | < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * the packaging of this file. */ #include "config.h" #include <string.h> #include <unistd.h> #include <errno.h> #ifndef _WIN32 # include <sys/types.h> # include <sys/socket.h> #endif |
︙ | ︙ | |||
98 99 100 101 102 103 104 | @throw [OFWriteFailedException newWithClass: isa size: size]; /* This is safe, as we already checked for -1 */ return ret; } | < < | < | < < | < < < < < < < < > < > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | @throw [OFWriteFailedException newWithClass: isa size: size]; /* This is safe, as we already checked for -1 */ return ret; } #ifdef _WIN32 - (void)setBlocking: (BOOL)enable { u_long v = enable; isBlocking = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException newWithClass: isa]; } #endif - (int)fileDescriptor { return sock; } - (void)close |
︙ | ︙ |