kivy / oscpy

An efficient OSC implementation compatible with python2.7 and 3.5+
MIT License
111 stars 27 forks source link

Modify blob parser and test_blob to address issue #72. #74

Closed felixdollack closed 1 year ago

felixdollack commented 1 year ago

Hey @tshirtman,

I changed the format for binary blobs to >%is. I used s instead of p or c because it is char[] without length limitation. According to the struct documentation p has a maximum length of 255 characters and c is single characters. I believe using s is the best option here.

Before you used Q which has a byte length of 8, since this is no longer necessary I removed the length argument from the call to padding (use the default length of 4).

This covers and works with my original use case sending data from tinyosc (see issue #72). However, sending blobs via send_message still uses single characters due to the way format_message works. I don't know if that needs to change, but I believe the issue of not being able to read blob data is addressed by the changes here.

Looking forward to your reply and hope the changes make it into oscpy 😄

tshirtman commented 1 year ago

Yeah not sure why i used Q (unsigned long long) in the first place, that seems like a weird choice now. it's been 5 years and the commit message "parse blobs" is certainly not as descriptive as it should :sweat_smile:.

The change looks sane to me, regarding send_message, i think if changes are needed that can be done separately, so looks good to merge to me.

tshirtman commented 1 year ago

Thank you for your contribution :)