From 7d57599b9d9c5fb48ea733596cbb812d7f84a8d6 Mon Sep 17 00:00:00 2001 From: Veselkov Konstantin Date: Sat, 15 Sep 2018 21:23:36 +0400 Subject: fixed warnings gocritic 3.3 (#192) --- png.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'png.go') diff --git a/png.go b/png.go index 854b003..15002b3 100644 --- a/png.go +++ b/png.go @@ -96,11 +96,12 @@ func (f *Fpdf) parsepngstream(buf *bytes.Buffer, readdpi bool) (info *ImageInfoT // dbg("tRNS") // Read transparency info t := buf.Next(n) - if ct == 0 { + switch ct { + case 0: trns = []int{int(t[1])} // ord(substr($t,1,1))); - } else if ct == 2 { + case 2: trns = []int{int(t[1]), int(t[3]), int(t[5])} // array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); - } else { + default: pos := strings.Index(string(t), "\x00") if pos >= 0 { trns = []int{pos} // array($pos); -- cgit v1.2.1-24-ge1ad