https://bugs.documentfoundation.org/show_bug.cgi?id=118716

--- Comment #8 from Noel Grandin <[email protected]> ---
Xisco, your change is correct, my patch was inadvisable.

In this code
   int a;
   std::max<sal_uInt16>(a,0)
std::max will first convert a and b to sal_uInt16, therefore potentially
converting a negative number to a positive number due to the conversion rules.
Then it will take the larger number.

While this code
    int a;
    static_cast<sal_uInt16>(a > 0 ? a : 0)
will compare first, and then convert the larger number to sal_uInt16, which
might result in making a "a" that is larger than 2^16 into a smaller value, but
which will never convert a negative "a" value into a positive value.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to