]> Cypherpunks repositories - gostls13.git/commitdiff
use new strconv API
authorRuss Cox <rsc@golang.org>
Mon, 5 Dec 2011 20:48:46 +0000 (15:48 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 5 Dec 2011 20:48:46 +0000 (15:48 -0500)
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069

57 files changed:
doc/talks/io2010/eval1.go
doc/talks/io2010/eval2.go
misc/cgo/stdio/fib.go
misc/dashboard/builder/http.go
src/cmd/cgo/gcc.go
src/cmd/goinstall/download.go
src/cmd/gotest/flag.go
src/pkg/archive/tar/reader.go
src/pkg/archive/tar/writer.go
src/pkg/compress/flate/huffman_bit_writer.go
src/pkg/compress/flate/inflate.go
src/pkg/crypto/openpgp/write.go
src/pkg/crypto/tls/handshake_server_test.go
src/pkg/debug/dwarf/buf.go
src/pkg/debug/dwarf/const.go
src/pkg/debug/dwarf/type.go
src/pkg/debug/elf/elf.go
src/pkg/debug/macho/macho.go
src/pkg/encoding/ascii85/ascii85.go
src/pkg/encoding/asn1/common.go
src/pkg/encoding/base32/base32.go
src/pkg/encoding/base64/base64.go
src/pkg/encoding/git85/git.go
src/pkg/encoding/json/decode.go
src/pkg/encoding/json/encode.go
src/pkg/encoding/xml/marshal.go
src/pkg/encoding/xml/read.go
src/pkg/encoding/xml/xml.go
src/pkg/exp/norm/maketables.go
src/pkg/exp/norm/normregtest.go
src/pkg/exp/sql/convert.go
src/pkg/exp/sql/driver/types.go
src/pkg/exp/types/gcimporter.go
src/pkg/expvar/expvar.go
src/pkg/flag/flag.go
src/pkg/fmt/format.go
src/pkg/fmt/scan.go
src/pkg/html/template/css_test.go
src/pkg/image/png/writer.go
src/pkg/net/http/cgi/child.go
src/pkg/net/http/chunked.go
src/pkg/net/http/fs.go
src/pkg/net/http/httputil/chunked.go
src/pkg/net/http/pprof/pprof.go
src/pkg/net/http/server.go
src/pkg/net/http/transfer.go
src/pkg/net/mail/message.go
src/pkg/old/template/parse.go
src/pkg/reflect/tostring_test.go
src/pkg/regexp/syntax/prog.go
src/pkg/regexp/syntax/regexp.go
src/pkg/text/template/parse/node.go
src/pkg/time/time_test.go
src/pkg/unicode/maketables.go
src/pkg/websocket/hixie.go
test/fixedbugs/bug120.go
test/fixedbugs/bug260.go

index 2d7fc3be6c4fed6320a2d549e8bff58d1ccfe642..582f43e8ea2e5f6b0bf3d86feacbfc30a439c3db 100644 (file)
@@ -101,7 +101,6 @@ func main() {
        }
 }
 
-
 // Custom grammar and values
 
 var precTab = map[string]int{
@@ -125,7 +124,7 @@ func newVal(lit string) Value {
        if err == nil {
                return Int(x)
        }
-       b, err := strconv.Atob(lit)
+       b, err := strconv.ParseBool(lit)
        if err == nil {
                return Bool(b)
        }
@@ -175,7 +174,7 @@ func (x Int) BinaryOp(op string, y Value) Value {
 
 type Bool bool
 
-func (x Bool) String() string { return strconv.Btoa(bool(x)) }
+func (x Bool) String() string { return strconv.FormatBool(bool(x)) }
 func (x Bool) BinaryOp(op string, y Value) Value {
        switch y := y.(type) {
        case Error:
@@ -195,7 +194,6 @@ func (x Bool) BinaryOp(op string, y Value) Value {
        return Error(fmt.Sprintf("illegal operation: '%v %s %v'", x, op, y))
 }
 
-
 func trace(newVal func(string) Value) func(string) Value {
        return func(s string) Value {
                v := newVal(s)
index 5524c8b3aa9c2fe40069e1839934f3b5c3c69b0a..6f826e12d09078837fcfce9c93b86e2fce717227 100644 (file)
@@ -101,7 +101,6 @@ func main() {
        }
 }
 
-
 // Custom grammar and values
 
 var precTab = map[string]int{
@@ -125,7 +124,7 @@ func newVal(lit string) Value {
        if err == nil {
                return Int(x)
        }
-       b, err := strconv.Atob(lit)
+       b, err := strconv.ParseBool(lit)
        if err == nil {
                return Bool(b)
        }
@@ -184,7 +183,7 @@ func (x Int) BinaryOp(op string, y Value) Value {
 
 type Bool bool
 
-func (x Bool) String() string { return strconv.Btoa(bool(x)) }
+func (x Bool) String() string { return strconv.FormatBool(bool(x)) }
 func (x Bool) BinaryOp(op string, y Value) Value {
        switch y := y.(type) {
        case Error:
@@ -227,7 +226,6 @@ func (x String) BinaryOp(op string, y Value) Value {
        return Error(fmt.Sprintf("illegal operation: '%v %s %v'", x, op, y))
 }
 
-
 func trace(newVal func(string) Value) func(string) Value {
        return func(s string) Value {
                v := newVal(s)
index c02e31fd8d8b7dd1134cc58b4b277c604f46aded..431d9cefee7c7df1e39faf0ed890d9f6d5acc011 100644 (file)
@@ -26,7 +26,7 @@ func fibber(c, out chan int64, i int64) {
        }
        for {
                j := <-c
-               stdio.Stdout.WriteString(strconv.Itoa64(j) + "\n")
+               stdio.Stdout.WriteString(strconv.FormatInt(j, 10) + "\n")
                out <- j
                <-out
                i += j
index 9de54a36947d25373a9e85c7704783635b8e819d..0f26059948a95e2c41efaf16da572ce1cb25d0b1 100644 (file)
@@ -134,7 +134,7 @@ func (b *Builder) updatePackage(pkg string, ok bool, buildLog, info string) erro
                "builder": b.name,
                "key":     b.key,
                "path":    pkg,
-               "ok":      strconv.Btoa(ok),
+               "ok":      strconv.FormatBool(ok),
                "log":     buildLog,
                "info":    info,
        })
index 20cac1944b7e06e864fe531309d5989ccf824e70..646857419d4adab0f6d9d233f325057aeec38120 100644 (file)
@@ -355,7 +355,7 @@ func (p *Package) guessKinds(f *File) []*Name {
                                // with enum-derived constants.  Otherwise
                                // in the cgo -godefs output half the constants
                                // are in hex and half are in whatever the #define used.
-                               i, err := strconv.Btoi64(n.Define, 0)
+                               i, err := strconv.ParseInt(n.Define, 0, 64)
                                if err == nil {
                                        n.Const = fmt.Sprintf("%#x", i)
                                } else {
@@ -1333,7 +1333,7 @@ func (c *typeConv) Opaque(n int64) ast.Expr {
 func (c *typeConv) intExpr(n int64) ast.Expr {
        return &ast.BasicLit{
                Kind:  token.INT,
-               Value: strconv.Itoa64(n),
+               Value: strconv.FormatInt(n, 10),
        }
 }
 
index 7c5382a3c44f367810ea96877fe12c5146e855d1..2147e62f08f90b89a2dffecdf6e6c5e1ed0f6112 100644 (file)
@@ -489,7 +489,7 @@ func selectTag(goVersion string, tags []string) (match string) {
        const rPrefix = "release.r"
        if strings.HasPrefix(goVersion, rPrefix) {
                p := "go.r"
-               v, err := strconv.Atof64(goVersion[len(rPrefix):])
+               v, err := strconv.ParseFloat(goVersion[len(rPrefix):], 64)
                if err != nil {
                        return ""
                }
@@ -498,7 +498,7 @@ func selectTag(goVersion string, tags []string) (match string) {
                        if !strings.HasPrefix(t, p) {
                                continue
                        }
-                       tf, err := strconv.Atof64(t[len(p):])
+                       tf, err := strconv.ParseFloat(t[len(p):], 64)
                        if err != nil {
                                continue
                        }
index 0e7c619df4228f8653e959279b4e5732f41d6df0..b0b0cae5cc9f856cd57ea3a51f3f7416af32259c 100644 (file)
@@ -156,7 +156,7 @@ func flag(i int) (f *flagSpec, value string, extra bool) {
 
 // setBoolFlag sets the addressed boolean to the value.
 func setBoolFlag(flag *bool, value string) {
-       x, err := strconv.Atob(value)
+       x, err := strconv.ParseBool(value)
        if err != nil {
                fmt.Fprintf(os.Stderr, "gotest: illegal bool flag value %s\n", value)
                usage()
index 76955e2ec03af9e04758014404799627a3a4f925..13fe2700f9bf1603b80fe40c2dc91b32cbbbc4cd 100644 (file)
@@ -80,7 +80,7 @@ func (tr *Reader) octal(b []byte) int64 {
        for len(b) > 0 && (b[len(b)-1] == ' ' || b[len(b)-1] == '\x00') {
                b = b[0 : len(b)-1]
        }
-       x, err := strconv.Btoui64(cString(b), 8)
+       x, err := strconv.ParseUint(cString(b), 8, 64)
        if err != nil {
                tr.err = err
        }
index b9310b3f189dc080833d367727a96de97ecfdfe0..d35726bf9d83ba93d2ffb8f8ffa91b02d31e2d76 100644 (file)
@@ -79,7 +79,7 @@ func (tw *Writer) cString(b []byte, s string) {
 
 // Encode x as an octal ASCII string and write it into b with leading zeros.
 func (tw *Writer) octal(b []byte, x int64) {
-       s := strconv.Itob64(x, 8)
+       s := strconv.FormatInt(x, 8)
        // leading zeros, but leave room for a NUL.
        for len(s)+1 < len(b) {
                s = "0" + s
@@ -90,7 +90,7 @@ func (tw *Writer) octal(b []byte, x int64) {
 // Write x into b, either as octal or as binary (GNUtar/star extension).
 func (tw *Writer) numeric(b []byte, x int64) {
        // Try octal first.
-       s := strconv.Itob64(x, 8)
+       s := strconv.FormatInt(x, 8)
        if len(s) < len(b) {
                tw.octal(b, x)
                return
index efd99c6b954350b9bcba3646fc2b2484a492f462..8d0b4f9c1e8d8f3f1757cba9d1daee6085b3be3d 100644 (file)
@@ -106,8 +106,8 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
 }
 
 func (err WrongValueError) Error() string {
-       return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.Itoa64(int64(err.from)) + ";" +
-               strconv.Itoa64(int64(err.to)) + "] but actual value is " + strconv.Itoa64(int64(err.value))
+       return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.FormatInt(int64(err.from), 10) + ";" +
+               strconv.FormatInt(int64(err.to), 10) + "] but actual value is " + strconv.FormatInt(int64(err.value), 10)
 }
 
 func (w *huffmanBitWriter) flushBits() {
index 3f0c94864a4c1d3f667d1ab9e14a38013321b8eb..3f2042bfe92fd9f90addc256f7512c338ddcd6bb 100644 (file)
@@ -25,7 +25,7 @@ const (
 type CorruptInputError int64
 
 func (e CorruptInputError) Error() string {
-       return "flate: corrupt input before offset " + strconv.Itoa64(int64(e))
+       return "flate: corrupt input before offset " + strconv.FormatInt(int64(e), 10)
 }
 
 // An InternalError reports an error in the flate code itself.
@@ -40,7 +40,7 @@ type ReadError struct {
 }
 
 func (e *ReadError) Error() string {
-       return "flate: read error at offset " + strconv.Itoa64(e.Offset) + ": " + e.Err.Error()
+       return "flate: read error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error()
 }
 
 // A WriteError reports an error encountered while writing output.
@@ -50,7 +50,7 @@ type WriteError struct {
 }
 
 func (e *WriteError) Error() string {
-       return "flate: write error at offset " + strconv.Itoa64(e.Offset) + ": " + e.Err.Error()
+       return "flate: write error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error()
 }
 
 // Huffman decoder is based on
index 60dae01e64b2fa6da49942c3534b45f84f6674ef..bdee57d767c4977e225ae960cdd98b43530bdd42 100644 (file)
@@ -183,7 +183,7 @@ func Encrypt(ciphertext io.Writer, to []*Entity, signed *Entity, hints *FileHint
        for i := range to {
                encryptKeys[i] = to[i].encryptionKey()
                if encryptKeys[i].PublicKey == nil {
-                       return nil, error_.InvalidArgumentError("cannot encrypt a message to key id " + strconv.Uitob64(to[i].PrimaryKey.KeyId, 16) + " because it has no encryption keys")
+                       return nil, error_.InvalidArgumentError("cannot encrypt a message to key id " + strconv.FormatUint(to[i].PrimaryKey.KeyId, 16) + " because it has no encryption keys")
                }
 
                sig := to[i].primaryIdentity().SelfSignature
index e00c32c5508371645d710daddc831a95841a1ce3..d98e13decf677596ee8bcf77c2a75ad533ef9922 100644 (file)
@@ -159,7 +159,7 @@ func TestHandshakeServerSSLv3(t *testing.T) {
 
 var serve = flag.Bool("serve", false, "run a TLS server on :10443")
 var testCipherSuites = flag.String("ciphersuites",
-       "0x"+strconv.Itob(int(TLS_RSA_WITH_RC4_128_SHA), 16),
+       "0x"+strconv.FormatInt(int64(TLS_RSA_WITH_RC4_128_SHA), 16),
        "cipher suites to accept in serving mode")
 
 func TestRunServer(t *testing.T) {
@@ -170,7 +170,7 @@ func TestRunServer(t *testing.T) {
        suites := strings.Split(*testCipherSuites, ",")
        testConfig.CipherSuites = make([]uint16, len(suites))
        for i := range suites {
-               suite, err := strconv.Btoui64(suites[i], 0)
+               suite, err := strconv.ParseUint(suites[i], 0, 64)
                if err != nil {
                        panic(err)
                }
index 6b4af7d53dcb8ef0e006a69fe8032c3e868c7c5a..6dc28d2568c39ba5dac17eb2bb1387e1b6844168 100644 (file)
@@ -149,5 +149,5 @@ type DecodeError struct {
 }
 
 func (e DecodeError) Error() string {
-       return "decoding dwarf section " + e.Name + " at offset 0x" + strconv.Itob64(int64(e.Offset), 16) + ": " + e.Err
+       return "decoding dwarf section " + e.Name + " at offset 0x" + strconv.FormatInt(int64(e.Offset), 16) + ": " + e.Err
 }
index 1a3fec155c2e08d37340e33ae8cf980e53a02c20..918b153d07895d3c551bfe5a26c3e793a3c380e7 100644 (file)
@@ -178,7 +178,7 @@ func (a Attr) GoString() string {
                        return "dwarf.Attr" + s
                }
        }
-       return "dwarf.Attr(" + strconv.Itoa64(int64(a)) + ")"
+       return "dwarf.Attr(" + strconv.FormatInt(int64(a), 10) + ")"
 }
 
 // A format is a DWARF data encoding format.
@@ -347,7 +347,7 @@ func (t Tag) GoString() string {
                        return "dwarf.Tag" + s
                }
        }
-       return "dwarf.Tag(" + strconv.Itoa64(int64(t)) + ")"
+       return "dwarf.Tag(" + strconv.FormatInt(int64(t), 10) + ")"
 }
 
 // Location expression operators.
index e8ce8d57b8c93019e62431bf783c2fc5d096c6d3..9be66658fe9fa0242e69fca787284bbd6c255f14 100644 (file)
@@ -110,7 +110,7 @@ type ArrayType struct {
 }
 
 func (t *ArrayType) String() string {
-       return "[" + strconv.Itoa64(t.Count) + "]" + t.Type.String()
+       return "[" + strconv.FormatInt(t.Count, 10) + "]" + t.Type.String()
 }
 
 func (t *ArrayType) Size() int64 { return t.Count * t.Type.Size() }
@@ -171,10 +171,10 @@ func (t *StructType) Defn() string {
                        s += "; "
                }
                s += f.Name + " " + f.Type.String()
-               s += "@" + strconv.Itoa64(f.ByteOffset)
+               s += "@" + strconv.FormatInt(f.ByteOffset, 10)
                if f.BitSize > 0 {
-                       s += " : " + strconv.Itoa64(f.BitSize)
-                       s += "@" + strconv.Itoa64(f.BitOffset)
+                       s += " : " + strconv.FormatInt(f.BitSize, 10)
+                       s += "@" + strconv.FormatInt(f.BitOffset, 10)
                }
        }
        s += "}"
@@ -206,7 +206,7 @@ func (t *EnumType) String() string {
                if i > 0 {
                        s += "; "
                }
-               s += v.Name + "=" + strconv.Itoa64(v.Val)
+               s += v.Name + "=" + strconv.FormatInt(v.Val, 10)
        }
        s += "}"
        return s
index c71b230bd95e9c63739fb8ad782fda0774553f42..03e42b034657c049cb52fcac5cfdea96d547b68e 100644 (file)
@@ -1490,11 +1490,11 @@ func stringName(i uint32, names []intName, goSyntax bool) string {
                        if goSyntax {
                                s = "elf." + s
                        }
-                       return s + "+" + strconv.Uitoa64(uint64(i-n.i))
+                       return s + "+" + strconv.FormatUint(uint64(i-n.i), 10)
                }
        }
 
-       return strconv.Uitoa64(uint64(i))
+       return strconv.FormatUint(uint64(i), 10)
 }
 
 func flagName(i uint32, names []intName, goSyntax bool) string {
@@ -1512,10 +1512,10 @@ func flagName(i uint32, names []intName, goSyntax bool) string {
                }
        }
        if len(s) == 0 {
-               return "0x" + strconv.Uitob64(uint64(i), 16)
+               return "0x" + strconv.FormatUint(uint64(i), 16)
        }
        if i != 0 {
-               s += "+0x" + strconv.Uitob64(uint64(i), 16)
+               s += "+0x" + strconv.FormatUint(uint64(i), 16)
        }
        return s
 }
index 1386f5acf571fe48fab83365df04a25a1140a284..bc14226c565a0c8045d8dcd68f95a4f5dd21b55a 100644 (file)
@@ -278,7 +278,7 @@ func stringName(i uint32, names []intName, goSyntax bool) string {
                        return n.s
                }
        }
-       return strconv.Uitoa64(uint64(i))
+       return strconv.FormatUint(uint64(i), 10)
 }
 
 func flagName(i uint32, names []intName, goSyntax bool) string {
@@ -296,10 +296,10 @@ func flagName(i uint32, names []intName, goSyntax bool) string {
                }
        }
        if len(s) == 0 {
-               return "0x" + strconv.Uitob64(uint64(i), 16)
+               return "0x" + strconv.FormatUint(uint64(i), 16)
        }
        if i != 0 {
-               s += "+0x" + strconv.Uitob64(uint64(i), 16)
+               s += "+0x" + strconv.FormatUint(uint64(i), 16)
        }
        return s
 }
index 6f592f3d727764b75459dd92afc37cee5ab6c845..7d004b5e5d74eb0c73d86de59770edf1c58d207d 100644 (file)
@@ -168,7 +168,7 @@ func (e *encoder) Close() error {
 type CorruptInputError int64
 
 func (e CorruptInputError) Error() string {
-       return "illegal ascii85 data at input byte " + strconv.Itoa64(int64(e))
+       return "illegal ascii85 data at input byte " + strconv.FormatInt(int64(e), 10)
 }
 
 // Decode decodes src into dst, returning both the number
index 01f4f7b6ec7a6519caf9dd508685a4484a0fdf46..f7cb3acbb8693b919389caa74ba66565264c8b3b 100644 (file)
@@ -98,7 +98,7 @@ func parseFieldParameters(str string) (ret fieldParameters) {
                case part == "printable":
                        ret.stringType = tagPrintableString
                case strings.HasPrefix(part, "default:"):
-                       i, err := strconv.Atoi64(part[8:])
+                       i, err := strconv.ParseInt(part[8:], 10, 64)
                        if err == nil {
                                ret.defaultValue = new(int64)
                                *ret.defaultValue = i
index 494c760d87dbaa6605552af935692c2f37bda3b4..c75c7c19d15d15dccb74536bec4420a3e1b6c614 100644 (file)
@@ -216,7 +216,7 @@ func (enc *Encoding) EncodedLen(n int) int { return (n + 4) / 5 * 8 }
 type CorruptInputError int64
 
 func (e CorruptInputError) Error() string {
-       return "illegal base32 data at input byte " + strconv.Itoa64(int64(e))
+       return "illegal base32 data at input byte " + strconv.FormatInt(int64(e), 10)
 }
 
 // decode is like Decode but returns an additional 'end' value, which
index 945128947ab268be68822c73999be9f974741b45..889b565e3f5a475b6c86672b5af6184c030c2c4c 100644 (file)
@@ -203,7 +203,7 @@ func (enc *Encoding) EncodedLen(n int) int { return (n + 2) / 3 * 4 }
 type CorruptInputError int64
 
 func (e CorruptInputError) Error() string {
-       return "illegal base64 data at input byte " + strconv.Itoa64(int64(e))
+       return "illegal base64 data at input byte " + strconv.FormatInt(int64(e), 10)
 }
 
 // decode is like Decode but returns an additional 'end' value, which
index b6ad6e2dd3845cebdcf777fd49fbbca47a9789f2..d383213ce8734084ace0e94f13a117a754a256ea 100644 (file)
@@ -15,7 +15,7 @@ import (
 type CorruptInputError int64
 
 func (e CorruptInputError) Error() string {
-       return "illegal git85 data at input byte " + strconv.Itoa64(int64(e))
+       return "illegal git85 data at input byte " + strconv.FormatInt(int64(e), 10)
 }
 
 const encode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"
index 2ea06c50c277985e216ed2eac3d73d498f71ffa4..0a700926296fe9f37c3099e35f0b19512f3aa96b 100644 (file)
@@ -642,7 +642,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value) {
                default:
                        d.error(&UnmarshalTypeError{"number", v.Type()})
                case reflect.Interface:
-                       n, err := strconv.Atof64(s)
+                       n, err := strconv.ParseFloat(s, 64)
                        if err != nil {
                                d.saveError(&UnmarshalTypeError{"number " + s, v.Type()})
                                break
@@ -650,7 +650,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value) {
                        v.Set(reflect.ValueOf(n))
 
                case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-                       n, err := strconv.Atoi64(s)
+                       n, err := strconv.ParseInt(s, 10, 64)
                        if err != nil || v.OverflowInt(n) {
                                d.saveError(&UnmarshalTypeError{"number " + s, v.Type()})
                                break
@@ -658,7 +658,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value) {
                        v.SetInt(n)
 
                case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-                       n, err := strconv.Atoui64(s)
+                       n, err := strconv.ParseUint(s, 10, 64)
                        if err != nil || v.OverflowUint(n) {
                                d.saveError(&UnmarshalTypeError{"number " + s, v.Type()})
                                break
@@ -666,7 +666,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value) {
                        v.SetUint(n)
 
                case reflect.Float32, reflect.Float64:
-                       n, err := strconv.AtofN(s, v.Type().Bits())
+                       n, err := strconv.ParseFloat(s, v.Type().Bits())
                        if err != nil || v.OverflowFloat(n) {
                                d.saveError(&UnmarshalTypeError{"number " + s, v.Type()})
                                break
@@ -798,7 +798,7 @@ func (d *decodeState) literalInterface() interface{} {
                if c != '-' && (c < '0' || c > '9') {
                        d.error(errPhase)
                }
-               n, err := strconv.Atof64(string(item))
+               n, err := strconv.ParseFloat(string(item), 64)
                if err != nil {
                        d.saveError(&UnmarshalTypeError{"number " + string(item), reflect.TypeOf(0.0)})
                }
@@ -813,7 +813,7 @@ func getu4(s []byte) rune {
        if len(s) < 6 || s[0] != '\\' || s[1] != 'u' {
                return -1
        }
-       r, err := strconv.Btoui64(string(s[2:6]), 16)
+       r, err := strconv.ParseUint(string(s[2:6]), 16, 64)
        if err != nil {
                return -1
        }
index 14284f50e47b5bf7f47a505f6a0e7c62269645d8..69deaf2a40d3ee0458abb0c70e40853b9a571521 100644 (file)
@@ -275,13 +275,13 @@ func (e *encodeState) reflectValueQuoted(v reflect.Value, quoted bool) {
                }
 
        case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-               writeString(e, strconv.Itoa64(v.Int()))
+               writeString(e, strconv.FormatInt(v.Int(), 10))
 
        case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-               writeString(e, strconv.Uitoa64(v.Uint()))
+               writeString(e, strconv.FormatUint(v.Uint(), 10))
 
        case reflect.Float32, reflect.Float64:
-               writeString(e, strconv.FtoaN(v.Float(), 'g', -1, v.Type().Bits()))
+               writeString(e, strconv.FormatFloat(v.Float(), 'g', -1, v.Type().Bits()))
 
        case reflect.String:
                if quoted {
index 691b70d2510e8fa83c80b7c3795a8aeb4c2c8983..e94fdbc531f29f0f43025279df7e34175cd45e85 100644 (file)
@@ -173,15 +173,15 @@ func (p *printer) marshalValue(val reflect.Value, name string) error {
 
        switch k := val.Kind(); k {
        case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
-               p.WriteString(strconv.Itoa64(val.Int()))
+               p.WriteString(strconv.FormatInt(val.Int(), 10))
        case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
-               p.WriteString(strconv.Uitoa64(val.Uint()))
+               p.WriteString(strconv.FormatUint(val.Uint(), 10))
        case reflect.Float32, reflect.Float64:
-               p.WriteString(strconv.Ftoa64(val.Float(), 'g', -1))
+               p.WriteString(strconv.FormatFloat(val.Float(), 'g', -1, 64))
        case reflect.String:
                Escape(p, []byte(val.String()))
        case reflect.Bool:
-               p.WriteString(strconv.Btoa(val.Bool()))
+               p.WriteString(strconv.FormatBool(val.Bool()))
        case reflect.Array:
                // will be [...]byte
                bytes := make([]byte, val.Len())
index c6a3d75a8019432a99359806233c5a3b77104754..6dd36541000820c0ec16aeec89ac3a21864fc3cd 100644 (file)
@@ -486,19 +486,19 @@ func copyValue(dst reflect.Value, src []byte) (err error) {
        // Helper functions for integer and unsigned integer conversions
        var itmp int64
        getInt64 := func() bool {
-               itmp, err = strconv.Atoi64(string(src))
+               itmp, err = strconv.ParseInt(string(src), 10, 64)
                // TODO: should check sizes
                return err == nil
        }
        var utmp uint64
        getUint64 := func() bool {
-               utmp, err = strconv.Atoui64(string(src))
+               utmp, err = strconv.ParseUint(string(src), 10, 64)
                // TODO: check for overflow?
                return err == nil
        }
        var ftmp float64
        getFloat64 := func() bool {
-               ftmp, err = strconv.Atof64(string(src))
+               ftmp, err = strconv.ParseFloat(string(src), 64)
                // TODO: check for overflow?
                return err == nil
        }
@@ -525,7 +525,7 @@ func copyValue(dst reflect.Value, src []byte) (err error) {
                }
                t.SetFloat(ftmp)
        case reflect.Bool:
-               value, err := strconv.Atob(strings.TrimSpace(string(src)))
+               value, err := strconv.ParseBool(strings.TrimSpace(string(src)))
                if err != nil {
                        return err
                }
index d67a299f5bb657e87c58b366efac3aef8d407e8c..d001c4089236aad6156c4193a3e920f51d6c8b96 100644 (file)
@@ -889,9 +889,9 @@ Input:
                                var n uint64
                                var err error
                                if i >= 3 && s[1] == 'x' {
-                                       n, err = strconv.Btoui64(s[2:], 16)
+                                       n, err = strconv.ParseUint(s[2:], 16, 64)
                                } else {
-                                       n, err = strconv.Btoui64(s[1:], 10)
+                                       n, err = strconv.ParseUint(s[1:], 10, 64)
                                }
                                if err == nil && n <= unicode.MaxRune {
                                        text = string(n)
index 39bab7f0b6a80ea33582af8b782c80ccf0981ad4..9a97831716b473067fbfaab95876bd9822cc3d27 100644 (file)
@@ -226,7 +226,7 @@ func parseDecomposition(s string, skipfirst bool) (a []rune, e error) {
                decomp = decomp[1:]
        }
        for _, d := range decomp {
-               point, err := strconv.Btoui64(d, 16)
+               point, err := strconv.ParseUint(d, 16, 64)
                if err != nil {
                        return a, err
                }
@@ -240,7 +240,7 @@ func parseCharacter(line string) {
        if len(field) != NumField {
                logger.Fatalf("%5s: %d fields (expected %d)\n", line, len(field), NumField)
        }
-       x, err := strconv.Btoui64(field[FCodePoint], 16)
+       x, err := strconv.ParseUint(field[FCodePoint], 16, 64)
        point := int(x)
        if err != nil {
                logger.Fatalf("%.5s...: %s", line, err)
@@ -264,7 +264,7 @@ func parseCharacter(line string) {
        if state != SLast {
                firstChar = lastChar
        }
-       x, err = strconv.Atoui64(field[FCanonicalCombiningClass])
+       x, err = strconv.ParseUint(field[FCanonicalCombiningClass], 10, 64)
        if err != nil {
                logger.Fatalf("%U: bad ccc field: %s", int(x), err)
        }
@@ -336,7 +336,7 @@ func parseExclusion(line string) int {
        if len(matches) != 2 {
                logger.Fatalf("%s: %d matches (expected 1)\n", line, len(matches))
        }
-       point, err := strconv.Btoui64(matches[1], 16)
+       point, err := strconv.ParseUint(matches[1], 16, 64)
        if err != nil {
                logger.Fatalf("%.5s...: %s", line, err)
        }
@@ -792,13 +792,13 @@ func testDerived() {
                        continue
                }
                rng := strings.Split(qc[1], "..")
-               i, err := strconv.Btoui64(rng[0], 16)
+               i, err := strconv.ParseUint(rng[0], 16, 64)
                if err != nil {
                        log.Fatal(err)
                }
                j := i
                if len(rng) > 1 {
-                       j, err = strconv.Btoui64(rng[1], 16)
+                       j, err = strconv.ParseUint(rng[1], 16, 64)
                        if err != nil {
                                log.Fatal(err)
                        }
index 6610c257e512617dfb9bb59be8839730af066418..d214ce11bc2b02a4534f75d8e4b64fa9f9c0b009 100644 (file)
@@ -171,7 +171,7 @@ func loadTestData() {
                counter++
                for j := 1; j < len(m)-1; j++ {
                        for _, split := range strings.Split(m[j], " ") {
-                               r, err := strconv.Btoui64(split, 16)
+                               r, err := strconv.ParseUint(split, 16, 64)
                                if err != nil {
                                        logger.Fatal(err)
                                }
index 48e281203bead02bd2f197a330c9a0528bd81090..24315a0d35136beefa1781d3c817f4fa560e531f 100644 (file)
@@ -95,7 +95,7 @@ func convertAssign(dest, src interface{}) error {
        switch dv.Kind() {
        case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
                s := asString(src)
-               i64, err := strconv.Atoi64(s)
+               i64, err := strconv.ParseInt(s, 10, 64)
                if err != nil {
                        return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err)
                }
@@ -106,7 +106,7 @@ func convertAssign(dest, src interface{}) error {
                return nil
        case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
                s := asString(src)
-               u64, err := strconv.Atoui64(s)
+               u64, err := strconv.ParseUint(s, 10, 64)
                if err != nil {
                        return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err)
                }
@@ -117,7 +117,7 @@ func convertAssign(dest, src interface{}) error {
                return nil
        case reflect.Float32, reflect.Float64:
                s := asString(src)
-               f64, err := strconv.Atof64(s)
+               f64, err := strconv.ParseFloat(s, 64)
                if err != nil {
                        return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err)
                }
index 6e0ce4339cc86faae5ac60d83616f7a13a05e7a6..086b529c84f1d74525ea891e6314f2039e41a5eb 100644 (file)
@@ -54,13 +54,13 @@ func (boolType) ConvertValue(src interface{}) (interface{}, error) {
        case bool:
                return s, nil
        case string:
-               b, err := strconv.Atob(s)
+               b, err := strconv.ParseBool(s)
                if err != nil {
                        return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s)
                }
                return b, nil
        case []byte:
-               b, err := strconv.Atob(string(s))
+               b, err := strconv.ParseBool(string(s))
                if err != nil {
                        return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s)
                }
index b5fc357802a40ea70016ba328bc166091b2095f3..6adcc2a9ad2018db5b46ea4eb56effd480880de6 100644 (file)
@@ -305,7 +305,7 @@ func (p *gcParser) parseArrayType() Type {
        lit := p.expect(scanner.Int)
        p.expect(']')
        elt := p.parseType()
-       n, err := strconv.Atoui64(lit)
+       n, err := strconv.ParseUint(lit, 10, 64)
        if err != nil {
                p.error(err)
        }
@@ -622,10 +622,11 @@ func (p *gcParser) parseNumber() Const {
                // exponent (base 2)
                p.next()
                sign, val = p.parseInt()
-               exp, err := strconv.Atoui(val)
+               exp64, err := strconv.ParseUint(val, 10, 0)
                if err != nil {
                        p.error(err)
                }
+               exp := uint(exp64)
                if sign == "-" {
                        denom := big.NewInt(1)
                        denom.Lsh(denom, exp)
index 629280acf76e05297cac9ead95457db2ef91b0f8..40f5441ddcb4f0800c2fa09f6b87e7dbf01a6f1b 100644 (file)
@@ -44,7 +44,7 @@ type Int struct {
        mu sync.Mutex
 }
 
-func (v *Int) String() string { return strconv.Itoa64(v.i) }
+func (v *Int) String() string { return strconv.FormatInt(v.i, 10) }
 
 func (v *Int) Add(delta int64) {
        v.mu.Lock()
@@ -64,7 +64,7 @@ type Float struct {
        mu sync.Mutex
 }
 
-func (v *Float) String() string { return strconv.Ftoa64(v.f, 'g', -1) }
+func (v *Float) String() string { return strconv.FormatFloat(v.f, 'g', -1, 64) }
 
 // Add adds delta to v.
 func (v *Float) Add(delta float64) {
index 9f115d592bde5d34cd2c03a13e00006b63237588..406ea77799d4358f47ac5183a85073b95a78d50f 100644 (file)
@@ -79,7 +79,7 @@ func newBoolValue(val bool, p *bool) *boolValue {
 }
 
 func (b *boolValue) Set(s string) bool {
-       v, err := strconv.Atob(s)
+       v, err := strconv.ParseBool(s)
        *b = boolValue(v)
        return err == nil
 }
@@ -95,7 +95,7 @@ func newIntValue(val int, p *int) *intValue {
 }
 
 func (i *intValue) Set(s string) bool {
-       v, err := strconv.Btoi64(s, 0)
+       v, err := strconv.ParseInt(s, 0, 64)
        *i = intValue(v)
        return err == nil
 }
@@ -111,7 +111,7 @@ func newInt64Value(val int64, p *int64) *int64Value {
 }
 
 func (i *int64Value) Set(s string) bool {
-       v, err := strconv.Btoi64(s, 0)
+       v, err := strconv.ParseInt(s, 0, 64)
        *i = int64Value(v)
        return err == nil
 }
@@ -127,7 +127,7 @@ func newUintValue(val uint, p *uint) *uintValue {
 }
 
 func (i *uintValue) Set(s string) bool {
-       v, err := strconv.Btoui64(s, 0)
+       v, err := strconv.ParseUint(s, 0, 64)
        *i = uintValue(v)
        return err == nil
 }
@@ -143,7 +143,7 @@ func newUint64Value(val uint64, p *uint64) *uint64Value {
 }
 
 func (i *uint64Value) Set(s string) bool {
-       v, err := strconv.Btoui64(s, 0)
+       v, err := strconv.ParseUint(s, 0, 64)
        *i = uint64Value(v)
        return err == nil
 }
@@ -174,7 +174,7 @@ func newFloat64Value(val float64, p *float64) *float64Value {
 }
 
 func (f *float64Value) Set(s string) bool {
-       v, err := strconv.Atof64(s)
+       v, err := strconv.ParseFloat(s, 64)
        *f = float64Value(v)
        return err == nil
 }
index 3957a5a261df160c91385b2b03053947143c76e3..fbafa9d9ad99c15053cef2c80255bc50f163d4df 100644 (file)
@@ -360,44 +360,44 @@ func (f *fmt) plusSpace(s string) {
 }
 
 // fmt_e64 formats a float64 in the form -1.23e+12.
-func (f *fmt) fmt_e64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'e', doPrec(f, 6))) }
+func (f *fmt) fmt_e64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'e', doPrec(f, 6), 64)) }
 
 // fmt_E64 formats a float64 in the form -1.23E+12.
-func (f *fmt) fmt_E64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'E', doPrec(f, 6))) }
+func (f *fmt) fmt_E64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'E', doPrec(f, 6), 64)) }
 
 // fmt_f64 formats a float64 in the form -1.23.
-func (f *fmt) fmt_f64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'f', doPrec(f, 6))) }
+func (f *fmt) fmt_f64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'f', doPrec(f, 6), 64)) }
 
 // fmt_g64 formats a float64 in the 'f' or 'e' form according to size.
-func (f *fmt) fmt_g64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'g', doPrec(f, -1))) }
+func (f *fmt) fmt_g64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'g', doPrec(f, -1), 64)) }
 
 // fmt_g64 formats a float64 in the 'f' or 'E' form according to size.
-func (f *fmt) fmt_G64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'G', doPrec(f, -1))) }
+func (f *fmt) fmt_G64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'G', doPrec(f, -1), 64)) }
 
 // fmt_fb64 formats a float64 in the form -123p3 (exponent is power of 2).
-func (f *fmt) fmt_fb64(v float64) { f.plusSpace(strconv.Ftoa64(v, 'b', 0)) }
+func (f *fmt) fmt_fb64(v float64) { f.plusSpace(strconv.FormatFloat(v, 'b', 0, 64)) }
 
 // float32
 // cannot defer to float64 versions
 // because it will get rounding wrong in corner cases.
 
 // fmt_e32 formats a float32 in the form -1.23e+12.
-func (f *fmt) fmt_e32(v float32) { f.plusSpace(strconv.Ftoa32(v, 'e', doPrec(f, 6))) }
+func (f *fmt) fmt_e32(v float32) { f.plusSpace(strconv.FormatFloat(float64(v), 'e', doPrec(f, 6), 32)) }
 
 // fmt_E32 formats a float32 in the form -1.23E+12.
-func (f *fmt) fmt_E32(v float32) { f.plusSpace(strconv.Ftoa32(v, 'E', doPrec(f, 6))) }
+func (f *fmt) fmt_E32(v float32) { f.plusSpace(strconv.FormatFloat(float64(v), 'E', doPrec(f, 6), 32)) }
 
 // fmt_f32 formats a float32 in the form -1.23.
-func (f *fmt) fmt_f32(v float32) { f.plusSpace(strconv.Ftoa32(v, 'f', doPrec(f, 6))) }
+func (f *fmt) fmt_f32(v float32) { f.plusSpace(strconv.FormatFloat(float64(v), 'f', doPrec(f, 6), 32)) }
 
 // fmt_g32 formats a float32 in the 'f' or 'e' form according to size.
-func (f *fmt) fmt_g32(v float32) { f.plusSpace(strconv.Ftoa32(v, 'g', doPrec(f, -1))) }
+func (f *fmt) fmt_g32(v float32) { f.plusSpace(strconv.FormatFloat(float64(v), 'g', doPrec(f, -1), 32)) }
 
 // fmt_G32 formats a float32 in the 'f' or 'E' form according to size.
-func (f *fmt) fmt_G32(v float32) { f.plusSpace(strconv.Ftoa32(v, 'G', doPrec(f, -1))) }
+func (f *fmt) fmt_G32(v float32) { f.plusSpace(strconv.FormatFloat(float64(v), 'G', doPrec(f, -1), 32)) }
 
 // fmt_fb32 formats a float32 in the form -123p3 (exponent is power of 2).
-func (f *fmt) fmt_fb32(v float32) { f.padString(strconv.Ftoa32(v, 'b', 0)) }
+func (f *fmt) fmt_fb32(v float32) { f.padString(strconv.FormatFloat(float64(v), 'b', 0, 32)) }
 
 // fmt_c64 formats a complex64 according to the verb.
 func (f *fmt) fmt_c64(v complex64, verb rune) {
index 85571e80c7a1ed04b36d377a079082da66829ba9..281525112e14bea7c6fa0cee6dfd95f884fb92d3 100644 (file)
@@ -613,7 +613,7 @@ func (s *ss) scanInt(verb rune, bitSize int) int64 {
                }
        }
        tok := s.scanNumber(digits, haveDigits)
-       i, err := strconv.Btoi64(tok, base)
+       i, err := strconv.ParseInt(tok, base, 64)
        if err != nil {
                s.error(err)
        }
@@ -643,7 +643,7 @@ func (s *ss) scanUint(verb rune, bitSize int) uint64 {
                base, digits, haveDigits = s.scanBasePrefix()
        }
        tok := s.scanNumber(digits, haveDigits)
-       i, err := strconv.Btoui64(tok, base)
+       i, err := strconv.ParseUint(tok, base, 64)
        if err != nil {
                s.error(err)
        }
@@ -719,7 +719,7 @@ func (s *ss) convertFloat(str string, n int) float64 {
        if p := strings.Index(str, "p"); p >= 0 {
                // Atof doesn't handle power-of-2 exponents,
                // but they're easy to evaluate.
-               f, err := strconv.AtofN(str[:p], n)
+               f, err := strconv.ParseFloat(str[:p], n)
                if err != nil {
                        // Put full string into error.
                        if e, ok := err.(*strconv.NumError); ok {
@@ -737,7 +737,7 @@ func (s *ss) convertFloat(str string, n int) float64 {
                }
                return math.Ldexp(f, n)
        }
-       f, err := strconv.AtofN(str, n)
+       f, err := strconv.ParseFloat(str, n)
        if err != nil {
                s.error(err)
        }
index 0d94bdcf18cda23dcc1473bee5fe459817f5469e..a735638b0314f6694931d48cd529f615f5aed748 100644 (file)
@@ -113,7 +113,7 @@ func TestDecodeCSS(t *testing.T) {
 
 func TestHexDecode(t *testing.T) {
        for i := 0; i < 0x200000; i += 101 /* coprime with 16 */ {
-               s := strconv.Itob(i, 16)
+               s := strconv.FormatInt(int64(i), 16)
                if got := int(hexDecode([]byte(s))); got != i {
                        t.Errorf("%s: want %d but got %d", s, i, got)
                }
index 48089ff75c7f091c954fc4541488cb4131f30c4a..641eae1bb8e8c0cb88c1ecc7d8f2db4d05095fe4 100644 (file)
@@ -429,7 +429,7 @@ func Encode(w io.Writer, m image.Image) error {
        // also rejected.
        mw, mh := int64(m.Bounds().Dx()), int64(m.Bounds().Dy())
        if mw <= 0 || mh <= 0 || mw >= 1<<32 || mh >= 1<<32 {
-               return FormatError("invalid image size: " + strconv.Itoa64(mw) + "x" + strconv.Itoa64(mw))
+               return FormatError("invalid image size: " + strconv.FormatInt(mw, 10) + "x" + strconv.FormatInt(mw, 10))
        }
 
        var e encoder
index e188cd4a25019a209b8c09383e519aab7c1f416a..e6c3ef911ab8f1cc9a5e76b97394cf7da659fc93 100644 (file)
@@ -70,7 +70,7 @@ func RequestFromMap(params map[string]string) (*http.Request, error) {
        r.Host = params["HTTP_HOST"]
 
        if lenstr := params["CONTENT_LENGTH"]; lenstr != "" {
-               clen, err := strconv.Atoi64(lenstr)
+               clen, err := strconv.ParseInt(lenstr, 10, 64)
                if err != nil {
                        return nil, errors.New("cgi: bad CONTENT_LENGTH in environment: " + lenstr)
                }
index 74c41aabd41fd49ad1a63dea3c573617f8cb5e82..60a478fd8faf7b65c18cd8a67cd019443f53bf8b 100644 (file)
@@ -48,7 +48,7 @@ func (cr *chunkedReader) beginChunk() {
        if cr.err != nil {
                return
        }
-       cr.n, cr.err = strconv.Btoui64(line, 16)
+       cr.n, cr.err = strconv.ParseUint(line, 16, 64)
        if cr.err != nil {
                return
        }
@@ -147,7 +147,7 @@ func (cw *chunkedWriter) Write(data []byte) (n int, err error) {
                return 0, nil
        }
 
-       head := strconv.Itob(len(data), 16) + "\r\n"
+       head := strconv.FormatInt(int64(len(data)), 16) + "\r\n"
 
        if _, err = io.WriteString(cw.Wire, head); err != nil {
                return 0, err
index 70e7849f16701bad9365ec9831a356f76292aa68..1392ca68ad680547304d9ef158e8b42209f03c92 100644 (file)
@@ -220,7 +220,7 @@ func serveFile(w ResponseWriter, r *Request, fs FileSystem, name string, redirec
 
        w.Header().Set("Accept-Ranges", "bytes")
        if w.Header().Get("Content-Encoding") == "" {
-               w.Header().Set("Content-Length", strconv.Itoa64(size))
+               w.Header().Set("Content-Length", strconv.FormatInt(size, 10))
        }
 
        w.WriteHeader(code)
@@ -295,7 +295,7 @@ func parseRange(s string, size int64) ([]httpRange, error) {
                if start == "" {
                        // If no start is specified, end specifies the
                        // range start relative to the end of the file.
-                       i, err := strconv.Atoi64(end)
+                       i, err := strconv.ParseInt(end, 10, 64)
                        if err != nil {
                                return nil, errors.New("invalid range")
                        }
@@ -305,7 +305,7 @@ func parseRange(s string, size int64) ([]httpRange, error) {
                        r.start = size - i
                        r.length = size - r.start
                } else {
-                       i, err := strconv.Atoi64(start)
+                       i, err := strconv.ParseInt(start, 10, 64)
                        if err != nil || i > size || i < 0 {
                                return nil, errors.New("invalid range")
                        }
@@ -314,7 +314,7 @@ func parseRange(s string, size int64) ([]httpRange, error) {
                                // If no end is specified, range extends to end of the file.
                                r.length = size - r.start
                        } else {
-                               i, err := strconv.Atoi64(end)
+                               i, err := strconv.ParseInt(end, 10, 64)
                                if err != nil || r.start > i {
                                        return nil, errors.New("invalid range")
                                }
index 69bcc0e816fdbd5432f891a47f4131d2fe79edda..29eaf3475f12cc4b577dfc7da2ecc7e172de6951 100644 (file)
@@ -50,7 +50,7 @@ func (cr *chunkedReader) beginChunk() {
        if cr.err != nil {
                return
        }
-       cr.n, cr.err = strconv.Btoui64(line, 16)
+       cr.n, cr.err = strconv.ParseUint(line, 16, 64)
        if cr.err != nil {
                return
        }
@@ -149,7 +149,7 @@ func (cw *chunkedWriter) Write(data []byte) (n int, err error) {
                return 0, nil
        }
 
-       head := strconv.Itob(len(data), 16) + "\r\n"
+       head := strconv.FormatInt(int64(len(data)), 16) + "\r\n"
 
        if _, err = io.WriteString(cw.Wire, head); err != nil {
                return 0, err
index 2de147579d1fae1a537f72c67d42a41c85898afa..21eac4743ace34f59452243b14f388b7b5579e25 100644 (file)
@@ -63,7 +63,7 @@ func Heap(w http.ResponseWriter, r *http.Request) {
 // Profile responds with the pprof-formatted cpu profile.
 // The package initialization registers it as /debug/pprof/profile.
 func Profile(w http.ResponseWriter, r *http.Request) {
-       sec, _ := strconv.Atoi64(r.FormValue("seconds"))
+       sec, _ := strconv.ParseInt(r.FormValue("seconds"), 10, 64)
        if sec == 0 {
                sec = 30
        }
@@ -111,7 +111,7 @@ func Symbol(w http.ResponseWriter, r *http.Request) {
                if err == nil {
                        word = word[0 : len(word)-1] // trim +
                }
-               pc, _ := strconv.Btoui64(string(word), 0)
+               pc, _ := strconv.ParseUint(string(word), 0, 64)
                if pc != 0 {
                        f := runtime.FuncForPC(uintptr(pc))
                        if f != nil {
index 125f3f214bb270d61c834f0cbc409041c713821b..c100e4d5c6d5a62ac1d513c2f7a9d0e86c033174 100644 (file)
@@ -288,7 +288,7 @@ func (w *response) WriteHeader(code int) {
        var contentLength int64
        if clenStr := w.header.Get("Content-Length"); clenStr != "" {
                var err error
-               contentLength, err = strconv.Atoi64(clenStr)
+               contentLength, err = strconv.ParseInt(clenStr, 10, 64)
                if err == nil {
                        hasCL = true
                } else {
index d25c8fcde42b25c8b781e3f352bd1f35f89c4118..ef9564af9c58b71a34d0f8bdddc0109f7a6f3dc3 100644 (file)
@@ -147,7 +147,7 @@ func (t *transferWriter) WriteHeader(w io.Writer) (err error) {
        // TransferEncoding)
        if t.shouldSendContentLength() {
                io.WriteString(w, "Content-Length: ")
-               _, err = io.WriteString(w, strconv.Itoa64(t.ContentLength)+"\r\n")
+               _, err = io.WriteString(w, strconv.FormatInt(t.ContentLength, 10)+"\r\n")
                if err != nil {
                        return
                }
@@ -432,7 +432,7 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header,
        // Logic based on Content-Length
        cl := strings.TrimSpace(header.Get("Content-Length"))
        if cl != "" {
-               n, err := strconv.Atoi64(cl)
+               n, err := strconv.ParseInt(cl, 10, 64)
                if err != nil || n < 0 {
                        return -1, &badStringError{"bad Content-Length", cl}
                }
index e1afa32062f99bb07d951cb3027b7f0eaa3ce0a4..bf22c711e49602ab3c1b62340e3a6b657ea9749f 100644 (file)
@@ -481,7 +481,7 @@ func (qd qDecoder) Read(p []byte) (n int, err error) {
                if _, err := io.ReadFull(qd.r, qd.scratch[:2]); err != nil {
                        return 0, err
                }
-               x, err := strconv.Btoi64(string(qd.scratch[:2]), 16)
+               x, err := strconv.ParseInt(string(qd.scratch[:2]), 16, 64)
                if err != nil {
                        return 0, fmt.Errorf("mail: invalid RFC 2047 encoding: %q", qd.scratch[:2])
                }
index b8c806472ee775bc83574778357f0509ce5d9a0a..e1bfa4724996f1bd791b6f0e1e35801ae4729718 100644 (file)
@@ -424,11 +424,11 @@ func (t *Template) newVariable(words []string) *variableElement {
                        }
 
                case '.', '+', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
-                       v, err := strconv.Btoi64(word, 0)
+                       v, err := strconv.ParseInt(word, 0, 64)
                        if err == nil {
                                args[i] = v
                        } else {
-                               v, err := strconv.Atof64(word)
+                               v, err := strconv.ParseFloat(word, 64)
                                args[i], lerr = v, err
                        }
 
index 5f5c52b778aa491218f3f7ce7a27072b3b4418d7..7486a9bfca3e935471de18bdaa14493d94519b5a 100644 (file)
@@ -23,14 +23,14 @@ func valueToString(val Value) string {
        typ := val.Type()
        switch val.Kind() {
        case Int, Int8, Int16, Int32, Int64:
-               return strconv.Itoa64(val.Int())
+               return strconv.FormatInt(val.Int(), 10)
        case Uint, Uint8, Uint16, Uint32, Uint64, Uintptr:
-               return strconv.Uitoa64(val.Uint())
+               return strconv.FormatUint(val.Uint(), 10)
        case Float32, Float64:
-               return strconv.Ftoa64(val.Float(), 'g', -1)
+               return strconv.FormatFloat(val.Float(), 'g', -1, 64)
        case Complex64, Complex128:
                c := val.Complex()
-               return strconv.Ftoa64(real(c), 'g', -1) + "+" + strconv.Ftoa64(imag(c), 'g', -1) + "i"
+               return strconv.FormatFloat(real(c), 'g', -1, 64) + "+" + strconv.FormatFloat(imag(c), 'g', -1, 64) + "i"
        case String:
                return val.String()
        case Bool:
@@ -88,7 +88,7 @@ func valueToString(val Value) string {
                return typ.String() + "(" + valueToString(val.Elem()) + ")"
        case Func:
                v := val
-               return typ.String() + "(" + strconv.Uitoa64(uint64(v.Pointer())) + ")"
+               return typ.String() + "(" + strconv.FormatUint(uint64(v.Pointer()), 10) + ")"
        default:
                panic("valueToString: can't print type " + typ.String())
        }
index f5b697a59ae02693a8c30e02c10e5cf814e1d59c..84ebb835581c2f2d64574bf58c0f462c1bf7b435 100644 (file)
@@ -267,7 +267,7 @@ func dumpProg(b *bytes.Buffer, p *Prog) {
 }
 
 func u32(i uint32) string {
-       return strconv.Uitoa64(uint64(i))
+       return strconv.FormatUint(uint64(i), 10)
 }
 
 func dumpInst(b *bytes.Buffer, i *Inst) {
index b5ddab1d16bbe5258765ea8453c49447c008b4dd..adcfe294495445301b950851e830a10293bca8ab 100644 (file)
@@ -277,7 +277,7 @@ func escape(b *bytes.Buffer, r rune, force bool) {
        default:
                if r < 0x100 {
                        b.WriteString(`\x`)
-                       s := strconv.Itob(int(r), 16)
+                       s := strconv.FormatInt(int64(r), 16)
                        if len(s) == 1 {
                                b.WriteRune('0')
                        }
@@ -285,7 +285,7 @@ func escape(b *bytes.Buffer, r rune, force bool) {
                        break
                }
                b.WriteString(`\x{`)
-               b.WriteString(strconv.Itob(int(r), 16))
+               b.WriteString(strconv.FormatInt(int64(r), 16))
                b.WriteString(`}`)
        }
 }
index a4e5514768a030a247ec143cfc5837443d0526c3..4f43424239a0340fbe3d25999bad6eeb646c5ef0 100644 (file)
@@ -267,7 +267,7 @@ func newNumber(text string, typ itemType) (*NumberNode, error) {
        }
        // Imaginary constants can only be complex unless they are zero.
        if len(text) > 0 && text[len(text)-1] == 'i' {
-               f, err := strconv.Atof64(text[:len(text)-1])
+               f, err := strconv.ParseFloat(text[:len(text)-1], 64)
                if err == nil {
                        n.IsComplex = true
                        n.Complex128 = complex(0, f)
@@ -276,12 +276,12 @@ func newNumber(text string, typ itemType) (*NumberNode, error) {
                }
        }
        // Do integer test first so we get 0x123 etc.
-       u, err := strconv.Btoui64(text, 0) // will fail for -0; fixed below.
+       u, err := strconv.ParseUint(text, 0, 64) // will fail for -0; fixed below.
        if err == nil {
                n.IsUint = true
                n.Uint64 = u
        }
-       i, err := strconv.Btoi64(text, 0)
+       i, err := strconv.ParseInt(text, 0, 64)
        if err == nil {
                n.IsInt = true
                n.Int64 = i
@@ -298,7 +298,7 @@ func newNumber(text string, typ itemType) (*NumberNode, error) {
                n.IsFloat = true
                n.Float64 = float64(n.Uint64)
        } else {
-               f, err := strconv.Atof64(text)
+               f, err := strconv.ParseFloat(text, 64)
                if err == nil {
                        n.IsFloat = true
                        n.Float64 = f
index 9590e281a66bef30675fa011c285fdd0c140f906..6d1e79b542bb28c770846f777dbee9402d54ae24 100644 (file)
@@ -339,7 +339,7 @@ func checkTime(time Time, test *ParseTest, t *testing.T) {
                t.Errorf("%s: bad second: %d not %d", test.name, time.Second(), 57)
        }
        // Nanoseconds must be checked against the precision of the input.
-       nanosec, err := strconv.Atoui("012345678"[:test.fracDigits] + "000000000"[:9-test.fracDigits])
+       nanosec, err := strconv.ParseUint("012345678"[:test.fracDigits]+"000000000"[:9-test.fracDigits], 10, 0)
        if err != nil {
                panic(err)
        }
index a405da30766900572833d41b0c8938ecb2373e4d..393f8eadea0b7c17baef2d5f1e768fdd920bdfff 100644 (file)
@@ -199,7 +199,7 @@ func parseCategory(line string) (state State) {
        if len(field) != NumField {
                logger.Fatalf("%5s: %d fields (expected %d)\n", line, len(field), NumField)
        }
-       point, err := strconv.Btoui64(field[FCodePoint], 16)
+       point, err := strconv.ParseUint(field[FCodePoint], 16, 64)
        if err != nil {
                logger.Fatalf("%.5s...: %s", line, err)
        }
@@ -261,7 +261,7 @@ func (char *Char) letterValue(s string, cas string) rune {
        if s == "" {
                return 0
        }
-       v, err := strconv.Btoui64(s, 16)
+       v, err := strconv.ParseUint(s, 16, 64)
        if err != nil {
                char.dump(cas)
                logger.Fatalf("%U: bad letter(%s): %s", char.codePoint, s, err)
@@ -377,11 +377,11 @@ func loadCasefold() {
                        // Only care about 'common' and 'simple' foldings.
                        continue
                }
-               p1, err := strconv.Btoui64(field[0], 16)
+               p1, err := strconv.ParseUint(field[0], 16, 64)
                if err != nil {
                        logger.Fatalf("CaseFolding.txt %.5s...: %s", line, err)
                }
-               p2, err := strconv.Btoui64(field[2], 16)
+               p2, err := strconv.ParseUint(field[2], 16, 64)
                if err != nil {
                        logger.Fatalf("CaseFolding.txt %.5s...: %s", line, err)
                }
@@ -628,13 +628,13 @@ func parseScript(line string, scripts map[string][]Script) {
        if len(matches) != 4 {
                logger.Fatalf("%s: %d matches (expected 3)\n", line, len(matches))
        }
-       lo, err := strconv.Btoui64(matches[1], 16)
+       lo, err := strconv.ParseUint(matches[1], 16, 64)
        if err != nil {
                logger.Fatalf("%.5s...: %s", line, err)
        }
        hi := lo
        if len(matches[2]) > 2 { // ignore leading ..
-               hi, err = strconv.Btoui64(matches[2][2:], 16)
+               hi, err = strconv.ParseUint(matches[2][2:], 16, 64)
                if err != nil {
                        logger.Fatalf("%.5s...: %s", line, err)
                }
index ec7b7ae0a452a5ae722f5d87cc37fb5fd7899d9b..d0ddbeeb484dc5d9ca425737b046b6b4db87bebc 100644 (file)
@@ -365,13 +365,13 @@ func hixie76ClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer)
        key2, number2 := generateKeyNumber()
        if config.handshakeData != nil {
                key1 = config.handshakeData["key1"]
-               n, err := strconv.Atoui(config.handshakeData["number1"])
+               n, err := strconv.ParseUint(config.handshakeData["number1"], 10, 32)
                if err != nil {
                        panic(err)
                }
                number1 = uint32(n)
                key2 = config.handshakeData["key2"]
-               n, err = strconv.Atoui(config.handshakeData["number2"])
+               n, err = strconv.ParseUint(config.handshakeData["number2"], 10, 32)
                if err != nil {
                        panic(err)
                }
index 2a71957d84bde3a8a014aece620f5d509aaae50f..bf401bf3048275994c2519f89b9f1929e57b3ff7 100644 (file)
@@ -41,16 +41,16 @@ func main() {
        ok := true
        for i := 0; i < len(tests); i++ {
                t := tests[i]
-               v := strconv.Ftoa64(t.f, 'g', -1)
+               v := strconv.FormatFloat(t.f, 'g', -1, 64)
                if v != t.out {
                        println("Bad float64 const:", t.in, "want", t.out, "got", v)
-                       x, err := strconv.Atof64(t.out)
+                       x, err := strconv.ParseFloat(t.out, 64)
                        if err != nil {
                                println("bug120: strconv.Atof64", t.out)
                                panic("fail")
                        }
-                       println("\twant exact:", strconv.Ftoa64(x, 'g', 1000))
-                       println("\tgot exact: ", strconv.Ftoa64(t.f, 'g', 1000))
+                       println("\twant exact:", strconv.FormatFloat(x, 'g', 1000, 64))
+                       println("\tgot exact: ", strconv.FormatFloat(t.f, 'g', 1000, 64))
                        ok = false
                }
        }
index 34757c70eefd70e46df756725c62edf4541a33ec..91dc89f77a5b85e2b91628f0879215124c46d23b 100644 (file)
@@ -24,8 +24,8 @@ func main() {
        report := len(os.Args) > 1
        status := 0
        var b1 [10]T1
-       a0, _ := strconv.Btoui64(fmt.Sprintf("%p", &b1[0])[2:], 16)
-       a1, _ := strconv.Btoui64(fmt.Sprintf("%p", &b1[1])[2:], 16)
+       a0, _ := strconv.ParseUint(fmt.Sprintf("%p", &b1[0])[2:], 16, 64)
+       a1, _ := strconv.ParseUint(fmt.Sprintf("%p", &b1[1])[2:], 16, 64)
        if a1 != a0+1 {
                fmt.Println("FAIL")
                if report {
@@ -34,8 +34,8 @@ func main() {
                status = 1
        }
        var b2 [10]T2
-       a0, _ = strconv.Btoui64(fmt.Sprintf("%p", &b2[0])[2:], 16)
-       a1, _ = strconv.Btoui64(fmt.Sprintf("%p", &b2[1])[2:], 16)
+       a0, _ = strconv.ParseUint(fmt.Sprintf("%p", &b2[0])[2:], 16, 64)
+       a1, _ = strconv.ParseUint(fmt.Sprintf("%p", &b2[1])[2:], 16, 64)
        if a1 != a0+2 {
                if status == 0 {
                        fmt.Println("FAIL")
@@ -46,8 +46,8 @@ func main() {
                }
        }
        var b4 [10]T4
-       a0, _ = strconv.Btoui64(fmt.Sprintf("%p", &b4[0])[2:], 16)
-       a1, _ = strconv.Btoui64(fmt.Sprintf("%p", &b4[1])[2:], 16)
+       a0, _ = strconv.ParseUint(fmt.Sprintf("%p", &b4[0])[2:], 16, 64)
+       a1, _ = strconv.ParseUint(fmt.Sprintf("%p", &b4[1])[2:], 16, 64)
        if a1 != a0+4 {
                if status == 0 {
                        fmt.Println("FAIL")