Skip to content

Commit babd2bc

Browse files
committed
Add missing static casts
1 parent fd900b2 commit babd2bc

File tree

15 files changed

+31
-29
lines changed

15 files changed

+31
-29
lines changed

lima_common/src/common/FsaAccess/AbstractLexiconIdGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int AbstractLexiconIdGeneratorInformer::operator() (
2929
AbstractLexiconIdGeneratorInformer* AbstractLexiconIdGeneratorInformer::theInformer = 0;
3030

3131
AbstractLexiconIdGeneratorInformer* AbstractLexiconIdGeneratorInformer::getInstance() {
32-
if( theInformer == 0 ) {
32+
if( theInformer == nullptr ) {
3333
theInformer = new AbstractLexiconIdGeneratorInformer();
3434
}
3535
return theInformer;

lima_common/src/common/MediaticData/EntityType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ bool EntityType::operator<(const EntityType& other) const
114114

115115
bool EntityType::isNull() const
116116
{
117-
return (m_d->m_id==static_cast<EntityTypeId>(0)
118-
&& m_d->m_groupId==static_cast<EntityGroupId>(0));
117+
return (m_d->m_id == static_cast<EntityTypeId>(0)
118+
&& m_d->m_groupId == static_cast<EntityGroupId>(0));
119119
}
120120

121121
EntityTypeId EntityType::getTypeId() const

lima_linguisticprocessing/src/linguisticProcessing/client/AnalysisHandlers/BowTextHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void BowTextHandler::startAnalysis()
8383
// delete m_writer;
8484
// m_writer=0;
8585
//}
86-
if (m_writer == 0){
86+
if (m_writer == nullptr){
8787
m_writer=new BowTextWriter();
8888
}
8989
m_bowstream=new std::ostringstream();

lima_linguisticprocessing/src/linguisticProcessing/client/AnalysisHandlers/BowTextWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void BowTextWriter::setOut(std::ostream* out)
5858

5959
void BowTextWriter::endAnalysis()
6060
{
61-
if (m_d->m_out == 0)
61+
if (m_d->m_out == nullptr)
6262
{
6363
BOWLOGINIT;
6464
LERROR << "BowTextWriter Error: output stream is not set !";
@@ -73,7 +73,7 @@ void BowTextWriter::endDocument()
7373

7474
void BowTextWriter::handle(const char* buf, int length)
7575
{
76-
if (m_d->m_out == 0)
76+
if (m_d->m_out == nullptr)
7777
{
7878
BOWLOGINIT;
7979
LERROR << "BowTextWriter Error: output stream is not set !";
@@ -86,7 +86,7 @@ void BowTextWriter::startAnalysis()
8686
{
8787
BOWLOGINIT;
8888
LDEBUG << "BowTextWriter::startAnalysis";
89-
if (m_d->m_out == 0)
89+
if (m_d->m_out == nullptr)
9090
{
9191
BOWLOGINIT;
9292
LERROR << "BowTextWriter Error: output stream is not set !";

lima_linguisticprocessing/src/linguisticProcessing/client/AnalysisHandlers/StructuredBoWToBoWDocument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void StructuredBoWToBoWDocument::
9494
addProperties(BoWDocument& /*document*/,
9595
const GenericDocumentProperties* properties)
9696
{
97-
if (properties == 0 ) {
97+
if (properties == nullptr ) {
9898
return;
9999
}
100100
std::pair<GenericDocumentProperties::IntPropertiesIterator,GenericDocumentProperties::IntPropertiesIterator> intProps=properties->getIntProperties();

lima_linguisticprocessing/src/linguisticProcessing/client/xmlreader/XmlReaderClientFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void Lima::XmlReader::XmlReaderClientFactory::configureClientFactory(
103103
for(ItrIds = MapMediaFactory.begin(); ItrIds != MapMediaFactory.end(); ItrIds++) {
104104

105105
// on ne cree une factory que si elle n'est pas encore dans la liste
106-
if(factory->getFactoryFromId(ItrIds->second) == 0) {
106+
if(factory->getFactoryFromId(ItrIds->second) == nullptr) {
107107

108108
// Create the processor factory
109109
auto factoryfactory = Lima::AbstractProcessingClientFactoryFactory::getFactory(ItrIds->second);

lima_linguisticprocessing/src/linguisticProcessing/core/AnalysisDumpers/EasyXmlDumper/easyXmlDumper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ LimaStatusCode EasyXmlDumper::process(AnalysisContent& analysis) const
121121
DUMPERLOGINIT;
122122

123123
LinguisticMetaData* metadata = static_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
124-
if (metadata == 0) {
124+
if (metadata == nullptr) {
125125
LERROR << "EasyXmlDumper::process no LinguisticMetaData ! abort";
126126
return MISSING_DATA;
127127
}
@@ -139,22 +139,22 @@ LimaStatusCode EasyXmlDumper::process(AnalysisContent& analysis) const
139139
}
140140

141141
auto graph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData(m_graph));
142-
if (graph == 0)
142+
if (graph == nullptr)
143143
{
144144
graph = new AnalysisGraph(m_graph,m_language,true,true);
145145
analysis.setData(m_graph,graph);
146146
}
147147

148148
auto syntacticData = std::dynamic_pointer_cast<SyntacticData>(analysis.getData("SyntacticData"));
149-
if (syntacticData == 0)
149+
if (syntacticData == nullptr)
150150
{
151151
syntacticData = new SyntacticAnalysis::SyntacticData(std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData(m_graph)),0);
152152
syntacticData->setupDependencyGraph();
153153
analysis.setData("SyntacticData",syntacticData);
154154
}
155155

156156
auto annotationData = std::dynamic_pointer_cast< AnnotationData >(analysis.getData("AnnotationData"));
157-
if (annotationData == 0)
157+
if (annotationData == nullptr)
158158
{
159159
annotationData = std::make_shared<AnnotationData>();
160160
if (std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("AnalysisGraph")) != 0)

lima_linguisticprocessing/src/linguisticProcessing/core/Automaton/basicConstraintFunctions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
277277
AnalysisContent& /*ac*/ ) const
278278
{
279279
Token* token = get(vertex_token,*(graph.getGraph()),v);
280-
if (token == 0)
280+
if (token == nullptr)
281281
{
282282
AULOGINIT;
283283
LERROR << "Null token on vertex " << v;
@@ -338,7 +338,7 @@ operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
338338
AnalysisContent& /*ac*/ ) const
339339
{
340340
Token* token = get(vertex_token,*(graph.getGraph()),v);
341-
if (token == 0)
341+
if (token == nullptr)
342342
{
343343
AULOGINIT;
344344
LERROR << "Null token on vertex " << v;
@@ -389,13 +389,13 @@ bool NoSpaceWith::operator()(const LinguisticAnalysisStructure::AnalysisGraph& g
389389
{
390390
Token* token1 = get(vertex_token,*(graph.getGraph()),v1);
391391
Token* token2 = get(vertex_token,*(graph.getGraph()),v2);
392-
if (token1 == 0)
392+
if (token1 == nullptr)
393393
{
394394
AULOGINIT;
395395
LERROR << "Null token on vertex " << v1;
396396
return false;
397397
}
398-
if (token2 == 0)
398+
if (token2 == nullptr)
399399
{
400400
AULOGINIT;
401401
LERROR << "Null token on vertex " << v2;

lima_linguisticprocessing/src/linguisticProcessing/core/FlatTokenizer/SpiritTokenizerLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ SpiritTokenizerLoader::SpiritTokenizerLoader(Automaton& automaton, const std::st
141141
State* SpiritTokenizerLoader::stateNamed(const LimaString& name)
142142
{
143143
State* newState = m_automaton.stateNamed(name);
144-
if (newState == 0)
144+
if (newState == nullptr)
145145
{
146146
newState = new State(name, m_automaton);
147147
m_automaton.states().push_back(newState);

lima_linguisticprocessing/src/linguisticProcessing/core/FlatTokenizer/Text.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ LimaString Text::token()
240240
#endif
241241
StringsPoolIndex form=(*m_d->m_stringsPool)[str];
242242
Token *tToken = new Token(form,str,m_d->m_debPtr+1,(delta-m_d->m_debPtr));
243-
if (tToken == 0) throw MemoryErrorException();
243+
if (tToken == nullptr) throw MemoryErrorException();
244244
// @todo: set default status here, according to structured status (alpha,numeric etc...)
245245
// instead of setting it at each change of status (setAlphaCapital, setNumeric etc...)
246246
tToken->setStatus(m_d->m_curSettings);

lima_linguisticprocessing/src/linguisticProcessing/core/FlatTokenizer/Transition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const State* Transition::run(Text& text) const
9898
TOKENIZERLOGINIT;
9999
#endif
100100
const CharClass* currentClass = text.currentClass();
101-
if (currentClass == 0)
101+
if (currentClass == nullptr)
102102
{
103103
TOKENIZERLOGINIT;
104104
LERROR << "Transition::run Null Class for char '"<< limastring2utf8stdstring(LimaString()+text.currentChar()) << "'";

lima_linguisticprocessing/src/linguisticProcessing/core/SpecificEntities/SpecificEntitiesConstraints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ bool CreateSpecificEntity::operator()(Automaton::RecognizerMatch& match,
342342
// (specific to modex) AddEntityFeature
343343
// WARN : some hard coded stuff here in resource names
344344
EntityType seType=match.getType();
345-
if (seType.getGroupId() == 0)
345+
if (seType.getGroupId() == static_cast<EntityGroupId>(0))
346346
{
347347
SELOGINIT;
348348
LERROR << "CreateSpecificEntity::operator() null group id:" << seType;

lima_linguisticprocessing/tools/automatonCompiler/libautomatonCompiler/transitionCompiler.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
using namespace std;
3636
using namespace Lima::Common;
37+
using namespace Lima::Common::MediaticData;
3738
using namespace Lima::LinguisticProcessing::LinguisticAnalysisStructure;
3839

3940
namespace Lima {
@@ -323,10 +324,10 @@ TransitionUnit* createTransition(const LimaString str,
323324
// entity transition
324325
else if (s.size()>=2 && s[0]==CHAR_BEGIN_ENTITY && s[s.size()-1]==CHAR_END_ENTITY) {
325326
LimaString entityName(s.mid(1,s.size()-2));
326-
Common::MediaticData::EntityType type=resolveEntityName(entityName,activeEntityGroups);
327+
EntityType type=resolveEntityName(entityName,activeEntityGroups);
327328
if (type.isNull()) {
328-
Common::MediaticData::EntityGroupId groupId = resolveGroupName(entityName,activeEntityGroups);
329-
if( groupId == 0) {
329+
EntityGroupId groupId = resolveGroupName(entityName,activeEntityGroups);
330+
if( groupId == static_cast<EntityGroupId>(0)) {
330331
AUCLOGINIT;
331332
LERROR << "createTransition: cannot resolve entity name "
332333
<< Common::Misc::limastring2utf8stdstring(s);
@@ -371,7 +372,7 @@ TransitionUnit* createTransition(const LimaString str,
371372

372373
//**********************************************************************
373374
//
374-
Common::MediaticData::EntityGroupId
375+
EntityGroupId
375376
resolveGroupName(const LimaString s,
376377
const std::vector<LimaString>& activeEntityGroups)
377378
{
@@ -380,11 +381,12 @@ resolveGroupName(const LimaString s,
380381
LDEBUG << "resolveGroupName: try to resolve group name "
381382
<< Common::Misc::limastring2utf8stdstring(s);
382383
#endif
383-
Common::MediaticData::EntityGroupId foundGroup;
384+
EntityGroupId foundGroup;
384385
try {
385386
LimaString groupName=s;
386387
#ifdef DEBUG_LP
387-
LDEBUG << "resolveGroupName: try group name " << Common::Misc::limastring2utf8stdstring(s);
388+
LDEBUG << "resolveGroupName: try group name "
389+
<< Common::Misc::limastring2utf8stdstring(s);
388390
#endif
389391
foundGroup = Common::MediaticData::MediaticData::single().getEntityGroupId(groupName);
390392
// group is among active groups

lima_pelf/resourceTool/ResourceEditorTableWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void ResourceEditorTableWidget::editEntry (const QModelIndex& index)
2929
{
3030
ResourceEditorTableModel* retm = dynamic_cast<ResourceEditorTableModel*>(resourceModel);
3131
AbstractResourceEntry* entry = retm->getFoundEntry(index.row());
32-
if(entry == 0)
32+
if(entry == nullptr)
3333
return;
3434
retm->dataModified = true;
3535
Q_EMIT editEntryDlg(entry);

lima_pelf/resourceTool/ResourceReaderTableModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ QVariant ResourceReaderTableModel::data (const QModelIndex& index, int role) con
8181
return QVariant();
8282
int column = index.column();
8383
AbstractResourceEntry* entry = getFoundEntry(index.row());
84-
if(entry == 0)
84+
if(entry == nullptr)
8585
return QVariant();
8686
return QVariant(entry->getColumnData(column));
8787
}

0 commit comments

Comments
 (0)