perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r178188 - in /perl/modperl/trunk: Changes t/lib/TestAPRlib/base64.pm xs/APR/Base64/APR__Base64.h xs/maps/apr_functions.map
Date Tue, 24 May 2005 15:23:30 GMT
Author: stas
Date: Tue May 24 08:23:29 2005
New Revision: 178188

URL: http://svn.apache.org/viewcvs?rev=178188&view=rev
Log:
APR::Base64 :
- fix encode_len() to return the length without accounting for the
terminating '\0' as the C API does. 
- fix encode() to create the string of the correct length (previously
was creating one too many)
Contributed by: Torsten Foertsch <torsten.foertsch@gmx.net>

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/t/lib/TestAPRlib/base64.pm
    perl/modperl/trunk/xs/APR/Base64/APR__Base64.h
    perl/modperl/trunk/xs/maps/apr_functions.map

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=178188&r1=178187&r2=178188&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Tue May 24 08:23:29 2005
@@ -12,6 +12,12 @@
 
 =item 2.0.1-dev
 
+APR::Base64 : [Torsten Foertsch <torsten.foertsch@gmx.net>]
+- fix encode_len() to return the length without accounting for the
+terminating '\0' as the C API does. 
+- fix encode() to create the string of the correct length (previously
+was creating one too many)
+
 in mod_perl callbacks merge error-notes entries rather than store just
 the newest error [Mark <mark@immermail.com>]
 

Modified: perl/modperl/trunk/t/lib/TestAPRlib/base64.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/base64.pm?rev=178188&r1=178187&r2=178188&view=diff
==============================================================================
--- perl/modperl/trunk/t/lib/TestAPRlib/base64.pm (original)
+++ perl/modperl/trunk/t/lib/TestAPRlib/base64.pm Tue May 24 08:23:29 2005
@@ -20,7 +20,7 @@
     my $encoded = APR::Base64::encode($str);
 
     t_debug("encoded string: $encoded");
-    ok $encoded;
+    ok t_cmp($encoded, 'MTIzNDVxd2VydCFAIyQl', 'encode');
 
     ok t_cmp(APR::Base64::encode_len(length $str),
              length $encoded,

Modified: perl/modperl/trunk/xs/APR/Base64/APR__Base64.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/Base64/APR__Base64.h?rev=178188&r1=178187&r2=178188&view=diff
==============================================================================
--- perl/modperl/trunk/xs/APR/Base64/APR__Base64.h (original)
+++ perl/modperl/trunk/xs/APR/Base64/APR__Base64.h Tue May 24 08:23:29 2005
@@ -13,14 +13,18 @@
  * limitations under the License.
  */
 
+/* apr_base64_encode_len and apr_base64_encode_binary give length that
+ * includes the terminating '\0' */
+#define mpxs_APR__Base64_encode_len(len) apr_base64_encode_len(len) - 1;
+    
 static MP_INLINE void mpxs_apr_base64_encode(pTHX_ SV *sv, SV *arg)
 {
     STRLEN len;
     int encoded_len;
     char *data = SvPV(arg, len);
-    mpxs_sv_grow(sv, apr_base64_encode_len(len));
+    mpxs_sv_grow(sv, apr_base64_encode_len(len) - 1);
     encoded_len = apr_base64_encode_binary(SvPVX(sv), data, len);
-    mpxs_sv_cur_set(sv, encoded_len);
+    mpxs_sv_cur_set(sv, encoded_len - 1);
 }
 
 static MP_INLINE void mpxs_apr_base64_decode(pTHX_ SV *sv, SV *arg)

Modified: perl/modperl/trunk/xs/maps/apr_functions.map
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/apr_functions.map?rev=178188&r1=178187&r2=178188&view=diff
==============================================================================
--- perl/modperl/trunk/xs/maps/apr_functions.map (original)
+++ perl/modperl/trunk/xs/maps/apr_functions.map Tue May 24 08:23:29 2005
@@ -579,7 +579,7 @@
 MODULE=APR::Base64
  apr_base64_decode | MPXS_ | coded_src
  apr_base64_encode | MPXS_ | plain_src
- apr_base64_encode_len
+ int:DEFINE_encode_len | | int:len
 -apr_base64_decode_len
 -apr_base64_encode_binary
 -apr_base64_decode_binary



Mime
View raw message