]> granicus.if.org Git - php/commitdiff
- Whitespace
authorDerick Rethans <derick@php.net>
Tue, 2 Apr 2002 06:41:23 +0000 (06:41 +0000)
committerDerick Rethans <derick@php.net>
Tue, 2 Apr 2002 06:41:23 +0000 (06:41 +0000)
ext/standard/quot_print.c

index 1009018bf87a547c52c1f7f2d59ee1d45200e38b..4d369ae90255a1593283a0c2a2fbccdc20697bfc 100644 (file)
 */
 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 @@ PHP_FUNCTION(quoted_printable_decode)
        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);
 }
 /* }}} */