mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fix warnings and whitespace in output
This commit is contained in:
parent
23da3057b9
commit
cfe2eda4f6
2 changed files with 58 additions and 60 deletions
|
@ -94,13 +94,13 @@ string *string_printf(string *str, const char *format, ...)
|
||||||
int n;
|
int n;
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
n = vsnprintf(str->string + str->len, str->alloced - str->len, format, arg);
|
n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
|
||||||
if (n > str->alloced - str->len) {
|
if (n > str->alloced - str->len) {
|
||||||
while (n + str->len > str->alloced ) {
|
while (n + str->len > str->alloced ) {
|
||||||
str->alloced *= 2;
|
str->alloced *= 2;
|
||||||
}
|
}
|
||||||
str->string = erealloc(str->string, str->alloced);
|
str->string = erealloc(str->string, str->alloced + 1);
|
||||||
n = vsnprintf(str->string + str->len, str->alloced - str->len, format, arg);
|
n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
|
||||||
}
|
}
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
str->len += n;
|
str->len += n;
|
||||||
|
@ -109,14 +109,13 @@ string *string_printf(string *str, const char *format, ...)
|
||||||
|
|
||||||
string *string_write(string *str, char *buf, int len)
|
string *string_write(string *str, char *buf, int len)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
if (str->alloced - str->len < len) {
|
if (str->alloced - str->len < len) {
|
||||||
while (str->alloced - str->len < len) {
|
while (str->alloced - str->len < len) {
|
||||||
str->alloced *= 2;
|
str->alloced *= 2;
|
||||||
}
|
}
|
||||||
str->string = erealloc(str->string, str->alloced);
|
str->string = erealloc(str->string, str->alloced + 1);
|
||||||
}
|
}
|
||||||
memcpy(str->string + str->len, buf, len);
|
memcpy(str->string + str->len - 1, buf, len);
|
||||||
str->len += len;
|
str->len += len;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +226,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
|
||||||
static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS_DC)
|
static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS_DC)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
/* TBD: Repair indenting of doc comment (or is this to be done in the parser?) */
|
/* TBD: Repair indenting of doc comment (or is this to be done in the parser?) */
|
||||||
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
|
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
|
||||||
string_printf(str, "%s%s", indent, ce->doc_comment);
|
string_printf(str, "%s%s", indent, ce->doc_comment);
|
||||||
|
@ -247,7 +247,7 @@ static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS
|
||||||
string_printf(str, " extends %s", ce->parent->name);
|
string_printf(str, " extends %s", ce->parent->name);
|
||||||
}
|
}
|
||||||
/* TBI: Interfaces */
|
/* TBI: Interfaces */
|
||||||
(string_printf, str, " ] {\n");
|
string_printf(str, " ] {\n");
|
||||||
|
|
||||||
/* The information where a class is declared is only available for user classes */
|
/* The information where a class is declared is only available for user classes */
|
||||||
if (ce->type == ZEND_USER_CLASS) {
|
if (ce->type == ZEND_USER_CLASS) {
|
||||||
|
@ -259,7 +259,7 @@ static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS
|
||||||
if (&ce->constants_table) {
|
if (&ce->constants_table) {
|
||||||
string_printf(str, "\n");
|
string_printf(str, "\n");
|
||||||
count = zend_hash_num_elements(&ce->constants_table);
|
count = zend_hash_num_elements(&ce->constants_table);
|
||||||
string_printf(str, "%s - Constants [%d,] {\n", indent, count);
|
string_printf(str, "%s - Constants [%d] {\n", indent, count);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
zval **value;
|
zval **value;
|
||||||
|
@ -475,7 +475,7 @@ ZEND_FUNCTION(reflection_export)
|
||||||
/* Invoke the toString() method */
|
/* Invoke the toString() method */
|
||||||
MAKE_STD_ZVAL(fname);
|
MAKE_STD_ZVAL(fname);
|
||||||
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
|
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
|
||||||
call_user_function_ex(NULL, &object, fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
|
result= call_user_function_ex(NULL, &object, fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
|
||||||
zval_ptr_dtor(&fname);
|
zval_ptr_dtor(&fname);
|
||||||
|
|
||||||
if (result == FAILURE) {
|
if (result == FAILURE) {
|
||||||
|
@ -945,7 +945,6 @@ ZEND_FUNCTION(reflection_method_invoke)
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
zend_error(E_WARNING, "First parameter is expected to be an instance of %s", mptr->common.scope->name);
|
zend_error(E_WARNING, "First parameter is expected to be an instance of %s", mptr->common.scope->name);
|
||||||
efree(params);
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,13 +94,13 @@ string *string_printf(string *str, const char *format, ...)
|
||||||
int n;
|
int n;
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
n = vsnprintf(str->string + str->len, str->alloced - str->len, format, arg);
|
n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
|
||||||
if (n > str->alloced - str->len) {
|
if (n > str->alloced - str->len) {
|
||||||
while (n + str->len > str->alloced ) {
|
while (n + str->len > str->alloced ) {
|
||||||
str->alloced *= 2;
|
str->alloced *= 2;
|
||||||
}
|
}
|
||||||
str->string = erealloc(str->string, str->alloced);
|
str->string = erealloc(str->string, str->alloced + 1);
|
||||||
n = vsnprintf(str->string + str->len, str->alloced - str->len, format, arg);
|
n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
|
||||||
}
|
}
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
str->len += n;
|
str->len += n;
|
||||||
|
@ -109,14 +109,13 @@ string *string_printf(string *str, const char *format, ...)
|
||||||
|
|
||||||
string *string_write(string *str, char *buf, int len)
|
string *string_write(string *str, char *buf, int len)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
if (str->alloced - str->len < len) {
|
if (str->alloced - str->len < len) {
|
||||||
while (str->alloced - str->len < len) {
|
while (str->alloced - str->len < len) {
|
||||||
str->alloced *= 2;
|
str->alloced *= 2;
|
||||||
}
|
}
|
||||||
str->string = erealloc(str->string, str->alloced);
|
str->string = erealloc(str->string, str->alloced + 1);
|
||||||
}
|
}
|
||||||
memcpy(str->string + str->len, buf, len);
|
memcpy(str->string + str->len - 1, buf, len);
|
||||||
str->len += len;
|
str->len += len;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +226,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
|
||||||
static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS_DC)
|
static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS_DC)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
/* TBD: Repair indenting of doc comment (or is this to be done in the parser?) */
|
/* TBD: Repair indenting of doc comment (or is this to be done in the parser?) */
|
||||||
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
|
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
|
||||||
string_printf(str, "%s%s", indent, ce->doc_comment);
|
string_printf(str, "%s%s", indent, ce->doc_comment);
|
||||||
|
@ -247,7 +247,7 @@ static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS
|
||||||
string_printf(str, " extends %s", ce->parent->name);
|
string_printf(str, " extends %s", ce->parent->name);
|
||||||
}
|
}
|
||||||
/* TBI: Interfaces */
|
/* TBI: Interfaces */
|
||||||
(string_printf, str, " ] {\n");
|
string_printf(str, " ] {\n");
|
||||||
|
|
||||||
/* The information where a class is declared is only available for user classes */
|
/* The information where a class is declared is only available for user classes */
|
||||||
if (ce->type == ZEND_USER_CLASS) {
|
if (ce->type == ZEND_USER_CLASS) {
|
||||||
|
@ -259,7 +259,7 @@ static void _class_string(string *str, zend_class_entry *ce, char *indent TSRMLS
|
||||||
if (&ce->constants_table) {
|
if (&ce->constants_table) {
|
||||||
string_printf(str, "\n");
|
string_printf(str, "\n");
|
||||||
count = zend_hash_num_elements(&ce->constants_table);
|
count = zend_hash_num_elements(&ce->constants_table);
|
||||||
string_printf(str, "%s - Constants [%d,] {\n", indent, count);
|
string_printf(str, "%s - Constants [%d] {\n", indent, count);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
zval **value;
|
zval **value;
|
||||||
|
@ -475,7 +475,7 @@ ZEND_FUNCTION(reflection_export)
|
||||||
/* Invoke the toString() method */
|
/* Invoke the toString() method */
|
||||||
MAKE_STD_ZVAL(fname);
|
MAKE_STD_ZVAL(fname);
|
||||||
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
|
ZVAL_STRINGL(fname, "tostring", sizeof("tostring") - 1, 1);
|
||||||
call_user_function_ex(NULL, &object, fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
|
result= call_user_function_ex(NULL, &object, fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
|
||||||
zval_ptr_dtor(&fname);
|
zval_ptr_dtor(&fname);
|
||||||
|
|
||||||
if (result == FAILURE) {
|
if (result == FAILURE) {
|
||||||
|
@ -945,7 +945,6 @@ ZEND_FUNCTION(reflection_method_invoke)
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
zend_error(E_WARNING, "First parameter is expected to be an instance of %s", mptr->common.scope->name);
|
zend_error(E_WARNING, "First parameter is expected to be an instance of %s", mptr->common.scope->name);
|
||||||
efree(params);
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue