PhotoRec: if less than 10 file famillies are enabled, display the results even if zero file have been found yet.

This commit is contained in:
Christophe Grenier 2012-01-27 08:43:56 +01:00
parent d256adb147
commit 71d5bddcff

View file

@ -49,7 +49,6 @@ void photorec_info(WINDOW *window, const file_stat_t *file_stats)
{
unsigned int i;
unsigned int nbr;
unsigned int others=0;
file_stat_t *new_file_stats;
for(i=0;file_stats[i].file_hint!=NULL;i++);
nbr=i;
@ -58,6 +57,21 @@ void photorec_info(WINDOW *window, const file_stat_t *file_stats)
new_file_stats=(file_stat_t*)MALLOC(nbr*sizeof(file_stat_t));
memcpy(new_file_stats, file_stats, nbr*sizeof(file_stat_t));
qsort(new_file_stats, nbr, sizeof(file_stat_t), sorfile_stat_ts);
if(nbr<=10)
{
for(i=0; i<nbr; i++)
{
wmove(window,11+i,0);
wclrtoeol(window);
wprintw(window, "%s: %u recovered\n",
(new_file_stats[i].file_hint->extension!=NULL?
new_file_stats[i].file_hint->extension:""),
new_file_stats[i].recovered);
}
}
else
{
unsigned int others=0;
for(i=0;i<nbr && new_file_stats[i].recovered>0;i++)
{
if(i<10)
@ -78,6 +92,7 @@ void photorec_info(WINDOW *window, const file_stat_t *file_stats)
wclrtoeol(window);
wprintw(window, "others: %u recovered\n", others);
}
}
free(new_file_stats);
}