Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8364

TStreamerElement.cxx: some else-if branches will never be chosen

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • High
    • Resolution: Fixed
    • None
    • 6.08/00
    • Core Libraries
    • None
    • Friendly

    Description

      Something is very wrong with this chain of else-ifs:

         if      (strstr(s,"vector"))                 fSTLtype = ROOT::kSTLvector;
         else if (strstr(s,"list"))                   fSTLtype = ROOT::kSTLlist;
         else if (strstr(s,"forward_list"))           fSTLtype = ROOT::kSTLforwardlist;
         else if (strstr(s,"deque"))                  fSTLtype = ROOT::kSTLdeque;
         else if (strstr(s,"multimap"))               fSTLtype = ROOT::kSTLmultimap;
         else if (strstr(s,"multiset"))               fSTLtype = ROOT::kSTLmultiset;
         else if (strstr(s,"bitset"))                 fSTLtype = ROOT::kSTLbitset;
         else if (strstr(s,"map"))                    fSTLtype = ROOT::kSTLmap;
         else if (strstr(s,"set"))                    fSTLtype = ROOT::kSTLset;
         else if (strstr(s,"unordered_set"))          fSTLtype = ROOT::kSTLunorderedset;
         else if (strstr(s,"unordered_multiset"))     fSTLtype = ROOT::kSTLunorderedmultiset;
         else if (strstr(s,"unordered_map"))          fSTLtype = ROOT::kSTLunorderedmap;
         else if (strstr(s,"unordered_multimap"))     fSTLtype = ROOT::kSTLunorderedmultimap;

      I think check for "list" substring matches string with "forward_list" substring and check for ordered containers matches their unordered counterparts.

      Was found by PVS-Studio static analyzer.

      Attachments

        Activity

          People

            pcanal Philippe Canal
            anerokhi Andrey Erokhin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: