Avoid potential divide by zero in INF call.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-08-05 12:42:31 +01:00
parent d9f8e6b525
commit 397e8afc1a
1 changed files with 8 additions and 5 deletions

View File

@ -728,11 +728,14 @@ data_thread_image(void *data, Ecore_Thread *thread EINA_UNUSED)
struct stat st;
if (!iw->path || (stat(iw->path, &st))) st.st_size = 0;
INF("Wrote %9i bytes (%4iKb) for \"%s\" image entry \"%s\" compress: [raw: %2.1f%%] [real: %2.1f%%]",
bytes, (bytes + 512) / 1024, buf, iw->img->entry,
100 - (100 * (double)bytes) / ((double)(iw->w * iw->h * 4)),
100 - (100 * (double)bytes) / ((double)(st.st_size))
);
if (st.st_size > 0)
{
INF("Wrote %9i bytes (%4iKb) for \"%s\" image entry \"%s\" compress: [raw: %2.1f%%] [real: %2.1f%%]",
bytes, (bytes + 512) / 1024, buf, iw->img->entry,
100 - (100 * (double)bytes) / ((double)(iw->w * iw->h * 4)),
100 - (100 * (double)bytes) / ((double)(st.st_size))
);
}
}
}