aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 3726d9235b..15b3868cbc 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -9,8 +9,8 @@ import (
"internal/bytealg"
"internal/goarch"
"internal/runtime/math"
- "internal/runtime/strconv"
"internal/runtime/sys"
+ "internal/strconv"
"unsafe"
)
@@ -420,11 +420,11 @@ func parseByteCount(s string) (int64, bool) {
// Handle the easy non-suffix case.
last := s[len(s)-1]
if last >= '0' && last <= '9' {
- n, ok := strconv.Atoi64(s)
- if !ok || n < 0 {
+ n, err := strconv.ParseInt(s, 10, 64)
+ if err != nil || n < 0 {
return 0, false
}
- return n, ok
+ return n, true
}
// Failing a trailing digit, this must always end in 'B'.
// Also at this point there must be at least one digit before
@@ -435,11 +435,11 @@ func parseByteCount(s string) (int64, bool) {
// The one before that must always be a digit or 'i'.
if c := s[len(s)-2]; c >= '0' && c <= '9' {
// Trivial 'B' suffix.
- n, ok := strconv.Atoi64(s[:len(s)-1])
- if !ok || n < 0 {
+ n, err := strconv.ParseInt(s[:len(s)-1], 10, 64)
+ if err != nil || n < 0 {
return 0, false
}
- return n, ok
+ return n, true
} else if c != 'i' {
return 0, false
}
@@ -466,8 +466,8 @@ func parseByteCount(s string) (int64, bool) {
for i := 0; i < power; i++ {
m *= 1024
}
- n, ok := strconv.Atoi64(s[:len(s)-3])
- if !ok || n < 0 {
+ n, err := strconv.ParseInt(s[:len(s)-3], 10, 64)
+ if err != nil || n < 0 {
return 0, false
}
un := uint64(n)