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

Piotr Jaroszyński p.jaroszynski at gmail.com
Thu Apr 1 09:10:43 EDT 2010


> 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

Ok.

>
>> +#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

The #ifdefs weren't supposed to make into the final patch, just wanted
to show both of my implementation to get feedback on which is better.
I prefer the table approach myself and wIll get rid of the other one
in the next series.

>> +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.

Well, it's not really that much related to buf_len so don't want to
make it look like it is.

-- 
Best Regards
Piotr Jaroszyński


More information about the gPXE-devel mailing list