Skip to content

Commit 5f57b89

Browse files
author
Deepika
committed
Resolved: [Error] main.cpp@115,34: [Pe266]: "size" is ambiguous
`size` is part of std library since c++17, and results in build errors for IAR 8.x. https://en.cppreference.com/w/cpp/iterator/size
1 parent a356db1 commit 5f57b89

File tree

2 files changed

+12
-6
lines changed
  • components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem

2 files changed

+12
-6
lines changed

components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem/files/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
7575
FILE *fd[MBED_TEST_FILES];
7676
struct dirent ent;
7777
struct dirent *ed;
78-
size_t size;
7978
uint8_t buffer[MBED_TEST_BUFFER];
8079
uint8_t rbuffer[MBED_TEST_BUFFER];
8180
uint8_t wbuffer[MBED_TEST_BUFFER];
@@ -107,6 +106,7 @@ void test_simple_file_test()
107106
TEST_ASSERT_EQUAL(0, res);
108107

109108
{
109+
size_t size;
110110
res = fs.mount(&bd);
111111
TEST_ASSERT_EQUAL(0, res);
112112
res = file[0].open(&fs, "hello", O_WRONLY | O_CREAT);

components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem/seek/main.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ DIR *dd[MBED_TEST_DIRS];
7575
FILE *fd[MBED_TEST_FILES];
7676
struct dirent ent;
7777
struct dirent *ed;
78-
size_t size;
7978
uint8_t buffer[MBED_TEST_BUFFER];
8079
uint8_t rbuffer[MBED_TEST_BUFFER];
8180
uint8_t wbuffer[MBED_TEST_BUFFER];
@@ -89,6 +88,7 @@ void test_seek_tests()
8988
TEST_ASSERT_EQUAL(0, res);
9089

9190
{
91+
size_t size;
9292
res = MBED_TEST_FILESYSTEM::format(&bd);
9393
TEST_ASSERT_EQUAL(0, res);
9494
res = fs.mount(&bd);
@@ -271,6 +271,7 @@ void test_simple_file_seek()
271271
TEST_ASSERT_EQUAL(0, res);
272272

273273
{
274+
size_t size;
274275
res = fs.mount(&bd);
275276
TEST_ASSERT_EQUAL(0, res);
276277
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@@ -318,7 +319,7 @@ void test_simple_file_seek()
318319
res = memcmp(buffer, "kittycatcat", size);
319320
TEST_ASSERT_EQUAL(0, res);
320321

321-
size_t size = file[0].size();
322+
size = file[0].size();
322323
res = file[0].seek(0, SEEK_CUR);
323324
TEST_ASSERT_EQUAL(size, res);
324325
res = file[0].close();
@@ -337,6 +338,7 @@ void test_large_file_seek()
337338
TEST_ASSERT_EQUAL(0, res);
338339

339340
{
341+
size_t size;
340342
res = fs.mount(&bd);
341343
TEST_ASSERT_EQUAL(0, res);
342344
res = file[0].open(&fs, "hello/kitty42", O_RDONLY);
@@ -384,7 +386,7 @@ void test_large_file_seek()
384386
res = memcmp(buffer, "kittycatcat", size);
385387
TEST_ASSERT_EQUAL(0, res);
386388

387-
size_t size = file[0].size();
389+
size = file[0].size();
388390
res = file[0].seek(0, SEEK_CUR);
389391
TEST_ASSERT_EQUAL(size, res);
390392
res = file[0].close();
@@ -403,6 +405,7 @@ void test_simple_file_seek_and_write()
403405
TEST_ASSERT_EQUAL(0, res);
404406

405407
{
408+
size_t size;
406409
res = fs.mount(&bd);
407410
TEST_ASSERT_EQUAL(0, res);
408411
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -450,7 +453,7 @@ void test_simple_file_seek_and_write()
450453
res = memcmp(buffer, "kittycatcat", size);
451454
TEST_ASSERT_EQUAL(0, res);
452455

453-
size_t size = file[0].size();
456+
size = file[0].size();
454457
res = file[0].seek(0, SEEK_CUR);
455458
TEST_ASSERT_EQUAL(size, res);
456459
res = file[0].close();
@@ -469,6 +472,7 @@ void test_large_file_seek_and_write()
469472
TEST_ASSERT_EQUAL(0, res);
470473

471474
{
475+
size_t size;
472476
res = fs.mount(&bd);
473477
TEST_ASSERT_EQUAL(0, res);
474478
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -518,7 +522,7 @@ void test_large_file_seek_and_write()
518522
res = memcmp(buffer, "kittycatcat", size);
519523
TEST_ASSERT_EQUAL(0, res);
520524

521-
size_t size = file[0].size();
525+
size = file[0].size();
522526
res = file[0].seek(0, SEEK_CUR);
523527
TEST_ASSERT_EQUAL(size, res);
524528
res = file[0].close();
@@ -537,6 +541,7 @@ void test_boundary_seek_and_write()
537541
TEST_ASSERT_EQUAL(0, res);
538542

539543
{
544+
size_t size;
540545
res = fs.mount(&bd);
541546
TEST_ASSERT_EQUAL(0, res);
542547
res = file[0].open(&fs, "hello/kitty42", O_RDWR);
@@ -583,6 +588,7 @@ void test_out_of_bounds_seek()
583588
TEST_ASSERT_EQUAL(0, res);
584589

585590
{
591+
size_t size;
586592
res = fs.mount(&bd);
587593
TEST_ASSERT_EQUAL(0, res);
588594
res = file[0].open(&fs, "hello/kitty42", O_RDWR);

0 commit comments

Comments
 (0)