Skip to content

Commit

Permalink
Merge pull request #696 from averater/compiler-warning-sign
Browse files Browse the repository at this point in the history
Fix compiler warnings related to signs
  • Loading branch information
lti9hc authored Nov 6, 2024
2 parents 348cc5f + 7735f71 commit 63ce404
Showing 1 changed file with 5 additions and 6 deletions.
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

0 comments on commit 63ce404

Please sign in to comment.