abies           Sat Jan 24 19:30:52 2004 EDT

  Modified files:              
    /php-src/ext/standard       url.c url.h ftp_fopen_wrapper.c 
  Log:
  Changed prototypes to allow parsing of string literals and constant strings
  Minor CS/WS
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/url.c?r1=1.75&r2=1.76&ty=u
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.75 php-src/ext/standard/url.c:1.76
--- php-src/ext/standard/url.c:1.75     Thu Jan  8 03:17:34 2004
+++ php-src/ext/standard/url.c  Sat Jan 24 19:30:49 2004
@@ -15,7 +15,7 @@
    | Author: Jim Winstead <[EMAIL PROTECTED]>                                  |
    +----------------------------------------------------------------------+
  */
-/* $Id: url.c,v 1.75 2004/01/08 08:17:34 andi Exp $ */
+/* $Id: url.c,v 1.76 2004/01/25 00:30:49 abies Exp $ */
 
 #include <stdlib.h>
 #include <string.h>
@@ -83,12 +83,12 @@
 
 /* {{{ php_url_parse
  */
-PHPAPI php_url *php_url_parse(char *str)
+PHPAPI php_url *php_url_parse(char const *str)
 {
        int length = strlen(str);
        char port_buf[5];
        php_url *ret = ecalloc(1, sizeof(php_url));
-       char *s, *e, *p, *pp, *ue;
+       char const *s, *e, *p, *pp, *ue;
                
        s = str;
        ue = s + length;
@@ -371,11 +371,11 @@
 
 /* {{{ php_url_encode
  */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length)
+PHPAPI char *php_url_encode(char const *s, int len, int *new_length)
 {
        register unsigned char c;
-       unsigned char *to, *from, *start;
-       unsigned char *end;
+       unsigned char *to, *start;
+       unsigned char const *from, *end;
        
        from = s;
        end = s + len;
@@ -392,15 +392,15 @@
                                   (c > 'Z' && c < 'a' && c != '_') ||
                                   (c > 'z')) {
                        to[0] = '%';
-                       to[1] = hexchars[(unsigned char) c >> 4];
-                       to[2] = hexchars[(unsigned char) c & 15];
+                       to[1] = hexchars[c >> 4];
+                       to[2] = hexchars[c & 15];
                        to += 3;
 #else /*CHARSET_EBCDIC*/
                } else if (!isalnum(c) && strchr("_-.", c) == NULL) {
                        /* Allow only alphanumeric chars and '_', '-', '.'; escape the 
rest */
                        to[0] = '%';
-                       to[1] = hexchars[os_toascii[(unsigned char) c] >> 4];
-                       to[2] = hexchars[os_toascii[(unsigned char) c] & 15];
+                       to[1] = hexchars[os_toascii[c] >> 4];
+                       to[2] = hexchars[os_toascii[c] & 15];
                        to += 3;
 #endif /*CHARSET_EBCDIC*/
                } else {
@@ -459,9 +459,11 @@
        char *data = str;
 
        while (len--) {
-               if (*data == '+')
+               if (*data == '+') {
                        *dest = ' ';
-               else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && 
isxdigit((int) *(data + 2))) {
+               }
+               else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && 
isxdigit((int) *(data + 2))) 
+               {
 #ifndef CHARSET_EBCDIC
                        *dest = (char) php_htoi(data + 1);
 #else
@@ -469,8 +471,9 @@
 #endif
                        data += 2;
                        len -= 2;
-               } else
+               } else {
                        *dest = *data;
+               }
                data++;
                dest++;
        }
@@ -481,7 +484,7 @@
 
 /* {{{ php_raw_url_encode
  */
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length)
+PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length)
 {
        register int x, y;
        unsigned char *str;
@@ -557,7 +560,8 @@
        char *data = str;
 
        while (len--) {
-               if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && 
isxdigit((int) *(data + 2))) {
+               if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && 
isxdigit((int) *(data + 2))) 
+               {
 #ifndef CHARSET_EBCDIC
                        *dest = (char) php_htoi(data + 1);
 #else
@@ -565,8 +569,9 @@
 #endif
                        data += 2;
                        len -= 2;
-               } else
+               } else {
                        *dest = *data;
+               }
                data++;
                dest++;
        }
http://cvs.php.net/diff.php/php-src/ext/standard/url.h?r1=1.17&r2=1.18&ty=u
Index: php-src/ext/standard/url.h
diff -u php-src/ext/standard/url.h:1.17 php-src/ext/standard/url.h:1.18
--- php-src/ext/standard/url.h:1.17     Thu Jan  8 12:32:52 2004
+++ php-src/ext/standard/url.h  Sat Jan 24 19:30:49 2004
@@ -15,7 +15,7 @@
    | Author: Jim Winstead <[EMAIL PROTECTED]>                                  |
    +----------------------------------------------------------------------+
  */
-/* $Id: url.h,v 1.17 2004/01/08 17:32:52 sniper Exp $ */
+/* $Id: url.h,v 1.18 2004/01/25 00:30:49 abies Exp $ */
 
 #ifndef URL_H
 #define URL_H
@@ -32,11 +32,11 @@
 } php_url;
 
 PHPAPI void php_url_free(php_url *theurl);
-PHPAPI php_url *php_url_parse(char *str);
+PHPAPI php_url *php_url_parse(char const *str);
 PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded 
string */
 PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded 
string */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length);
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length);
+PHPAPI char *php_url_encode(char const *s, int len, int *new_length);
+PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length);
 
 PHP_FUNCTION(parse_url);
 PHP_FUNCTION(urlencode);
http://cvs.php.net/diff.php/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.71&r2=1.72&ty=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.71 
php-src/ext/standard/ftp_fopen_wrapper.c:1.72
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.71       Thu Jan  8 03:17:32 2004
+++ php-src/ext/standard/ftp_fopen_wrapper.c    Sat Jan 24 19:30:50 2004
@@ -18,7 +18,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.71 2004/01/08 08:17:32 andi Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.72 2004/01/25 00:30:50 abies Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -125,7 +125,7 @@
        char *scratch;
        char tmp_line[512];
 
-       resource = php_url_parse((char *) path);
+       resource = php_url_parse(path);
        if (resource == NULL || resource->path == NULL)
                return NULL;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to