code review for 5c15f685

This commit is contained in:
Raymond Hill 2018-03-31 19:41:59 -04:00
parent c5f870a367
commit cb060e54ee
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 3 additions and 5 deletions

View File

@ -178,15 +178,13 @@ vAPI.net.registerListeners = function() {
bufOut[iOut++] = (b1 << 4) & 0xF0 | (b2 >>> 2);
bufOut[iOut++] = (b2 << 6) & 0xC0 | b3;
}
if ( n < sizeIn ) {
if ( iIn !== sizeIn ) {
let b0 = dec[bufIn.charCodeAt(iIn++)];
let b1 = dec[bufIn.charCodeAt(iIn++)];
if ( (sizeIn & 3) === 2 ) {
bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4);
if ( iIn !== sizeIn ) {
let b2 = dec[bufIn.charCodeAt(iIn++)];
bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4);
bufOut[iOut++] = (b1 << 4) & 0xF0 | (b2 >>> 2);
} else {
bufOut[iOut++] = (b0 << 2) & 0xFC | (b1 >>> 4);
}
}
this.write(bufOut);