mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Fix whitespace (guys, please try to stick with the php4 tree style as far
as indentation/newlines go, and also as far as using {} even on if's that have single statements) - Fix Windows build
This commit is contained in:
parent
a990c4da3e
commit
dcb44bf512
3 changed files with 117 additions and 45 deletions
|
@ -40,7 +40,10 @@ typedef struct {
|
|||
int mode;
|
||||
} php_stream_memory_data;
|
||||
|
||||
static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -73,9 +76,13 @@ static size_t php_stream_memory_write(php_stream *stream, const char *buf, size_
|
|||
ms->fpos += count;
|
||||
}
|
||||
return count;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -100,10 +107,13 @@ static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count
|
|||
ms->fpos += count;
|
||||
}
|
||||
return count;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -117,16 +127,21 @@ static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_D
|
|||
ms->fsize = 0;
|
||||
ms->fpos = 0;
|
||||
return 0;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) {
|
||||
/* nothing to do here */
|
||||
return 0;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -176,9 +191,13 @@ static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence T
|
|||
return 0;
|
||||
/*return EINVAL;*/
|
||||
}
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static char *php_stream_memory_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static char *php_stream_memory_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
|
||||
{
|
||||
size_t n = 1;
|
||||
char *c = buf;
|
||||
|
||||
|
@ -200,11 +219,17 @@ static char *php_stream_memory_gets(php_stream *stream, char *buf, size_t maxlen
|
|||
}
|
||||
*c = 0;
|
||||
return buf;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static int php_stream_memory_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
|
||||
{
|
||||
return FAILURE;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
php_stream_ops php_stream_memory_ops = {
|
||||
php_stream_memory_write, php_stream_memory_read,
|
||||
|
@ -215,7 +240,10 @@ php_stream_ops php_stream_memory_ops = {
|
|||
"MEMORY"
|
||||
};
|
||||
|
||||
PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *self;
|
||||
|
||||
self = emalloc(sizeof(*self));
|
||||
|
@ -226,10 +254,13 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC) { /*
|
|||
self->smax = -1;
|
||||
self->mode = mode;
|
||||
return php_stream_alloc(&php_stream_memory_ops, self, 0, "rwb");
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC) { /* {{{ */
|
||||
php_stream *stream;
|
||||
|
||||
/* {{{ */
|
||||
PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC)
|
||||
{ php_stream *stream;
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
if ((stream = php_stream_memory_create_rel(TEMP_STREAM_DEFAULT)) != NULL) {
|
||||
|
@ -240,9 +271,13 @@ PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length ST
|
|||
ms->mode = mode;
|
||||
}
|
||||
return stream;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
php_stream_memory_data *ms;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -252,10 +287,10 @@ PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length ST
|
|||
|
||||
*length = ms->fsize;
|
||||
return ms->data;
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ ------- TEMP stream implementation -------*/
|
||||
|
||||
typedef struct {
|
||||
|
@ -264,7 +299,10 @@ typedef struct {
|
|||
int mode;
|
||||
} php_stream_temp_data;
|
||||
|
||||
static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -283,9 +321,13 @@ static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t
|
|||
}
|
||||
}
|
||||
return php_stream_write(ts->innerstream, buf, count);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -293,10 +335,13 @@ static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count T
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_read(ts->innerstream, buf, count);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -304,10 +349,13 @@ static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC)
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_close(ts->innerstream);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_temp_flush(php_stream *stream TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_temp_flush(php_stream *stream TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -315,10 +363,13 @@ static int php_stream_temp_flush(php_stream *stream TSRMLS_DC) { /* {{{ */
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_flush(ts->innerstream);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC) { /* {{{ */
|
||||
/* {{{ */
|
||||
static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -326,9 +377,13 @@ static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence TSR
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_seek(ts->innerstream, offset, whence);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *php_stream_temp_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
char *php_stream_temp_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -336,9 +391,13 @@ char *php_stream_temp_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_D
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_gets(ts->innerstream, buf, maxlen);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *ts;
|
||||
|
||||
assert(stream != NULL);
|
||||
|
@ -346,7 +405,8 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRML
|
|||
assert(ts != NULL);
|
||||
|
||||
return php_stream_cast(ts->innerstream, castas, ret, 0);
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_ops php_stream_temp_ops = {
|
||||
php_stream_temp_write, php_stream_temp_read,
|
||||
|
@ -357,7 +417,10 @@ php_stream_ops php_stream_temp_ops = {
|
|||
"TEMP"
|
||||
};
|
||||
|
||||
PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
php_stream_temp_data *self;
|
||||
php_stream *stream;
|
||||
|
||||
|
@ -369,9 +432,13 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR
|
|||
self->innerstream = php_stream_memory_create(mode);
|
||||
php_stream_temp_write(stream, NULL, 0 TSRMLS_CC);
|
||||
return stream;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC) { /* {{{ */
|
||||
|
||||
/* {{{ */
|
||||
PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
php_stream *stream;
|
||||
php_stream_temp_data *ms;
|
||||
|
||||
|
@ -385,7 +452,8 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char
|
|||
ms->mode = mode;
|
||||
}
|
||||
return stream;
|
||||
} /* }}} */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
|
|
@ -207,7 +207,7 @@ static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC)
|
|||
LPEXTENSION_CONTROL_BLOCK ecb;
|
||||
|
||||
ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
|
||||
if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) {
|
||||
if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) {
|
||||
php_handle_aborted_connection();
|
||||
}
|
||||
return num_bytes;
|
||||
|
|
|
@ -174,6 +174,10 @@ SOURCE=..\main\main.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\memory_streams.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\mergesort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -234,16 +238,16 @@ SOURCE=..\main\streams.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\user_streams.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\strlcat.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\strlcpy.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\main\user_streams.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue