Skip to content

Commit 42901df

Browse files
committed
Mark stream_info objects as const where needed
1 parent c9a417f commit 42901df

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/mainwindow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void MainWindow::save_config(QString filename) {
266266
// Stub.
267267
}
268268

269-
QString info_to_listName(lsl::stream_info info) {
269+
QString info_to_listName(const lsl::stream_info& info) {
270270
return QString::fromStdString(info.name() + " (" + info.hostname() + ")");
271271
}
272272

@@ -276,11 +276,11 @@ QString info_to_listName(lsl::stream_info info) {
276276
* @return A vector of found stream_infos
277277
*/
278278
std::vector<lsl::stream_info> MainWindow::refreshStreams() {
279-
std::vector<lsl::stream_info> resolvedStreams = lsl::resolve_streams(1.0);
279+
const std::vector<lsl::stream_info> resolvedStreams = lsl::resolve_streams(1.0);
280280

281281
// For each item in resolvedStreams, ignore if already in knownStreams, otherwise add to knownStreams.
282282
// if in missingStreams then also mark it as required (--> checked by default) and remove from missingStreams.
283-
for (auto& s : resolvedStreams) {
283+
for (const auto& s : resolvedStreams) {
284284
bool known = false;
285285
for (auto &k : knownStreams) {
286286
known |= s.name() == k.name && s.type() == k.type && s.source_id() == k.id;
@@ -308,7 +308,7 @@ std::vector<lsl::stream_info> MainWindow::refreshStreams() {
308308
bool resolved = false;
309309
size_t r_ind = 0;
310310
while (!resolved && r_ind < resolvedStreams.size()) {
311-
lsl::stream_info r = resolvedStreams[r_ind];
311+
const lsl::stream_info r = resolvedStreams[r_ind];
312312
resolved |= (r.name() == k.name) && (r.type() == k.type) && (r.source_id() == k.id);
313313
r_ind++;
314314
}
@@ -339,7 +339,7 @@ std::vector<lsl::stream_info> MainWindow::refreshStreams() {
339339

340340
// return a std::vector of streams of checked and not missing streams.
341341
std::vector<lsl::stream_info> requestedAndAvailableStreams;
342-
for (auto &r : resolvedStreams) {
342+
for (const auto &r : resolvedStreams) {
343343
for (auto &k : knownStreams) {
344344
if ((r.name() == k.name) && (r.type() == k.type) && (r.source_id() == k.id)) {
345345
if (k.checked) { requestedAndAvailableStreams.push_back(r); }

src/recording.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ void recording::record_from_query_results(const std::string &query) {
129129
std::cout << "Watching for a stream with properties " << query << std::endl;
130130
while (!shutdown_) {
131131
// periodically re-resolve the query
132-
std::vector<lsl::stream_info> results = lsl::resolve_stream(query, 0, resolve_interval);
132+
const std::vector<lsl::stream_info> results = lsl::resolve_stream(query, 0, resolve_interval);
133133
// for each result...
134-
for (auto &result : results) {
134+
for (const auto &result : results) {
135135
// if it is a new stream...
136136
std::string _uid = result.uid();
137137
std::string _src_id = result.source_id();

0 commit comments

Comments
 (0)