cvs: php4 /ext/standard quot_print.c
| From: | Derick Rethans | Date: | Tue, 02 Apr 2002 06:41:23 +0000 |
| Subject: | cvs: php4 /ext/standard quot_print.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10826@lists.php.net to get a copy of this message | ||
derick Tue Apr 2 01:41:23 2002 EDT
Modified files:
/php4/ext/standard quot_print.c
Log:
- Whitespace
Index: php4/ext/standard/quot_print.c
diff -u php4/ext/standard/quot_print.c:1.20 php4/ext/standard/quot_print.c:1.21
--- php4/ext/standard/quot_print.c:1.20 Mon Apr 1 12:03:01 2002
+++ php4/ext/standard/quot_print.c Tue Apr 2 01:41:23 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: quot_print.c,v 1.20 2002/04/01 17:03:01 kir Exp $ */
+/* $Id: quot_print.c,v 1.21 2002/04/02 06:41:23 derick Exp $ */
#include <stdlib.h>
@@ -36,20 +36,16 @@
*/
static char php_hex2int(int c)
{
- if ( isdigit(c) )
- {
+ if (isdigit(c)) {
return c - '0';
}
- else if ( c >= 'A' && c <= 'F' )
- {
+ else if (c >= 'A' && c <= 'F') {
return c - 'A' + 10;
}
- else if ( c >= 'a' && c <= 'f' )
- {
- return c - 'a' + 10;
- }
- else
- {
+ else if (c >= 'a' && c <= 'f') {
+ return c - 'a' + 10;
+ }
+ else {
return -1;
}
}
@@ -66,69 +62,59 @@
pval **arg1;
char *str_in, *str_out;
int i = 0, j = 0, k;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string_ex(arg1);
- if(Z_STRLEN_PP(arg1) == 0) {
+ if (Z_STRLEN_PP(arg1) == 0) {
/* shortcut */
RETURN_EMPTY_STRING();
}
- str_in = Z_STRVAL_PP(arg1);
- str_out = emalloc(Z_STRLEN_PP(arg1)+1);
- while ( str_in[i] )
- {
- switch (str_in[i])
- {
- case '=':
- if (str_in[i+1] && str_in[i+2] &&
- isxdigit((int)str_in[i+1]) &&
- isxdigit((int)str_in[i+1]) )
- {
- str_out[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*/
- {
- k = 1;
- while ( str_in[i+k] && ((str_in[i+k] == 32) || (str_in[i+k] == 9)) )
- {
- /* Possibly, skip spaces/tabs at the end of line */
- k++;
- }
- if (!str_in[i+k])
- {
- /* End of line reached */
- i += k;
- }
- else if ( (str_in[i+k] == 13) && (str_in[i+k+1] == 10))
- {
- /* CRLF */
- i += k+2;
- }
- else if ( (str_in[i+k] == 13) || (str_in[i+k] == 10) )
- {
- /* CR or LF */
- i += k+1;
- }
- else
- {
- str_out[j++] = str_in[i++];
- }
- }
- break;
- default:
- str_out[j++] = str_in[i++];
- }
- }
- str_out[j] = '\0';
+ str_in = Z_STRVAL_PP(arg1);
+ str_out = emalloc(Z_STRLEN_PP(arg1) + 1);
+ while (str_in[i]) {
+ switch (str_in[i]) {
+ case '=':
+ if (str_in[i + 1] && str_in[i + 2] &&
+ isxdigit((int) str_in[i + 1]) &&
+ isxdigit((int) str_in[i + 1]))
+ {
+ str_out[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*/ {
+ k = 1;
+ while (str_in[i + k] && ((str_in[i + k] == 32) || (str_in[i + k] == 9))) {
+ /* Possibly, skip spaces/tabs at the end of line */
+ k++;
+ }
+ if (!str_in[i + k]) {
+ /* End of line reached */
+ i += k;
+ }
+ else if ((str_in[i + k] == 13) && (str_in[i + k + 1] == 10)) {
+ /* CRLF */
+ i += k + 2;
+ }
+ else if ((str_in[i + k] == 13) || (str_in[i + k] == 10)) {
+ /* CR or LF */
+ i += k + 1;
+ }
+ else {
+ str_out[j++] = str_in[i++];
+ }
+ }
+ break;
+ default:
+ str_out[j++] = str_in[i++];
+ }
+ }
+ str_out[j] = '\0';
- RETVAL_STRINGL(str_out, j, 0);
+ RETVAL_STRINGL(str_out, j, 0);
}
/* }}} */