Former-commit-id: b3334c1351bfa1c9be431a453a6b9439b3aac003
This commit is contained in:
Gerasimos (Makis) Maropoulos 2018-10-30 00:57:08 +02:00
parent be32418bc1
commit c262c5076a

View File

@ -267,7 +267,7 @@ func (e Entry) UintDefault(def uint) (uint, error) {
}
x64 := strconv.IntSize == 64
var maxValue uint = math.MaxUint32
var maxValue uint64 = math.MaxUint32
if x64 {
maxValue = math.MaxUint64
}
@ -436,7 +436,9 @@ func (e Entry) Uint32Default(def uint32) (uint32, error) {
return def, errFindParse.Format("uint32", e.Key)
}
return uint32(vv), nil
case int:
case int32:
return uint32(vv), nil
case int64:
if vv < 0 || vv > math.MaxUint32 {
return def, errFindParse.Format("uint32", e.Key)
}
@ -464,11 +466,6 @@ func (e Entry) Uint64Default(def uint64) (uint64, error) {
return def, errFindParse.Format("uint64", e.Key)
}
return uint64(val), nil
case uint:
if vv > math.MaxUint64 {
return def, errFindParse.Format("uint64", e.Key)
}
return uint64(vv), nil
case uint8:
return uint64(vv), nil
case uint16: