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

Julien Nabet <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Julien Nabet <[email protected]> ---
Noel: the asserts have been added with
https://cgit.freedesktop.org/libreoffice/core/commit/?id=d66f266cf24d09c2ceb9320f1355ba27114187c2
"convert SDR*ALIGN constants to scoped enum"

void SetHorzAlign(SdrAlign nAlg)                { assert((nAlg &
static_cast<SdrAlign>(0xff)) == SdrAlign::NONE); nAlign = SdrAlign(nAlign &
static_cast<SdrAlign>(0xFF00)) | (nAlg & static_cast<SdrAlign>(0x00FF)); }

void SetVertAlign(SdrAlign nAlg)                { assert((nAlg &
static_cast<SdrAlign>(0xff00)) == SdrAlign::NONE); nAlign = SdrAlign(nAlign &
static_cast<SdrAlign>(0x00FF)) | (nAlg & static_cast<SdrAlign>(0xFF00)); }

51  enum class SdrAlign
52  {
53      NONE          = 0x0000,
54      HORZ_CENTER   = 0x0000,
55      HORZ_LEFT     = 0x0001,
56      HORZ_RIGHT    = 0x0002,
57      HORZ_DONTCARE = 0x0010,
58      VERT_CENTER   = 0x0000,
59      VERT_TOP      = 0x0100,
60      VERT_BOTTOM   = 0x0200,
61      VERT_DONTCARE = 0x1000,
62  };

If we take the example of SetVertAlign (but there's the same pb with
SetHorzAlign):
assert((nAlg & static_cast<SdrAlign>(0xff00)) == SdrAlign::NONE)
it means the method should work only if we call it with HORZ enum.

I thought about 2 possibilities:
a) assert((nAlg & static_cast<SdrAlign>(0xff00)) != SdrAlign::NONE)
we want an align which includes a vert part. (whatever horizontal part)
b) assert((nAlg & static_cast<SdrAlign>(0x00ff)) == SdrAlign::NONE)
we don't want SetVertAlign includes an horizontal part.

I think b) should be right one, any opinion?

-- 
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