Fix compiler warning in conjunction with strncpy
This commit is contained in:
parent
3438402fe2
commit
4e2ad7dae1
|
@ -3343,7 +3343,7 @@ static void amps_encode_focc_bits(uint64_t word_a, uint64_t word_b, char *bits)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
strncpy(bits + 0, dotting, 10);
|
memcpy(bits + 0, dotting, 10);
|
||||||
bits[10] = 'i';
|
bits[10] = 'i';
|
||||||
strcpy(bits + 11, sync_word);
|
strcpy(bits + 11, sync_word);
|
||||||
bits[22] = 'i';
|
bits[22] = 'i';
|
||||||
|
@ -3391,10 +3391,10 @@ static void amps_encode_fvc_bits(uint64_t word_a, char *bits)
|
||||||
k = 0;
|
k = 0;
|
||||||
for (i = 0; i < 11; i++) {
|
for (i = 0; i < 11; i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
strncpy(bits + k, dotting, 101);
|
memcpy(bits + k, dotting, 101);
|
||||||
k += 101;
|
k += 101;
|
||||||
} else {
|
} else {
|
||||||
strncpy(bits + k, dotting, 37);
|
memcpy(bits + k, dotting, 37);
|
||||||
k += 37;
|
k += 37;
|
||||||
}
|
}
|
||||||
strcpy(bits + k, sync_word);
|
strcpy(bits + k, sync_word);
|
||||||
|
|
|
@ -161,7 +161,7 @@ int bnetz_create(int kanal, const char *audiodev, int use_sdr, int samplerate, d
|
||||||
{
|
{
|
||||||
bnetz_t *bnetz;
|
bnetz_t *bnetz;
|
||||||
enum paging_signal paging_signal = PAGING_SIGNAL_NONE;
|
enum paging_signal paging_signal = PAGING_SIGNAL_NONE;
|
||||||
char paging_file[256] = "", paging_on[256] = "", paging_off[256] = "";
|
char paging_file[255] = "", paging_on[255] = "", paging_off[255] = "";
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!(kanal >= 1 && kanal <= 39) && !(kanal >= 50 && kanal <= 86)) {
|
if (!(kanal >= 1 && kanal <= 39) && !(kanal >= 50 && kanal <= 86)) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ typedef struct transaction {
|
||||||
uint8_t futln_fuvst;
|
uint8_t futln_fuvst;
|
||||||
uint16_t futln_rest;
|
uint16_t futln_rest;
|
||||||
int extended; /* extended frequency capability */
|
int extended; /* extended frequency capability */
|
||||||
char dialing[17]; /* number dialed by the phone */
|
char dialing[18]; /* number dialed by the phone */
|
||||||
int64_t state; /* state of transaction */
|
int64_t state; /* state of transaction */
|
||||||
int8_t release_cause; /* reason for release, (c-netz coding) */
|
int8_t release_cause; /* reason for release, (c-netz coding) */
|
||||||
int try; /* counts resending messages */
|
int try; /* counts resending messages */
|
||||||
|
|
|
@ -202,7 +202,7 @@ static void print_measurements(int on)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* "Deviation ::::::::::............ 4.5 KHz" */
|
/* "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)) {
|
if (isinf(value) || isnan(value)) {
|
||||||
bar_left = -1;
|
bar_left = -1;
|
||||||
bar_right = -1;
|
bar_right = -1;
|
||||||
|
|
|
@ -83,7 +83,7 @@ void display_status_start(void)
|
||||||
{
|
{
|
||||||
memset(screen, ' ', sizeof(screen));
|
memset(screen, ' ', sizeof(screen));
|
||||||
memset(screen[0], '-', sizeof(screen[0]));
|
memset(screen[0], '-', sizeof(screen[0]));
|
||||||
strncpy(screen[0] + 4, "Channel Status", 14);
|
memcpy(screen[0] + 4, "Channel Status", 14);
|
||||||
line_count = 1;
|
line_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void display_status_channel(int channel, const char *type, const char *state)
|
||||||
else
|
else
|
||||||
snprintf(line, sizeof(line), "Channel: %d State: %s", channel, state);
|
snprintf(line, sizeof(line), "Channel: %d State: %s", channel, state);
|
||||||
line[sizeof(line) - 1] = '\0';
|
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)
|
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
|
else
|
||||||
snprintf(line, sizeof(line), " Subscriber: %s", number);
|
snprintf(line, sizeof(line), " Subscriber: %s", number);
|
||||||
line[sizeof(line) - 1] = '\0';
|
line[sizeof(line) - 1] = '\0';
|
||||||
strncpy(screen[line_count++], line, strlen(line));
|
memcpy(screen[line_count++], line, strlen(line));
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_status_end(void)
|
void display_status_end(void)
|
||||||
|
|
|
@ -562,7 +562,7 @@ int sdr_start(void *inst)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
pthread_getname_np(tid, tname, sizeof(tname));
|
pthread_getname_np(tid, tname, sizeof(tname));
|
||||||
strncat(tname, "-sdr_tx", sizeof(tname));
|
strncat(tname, "-sdr_tx", sizeof(tname) - 1);
|
||||||
tname[sizeof(tname) - 1] = '\0';
|
tname[sizeof(tname) - 1] = '\0';
|
||||||
pthread_setname_np(tid, tname);
|
pthread_setname_np(tid, tname);
|
||||||
sdr->thread_read.running = 1;
|
sdr->thread_read.running = 1;
|
||||||
|
@ -574,7 +574,7 @@ int sdr_start(void *inst)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
pthread_getname_np(tid, tname, sizeof(tname));
|
pthread_getname_np(tid, tname, sizeof(tname));
|
||||||
strncat(tname, "-sdr_rx", sizeof(tname));
|
strncat(tname, "-sdr_rx", sizeof(tname) - 1);
|
||||||
tname[sizeof(tname) - 1] = '\0';
|
tname[sizeof(tname) - 1] = '\0';
|
||||||
pthread_setname_np(tid, tname);
|
pthread_setname_np(tid, tname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue