rework send string

This commit is contained in:
Joel Wetzell
2026-01-28 14:36:59 -06:00
parent e34a589c5f
commit 6f3a65322b
+5 -9
View File
@@ -174,17 +174,13 @@ func argsToBuffer(args []OSCArg) []byte {
func readOSCString(bytes []byte) (string, []byte) {
//TODO(jwetzell): add error handling
oscString := ""
stringFinished := false
stringEndIndex := 0
remainingBytes := []byte{}
for index, byteIn := range bytes {
if !stringFinished {
if byteIn == 0 {
oscString = string(bytes[0:index])
stringEndIndex = index + 1
break
}
if byteIn == 0 {
oscString = string(bytes[0:index])
stringEndIndex = index + 1
break
}
}
@@ -194,7 +190,7 @@ func readOSCString(bytes []byte) (string, []byte) {
stringEndIndex = stringEndIndex + stringPadding
}
remainingBytes = bytes[stringEndIndex:]
remainingBytes := bytes[stringEndIndex:]
return oscString, remainingBytes
}