From 8879054f49f2f3063cc98329b875ddff0e84baee Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 25 Jun 2018 22:09:27 +0200 Subject: [PATCH] go vet --- codecCtx_test.go | 2 +- dict.go | 8 +++++--- format_test.go | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/codecCtx_test.go b/codecCtx_test.go index f47f0b3..a09ff78 100644 --- a/codecCtx_test.go +++ b/codecCtx_test.go @@ -43,7 +43,7 @@ func TestCodecCtx(t *testing.T) { } if cc.TimeBase().AVR().Num != td.timebase.Num || cc.TimeBase().AVR().Den != td.timebase.Den { - t.Fatal("Expected AVR = %v, %v got", cc.TimeBase().AVR()) + t.Fatalf("Expected AVR = %v, %v got", cc.TimeBase().AVR(), td.timebase) } if cc.PixFmt() != td.pixfmt { diff --git a/dict.go b/dict.go index 4f79d6a..6f02158 100644 --- a/dict.go +++ b/dict.go @@ -4,6 +4,7 @@ package gmf #cgo pkg-config: libavutil +#include "stdlib.h" #include "libavutil/dict.h" */ @@ -11,6 +12,7 @@ import "C" import ( "log" + "unsafe" ) type Pair struct { @@ -30,11 +32,11 @@ func NewDict(pairs []Pair) *Dict { cval := C.CString(pair.Val) if ret := C.av_dict_set(&this.avDict, ckey, cval, 0); int(ret) < 0 { - log.Printf("unable to set key '%s' value '%d', error: %s\n", pair.Key, pair.Val, AvError(int(ret))) + log.Printf("unable to set key '%v' value '%v', error: %s\n", pair.Key, pair.Val, AvError(int(ret))) } - // C.free(unsafe.Pointer(ckey)) - // C.free(unsafe.Pointer(cval)) + C.free(unsafe.Pointer(ckey)) + C.free(unsafe.Pointer(cval)) } return this diff --git a/format_test.go b/format_test.go index 0fac9a0..7d6ecfa 100644 --- a/format_test.go +++ b/format_test.go @@ -213,20 +213,20 @@ func TestAVIOContext(t *testing.T) { } -func ExampleNewAVIOContext(t *testing.T) { +func ExampleNewAVIOContext() { ctx := NewCtx() defer Release(ctx) // In this example, we're using custom reader implementation, // so we should specify format manually. if err := ctx.SetInputFormat("mov"); err != nil { - t.Fatal(err) + log.Fatal(err) } avioCtx, err := NewAVIOContext(ctx, &AVIOHandlers{ReadPacket: customReader}) defer Release(avioCtx) if err != nil { - t.Fatal(err) + log.Fatal(err) } // Setting up AVFormatContext.pb