summaryrefslogtreecommitdiff
path: root/src/lib/dlt_filetransfer.c
diff options
context:
space:
mode:
authorDinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>2020-10-27 15:35:51 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-01-06 09:27:28 +0900
commit906578850094f8f5e9ce488c71ad831b2f35330c (patch)
tree90403e585db0470fe67ac9d2c677f772d3c12468 /src/lib/dlt_filetransfer.c
parent7e7ae6dbb5579c2e163d87ff7bcc774de459b96b (diff)
downloadDLT-daemon-906578850094f8f5e9ce488c71ad831b2f35330c.tar.gz
library: fix conversion warnings
- Change the data type of variable 'size' in DltContextData struct (dlt_user.h.in). Variable 'size' was used repeated with function 'sizeof()' many time, so change type to 'size_t' can avoid a lot of warnings. - Adding temporary variable to calculate the datasize header (define in dlt_common.h) in 'dlt_common.c' file. Signed-off-by: Dinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>
Diffstat (limited to 'src/lib/dlt_filetransfer.c')
-rw-r--r--src/lib/dlt_filetransfer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/dlt_filetransfer.c b/src/lib/dlt_filetransfer.c
index bd196ea..40acafa 100644
--- a/src/lib/dlt_filetransfer.c
+++ b/src/lib/dlt_filetransfer.c
@@ -91,7 +91,7 @@ uint32_t getFilesize(const char *file, int *ok)
}
*ok = 1;
- return (uint32_t)st.st_size;
+ return (uint32_t) st.st_size;
}
/** A simple Hash function for C-strings
@@ -104,7 +104,7 @@ void stringHash(const char *str, uint32_t *hash)
if (!str || !hash)
return;
- unsigned int len = strlen(str);
+ unsigned int len = (unsigned int) strlen(str);
unsigned int i = 0;
@@ -112,7 +112,7 @@ void stringHash(const char *str, uint32_t *hash)
return;
for (i = 0; i < len; i++)
- *hash = 53 * *hash + str[i];
+ *hash = 53 * *hash + (uint32_t) str[i];
}
@@ -133,10 +133,10 @@ uint32_t getFileSerialNumber(const char *file, int *ok)
}
else {
*ok = 1;
- ret = st.st_ino;
+ ret = (uint32_t) st.st_ino;
ret = ret << (sizeof(ret) * 8) / 2;
- ret |= st.st_size;
- ret ^= st.st_ctime;
+ ret |= (uint32_t) st.st_size;
+ ret ^= (uint32_t) st.st_ctime;
stringHash(file, &ret);
}
@@ -595,7 +595,7 @@ int dlt_user_log_file_data(DltContext *fileContext, const char *filename, int pa
}
- readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
+ readBytes = (uint32_t) fread(buffer, sizeof(char), BUFFER_SIZE, file);
int ok;
uint32_t fserial = getFileSerialNumber(filename, &ok);