Konstantin,
On 3/19/13 6:09 AM, Konstantin Kolinko wrote:
>> } else if (data[end - 1] == PADDING) {
>> - b1 = DECODING_TABLE[data[end - 4]];
>> - b2 = DECODING_TABLE[data[end - 3]];
>> - b3 = DECODING_TABLE[data[end - 2]];
>> + b1 = DECODING_TABLE[data[end - MASK_4BITS]];
>> + b2 = DECODING_TABLE[data[end - BYTES_PER_UNENCODED_BLOCK]];
>> + b3 = DECODING_TABLE[data[end - MASK_2BITS]];
>
>
> ??? (A question to commons team though).
>
> I do not know FileUpload code, but from my generic knowledge of base64,
> the above replacement is suspicious.
>
> I think the above replacement of 2,3,4 with constants is incorrect.
> They are just indexes in the table.
+1
The code will still run properly but if the constants were ever to be
changed (which they shouldn't!), chaos would ensue. It's also misleading
to read the code.
>> } else {
>> - b1 = DECODING_TABLE[data[end - 4]];
>> - b2 = DECODING_TABLE[data[end - 3]];
>> - b3 = DECODING_TABLE[data[end - 2]];
>> + b1 = DECODING_TABLE[data[end - MASK_4BITS]];
>> + b2 = DECODING_TABLE[data[end - BYTES_PER_UNENCODED_BLOCK]];
>> + b3 = DECODING_TABLE[data[end - MASK_2BITS]];
>> b4 = DECODING_TABLE[data[end - 1]];
Also here +1
-chris
signature.asc
Description: OpenPGP digital signature
