Fix compile warning on strings in tests

pull/15/merge
Michael Black W9MDB 2018-04-15 22:54:27 -05:00 zatwierdzone przez Nate Bargmann
rodzic 6bac8422f3
commit 9ba1f1a972
3 zmienionych plików z 17 dodań i 24 usunięć

Wyświetl plik

@ -546,13 +546,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "Warning: %s is not a directory!\n", hist_dir);
}
hist_path = (char *)calloc((sizeof(char)
* (strlen(hist_dir)
+ strlen(hist_file) + 1)),
sizeof(char));
int hist_path_size = sizeof(char)*(strlen(hist_dir)+strlen(hist_file) + 1);
hist_path = (char *)calloc(hist_path_size, sizeof(char));
strncpy(hist_path, hist_dir, strlen(hist_dir));
strncat(hist_path, hist_file, strlen(hist_file));
snprintf(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
}
if (rd_hist && hist_path)

Wyświetl plik

@ -1096,11 +1096,9 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
#endif
/* The starting position of the source string is the first
* character past the initial '\'. Using MAXNAMSIZ for the
* length leaves enough space for the '\0' string terminator in the
* cmd_name array.
* character past the initial '\'.
*/
strncpy(cmd_name, parsed_input[0] + 1, MAXNAMSIZ);
snprintf(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
/* Sanity check as valid multiple character commands consist of
* alpha-numeric characters and the underscore ('_') character.
@ -1206,7 +1204,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXNAMSIZ);
}
@ -1293,7 +1291,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1356,7 +1354,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1422,7 +1420,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1488,7 +1486,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, syn
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}

Wyświetl plik

@ -1007,11 +1007,9 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
#endif
/* The starting position of the source string is the first
* character past the initial '\'. Using MAXNAMSIZ for the
* length leaves enough space for the '\0' string terminator in the
* cmd_name array.
* character past the initial '\'.
*/
strncpy(cmd_name, parsed_input[0] + 1, MAXNAMSIZ);
snprintf(cmd_name, sizeof(cmd_name), parsed_input[0] + 1);
/* Sanity check as valid multiple character commands consist of
* alpha-numeric characters and the underscore ('_') character.
@ -1111,7 +1109,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1169,7 +1167,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1230,7 +1228,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1291,7 +1289,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}
@ -1352,7 +1350,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc)
if (rp_hist_buf)
{
strncat(rp_hist_buf, " ", 1);
strncat(rp_hist_buf, " ", 2);
strncat(rp_hist_buf, parsed_input[x], MAXARGSZ);
}