Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in split_55() ? #18

Open
peepshow-21 opened this issue Jan 30, 2022 · 2 comments
Open

bug in split_55() ? #18

peepshow-21 opened this issue Jan 30, 2022 · 2 comments

Comments

@peepshow-21
Copy link


  def split_55(b)
    var ret = []
    var s = size(b)   
    var i = s-1   # start from last
    while i > 0
      if b[i] == 0x55 && b[i+1] == 0xAA           
        ret.push(b[i..s-1]) # push last msg to list
        b = b[(0..i-1)]   # write the rest back to b
      end
      i -= 1
    end
    ret.push(b)
    return ret
  end

should be like this i think;

        ret.push(b[(i+2)..s-1]) # push last msg to list

I think it needs that or the split message will still have the split chars in the messsage

@blakadder
Copy link
Owner

you think or you're certain? what kind of testing makes you think that?

@peepshow-21
Copy link
Author

peepshow-21 commented Jan 30, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants