apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r995861 - in /apr/apr/trunk: encoding/apr_base64.c include/apr_base64.h
Date Fri, 10 Sep 2010 16:43:49 GMT
Author: sf
Date: Fri Sep 10 16:43:49 2010
New Revision: 995861

URL: http://svn.apache.org/viewvc?rev=995861&view=rev
Log:
Correctly document the handling of trailing \0 characters

Modified:
    apr/apr/trunk/encoding/apr_base64.c
    apr/apr/trunk/include/apr_base64.h

Modified: apr/apr/trunk/encoding/apr_base64.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/encoding/apr_base64.c?rev=995861&r1=995860&r2=995861&view=diff
==============================================================================
--- apr/apr/trunk/encoding/apr_base64.c (original)
+++ apr/apr/trunk/encoding/apr_base64.c Fri Sep 10 16:43:49 2010
@@ -139,8 +139,9 @@ APR_DECLARE(int) apr_base64_decode(char 
     return len;
 }
 
-/* This is the same as apr_base64_decode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
+/* This is the same as apr_base64_decode() except:
+ * - no \0 is appended
+ * - on EBCDIC machines, the conversion of the output to ebcdic is left out
  */
 APR_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain,
 				   const char *bufcoded)

Modified: apr/apr/trunk/include/apr_base64.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_base64.h?rev=995861&r1=995860&r2=995861&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_base64.h (original)
+++ apr/apr/trunk/include/apr_base64.h Fri Sep 10 16:43:49 2010
@@ -43,10 +43,10 @@ extern "C" {
  * the incoming plain source. And return the length of what we decoded.
  *
  * The decoding function takes any non valid char (i.e. whitespace, \0
- * or anything non A-Z,0-9 etc as terminal.
+ * or anything non A-Z,0-9 etc) as terminal.
  * 
- * plain strings/binary sequences are not assumed '\0' terminated. Encoded
- * strings are neither. But probably should.
+ * The handling of terminating \0 characters differs from function to
+ * function.
  *
  */
 
@@ -54,26 +54,32 @@ extern "C" {
  * Given the length of an un-encrypted string, get the length of the 
  * encrypted string.
  * @param len the length of an unencrypted string.
- * @return the length of the string after it is encrypted
+ * @return the length of the string after it is encrypted, including the
+ * trailing \0
  */ 
 APR_DECLARE(int) apr_base64_encode_len(int len);
 
 /**
- * Encode a text string using base64encoding.
- * @param coded_dst The destination string for the encoded string.
+ * Encode a text string using base64encoding. On EBCDIC machines, the input
+ * is first converted to ASCII.
+ * @param coded_dst The destination string for the encoded string. A \0 is
+ * appended.
  * @param plain_src The original string in plain text
  * @param len_plain_src The length of the plain text string
- * @return the length of the encoded string
+ * @return the length of the encoded string, including the trailing \0
  */ 
 APR_DECLARE(int) apr_base64_encode(char * coded_dst, const char *plain_src, 
                                  int len_plain_src);
 
 /**
- * Encode an EBCDIC string using base64encoding.
- * @param coded_dst The destination string for the encoded string.
+ * Encode an text string using base64encoding. This is the same as
+ * apr_base64_encode() except on EBCDIC machines, where the conversion of the
+ * input to ASCII is left out.
+ * @param coded_dst The destination string for the encoded string. A \0 is
+ * appended.
  * @param plain_src The original string in plain text
  * @param len_plain_src The length of the plain text string
- * @return the length of the encoded string
+ * @return the length of the encoded string, including the trailing \0
  */ 
 APR_DECLARE(int) apr_base64_encode_binary(char * coded_dst, 
                                         const unsigned char *plain_src,
@@ -88,16 +94,21 @@ APR_DECLARE(int) apr_base64_encode_binar
 APR_DECLARE(int) apr_base64_decode_len(const char * coded_src);
 
 /**
- * Decode a string to plain text
- * @param plain_dst The destination string for the plain text
+ * Decode a string to plain text. On EBCDIC machines, the result is then
+ * converted to EBCDIC.
+ * @param plain_dst The destination string for the plain text. A \0 is
+ * appended.
  * @param coded_src The encoded string 
- * @return the length of the plain text string
+ * @return the length of the plain text string (excluding the trailing \0)
  */ 
 APR_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src);
 
 /**
- * Decode an EBCDIC string to plain text
- * @param plain_dst The destination string for the plain text
+ * Decode an string to plain text. This is the same as apr_base64_decode()
+ * except no \0 is appended and on EBCDIC machines, the conversion of the
+ * output to EBCDIC is left out.
+ * @param plain_dst The destination string for the plain text. The string is
+ * not \0-terminated.
  * @param coded_src The encoded string 
  * @return the length of the plain text string
  */ 



Mime
View raw message