[gPXE-devel] [PATCH 1/2] [base64] Add decoding support.

Stefan Hajnoczi stefanha at gmail.com
Thu Apr 1 04:04:32 EDT 2010


2010/3/27 Piotr Jaroszyński <p.jaroszynski at gmail.com>:
> ---

Please add Signed-off-by.  The Linux SubmittingPatches documentation
describes what adding Signed-off-by means:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/SubmittingPatches;h=72651f788f4e3536149ef5e7ddfbed96a8f14d2f;hb=HEAD#l286

> +#define TABLE

gPXE avoids #ifdefs because it makes testing much harder and chances
are dead code will rot.  If you are happy with the lookup table
approach, then submitting just that would be preferred.  For more
background:
http://git.etherboot.org/?p=gpxe.git;a=blob;f=src/include/gpxe/tables.h;h=7dfced8c4686c0cb4f85c88076200d1c55f43fab;hb=HEAD#l6

> +int base64_decode ( const char *encoded, char *raw ) {
> +       const uint8_t *encoded_bytes = ( ( const uint8_t * ) encoded );
> +       uint8_t *raw_bytes = ( ( uint8_t * ) raw );
> +       size_t encoded_len =  strlen ( encoded );
> +       size_t len = ( encoded_len / 4 ) * 3;

Could use base64_decode_buf_len() instead of writing out the expression.

Stefan


More information about the gPXE-devel mailing list