mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-07-29 16:29:17 +02:00
fix pcalls
This commit is contained in:
+1
-1
@@ -92,7 +92,7 @@ local function get_data()
|
||||
local oda = _RDS_ODAs[_RDS_ODA_pointer]
|
||||
|
||||
if oda ~= false and type(oda.handler) == "function" then
|
||||
local ok, generated, b, c, d = pcall(oda.handler())
|
||||
local ok, generated, b, c, d = pcall(oda.handler)
|
||||
if ok and generated then
|
||||
_RDS_ODA_pointer = (_RDS_ODA_pointer % #_RDS_ODAs) + 1
|
||||
b = b | oda.group << 12
|
||||
|
||||
@@ -100,7 +100,7 @@ function rds2_group(stream)
|
||||
local generated = false
|
||||
checked = 0
|
||||
while generated == false and checked < #_RDS2_ODAs do
|
||||
local ok, generated, a, b, c, d = pcall(oda.handler(stream))
|
||||
local ok, generated, a, b, c, d = pcall(oda.handler, stream)
|
||||
if not (generated and ok) then
|
||||
_RDS2_ODA_pointer = _RDS2_ODA_pointer + 1
|
||||
if _RDS2_ODA_pointer > #_RDS2_ODAs then _RDS2_ODA_pointer = 1 end
|
||||
|
||||
@@ -210,7 +210,7 @@ void get_rds_group(RDSEncoder* enc, RDSGroup *group, uint8_t stream) {
|
||||
|
||||
if(!good_group) cant_find_group++;
|
||||
else cant_find_group = 0;
|
||||
|
||||
|
||||
if(!good_group && cant_find_group == 23) {
|
||||
cant_find_group = 0;
|
||||
break;
|
||||
@@ -295,8 +295,7 @@ uint16_t offset_words_typeb[] = {
|
||||
0x1B4, /* D */
|
||||
};
|
||||
|
||||
void add_checkwords(RDSGroup *group, uint8_t *bits)
|
||||
{
|
||||
void add_checkwords(RDSGroup *group, uint8_t *bits) {
|
||||
uint16_t* offset_words;
|
||||
if(group->is_type_b) offset_words = offset_words_typeb;
|
||||
else offset_words = offset_words_typea;
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ int main(int argc, char **argv) {
|
||||
init_rds_modulator(&rdsModulator, &rdsEncoder, config.num_streams);
|
||||
init_rds_encoder(&rdsEncoder);
|
||||
|
||||
if(open_udp_server(config.udp_port, &rdsModulator) == 0) {
|
||||
if(open_udp_server(config.udp_port) == 0) {
|
||||
printf("Reading control commands on UDP:%d.\n", config.udp_port);
|
||||
int r = pthread_create(&udp_server_thread, &attr, udp_server_worker, NULL);
|
||||
if (r < 0) {
|
||||
|
||||
+1
-5
@@ -8,9 +8,7 @@ static struct pollfd poller;
|
||||
static struct sockaddr_in client_addr;
|
||||
static socklen_t client_len = sizeof(client_addr);
|
||||
|
||||
static RDSModulator* mod = NULL;
|
||||
|
||||
int open_udp_server(int port, RDSModulator* rds_mod) {
|
||||
int open_udp_server(int port) {
|
||||
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd < 0) return -1;
|
||||
|
||||
@@ -30,8 +28,6 @@ int open_udp_server(int port, RDSModulator* rds_mod) {
|
||||
poller.fd = sockfd;
|
||||
poller.events = POLLIN;
|
||||
|
||||
mod = rds_mod;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -10,13 +10,12 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include "modulator.h"
|
||||
#include "lua_rds.h"
|
||||
|
||||
#define CMD_BUFFER_SIZE 255
|
||||
#define CTL_BUFFER_SIZE (CMD_BUFFER_SIZE * 2)
|
||||
#define READ_TIMEOUT_MS 225
|
||||
|
||||
int open_udp_server(int port, RDSModulator *rds_mod);
|
||||
int open_udp_server(int port);
|
||||
void poll_udp_server();
|
||||
void close_udp_server();
|
||||
|
||||
Reference in New Issue
Block a user