1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

Fix compilation warnings

This commit is contained in:
albfan 2016-10-23 03:58:47 +02:00
parent cd23da3c74
commit 5e93ad0638
6 changed files with 27 additions and 10 deletions

View file

@ -47,7 +47,7 @@ static sd_event_source *cli_sigs[_NSIG];
static sd_event_source *cli_stdin;
static bool cli_rl;
static const struct cli_cmd *cli_cmds;
int cli_max_sev = LOG_NOTICE;
unsigned int cli_max_sev = LOG_NOTICE;
static bool is_cli(void)
{

View file

@ -213,7 +213,7 @@ static void sink_handle_set_parameter(struct ctl_sink *s,
_rtsp_message_unref_ struct rtsp_message *rep = NULL;
const char *trigger;
const char *url;
const char *uibc_config;
char *uibc_config;
const char *uibc_setting;
char *nu;
unsigned int cea_res, vesa_res, hh_res;

View file

@ -120,7 +120,7 @@ bool ctl_sink_is_closed(struct ctl_sink *s);
/* CLI handling */
extern int cli_max_sev;
extern unsigned int cli_max_sev;
void cli_printv(const char *fmt, va_list args);
void cli_printf(const char *fmt, ...);

View file

@ -12,6 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <limits.h>
#include "shl_log.h"
/*
@ -239,9 +240,9 @@ void log_llog(void *data,
log_submit(file, line, func, subs, sev, format, args);
}
int log_parse_arg(char *optarg)
unsigned int log_parse_arg(char *optarg)
{
int log_max_sev;
unsigned int log_max_sev;
if(!strcasecmp(optarg, "fatal")) {
log_max_sev = LOG_FATAL;
} else if(!strcasecmp(optarg, "alert")) {
@ -261,7 +262,23 @@ int log_parse_arg(char *optarg)
} else if(!strcasecmp(optarg, "trace")) {
log_max_sev = LOG_TRACE;
} else {
log_max_sev = atoi(optarg);
errno = 0;
char *temp;
long val = strtoul(optarg, &temp, 0);
if (temp == optarg || *temp != '\0'
|| ((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE)) {
log_error("Could not convert '%s' to long and leftover string is: '%s'\n", optarg, temp);
}
if (val > INT_MAX) {
errno = ERANGE;
return INT_MAX;
}
if (val < INT_MIN) {
errno = ERANGE;
return INT_MIN;
}
log_max_sev = (unsigned int) val;
}
return log_max_sev;
}

View file

@ -116,7 +116,7 @@ void log_llog(void *data,
const char *format,
va_list args);
int log_parse_arg(char *optarg);
unsigned int log_parse_arg(char *optarg);
static inline __attribute__((format(printf, 2, 3)))
void log_dummyf(unsigned int sev, const char *format, ...)

View file

@ -106,7 +106,7 @@ const char *int2binary(int x, int padding)
int sendUibcMessage(UibcMessage* uibcmessage, int sockfd) {
ssize_t n;
printf("sending %d bytes\n", uibcmessage->m_PacketDataLen);
printf("sending %zu bytes\n", uibcmessage->m_PacketDataLen);
n = write(sockfd, uibcmessage->m_PacketData , uibcmessage->m_PacketDataLen);
@ -249,7 +249,7 @@ void getUIBCGenericTouchPacket(const char *inEventDesc,
void hexdump(void *_data, size_t len)
{
unsigned char *data = _data;
int count;
size_t count;
int line = 15;
for (count = 0; count < len; count++) {
@ -270,7 +270,7 @@ void hexdump(void *_data, size_t len)
void binarydump(void *_data, size_t len)
{
unsigned char *data = _data;
int count;
size_t count;
int line = 7;
for (count = 0; count < len; count++) {