diff options
author | Dinh Cong Toan <toan.dinhcong@vn.bosch.com> | 2021-05-25 16:28:21 +0700 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2021-06-30 10:54:59 +0900 |
commit | 1e7d374593ae34c5f1b343a213123d5385852fe7 (patch) | |
tree | 8df78ee5c1112874dc0d4d7c682ff559cbc2d04f /src/daemon | |
parent | 3bb7eb24092ff771ccfd1119f8c1088f3f78f981 (diff) | |
download | DLT-daemon-1e7d374593ae34c5f1b343a213123d5385852fe7.tar.gz |
dlt message header broken
This commit is to revert the following commits:
- de4a4234
- fb9ff078
- db9917b3
- e4467f0e
- a567e01d
Those commits are from improvement but they seem to
break the dlt message header in some cases.
Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/dlt-daemon.h | 2 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_connection.c | 6 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_event_handler.c | 8 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_offline_logstorage.c | 34 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_serial.c | 4 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_socket.c | 4 |
6 files changed, 29 insertions, 29 deletions
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h index bbee5ea..7a4b29c 100644 --- a/src/daemon/dlt-daemon.h +++ b/src/daemon/dlt-daemon.h @@ -110,7 +110,7 @@ typedef struct int sendECUSoftwareVersion; /**< (Boolean) Send ECU software version perdiodically */ char pathToECUSoftwareVersion[DLT_DAEMON_FLAG_MAX]; /**< (String: Filename) The file from which to read the ECU version from. */ int sendTimezone; /**< (Boolean) Send Timezone perdiodically */ - uint32_t offlineLogstorageMaxDevices; /**< (int) Maximum devices to be used as offline logstorage devices */ + int offlineLogstorageMaxDevices; /**< (int) Maximum devices to be used as offline logstorage devices */ char offlineLogstorageDirPath[DLT_MOUNT_PATH_MAX]; /**< (String: Directory) DIR path to store offline logs */ int offlineLogstorageTimestamp; /**< (int) Append timestamp in offline logstorage filename */ char offlineLogstorageDelimiter; /**< (char) Append delimeter character in offline logstorage filename */ diff --git a/src/daemon/dlt_daemon_connection.c b/src/daemon/dlt_daemon_connection.c index 78346fd..a438c03 100644 --- a/src/daemon/dlt_daemon_connection.c +++ b/src/daemon/dlt_daemon_connection.c @@ -86,7 +86,7 @@ DLT_STATIC int dlt_connection_send(DltConnection *conn, case DLT_CONNECTION_CLIENT_MSG_TCP: ret = dlt_daemon_socket_sendreliable(conn->receiver->fd, msg, - (int) msg_size); + msg_size); return ret; default: return DLT_DAEMON_ERROR_UNKNOWN; @@ -125,10 +125,10 @@ int dlt_connection_send_multiple(DltConnection *con, sizeof(dltSerialHeader)); if ((data1 != NULL) && (ret == DLT_RETURN_OK)) - ret = dlt_connection_send(con, data1, (size_t) size1); + ret = dlt_connection_send(con, data1, size1); if ((data2 != NULL) && (ret == DLT_RETURN_OK)) - ret = dlt_connection_send(con, data2, (size_t) size2); + ret = dlt_connection_send(con, data2, size2); return ret; } diff --git a/src/daemon/dlt_daemon_event_handler.c b/src/daemon/dlt_daemon_event_handler.c index 3cecf64..0d463da 100644 --- a/src/daemon/dlt_daemon_event_handler.c +++ b/src/daemon/dlt_daemon_event_handler.c @@ -109,9 +109,9 @@ int dlt_daemon_prepare_event_handling(DltEventHandler *ev) static void dlt_event_handler_enable_fd(DltEventHandler *ev, int fd, int mask) { if (ev->max_nfds <= ev->nfds) { - int i = (int) ev->nfds; - int max = (int) (2 * ev->max_nfds); - struct pollfd *tmp = realloc(ev->pfd, (size_t) (max) * sizeof(*ev->pfd)); + int i = ev->nfds; + int max = 2 * ev->max_nfds; + struct pollfd *tmp = realloc(ev->pfd, max * sizeof(*ev->pfd)); if (!tmp) { dlt_log(LOG_CRIT, @@ -143,7 +143,7 @@ static void dlt_event_handler_disable_fd(DltEventHandler *ev, int fd) { unsigned int i = 0; unsigned int j = 0; - unsigned int nfds = (unsigned int) ev->nfds; + unsigned int nfds = ev->nfds; for (; i < nfds; i++, j++) { if (ev->pfd[i].fd == fd) { diff --git a/src/daemon/dlt_daemon_offline_logstorage.c b/src/daemon/dlt_daemon_offline_logstorage.c index b56aade..5d21a76 100644 --- a/src/daemon/dlt_daemon_offline_logstorage.c +++ b/src/daemon/dlt_daemon_offline_logstorage.c @@ -49,7 +49,7 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_ecuid(char *key, if ((len > (DLT_ID_SIZE + 2)) || (len < 2)) return DLT_RETURN_ERROR; - memcpy(ecuid, key, (size_t) (len - 2)); + memcpy(ecuid, key, (len - 2)); memcpy(apid, ".*", 2); memcpy(ctid, ".*", 2); @@ -76,7 +76,7 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_ctid(char *key, if ((len > (DLT_ID_SIZE + 2)) || (len < 1)) return DLT_RETURN_ERROR; - strncpy(ctid, (key + 2), (size_t) (len - 1)); + strncpy(ctid, (key + 2), (len - 1)); memcpy(apid, ".*", 2); return DLT_RETURN_OK; @@ -101,7 +101,7 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_apid(char *key, if ((len > (DLT_ID_SIZE + 2)) || (len < 2)) return DLT_RETURN_ERROR; - strncpy(apid, key + 1, (size_t) (len - 2)); + strncpy(apid, key + 1, (len - 2)); memcpy(ctid, ".*", 2); return DLT_RETURN_OK; @@ -218,7 +218,7 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_multi(char *key, if (tok == NULL) return DLT_RETURN_ERROR; - len = (int) strlen(tok); + len = strlen(tok); if (key[len + 1] == ':') { strncpy(ecuid, tok, DLT_ID_SIZE); @@ -264,7 +264,7 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_key(char *key, char *apid, if ((key == NULL) || (apid == NULL) || (ctid == NULL) || (ecuid == NULL)) return DLT_RETURN_WRONG_PARAMETER; - len = (int) strlen(key); + len = strlen(key); sep = strchr (key, ':'); @@ -336,7 +336,7 @@ DLT_STATIC DltReturnValue dlt_daemon_logstorage_update_passive_node_context( dlt_set_id(req.apid, apid); dlt_set_id(req.ctid, ctid); - req.log_level = (uint8_t) loglevel; + req.log_level = loglevel; if (dlt_gateway_send_control_message(con, &ctrl, (void *)&req, verbose) != 0) { dlt_vlog(LOG_ERR, @@ -382,7 +382,7 @@ DLT_STATIC DltReturnValue dlt_daemon_logstorage_send_log_level(DltDaemon *daemon if (strncmp(ecuid, daemon->ecuid, DLT_ID_SIZE) == 0) { old_log_level = context->storage_log_level; - context->storage_log_level = (int8_t) DLT_OFFLINE_LOGSTORAGE_MAX(loglevel, + context->storage_log_level = DLT_OFFLINE_LOGSTORAGE_MAX(loglevel, context->storage_log_level); if (context->storage_log_level > old_log_level) { @@ -487,7 +487,7 @@ DLT_STATIC DltReturnValue dlt_daemon_logstorage_force_reset_level(DltDaemon *dae { int ll = DLT_LOG_DEFAULT; int num = 0; - uint32_t i = 0; + int i = 0; DltLogStorageFilterConfig *config[DLT_CONFIG_FILE_SECTIONS_MAX] = { 0 }; if ((daemon == NULL) || (daemon_local == NULL) || (ecuid == NULL) || @@ -975,11 +975,11 @@ int dlt_daemon_logstorage_get_loglevel(DltDaemon *daemon, /* If logstorage configuration do not contain file name, * then it is non verbose control filter, so return level as in this filter */ if (config[j]->file_name == NULL) { - storage_loglevel = (int8_t) config[j]->log_level; + storage_loglevel = config[j]->log_level; break; } - configured_loglevel = (int8_t) config[j]->log_level; + configured_loglevel = config[j]->log_level; storage_loglevel = DLT_OFFLINE_LOGSTORAGE_MAX( configured_loglevel, storage_loglevel); @@ -1014,7 +1014,7 @@ void dlt_daemon_logstorage_write(DltDaemon *daemon, unsigned char *data3, int size3) { - uint32_t i = 0; + int i = 0; DltLogStorageUserConfig file_config; if ((daemon == NULL) || (user_config == NULL) || @@ -1118,7 +1118,7 @@ int dlt_daemon_logstorage_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) { - uint32_t i = 0; + int i = 0; PRINT_FUNCTION_VERBOSE(verbose); @@ -1152,7 +1152,7 @@ int dlt_daemon_logstorage_sync_cache(DltDaemon *daemon, char *mnt_point, int verbose) { - uint32_t i = 0; + int i = 0; DltLogStorage *handle = NULL; PRINT_FUNCTION_VERBOSE(verbose); @@ -1210,7 +1210,7 @@ DltLogStorage *dlt_daemon_logstorage_get_device(DltDaemon *daemon, char *mnt_point, int verbose) { - uint32_t i = 0; + int i = 0; int len = 0; int len1 = 0; int len2 = 0; @@ -1220,17 +1220,17 @@ DltLogStorage *dlt_daemon_logstorage_get_device(DltDaemon *daemon, if ((daemon == NULL) || (daemon_local == NULL) || (mnt_point == NULL)) return NULL; - len1 = (int) strlen(mnt_point); + len1 = strlen(mnt_point); for (i = 0; i < daemon_local->flags.offlineLogstorageMaxDevices; i++) { - len2 = (int) strlen(daemon->storage_handle[i].device_mount_point); + len2 = strlen(daemon->storage_handle[i].device_mount_point); /* Check if the requested device path is already used as log storage * device. Check for strlen first, to avoid comparison errors when * final '/' is given or not */ len = len1 > len2 ? len2 : len1; - if (strncmp(daemon->storage_handle[i].device_mount_point, mnt_point, (size_t) len) == 0) + if (strncmp(daemon->storage_handle[i].device_mount_point, mnt_point, len) == 0) return &daemon->storage_handle[i]; } diff --git a/src/daemon/dlt_daemon_serial.c b/src/daemon/dlt_daemon_serial.c index 1b6507d..36b7990 100644 --- a/src/daemon/dlt_daemon_serial.c +++ b/src/daemon/dlt_daemon_serial.c @@ -76,13 +76,13 @@ int dlt_daemon_serial_send(int sock, void *data1, int size1, void *data2, int si /* Send data */ if (data1 && (size1 > 0)) - if (0 > write(sock, data1, (size_t) size1)) + if (0 > write(sock, data1, size1)) return DLT_DAEMON_ERROR_SEND_FAILED; if (data2 && (size2 > 0)) - if (0 > write(sock, data2, (size_t) size2)) + if (0 > write(sock, data2, size2)) return DLT_DAEMON_ERROR_SEND_FAILED; return DLT_DAEMON_ERROR_OK; diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c index 0dd22a9..9db48b9 100644 --- a/src/daemon/dlt_daemon_socket.c +++ b/src/daemon/dlt_daemon_socket.c @@ -196,7 +196,7 @@ int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size while (data_sent < message_size) { ssize_t ret = send(sock, (uint8_t*)data_buffer + data_sent, - (size_t) (message_size - data_sent), + message_size - data_sent, 0); if (ret < 0) { @@ -204,7 +204,7 @@ int dlt_daemon_socket_sendreliable(int sock, void *data_buffer, int message_size "%s: socket send failed [errno: %d]!\n", __func__, errno); return DLT_DAEMON_ERROR_SEND_FAILED; } else { - data_sent += (int) ret; + data_sent += ret; } } |