diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-14 15:41:54 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-14 15:41:54 +0000 |
commit | d5363590597572228d4e0d0ae13f3469176ceb14 (patch) | |
tree | e3de46cbc89d82ca1f49843fe2e1e670db67795e /libgo/go/encoding/xml | |
parent | ef0d4c4d9937276c8ff818ecb0b92925d322d3bd (diff) | |
download | gcc-d5363590597572228d4e0d0ae13f3469176ceb14.zip gcc-d5363590597572228d4e0d0ae13f3469176ceb14.tar.gz gcc-d5363590597572228d4e0d0ae13f3469176ceb14.tar.bz2 |
libgo: Update to weekly.2011-12-06.
From-SVN: r182338
Diffstat (limited to 'libgo/go/encoding/xml')
-rw-r--r-- | libgo/go/encoding/xml/marshal.go | 8 | ||||
-rw-r--r-- | libgo/go/encoding/xml/marshal_test.go | 12 | ||||
-rw-r--r-- | libgo/go/encoding/xml/read.go | 8 | ||||
-rw-r--r-- | libgo/go/encoding/xml/xml.go | 4 |
4 files changed, 16 insertions, 16 deletions
diff --git a/libgo/go/encoding/xml/marshal.go b/libgo/go/encoding/xml/marshal.go index 691b70d..e94fdbc 100644 --- a/libgo/go/encoding/xml/marshal.go +++ b/libgo/go/encoding/xml/marshal.go @@ -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()) diff --git a/libgo/go/encoding/xml/marshal_test.go b/libgo/go/encoding/xml/marshal_test.go index a6f7d2d..8040765 100644 --- a/libgo/go/encoding/xml/marshal_test.go +++ b/libgo/go/encoding/xml/marshal_test.go @@ -160,19 +160,19 @@ var marshalTests = []struct { Age: 1, Drive: ImprobabilityDrive, Passenger: []*Passenger{ - &Passenger{ + { Name: []string{"Zaphod", "Beeblebrox"}, Weight: 7.25, }, - &Passenger{ + { Name: []string{"Trisha", "McMillen"}, Weight: 5.5, }, - &Passenger{ + { Name: []string{"Ford", "Prefect"}, Weight: 7, }, - &Passenger{ + { Name: []string{"Arthur", "Dent"}, Weight: 6.75, }, @@ -326,12 +326,12 @@ var marshalErrorTests = []struct { "question": "What do you get when you multiply six by nine?", "answer": "42", }, - Err: "xml: unsupported type: map[string] string", + Err: "xml: unsupported type: map[string]string", Kind: reflect.Map, }, { Value: map[*Ship]bool{nil: false}, - Err: "xml: unsupported type: map[*xml.Ship] bool", + Err: "xml: unsupported type: map[*xml.Ship]bool", Kind: reflect.Map, }, } diff --git a/libgo/go/encoding/xml/read.go b/libgo/go/encoding/xml/read.go index c6a3d75..6dd3654 100644 --- a/libgo/go/encoding/xml/read.go +++ b/libgo/go/encoding/xml/read.go @@ -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 } diff --git a/libgo/go/encoding/xml/xml.go b/libgo/go/encoding/xml/xml.go index d67a299..d001c40 100644 --- a/libgo/go/encoding/xml/xml.go +++ b/libgo/go/encoding/xml/xml.go @@ -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) |