test_ipfrag: remove array of size zero
PATCH 1/1 test_ipfrag: remove array of size zero
When compiling with MSVC the error below pops up:
../app/test/test_ipfrag.c(39): error C2466:
cannot allocate an array of constant size 0
../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0 ../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0
The fix is to simplify the code and remove the zero-size array.
--- app/test/test_ipfrag.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
app/test/test_ipfrag.c +2 -7
@@ -36,8 +36,6 @@ uint8_t expected_first_frag_ipv4_opts_nocopied[] = { 0x00, 0x00, 0x00, 0x00, }; -uint8_t expected_sub_frag_ipv4_opts_nocopied[0 ]; -struct test_opt_data {bool is_first_frag;/**< offset is 0 */ bool opt_copied;/**< ip option copied flag */
@@ -153,11 +151,8 @@ test_get_ipv4_opt(bool is_first_frag, bool opt_copied, expected_sub_frag_ipv4_opts_copied, sizeof(expected_sub_frag_ipv4_opts_copied)); }else { - expected_opt->len = -sizeof (expected_sub_frag_ipv4_opts_nocopied); -memcpy (expected_opt->data, - expected_sub_frag_ipv4_opts_nocopied, -sizeof (expected_sub_frag_ipv4_opts_nocopied)); + expected_opt->len =0 ; +/* No data to be copied */ } } }
Signature · 1 line
2.48.1.vfs.0.0
Quoted 11 lines · Andre Muezerie
When compiling with MSVC the error below pops up:
../app/test/test_ipfrag.c(39): error C2466:
cannot allocate an array of constant size 0
../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0 ../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0The fix is to simplify the code and remove the zero-size array.
Signed-off-by Andre Muezerie <[email protected]>
Looks simple enough and valid.
Signature · 1 line
David Marchand
David Marchand
AppliedQuoted 11 lines · Andre Muezerie
When compiling with MSVC the error below pops up:
../app/test/test_ipfrag.c(39): error C2466:
cannot allocate an array of constant size 0
../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0 ../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0The fix is to simplify the code and remove the zero-size array.
Signed-off-by Andre Muezerie <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand