proto.h/proto.c files are shared with libspnav, add spnav_ prefixes to

all global symbols to avoid namespace pollution there.
pull/68/head
John Tsiombikas 2022-03-24 17:52:38 +02:00
rodzic a6e9f4b2ca
commit 743d5eb3f1
3 zmienionych plików z 27 dodań i 27 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
#include "proto.h"
int proto_send_str(int fd, int req, const char *str)
int spnav_send_str(int fd, int req, const char *str)
{
int len;
struct reqresp rr = {0};
@ -28,7 +28,7 @@ int proto_send_str(int fd, int req, const char *str)
return 0;
}
int proto_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr)
int spnav_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr)
{
int len;

Wyświetl plik

@ -125,18 +125,18 @@ enum {
#define REQSTR_FIRST(rr) (((rr)->data[6] & REQSTR_CONT_BIT) == 0)
#define REQSTR_REMLEN(rr) ((rr)->data[6] & 0xffff)
int proto_send_str(int fd, int req, const char *str);
int proto_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr);
int spnav_send_str(int fd, int req, const char *str);
int spnav_recv_str(struct reqresp_strbuf *sbuf, struct reqresp *rr);
#ifdef DEF_PROTO_REQ_NAMES
const char *reqnames_1000[] = {
const char *spnav_reqnames_1000[] = {
"SET_NAME",
"SET_SENS",
"GET_SENS",
"SET_EVMASK",
"GET_EVMASK"
};
const char *reqnames_2000[] = {
const char *spnav_reqnames_2000[] = {
"DEV_NAME",
"DEV_PATH",
"DEV_NAXES",
@ -144,7 +144,7 @@ const char *reqnames_2000[] = {
"DEV_USBID",
"DEV_TYPE"
};
const char *reqnames_3000[] = {
const char *spnav_reqnames_3000[] = {
"SCFG_SENS",
"GCFG_SENS",
"SCFG_SENS_AXIS",
@ -171,16 +171,16 @@ const char *reqnames_3000[] = {
"GCFG_SERDEV"
};
const int reqnames_1000_size = sizeof reqnames_1000 / sizeof *reqnames_1000;
const int reqnames_2000_size = sizeof reqnames_2000 / sizeof *reqnames_2000;
const int reqnames_3000_size = sizeof reqnames_3000 / sizeof *reqnames_3000;
const int spnav_reqnames_1000_size = sizeof spnav_reqnames_1000 / sizeof *spnav_reqnames_1000;
const int spnav_reqnames_2000_size = sizeof spnav_reqnames_2000 / sizeof *spnav_reqnames_2000;
const int spnav_reqnames_3000_size = sizeof spnav_reqnames_3000 / sizeof *spnav_reqnames_3000;
#else
extern const char *reqnames_1000[];
extern const char *reqnames_2000[];
extern const char *reqnames_3000[];
extern const int reqnames_1000_size;
extern const int reqnames_2000_size;
extern const int reqnames_3000_size;
extern const char *spnav_reqnames_1000[];
extern const char *spnav_reqnames_2000[];
extern const char *spnav_reqnames_3000[];
extern const int spnav_reqnames_1000_size;
extern const int spnav_reqnames_2000_size;
extern const int spnav_reqnames_3000_size;
#endif /* DEF_PROTO_REQ_NAMES */
#endif /* PROTO_H_ */

Wyświetl plik

@ -276,7 +276,7 @@ static int handle_request(struct client *c, struct reqresp *req)
switch(req->type & 0xffff) {
case REQ_SET_NAME:
if((res = proto_recv_str(&c->strbuf, req)) == -1) {
if((res = spnav_recv_str(&c->strbuf, req)) == -1) {
logmsg(LOG_ERR, "SET_NAME: failed to receive string\n");
break;
}
@ -316,7 +316,7 @@ static int handle_request(struct client *c, struct reqresp *req)
case REQ_DEV_NAME:
if((dev = get_client_device(c))) {
proto_send_str(get_client_socket(c), req->type, dev->name);
spnav_send_str(get_client_socket(c), req->type, dev->name);
} else {
sendresp(c, req, -1);
}
@ -324,7 +324,7 @@ static int handle_request(struct client *c, struct reqresp *req)
case REQ_DEV_PATH:
if((dev = get_client_device(c))) {
proto_send_str(get_client_socket(c), req->type, dev->path);
spnav_send_str(get_client_socket(c), req->type, dev->path);
} else {
sendresp(c, req, -1);
}
@ -580,7 +580,7 @@ static int handle_request(struct client *c, struct reqresp *req)
break;
case REQ_SCFG_SERDEV:
if((res = proto_recv_str(&c->strbuf, req)) == -1) {
if((res = spnav_recv_str(&c->strbuf, req)) == -1) {
logmsg(LOG_ERR, "SCFG_SERDEV: failed to receive string\n");
break;
}
@ -592,7 +592,7 @@ static int handle_request(struct client *c, struct reqresp *req)
break;
case REQ_GCFG_SERDEV:
proto_send_str(c->sock, req->type, cfg.serial_dev);
spnav_send_str(c->sock, req->type, cfg.serial_dev);
break;
case REQ_CFG_SAVE:
@ -629,14 +629,14 @@ static const char *reqstr(int req)
req &= 0xffff;
if(req >= 0x1000 && req < 0x1000 + reqnames_1000_size) {
return reqnames_1000[req - 0x1000];
if(req >= 0x1000 && req < 0x1000 + spnav_reqnames_1000_size) {
return spnav_reqnames_1000[req - 0x1000];
}
if(req >= 0x2000 && req < 0x2000 + reqnames_2000_size) {
return reqnames_2000[req - 0x2000];
if(req >= 0x2000 && req < 0x2000 + spnav_reqnames_2000_size) {
return spnav_reqnames_2000[req - 0x2000];
}
if(req >= 0x3000 && req < 0x3000 + reqnames_3000_size) {
return reqnames_3000[req - 0x3000];
if(req >= 0x3000 && req < 0x3000 + spnav_reqnames_3000_size) {
return spnav_reqnames_3000[req - 0x3000];
}
switch(req) {
case REQ_CFG_SAVE: