Fix a loop indexing problem in all file system tests
This commit is contained in:
parent
b93af2189b
commit
a512e7dc1d
@ -619,10 +619,19 @@ static int fstest_delfiles(void)
|
||||
|
||||
int ndx = (rand() % (g_nfiles - g_ndeleted));
|
||||
|
||||
/* And delete the next undeleted file after that random index */
|
||||
/* And delete the next undeleted file after that random index. NOTE
|
||||
* that the entry at ndx is not checked.
|
||||
*/
|
||||
|
||||
for (j = ndx + 1; j != ndx;)
|
||||
for (j = ndx + 1; j != ndx; j++)
|
||||
{
|
||||
/* Test for wrap-around */
|
||||
|
||||
if (j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
file = &g_files[j];
|
||||
if (file->name && !file->deleted)
|
||||
{
|
||||
@ -644,14 +653,6 @@ static int fstest_delfiles(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Increment the index and test for wrap-around */
|
||||
|
||||
if (++j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,10 +652,19 @@ static int nxffs_delfiles(void)
|
||||
|
||||
int ndx = (rand() % (g_nfiles - g_ndeleted));
|
||||
|
||||
/* And delete the next undeleted file after that random index */
|
||||
/* And delete the next undeleted file after that random index. NOTE
|
||||
* that the entry at ndx is not checked.
|
||||
*/
|
||||
|
||||
for (j = ndx + 1; j != ndx;)
|
||||
for (j = ndx + 1; j != ndx; j++)
|
||||
{
|
||||
/* Test for wrap-around */
|
||||
|
||||
if (j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
file = &g_files[j];
|
||||
if (file->name && !file->deleted)
|
||||
{
|
||||
@ -677,14 +686,6 @@ static int nxffs_delfiles(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Increment the index and test for wrap-around */
|
||||
|
||||
if (++j >= CONFIG_EXAMPLES_NXFFS_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -657,10 +657,19 @@ static int smart_delfiles(void)
|
||||
|
||||
int ndx = (rand() % (g_nfiles - g_ndeleted));
|
||||
|
||||
/* And delete the next undeleted file after that random index */
|
||||
/* And delete the next undeleted file after that random index. NOTE
|
||||
* that the entry at ndx is not checked.
|
||||
*/
|
||||
|
||||
for (j = ndx + 1; j != ndx;)
|
||||
for (j = ndx + 1; j != ndx; j++)
|
||||
{
|
||||
/* Test for wrap-around */
|
||||
|
||||
if (j >= CONFIG_EXAMPLES_FSTEST_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
file = &g_files[j];
|
||||
if (file->name && !file->deleted)
|
||||
{
|
||||
@ -682,14 +691,6 @@ static int smart_delfiles(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Increment the index and test for wrap-around */
|
||||
|
||||
if (++j >= CONFIG_EXAMPLES_SMART_MAXOPEN)
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user