bug-commoncpp
[Top][All Lists]
Advanced

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

base 64 encode/decode test


From: Chad Yates
Subject: base 64 encode/decode test
Date: Tue, 07 Jan 2003 12:55:10 -0800

Here is the test program I promised.  On my win32 system and vc++ 6.0 the
second two tests (testPadding1Short, testPadding2Short) fail unless I change
part of the b64Decode function like so:

if (c == '=')
{
  if (bits & 0x40000)
  {
    if (dstsize < 2) break;
    *(pdst++) = (bits >> 10);  // changed from '(bits >> 16)'
    *(pdst++) = (bits >> 2) & 0xff;  // changed from '(bits >> 8) & 0xff'
    break;
  }
  if (bits & 0x1000 && dstsize)
    *(pdst++) = (bits >> 4);  // changed from '(bits >> 10)'
  break;
}

What I want to know if this is system specific (endian related?) or an
actual bug.

thanks,

Chad

Attachment: b64test.cpp
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]