Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
dbec9e98
Commit
dbec9e98
authored
Oct 23, 2018
by
Patrick José Pereira
Browse files
comm: Change from foreach to c++11 for
Signed-off-by:
Patrick José Pereira
<
patrickelectric@gmail.com
>
parent
f1ed746d
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/comm/BluetoothLink.cc
View file @
dbec9e98
...
...
@@ -340,7 +340,7 @@ void BluetoothConfiguration::deviceDiscovered(QBluetoothDeviceInfo info)
qDebug() << "Address: " << info.address().toString();
qDebug() << "Service Classes:" << info.serviceClasses();
QList<QBluetoothUuid> uuids = info.serviceUuids();
for
each
(QBluetoothUuid uuid
,
uuids) {
for (QBluetoothUuid uuid
:
uuids) {
qDebug() << "Service UUID: " << uuid.toString();
}
#endif
...
...
@@ -373,7 +373,7 @@ void BluetoothConfiguration::doneScanning()
void
BluetoothConfiguration
::
setDevName
(
const
QString
&
name
)
{
for
each
(
const
BluetoothData
&
data
,
_deviceList
)
for
(
const
BluetoothData
&
data
:
_deviceList
)
{
if
(
data
.
name
==
name
)
{
...
...
src/comm/LinkManager.cc
View file @
dbec9e98
...
...
@@ -497,7 +497,7 @@ void LinkManager::_updateAutoConnectLinks(void)
#endif
// Iterate Comm Ports
for
each
(
QGCSerialPortInfo
portInfo
,
portList
)
{
for
(
QGCSerialPortInfo
portInfo
:
portList
)
{
qCDebug
(
LinkManagerVerboseLog
)
<<
"-----------------------------------------------------"
;
qCDebug
(
LinkManagerVerboseLog
)
<<
"portName: "
<<
portInfo
.
portName
();
qCDebug
(
LinkManagerVerboseLog
)
<<
"systemLocation: "
<<
portInfo
.
systemLocation
();
...
...
@@ -638,7 +638,7 @@ void LinkManager::_updateAutoConnectLinks(void)
}
// Now remove all configs that are gone
for
each
(
LinkConfiguration
*
pDeleteConfig
,
_confToDelete
)
{
for
(
LinkConfiguration
*
pDeleteConfig
:
_confToDelete
)
{
qCDebug
(
LinkManagerLog
)
<<
"Removing unused autoconnect config"
<<
pDeleteConfig
->
name
();
if
(
pDeleteConfig
->
link
())
{
disconnectLink
(
pDeleteConfig
->
link
());
...
...
@@ -703,7 +703,7 @@ void LinkManager::_updateSerialPorts()
_commPortDisplayList
.
clear
();
#ifndef NO_SERIAL_LINK
QList
<
QSerialPortInfo
>
portList
=
QSerialPortInfo
::
availablePorts
();
for
each
(
const
QSerialPortInfo
&
info
,
portList
)
for
(
const
QSerialPortInfo
&
info
:
portList
)
{
QString
port
=
info
.
systemLocation
().
trimmed
();
_commPortList
+=
port
;
...
...
src/comm/MAVLinkProtocol.cc
View file @
dbec9e98
...
...
@@ -453,7 +453,7 @@ void MAVLinkProtocol::checkForLostLogFiles(void)
QFileInfoList
fileInfoList
=
tempDir
.
entryInfoList
(
QStringList
(
filter
),
QDir
::
Files
);
//qDebug() << "Orphaned log file count" << fileInfoList.count();
for
each
(
const
QFileInfo
fileInfo
,
fileInfoList
)
{
for
(
const
QFileInfo
fileInfo
:
fileInfoList
)
{
//qDebug() << "Orphaned log file" << fileInfo.filePath();
if
(
fileInfo
.
size
()
==
0
)
{
// Delete all zero length files
...
...
@@ -476,7 +476,7 @@ void MAVLinkProtocol::deleteTempLogFiles(void)
QString
filter
(
QString
(
"*.%1"
).
arg
(
_logFileExtension
));
QFileInfoList
fileInfoList
=
tempDir
.
entryInfoList
(
QStringList
(
filter
),
QDir
::
Files
);
for
each
(
const
QFileInfo
fileInfo
,
fileInfoList
)
{
for
(
const
QFileInfo
fileInfo
:
fileInfoList
)
{
QFile
::
remove
(
fileInfo
.
filePath
());
}
}
...
...
src/comm/QGCFlightGearLink.cc
View file @
dbec9e98
...
...
@@ -956,7 +956,7 @@ void QGCFlightGearLink::_printFgfsOutput(void)
QByteArray
byteArray
=
_fgProcess
->
readAllStandardOutput
();
QStringList
strLines
=
QString
(
byteArray
).
split
(
"
\n
"
);
for
each
(
const
QString
&
line
,
strLines
){
for
(
const
QString
&
line
:
strLines
){
qDebug
()
<<
line
;
}
}
...
...
@@ -968,7 +968,7 @@ void QGCFlightGearLink::_printFgfsError(void)
QByteArray
byteArray
=
_fgProcess
->
readAllStandardError
();
QStringList
strLines
=
QString
(
byteArray
).
split
(
"
\n
"
);
for
each
(
const
QString
&
line
,
strLines
){
for
(
const
QString
&
line
:
strLines
){
qDebug
()
<<
line
;
}
}
...
...
src/comm/QGCSerialPortInfo.cc
View file @
dbec9e98
...
...
@@ -252,7 +252,7 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void)
{
QList
<
QGCSerialPortInfo
>
list
;
for
each
(
QSerialPortInfo
portInfo
,
QSerialPortInfo
::
availablePorts
())
{
for
(
QSerialPortInfo
portInfo
:
QSerialPortInfo
::
availablePorts
())
{
if
(
!
isSystemPort
(
&
portInfo
))
{
list
<<
*
((
QGCSerialPortInfo
*
)
&
portInfo
);
}
...
...
src/comm/SerialLink.cc
View file @
dbec9e98
...
...
@@ -65,7 +65,7 @@ bool SerialLink::_isBootloader()
if
(
portList
.
count
()
==
0
){
return
false
;
}
for
each
(
const
QSerialPortInfo
&
info
,
portList
)
for
(
const
QSerialPortInfo
&
info
:
portList
)
{
qCDebug
(
SerialLinkLog
)
<<
"PortName : "
<<
info
.
portName
()
<<
"Description : "
<<
info
.
description
();
qCDebug
(
SerialLinkLog
)
<<
"Manufacturer: "
<<
info
.
manufacturer
();
...
...
src/comm/UDPLink.cc
View file @
dbec9e98
...
...
@@ -70,7 +70,7 @@ static QString get_ip_address(const QString& address)
static
bool
contains_target
(
const
QList
<
UDPCLient
*>
list
,
const
QHostAddress
&
address
,
quint16
port
)
{
for
each
(
UDPCLient
*
target
,
list
)
{
for
(
UDPCLient
*
target
:
list
)
{
if
(
target
->
address
==
address
&&
target
->
port
==
port
)
{
return
true
;
}
...
...
@@ -91,7 +91,7 @@ UDPLink::UDPLink(SharedLinkConfigurationPointer& config)
if
(
!
_udpConfig
)
{
qWarning
()
<<
"Internal error"
;
}
for
each
(
const
QHostAddress
&
address
,
QNetworkInterface
::
allAddresses
())
{
for
(
const
QHostAddress
&
address
:
QNetworkInterface
::
allAddresses
())
{
_localAddress
.
append
(
QHostAddress
(
address
));
}
moveToThread
(
this
);
...
...
@@ -156,7 +156,7 @@ bool UDPLink::_isIpLocal(const QHostAddress& add)
// On Windows, this is a very expensive call only Redmond would know
// why. As such, we make it once and keep the list locally. If a new
// interface shows up after we start, it won't be on this list.
for
each
(
const
QHostAddress
&
address
,
_localAddress
)
{
for
(
const
QHostAddress
&
address
:
_localAddress
)
{
if
(
address
==
add
)
{
// This is a local address of the same host
return
true
;
...
...
@@ -171,14 +171,14 @@ void UDPLink::_writeBytes(const QByteArray data)
return
;
}
// Send to all manually targeted systems
for
each
(
UDPCLient
*
target
,
_udpConfig
->
targetHosts
())
{
for
(
UDPCLient
*
target
:
_udpConfig
->
targetHosts
())
{
// Skip it if it's part of the session clients below
if
(
!
contains_target
(
_sessionTargets
,
target
->
address
,
target
->
port
))
{
_writeDataGram
(
data
,
target
);
}
}
// Send to all connected systems
for
each
(
UDPCLient
*
target
,
_sessionTargets
)
{
for
(
UDPCLient
*
target
:
_sessionTargets
)
{
_writeDataGram
(
data
,
target
);
}
}
...
...
@@ -401,7 +401,7 @@ void UDPConfiguration::_copyFrom(LinkConfiguration *source)
if
(
usource
)
{
_localPort
=
usource
->
localPort
();
_clearTargetHosts
();
for
each
(
UDPCLient
*
target
,
usource
->
targetHosts
())
{
for
(
UDPCLient
*
target
:
usource
->
targetHosts
())
{
if
(
!
contains_target
(
_targetHosts
,
target
->
address
,
target
->
port
))
{
UDPCLient
*
newTarget
=
new
UDPCLient
(
target
);
_targetHosts
.
append
(
newTarget
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment