]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix errcheck
authorqydysky <qydysky@foxmail.com>
Mon, 11 Nov 2024 16:52:22 +0000 (00:52 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 11 Nov 2024 16:52:22 +0000 (00:52 +0800)
Reply/flvDecode.go
Reply/flvDecode_test.go
Reply/fmp4Decode.go
Reply/fmp4Decode_test.go

index 5c1092e7ea3fa436cf0cb55d1c1cf4c51ecd829b..14270600d6ac8492a5048f1c556c2306038a8b70 100644 (file)
@@ -264,7 +264,7 @@ func (t *FlvDecoder) oneF(buf []byte, w ...io.Writer) (dropT int, dropOffset int
                        if keyframeOp >= 0 {
                                dropOffset = bufOffset
                                if len(w) > 0 {
-                                       w[0].Write(buf[keyframeOp:bufOffset])
+                                       _, err = w[0].Write(buf[keyframeOp:bufOffset])
                                }
                                return
                        }
@@ -301,7 +301,7 @@ func (t *FlvDecoder) Cut(reader io.Reader, startT, duration time.Duration, w io.
                                if len(frontBuf) == 0 {
                                        continue
                                } else {
-                                       w.Write(frontBuf)
+                                       _, err = w.Write(frontBuf)
                                }
                        }
                } else if !skiped {
index 076678c35fa86a21dda3bc738cb3c70fafa1fc00..109cd71cdd1e3b7a4b99b30e2ee408ec81e8696f 100644 (file)
@@ -51,17 +51,17 @@ func Test_FLVdeal(t *testing.T) {
        t.Log("max", humanize.Bytes(uint64(max)))
 }
 
-func _Test_FLVCut(t *testing.T) {
+func Test_FLVCut(t *testing.T) {
 
        cutf := file.New("testdata/1.cut.flv", 0, false)
        defer cutf.Close()
-       cutf.Delete()
+       _ = cutf.Delete()
 
        f := file.New("testdata/1.flv", 0, false)
        defer f.Close()
 
        if f.IsDir() || !f.IsExist() {
-               t.Fatal("file not support")
+               t.Log("test file not exist")
        }
 
        e := NewFlvDecoder().Cut(f, time.Second*10, time.Second*20, cutf.File())
index 3de55e8282685b5a086d74073cb098a25d1ef13b..69bad4cbdc1c60659c2e700f68263fad63b4bd13 100644 (file)
@@ -556,7 +556,7 @@ func (t *Fmp4Decoder) oneF(buf []byte, w ...io.Writer) (cuT float64, cu int, err
                                                cu = m[0].i
                                                cuT = video.getT()
                                                if haveKeyframe && len(w) > 0 {
-                                                       w[0].Write(t.buf.GetPureBuf())
+                                                       _, err = w[0].Write(t.buf.GetPureBuf())
                                                        return true, ErrNormal
                                                }
                                                t.buf.Reset()
@@ -654,7 +654,7 @@ func (t *Fmp4Decoder) oneF(buf []byte, w ...io.Writer) (cuT float64, cu int, err
                                                cu = m[0].i
                                                cuT = video.getT()
                                                if haveKeyframe && len(w) > 0 {
-                                                       w[0].Write(t.buf.GetPureBuf())
+                                                       _, err = w[0].Write(t.buf.GetPureBuf())
                                                        return true, ErrNormal
                                                }
                                                t.buf.Reset()
@@ -703,7 +703,7 @@ func (t *Fmp4Decoder) Cut(reader io.Reader, startT, duration time.Duration, w io
                                        continue
                                } else {
                                        init = true
-                                       w.Write(frontBuf)
+                                       _, err = w.Write(frontBuf)
                                }
                        }
                } else if !skiped {
index a5449831d0fe01b6f7977756579933bf87e19f09..32454d2607a2ed67e3b758fd7f722d312251560c 100644 (file)
@@ -63,17 +63,17 @@ func Test_deal(t *testing.T) {
        t.Log("max", humanize.Bytes(uint64(max)))
 }
 
-func _Test_Mp4Cut(t *testing.T) {
+func Test_Mp4Cut(t *testing.T) {
 
        cutf := file.New("testdata/1.cut.mp4", 0, false)
        defer cutf.Close()
-       cutf.Delete()
+       _ = cutf.Delete()
 
        f := file.New("testdata/1.mp4", 0, false)
        defer f.Close()
 
        if f.IsDir() || !f.IsExist() {
-               t.Fatal("file not support")
+               t.Log("test file not exist")
        }
 
        e := NewFmp4Decoder().Cut(f, time.Second*10, time.Second*20, cutf.File())