Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthSim committed Jun 4, 2019
1 parent a9244a7 commit 6959489
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions heic.go
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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])
}

Expand Down
6 changes: 3 additions & 3 deletions image_type.go
Expand Up @@ -7,9 +7,9 @@ package main
import "C"

import (
"path/filepath"
"fmt"
"net/url"
"path/filepath"
"strings"
)

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions process.go
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 6959489

Please sign in to comment.