diff options
author | 2023-09-25 11:33:10 +0100 | |
---|---|---|
committer | 2023-09-25 11:33:10 +0100 | |
commit | 380d83f9a968da60419e0afbd8b37bd50ba953de (patch) | |
tree | 0fb6d3645c6620ad6c5381d1a680b412eee2e732 /vendor/github.com/abema/go-mp4/internal/util/io.go | |
parent | [bugfix] support both CollectionPage AND OrderedCollectionPage in status repl... (diff) | |
download | gotosocial-380d83f9a968da60419e0afbd8b37bd50ba953de.tar.xz |
[chore]: Bump github.com/abema/go-mp4 from 0.13.0 to 1.0.0 (#2222)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/abema/go-mp4/internal/util/io.go')
-rw-r--r-- | vendor/github.com/abema/go-mp4/internal/util/io.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/abema/go-mp4/internal/util/io.go b/vendor/github.com/abema/go-mp4/internal/util/io.go new file mode 100644 index 000000000..1e4681186 --- /dev/null +++ b/vendor/github.com/abema/go-mp4/internal/util/io.go @@ -0,0 +1,30 @@ +package util + +import ( + "bytes" + "io" +) + +func ReadString(r io.Reader) (string, error) { + b := make([]byte, 1) + buf := bytes.NewBuffer(nil) + for { + if _, err := r.Read(b); err != nil { + return "", err + } + if b[0] == 0 { + return buf.String(), nil + } + buf.Write(b) + } +} + +func WriteString(w io.Writer, s string) error { + if _, err := w.Write([]byte(s)); err != nil { + return err + } + if _, err := w.Write([]byte{0}); err != nil { + return err + } + return nil +} |