[phobos] std.base64 replacement

Daniel Murphy yebblies at gmail.com
Wed Oct 27 01:10:16 PDT 2010


On Wed, Oct 27, 2010 at 2:20 AM, Masahiro Nakagawa <repeatedly at gmail.com>wrote:

> Applied!
>

 Great!

The only thing that still bugs me a little is the error messages:
"Cannot call popFront on empty range" should probably say something like
"Cannot call popFront on Encoder with no data remaining", but it's really
superficial.
The static asserts could also be improved (I know I did them in the first
place)

static assert(Map62th < 'A' || Map62th > 'Z', "Character '" ~ Map62th ~ "'
cannot be used twice");
static assert(Map62th != NoPadding, "'\\0' is not a valid base64
character");

Decoder currently advances partially on each call to front!  This code
should be moved into popFront, or at the very least the result should be
cached.
Encoder doesn't advance, but currently re-encodes the data on each call to
front.  This should also be moved into popFront.

Decoder.front also currently uses array appending to build the input data.
 It might be worth only reading several bytes off the next element of the
input in order to avoid unnecessary allocations.

If this is only supposed to work with foreach, an opApply based design might
be a better fit.

Daniel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20101027/3462fc7d/attachment.html>


More information about the phobos mailing list