|
@@ -9,8 +9,10 @@ For details, see http://sourceforge.net/projects/libb64
|
|
|
|
|
|
const int CHARS_PER_LINE = 72;
|
|
const int CHARS_PER_LINE = 72;
|
|
|
|
|
|
|
|
+#ifdef _MSC_VER
|
|
#pragma warning(push)
|
|
#pragma warning(push)
|
|
#pragma warning(disable : 4244)
|
|
#pragma warning(disable : 4244)
|
|
|
|
+#endif // _MSC_VER
|
|
|
|
|
|
void base64_init_encodestate(base64_encodestate* state_in)
|
|
void base64_init_encodestate(base64_encodestate* state_in)
|
|
{
|
|
{
|
|
@@ -33,9 +35,9 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
|
char* codechar = code_out;
|
|
char* codechar = code_out;
|
|
char result;
|
|
char result;
|
|
char fragment;
|
|
char fragment;
|
|
-
|
|
|
|
|
|
+
|
|
result = state_in->result;
|
|
result = state_in->result;
|
|
-
|
|
|
|
|
|
+
|
|
switch (state_in->step)
|
|
switch (state_in->step)
|
|
{
|
|
{
|
|
while (1)
|
|
while (1)
|
|
@@ -74,7 +76,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
|
*codechar++ = base64_encode_value(result);
|
|
*codechar++ = base64_encode_value(result);
|
|
result = (fragment & 0x03f) >> 0;
|
|
result = (fragment & 0x03f) >> 0;
|
|
*codechar++ = base64_encode_value(result);
|
|
*codechar++ = base64_encode_value(result);
|
|
-
|
|
|
|
|
|
+
|
|
++(state_in->stepcount);
|
|
++(state_in->stepcount);
|
|
if (state_in->stepcount == CHARS_PER_LINE/4)
|
|
if (state_in->stepcount == CHARS_PER_LINE/4)
|
|
{
|
|
{
|
|
@@ -90,7 +92,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
|
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
|
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
|
{
|
|
{
|
|
char* codechar = code_out;
|
|
char* codechar = code_out;
|
|
-
|
|
|
|
|
|
+
|
|
switch (state_in->step)
|
|
switch (state_in->step)
|
|
{
|
|
{
|
|
case step_B:
|
|
case step_B:
|
|
@@ -106,8 +108,10 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
*codechar++ = '\n';
|
|
*codechar++ = '\n';
|
|
-
|
|
|
|
|
|
+
|
|
return (int)(codechar - code_out);
|
|
return (int)(codechar - code_out);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef _MSC_VER
|
|
#pragma warning(pop)
|
|
#pragma warning(pop)
|
|
|
|
+#endif // _MSC_VER
|