Fix compiler warning in conjunction with strncpy

This commit is contained in:
Andreas Eversberg
2018-05-20 11:35:06 +02:00
parent 3438402fe2
commit 4e2ad7dae1
6 changed files with 11 additions and 11 deletions

View File

@@ -202,7 +202,7 @@ static void print_measurements(int on)
break;
}
/* "Deviation ::::::::::............ 4.5 KHz" */
strncpy(line, param->name, (strlen(param->name) < MAX_NAME_LEN) ? strlen(param->name) : MAX_NAME_LEN);
memcpy(line, param->name, (strlen(param->name) < MAX_NAME_LEN) ? strlen(param->name) : MAX_NAME_LEN);
if (isinf(value) || isnan(value)) {
bar_left = -1;
bar_right = -1;

View File

@@ -83,7 +83,7 @@ void display_status_start(void)
{
memset(screen, ' ', sizeof(screen));
memset(screen[0], '-', sizeof(screen[0]));
strncpy(screen[0] + 4, "Channel Status", 14);
memcpy(screen[0] + 4, "Channel Status", 14);
line_count = 1;
}
@@ -103,7 +103,7 @@ void display_status_channel(int channel, const char *type, const char *state)
else
snprintf(line, sizeof(line), "Channel: %d State: %s", channel, state);
line[sizeof(line) - 1] = '\0';
strncpy(screen[line_count++], line, strlen(line));
memcpy(screen[line_count++], line, strlen(line));
}
void display_status_subscriber(const char *number, const char *state)
@@ -118,7 +118,7 @@ void display_status_subscriber(const char *number, const char *state)
else
snprintf(line, sizeof(line), " Subscriber: %s", number);
line[sizeof(line) - 1] = '\0';
strncpy(screen[line_count++], line, strlen(line));
memcpy(screen[line_count++], line, strlen(line));
}
void display_status_end(void)