* Enable warnings

* Work without "-fpermissive" option

* Cosmetic fix

* Add "const" to fix warnings

These strings are not needs to modify.

* No need to use "#pragma once" in main C++ source file

* Cosmetic fix

Add newline to end

* Return nullptr if error

* delete() not works for "void*"

Cast specific type to use delete()

* Disable VC++ specific pragmas for other C++ compilers

* Fix warning

* Fix warning

* Use pipeline for compiler

* Enable code optimization

* Add "default:" to fix "switch" syntax warning

* Use "nullptr" for null pointer

* Use nullptr instead of NULL

* Use nullptr instead of NULL

* Use "L" notation for wide character

* Use C++ header instead of raw C header
This commit is contained in:
qykth-git 2021-08-24 03:27:05 +09:00 коммит произвёл GitHub
Родитель f94399f684
Коммит f14d961d2c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 162 добавлений и 125 удалений

Просмотреть файл

@ -3,8 +3,7 @@
# variables used to generate a source snapshot of the GIT repo
COMMIT=$(shell git log --pretty=format:'%H' -n 1)
SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1)
# suppress all warnings :-(
CXXFLAGS=-fPIC -std=c++11 -Iapi -w -fpermissive
CXXFLAGS=-fPIC -pipe -std=c++11 -O2 -Iapi
TARGET=pict
TARGET_LIB_SO=libpict.so
TEST_OUTPUT = test/rel.log test/rel.log.failures test/dbg.log

Просмотреть файл

@ -259,7 +259,7 @@ void Combination::SetOpen( int index )
//
//
Combination::Combination( Model *M ) :
m_bitvec( NULL ), m_openCount( 0 ), m_boundCount( 0 ), m_range( 0 ), m_model( M )
m_bitvec( nullptr ), m_openCount( 0 ), m_boundCount( 0 ), m_range( 0 ), m_model( M )
{
m_id = ++m_lastUsedId;
DOUT( L"Combination created: " << m_id << endl );
@ -271,7 +271,7 @@ Combination::Combination( Model *M ) :
Combination::~Combination()
{
DOUT( L"Combination deleted: " << m_id << endl );
if( NULL != m_bitvec ) delete[] m_bitvec;
if( nullptr != m_bitvec ) delete[] m_bitvec;
}
//
@ -290,4 +290,4 @@ void Combination::Print()
DOUT( L"\n" );
}
}
}

Просмотреть файл

@ -1,7 +1,9 @@
#pragma once
#ifdef _MSC_VER
#pragma warning(disable:4511)
#pragma warning(disable:4512)
#pragma warning(disable:4239)
#endif
#include <vector>
#include <string>
@ -447,8 +449,8 @@ public:
size_t GetLast() { return m_currentValue; }
ParamResult& GetTempResults() { return m_result; }
virtual Model* GetModel() { return NULL; }
virtual ParamCollection* GetComponents() { return NULL; }
virtual Model* GetModel() { return nullptr; }
virtual ParamCollection* GetComponents() { return nullptr; }
void CleanUp();
@ -696,7 +698,7 @@ public:
ExclusionCollection& GetExclusions() { return( m_exclusions ); }
RowSeedCollection& GetRowSeeds() { return( m_rowSeeds ); }
bool AbortGeneration() { return( ( NULL == m_abortCallback ) ? false : m_abortCallback() ); }
bool AbortGeneration() { return( ( nullptr == m_abortCallback ) ? false : m_abortCallback() ); }
void SetGenerationMode( GenerationMode mode ) { m_generationMode = mode; }
GenerationMode GetGenerationMode() { return( m_generationMode ); }
@ -728,7 +730,7 @@ private:
void deriveExclusions();
// a global workspace shared by multiple objects
int* m_workbuf = NULL;
int* m_workbuf = nullptr;
// result row pointer allows C-style API to implement GetNextResultRow function
// i.e. get one result row at a time

Просмотреть файл

@ -598,13 +598,13 @@ bool Model::excludeConflictingParamValues()
{
Parameter* s1 = GetParameters()[ pseudo1 ];
assert( s1 );
if( NULL == s1 || NULL == s1->GetComponents() ) continue;
if( nullptr == s1 || nullptr == s1->GetComponents() ) continue;
for( size_t pseudo2 = pseudo1 + 1; pseudo2 < GetParameters().size(); ++pseudo2 )
{
Parameter* s2 = GetParameters()[ pseudo2 ];
assert( s2 );
if( NULL == s2 || NULL == s2->GetComponents() ) continue;
if( nullptr == s2 || nullptr == s2->GetComponents() ) continue;
// for each param p1 in s1
ParamCollection::iterator p1;
@ -1464,4 +1464,4 @@ Model::~Model()
}
}
}
}

Просмотреть файл

@ -271,9 +271,9 @@ PictAddParameter
false );
try
{
if( NULL != param )
if( nullptr != param )
{
if( NULL != valueWeights )
if( nullptr != valueWeights )
{
std::vector<int> weights;
weights.reserve( valueCount );
@ -286,7 +286,7 @@ PictAddParameter
}
catch( ... )
{
param = NULL;
param = nullptr;
}
return( param );

Просмотреть файл

@ -73,8 +73,8 @@ typedef struct _PICT_SEED_ITEM
// None
//
// Returns:
// Non-NULL Allocation succeeded (a handle is returned)
// NULL Allocation failed
// Non-nullptr Allocation succeeded (a handle is returned)
// nullptr Allocation failed
//
// ////////////////////////////////////////////////////////////////////////////
@ -189,8 +189,8 @@ PictGenerate
// task Valid handle to a task
//
// Returns:
// Non-NULL Allocation succeeded (a handle is returned)
// NULL Allocation failed
// Non-nullptr Allocation succeeded (a handle is returned)
// nullptr Allocation failed
//
// ////////////////////////////////////////////////////////////////////////////
@ -297,8 +297,8 @@ PictDeleteTask
// randomSeed A seed used to randomize the engine
//
// Returns:
// Non-NULL Allocation succeeded (a handle is returned)
// NULL Allocation failed
// Non-nullptr Allocation succeeded (a handle is returned)
// nullptr Allocation failed
//
// ////////////////////////////////////////////////////////////////////////////
@ -320,8 +320,8 @@ PictCreateModel
// valueWeights Array of weights, one per value, must be of ValueCount size
//
// Returns:
// Non-NULL Allocation succeeded (a handle is returned)
// NULL Allocation failed
// Non-nullptr Allocation succeeded (a handle is returned)
// nullptr Allocation failed
//
// ////////////////////////////////////////////////////////////////////////////
@ -332,7 +332,7 @@ PictAddParameter
IN const PICT_HANDLE model,
IN size_t valueCount,
IN OPT unsigned int order = PICT_PAIRWISE_GENERATION,
IN OPT unsigned int valueWeights[] = NULL
IN OPT unsigned int valueWeights[] = nullptr
);
//

Просмотреть файл

@ -10,11 +10,11 @@ const size_t DefaultMaxRandomTries = 1000;
//
//
Task::Task() :
m_rootModel (NULL),
m_abortCallback (NULL),
m_rootModel (nullptr),
m_abortCallback (nullptr),
m_generationMode(Regular),
m_maxRandomTries(DefaultMaxRandomTries),
m_workbuf (NULL)
m_workbuf (nullptr)
{
Combination::ResetId();
@ -53,10 +53,10 @@ void Task::AllocWorkbuf( int size )
//
void Task::DeallocWorkbuf()
{
if( NULL != m_workbuf )
if( nullptr != m_workbuf )
{
delete[] m_workbuf;
m_workbuf = NULL;
m_workbuf = nullptr;
}
}
@ -80,7 +80,7 @@ void Task::PrepareForGeneration()
for ( auto & excl : m_exclusions )
{
Model* found = findMatchingNode(const_cast<Exclusion&>( excl ), m_rootModel);
assert( NULL != found );
assert( nullptr != found );
found->AddExclusion( const_cast<Exclusion&>( excl ));
}
@ -120,7 +120,7 @@ Model* Task::findMatchingNode( Exclusion& exclusion, Model* root )
for( auto & submodel : root->GetSubmodels() )
{
Model* foundNode = findMatchingNode( exclusion, submodel );
if ( NULL != foundNode ) return( foundNode );
if ( nullptr != foundNode ) return( foundNode );
}
// none of the subnodes matches the exclusion so let's try the current one
@ -136,7 +136,7 @@ Model* Task::findMatchingNode( Exclusion& exclusion, Model* root )
}
else
{
return( NULL );
return( nullptr );
}
}
@ -187,4 +187,4 @@ void Task::deriveExclusions()
__insert( m_exclusions, deriver.GetExclusions().begin(), deriver.GetExclusions().end() );
}
}
}

Просмотреть файл

@ -70,7 +70,7 @@ public:
found = current->children.find( *ic );
if( found == current->children.end() )
{
trienode< typename Col::value_type > *node = NULL;
trienode< typename Col::value_type > *node = nullptr;
try
{
@ -101,7 +101,7 @@ public:
void erase( Col& t )
{
trienode<typename Col::value_type>* node = pfind( t );
if( NULL == node ) return;
if( nullptr == node ) return;
node->valid = false;
}
@ -110,7 +110,7 @@ public:
//
bool find_prefix( Col &t )
{
return( pfind_prefix( t ) != NULL );
return( pfind_prefix( t ) != nullptr );
}
private:
@ -125,11 +125,11 @@ private:
for( typename Col::iterator ic = t.begin(); ic != t.end(); ++ic )
{
typename TNodeCol::iterator found = current->children.find( *ic );
if( found == current->children.end() ) return( NULL );
if( found == current->children.end() ) return( nullptr );
current = found->second;
}
return( current->valid ? current : NULL );
return( current->valid ? current : nullptr );
}
//
@ -141,14 +141,14 @@ private:
for( typename Col::iterator ic = t.begin(); ic != t.end(); ++ic )
{
typename TNodeCol::iterator found = current->children.find( *ic );
if( found == current->children.end() ) return( NULL );
if( found == current->children.end() ) return( nullptr );
current = found->second;
if( current->valid ) return( current );
}
return( current->valid ? current : NULL );
return( current->valid ? current : nullptr );
}
};

Просмотреть файл

@ -64,6 +64,8 @@ void CTerm::Print()
case Relation_NOT_LIKE:
wcerr << L"{not like}";
break;
default:
break;
}
wcerr << L" ";
@ -144,6 +146,8 @@ void CTokenList::Print()
wcerr << L"\n";
break;
}
default:
break;
}
}
}
@ -191,8 +195,8 @@ void CSyntaxTreeItem::Print( unsigned int indent )
break;
}
if( NULL != node->LLink ) node->LLink->Print( indent + 1 );
if( NULL != node->RLink ) node->RLink->Print( indent + 1 );
if( nullptr != node->LLink ) node->LLink->Print( indent + 1 );
if( nullptr != node->RLink ) node->RLink->Print( indent + 1 );
}
}
@ -202,7 +206,7 @@ void CSyntaxTreeItem::Print( unsigned int indent )
void CConstraint::Print() const
{
wcerr << L"Condition:\n";
if( NULL == Condition )
if( nullptr == Condition )
{
wcerr << L" -\n";
}
@ -212,7 +216,7 @@ void CConstraint::Print() const
}
wcerr << L"Term:\n";
if( NULL == Term )
if( nullptr == Term )
{
wcerr << L" -\n";
}

Просмотреть файл

@ -2,7 +2,7 @@
#include <vector>
#include <list>
#include <assert.h>
#include <cassert>
#include "strings.h"
namespace pictcli_constraints
@ -100,9 +100,9 @@ public:
CValue( IN std::wstring text ) : DataType( DataType_String ), Text( text ) {}
CValue( IN double number ) : DataType( DataType_Number ), Number( number ) {}
DataType DataType;
std::wstring Text;
double Number;
pictcli_constraints::DataType DataType;
std::wstring Text;
double Number;
};
typedef std::list<CValue> CValueSet;
@ -146,11 +146,11 @@ class CTerm
public:
CTerm
(
IN CParameter* parameter, // what parameter the term relates to
IN Relation relation, // what is the relation
IN TermDataType dataType, // type of the right side of the relation
IN void* data, // data of the right side of the relation
IN std::wstring rawText // raw text of the term, useful for warnings
IN CParameter* parameter, // what parameter the term relates to
IN pictcli_constraints::Relation relation, // what is the relation
IN TermDataType dataType, // type of the right side of the relation
IN void* data, // data of the right side of the relation
IN std::wstring rawText // raw text of the term, useful for warnings
) :
Parameter( parameter ),
Relation ( relation ),
@ -196,17 +196,27 @@ public:
~CTerm()
{
if( SyntaxTermDataType_ParameterName != DataType )
switch( DataType )
{
delete( Data );
case SyntaxTermDataType_ParameterName:
break;
case SyntaxTermDataType_Value:
delete( reinterpret_cast<CValue*>(Data) );
break;
case SyntaxTermDataType_ValueSet:
delete( reinterpret_cast<CValueSet*>(Data) );
break;
default:
assert(false);
break;
}
}
CParameter* Parameter;
TermDataType DataType;
Relation Relation;
void* Data;
std::wstring RawText;
CParameter* Parameter;
TermDataType DataType;
pictcli_constraints::Relation Relation;
void* Data;
std::wstring RawText;
};
//
@ -261,9 +271,13 @@ public:
{
// we don't have to delete Data for FunctionDataType_Parameter
// as it's merely a pointer to an existing data set
if( FunctionDataType_Parameter != DataType )
switch( DataType )
{
delete( Data );
case FunctionDataType_Parameter:
break;
default:
assert(false);
break;
}
}
@ -320,41 +334,41 @@ public:
Type ( type ),
PositionInText( positionInText ),
LogicalOper ( LogicalOper_Unknown ),
Term ( NULL ),
Function ( NULL ) {}
Term ( nullptr ),
Function ( nullptr ) {}
CToken( IN LogicalOper logicalOper, IN std::wstring::iterator positionInText ) :
CToken( IN pictcli_constraints::LogicalOper logicalOper, IN std::wstring::iterator positionInText ) :
Type ( TokenType_LogicalOper ),
PositionInText( positionInText ),
LogicalOper ( logicalOper ),
Term ( NULL ),
Function ( NULL ) {}
Term ( nullptr ),
Function ( nullptr ) {}
CToken( IN CTerm *term, IN std::wstring::iterator positionInText ) :
Type ( TokenType_Term ),
PositionInText( positionInText ),
LogicalOper ( LogicalOper_Unknown ),
Term ( term ),
Function ( NULL ) {}
Function ( nullptr ) {}
CToken( IN CFunction *function, IN std::wstring::iterator positionInText ) :
Type ( TokenType_Function ),
PositionInText( positionInText ),
LogicalOper ( LogicalOper_Unknown ),
Term ( NULL ),
Term ( nullptr ),
Function ( function ) {}
~CToken()
{
if( NULL != Term ) delete( Term );
if( NULL != Function ) delete( Function );
if( nullptr != Term ) delete( Term );
if( nullptr != Function ) delete( Function );
}
TokenType Type;
std::wstring::iterator PositionInText;
LogicalOper LogicalOper;
CTerm* Term;
CFunction* Function;
TokenType Type;
std::wstring::iterator PositionInText;
pictcli_constraints::LogicalOper LogicalOper;
CTerm* Term;
CFunction* Function;
};
//
@ -422,11 +436,24 @@ public:
~CSyntaxTreeItem()
{
if( NULL != Data ) delete( Data );
switch( Type )
{
case ItemType_Term:
delete( reinterpret_cast<CTerm*>(Data) );
break;
case ItemType_Function:
delete( reinterpret_cast<CFunction*>(Data) );
break;
case ItemType_Node:
break;
default:
assert(false);
break;
}
}
SyntaxTreeItemType Type;
void* Data = NULL;
void* Data = nullptr;
};
//
@ -435,16 +462,16 @@ public:
class CSyntaxTreeNode
{
public:
LogicalOper Oper;
CSyntaxTreeItem* LLink;
CSyntaxTreeItem* RLink;
pictcli_constraints::LogicalOper Oper;
CSyntaxTreeItem* LLink;
CSyntaxTreeItem* RLink;
CSyntaxTreeNode() : Oper( LogicalOper_Unknown ), LLink( NULL ), RLink( NULL ) {}
CSyntaxTreeNode() : Oper( LogicalOper_Unknown ), LLink( nullptr ), RLink( nullptr ) {}
~CSyntaxTreeNode()
{
if( NULL != LLink ) delete( (CSyntaxTreeItem*) LLink );
if( NULL != RLink ) delete( RLink );
if( nullptr != LLink ) delete( (CSyntaxTreeItem*) LLink );
if( nullptr != RLink ) delete( RLink );
}
};
@ -457,7 +484,7 @@ public:
class CConstraint
{
public:
CConstraint() : Condition( NULL ), Term( NULL ) {}
CConstraint() : Condition( nullptr ), Term( nullptr ) {}
CSyntaxTreeItem* Condition;
CSyntaxTreeItem* Term;

Просмотреть файл

@ -175,7 +175,7 @@ bool parseArg( wchar_t* text, CModelData& modelData )
// /r
if( wcslen( text ) == 2 )
{
modelData.RandSeed = (unsigned short) ( time( NULL ) );
modelData.RandSeed = (unsigned short) ( time( nullptr ) );
}
// /r:
else if( wcslen( text ) == 3 )

Просмотреть файл

@ -10,9 +10,9 @@ using namespace std;
void PrintMessage
(
IN MsgType type,
IN wchar_t* text1,
IN wchar_t* text2,
IN wchar_t* text3
IN const wchar_t* text1,
IN const wchar_t* text2,
IN const wchar_t* text3
)
{
switch ( type )

Просмотреть файл

@ -14,7 +14,7 @@
// TODO: move these two somewhere else
#define TEXT_TokenConstraintEnd L";"
const wchar_t RESULT_DELIMITER = '\t';
const wchar_t RESULT_DELIMITER = L'\t';
//
// Types of messages
@ -36,9 +36,9 @@ enum MsgType
void PrintMessage
(
IN MsgType type,
IN wchar_t* text1,
IN wchar_t* text2 = 0,
IN wchar_t* text3 = 0
IN const wchar_t* text1,
IN const wchar_t* text2 = nullptr,
IN const wchar_t* text3 = nullptr
);
//

Просмотреть файл

@ -199,6 +199,8 @@ CSyntaxTreeItem* ConstraintsParser::constructSyntaxTreeItem
case TokenType_ParenthesisClose:
--parenthesesCount;
break;
default:
break;
}
++token;
@ -208,6 +210,8 @@ CSyntaxTreeItem* ConstraintsParser::constructSyntaxTreeItem
operands.push( constructSyntaxTreeItem( tokenBegin, token, false ));
break;
}
default:
break;
}
}
@ -254,6 +258,7 @@ CSyntaxTreeItem* ConstraintsParser::constructSyntaxTreeItem
delete( (CSyntaxTreeItem*) operands.top() );
operands.pop();
}
return nullptr;
}
}
@ -280,7 +285,7 @@ CSyntaxTreeItem* ConstraintsParser::processOneLogicalOper( IN COperators& operat
break;
case LogicalOper_NOT:
node->LLink = operands.top();
// the right node remains NULL
// the right node remains "nullptr"
operands.pop();
break;
default:
@ -338,7 +343,7 @@ void ConstraintsParser::removeNOTs()
//
void ConstraintsParser::removeBranchNOTs( IN CSyntaxTreeItem* item, IN bool carryOver )
{
if ( NULL == item) return;
if ( nullptr == item) return;
switch( item->Type )
{
@ -394,7 +399,7 @@ void ConstraintsParser::removeBranchNOTs( IN CSyntaxTreeItem* item, IN bool carr
// zero out the data pointer of LLink so during clean-up we don't
// delete the data that was just assigned to current item
node->LLink->Data = NULL;
node->LLink->Data = nullptr;
delete( node );
break;
default:
@ -463,7 +468,7 @@ void ConstraintsParser::verifyConstraint( CConstraint& constraint )
//
void ConstraintsParser::verifySyntaxTreeItem( CSyntaxTreeItem* item )
{
if ( NULL == item ) return;
if ( nullptr == item ) return;
if ( ItemType_Term == item->Type )
{
@ -488,7 +493,7 @@ void ConstraintsParser::verifySyntaxTreeItem( CSyntaxTreeItem* item )
void ConstraintsParser::verifyTerm( CTerm* term )
{
// Is Parameter defined in the model?
if ( term->Parameter == NULL )
if ( term->Parameter == nullptr )
{
throw CSemanticWarning( ValidationWarnType_UnknownParameter );
}
@ -521,7 +526,7 @@ void ConstraintsParser::verifyTerm( CTerm* term )
// Is second parameter defined?
if ( term->DataType == SyntaxTermDataType_ParameterName )
{
if ( term->Data == NULL )
if ( term->Data == nullptr )
{
throw CSemanticWarning( ValidationWarnType_UnknownParameter );
}
@ -569,13 +574,15 @@ void ConstraintsParser::verifyFunction( CFunction *function )
case FunctionTypeIsNegativeParam:
case FunctionTypeIsPositiveParam:
{
if ( function->Data == NULL && ! function->DataText.empty() )
if ( function->Data == nullptr && ! function->DataText.empty() )
{
throw CSemanticWarning( ValidationWarnType_UnknownParameter );
}
break;
}
default:
break;
}
}
}
}

Просмотреть файл

@ -261,7 +261,7 @@ void ConstraintsTokenizer::parseTerm( IN OUT CTokenList& tokens )
// check whether it's one of the functions
CFunction *function = getFunction();
if( NULL != function )
if( nullptr != function )
{
CToken* token;
try
@ -282,7 +282,7 @@ void ConstraintsTokenizer::parseTerm( IN OUT CTokenList& tokens )
wstring paramName = getParameterName();
CParameters::iterator found = _model.findParamByName( paramName );
CParameter* param = NULL;
CParameter* param = nullptr;
if ( found != _model.Parameters.end() )
{
param = &*found;
@ -293,7 +293,7 @@ void ConstraintsTokenizer::parseTerm( IN OUT CTokenList& tokens )
skipWhiteChars();
CTerm* term = NULL;
CTerm* term = nullptr;
switch( relation )
{
case Relation_IN:
@ -350,7 +350,7 @@ void ConstraintsTokenizer::parseTerm( IN OUT CTokenList& tokens )
//
// look up parameters by their names and return references
//
CParameter *param2 = NULL;
CParameter *param2 = nullptr;
found = _model.findParamByName( paramName2 );
if ( found != _model.Parameters.end() )
{
@ -405,7 +405,7 @@ void ConstraintsTokenizer::parseTerm( IN OUT CTokenList& tokens )
// <term> ::= IsNegative(<parameter_name>)
//
// Returns a CFunction object if in fact a function was parsed
// or NULL otherwise
// or "nullptr" otherwise
//
CFunction *ConstraintsTokenizer::getFunction()
{
@ -424,7 +424,7 @@ CFunction *ConstraintsTokenizer::getFunction()
}
else
{
return NULL;
return nullptr;
}
// opening bracket
@ -438,7 +438,7 @@ CFunction *ConstraintsTokenizer::getFunction()
wstring paramName = getString( charArrToStr( TEXT_TokenParenthesisClose ));
CParameters::iterator found = _model.findParamByName( paramName );
CParameter* param = NULL;
CParameter* param = nullptr;
if ( found != _model.Parameters.end() )
{
param = &*found;
@ -759,8 +759,8 @@ void ConstraintsTokenizer::doPostParseExpansions( IN OUT CTokenList& tokens )
&& function->DataText.empty() )
{
// deallocate the current token
// we don't have to deallocate Data because in this case it is always NULL
assert( function->Data == NULL );
// we don't have to deallocate Data because in this case it is always "nullptr"
assert( function->Data == nullptr );
// save positionInText and rawText and reuse it in all new tokens
wstring::iterator oldPosInText = (*i_token)->PositionInText;

Просмотреть файл

@ -288,8 +288,8 @@ void ConstraintsInterpreter::interpretFunction( IN CFunction* function, IN OUT C
for( unsigned int idx = 0; idx < modelParam.Values.size(); ++idx )
{
bool positive = modelParam.Values[ idx ].IsPositive();
if( function->Type == FunctionTypeIsNegativeParam && ! positive
|| function->Type == FunctionTypeIsPositiveParam && positive )
if( (function->Type == FunctionTypeIsNegativeParam && ! positive)
|| (function->Type == FunctionTypeIsPositiveParam && positive) )
{
Exclusion newExcl;
newExcl.insert( make_pair( _gcdParameters[ paramIdx ], idx ));
@ -311,7 +311,7 @@ void ConstraintsInterpreter::interpretFunction( IN CFunction* function, IN OUT C
//
void ConstraintsInterpreter::interpretSyntaxTreeItem( IN CSyntaxTreeItem* item, IN OUT CGcdExclusions& gcdExclusions )
{
if ( NULL == item ) return;
if ( nullptr == item ) return;
// a case where where there is no condition
if ( ItemType_Term == item->Type )
@ -368,7 +368,7 @@ void ConstraintsInterpreter::interpretSyntaxTreeItem( IN CSyntaxTreeItem* item,
void ConstraintsInterpreter::interpretConstraint( IN const CConstraint& constraint, IN OUT CGcdExclusions& gcdExclusions )
{
// if there's no condition, look at the term only
if ( NULL == constraint.Condition )
if ( nullptr == constraint.Condition )
{
interpretSyntaxTreeItem( constraint.Term, gcdExclusions );
}

Просмотреть файл

@ -1,5 +1,3 @@
#pragma once
#include "cmdline.h"
#include "gcdexcl.h"
#include "gcdmodel.h"

Просмотреть файл

@ -278,7 +278,7 @@ void CModelData::PrintModelContents( wstring title )
for( auto & param : Parameters )
{
wcerr << L" " << param.Name << L":\t" << (unsigned int) param.Values.size() << L" values, order: ";
if( NULL == param.GcdPointer )
if( nullptr == param.GcdPointer )
wcerr << L"?" << endl;
else
wcerr << param.Order << L" : " << param.GcdPointer->GetOrder() << endl;

Просмотреть файл

@ -59,7 +59,7 @@ public:
CModelParameter() :
IsResultParameter( false ),
GcdPointer( NULL ) {}
GcdPointer( nullptr ) {}
int GetValueOrdinal( IN std::wstring& name, IN bool caseSensitive );
bool ValueNamesUnique( IN bool CaseSensitive );

Просмотреть файл

@ -193,7 +193,7 @@ bool CModelData::readParameter( wstring& line )
size_t weightEnd = i_val->find_last_of( WEIGHT_END );
// '(' must exist, ')' must be the last character
if ( weightBegin != -1 && weightEnd == i_val->length() - 1 )
if ( weightBegin != wstring::npos && weightEnd == i_val->length() - 1 )
{
wstring weightStr = trim( i_val->substr( weightBegin + 1, weightEnd - weightBegin - 1 ));
double weightDbl = 0;

Просмотреть файл

@ -46,7 +46,7 @@ int __cdecl execute
IN OUT wstring& output
)
{
time_t start = time( NULL );
time_t start = time( nullptr );
CModelData modelData;
@ -73,7 +73,7 @@ int __cdecl execute
return err;
}
time_t end = time( NULL );
time_t end = time( nullptr );
// if r has been provided then print out the seed
// TODO: change to not use SWITCH_RANDOMIZE const

Просмотреть файл

@ -3,8 +3,8 @@
#include <algorithm>
#include <functional>
#include <cctype>
#include <wchar.h>
#include <assert.h>
#include <cwchar>
#include <cassert>
#include "strings.h"
using namespace std;
@ -224,7 +224,7 @@ wstring charToStr( wchar_t c )
//
//
//
wstring charArrToStr( wchar_t* c )
wstring charArrToStr( const wchar_t* c )
{
return( wstring( c ) );
}

Просмотреть файл

@ -110,7 +110,7 @@ std::wstring charToStr
//
std::wstring charArrToStr
(
IN wchar_t* c
IN const wchar_t* c
);
//