1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-03-22 20:21:28 +02:00

Fix build on 32-bit systems

This commit is contained in:
DarthSim 2019-08-13 17:25:54 +06:00
parent 939a4c18c3
commit bf64a48783
2 changed files with 6 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/hex"
"flag"
"fmt"
"math"
"os"
"runtime"
"strconv"
@ -461,14 +462,14 @@ func configure() {
if conf.DownloadBufferSize < 0 {
logFatal("Download buffer size should be greater than or equal to 0")
} else if conf.DownloadBufferSize > int(^uint32(0)) {
logFatal("Download buffer size can't be greater than %d", ^uint32(0))
} else if conf.DownloadBufferSize > math.MaxInt32 {
logFatal("Download buffer size can't be greater than %d", math.MaxInt32)
}
if conf.GZipBufferSize < 0 {
logFatal("GZip buffer size should be greater than or equal to 0")
} else if conf.GZipBufferSize > int(^uint32(0)) {
logFatal("GZip buffer size can't be greater than %d", ^uint32(0))
} else if conf.GZipBufferSize > math.MaxInt32 {
logFatal("GZip buffer size can't be greater than %d", math.MaxInt32)
}
if conf.BufferPoolCalibrationThreshold < 64 {

View File

@ -292,9 +292,7 @@ func (img *vipsImage) Save(imgtype imageType, quality int) ([]byte, context.Canc
return nil, cancel, vipsError()
}
const maxBufSize = ^uint32(0)
b := (*[maxBufSize]byte)(ptr)[:int(imgsize):int(imgsize)]
b := (*[math.MaxUint32]byte)(ptr)[:int(imgsize):int(imgsize)]
return b, cancel, nil
}