From: Florian Forster Date: Wed, 28 Jul 2010 16:01:45 +0000 (+0200) Subject: src/utils_cgi.c: Implement "uri_escape_buffer". X-Git-Tag: v4.0.0~62 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1ca9e6ca7959d20780bb3bc336404549156415c7;p=collection4.git src/utils_cgi.c: Implement "uri_escape_buffer". --- diff --git a/src/utils_cgi.c b/src/utils_cgi.c index 7c01bd9..7851914 100644 --- a/src/utils_cgi.c +++ b/src/utils_cgi.c @@ -432,6 +432,7 @@ char *uri_escape_copy (char *dest, const char *src, size_t n) /* {{{ */ return (dest); } else if ((((unsigned char) src[in]) < 32) + || (src[in] == ' ') || (src[in] == '&') || (src[in] == ';') || (src[in] == '?') @@ -462,6 +463,16 @@ char *uri_escape_copy (char *dest, const char *src, size_t n) /* {{{ */ return (dest); } /* }}} char *uri_escape_copy */ +char *uri_escape_buffer (char *buffer, size_t buffer_size) /* {{{ */ +{ + char temp[buffer_size]; + + uri_escape_copy (temp, buffer, buffer_size); + memcpy (buffer, temp, buffer_size); + + return (&buffer[0]); +} /* }}} char *uri_escape_buffer */ + char *uri_escape (const char *string) /* {{{ */ { char buffer[4096];