~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/big/rat.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:
227
227
                return err
228
228
        }
229
229
        if strings.IndexRune("efgEFGv", ch) < 0 {
230
 
                return os.ErrorString("Rat.Scan: invalid verb")
 
230
                return os.NewError("Rat.Scan: invalid verb")
231
231
        }
232
232
        if _, ok := z.SetString(string(tok)); !ok {
233
 
                return os.ErrorString("Rat.Scan: invalid syntax")
 
233
                return os.NewError("Rat.Scan: invalid syntax")
234
234
        }
235
235
        return nil
236
236
}
368
368
        n := i - j
369
369
        if int(uint32(n)) != n {
370
370
                // this should never happen
371
 
                return nil, os.ErrorString("Rat.GobEncode: numerator too large")
 
371
                return nil, os.NewError("Rat.GobEncode: numerator too large")
372
372
        }
373
373
        binary.BigEndian.PutUint32(buf[j-4:j], uint32(n))
374
374
        j -= 1 + 4
384
384
// GobDecode implements the gob.GobDecoder interface.
385
385
func (z *Rat) GobDecode(buf []byte) os.Error {
386
386
        if len(buf) == 0 {
387
 
                return os.ErrorString("Rat.GobDecode: no data")
 
387
                return os.NewError("Rat.GobDecode: no data")
388
388
        }
389
389
        b := buf[0]
390
390
        if b>>1 != ratGobVersion {
391
 
                return os.ErrorString(fmt.Sprintf("Rat.GobDecode: encoding version %d not supported", b>>1))
 
391
                return os.NewError(fmt.Sprintf("Rat.GobDecode: encoding version %d not supported", b>>1))
392
392
        }
393
393
        const j = 1 + 4
394
394
        i := j + binary.BigEndian.Uint32(buf[j-4:j])