Skip to content

Commit 40d3b59

Browse files
cmaughansamaaron
authored andcommitted
Fix path lens
1 parent 323f8ea commit 40d3b59

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/gui/qt/osc/oschandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ OscHandler::OscHandler(MainWindow *parent, SonicPiLog *outPane, SonicPiLog *inc
2828
incoming = incomingPane;
2929
signal_server_stop = false;
3030
server_started = false;
31-
int last_incoming_path_lens [20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
31+
last_incoming_path_lens.fill(0);
3232
this->theme = theme;
3333
}
3434

@@ -68,7 +68,7 @@ void OscHandler::oscMessage(std::vector<char> buffer)
6868
std::string args;
6969
if (msg->arg().popStr(time).popInt32(id).popStr(address).popStr(args).isOkNoMoreArgs()) {
7070
int max_path_len = 0;
71-
for (int i = 0; i < 20 ; i++) {
71+
for (int i = 0; i < last_incoming_path_lens.size() ; i++) {
7272
if (last_incoming_path_lens[i] > max_path_len) {
7373
max_path_len = last_incoming_path_lens[i];
7474
}
@@ -103,7 +103,7 @@ void OscHandler::oscMessage(std::vector<char> buffer)
103103
//QMetaObject::invokeMethod( incoming, "setTextBgFgColors", Qt::QueuedConnection, Q_ARG(QColor, QColor(255, 153, 0, idmod)), Q_ARG(QColor,g"white"));
104104
QMetaObject::invokeMethod( incoming, "insertPlainText", Qt::QueuedConnection,
105105
Q_ARG(QString, QString::fromStdString(args) ) );
106-
last_incoming_path_lens[id % 20] = int(address.length());
106+
last_incoming_path_lens[id % last_incoming_path_lens.size()] = int(address.length());
107107
}
108108
QMetaObject::invokeMethod( window, "addCuePath", Qt::QueuedConnection, Q_ARG(QString, qs_address), Q_ARG(QString, QString::fromStdString(args)));
109109
} else {

app/gui/qt/osc/oschandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef OSCHANDLER_H
1515
#define OSCHANDLER_H
1616

17+
#include <array>
1718
#include "oscpkt.hh"
1819
#include "mainwindow.h"
1920
class SonicPiTheme;
@@ -32,7 +33,7 @@ class OscHandler
3233
MainWindow *window;
3334
SonicPiLog *out;
3435
SonicPiLog *incoming;
35-
int last_incoming_path_lens [20];
36+
std::array<int, 20> last_incoming_path_lens;
3637

3738
oscpkt::PacketReader pr;
3839
oscpkt::PacketWriter pw;

0 commit comments

Comments
 (0)