Fix some more signed/unsigned comparisions.
This commit is contained in:
parent
2ad04a048e
commit
bfaeaf1586
12
src/bridge.c
12
src/bridge.c
@ -114,7 +114,7 @@ int parse_ip_data(modem_config *cfg, unsigned char *data, int len)
|
||||
}
|
||||
}
|
||||
else {
|
||||
mdm_write(cfg, (char *) data, len);
|
||||
mdm_write(cfg, data, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -127,7 +127,7 @@ void *ip_thread(void *arg)
|
||||
fd_set readfs;
|
||||
int max_fd;
|
||||
int res = 0;
|
||||
char buf[256];
|
||||
unsigned char buf[256];
|
||||
int rc;
|
||||
|
||||
|
||||
@ -162,8 +162,8 @@ void *ip_thread(void *arg)
|
||||
else {
|
||||
LOG(LOG_DEBUG, "Read %d bytes from socket", res);
|
||||
buf[res] = 0;
|
||||
log_trace(TRACE_IP_IN, buf, res);
|
||||
parse_ip_data(cfg, (unsigned char *) buf, res);
|
||||
log_trace(TRACE_IP_IN, (char *) buf, res);
|
||||
parse_ip_data(cfg, buf, res);
|
||||
}
|
||||
}
|
||||
if (FD_ISSET(cfg->data.cp[1][0], &readfs)) { // pipe
|
||||
@ -248,7 +248,7 @@ void *run_bridge(void *arg)
|
||||
int max_fd = 0;
|
||||
fd_set readfs;
|
||||
int res = 0;
|
||||
char buf[256];
|
||||
unsigned char buf[256];
|
||||
int rc = 0;
|
||||
|
||||
int last_conn_type;
|
||||
@ -405,7 +405,7 @@ void *run_bridge(void *arg)
|
||||
mdm_send_response(MDM_RESP_OK, cfg);
|
||||
}
|
||||
else {
|
||||
mdm_parse_data(cfg, buf, res);
|
||||
mdm_parse_data(cfg, (char *) buf, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ int dce_check_control_lines(modem_config *cfg)
|
||||
return new_status;
|
||||
}
|
||||
|
||||
int dce_write(modem_config *cfg, char data[], int len)
|
||||
int dce_write(modem_config *cfg, unsigned char data[], int len)
|
||||
{
|
||||
if (cfg->dce_data.is_ip232) {
|
||||
return ip232_write(cfg, data, len);
|
||||
@ -147,7 +147,7 @@ int dce_write(modem_config *cfg, char data[], int len)
|
||||
return ser_write(cfg->dce_data.fd, data, len);
|
||||
}
|
||||
|
||||
int dce_read(modem_config *cfg, char data[], int len)
|
||||
int dce_read(modem_config *cfg, unsigned char data[], int len)
|
||||
{
|
||||
if (cfg->dce_data.is_ip232) {
|
||||
return ip232_read(cfg, data, len);
|
||||
|
@ -8,8 +8,8 @@ int dce_set_flow_control(modem_config *cfg, int opts);
|
||||
int dce_set_control_lines(modem_config *cfg, int state);
|
||||
int dce_get_control_lines(modem_config *cfg);
|
||||
int dce_check_control_lines(modem_config *cfg);
|
||||
int dce_read(modem_config *cfg, char *data, int len);
|
||||
int dce_write(modem_config *cfg, char *data, int len);
|
||||
int dce_read(modem_config *cfg, unsigned char *data, int len);
|
||||
int dce_write(modem_config *cfg, unsigned char *data, int len);
|
||||
|
||||
//int dce_check_for_break(modem_config *cfg, char ch, int chars_left);
|
||||
|
||||
|
@ -52,7 +52,7 @@ void log_set_file(FILE * a);
|
||||
void log_set_level(int a);
|
||||
int log_get_trace_flags();
|
||||
void log_set_trace_flags(int a);
|
||||
void log_trace(int type, unsigned char *line, int len);
|
||||
void log_trace(int type, char *line, int len);
|
||||
void log_start(int level);
|
||||
void log_end();
|
||||
|
||||
|
4
src/ip.c
4
src/ip.c
@ -163,9 +163,9 @@ int ip_disconnect(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ip_write(int fd, char *data, int len)
|
||||
int ip_write(int fd, unsigned char *data, int len)
|
||||
{
|
||||
log_trace(TRACE_IP_OUT, data, len);
|
||||
log_trace(TRACE_IP_OUT, (char *) data, len);
|
||||
return write(fd, data, len);
|
||||
}
|
||||
|
||||
|
2
src/ip.h
2
src/ip.h
@ -12,6 +12,6 @@ extern int ip_connect(char addy[]);
|
||||
extern int ip_accept(int sSocket);
|
||||
extern int ip_disconnect(int fd);
|
||||
extern int ip_write(int fd, unsigned char *data, int len);
|
||||
extern int ip_read(int fd, unsigned char *data, int len);
|
||||
extern int ip_read(int fd, char *data, int len);
|
||||
|
||||
#endif
|
||||
|
@ -157,7 +157,7 @@ int ip232_write(modem_config *cfg, unsigned char *data, int len)
|
||||
int text_len = 0;
|
||||
|
||||
|
||||
log_trace(TRACE_MODEM_OUT, data, len);
|
||||
log_trace(TRACE_MODEM_OUT, (char *) data, len);
|
||||
retval = len;
|
||||
if (cfg->dce_data.ip232_is_connected) {
|
||||
while (i < len) {
|
||||
@ -191,7 +191,7 @@ int ip232_read(modem_config *cfg, unsigned char *data, int len)
|
||||
{
|
||||
int res;
|
||||
int rc;
|
||||
unsigned char buf[256];
|
||||
char buf[256];
|
||||
int i = 0;
|
||||
int ch;
|
||||
int text_len = 0;
|
||||
|
@ -59,7 +59,7 @@ int line_write(modem_config *cfg, char *data, int len)
|
||||
return retval;
|
||||
}
|
||||
|
||||
return ip_write(cfg->line_data.fd, data, len);
|
||||
return ip_write(cfg->line_data.fd, (unsigned char *) data, len);
|
||||
}
|
||||
|
||||
int line_listen(modem_config *cfg)
|
||||
|
@ -173,14 +173,14 @@ int mdm_set_control_lines(modem_config *cfg)
|
||||
/* Write single char bypassing parity generation since this mirrors input */
|
||||
void mdm_write_char(modem_config *cfg, char data)
|
||||
{
|
||||
char str[2];
|
||||
unsigned char str[2];
|
||||
|
||||
|
||||
str[0] = data;
|
||||
dce_write(cfg, str, 1);
|
||||
}
|
||||
|
||||
void mdm_write(modem_config *cfg, char *data, int len)
|
||||
void mdm_write(modem_config *cfg, unsigned char *data, int len)
|
||||
{
|
||||
unsigned char *buf;
|
||||
int i;
|
||||
@ -199,7 +199,7 @@ void mdm_write(modem_config *cfg, char *data, int len)
|
||||
buf[i] |= (((cfg->parity >> v)) & 1) << 7;
|
||||
}
|
||||
|
||||
dce_write(cfg, (char *) buf, len);
|
||||
dce_write(cfg, buf, len);
|
||||
free(buf);
|
||||
}
|
||||
else
|
||||
@ -214,17 +214,17 @@ void mdm_send_response(int msg, modem_config *cfg)
|
||||
|
||||
LOG(LOG_DEBUG, "Sending %s response to modem", mdm_responses[msg]);
|
||||
if (cfg->send_responses == TRUE) {
|
||||
mdm_write(cfg, cfg->crlf, 2);
|
||||
mdm_write(cfg, (unsigned char *) cfg->crlf, 2);
|
||||
if (cfg->text_responses == TRUE) {
|
||||
LOG(LOG_ALL, "Sending text response");
|
||||
mdm_write(cfg, mdm_responses[msg], strlen(mdm_responses[msg]));
|
||||
mdm_write(cfg, (unsigned char *) mdm_responses[msg], strlen(mdm_responses[msg]));
|
||||
}
|
||||
else {
|
||||
LOG(LOG_ALL, "Sending numeric response");
|
||||
sprintf(msgID, "%d", msg);
|
||||
mdm_write(cfg, msgID, strlen(msgID));
|
||||
mdm_write(cfg, (unsigned char *) msgID, strlen(msgID));
|
||||
}
|
||||
mdm_write(cfg, cfg->crlf, 2);
|
||||
mdm_write(cfg, (unsigned char *) cfg->crlf, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,8 +389,8 @@ int mdm_parse_cmd(modem_config *cfg)
|
||||
strncpy(cfg->dialno, cfg->last_dialno, strlen(cfg->last_dialno));
|
||||
cfg->dial_type = cfg->dial_type;
|
||||
cfg->memory_dial = TRUE;
|
||||
mdm_write(cfg, cfg->crlf, 2);
|
||||
mdm_write(cfg, cfg->dialno, strlen(cfg->dialno));
|
||||
mdm_write(cfg, (unsigned char *) cfg->crlf, 2);
|
||||
mdm_write(cfg, (unsigned char *) cfg->dialno, strlen(cfg->dialno));
|
||||
}
|
||||
else {
|
||||
cfg->dialno[0] = 0;
|
||||
@ -477,7 +477,7 @@ int mdm_parse_cmd(modem_config *cfg)
|
||||
break;
|
||||
case AT_CMD_FLAG_QUERY | 'S':
|
||||
sprintf(tmp, "%s%3.3d", cfg->crlf, cfg->s[num]);
|
||||
mdm_write(cfg, tmp, strlen(tmp));
|
||||
mdm_write(cfg, (unsigned char *) tmp, strlen(tmp));
|
||||
break;
|
||||
case 'T': // defaut to tone dialing
|
||||
//cfg->default_dial_type=MDM_DT_TONE;
|
||||
@ -603,7 +603,7 @@ int mdm_handle_char(modem_config *cfg, char ch)
|
||||
if (cfg->cmd_started == TRUE) {
|
||||
if (ch == (char) (cfg->s[SRegisterBackspace])) {
|
||||
if (cfg->cur_line_idx == 0 && cfg->echo == TRUE) {
|
||||
mdm_write(cfg, "T", 1);
|
||||
mdm_write(cfg, (unsigned char *) "T", 1);
|
||||
}
|
||||
else {
|
||||
cfg->cur_line_idx--;
|
||||
|
@ -145,7 +145,7 @@ typedef struct modem_config {
|
||||
int disconnect_delay;
|
||||
char crlf[3];
|
||||
int parity;
|
||||
unsigned char pchars[3];
|
||||
char pchars[3];
|
||||
} modem_config;
|
||||
|
||||
int mdm_init(void);
|
||||
|
@ -120,7 +120,7 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, i
|
||||
return rc;
|
||||
}
|
||||
|
||||
void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt)
|
||||
void send_nvt_command(int fd, nvt_vars *vars, int action, int opt)
|
||||
{
|
||||
unsigned char cmd[3];
|
||||
|
||||
|
@ -45,13 +45,13 @@ typedef enum {
|
||||
typedef struct nvt_vars {
|
||||
int binary_xmit;
|
||||
int binary_recv;
|
||||
unsigned char term[256];
|
||||
char term[256];
|
||||
} nvt_vars;
|
||||
|
||||
extern void nvt_init_config(nvt_vars *vars);
|
||||
extern int get_nvt_cmd_response(int action, int type);
|
||||
extern int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, int speed);
|
||||
extern void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt);
|
||||
extern void send_nvt_command(int fd, nvt_vars *vars, int action, int opt);
|
||||
extern void parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity);
|
||||
|
||||
#endif
|
||||
|
@ -173,18 +173,18 @@ int ser_set_control_lines(int fd, int state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ser_write(int fd, char *data, int len)
|
||||
int ser_write(int fd, unsigned char *data, int len)
|
||||
{
|
||||
log_trace(TRACE_MODEM_OUT, data, len);
|
||||
log_trace(TRACE_MODEM_OUT, (char *) data, len);
|
||||
return write(fd, data, len);
|
||||
}
|
||||
|
||||
int ser_read(int fd, char *data, int len)
|
||||
int ser_read(int fd, unsigned char *data, int len)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
||||
res = read(fd, data, len);
|
||||
log_trace(TRACE_MODEM_IN, data, res);
|
||||
log_trace(TRACE_MODEM_IN, (char *) data, res);
|
||||
return res;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ int ser_init_conn(char *tty, int speed);
|
||||
int ser_set_flow_control(int fd, int status);
|
||||
int ser_get_control_lines(int fd);
|
||||
int ser_set_control_lines(int fd, int state);
|
||||
int ser_write(int fd, char *data, int len);
|
||||
int ser_read(int fd, char *data, int len);
|
||||
int ser_write(int fd, unsigned char *data, int len);
|
||||
int ser_read(int fd, unsigned char *data, int len);
|
||||
|
||||
#endif
|
||||
|
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
cSocket = ip_accept(sSocket);
|
||||
if (cSocket > -1) {
|
||||
if (strlen(all_busy) < 1) {
|
||||
ip_write(cSocket, (char *) MDM_BUSY, strlen(MDM_BUSY));
|
||||
ip_write(cSocket, (unsigned char *) MDM_BUSY, strlen(MDM_BUSY));
|
||||
}
|
||||
else {
|
||||
writeFile(all_busy, cSocket);
|
||||
|
Loading…
x
Reference in New Issue
Block a user