aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/rfb/CMsgWriter.cxx5
-rw-r--r--common/rfb/DecodeManager.cxx33
-rw-r--r--common/rfb/EncodeManager.cxx6
-rw-r--r--common/rfb/H264Decoder.cxx10
-rw-r--r--common/rfb/SMsgWriter.cxx5
-rw-r--r--common/rfb/Security.cxx23
6 files changed, 35 insertions, 47 deletions
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index 8e3f1c27..7d757968 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -65,12 +65,11 @@ void CMsgWriter::writeSetPixelFormat(const PixelFormat& pf)
void CMsgWriter::writeSetEncodings(const std::list<uint32_t> encodings)
{
- std::list<uint32_t>::const_iterator iter;
startMsg(msgTypeSetEncodings);
os->pad(1);
os->writeU16(encodings.size());
- for (iter = encodings.begin(); iter != encodings.end(); ++iter)
- os->writeU32(*iter);
+ for (uint32_t encoding : encodings)
+ os->writeU32(encoding);
endMsg();
}
diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx
index 1e71b8b9..63ab987d 100644
--- a/common/rfb/DecodeManager.cxx
+++ b/common/rfb/DecodeManager.cxx
@@ -97,8 +97,8 @@ DecodeManager::~DecodeManager()
delete producerCond;
delete queueMutex;
- for (size_t i = 0; i < sizeof(decoders)/sizeof(decoders[0]); i++)
- delete decoders[i];
+ for (Decoder* decoder : decoders)
+ delete decoder;
}
bool DecodeManager::decodeRect(const Rect& r, int encoding,
@@ -347,7 +347,6 @@ void DecodeManager::DecodeThread::worker()
DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
{
- std::list<DecodeManager::QueueEntry*>::iterator iter;
Region lockedRegion;
if (manager->workQueue.empty())
@@ -356,15 +355,7 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
if (!manager->workQueue.front()->active)
return manager->workQueue.front();
- for (iter = manager->workQueue.begin();
- iter != manager->workQueue.end();
- ++iter) {
- DecodeManager::QueueEntry* entry;
-
- std::list<DecodeManager::QueueEntry*>::iterator iter2;
-
- entry = *iter;
-
+ for (DecodeManager::QueueEntry* entry : manager->workQueue) {
// Another thread working on this?
if (entry->active)
goto next;
@@ -372,8 +363,10 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
// If this is an ordered decoder then make sure this is the first
// rectangle in the queue for that decoder
if (entry->decoder->flags & DecoderOrdered) {
- for (iter2 = manager->workQueue.begin(); iter2 != iter; ++iter2) {
- if (entry->encoding == (*iter2)->encoding)
+ for (DecodeManager::QueueEntry* entry2 : manager->workQueue) {
+ if (entry2 == entry)
+ break;
+ if (entry->encoding == entry2->encoding)
goto next;
}
}
@@ -381,15 +374,17 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
// For a partially ordered decoder we must ask the decoder for each
// pair of rectangles.
if (entry->decoder->flags & DecoderPartiallyOrdered) {
- for (iter2 = manager->workQueue.begin(); iter2 != iter; ++iter2) {
- if (entry->encoding != (*iter2)->encoding)
+ for (DecodeManager::QueueEntry* entry2 : manager->workQueue) {
+ if (entry2 == entry)
+ break;
+ if (entry->encoding != entry2->encoding)
continue;
if (entry->decoder->doRectsConflict(entry->rect,
entry->bufferStream->data(),
entry->bufferStream->length(),
- (*iter2)->rect,
- (*iter2)->bufferStream->data(),
- (*iter2)->bufferStream->length(),
+ entry2->rect,
+ entry2->bufferStream->data(),
+ entry2->bufferStream->length(),
*entry->server))
goto next;
}
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 7a15e0c2..5c1429d2 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -161,12 +161,10 @@ EncodeManager::EncodeManager(SConnection* conn_)
EncodeManager::~EncodeManager()
{
- std::vector<Encoder*>::iterator iter;
-
logStats();
- for (iter = encoders.begin();iter != encoders.end();iter++)
- delete *iter;
+ for (Encoder* encoder : encoders)
+ delete encoder;
}
void EncodeManager::logStats()
diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx
index 1f79c4ff..26bb9348 100644
--- a/common/rfb/H264Decoder.cxx
+++ b/common/rfb/H264Decoder.cxx
@@ -51,17 +51,17 @@ H264Decoder::~H264Decoder()
void H264Decoder::resetContexts()
{
os::AutoMutex lock(&mutex);
- for (std::deque<H264DecoderContext*>::iterator it = contexts.begin(); it != contexts.end(); it++)
- delete *it;
+ for (H264DecoderContext* context : contexts)
+ delete context;
contexts.clear();
}
H264DecoderContext* H264Decoder::findContext(const Rect& r)
{
os::AutoMutex m(&mutex);
- for (std::deque<H264DecoderContext*>::iterator it = contexts.begin(); it != contexts.end(); it++)
- if ((*it)->isEqualRect(r))
- return *it;
+ for (H264DecoderContext* context : contexts)
+ if (context->isEqualRect(r))
+ return context;
return nullptr;
}
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx
index 43d97853..0c03b51d 100644
--- a/common/rfb/SMsgWriter.cxx
+++ b/common/rfb/SMsgWriter.cxx
@@ -508,10 +508,9 @@ void SMsgWriter::writeNoDataRects()
{
if (!extendedDesktopSizeMsgs.empty()) {
if (client->supportsEncoding(pseudoEncodingExtendedDesktopSize)) {
- std::list<ExtendedDesktopSizeMsg>::const_iterator ri;
- for (ri = extendedDesktopSizeMsgs.begin();ri != extendedDesktopSizeMsgs.end();++ri) {
+ for (ExtendedDesktopSizeMsg msg : extendedDesktopSizeMsgs) {
// FIXME: We can probably skip multiple reasonServer entries
- writeExtendedDesktopSizeRect(ri->reason, ri->result,
+ writeExtendedDesktopSizeRect(msg.reason, msg.result,
client->width(), client->height(),
client->screenLayout());
}
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index 55f766a1..01191c65 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -52,23 +52,22 @@ Security::Security(StringParameter &secTypes)
const std::list<uint8_t> Security::GetEnabledSecTypes(void)
{
list<uint8_t> result;
- list<uint32_t>::iterator i;
/* Partial workaround for Vino's stupid behaviour. It doesn't allow
* the basic authentication types as part of the VeNCrypt handshake,
* making it impossible for a client to do opportunistic encryption.
* At least make it possible to connect when encryption is explicitly
* disabled. */
- for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) {
- if (*i >= 0x100) {
+ for (uint32_t type : enabledSecTypes) {
+ if (type >= 0x100) {
result.push_back(secTypeVeNCrypt);
break;
}
}
- for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++)
- if (*i < 0x100)
- result.push_back(*i);
+ for (uint32_t type : enabledSecTypes)
+ if (type < 0x100)
+ result.push_back(type);
return result;
}
@@ -76,11 +75,10 @@ const std::list<uint8_t> Security::GetEnabledSecTypes(void)
const std::list<uint32_t> Security::GetEnabledExtSecTypes(void)
{
list<uint32_t> result;
- list<uint32_t>::iterator i;
- for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++)
- if (*i != secTypeVeNCrypt) /* Do not include VeNCrypt type to avoid loops */
- result.push_back(*i);
+ for (uint32_t type : enabledSecTypes)
+ if (type != secTypeVeNCrypt) /* Do not include VeNCrypt type to avoid loops */
+ result.push_back(type);
return result;
}
@@ -107,15 +105,14 @@ bool Security::IsSupported(uint32_t secType)
char *Security::ToString(void)
{
- list<uint32_t>::iterator i;
static char out[128]; /* Should be enough */
bool firstpass = true;
const char *name;
memset(out, 0, sizeof(out));
- for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) {
- name = secTypeName(*i);
+ for (uint32_t type : enabledSecTypes) {
+ name = secTypeName(type);
if (name[0] == '[') /* Unknown security type */
continue;