summaryrefslogtreecommitdiff
path: root/src/lib/ethumb
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-20 14:52:53 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-20 16:39:30 -0800
commitfb418debc3a87fb9361d48f7ade10fe0e589e92d (patch)
tree0ffd9da7cd715f75bf87ffd7542a417fa3c40e4a /src/lib/ethumb
parent4a7954248037015c900e03669ad0180691f40e2e (diff)
ethumb: fix float comparison warning.
Diffstat (limited to 'src/lib/ethumb')
-rw-r--r--src/lib/ethumb/ethumb.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c
index b66c3f41c2..f7b4b467f5 100644
--- a/src/lib/ethumb/ethumb.c
+++ b/src/lib/ethumb/ethumb.c
@@ -1151,7 +1151,7 @@ ethumb_calculate_aspect_from_ratio(Ethumb *e, float ia, int *w, int *h)
1151 *w = e->tw; 1151 *w = e->tw;
1152 *h = e->th; 1152 *h = e->th;
1153 1153
1154 if (ia == 0) 1154 if (EINA_FLT_CMP(ia, 0))
1155 return; 1155 return;
1156 1156
1157 a = e->tw / (float)e->th; 1157 a = e->tw / (float)e->th;
@@ -1190,7 +1190,7 @@ ethumb_calculate_fill_from_ratio(Ethumb *e, float ia, int *fx, int *fy, int *fw,
1190 *fx = 0; 1190 *fx = 0;
1191 *fy = 0; 1191 *fy = 0;
1192 1192
1193 if (ia == 0) 1193 if (EINA_FLT_CMP(ia, 0))
1194 return; 1194 return;
1195 1195
1196 a = e->tw / (float)e->th; 1196 a = e->tw / (float)e->th;
@@ -1738,10 +1738,19 @@ ethumb_dup(const Ethumb *e)
1738#define CHECK_DELTA(Param) \ 1738#define CHECK_DELTA(Param) \
1739 if (e1->Param != e2->Param) \ 1739 if (e1->Param != e2->Param) \
1740 return EINA_TRUE; 1740 return EINA_TRUE;
1741#define CHECK_FLT_DELTA(Param) \
1742 if (!EINA_FLT_CMP(e1->Param, e2->Param)) \
1743 return EINA_TRUE;
1741 1744
1742EAPI Eina_Bool 1745EAPI Eina_Bool
1743ethumb_cmp(const Ethumb *e1, const Ethumb *e2) 1746ethumb_cmp(const Ethumb *e1, const Ethumb *e2)
1744{ 1747{
1748 CHECK_FLT_DELTA(crop_x);
1749 CHECK_FLT_DELTA(crop_y);
1750 CHECK_FLT_DELTA(video.start);
1751 CHECK_FLT_DELTA(video.time);
1752 CHECK_FLT_DELTA(video.interval);
1753
1745 CHECK_DELTA(thumb_dir); 1754 CHECK_DELTA(thumb_dir);
1746 CHECK_DELTA(category); 1755 CHECK_DELTA(category);
1747 CHECK_DELTA(tw); 1756 CHECK_DELTA(tw);
@@ -1749,15 +1758,10 @@ ethumb_cmp(const Ethumb *e1, const Ethumb *e2)
1749 CHECK_DELTA(format); 1758 CHECK_DELTA(format);
1750 CHECK_DELTA(aspect); 1759 CHECK_DELTA(aspect);
1751 CHECK_DELTA(orientation); 1760 CHECK_DELTA(orientation);
1752 CHECK_DELTA(crop_x);
1753 CHECK_DELTA(crop_y);
1754 CHECK_DELTA(quality); 1761 CHECK_DELTA(quality);
1755 CHECK_DELTA(compress); 1762 CHECK_DELTA(compress);
1756 CHECK_DELTA(rw); 1763 CHECK_DELTA(rw);
1757 CHECK_DELTA(rh); 1764 CHECK_DELTA(rh);
1758 CHECK_DELTA(video.start);
1759 CHECK_DELTA(video.time);
1760 CHECK_DELTA(video.interval);
1761 CHECK_DELTA(video.ntimes); 1765 CHECK_DELTA(video.ntimes);
1762 CHECK_DELTA(video.fps); 1766 CHECK_DELTA(video.fps);
1763 CHECK_DELTA(document.page); 1767 CHECK_DELTA(document.page);
@@ -1771,8 +1775,12 @@ ethumb_length(EINA_UNUSED const void *key)
1771 return sizeof (Ethumb); 1775 return sizeof (Ethumb);
1772} 1776}
1773 1777
1774#define CMP_PARAM(Param) \ 1778#define CMP_PARAM(Param) \
1775 if (e1->Param != e2->Param) \ 1779 if (e1->Param != e2->Param) \
1780 return e1->Param - e2->Param;
1781
1782#define CMP_FLT_PARAM(Param) \
1783 if (!EINA_FLT_CMP(e1->Param, e2->Param)) \
1776 return e1->Param - e2->Param; 1784 return e1->Param - e2->Param;
1777 1785
1778EAPI int 1786EAPI int
@@ -1782,6 +1790,12 @@ ethumb_key_cmp(const void *key1, EINA_UNUSED int key1_length,
1782 const Ethumb *e1 = key1; 1790 const Ethumb *e1 = key1;
1783 const Ethumb *e2 = key2; 1791 const Ethumb *e2 = key2;
1784 1792
1793 CMP_FLT_PARAM(crop_x);
1794 CMP_FLT_PARAM(crop_y);
1795 CMP_FLT_PARAM(video.start);
1796 CMP_FLT_PARAM(video.time);
1797 CMP_FLT_PARAM(video.interval);
1798
1785 CMP_PARAM(thumb_dir); 1799 CMP_PARAM(thumb_dir);
1786 CMP_PARAM(category); 1800 CMP_PARAM(category);
1787 CMP_PARAM(tw); 1801 CMP_PARAM(tw);
@@ -1789,15 +1803,10 @@ ethumb_key_cmp(const void *key1, EINA_UNUSED int key1_length,
1789 CMP_PARAM(format); 1803 CMP_PARAM(format);
1790 CMP_PARAM(aspect); 1804 CMP_PARAM(aspect);
1791 CMP_PARAM(orientation); 1805 CMP_PARAM(orientation);
1792 CMP_PARAM(crop_x);
1793 CMP_PARAM(crop_y);
1794 CMP_PARAM(quality); 1806 CMP_PARAM(quality);
1795 CMP_PARAM(compress); 1807 CMP_PARAM(compress);
1796 CMP_PARAM(rw); 1808 CMP_PARAM(rw);
1797 CMP_PARAM(rh); 1809 CMP_PARAM(rh);
1798 CMP_PARAM(video.start);
1799 CMP_PARAM(video.time);
1800 CMP_PARAM(video.interval);
1801 CMP_PARAM(video.ntimes); 1810 CMP_PARAM(video.ntimes);
1802 CMP_PARAM(video.fps); 1811 CMP_PARAM(video.fps);
1803 CMP_PARAM(document.page); 1812 CMP_PARAM(document.page);