diff options
Diffstat (limited to 'ext/standard/quot_print.c')
| -rw-r--r-- | ext/standard/quot_print.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 6699566863..548f886d25 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -144,7 +144,7 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt /* }}} */ #define PHP_QPRINT_MAXL 75 - + PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t length) /* {{{ */ { zend_ulong lp = 0; @@ -163,9 +163,9 @@ PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t lengt lp = 0; } else { if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*str == '\015'))) { - if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) - || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) - || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) + if ((((lp+= 3) > PHP_QPRINT_MAXL) && (c <= 0x7f)) + || ((c > 0x7f) && (c <= 0xdf) && ((lp + 3) > PHP_QPRINT_MAXL)) + || ((c > 0xdf) && (c <= 0xef) && ((lp + 6) > PHP_QPRINT_MAXL)) || ((c > 0xef) && (c <= 0xf4) && ((lp + 9) > PHP_QPRINT_MAXL))) { *d++ = '='; *d++ = '\015'; @@ -209,7 +209,7 @@ PHP_FUNCTION(quoted_printable_decode) if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg1) == FAILURE) { return; } - + if (arg1->len == 0) { /* shortcut */ RETURN_EMPTY_STRING(); @@ -220,11 +220,11 @@ PHP_FUNCTION(quoted_printable_decode) while (str_in[i]) { switch (str_in[i]) { case '=': - if (str_in[i + 1] && str_in[i + 2] && - isxdigit((int) str_in[i + 1]) && + if (str_in[i + 1] && str_in[i + 2] && + isxdigit((int) str_in[i + 1]) && isxdigit((int) str_in[i + 2])) { - str_out->val[j++] = (php_hex2int((int) str_in[i + 1]) << 4) + str_out->val[j++] = (php_hex2int((int) str_in[i + 1]) << 4) + php_hex2int((int) str_in[i + 2]); i += 3; } else /* check for soft line break according to RFC 2045*/ { @@ -256,7 +256,7 @@ PHP_FUNCTION(quoted_printable_decode) } str_out->val[j] = '\0'; str_out->len = j; - + RETVAL_NEW_STR(str_out); } /* }}} */ |
