mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 16:52:40 +08:00
[test]: Fix stringop-truncation warnings
Fix this warning when building with newer GCC: warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation] | 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | In function 'strncpy', Change-Id: I6341fa4e507f644b143a8e266f3df267fbd9c566 Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
@@ -497,8 +497,7 @@ static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* c
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_input = 1;
|
||||
} else {
|
||||
mpp_err("input file is invalid\n");
|
||||
@@ -507,8 +506,7 @@ static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* c
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_output[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_output = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
|
@@ -653,8 +653,7 @@ static RK_S32 mpi_dec_multi_test_parse_options(int argc, char **argv, MpiDecTest
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_input = 1;
|
||||
} else {
|
||||
mpp_err("input file is invalid\n");
|
||||
@@ -663,8 +662,7 @@ static RK_S32 mpi_dec_multi_test_parse_options(int argc, char **argv, MpiDecTest
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_output[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_output = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
|
@@ -784,8 +784,7 @@ static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* c
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_input = 1;
|
||||
name_to_coding_type(cmd->file_input, &cmd->type);
|
||||
} else {
|
||||
@@ -795,8 +794,7 @@ static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* c
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_output[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_output = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
@@ -805,8 +803,7 @@ static RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* c
|
||||
break;
|
||||
case 'c':
|
||||
if (next) {
|
||||
strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_config[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_config = 1;
|
||||
|
||||
// enlarge packet buffer size for large input stream case
|
||||
|
@@ -876,8 +876,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiEncTestCmd* c
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_input = 1;
|
||||
} else {
|
||||
mpp_err("input file is invalid\n");
|
||||
@@ -886,8 +885,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiEncTestCmd* c
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH);
|
||||
cmd->file_output[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
||||
cmd->have_output = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
|
@@ -1214,8 +1214,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv,
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_input = 1;
|
||||
} else {
|
||||
mpp_err("input file is invalid\n");
|
||||
@@ -1224,8 +1223,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv,
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_enc_out, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_enc_out[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_enc_out, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_enc_out = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
@@ -1261,8 +1259,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv,
|
||||
break;
|
||||
case 's':
|
||||
if (next) {
|
||||
strncpy(cmd->file_stat, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_stat[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_stat, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_stat_out = 1;
|
||||
} else {
|
||||
mpp_log("stat file is invalid\n");
|
||||
@@ -1271,8 +1268,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv,
|
||||
break;
|
||||
case 'g':
|
||||
if (next) {
|
||||
strncpy(cmd->file_config, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_config[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_config, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_config_file = 1;
|
||||
}
|
||||
break;
|
||||
|
@@ -1005,8 +1005,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiRcTestCmd* cm
|
||||
switch (*opt) {
|
||||
case 'i':
|
||||
if (next) {
|
||||
strncpy(cmd->file_input, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_input[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_input, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_input = 1;
|
||||
} else {
|
||||
mpp_err("input file is invalid\n");
|
||||
@@ -1015,8 +1014,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiRcTestCmd* cm
|
||||
break;
|
||||
case 'o':
|
||||
if (next) {
|
||||
strncpy(cmd->file_enc_out, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_enc_out[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_enc_out, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_enc_out = 1;
|
||||
} else {
|
||||
mpp_log("output file is invalid\n");
|
||||
@@ -1084,8 +1082,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiRcTestCmd* cm
|
||||
break;
|
||||
case 'y':
|
||||
if (next) {
|
||||
strncpy(cmd->file_dec_out, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_dec_out[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_dec_out, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_dec_out = 1;
|
||||
} else {
|
||||
mpp_log("dec output file is invalid\n");
|
||||
@@ -1094,8 +1091,7 @@ static RK_S32 mpi_enc_test_parse_options(int argc, char **argv, MpiRcTestCmd* cm
|
||||
break;
|
||||
case 's':
|
||||
if (next) {
|
||||
strncpy(cmd->file_stat, next, MPI_RC_FILE_NAME_LEN);
|
||||
cmd->file_stat[strlen(next)] = '\0';
|
||||
strncpy(cmd->file_stat, next, MPI_RC_FILE_NAME_LEN - 1);
|
||||
cmd->have_stat_out = 1;
|
||||
} else {
|
||||
mpp_log("stat file is invalid\n");
|
||||
|
Reference in New Issue
Block a user