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

            Bug ID: 103221
           Summary: core/tools/source/fsys/urlobj.cxx:4450: unmaintainable
                    code ?
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: dcb...@hotmail.com

tools/source/fsys/urlobj.cxx:4450:1: error: V502 Perhaps the '?:' operator
works in a different way than it was expected. The '?:' operator has a lower
priority than the '&&' operator.

Source code is


        eStyle = eStyle & FSYS_VOS
                 && m_aHost.isPresent()
                 && m_aHost.getLength() > 0 ?
                     FSYS_VOS :
                 hasDosVolume(eStyle)
                 || ((eStyle & FSYS_DOS) != 0
                    && m_aHost.isPresent()
                    && m_aHost.getLength() > 0) ?
                     FSYS_DOS :
                 eStyle & FSYS_UNX
                 && (!m_aHost.isPresent() || m_aHost.getLength() == 0) ?
                     FSYS_UNX :
                     FSysStyle(0);

What a mess ! Nested ternary operators are worth avoiding.

Suggest recode with a clear sequence of if-then-else statements.

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

Reply via email to