Ignore:
Timestamp:
05/29/18 16:51:14 (6 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/validitychecks.cpp

    r651 r793  
    77#include <common/log.h>
    88
    9 bool listIndexCheck(SList* list,int index,const char* msgobj,const char* msgfun)
     9bool listIndexCheck(SList* list, int index, const char* msgobj, const char* msgfun)
    1010{
    11         int size=list->size();
    12 if ((index<0)||(index>=size))
     11        int size = list->size();
     12        if ((index < 0) || (index >= size))
    1313        {
    14         if (size>0)
    15                 logPrintf(msgobj,msgfun,LOG_ERROR,"Invalid index %d (allowed range is 0..%d)",index,size-1);
    16         else
    17                 logPrintf(msgobj,msgfun,LOG_ERROR,"Invalid index %d (this list is empty)",index);
    18         return false;
     14                if (size>0)
     15                        logPrintf(msgobj, msgfun, LOG_ERROR, "Invalid index %d (allowed range is 0..%d)", index, size - 1);
     16                else
     17                        logPrintf(msgobj, msgfun, LOG_ERROR, "Invalid index %d (this list is empty)", index);
     18                return false;
    1919        }
    20 return true;
     20        return true;
    2121}
    2222
    23 SString stringCheck(SString& in,const char* msgobj,const char* msgfun,const char* msg,SString (*checker)(const SString& in))
     23SString stringCheck(SString& in, const char* msgobj, const char* msgfun, const char* msg, SString(*checker)(const SString& in))
    2424{
    25 if (!checker)
    26         checker=trim;
    27 SString corrected=checker(in);
    28 if (corrected!=in)
     25        if (!checker)
     26                checker = trim;
     27        SString corrected = checker(in);
     28        if (corrected != in)
    2929        {
    30         SString msg2=SString(msg)+": \"%s\" (adjusted to \"%s\")";
    31         logPrintf(msgobj,msgfun,LOG_WARN,msg2.c_str(),in.c_str(),corrected.c_str());
     30                SString msg2 = SString(msg) + ": \"%s\" (adjusted to \"%s\")";
     31                logPrintf(msgobj, msgfun, LOG_WARN, msg2.c_str(), in.c_str(), corrected.c_str());
    3232        }
    33 return corrected;
     33        return corrected;
    3434}
Note: See TracChangeset for help on using the changeset viewer.