Gitweb links:

...log 
http://git.netsurf-browser.org/libcss.git/shortlog/04976d7f23da03e4bebbe50fd3548c8b4d7c26fc
...commit 
http://git.netsurf-browser.org/libcss.git/commit/04976d7f23da03e4bebbe50fd3548c8b4d7c26fc
...tree 
http://git.netsurf-browser.org/libcss.git/tree/04976d7f23da03e4bebbe50fd3548c8b4d7c26fc

The branch, master has been updated
       via  04976d7f23da03e4bebbe50fd3548c8b4d7c26fc (commit)
      from  5926dfdd6fa9053ed40d9b0207b563cf3aec48d1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=04976d7f23da03e4bebbe50fd3548c8b4d7c26fc
commit 04976d7f23da03e4bebbe50fd3548c8b4d7c26fc
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Floating point maths: Squash clang warning
    
    Implicit conversion from 'int' to 'float' changes value from 2147483647
    to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]

diff --git a/include/libcss/fpmath.h b/include/libcss/fpmath.h
index bed5ee6..d7cac4d 100644
--- a/include/libcss/fpmath.h
+++ b/include/libcss/fpmath.h
@@ -99,10 +99,12 @@ css_float_to_fixed(const float a) {
        float xx = a * (float) (1 << CSS_RADIX_POINT);
 
        if (xx < INT_MIN)
-               xx = INT_MIN;
+               return INT_MIN;
 
-       if (xx > INT_MAX)
-               xx = INT_MAX;
+       /* Conversion from int to float changes value from
+        * 2147483647 to 2147483648, so we use >= instead of >. */
+       if (xx >= (float)INT_MAX)
+               return INT_MAX;
 
        return (css_fixed) xx;
 }


-----------------------------------------------------------------------

Summary of changes:
 include/libcss/fpmath.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/libcss/fpmath.h b/include/libcss/fpmath.h
index bed5ee6..d7cac4d 100644
--- a/include/libcss/fpmath.h
+++ b/include/libcss/fpmath.h
@@ -99,10 +99,12 @@ css_float_to_fixed(const float a) {
        float xx = a * (float) (1 << CSS_RADIX_POINT);
 
        if (xx < INT_MIN)
-               xx = INT_MIN;
+               return INT_MIN;
 
-       if (xx > INT_MAX)
-               xx = INT_MAX;
+       /* Conversion from int to float changes value from
+        * 2147483647 to 2147483648, so we use >= instead of >. */
+       if (xx >= (float)INT_MAX)
+               return INT_MAX;
 
        return (css_fixed) xx;
 }


-- 
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to