~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/gob/gobencdec_test.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
func (g *ByteStruct) GobDecode(data []byte) os.Error {
46
46
        if g == nil {
47
 
                return os.ErrorString("NIL RECEIVER")
 
47
                return os.NewError("NIL RECEIVER")
48
48
        }
49
49
        // Expect N sequential-valued bytes.
50
50
        if len(data) == 0 {
53
53
        g.a = data[0]
54
54
        for i, c := range data {
55
55
                if c != g.a+byte(i) {
56
 
                        return os.ErrorString("invalid data sequence")
 
56
                        return os.NewError("invalid data sequence")
57
57
                }
58
58
        }
59
59
        return nil
71
71
        a := data[0]
72
72
        for i, c := range data {
73
73
                if c != a+byte(i) {
74
 
                        return os.ErrorString("invalid data sequence")
 
74
                        return os.NewError("invalid data sequence")
75
75
                }
76
76
        }
77
77
        g.s = string(data)
84
84
 
85
85
func (a *ArrayStruct) GobDecode(data []byte) os.Error {
86
86
        if len(data) != len(a.a) {
87
 
                return os.ErrorString("wrong length in array decode")
 
87
                return os.NewError("wrong length in array decode")
88
88
        }
89
89
        copy(a.a[:], data)
90
90
        return nil