[Libreoffice] [REVIEW 3-4] Fix for fdo#39589

Lionel Elie Mamane lionel at mamane.lu
Wed Nov 23 22:50:16 PST 2011


On Wed, Nov 23, 2011 at 06:53:53PM -0500, Kohei Yoshida wrote:

> I'd like to have

> http://cgit.freedesktop.org/libreoffice/core/commit/?id=0215f8b19451ab67c7fdaf91f2da8298a9b89c47

> cherry-picked to the 3-4 branch.  It fixes

> https://bugs.freedesktop.org/show_bug.cgi?id=39589

I see how ulimit_cast is the wrong choice there, but:

If I understand well, static_cast<unsigned int>(a) where a is a signed
int returns a+2^n where n is the length of int in bits.

For example, for 32 bit ints, static_cast<unsigned int>(-1) is
2^32-1.

Why is that the best solution, rather than 0, which as far as I
understand, limit_cast<unsigned int>(a) would use?

-- 
Lionel


More information about the LibreOffice mailing list