1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-10-30 23:08:02 +02:00

Fix lint issues

This commit is contained in:
DarthSim
2019-06-04 17:03:03 +06:00
parent a9244a7063
commit 69594894a0
3 changed files with 7 additions and 9 deletions

View File

@@ -52,13 +52,13 @@ func heifReadFtyp(r io.Reader, boxDataSize int64) error {
return err
}
if bytes.Compare(data[0:4], heicBrand) == 0 {
if bytes.Equal(data[0:4], heicBrand) {
return nil
}
if boxDataSize >= 12 {
for i := int64(8); i < boxDataSize; i += 4 {
if bytes.Compare(data[i:i+4], heicBrand) == 0 {
if bytes.Equal(data[i:i+4], heicBrand) {
return nil
}
}
@@ -95,7 +95,7 @@ func heifReadHldr(r io.Reader, boxDataSize int64) error {
return err
}
if bytes.Compare(data[8:12], heicPict) != 0 {
if !bytes.Equal(data[8:12], heicPict) {
return fmt.Errorf("Invalid handler. Expected: pict, actual: %s", data[8:12])
}

View File

@@ -7,9 +7,9 @@ package main
import "C"
import (
"path/filepath"
"fmt"
"net/url"
"path/filepath"
"strings"
)
@@ -71,9 +71,9 @@ func (it imageType) String() string {
func (it imageType) Mime() string {
if mime, ok := mimes[it]; ok {
return mime
} else {
return "application/octet-stream"
}
return "application/octet-stream"
}
func (it imageType) ContentDisposition(imageURL string) string {

View File

@@ -481,14 +481,13 @@ func transformImage(ctx context.Context, img **C.VipsImage, data []byte, po *pro
func transformAnimated(ctx context.Context, img **C.VipsImage, data []byte, po *processingOptions, imgtype imageType) error {
imgWidth := int((*img).Xsize)
imgHeight := int((*img).Ysize)
frameHeight, err := vipsGetInt(*img, "page-height")
if err != nil {
return err
}
framesCount := minInt(imgHeight/frameHeight, conf.MaxGifFrames)
framesCount := minInt(int((*img).Ysize)/frameHeight, conf.MaxGifFrames)
// Double check dimensions because animated image has many frames
if err := checkDimensions(imgWidth, frameHeight*framesCount); err != nil {
@@ -509,7 +508,6 @@ func transformAnimated(ctx context.Context, img **C.VipsImage, data []byte, po *
}
imgWidth = int((*img).Xsize)
imgHeight = int((*img).Ysize)
frameHeight, err = vipsGetInt(*img, "page-height")
if err != nil {