Merged in ParseInt-to-Atoi (pull request #297)

revid/revid.go: Replaced ParseInt with Atoi

Approved-by: Saxon Milton <saxon.milton@gmail.com>
This commit is contained in:
Frank Cui 2019-12-05 09:36:42 +00:00 committed by Saxon Milton
commit 73398f96a7
1 changed files with 8 additions and 8 deletions

View File

@ -479,14 +479,14 @@ func (r *Revid) Update(vars map[string]string) error {
} }
r.cfg.Input = v r.cfg.Input = v
case "Saturation": case "Saturation":
s, err := strconv.ParseInt(value, 10, 0) s, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid saturation param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid saturation param", "value", value)
break break
} }
r.cfg.Saturation = int(s) r.cfg.Saturation = int(s)
case "Brightness": case "Brightness":
b, err := strconv.ParseUint(value, 10, 0) b, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid brightness param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid brightness param", "value", value)
break break
@ -530,7 +530,7 @@ func (r *Revid) Update(vars map[string]string) error {
case "RtpAddress": case "RtpAddress":
r.cfg.RTPAddress = value r.cfg.RTPAddress = value
case "Bitrate": case "Bitrate":
v, err := strconv.ParseUint(value, 10, 0) v, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid framerate param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid framerate param", "value", value)
break break
@ -541,28 +541,28 @@ func (r *Revid) Update(vars map[string]string) error {
case "InputPath": case "InputPath":
r.cfg.InputPath = value r.cfg.InputPath = value
case "Height": case "Height":
h, err := strconv.ParseUint(value, 10, 0) h, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid height param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid height param", "value", value)
break break
} }
r.cfg.Height = uint(h) r.cfg.Height = uint(h)
case "Width": case "Width":
w, err := strconv.ParseUint(value, 10, 0) w, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid width param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid width param", "value", value)
break break
} }
r.cfg.Width = uint(w) r.cfg.Width = uint(w)
case "FrameRate": case "FrameRate":
v, err := strconv.ParseUint(value, 10, 0) v, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid framerate param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid framerate param", "value", value)
break break
} }
r.cfg.FrameRate = uint(v) r.cfg.FrameRate = uint(v)
case "Rotation": case "Rotation":
v, err := strconv.ParseUint(value, 10, 0) v, err := strconv.Atoi(value)
if err != nil || v > 359 { if err != nil || v > 359 {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid rotation param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid rotation param", "value", value)
break break
@ -612,7 +612,7 @@ func (r *Revid) Update(vars map[string]string) error {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
} }
case "BurstPeriod": case "BurstPeriod":
v, err := strconv.ParseUint(value, 10, 0) v, err := strconv.Atoi(value)
if err != nil { if err != nil {
r.cfg.Logger.Log(logger.Warning, pkg+"invalid BurstPeriod param", "value", value) r.cfg.Logger.Log(logger.Warning, pkg+"invalid BurstPeriod param", "value", value)
break break