Skip to content

Commit

Permalink
src: remove dead code in base64_encode
Browse files Browse the repository at this point in the history
If mode == Base64Mode::NORMAL, then the function has already returned.

Refs: nodejs#39775

PR-URL: nodejs#43979
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
  • Loading branch information
tniessen authored and Fyko committed Sep 15, 2022
1 parent 63da9b7 commit 833bec2
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/base64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,13 @@ inline size_t base64_encode(const char* src,
a = src[i + 0] & 0xff;
dst[k + 0] = table[a >> 2];
dst[k + 1] = table[(a & 3) << 4];
if (mode == Base64Mode::NORMAL) {
dst[k + 2] = '=';
dst[k + 3] = '=';
}
break;
case 2:
a = src[i + 0] & 0xff;
b = src[i + 1] & 0xff;
dst[k + 0] = table[a >> 2];
dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
dst[k + 2] = table[(b & 0x0f) << 2];
if (mode == Base64Mode::NORMAL)
dst[k + 3] = '=';
break;
}

Expand Down

0 comments on commit 833bec2

Please sign in to comment.