[gnet] Re: [gnet-dev] gnet_base64_encode version 2.0.5



hi!

>The 2.0.5's gnet_base64_encode function is buggy. Has
>anybody fixed it?
>
>I encoded "A\x84\0", the result was "QIQA". That
>result was incorrect. The correct result is "QYQA" 
>
>I have fixed gnet_base64_encode in my libgnet code
>tree. But I created the function from scratch, not
>based from the 2.0.5's gnet_base64_encode.

since i have been cooked up that code here is the fix.
change the line:

      output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);

to:

      output[1] = ((input[0] & 0x03) << 6) + (input[1] >> 2);


sorry, but i cant do cvs nor diff at the moment.


cheers,

--
  __              _ 
 / _|_ __ ___  __| | ___    unix, linux, freebsd
| |_| '__/ _ \/ _` |/ _ \   jpeg, png, gif, ppm
|  _| | |  __/ (_| | (_) |  apache, perl, php, mysql 
|_| |_|  \___|\__,_|\___/   pdf, ps, abw, html, pod



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]