forked from enlightenment/efl
eina: include blank lines in file iterator T2237
any line that would not have been included before has length == 0
This commit is contained in:
parent
3a64b0ccd3
commit
128a78940b
|
@ -552,17 +552,18 @@ _eina_file_map_lines_iterator_next(Eina_Lines_Iterator *it, void **data)
|
||||||
|
|
||||||
if (it->current.end >= it->end)
|
if (it->current.end >= it->end)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
if (it->current.index == 0)
|
|
||||||
it->current.index++;
|
|
||||||
|
|
||||||
match = *it->current.end;
|
match = *it->current.end;
|
||||||
|
if (it->current.index > 0)
|
||||||
|
it->current.end++;
|
||||||
while ((*it->current.end == '\n' || *it->current.end == '\r')
|
while ((*it->current.end == '\n' || *it->current.end == '\r')
|
||||||
&& it->current.end < it->end)
|
&& it->current.end < it->end)
|
||||||
{
|
{
|
||||||
if (match == *it->current.end)
|
if (match == *it->current.end)
|
||||||
it->current.index++;
|
break;
|
||||||
it->current.end++;
|
it->current.end++;
|
||||||
}
|
}
|
||||||
|
it->current.index++;
|
||||||
|
|
||||||
if (it->current.end == it->end)
|
if (it->current.end == it->end)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
|
@ -407,8 +407,7 @@ START_TEST(eina_test_file_virtualize)
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
Eina_File_Line *ln;
|
Eina_File_Line *ln;
|
||||||
void *map;
|
void *map;
|
||||||
const unsigned int check[] = { 1, 2, 3, 6, 7 };
|
unsigned int i = 0;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
|
@ -430,13 +429,16 @@ START_TEST(eina_test_file_virtualize)
|
||||||
it = eina_file_map_lines(f);
|
it = eina_file_map_lines(f);
|
||||||
EINA_ITERATOR_FOREACH(it, ln)
|
EINA_ITERATOR_FOREACH(it, ln)
|
||||||
{
|
{
|
||||||
fail_if(ln->index != check[i]);
|
|
||||||
i++;
|
i++;
|
||||||
|
fail_if(ln->index != i);
|
||||||
|
|
||||||
|
if (i == 4 || i == 5)
|
||||||
|
fail_if(ln->length != 0);
|
||||||
}
|
}
|
||||||
fail_if(eina_iterator_container_get(it) != f);
|
fail_if(eina_iterator_container_get(it) != f);
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
fail_if(i != 5);
|
fail_if(i != 7);
|
||||||
|
|
||||||
eina_file_close(f);
|
eina_file_close(f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue