Fixed maximum line length bug.
This commit is contained in:
parent
c00aa1fc5e
commit
8f7a3ab27a
@ -117,13 +117,16 @@ const utility::stream::size_type encoderB64::encode(utility::inputStream& in,
|
|||||||
while (count < 3 && bufferPos < bufferLength)
|
while (count < 3 && bufferPos < bufferLength)
|
||||||
bytes[count++] = buffer[bufferPos++];
|
bytes[count++] = buffer[bufferPos++];
|
||||||
|
|
||||||
if (count != 3)
|
while (count < 3)
|
||||||
{
|
{
|
||||||
// There may be more data in the next chunk...
|
// There may be more data in the next chunk...
|
||||||
if (bufferPos >= bufferLength)
|
if (bufferPos >= bufferLength)
|
||||||
{
|
{
|
||||||
bufferLength = in.read(buffer, sizeof(buffer));
|
bufferLength = in.read(buffer, sizeof(buffer));
|
||||||
bufferPos = 0;
|
bufferPos = 0;
|
||||||
|
|
||||||
|
if (bufferLength == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (count < 3 && bufferPos < bufferLength)
|
while (count < 3 && bufferPos < bufferLength)
|
||||||
@ -169,7 +172,7 @@ const utility::stream::size_type encoderB64::encode(utility::inputStream& in,
|
|||||||
total += 4;
|
total += 4;
|
||||||
curCol += 4;
|
curCol += 4;
|
||||||
|
|
||||||
if (cutLines && curCol >= maxLineLength - 1)
|
if (cutLines && curCol >= maxLineLength - 2 /* \r\n */ - 4 /* next bytes */)
|
||||||
{
|
{
|
||||||
out.write("\r\n", 2);
|
out.write("\r\n", 2);
|
||||||
curCol = 0;
|
curCol = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user