67 static const char cb64[] =
68 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
74 return OREF_NULLSTRING;
77 size_t outputLength = (inputLength / 3) * 4;
78 if (inputLength % 3 > 0)
87 while (inputLength > 0)
90 for (i = 0; i < 3; i++)
94 inc[i] = *source & 0xff;
106 *destination = cb64[ inc[0] >> 2 ];
108 *destination = cb64[ ((inc[0] & 0x03) << 4) | ((inc[1] & 0xf0) >> 4) ];
110 *destination = (char) (buflen > 1 ? cb64[ ((inc[1] & 0x0f) << 2) | ((inc[2] & 0xc0) >> 6) ] :
'=');
112 *destination = (char) (buflen > 2 ? cb64[ inc[2] & 0x3f ] :
'=');
129 static const char cb64[] =
130 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
134 if (inputLength == 0)
136 return OREF_NULLSTRING;
138 if (inputLength % 4 > 0) {
144 size_t outputLength = (inputLength / 4) * 3;
145 if (*(source + inputLength - 1) ==
'=')
149 if (*(source + inputLength - 2) ==
'=')
159 for (i = 0; i < 4; i++)
161 for (j = 0; j < 64; j++)
163 if (*(cb64 + j) == *(source + i))
171 if (*(source + i) ==
'=' && inputLength <= 4) {
184 *destination = (char)(j << 2);
187 *destination |= (char)(j >> 4);
189 *destination = (char)(j << 4);
192 *destination |= (char)(j >> 2);
194 *destination = (char)(j << 6);
197 *destination |= (char)j;
224 Retval = OREF_NULLSTRING;
233 while (InputLength--)
265 return numberstring->
d2xD2c(_length,
true);
281 return numberstring->
d2xD2c(_length,
false);
292 return OREF_NULLSTRING;
307 return this->
x2dC2d(_length,
false);
328 size_t NibblePosition;
333 size_t CurrentDigits;
367 if (*StringPtr & 0x80)
398 BytePosition = ResultSize / 2;
400 NibblePosition = ResultSize % 2;
402 ResultSize = (BytePosition + NibblePosition);
414 if ((NibblePosition &&
416 *StringPtr & 0x08) ||
438 *Scan = *Scan ^ 0xff;
472 HighDigit = Accumulator - 1;
482 DecLength = (Accumulator - HighDigit);
483 if (DecLength > CurrentDigits)
502 DecLength = (Accumulator - HighDigit);
503 if (DecLength > CurrentDigits)
516 DecLength = (Accumulator - HighDigit);
517 TempLength = DecLength;
518 Scan = HighDigit + 1;
526 ResultSize = DecLength;
538 memcpy(Scan, Accumulator - DecLength + 1, DecLength);
558 Retval = OREF_NULLSTRING;
580 memset(Nibble,
'0', 4);
599 return this->
x2dC2d(_length,
true);
618 Retval = OREF_NULLSTRING;
638 memcpy(Destination, Nibble, 4);