mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Added padding flag
This commit is contained in:
parent
456a56e7aa
commit
5016d4033f
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user