Re: APR::Base64 Bug
[prev]
[thread]
[next]
[Date index for 2005/05/24]
--nextPart2484545.iFRbenpiDc
Content-Type: multipart/mixed;
boundary="Boundary-01=_QWtkC2Jg4NXbH3i"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--Boundary-01=_QWtkC2Jg4NXbH3i
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Monday 23 May 2005 22:57, Stas Bekman wrote:
> if it works for you, i'll commit it.
The attachment contains a complete patch including the test.
All tests successful, 1 test skipped.
Files=229, Tests=2475, 81 wallclock secs (62.48 cusr + 6.47 csys = 68.95 CPU)
Torsten
--Boundary-01=_QWtkC2Jg4NXbH3i
Content-Type: text/x-diff;
charset="iso-8859-1";
name="APR__Base64.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="APR__Base64.patch"
diff -Naur mod_perl-2.0.0/t/lib/TestAPRlib/base64.pm mod_perl-2.0.0.new/t/l=
ib/TestAPRlib/base64.pm
=2D-- mod_perl-2.0.0/t/lib/TestAPRlib/base64.pm 2005-04-26 20:58:42.0000000=
00 +0200
+++ mod_perl-2.0.0.new/t/lib/TestAPRlib/base64.pm 2005-05-24 09:05:31.17623=
1063 +0200
@@ -20,7 +20,7 @@
my $encoded =3D APR::Base64::encode($str);
=20
t_debug("encoded string: $encoded");
=2D ok $encoded;
+ ok t_cmp($encoded, 'MTIzNDVxd2VydCFAIyQl', 'encode');
=20
ok t_cmp(APR::Base64::encode_len(length $str),
length $encoded,
diff -Naur mod_perl-2.0.0/xs/APR/Base64/APR__Base64.h mod_perl-2.0.0.new/xs=
/APR/Base64/APR__Base64.h
=2D-- mod_perl-2.0.0/xs/APR/Base64/APR__Base64.h 2005-04-26 20:58:34.000000=
000 +0200
+++ mod_perl-2.0.0.new/xs/APR/Base64/APR__Base64.h 2005-05-24 09:03:30.6975=
80724 +0200
@@ -13,14 +13,18 @@
* limitations under the License.
*/
=20
+/* 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 =3D SvPV(arg, len);
=2D mpxs_sv_grow(sv, apr_base64_encode_len(len));
+ mpxs_sv_grow(sv, apr_base64_encode_len(len) - 1);
encoded_len =3D apr_base64_encode_binary(SvPVX(sv), data, len);
=2D mpxs_sv_cur_set(sv, encoded_len);
+ mpxs_sv_cur_set(sv, encoded_len - 1);
}
=20
static MP_INLINE void mpxs_apr_base64_decode(pTHX_ SV *sv, SV *arg)
diff -Naur mod_perl-2.0.0/xs/maps/apr_functions.map mod_perl-2.0.0.new/xs/m=
aps/apr_functions.map
=2D-- mod_perl-2.0.0/xs/maps/apr_functions.map 2005-05-12 13:46:50.00000000=
0 +0200
+++ mod_perl-2.0.0.new/xs/maps/apr_functions.map 2005-05-24 09:03:12.383066=
190 +0200
@@ -579,7 +579,7 @@
MODULE=3DAPR::Base64
apr_base64_decode | MPXS_ | coded_src
apr_base64_encode | MPXS_ | plain_src
=2D apr_base64_encode_len
+ int:DEFINE_encode_len | | int:len
-apr_base64_decode_len
-apr_base64_encode_binary
-apr_base64_decode_binary
--Boundary-01=_QWtkC2Jg4NXbH3i--
--nextPart2484545.iFRbenpiDc
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQBCktWbwicyCTir8T4RApp2AJ42UQBdVjKpJ+5C4fAuGbkYN1O1kQCfbNcV
2oQ+ZJUl2CPa4Y+RhmrjsoE=
=+Wrl
-----END PGP SIGNATURE-----
--nextPart2484545.iFRbenpiDc--
 |
(message missing)
|