forked from enlightenment/efl
edje_cc - fix potential divide by 0 in info output if file size is 0
this will realistically never happen in a sane case... but its theoretically possible. fixes CID 1366923
This commit is contained in:
parent
f6638432d3
commit
5b4c032fb5
|
@ -786,6 +786,7 @@ data_thread_fonts(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
char buf[EINA_PATH_MAX];
|
char buf[EINA_PATH_MAX];
|
||||||
char buf2[EINA_PATH_MAX];
|
char buf2[EINA_PATH_MAX];
|
||||||
|
size_t size;
|
||||||
|
|
||||||
f = eina_file_open(fc->fn->file, 0);
|
f = eina_file_open(fc->fn->file, 0);
|
||||||
if (f)
|
if (f)
|
||||||
|
@ -835,9 +836,10 @@ data_thread_fonts(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size = eina_file_size_get(f);
|
||||||
INF("Wrote %9i bytes (%4iKb) for \"%s\" font entry \"%s\" compress: [real: %2.1f%%]",
|
INF("Wrote %9i bytes (%4iKb) for \"%s\" font entry \"%s\" compress: [real: %2.1f%%]",
|
||||||
bytes, (bytes + 512) / 1024, buf, fc->fn->file,
|
bytes, (bytes + 512) / 1024, buf, fc->fn->file,
|
||||||
100 - (100 * (double)bytes) / ((double)(eina_file_size_get(f)))
|
100 - (100 * (double)bytes) / ((double)((size > 0) ? size : 1))
|
||||||
);
|
);
|
||||||
eina_file_map_free(f, m);
|
eina_file_map_free(f, m);
|
||||||
eina_file_close(f);
|
eina_file_close(f);
|
||||||
|
|
Loading…
Reference in New Issue