Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/dlt_filetransfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FLST | Package flag
After the header package was sent, at least one or more data packages can be
sent using:

` int dlt_user_log_file_data(DltContext *fileContext,const char *filename,int packageToTransfer, int timeout) `
` int dlt_user_log_file_data(DltContext *fileContext,const char *filename,int packageToTransfer, unsigned int timeout) `

Data Data Package Protocol:

Expand Down
2 changes: 1 addition & 1 deletion include/dlt/dlt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ int dlt_execute_command(char *filename, char *command, ...);
* @param filename Only file names without prepended path allowed.
* @return pointer to extension
*/
char *get_filename_ext(const char *filename);
const char *get_filename_ext(const char *filename);

/**
* Extract the base name of given file name (without the extension).
Expand Down
6 changes: 3 additions & 3 deletions include/dlt/dlt_filetransfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
* @param timeout Timeout in ms to wait between some logs. Important that the FIFO of dlt will not be flooded with to many messages in a short period of time.
* @return Returns 0 if everything was okey. If there was a failure value < 0 will be returned.
*/
extern int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout);
extern int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, unsigned int timeout);


/* !This method gives information about the number of packages the file have */
Expand Down Expand Up @@ -126,7 +126,7 @@ extern int dlt_user_log_file_header(DltContext *fileContext, const char *filenam
* @param fileCancelTransferFlag is a bool pointer to cancel the filetransfer on demand. For example in case of application shutdown event outstanding file transfer should abort and return
* @return Returns 0 if everything was okey. If there was a failure value < 0 will be returned.
*/
extern int dlt_user_log_file_data_cancelable(DltContext *fileContext, const char *filename, int packageToTransfer, int timeout, bool *const fileCancelTransferFlag);
extern int dlt_user_log_file_data_cancelable(DltContext *fileContext, const char *filename, int packageToTransfer, unsigned int timeout, bool *const fileCancelTransferFlag);


/* !Transfer the content data of a file. */
Expand All @@ -137,7 +137,7 @@ extern int dlt_user_log_file_data_cancelable(DltContext *fileContext, const char
* @param timeout Timeout to wait between dlt logs. Important because the dlt FIFO should not be flooded. Default is defined by MIN_TIMEOUT. The given timeout in ms can not be smaller than MIN_TIMEOUT.
* @return Returns 0 if everything was okey. If there was a failure value < 0 will be returned.
*/
extern int dlt_user_log_file_data(DltContext *fileContext, const char *filename, int packageToTransfer, int timeout);
extern int dlt_user_log_file_data(DltContext *fileContext, const char *filename, int packageToTransfer, unsigned int timeout);



Expand Down
2 changes: 1 addition & 1 deletion src/console/dlt-control-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static int prepare_headers(DltMessage *msg, uint8_t *header)
return -1;
}

msg->standardheader->len = DLT_HTOBE_16(len);
msg->standardheader->len = DLT_HTOBE_16((uint16_t)len);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/console/dlt-control-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ int main(int argc, char *argv[])
/*dlt_client_main_loop(&dltclient, &dltdata, dltdata.vflag); */

/* Wait timeout */
ts.tv_sec = (dltdata.tvalue * NANOSEC_PER_MILLISEC) / NANOSEC_PER_SEC;
ts.tv_nsec = (dltdata.tvalue * NANOSEC_PER_MILLISEC) % NANOSEC_PER_SEC;
ts.tv_sec = (long int)(dltdata.tvalue * NANOSEC_PER_MILLISEC) / NANOSEC_PER_SEC;
ts.tv_nsec = (long int)(dltdata.tvalue * NANOSEC_PER_MILLISEC) % NANOSEC_PER_SEC;
nanosleep(&ts, NULL);
} else {
ret = -1;
Expand Down Expand Up @@ -934,4 +934,4 @@ int dlt_receive_message_callback_v2(DltMessageV2 *message, void *data)
}

return ret;
}
}
4 changes: 2 additions & 2 deletions src/console/dlt-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ int main(int argc, char *argv[])
/*dlt_client_main_loop(&dltclient, &dltdata, dltdata.vflag); */

/* Wait timeout */
ts.tv_sec = (dltdata.tvalue * NANOSEC_PER_MILLISEC) / NANOSEC_PER_SEC;
ts.tv_nsec = (dltdata.tvalue * NANOSEC_PER_MILLISEC) % NANOSEC_PER_SEC;
ts.tv_sec = (long int)(dltdata.tvalue * NANOSEC_PER_MILLISEC) / NANOSEC_PER_SEC;
ts.tv_nsec = (long int)(dltdata.tvalue * NANOSEC_PER_MILLISEC) % NANOSEC_PER_SEC;
nanosleep(&ts, NULL);
} else {
ret = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/console/logstorage/dlt-logstorage-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static int parse_args(int argc, char *argv[])
}

#if !defined(DLT_SYSTEMD_ENABLE)
int sd_notify(int unset_environment, const char *state)
int sd_notify(int unset_environment, char *state)
{
/* Satisfy Compiler for warnings */
(void)unset_environment;
Expand Down
2 changes: 1 addition & 1 deletion src/console/logstorage/dlt-logstorage-udev.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int logstorage_udev_udevd_callback(void)
* and/or for hot unplug (without unmount).
*/
ts.tv_sec = 0;
ts.tv_nsec = 500 * NANOSEC_PER_MILLISEC;
ts.tv_nsec = (long int) 500 * NANOSEC_PER_MILLISEC;
nanosleep(&ts, NULL);
ret = check_mountpoint_from_partition(EVENT_MOUNTED, partition);
}
Expand Down
20 changes: 10 additions & 10 deletions src/daemon/dlt-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,15 +1604,15 @@ int main(int argc, char *argv[])
{
char *watchdogUSec = getenv("WATCHDOG_USEC");
// set a sensible default, in case the environment variable is not set
int watchdogTimeoutSeconds = 30;
unsigned int watchdogTimeoutSeconds = 30;

dlt_log(LOG_DEBUG, "Systemd watchdog initialization\n");

if (watchdogUSec) {
// WATCHDOG_USEC is the timeout in micrsoseconds
// divide this by 2*10^6 to get the interval in seconds
// 2 * because we notify systemd after half the timeout
watchdogTimeoutSeconds = atoi(watchdogUSec) / 2000000;
watchdogTimeoutSeconds = (unsigned int)atoi(watchdogUSec) / 2000000;
}

if (watchdogTimeoutSeconds == 0) {
Expand Down Expand Up @@ -2874,7 +2874,7 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local,
msg.datasize += (int32_t)uiSize;

/* Calc length */
msg.standardheader->len = DLT_HTOBE_16((size_t)msg.headersize - sizeof(DltStorageHeader) + (size_t)msg.datasize);
msg.standardheader->len = DLT_HTOBE_16((uint16_t)((size_t)msg.headersize - sizeof(DltStorageHeader) + (size_t)msg.datasize));

dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,
msg.headerbuffer, sizeof(DltStorageHeader),
Expand Down Expand Up @@ -5660,8 +5660,8 @@ static void *timer_thread(void *data)
#endif

int create_timer_fd(DltDaemonLocal *daemon_local,
int period_sec,
int starts_in,
unsigned int period_sec,
unsigned int starts_in,
DltTimers timer_id)
{
int local_fd = DLT_FD_INIT;
Expand All @@ -5679,7 +5679,7 @@ int create_timer_fd(DltDaemonLocal *daemon_local,
return -1;
}

if ((period_sec <= 0) || (starts_in <= 0)) {
if ((period_sec == 0) || (starts_in == 0)) {
/* timer not activated via the service file */
dlt_vlog(LOG_INFO, "<%s> not set: period=0\n", timer_name);
local_fd = DLT_FD_INIT;
Expand All @@ -5693,10 +5693,10 @@ int create_timer_fd(DltDaemonLocal *daemon_local,
dlt_vlog(LOG_WARNING, "<%s> timerfd_create failed: %s\n",
timer_name, strerror(errno));

l_timer_spec.it_interval.tv_sec = period_sec;
l_timer_spec.it_interval.tv_nsec = 0;
l_timer_spec.it_value.tv_sec = starts_in;
l_timer_spec.it_value.tv_nsec = 0;
l_timer_spec.it_interval.tv_sec = (long int) period_sec;
l_timer_spec.it_interval.tv_nsec = (long int) 0;
l_timer_spec.it_value.tv_sec = (long int) starts_in;
l_timer_spec.it_value.tv_nsec = (long int) 0;

if (timerfd_settime(local_fd, 0, &l_timer_spec, NULL) < 0) {
dlt_vlog(LOG_WARNING, "<%s> timerfd_settime failed: %s\n",
Expand Down
8 changes: 4 additions & 4 deletions src/daemon/dlt-daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ typedef struct
typedef struct
{
unsigned long long wakeups_missed;
int period_sec;
int starts_in;
unsigned int period_sec;
unsigned int starts_in;
int timer_id;
} DltDaemonPeriodicData;

Expand Down Expand Up @@ -232,7 +232,7 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon,
int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);
int dlt_daemon_process_one_s_timer(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);
int dlt_daemon_process_sixty_s_timer(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);
int dlt_daemon_process_systemd_timer(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);
ssize_t dlt_daemon_process_systemd_timer(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);

int dlt_daemon_process_control_connect(DltDaemon *daemon, DltDaemonLocal *daemon_local, DltReceiver *recv, int verbose);
#if defined DLT_DAEMON_USE_UNIX_SOCKET_IPC || defined DLT_DAEMON_VSOCK_IPC_ENABLE
Expand Down Expand Up @@ -300,7 +300,7 @@ void dlt_daemon_ecu_version_thread(void *ptr);
void dlt_daemon_systemd_watchdog_thread(void *ptr);
#endif

int create_timer_fd(DltDaemonLocal *daemon_local, int period_sec, int starts_in, DltTimers timer);
int create_timer_fd(DltDaemonLocal *daemon_local, unsigned int period_sec, unsigned int starts_in, DltTimers timer);

int dlt_daemon_close_socket(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);

Expand Down
4 changes: 2 additions & 2 deletions src/daemon/dlt_daemon_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4678,7 +4678,7 @@ int dlt_daemon_process_sixty_s_timer(DltDaemon *daemon,
}

#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
int dlt_daemon_process_systemd_timer(DltDaemon *daemon,
ssize_t dlt_daemon_process_systemd_timer(DltDaemon *daemon,
DltDaemonLocal *daemon_local,
DltReceiver *receiver,
int verbose)
Expand Down Expand Up @@ -4716,7 +4716,7 @@ int dlt_daemon_process_systemd_timer(DltDaemon *daemon,
return 0;
}
#else
int dlt_daemon_process_systemd_timer(DltDaemon *daemon,
ssize_t dlt_daemon_process_systemd_timer(DltDaemon *daemon,
DltDaemonLocal *daemon_local,
DltReceiver *receiver,
int verbose)
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/dlt-dbus-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ int read_configuration_file(DltDBusConfiguration *config, char *file_name)
filterEnd = strpbrk (line, "\r\n");

if (filterBegin) {
if (filterEnd && (filterEnd > filterBegin)) {
strncpy(filter, filterBegin + 1, filterEnd - filterBegin - 1);
if (filterEnd && (filterEnd - filterBegin - 1 >= 0)) {
strncpy(filter, filterBegin + 1, (long unsigned int) (filterEnd - filterBegin - 1));
filter[filterEnd - filterBegin - 1] = 0;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/dbus/dlt-dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ filter_func (DBusConnection *con,
return DBUS_HANDLER_RESULT_HANDLED;
}

DLT_TRACE_NETWORK_SEGMENTED(dbusContext, DLT_NW_TRACE_IPC, 0, 0, len_p, (void *)*buf);
DLT_TRACE_NETWORK_SEGMENTED(dbusContext, DLT_NW_TRACE_IPC, 0, 0, (uint16_t)len_p, (void *)*buf);

free(*buf);
*buf = NULL;
Expand Down Expand Up @@ -86,7 +86,7 @@ int main (int argc, char *argv[])
DBusError error;
DBusBusType type;

int num;
unsigned int num;

if (read_command_line(&options, argc, argv) < 0) {
fprintf(stderr, "Failed to read command line!\n");
Expand Down
2 changes: 1 addition & 1 deletion src/dbus/dlt-dbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef struct {
typedef struct {
char *ContextId;
char *BusType;
int FilterCount;
unsigned int FilterCount;
char *FilterMatch[DLT_DBUS_FILTER_MAX];
} DBusOptions;

Expand Down
4 changes: 2 additions & 2 deletions src/examples/dlt-example-filetransfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
DLT_DECLARE_CONTEXT(fileContext)

char *file = 0;
int timeout;
unsigned int timeout;
int dflag = 0;
bool shutdownStatus = false;

Expand Down Expand Up @@ -229,7 +229,7 @@ int main(int argc, char *argv[])
}

if (tvalue)
timeout = atoi(tvalue);
timeout = (unsigned int)atoi(tvalue);
else
timeout = TIMEOUT;

Expand Down
18 changes: 9 additions & 9 deletions src/gateway/dlt_gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ DLT_STATIC DltReturnValue dlt_gateway_check_interval(DltGateway *gateway,
return DLT_RETURN_WRONG_PARAMETER;
}

gateway->interval = (int)strtol(value, NULL, 10);
gateway->interval = (unsigned int)strtol(value, NULL, 10);

if (gateway->interval > 0)
return DLT_RETURN_OK;
Expand Down Expand Up @@ -322,7 +322,7 @@ DLT_STATIC DltReturnValue dlt_gateway_check_control_messages(DltGatewayConnectio
con->p_control_msgs->user_id = DLT_SERVICE_ID_PASSIVE_NODE_CONNECT;
con->p_control_msgs->type = CONTROL_MESSAGE_ON_STARTUP;
con->p_control_msgs->req = CONTROL_MESSAGE_NOT_REQUESTED;
con->p_control_msgs->interval = -1;
con->p_control_msgs->interval = 0;

if (head == NULL)
head = con->p_control_msgs;
Expand Down Expand Up @@ -398,9 +398,9 @@ DLT_STATIC DltReturnValue dlt_gateway_check_periodic_control_messages(
while (con->p_control_msgs != NULL) {
if (con->p_control_msgs->id == id) {
con->p_control_msgs->type = CONTROL_MESSAGE_BOTH;
con->p_control_msgs->interval = (int)strtol(p_rest, NULL, 10);
con->p_control_msgs->interval = (unsigned int)strtol(p_rest, NULL, 10);

if (con->p_control_msgs->interval <= 0)
if (con->p_control_msgs->interval == 0)
dlt_vlog(LOG_WARNING,
"%s interval is %d. It won't be send periodically.\n",
dlt_get_service_name(con->p_control_msgs->id),
Expand Down Expand Up @@ -435,9 +435,9 @@ DLT_STATIC DltReturnValue dlt_gateway_check_periodic_control_messages(
con->p_control_msgs->user_id = DLT_SERVICE_ID_PASSIVE_NODE_CONNECT;
con->p_control_msgs->type = CONTROL_MESSAGE_PERIODIC;
con->p_control_msgs->req = CONTROL_MESSAGE_NOT_REQUESTED;
con->p_control_msgs->interval = (int)strtol(p_rest, NULL, 10);
con->p_control_msgs->interval = (unsigned int)strtol(p_rest, NULL, 10);

if (con->p_control_msgs->interval <= 0)
if (con->p_control_msgs->interval == 0)
dlt_vlog(LOG_WARNING,
"%s interval is %d. It won't be send periodically.\n",
dlt_get_service_name(con->p_control_msgs->id),
Expand Down Expand Up @@ -907,7 +907,7 @@ DLT_STATIC int dlt_gateway_add_to_event_loop(DltDaemonLocal *daemon_local,
int verbose)
{
DltPassiveControlMessage *control_msg = NULL;
int sendtime = 1;
unsigned int sendtime = 1;

if ((daemon_local == NULL) || (con == NULL)) {
dlt_vlog(LOG_ERR, "%s: wrong parameter\n", __func__);
Expand Down Expand Up @@ -1782,7 +1782,7 @@ int dlt_gateway_send_control_message(DltGatewayConnection *con,
/* check sendtime counter and message interval */
/* sendtime counter is 0 on startup, otherwise positive value */
if ((control_msg->type != CONTROL_MESSAGE_ON_DEMAND) && (con->sendtime_cnt > 0)) {
if (control_msg->interval <= 0)
if ((control_msg->interval) == 0)
return DLT_RETURN_ERROR;

if ((control_msg->type == CONTROL_MESSAGE_PERIODIC) ||
Expand Down Expand Up @@ -1861,7 +1861,7 @@ int dlt_gateway_send_control_message_v2(DltGatewayConnection *con,
/* check sendtime counter and message interval */
/* sendtime counter is 0 on startup, otherwise positive value */
if ((control_msg->type != CONTROL_MESSAGE_ON_DEMAND) && (con->sendtime_cnt > 0)) {
if (control_msg->interval <= 0)
if (control_msg->interval == 0)
return DLT_RETURN_ERROR;

if ((control_msg->type == CONTROL_MESSAGE_PERIODIC) ||
Expand Down
8 changes: 4 additions & 4 deletions src/gateway/dlt_gateway_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef struct DltPassiveControlMessage {
uint32_t user_id;
control_msg_trigger type; /* on startup or periodic or both */
control_msg_request req; /* whether it is requested from gateway or not */
int interval; /* interval for periodic sending. if on startup, -1 */
unsigned int interval; /* interval for periodic sending. if on startup, -1 */
struct DltPassiveControlMessage *next; /* for multiple passive control message */
} DltPassiveControlMessage;

Expand All @@ -127,8 +127,8 @@ typedef struct {
int timeout; /* connection timeout */
int timeout_cnt; /* connection timeout counter */
int reconnect_cnt; /* reconnection counter */
int sendtime; /* periodic sending max time */
int sendtime_cnt; /* periodic sending counter */
unsigned int sendtime; /* periodic sending max time */
unsigned int sendtime_cnt; /* periodic sending counter */
DltPassiveControlMessage *p_control_msgs; /* passive control msgs */
DltPassiveControlMessage *head; /* to go back to the head pointer of p_control_msgs */
int send_serial; /* Send serial header with control messages */
Expand All @@ -142,7 +142,7 @@ typedef struct
int send_serial; /* Default: Send serial header with control messages */
DltGatewayConnection *connections; /* pointer to connections */
int num_connections; /* number of connections */
int interval; /* interval of retry connection */
unsigned int interval; /* interval of retry connection */
} DltGateway;

typedef struct {
Expand Down
Loading
Loading