Fix compiler warning in conjunction with strncpy
This commit is contained in:
@@ -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;
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user