Skip to content

Commit

Permalink
clean code:remove unnecessary typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Apr 5, 2022
1 parent 4283b25 commit 64d989f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
26 changes: 13 additions & 13 deletions config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,17 @@ Group loadGroup( QDomElement grp, unsigned * nextId = 0 )

QDomNodeList dicts = grp.elementsByTagName( "dictionary" );

for( Utils::Dom::size_type y = 0; y < dicts.length(); ++y )
for( int y = 0; y < dicts.length(); ++y )
g.dictionaries.push_back( DictionaryRef( dicts.item( y ).toElement().text(),
dicts.item( y ).toElement().attribute( "name" ) ) );

QDomNode muted = grp.namedItem( "mutedDictionaries" );
dicts = muted.toElement().elementsByTagName( "mutedDictionary" );
for( Utils::Dom::size_type x = 0; x < dicts.length(); ++x )
for( int x = 0; x < dicts.length(); ++x )
g.mutedDictionaries.insert( dicts.item( x ).toElement().text() );

dicts = muted.toElement().elementsByTagName( "popupMutedDictionary" );
for( Utils::Dom::size_type x = 0; x < dicts.length(); ++x )
for( int x = 0; x < dicts.length(); ++x )
g.popupMutedDictionaries.insert( dicts.item( x ).toElement().text() );

return g;
Expand All @@ -420,7 +420,7 @@ MutedDictionaries loadMutedDictionaries( QDomNode mutedDictionaries )
QDomNodeList nl = mutedDictionaries.toElement().
elementsByTagName( "mutedDictionary" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
result.insert( nl.item( x ).toElement().text() );
}

Expand Down Expand Up @@ -583,7 +583,7 @@ Class load()
{
QDomNodeList nl = paths.toElement().elementsByTagName( "path" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
c.paths.push_back(
Path( nl.item( x ).toElement().text(),
nl.item( x ).toElement().attribute( "recursive" ) == "1" ) );
Expand All @@ -595,7 +595,7 @@ Class load()
{
QDomNodeList nl = soundDirs.toElement().elementsByTagName( "sounddir" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
c.soundDirs.push_back(
SoundDir( nl.item( x ).toElement().text(),
nl.item( x ).toElement().attribute( "name" ),
Expand All @@ -620,7 +620,7 @@ Class load()

QDomNodeList nl = groups.toElement().elementsByTagName( "group" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement grp = nl.item( x ).toElement();

Expand All @@ -636,7 +636,7 @@ Class load()

QDomNodeList nl = hunspell.toElement().elementsByTagName( "enabled" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
c.hunspell.enabledDictionaries.push_back( nl.item( x ).toElement().text() );
}

Expand Down Expand Up @@ -700,7 +700,7 @@ Class load()
{
QDomNodeList nl = programs.toElement().elementsByTagName( "program" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement pr = nl.item( x ).toElement();

Expand All @@ -727,7 +727,7 @@ Class load()
{
QDomNodeList nl = mws.toElement().elementsByTagName( "mediawiki" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement mw = nl.item( x ).toElement();

Expand Down Expand Up @@ -755,7 +755,7 @@ Class load()
{
QDomNodeList nl = wss.toElement().elementsByTagName( "website" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement ws = nl.item( x ).toElement();

Expand Down Expand Up @@ -783,7 +783,7 @@ Class load()
{
QDomNodeList nl = dss.toElement().elementsByTagName( "server" );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement ds = nl.item( x ).toElement();

Expand Down Expand Up @@ -812,7 +812,7 @@ Class load()
{
QDomNodeList nl = ves.toElement().elementsByTagName( "voiceEngine" );

for ( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for ( int x = 0; x < nl.length(); ++x )
{
QDomElement ve = nl.item( x ).toElement();
VoiceEngine v;
Expand Down
2 changes: 1 addition & 1 deletion forvo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void ForvoArticleRequest::requestFinished( QNetworkReply * r )

articleBody += "<table class=\"forvo_play\">";

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
{
QDomElement item = nl.item( x ).toElement();

Expand Down
2 changes: 1 addition & 1 deletion mediawiki.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void MediaWikiWordSearchRequest::downloadFinished()

Mutex::Lock _( dataMutex );

for( Utils::Dom::size_type x = 0; x < nl.length(); ++x )
for( int x = 0; x < nl.length(); ++x )
matches.push_back( gd::toWString( nl.item( x ).toElement().attribute( "title" ) ) );
}
}
Expand Down
5 changes: 0 additions & 5 deletions utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ inline QString getWordFromUrl( const QUrl & url )
}
}

namespace Dom
{
typedef int size_type;
}

}

#endif // UTILS_HH

0 comments on commit 64d989f

Please sign in to comment.