Changeset 1280 for cpp


Ignore:
Timestamp:
09/10/23 01:51:57 (15 months ago)
Author:
Maciej Komosinski
Message:

Added explicit type casts (size_t vs. int etc.)

Location:
cpp
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd_math.cpp

    r1275 r1280  
    8989
    9090namespace fpExcept
    91 { //shared for all platform, using crossplatform constants, can be defined in build_config (but also conditionally changed from the code)
     91{ //shared for all platforms, using crossplatform constants, can be defined in build_config (but also conditionally changed from the code)
    9292int wanted_exceptions =
    9393#ifdef WANTED_FP_EXCEPTIONS
  • cpp/frams/genetics/f9/f9_conv.cpp

    r1157 r1280  
    9292int GenoConv_f90::findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &vertex)
    9393{
    94         for (size_t i = 0; i < vertices.size(); i++)
     94        for (int i = 0; i < vertices.size(); i++)
    9595                if (vertices[i].same_coordinates(vertex)) return i;
    9696        return -1;
  • cpp/frams/genetics/fF/fF_oper.cpp

    r1130 r1280  
    4949        par.load(gene);
    5050        static const int propsToMutate[] = fF_PROPS_TO_MUTATE;
    51         int which = rndUint(std::size(propsToMutate));
     51        int which = rndUint((unsigned int)std::size(propsToMutate));
    5252        bool mutated_ok = GenoOperators::mutatePropertyNaive(par.param, propsToMutate[which]);
    5353        if (mutated_ok)
  • cpp/frams/genetics/fL/fL_general.cpp

    r1273 r1280  
    555555        //branch->processDefinition(this);
    556556
    557         builtincount = words.size();
     557        builtincount = (int)words.size();
    558558}
    559559
     
    13831383int fL_Builder::countDefinedWords()
    13841384{
    1385         return words.size() - builtincount;
     1385        return (int)words.size() - builtincount;
    13861386}
    13871387
    13881388int fL_Builder::countWordsInLSystem()
    13891389{
    1390         int count = genotype.size();
     1390        size_t count = genotype.size();
    13911391        for (fL_Rule *rul : rules)
    13921392        {
     
    13941394        }
    13951395        count += words.size();
    1396         return count;
     1396        return int(count);
    13971397}
    13981398
  • cpp/frams/model/autoname.cpp

    r1130 r1280  
    5959static void przeplatanka(char *out, char *in1, char *in2)
    6060{
    61         int d1 = strlen(in1), d2 = strlen(in2);
     61        int d1 = (int)strlen(in1), d2 = (int)strlen(in2);
    6262        int p1 = 0, p2 = 0;
    6363        int pp = d1 + d2;
  • cpp/frams/model/model.cpp

    r1215 r1280  
    610610int Model::getCheckpointCount()
    611611{
    612         return checkpoints.size();
     612        return (int)checkpoints.size();
    613613}
    614614
  • cpp/frams/model/modelparts.h

    r1122 r1280  
    229229        SString name, longname, description;
    230230        ParamEntry *props;
    231         bool ownedprops;//< destructor will free props using ParamObject::freeParamTab
     231        bool ownedprops; //< destructor will free props using ParamObject::freeParamTab
    232232        paInt prefinputs, prefoutput;
    233233        paInt preflocation;
     
    304304                return vectordata;
    305305        }
    306         void setSymbolGlyph(int *data, bool owned = 1)
     306        void setSymbolGlyph(int *data, bool owned = true)
    307307        {
    308308                if (vectordata && ownedvectordata) delete[]vectordata;
    309                 vectordata = data; ownedvectordata = owned;
     309                vectordata = data;
     310                ownedvectordata = owned;
    310311        }
    311312        /** additional information about how the neuron should be drawn
  • cpp/frams/model/similarity/simil-match.cpp

    r1044 r1280  
    6969
    7070        // return the result
    71         return m_apvMatched[Obj]->size();
     71        return (int)m_apvMatched[Obj]->size();
    7272}
    7373
  • cpp/frams/util/sstring-simple.cpp

    r1130 r1280  
    7878void SString::endWrite(int newlength)
    7979{
    80         if (newlength < 0) newlength = strlen(txt);
     80        if (newlength < 0) newlength = (int)strlen(txt);
    8181        else
    8282        {
     
    9595void SString::endAppend(int newappend)
    9696{
    97         if (newappend < 0) endWrite(appending + strlen(txt + appending));
     97        if (newappend < 0) endWrite(appending + (int)strlen(txt + appending));
    9898        else endWrite(newappend + appending);
    9999}
     
    104104{
    105105        if (!s) return;
    106         int x = strlen(s);
     106        int x = (int)strlen(s);
    107107        if (!x) return;
    108108        append(s, x);
     
    137137{
    138138        if (!ch) chlen = 0;
    139         else if (chlen < 0) chlen = strlen(ch);
     139        else if (chlen < 0) chlen = (int)strlen(ch);
    140140        if (chlen)
    141141        {
Note: See TracChangeset for help on using the changeset viewer.