Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc

    r10768 r10821  
    124124            std::string shortcut;
    125125            std::string value;
    126             for (unsigned int i = 0; i < arguments.size(); ++i)
    127             {
    128                 if (arguments[i].size() != 0)
     126            for (auto & argument : arguments)
     127            {
     128                if (argument.size() != 0)
    129129                {
    130130                    // sure not ""
    131                     if (arguments[i][0] == '-')
     131                    if (argument[0] == '-')
    132132                    {
    133133                        // start with "-"
    134                         if (arguments[i].size() == 1)
     134                        if (argument.size() == 1)
    135135                        {
    136136                            // argument[i] is "-", probably a minus sign
    137137                            value += "- ";
    138138                        }
    139                         else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
     139                        else if (argument[1] <= 57 && argument[1] >= 48)
    140140                        {
    141141                            // negative number as a value
    142                             value += arguments[i] + ' ';
     142                            value += argument + ' ';
    143143                        }
    144144                        else
     
    161161                            }
    162162
    163                             if (arguments[i][1] == '-')
     163                            if (argument[1] == '-')
    164164                            {
    165165                                // full name argument with "--name"
    166                                 name = arguments[i].substr(2);
     166                                name = argument.substr(2);
    167167                            }
    168168                            else
    169169                            {
    170170                                // shortcut with "-s"
    171                                 shortcut = arguments[i].substr(1);
     171                                shortcut = argument.substr(1);
    172172                            }
    173173
     
    186186
    187187                        // Concatenate strings as long as there's no new argument by "-" or "--"
    188                         value += arguments[i] + ' ';
     188                        value += argument + ' ';
    189189                    }
    190190                }
Note: See TracChangeset for help on using the changeset viewer.