summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2018-01-12 14:18:00 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-01-24 08:18:50 +0900
commit549b7037381ec51d0c5b9a0abbe8f73000fda70c (patch)
tree40ed8a74f1b75990071b79e363e331887e7db51e /api/grpc_server.go
parentb391322bcbf56d623ca0a6b667c026b92f1e9e4d (diff)
*: Use strconv.ParseUint instead of strconv.Atoi()
For the 32-bit platform compatibility. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go12
1 files changed, 6 insertions, 6 deletions
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
}