diff options
| author | 2025-03-09 17:47:56 +0100 | |
|---|---|---|
| committer | 2025-12-01 22:08:04 +0100 | |
| commit | b1af8fd87760b34e3ff2fd3bda38f211815a0473 (patch) | |
| tree | 9317fad1a7ec298d7a8d2678e4e422953bbc6f33 /vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go | |
| parent | [chore] update URLs to forked source (diff) | |
| download | gotosocial-b1af8fd87760b34e3ff2fd3bda38f211815a0473.tar.xz | |
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go')
| -rw-r--r-- | vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go b/vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go deleted file mode 100644 index e6abcb57d..000000000 --- a/vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build !amd64 !go1.17 go1.26 - -package rt - -import ( - "encoding/base64" -) - -func DecodeBase64(raw []byte) ([]byte, error) { - ret := make([]byte, base64.StdEncoding.DecodedLen(len(raw))) - n, err := base64.StdEncoding.Decode(ret, raw) - if err != nil { - return nil, err - } - return ret[:n], nil -} - -func EncodeBase64ToString(src []byte) string { - return base64.StdEncoding.EncodeToString(src) -} - -func EncodeBase64(buf []byte, src []byte) []byte { - if len(src) == 0 { - return append(buf, '"', '"') - } - buf = append(buf, '"') - need := base64.StdEncoding.EncodedLen(len(src)) - if cap(buf) - len(buf) < need { - tmp := make([]byte, len(buf), len(buf) + need*2) - copy(tmp, buf) - buf = tmp - } - base64.StdEncoding.Encode(buf[len(buf):cap(buf)], src) - buf = buf[:len(buf) + need] - buf = append(buf, '"') - return buf -} |
