Added padding flag

This commit is contained in:
John Wellbelove 2023-10-21 11:41:35 +01:00 committed by John Wellbelove
parent b1a042385f
commit 02e69f5757
2 changed files with 19 additions and 5 deletions

View File

@ -80,6 +80,15 @@ namespace etl
{
public:
//*************************************************************************
/// Default constructor
//*************************************************************************
ETL_CONSTEXPR14
base64()
: use_padding(true)
{
}
//*************************************************************************
/// Encode to Base64
/// Four parameter
@ -599,11 +608,14 @@ namespace etl
}
}
// Pad out the end of the output buffer.
while (output_count != output_length)
if (use_padding)
{
*output++ = padding<char>();
++output_count;
// Pad out the end of the output buffer.
while (output_count != output_length)
{
*output++ = padding<char>();
++output_count;
}
}
return output_length;
@ -658,6 +670,8 @@ namespace etl
return output_length;
}
bool use_padding;
};
}

View File

@ -563,7 +563,7 @@ namespace
etl::array<char, etl::base64::encoded_size(Size)> output{ 0 };
b64.encode(input.begin(), Size,
output._buffer, encoded_size);
output._buffer, encoded_size);
return output;
}