Skip to content

Commit 051414b

Browse files
committed
streams: use an enum for return type of _php_stream_make_seekable()
1 parent 93ec0ac commit 051414b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

main/php_streams.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,15 +646,18 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf);
646646
/* pushes an error message onto the stack for a wrapper instance */
647647
PHPAPI void php_stream_wrapper_log_error(const php_stream_wrapper *wrapper, int options, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
648648

649-
#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */
650-
#define PHP_STREAM_RELEASED 1 /* newstream should be used; origstream is no longer valid */
651-
#define PHP_STREAM_FAILED 2 /* an error occurred while attempting conversion */
652-
#define PHP_STREAM_CRITICAL 3 /* an error occurred; origstream is in an unknown state; you should close origstream */
649+
typedef enum {
650+
PHP_STREAM_UNCHANGED = 0, /* orig stream was seekable anyway */
651+
PHP_STREAM_RELEASED = 1, /* newstream should be used; origstream is no longer valid */
652+
PHP_STREAM_FAILED = 2, /* an error occurred while attempting conversion */
653+
PHP_STREAM_CRITICAL = 3, /* an error occurred; origstream is in an unknown state; you should close origstream */
654+
} php_stream_make_seekable_status;
655+
653656
#define PHP_STREAM_NO_PREFERENCE 0
654657
#define PHP_STREAM_PREFER_STDIO 1
655658
#define PHP_STREAM_FORCE_CONVERSION 2
656659
/* DO NOT call this on streams that are referenced by resources! */
657-
PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC);
660+
PHPAPI php_stream_make_seekable_status _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC);
658661
#define php_stream_make_seekable(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_CC)
659662

660663
/* Give other modules access to the url_stream_wrappers_hash and stream_filters_hash */

main/streams/cast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int optio
370370
/* }}} */
371371

372372
/* {{{ php_stream_make_seekable */
373-
PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC)
373+
PHPAPI php_stream_make_seekable_status _php_stream_make_seekable(php_stream *origstream, php_stream **newstream, int flags STREAMS_DC)
374374
{
375375
if (newstream == NULL) {
376376
return PHP_STREAM_FAILED;

0 commit comments

Comments
 (0)