Changeset 1075


Ignore:
Timestamp:
02/16/21 06:36:01 (10 days ago)
Author:
Maciej Komosinski
Message:

Fixed dangerous size_t-1

Location:
cpp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/loggers/loggers.cpp

    r1037 r1075  
    1616void LoggerManager::send(int position, const char *obj, const char *method, int level, const char *msg)
    1717{
    18         if (position >= (int)loggers.size()) position = loggers.size() - 1;
     18        if (position >= int(loggers.size())) position = int(loggers.size()) - 1;
    1919        bool blocked = false;
    2020        for (int i = position; i >= 0; i--)
     
    3434        logger->manager = this;
    3535        loggers.push_back(logger);
    36         return loggers.size() - 1;
     36        return int(loggers.size()) - 1;
    3737}
    3838
     
    5454{
    5555        while (loggers.size() > 0)
    56                 remove(loggers.size() - 1);
     56                remove(int(loggers.size()) - 1);
    5757}
    5858
  • cpp/common/loggers/loggers.h

    r876 r1075  
    2929        void send(const char *obj, const char *method, int level, const char *msg)
    3030        {
    31                 send(loggers.size() - 1, obj, method, level, msg);
     31                send(int(loggers.size())-1, obj, method, level, msg);
    3232        }
    3333        ~LoggerManager() { removeAll(); }
  • cpp/frams/genetics/fL/fL_oper.cpp

    r1029 r1075  
    421421                        if (list->size() > 1)
    422422                        {
    423                                 int rndid = rndUint(list->size() - 1);
     423                                int rndid = rndUint(int(list->size()) - 1);
    424424                                int j = 0;
    425425                                std::list<fL_Word *>::iterator it = list->begin();
Note: See TracChangeset for help on using the changeset viewer.