X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=encode.c;h=7e82acd8fcc87523a5fd85495d2a14e840a2932c;hp=42d07443d7cf4c0608f93c10bb806b76bb60ff8a;hb=5e64295a7ed3662f734abfb34d50a0f1a9dc5377;hpb=c75584ebcc79f939fb4ec9c8f842cef6692640c7 diff --git a/encode.c b/encode.c index 42d07443..7e82acd8 100644 --- a/encode.c +++ b/encode.c @@ -1,7 +1,7 @@ -const char encode_rcs[] = "$Id: encode.c,v 1.1 2001/05/13 21:57:06 administrator Exp $"; +const char encode_rcs[] = "$Id: encode.c,v 1.1.1.1 2001/05/15 13:58:51 oes Exp $"; /********************************************************************* * - * File : $Source: /home/administrator/cvs/ijb/encode.c,v $ + * File : $Source: /cvsroot/ijbswa/current/encode.c,v $ * * Purpose : Functions to encode and decode URLs, and also to * encode cookies and HTML text. @@ -33,6 +33,9 @@ const char encode_rcs[] = "$Id: encode.c,v 1.1 2001/05/13 21:57:06 administrator * * Revisions : * $Log: encode.c,v $ + * Revision 1.1.1.1 2001/05/15 13:58:51 oes + * Initial import of version 2.9.3 source tree + * * *********************************************************************/ @@ -42,7 +45,7 @@ const char encode_rcs[] = "$Id: encode.c,v 1.1 2001/05/13 21:57:06 administrator #include #include #include - + #include "encode.h" const char encode_h_rcs[] = ENCODE_H_VERSION; @@ -232,7 +235,7 @@ char * cookie_encode(const char *s) * Function : url_encode * * Description : Encodes a string so it can be used in a URL - * query string. Replaces special characters with + * query string. Replaces special characters with * the appropriate %xx codes. * * Parameters : @@ -243,12 +246,12 @@ char * cookie_encode(const char *s) * *********************************************************************/ char * url_encode(const char *s) -{ - /* each input char can expand to at most 3 chars */ +{ + /* each input char can expand to at most 3 chars */ char * buf = (char *) malloc((strlen(s) * 3) + 1); - + if (buf) - { + { char c; char * p = buf; while( (c = *s++) != '\0') @@ -266,9 +269,9 @@ char * url_encode(const char *s) } *p = '\0'; - + } - + return(buf); } @@ -355,9 +358,9 @@ char *url_decode(const char * s) { char *buf = malloc(strlen(s) + 1); char *q = buf; - - if (buf) - { + + if (buf) + { while (*s) { switch (*s) @@ -385,9 +388,9 @@ char *url_decode(const char * s) break; } } - *q = '\0'; + *q = '\0'; } - + return(buf); }