Pad input with null characters if it is not a multiple of 3.
PR: bin/31156 MFC after: 1 week
This commit is contained in:
parent
9c40d2f8d9
commit
48d3dbff31
@ -117,6 +117,12 @@ encode()
|
||||
if (putchar(ch) == EOF)
|
||||
break;
|
||||
for (p = buf; n > 0; n -= 3, p += 3) {
|
||||
/* Pad with nulls if not a multiple of 3. */
|
||||
if (n < 3) {
|
||||
p[2] = '\0';
|
||||
if (n < 2)
|
||||
p[1] = '\0';
|
||||
}
|
||||
ch = *p >> 2;
|
||||
ch = ENC(ch);
|
||||
if (putchar(ch) == EOF)
|
||||
|
@ -83,7 +83,7 @@ Character
|
||||
The last line may be shorter than the normal 45 bytes.
|
||||
If the size is not a multiple of 3, this fact can be determined
|
||||
by the value of the count on the last line.
|
||||
Extra garbage will be included to make the character count a multiple
|
||||
Extra null characters will be included to make the character count a multiple
|
||||
of 4.
|
||||
The body is terminated by a line with a count of zero.
|
||||
This line consists of one
|
||||
|
Loading…
Reference in New Issue
Block a user