Commit 43c00601 authored by Damian Gryski's avatar Damian Gryski

decoder: support opcodes the encoder produces

parent 66358694
...@@ -334,7 +334,13 @@ func (d *Decoder) loadLong() error { ...@@ -334,7 +334,13 @@ func (d *Decoder) loadLong() error {
// Push a 2-byte unsigned int // Push a 2-byte unsigned int
func (d *Decoder) loadBinInt2() error { func (d *Decoder) loadBinInt2() error {
return errNotImplemented var u uint16
err := binary.Read(d.r, binary.LittleEndian, &u)
if err != nil {
return err
}
d.push(int64(u))
return nil
} }
// Push None // Push None
...@@ -388,7 +394,18 @@ func (d *Decoder) loadString() error { ...@@ -388,7 +394,18 @@ func (d *Decoder) loadString() error {
} }
func (d *Decoder) loadBinString() error { func (d *Decoder) loadBinString() error {
return errNotImplemented var v int32
err := binary.Read(d.r, binary.LittleEndian, &v)
if err != nil {
return err
}
s := make([]byte, v)
_, err = io.ReadFull(d.r, s)
if err != nil {
return err
}
d.push(string(s))
return nil
} }
func (d *Decoder) loadShortBinString() error { func (d *Decoder) loadShortBinString() error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment