mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-07-31 01:09:17 +02:00
dont find 0xff
This commit is contained in:
+1
-7
@@ -236,13 +236,7 @@ end
|
|||||||
|
|
||||||
---@param packet string
|
---@param packet string
|
||||||
function uecp.parse_uecp(packet)
|
function uecp.parse_uecp(packet)
|
||||||
local end_i = string.find(packet, "\xff", 1, true)
|
local unstuffed = undo_byte_stuff(string.sub(packet, 2, #packet - 1))
|
||||||
if not end_i then
|
|
||||||
print("could not find 0xff")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local unstuffed = undo_byte_stuff(string.sub(packet, 2, end_i - 1))
|
|
||||||
|
|
||||||
local addr1 = string.byte(unstuffed, 1)
|
local addr1 = string.byte(unstuffed, 1)
|
||||||
local addr2 = string.byte(unstuffed, 2)
|
local addr2 = string.byte(unstuffed, 2)
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ void poll_udp_server() {
|
|||||||
for (ssize_t i = 0; i < bytes_read; i++) {
|
for (ssize_t i = 0; i < bytes_read; i++) {
|
||||||
if (buf[i] == '\n' || (unsigned char)buf[i] == 0xFF) {
|
if (buf[i] == '\n' || (unsigned char)buf[i] == 0xFF) {
|
||||||
size_t len = i - start;
|
size_t len = i - start;
|
||||||
if((unsigned char)buf[i] == 0xFF) len += 1;
|
|
||||||
|
|
||||||
if (len > 0 && len < BUF_SIZE) {
|
if (len > 0 && len < BUF_SIZE) {
|
||||||
memset(cmd_buf, 0, BUF_SIZE);
|
memset(cmd_buf, 0, BUF_SIZE);
|
||||||
|
|||||||
Reference in New Issue
Block a user