Skip to content

Commit

Permalink
Merge branch 'master' into fix_gzip_flag_usage
Browse files Browse the repository at this point in the history
  • Loading branch information
averater authored Nov 6, 2024
2 parents 2bb3478 + 63ce404 commit d4737ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion doc/dlt_offline_logstorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ OverwriteBehavior=<strategy> # Specify overwrite strategy. Default: Dele
DisableNetwork=<ON/OFF> # Specify if the message shall be routed to network client.
```

The Parameter "SyncBehavior", "OverwriteBehavior", "DisableNetwork", "EcuID" and
The Parameters "SyncBehavior", "GzipCompression", "OverwriteBehavior", "DisableNetwork", "EcuID" and
"SpecificSize" are optional - all others are mandatory.

If both of the parameter "LogAppName" and "ContextName" are set to wildcard or
Expand Down
11 changes: 5 additions & 6 deletions src/daemon/dlt-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2221,7 +2221,7 @@ static char* file_read_everything(FILE* const file, const size_t sizeLimit)

/* Size limit includes NULL terminator. */
const off_t size = s_buf.st_size;
if (size < 0 || size >= sizeLimit) {
if (size < 0 || (size_t)size >= sizeLimit) {
dlt_log(LOG_WARNING, "file size invalid\n");
fclose(file);
return NULL;
Expand Down Expand Up @@ -2270,7 +2270,7 @@ static char* file_read_field(FILE* const file, const char* const fieldName)
char* result = NULL;

char* buffer = NULL;
ssize_t bufferSize = 0;
size_t bufferSize = 0;

while (true) {
ssize_t lineSize = getline(&buffer, &bufferSize, file);
Expand All @@ -2288,10 +2288,9 @@ static char* file_read_field(FILE* const file, const char* const fieldName)
}

/* check fieldName */
if ( strncmp(line, fieldName, fieldNameLen) == 0
&& lineSize >= (fieldNameLen + 1)
&& strchr(kDelimiters, line[fieldNameLen]) != NULL
) {
if (strncmp(line, fieldName, fieldNameLen) == 0 &&
(size_t)lineSize >= (fieldNameLen + 1) &&
strchr(kDelimiters, line[fieldNameLen]) != NULL) {
/* trim fieldName */
line += fieldNameLen;

Expand Down
15 changes: 2 additions & 13 deletions src/offlinelogstorage/dlt_offline_logstorage_behavior.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,9 @@ int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config,
config->records = NULL;
}

char* suffix = NULL;
for (i = 0; i < cnt; i++) {
if (config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON) {
suffix = strdup(".dlt.gz");
}
else {
suffix = strdup(".dlt");
}
char *suffix = config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON ? ".dlt.gz" : ".dlt";

for (i = 0; i < cnt; i++) {
int len = 0;
len = strlen(file_name);

Expand Down Expand Up @@ -470,11 +464,6 @@ int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config,

free(files);

if (suffix) {
free(suffix);
suffix = NULL;
}

return ret;
}

Expand Down

0 comments on commit d4737ed

Please sign in to comment.