From 5087d9b746c7dab3ac738a4d1558f60829255f58 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 27 Apr 2020 11:20:46 -0400 Subject: Clean up decode.c --- decode.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/decode.c b/decode.c index 2604f73..8578c41 100644 --- a/decode.c +++ b/decode.c @@ -90,11 +90,6 @@ static const char Base64[64] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" }; -static uint8_t unbase64(char ch) { - const char *ptr = strchr(Base64, ch); - return (ptr ? ptr - Base64 : 0); -} - static void decodeBase64(struct Buffer *dst, const char *src) { while (src[0] && src[1] && src[2] && src[3]) { if (!strchr(Base64, src[0])) { @@ -104,7 +99,7 @@ static void decodeBase64(struct Buffer *dst, const char *src) { uint32_t bits = 0; for (int i = 0; i < 4; ++i) { bits <<= 6; - bits |= unbase64(src[i]); + bits |= strchr(Base64, src[i]) - Base64; } *bufferDest(dst, 1) = bits >> 16; if (src[2] != '=') *bufferDest(dst, 1) = bits >> 8; @@ -116,8 +111,7 @@ static void decodeBase64(struct Buffer *dst, const char *src) { static char unhex(char ch) { if (ch <= '9') return ch - '0'; if (ch <= 'F') return 0xA + ch - 'A'; - if (ch <= 'f') return 0xA + ch - 'a'; - return 0; + return 0xA + ch - 'a'; } static void decodeQ(struct Buffer *dst, const char *src) { -- cgit 1.4.1 9e16d9abc20146accb24de17090&follow=1'>diff
path: root/bin/1sh/funcs/pushd (unfollow)
Commit message (Expand)Author
2020-03-09Import /usr/src/bin/sh from FreeBSD 12.1-RELEASEJune McEnroe
2020-03-09Remove 1sh sourcesJune McEnroe
2020-03-08Add The Stone SkyJune McEnroe
2020-03-08Publish "How I Relay Chat"June McEnroe
2020-03-03Don't use $ inside $(())June McEnroe
2020-03-03Remove setoptJune McEnroe
2020-03-03Use getopts in shell scriptsJune McEnroe
2020-02-27Style %T outside of Rs in italicJune McEnroe
2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe
2020-02-23Add This Is How You Lose the Time WarJune McEnroe
2020-02-22Add See Ya LaterJune McEnroe
2020-02-20Remove wiki scriptJune McEnroe
2020-02-19Add The Obelisk GateJune McEnroe
2020-02-17Add Four Tet — HandsJune McEnroe
2020-02-12Simplify macOS notify-sendJune McEnroe
2020-02-12Add imbox and notemap to pageJune McEnroe
2020-02-12Collapse simple linksJune McEnroe
2020-02-12Move catgirl up the pageJune McEnroe
2020-02-12Update catgirl pty grabJune McEnroe
2020-02-12Link to cgit /about pages where appropriateJune McEnroe
2020-02-11Separate LINKS from BINS for html to workJune McEnroe
2020-02-11Add margin to Bl-bullet itemsJune McEnroe
2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe
2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe
2020-02-09Add To Be Taught, If FortunateJune McEnroe
2020-02-04Add The Future of Another TimelineJune McEnroe
2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe
2020-01-28Change scout sensitivity to 1.4June McEnroe
2020-01-28Import shows.txtJune McEnroe