amitbet / vncproxy

An RFB proxy, written in go that can save and replay FBS files
Other
206 stars 45 forks source link

raw encoding should return the buff #22

Open yannliao opened 3 years ago

yannliao commented 3 years ago

in raw encoding func (*RawEncoding) Read(...) always return nil buff.

for y := uint16(0); y < rect.Height; y++ {
  for x := uint16(0); x < rect.Width; x++ {
      if bts, err := r.ReadBytes(bytesPerPixel); err != nil {
          StoreBytes(bytes, bts)
          return nil, err
      }
  }
}

StoreBytes(bytes, bts) should called outside the error assertion :

for y := uint16(0); y < rect.Height; y++ {
  for x := uint16(0); x < rect.Width; x++ {
      bts, err := r.ReadBytes(bytesPerPixel)
      if err != nil {
          return nil, err
      }
      StoreBytes(bytes, bts)
  }
}