Overview
Comment: | OFStream: Add -[hasDataInReadBuffer].
This replaces -[numberOfBytesInReadBuffer], as it's not always known how |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
acc999a75e51fd097a194c7227d3f8e4 |
User & Date: | js on 2014-05-31 17:57:21 |
Other Links: | manifest | tags |
Context
2014-06-12
| ||
13:43 | OFINIFile: Add support for quoted keys / values check-in: 12c5b7ee91 user: js tags: trunk | |
2014-05-31
| ||
17:57 | OFStream: Add -[hasDataInReadBuffer]. check-in: acc999a75e user: js tags: trunk | |
16:34 | Work around broken Apple libc headers check-in: dccc3ed8a9 user: js tags: trunk | |
Changes
Modified src/OFDeflateStream.m from [8d93d6070f] to [e0f523d409].
︙ | ︙ | |||
772 773 774 775 776 777 778 779 780 | } #ifndef DEFLATE64 - (bool)lowlevelIsAtEndOfStream { return _atEndOfStream; } #endif @end | > > > > > > > > > > | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | } #ifndef DEFLATE64 - (bool)lowlevelIsAtEndOfStream { return _atEndOfStream; } - (int)fileDescriptorForReading { return [_stream fileDescriptorForReading]; } - (bool)hasDataInReadBuffer { return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]); } #endif @end |
Modified src/OFHTTPClient.m from [3007afbd2c] to [26d3992686].
︙ | ︙ | |||
234 235 236 237 238 239 240 | } - (int)fileDescriptorForReading { return [_socket fileDescriptorForReading]; } | | | < | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } - (int)fileDescriptorForReading { return [_socket fileDescriptorForReading]; } - (bool)hasDataInReadBuffer { return ([super hasDataInReadBuffer] || [_socket hasDataInReadBuffer]); } - (void)close { [_socket release]; _socket = nil; } |
︙ | ︙ |
Modified src/OFHTTPServer.m from [48d8bdc4b1] to [7f98124205].
︙ | ︙ | |||
201 202 203 204 205 206 207 | [_socket release]; [_server release]; [super dealloc]; } | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | [_socket release]; [_server release]; [super dealloc]; } - (void)OF_sendHeaders { void *pool = objc_autoreleasePoolPush(); OFString *date = [[OFDate date] dateStringWithFormat: @"%a, %d %b %Y %H:%M:%S GMT"]; OFEnumerator *keyEnumerator, *valueEnumerator; OFString *key, *value; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { void *pool; if (!_headersSent) | | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { void *pool; if (!_headersSent) [self OF_sendHeaders]; if (!_chunked) { [_socket writeBuffer: buffer length: length]; return; } pool = objc_autoreleasePoolPush(); [_socket writeString: [OFString stringWithFormat: @"%zx\r\n", length]]; objc_autoreleasePoolPop(pool); [_socket writeBuffer: buffer length: length]; [_socket writeBuffer: "\r\n" length: 2]; } - (void)close { if (!_headersSent) [self OF_sendHeaders]; if (_chunked) [_socket writeBuffer: "0\r\n\r\n" length: 5]; [_socket close]; |
︙ | ︙ |
Modified src/OFKernelEventObserver.m from [2dacb355e7] to [fb20fdd1d1].
︙ | ︙ | |||
403 404 405 406 407 408 409 | { id *objects = [_readObjects objects]; size_t i, count = [_readObjects count]; bool foundInCache = false; for (i = 0; i < count; i++) { if ([objects[i] isKindOfClass: [OFStream class]] && | | | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | { id *objects = [_readObjects objects]; size_t i, count = [_readObjects count]; bool foundInCache = false; for (i = 0; i < count; i++) { if ([objects[i] isKindOfClass: [OFStream class]] && [objects[i] hasDataInReadBuffer] && ![objects[i] OF_isWaitingForDelimiter]) { void *pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: objects[i]]; |
︙ | ︙ |
Modified src/OFSeekableStream.m from [c1a75862c3] to [f1a559726a].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <stdlib.h> #include <stdio.h> #import "OFSeekableStream.h" | > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #define OF_SEEKABLE_STREAM_M #include "config.h" #include <stdlib.h> #include <stdio.h> #import "OFSeekableStream.h" |
︙ | ︙ |
Modified src/OFStream.h from [16a1b1d069] to [10f43f7343].
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | */ @interface OFStream: OFObject < #ifdef OF_HAVE_SOCKETS OFReadyForReadingObserving, OFReadyForWritingObserving, #endif OFCopying> { char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; bool _writeBufferEnabled, _blocking, _waitingForDelimiter; } #ifdef OF_HAVE_PROPERTIES @property (getter=isWriteBufferEnabled) bool writeBufferEnabled; | > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | */ @interface OFStream: OFObject < #ifdef OF_HAVE_SOCKETS OFReadyForReadingObserving, OFReadyForWritingObserving, #endif OFCopying> { #ifndef OF_SEEKABLE_STREAM_M @private #endif char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; bool _writeBufferEnabled, _blocking, _waitingForDelimiter; } #ifdef OF_HAVE_PROPERTIES @property (getter=isWriteBufferEnabled) bool writeBufferEnabled; |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | * @param arguments The arguments used in the format string * @return The number of bytes written */ - (size_t)writeFormat: (OFConstantString*)format arguments: (va_list)arguments; /*! | | | | | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | * @param arguments The arguments used in the format string * @return The number of bytes written */ - (size_t)writeFormat: (OFConstantString*)format arguments: (va_list)arguments; /*! * @brief Returns whether data is present in the internal read buffer. * * @return Whether data is present in the internal read buffer */ - (bool)hasDataInReadBuffer; /*! * @brief Returns whether the stream is in blocking mode. * * @return Whether the stream is in blocking mode */ - (bool)isBlocking; |
︙ | ︙ |
Modified src/OFStream.m from [30723cee3c] to [6cbe514a9d].
︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 | } @finally { free(UTF8String); } return length; } | | | | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | } @finally { free(UTF8String); } return length; } - (bool)hasDataInReadBuffer { return (_readBufferLength > 0); } - (bool)isBlocking { return _blocking; } |
︙ | ︙ |