Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-72286

qt-everywhere-src-5.11.3/qtbase/src/corelib/codecs/qwindowscodec.cpp:182: bad error checking ?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.12.1, 5.12.2
    • 5.11.3
    • Core: Other
    • None
    • All
    • 2c6ec2c653af7f04bb98c6403b2e406cd493a8ab (qt/qtbase/5.12)

    Description

      qt-everywhere-src-5.11.3/qtbase/src/corelib/codecs/qwindowscodec.cpp:182]: (style) Checking if unsigned variable 'size' is less than zero.

      Source code is

      size_t size = mbstowcs(NULL, mb, length);
       if (size < 0) {
       Q_ASSERT("Error in CE TextCodec");
       return QString();
       }
      

      Maybe better code

       

      size_t size = mbstowcs(NULL, mb, length);
       if (size == (size_t) -1) {
       Q_ASSERT("Error in CE TextCodec");
       return QString();
       }
      

      Attachments

        For Gerrit Dashboard: QTBUG-72286
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            dcb David Binderman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes