summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-11-08 16:40:51 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-11-09 12:18:59 +0000
commitdd677aa2f65fa025fa8e76bcd30a37141e36afa3 (patch)
treeefd233036dec5eb0a898f6d06675ee4231a168ce
parent5641910ed24e1037d347ad991abdef328424b1ca (diff)
eina file test - warn - silence wanring wirth a bit of hand str trunc
truncation is intended. the way i can find to silence the warning is use memcpy with a manually computed size...
-rw-r--r--src/tests/eina/eina_test_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 242922083f..5a473a2e4b 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -317,6 +317,7 @@ EFL_START_TEST(eina_file_map_new_test)
317 int test_file2_name_part_size = strlen(test_file2_name_part); 317 int test_file2_name_part_size = strlen(test_file2_name_part);
318 int test_dirname_size; 318 int test_dirname_size;
319 int start_point_final, last_chunk_size; 319 int start_point_final, last_chunk_size;
320 size_t size;
320 321
321 Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir(); 322 Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
322 fail_if(test_dirname == NULL); 323 fail_if(test_dirname == NULL);
@@ -340,7 +341,9 @@ EFL_START_TEST(eina_file_map_new_test)
340 last_chunk_size = big_buffer_size - iteration_number * template_size - file_min_offset; 341 last_chunk_size = big_buffer_size - iteration_number * template_size - file_min_offset;
341 //calculating start point for final iteration_number 342 //calculating start point for final iteration_number
342 start_point_final = iteration_number * template_size; 343 start_point_final = iteration_number * template_size;
343 strncpy ((big_buffer + start_point_final), template, last_chunk_size); 344 size = strlen(template);
345 if (size > (size_t)last_chunk_size) size = last_chunk_size;
346 memcpy((big_buffer + start_point_final), template, size);
344 // set last element of big_buffer in '\0' - end of string 347 // set last element of big_buffer in '\0' - end of string
345 big_buffer[big_buffer_size - file_min_offset] = '\0'; 348 big_buffer[big_buffer_size - file_min_offset] = '\0';
346 // check big_buffer valid length 349 // check big_buffer valid length