axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa.abeysin...@gmail.com>
Subject [Fwd: svn commit: r589983 - in /webservices/axis2/trunk/c/util: include/axutil_utils.h src/utils.c]
Date Thu, 01 Nov 2007 05:43:29 GMT
Hi Nandika,
    Looks like you have improved the URL encoding functions.
    Could you please explain where in the engine these are used.

Thanks,
Samisa...

-------- Original Message --------
Subject: 	svn commit: r589983 - in /webservices/axis2/trunk/c/util: 
include/axutil_utils.h src/utils.c
Date: 	Tue, 30 Oct 2007 08:28:29 -0000
From: 	nandika@apache.org
To: 	axis2-cvs@ws.apache.org



Author: nandika
Date: Tue Oct 30 01:28:27 2007
New Revision: 589983

URL: http://svn.apache.org/viewvc?rev=589983&view=rev
Log:
axutil_url_decode and axutil_hexit functions added

Modified:
    webservices/axis2/trunk/c/util/include/axutil_utils.h
    webservices/axis2/trunk/c/util/src/utils.c

Modified: webservices/axis2/trunk/c/util/include/axutil_utils.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axutil_utils.h?rev=589983&r1=589982&r2=589983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axutil_utils.h (original)
+++ webservices/axis2/trunk/c/util/include/axutil_utils.h Tue Oct 30 01:28:27 2007
@@ -178,6 +178,15 @@
         const axis2_char_t * s,
         axis2_bool_t quotes);
 
+    AXIS2_EXTERN int AXIS2_CALL
+    axutil_hexit(axis2_char_t c);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axutil_url_decode(
+        const axutil_env_t * env,
+        axis2_char_t * dest,
+        axis2_char_t * src);
+
     /** @} */
 
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/util/src/utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/utils.c?rev=589983&r1=589982&r2=589983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/utils.c (original)
+++ webservices/axis2/trunk/c/util/src/utils.c Tue Oct 30 01:28:27 2007
@@ -165,3 +165,48 @@
     *qscan = '\0';
     return qstr;
 }
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axutil_url_decode(
+    const axutil_env_t * env,
+    axis2_char_t * dest,
+    axis2_char_t * src)
+{
+    AXIS2_PARAM_CHECK(env->error, dest, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, src, AXIS2_FAILURE);
+
+    for (; *src != '\0'; ++dest, ++src)
+    {
+        if (src[0] == '%' && isxdigit(src[1]) && isxdigit(src[2]))
+        {
+            *dest = axutil_hexit(src[1]) * 16 + axutil_hexit(src[2]);
+            src += 2;
+        }
+        else
+        {
+            *dest = *src;
+        }
+    }
+    *dest = '\0';
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+axutil_hexit(axis2_char_t c)
+{
+    if (c >= '0' && c <= '9')
+    {
+        return c - '0';
+    }
+    if (c >= 'a' && c <= 'f')
+    {
+        return c - 'a' + 10;
+    }
+    if (c >= 'A' && c <= 'F')
+    {
+        return c - 'A' + 10;
+    }
+    return 0;    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org




-- 
Samisa Abeysinghe - Apche Axis2/C
"http://ws.apache.org/axis2/c/?Apache&nbsp;Axis2/C&nbsp;The&nbsp;Web&nbsp;Services&nbsp;Engine"


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message