From 549b7037381ec51d0c5b9a0abbe8f73000fda70c Mon Sep 17 00:00:00 2001
From: IWASE Yusuke <iwase.yusuke0@gmail.com>
Date: Fri, 12 Jan 2018 14:18:00 +0900
Subject: *: Use strconv.ParseUint instead of strconv.Atoi()

For the 32-bit platform compatibility.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
---
 api/grpc_server.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'api')

diff --git a/api/grpc_server.go b/api/grpc_server.go
index d43a0a8b..67ff7722 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -1489,8 +1489,8 @@ func (s *Server) GetDefinedSet(ctx context.Context, arg *GetDefinedSetRequest) (
 				for _, p := range cs.PrefixList {
 					exp := regexp.MustCompile("(\\d+)\\.\\.(\\d+)")
 					elems := exp.FindStringSubmatch(p.MasklengthRange)
-					min, _ := strconv.Atoi(elems[1])
-					max, _ := strconv.Atoi(elems[2])
+					min, _ := strconv.ParseUint(elems[1], 10, 32)
+					max, _ := strconv.ParseUint(elems[2], 10, 32)
 
 					l = append(l, &Prefix{IpPrefix: p.IpPrefix, MaskLengthMin: uint32(min), MaskLengthMax: uint32(max)})
 				}
@@ -1664,12 +1664,12 @@ func toStatementApi(s *config.Statement) *Statement {
 			case "+", "-":
 				action = MedActionType_MED_MOD
 			}
-			value, err := strconv.Atoi(matches[1] + matches[2])
+			value, err := strconv.ParseInt(matches[1]+matches[2], 10, 64)
 			if err != nil {
 				return nil
 			}
 			return &MedAction{
-				Value: int64(value),
+				Value: value,
 				Type:  action,
 			}
 		}(),
@@ -1677,10 +1677,10 @@ func toStatementApi(s *config.Statement) *Statement {
 			if len(s.Actions.BgpActions.SetAsPathPrepend.As) == 0 {
 				return nil
 			}
-			asn := 0
+			var asn uint64
 			useleft := false
 			if s.Actions.BgpActions.SetAsPathPrepend.As != "last-as" {
-				asn, _ = strconv.Atoi(s.Actions.BgpActions.SetAsPathPrepend.As)
+				asn, _ = strconv.ParseUint(s.Actions.BgpActions.SetAsPathPrepend.As, 10, 32)
 			} else {
 				useleft = true
 			}
-- 
cgit v1.2.3