Changeset 1075 for cpp/common/loggers


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

Fixed dangerous size_t-1

Location:
cpp/common/loggers
Files:
2 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(); }
Note: See TracChangeset for help on using the changeset viewer.