[PATCH] base-64 encoder upgrade

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 28 Apr 2011 17:01:40 +1200

Markus Moeller has re-implemented several of the coder functions for use
by Kerberos helpers.

This patch seeks to de-duplicate them and combine the resulting code
back into the libmiscencoding.la "base64.h" implementation.

Changes include:

  * old function API renamed to old_*() and existing code update to use
the names. Some code has been updated to use the new API.

  * new estimator base64_encode_len()/base64_decode_len() function added
to provide details of much much buffer space the output will require.

  * new API encoder and decoder functions added which accept caller
provided buffers and encode/decode an arbitrary string into them.

  * also fixes a bug where if the input text or output buffer was too
short the coder functions would crop a few bytes off the end of the result.

Some optimizations have been added by myself over and above Markus changes:

  * optimized to short-circuit on several more variations of empty input
and nil result buffer.

  * sub-loop optimizations added to reduce the number of if() calls made
by the new code.

  * split encoder into terminated (C-str) and non-terminated variants.

I have also now documented both old and new APIs functions.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.12
   Beta testers wanted for 3.2.0.7 and 3.1.12.1

Received on Thu Apr 28 2011 - 05:01:46 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 29 2011 - 12:00:07 MDT