Changeset 319


Ignore:
Timestamp:
02/01/15 01:08:50 (9 years ago)
Author:
Maciej Komosinski
Message:

Fixed compilation warnings

Location:
cpp
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/stl-util.cpp

    r286 r319  
    2121{
    2222        string s; //clang crashed when this declaration was in s=buf
    23         long size = 256;
     23        int size = 256;
    2424        char* buf;
    2525        va_list ap_copy; // "va_list ap" can only by used once by printf-type functions as they advance the current argument pointer (crashed on linux x86_64)
     
    151151string stripExt(const string& filename)
    152152{
    153         int dot = filename.rfind('.');
     153        size_t dot = filename.rfind('.');
    154154        if (dot == string::npos) return filename;
    155         int sep = filename.rfind(PATH_SEPARATOR_CHAR);
     155        size_t sep = filename.rfind(PATH_SEPARATOR_CHAR);
    156156        if ((sep == string::npos) || (sep < dot))
    157157                return filename.substr(0, dot);
     
    161161string getFileExt(const string& filename)
    162162{
    163         int dot = filename.rfind('.');
     163        size_t dot = filename.rfind('.');
    164164        if (dot == string::npos) return string("");
    165         int sep = filename.rfind(PATH_SEPARATOR_CHAR);
     165        size_t sep = filename.rfind(PATH_SEPARATOR_CHAR);
    166166        if ((sep == string::npos) || (sep < dot))
    167167                return filename.substr(dot);
     
    171171string getFileDir(const string& filename)
    172172{
    173         int slash = filename.rfind(PATH_SEPARATOR_CHAR);
     173        size_t slash = filename.rfind(PATH_SEPARATOR_CHAR);
    174174        if (slash == string::npos) return string("");
    175175        return filename.substr(0, slash);
  • cpp/frams/_demos/genooper_test_fTest.cpp

    r286 r319  
    1515        {
    1616                int _method; //unused
    17                 int result = gft.mutate(g, chg, _method);
     17                /*int result = */gft.mutate(g, chg, _method);
    1818                printf("%s   [mutated %.1f%%]\n", g, chg * 100);
    1919        }
  • cpp/frams/_demos/part_shapes.cpp

    r286 r319  
    1111        Model m;
    1212        Part *p1, *p2;
    13         Joint *j;
    1413
    1514        m.open();
  • cpp/frams/_demos/serial_test.cpp

    r286 r319  
    3232        {
    3333        case TUnknown: puts("null"); return;
     34        case TInvalid: puts("invalid"); return;
    3435        case TInt: printf("int:"); break;
    3536        case TDouble: printf("double:"); break;
  • cpp/frams/canvas/nn_smart_layout.cpp

    r286 r319  
    1313#endif
    1414
    15 #define DB(x)
     15//#define DB(x) x
     16#define DB(x)
    1617
    1718#if DB(1)+0
     
    105106                h = maxy - miny + 1;
    106107                map = (char*)calloc(1, w*h);
    107                 int i, e;
    108                 DB(printf("mapa bloku #%ld\n", id));
    109                 for (i = 0; i < elementy.size(); i++)
    110                 {
    111                         e = elementy[i];
     108                DB(printf("mapa bloku #%d\n", id));
     109                for (size_t i = 0; i < elementy.size(); i++)
     110                {
     111                        int e = elementy[i];
    112112                        map[w*(einfo[e].y - miny) + (einfo[e].x - minx)] = 1;
    113113                }
    114                 DB(for (i = 0; i < h; i++){ for (e = 0; e < w; e++)printf("%c", map[w*i + e] ? '*' : '.'); printf("\n"); })
     114                DB(for (int i = 0; i < h; i++){ for (int e = 0; e < w; e++)printf("%c", map[w*i + e] ? '*' : '.'); printf("\n"); })
    115115        }
    116116
     
    154154{ // return 1 if successful
    155155        if (!moznadolaczyc(b, b2, dx, dy)) return 0; // merging causes no collision
    156         DB(printf("#%ld(%ld,%ld,%ld,%ld) + #%ld(%ld,%ld,%ld,%ld)<%ld,%ld>", b->id, b->minx, b->miny, b->maxx, b->maxy, b2->id, b2->minx, b2->miny, b2->maxx, b2->maxy, dx, dy));
     156        DB(printf("#%d(%d,%d,%d,%d) + #%d(%d,%d,%d,%d)<%d,%d>", b->id, b->minx, b->miny, b->maxx, b->maxy, b2->id, b2->minx, b2->miny, b2->maxx, b2->maxy, dx, dy));
    157157
    158158        b->zwolnijmape();
    159         int i, e;
    160         for (i = 0; i < b2->elementy.size(); i++)
    161         {
    162                 e = b2->elementy[i];
     159        for (size_t i = 0; i < b2->elementy.size(); i++)
     160        {
     161                int e = b2->elementy[i];
    163162                b->dodajelement(e, einfo[e].x + dx, einfo[e].y + dy);
    164163        }
     
    168167        b->maxy = max(b->maxy, dy + b2->maxy);
    169168
    170         DB(printf(" -> (%ld,%ld,%ld,%ld)\n", b->minx, b->miny, b->maxx, b->maxy));
    171 
    172         DB(printf(" ...#%ld...(%ld)...", b->id, b->elementy.size()));
    173         for (i = 0; i < b->elementy.size(); i++)
    174         {
    175                 e = b->elementy[i];
    176                 DB(assert(einfo[e].x >= b->minx);)
    177                         DB(assert(einfo[e].x <= b->maxx);)
    178                         DB(assert(einfo[e].y >= b->miny);)
    179                         DB(assert(einfo[e].y <= b->maxy);)
    180                         DB(printf("(%ld)%ld,%ld ", e, einfo[e].x, einfo[e].y));
    181         }
    182 
    183         DB(printf("\n"));
     169        DB(
     170        printf(" -> (%d,%d,%d,%d)\n", b->minx, b->miny, b->maxx, b->maxy);
     171
     172        printf(" ...#%d...(%d)...", b->id, b->elementy.size());
     173        for (size_t i = 0; i < b->elementy.size(); i++)
     174        {
     175                int e = b->elementy[i];
     176                assert(einfo[e].x >= b->minx);
     177                        assert(einfo[e].x <= b->maxx);
     178                        assert(einfo[e].y >= b->miny);
     179                        assert(einfo[e].y <= b->maxy);
     180                        printf("(%d)%d,%d ", e, einfo[e].x, einfo[e].y);
     181        }
     182
     183        printf("\n")
     184        );
    184185
    185186        delete b2;
     
    205206        dx = einfo[e].x - einfo[e2].x;
    206207        dy = einfo[e].y - einfo[e2].y;
    207         DB(printf("  elem.%ld (%ld,%ld@%ld) + elem.%ld (%ld,%ld@%ld)...\n", e, einfo[e].x, einfo[e].y, b->id, e2, einfo[e2].x, einfo[e2].y, b2->id));
     208        DB(printf("  elem.%d (%d,%d@%d) + elem.%d (%d,%d@%d)...\n", e, einfo[e].x, einfo[e].y, b->id, e2, einfo[e2].x, einfo[e2].y, b2->id));
    208209        if (dolaczblock(b, b2, dx - 1, dy)) return;
    209210        int proba; // retry - increasing the y offset (keeps x offset at -1)
     
    222223        if (einfo[e].block)
    223224        {
    224                 DB(printf("block#%ld exists\n", e));
     225                DB(printf("block#%d exists\n", e));
    225226                return;
    226227        }
     
    312313        {
    313314                DB(printf(" - - setting coordinates - -\n"));
    314                 int i;
    315315                DB(first->odtworzmape());
    316                 for (i = 0; i < first->elementy.size(); i++)
     316                for (size_t i = 0; i < first->elementy.size(); i++)
    317317                {
    318318                        el = first->elementy[i];
  • cpp/frams/genetics/f1/conv_f1.cpp

    r286 r319  
    1818{
    1919public:
    20 Builder(const char*g,int mapping=0):invalid(0),genbegin(g),usemapping(mapping),energ(0),energ_div(0),first_part_mapping(NULL) {}
     20Builder(const char*g,int mapping=0):invalid(0),genbegin(g),usemapping(mapping),first_part_mapping(NULL),energ(0),energ_div(0) {}
    2121~Builder() {SAFEDELETE(first_part_mapping);}
    2222char tmp[222];
  • cpp/frams/genetics/f9/conv_f9.cpp

    r286 r319  
    9191int GenoConv_f90::findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &vertex)
    9292{
    93         for (int i = 0; i < vertices.size(); i++)
     93        for (size_t i = 0; i < vertices.size(); i++)
    9494                if (vertices[i].same_coordinates(vertex)) return i;
    9595        return -1;
  • cpp/frams/genetics/f9/oper_f9.cpp

    r286 r319  
    3030        if (!gene[0]) return 1; //empty is not valid
    3131        bool ok = true;
    32         int i;
     32        size_t i;
    3333        for (i = 0; i < strlen(gene); i++) if (!strchr(turtle_commands_f9, gene[i])) { ok = false; break; }
    3434        return ok ? GENOPER_OK : i + 1;
     
    3939{
    4040        SString validated; //new genotype (everything except turtle_commands_f9 is skipped)
    41         for (int i = 0; i < strlen(gene); i++)
     41        for (size_t i = 0; i < strlen(gene); i++)
    4242                if (strchr(turtle_commands_f9, gene[i])) validated += gene[i];  //validated contains only turtle_commands_f9
    4343        free(gene);
  • cpp/frams/genetics/fF/conv_fF.cpp

    r286 r319  
    104104                double pcx = chambers[which - 1]->centerX;
    105105                double pcy = chambers[which - 1]->centerY;
    106                 double pcz = chambers[which - 1]->centerZ;
     106                //double pcz = chambers[which - 1]->centerZ; //not used
    107107
    108108                /* aperture of the next to last chamber */
    109109                double ppx;
    110110                double ppy;
    111                 double ppz;
     111                //double ppz; //not used
    112112
    113113                if (which == 1)
     
    115115                        ppx = pcx;
    116116                        ppy = pcy;
    117                         ppz = pcz;
     117                        //ppz = pcz;
    118118                }
    119119                else
     
    121121                        ppx = chambers[which - 2]->holeX;
    122122                        ppy = chambers[which - 2]->holeY;
    123                         ppz = chambers[which - 2]->holeZ;
     123                        //ppz = chambers[which - 2]->holeZ;
    124124                }
    125125
  • cpp/frams/genetics/fT/oper_fTest.cpp

    r286 r319  
    6565        if (!gene[0]) return 1; //empty is not valid
    6666        bool ok = true;
    67         int i;
     67        size_t i;
    6868        for (i = 0; i < strlen(gene); i++) if (!strchr("ATGC", gene[i])) { ok = false; break; }
    6969        return ok ? GENOPER_OK : i + 1;
     
    7474{
    7575        SString validated; //new genotype (everything except ATGC is skipped)
    76         for (int i = 0; i < strlen(gene); i++)
     76        for (size_t i = 0; i < strlen(gene); i++)
    7777                if (strchr("ATGC", gene[i])) validated += gene[i];  //validated contains only ATGC
    7878        free(gene);
  • cpp/frams/genetics/genman.cpp

    r286 r319  
    101101GenMan::GenMan() : localpar(GMparam_tab, this), localstats(GMstats_tab, this),
    102102seloperpar("GenOperators", "Genetics: Active operators"),
    103 par("GenMan", "Manages various genetic operations, using appropriate operators for the argument genotype format."),
    104 neuronsparam("Genetics: Neurons to add", "neuronsAdd", "neuadd_")
     103neuronsparam("Genetics: Neurons to add", "neuronsAdd", "neuadd_"),
     104par("GenMan", "Manages various genetic operations, using appropriate operators for the argument genotype format.")
    105105{
    106106        history = 0;
  • cpp/frams/model/model.cpp

    r286 r319  
    13251325                                if ((oj2->part1==op)||(oj2->part2==op))
    13261326                                        {
    1327                                         Joint *newj=addNewJoint(getPart(j),getPart(j2),Joint::SHAPE_SOLID);
     1327                                        addNewJoint(getPart(j),getPart(j2),Joint::SHAPE_SOLID);
    13281328                                        }
    13291329                                }
  • cpp/frams/param/param.h

    r316 r319  
    6060{
    6161public:
     62        virtual ~ParamInterface() {}
     63
    6264        virtual int getGroupCount() = 0; ///< @return the number of property groups
    6365        virtual int getPropCount() = 0; ///< @return the number of properties
  • cpp/frams/util/sstringutils.cpp

    r286 r319  
    298298                SString before = pattern.substr(0, aster);
    299299                SString after = pattern.substr(aster + 1);
    300                 int pos = 0;
    301300                if (!word.len()) return false;
    302301                if (before.len()) if (!word.startsWith(before)) return false;
Note: See TracChangeset for help on using the changeset viewer.