Skip to content

Commit 0709a04

Browse files
committed
- MFH Add PHPAPI to stuff needed by streams API for shared exts
- MFH Readonly issue fix to memory streams option handling (still not activated in 5.2.1 though)
1 parent 74cafe0 commit 0709a04

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

main/php_memory_streams.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR
4848
PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC);
4949
END_EXTERN_C()
5050

51-
extern php_stream_ops php_stream_memory_ops;
52-
extern php_stream_ops php_stream_temp_ops;
53-
extern php_stream_ops php_stream_rfc2397_ops;
54-
extern php_stream_wrapper php_stream_rfc2397_wrapper;
51+
extern PHPAPI php_stream_ops php_stream_memory_ops;
52+
extern PHPAPI php_stream_ops php_stream_temp_ops;
53+
extern PHPAPI php_stream_ops php_stream_rfc2397_ops;
54+
extern PHPAPI php_stream_wrapper php_stream_rfc2397_wrapper;
5555

5656
#define PHP_STREAM_IS_MEMORY &php_stream_memory_ops
5757
#define PHP_STREAM_IS_TEMP &php_stream_temp_ops

main/streams/memory.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
253253
return PHP_STREAM_OPTION_RETURN_OK;
254254

255255
case PHP_STREAM_TRUNCATE_SET_SIZE:
256+
if (ms->mode & TEMP_STREAM_READONLY) {
257+
return PHP_STREAM_OPTION_RETURN_ERR;
258+
}
256259
newsize = *(size_t*)ptrparam;
257260
if (newsize <= ms->fsize) {
258261
if (newsize < ms->fpos) {
@@ -272,7 +275,7 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
272275
}
273276
/* }}} */
274277

275-
php_stream_ops php_stream_memory_ops = {
278+
PHPAPI php_stream_ops php_stream_memory_ops = {
276279
php_stream_memory_write, php_stream_memory_read,
277280
php_stream_memory_close, php_stream_memory_flush,
278281
"MEMORY",
@@ -532,7 +535,7 @@ static int php_stream_temp_set_option(php_stream *stream, int option, int value,
532535
}
533536
/* }}} */
534537

535-
php_stream_ops php_stream_temp_ops = {
538+
PHPAPI php_stream_ops php_stream_temp_ops = {
536539
php_stream_temp_write, php_stream_temp_read,
537540
php_stream_temp_close, php_stream_temp_flush,
538541
"TEMP",
@@ -585,7 +588,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char
585588
}
586589
/* }}} */
587590

588-
php_stream_ops php_stream_rfc2397_ops = {
591+
PHPAPI php_stream_ops php_stream_rfc2397_ops = {
589592
php_stream_temp_write, php_stream_temp_read,
590593
php_stream_temp_close, php_stream_temp_flush,
591594
"RFC2397",

0 commit comments

Comments
 (0)