aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jack.c4
-rw-r--r--src/jalv.c8
-rw-r--r--src/jalv_gtkmm2.cpp14
-rw-r--r--src/jalv_internal.h8
-rw-r--r--src/jalv_qt.cpp48
-rw-r--r--src/state.c5
-rw-r--r--src/worker.c37
m---------waflib0
-rw-r--r--wscript111
9 files changed, 159 insertions, 76 deletions
diff --git a/src/jack.c b/src/jack.c
index 7a3d6dc..a27e261 100644
--- a/src/jack.c
+++ b/src/jack.c
@@ -177,7 +177,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
{ 0, jalv->urids.patch_Get } };
lv2_evbuf_write(&iter, 0, 0,
get.atom.type, get.atom.size,
- (const uint8_t*)LV2_ATOM_BODY(&get));
+ (const uint8_t*)LV2_ATOM_BODY_CONST(&get));
}
if (port->sys_port) {
@@ -496,7 +496,7 @@ jalv_backend_activate_port(Jalv* jalv, uint32_t port_index)
if (port->sys_port) {
// Set port order to index
char index_str[16];
- snprintf(index_str, sizeof(index_str), "%d", port_index);
+ snprintf(index_str, sizeof(index_str), "%u", port_index);
jack_set_property(client, jack_port_uuid(port->sys_port),
"http://jackaudio.org/metadata/order", index_str,
"http://www.w3.org/2001/XMLSchema#integer");
diff --git a/src/jalv.c b/src/jalv.c
index 09b15e3..e3f4069 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -470,13 +470,13 @@ jalv_ui_write(void* const jalv_handle,
Jalv* const jalv = (Jalv*)jalv_handle;
if (protocol != 0 && protocol != jalv->urids.atom_eventTransfer) {
- fprintf(stderr, "UI write with unsupported protocol %d (%s)\n",
+ fprintf(stderr, "UI write with unsupported protocol %u (%s)\n",
protocol, unmap_uri(jalv, protocol));
return;
}
if (port_index >= jalv->num_ports) {
- fprintf(stderr, "UI write to out of range port index %d\n",
+ fprintf(stderr, "UI write to out of range port index %u\n",
port_index);
return;
}
@@ -528,7 +528,7 @@ jalv_apply_ui_events(Jalv* jalv, uint32_t nframes)
lv2_evbuf_write(&e, nframes, 0, atom->type, atom->size,
(const uint8_t*)LV2_ATOM_BODY_CONST(atom));
} else {
- fprintf(stderr, "error: Unknown control change protocol %d\n",
+ fprintf(stderr, "error: Unknown control change protocol %u\n",
ev.protocol);
}
}
@@ -1093,7 +1093,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
/* The UI can only go so fast, clamp to reasonable limits */
jalv->ui_update_hz = MIN(60, jalv->ui_update_hz);
jalv->opts.buffer_size = MAX(4096, jalv->opts.buffer_size);
- fprintf(stderr, "Comm buffers: %d bytes\n", jalv->opts.buffer_size);
+ fprintf(stderr, "Comm buffers: %u bytes\n", jalv->opts.buffer_size);
fprintf(stderr, "Update rate: %.01f Hz\n", jalv->ui_update_hz);
/* Build options array to pass to plugin */
diff --git a/src/jalv_gtkmm2.cpp b/src/jalv_gtkmm2.cpp
index 3f5a0e9..065b971 100644
--- a/src/jalv_gtkmm2.cpp
+++ b/src/jalv_gtkmm2.cpp
@@ -24,7 +24,7 @@ LV2_DISABLE_DEPRECATION_WARNINGS
#include <gtkmm/window.h>
LV2_RESTORE_WARNINGS
-Gtk::Main* jalv_gtk_main = NULL;
+static Gtk::Main* jalv_gtk_main = nullptr;
int
jalv_init(int* argc, char*** argv, JalvOptions* opts)
@@ -70,23 +70,27 @@ jalv_open_ui(Jalv* jalv)
Gtk::Window* window = new Gtk::Window();
if (jalv->ui) {
- jalv_ui_instantiate(jalv, jalv_native_ui_type(), NULL);
+ jalv_ui_instantiate(jalv, jalv_native_ui_type(), nullptr);
}
if (jalv->ui_instance) {
- GtkWidget* widget = (GtkWidget*)suil_instance_get_widget(
- jalv->ui_instance);
+ GtkWidget* widget = static_cast<GtkWidget*>(
+ suil_instance_get_widget(jalv->ui_instance));
+
Gtk::Widget* widgetmm = Glib::wrap(widget);
window->add(*Gtk::manage(widgetmm));
widgetmm->show_all();
g_timeout_add(1000 / jalv->ui_update_hz,
- (GSourceFunc)jalv_update, jalv);
+ reinterpret_cast<GSourceFunc>(jalv_update),
+ jalv);
} else {
Gtk::Button* button = Gtk::manage(new Gtk::Button("Close"));
window->add(*Gtk::manage(button));
}
+ jalv_init_ui(jalv);
+
window->set_resizable(jalv_ui_is_resizable(jalv));
window->show_all();
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 3bfc102..0932460 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -58,6 +58,12 @@
# define REALTIME
#endif
+#ifdef __GNUC__
+# define JALV_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
+#else
+# define JALV_LOG_FUNC(fmt, arg1)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -526,11 +532,13 @@ jalv_strjoin(const char* a, const char* b)
return out;
}
+JALV_LOG_FUNC(3, 4)
int
jalv_printf(LV2_Log_Handle handle,
LV2_URID type,
const char* fmt, ...);
+JALV_LOG_FUNC(3, 0)
int
jalv_vprintf(LV2_Log_Handle handle,
LV2_URID type,
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index f23a005..bf211f0 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -48,7 +48,7 @@
#define CONTROL_WIDTH 150
#define DIAL_STEPS 10000
-static QApplication* app = NULL;
+static QApplication* app = nullptr;
class FlowLayout : public QLayout
{
@@ -60,20 +60,20 @@ public:
FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
- ~FlowLayout();
+ ~FlowLayout() override;
- void addItem(QLayoutItem* item);
+ void addItem(QLayoutItem* item) override;
int horizontalSpacing() const;
int verticalSpacing() const;
- Qt::Orientations expandingDirections() const;
- bool hasHeightForWidth() const;
- int heightForWidth(int) const;
- int count() const;
- QLayoutItem* itemAt(int index) const;
- QSize minimumSize() const;
- void setGeometry(const QRect &rect);
- QSize sizeHint() const;
- QLayoutItem* takeAt(int index);
+ Qt::Orientations expandingDirections() const override;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ int count() const override;
+ QLayoutItem* itemAt(int index) const override;
+ QSize minimumSize() const override;
+ void setGeometry(const QRect &rect) override;
+ QSize sizeHint() const override;
+ QLayoutItem* takeAt(int index) override;
private:
int doLayout(const QRect &rect, bool testOnly) const;
@@ -148,14 +148,14 @@ FlowLayout::takeAt(int index)
if (index >= 0 && index < itemList.size()) {
return itemList.takeAt(index);
} else {
- return 0;
+ return nullptr;
}
}
Qt::Orientations
FlowLayout::expandingDirections() const
{
- return 0;
+ return Qt::Orientations();
}
bool
@@ -249,7 +249,7 @@ FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
return -1;
} else if (parent->isWidgetType()) {
QWidget* pw = static_cast<QWidget*>(parent);
- return pw->style()->pixelMetric(pm, 0, pw);
+ return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout*>(parent)->spacing();
}
@@ -288,7 +288,7 @@ class Control : public QGroupBox
Q_OBJECT
public:
- Control(PortContainer portContainer, QWidget* parent = 0);
+ Control(PortContainer portContainer, QWidget* parent = nullptr);
Q_SLOT void dialChanged(int value);
@@ -368,7 +368,7 @@ class Timer : public QTimer
public:
explicit Timer(Jalv* jalv) : _jalv(jalv) {}
- void timerEvent(QTimerEvent* e) {
+ void timerEvent(QTimerEvent* e) override {
jalv_update(_jalv);
}
@@ -630,8 +630,8 @@ build_control_widget(Jalv* jalv)
FlowLayout* flowLayout = new FlowLayout();
QLayout* layout = flowLayout;
- LilvNode* lastGroup = NULL;
- QHBoxLayout* groupLayout = NULL;
+ LilvNode* lastGroup = nullptr;
+ QHBoxLayout* groupLayout = nullptr;
for (int i = 0; i < portContainers.count(); ++i) {
PortContainer portContainer = portContainers[i];
Port* port = portContainer.port;
@@ -643,10 +643,10 @@ build_control_widget(Jalv* jalv)
if (!lilv_node_equals(group, lastGroup)) {
/* Group has changed */
LilvNode* groupName = lilv_world_get(
- world, group, jalv->nodes.lv2_name, NULL);
+ world, group, jalv->nodes.lv2_name, nullptr);
if (!groupName) {
groupName = lilv_world_get(
- world, group, jalv->nodes.rdfs_label, NULL);
+ world, group, jalv->nodes.rdfs_label, nullptr);
}
QGroupBox* groupBox = new QGroupBox(lilv_node_as_string(groupName));
@@ -715,8 +715,8 @@ jalv_open_ui(Jalv* jalv)
QWidget* controlWidget = build_control_widget(jalv);
widget = new QScrollArea();
- ((QScrollArea*)widget)->setWidget(controlWidget);
- ((QScrollArea*)widget)->setWidgetResizable(true);
+ static_cast<QScrollArea*>(widget)->setWidget(controlWidget);
+ static_cast<QScrollArea*>(widget)->setWidgetResizable(true);
widget->setMinimumWidth(800);
widget->setMinimumHeight(600);
}
@@ -728,6 +728,8 @@ jalv_open_ui(Jalv* jalv)
win->setCentralWidget(widget);
app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));
+ jalv_init_ui(jalv);
+
win->show();
if (jalv->ui_instance && !jalv_ui_is_resizable(jalv)) {
widget->setMinimumSize(widget->width(), widget->height());
diff --git a/src/state.c b/src/state.c
index dab6c02..4f8100a 100644
--- a/src/state.c
+++ b/src/state.c
@@ -31,11 +31,6 @@
#include <sys/stat.h>
#include <sys/types.h>
-#define NS_JALV "http://drobilla.net/ns/jalv#"
-#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#"
-#define NS_XSD "http://www.w3.org/2001/XMLSchema#"
-
char*
jalv_make_path(LV2_State_Make_Path_Handle handle,
const char* path)
diff --git a/src/worker.c b/src/worker.c
index 8cb09d1..79bb7b7 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -22,10 +22,6 @@ jalv_worker_respond(LV2_Worker_Respond_Handle handle,
const void* data)
{
JalvWorker* worker = (JalvWorker*)handle;
- if (zix_ring_write_space(worker->responses) < (sizeof(size) + size)) {
- return LV2_WORKER_ERR_NO_SPACE;
- }
-
zix_ring_write(worker->responses, (const char*)&size, sizeof(size));
zix_ring_write(worker->responses, (const char*)data, size);
return LV2_WORKER_SUCCESS;
@@ -129,36 +125,17 @@ void
jalv_worker_emit_responses(JalvWorker* worker, LilvInstance* instance)
{
if (worker->responses) {
- uint32_t read_space = 0;
- while (read_space = zix_ring_read_space(worker->responses)) {
+ uint32_t read_space = zix_ring_read_space(worker->responses);
+ while (read_space) {
uint32_t size = 0;
- if (zix_ring_peek(worker->responses, (char*)&size, sizeof(size)) <= 0) {
- fprintf(stderr, "error: Response buffer corrupted (req %lu avail %u)\n",
- sizeof(size), read_space);
- break;
- }
-
- const uint32_t packet_size = sizeof(size) + size;
- if (read_space < packet_size) {
- fprintf(stderr, "warning: Try to read bigger response (%u) than data available (%u). Retry later.\n",
- packet_size, read_space);
- break;
- }
-
- if (zix_ring_skip(worker->responses, sizeof(size)) <= 0) {
- fprintf(stderr, "error: Response buffer corrupted on skip (req %lu avail %u)\n",
- sizeof(size), read_space);
- break;
- }
-
- if (zix_ring_read(worker->responses, (char*)worker->response, size) <= 0) {
- fprintf(stderr, "error: Response buffer corrupted on read response (req %u avail %u)\n",
- size, zix_ring_read_space(worker->responses));
- break;
- }
+ zix_ring_read(worker->responses, (char*)&size, sizeof(size));
+
+ zix_ring_read(worker->responses, (char*)worker->response, size);
worker->iface->work_response(
instance->lv2_handle, size, worker->response);
+
+ read_space -= sizeof(size) + size;
}
}
}
diff --git a/waflib b/waflib
-Subproject 0bde0c2e022c479b8c7e3933eca0cbc01282562
+Subproject 116a28fa5f92e58a46dc878751019ba74a61e54
diff --git a/wscript b/wscript
index 33be578..4562825 100644
--- a/wscript
+++ b/wscript
@@ -42,6 +42,71 @@ def configure(conf):
conf.load('autowaf', cache=True)
autowaf.set_c_lang(conf, 'c99')
+ if Options.options.ultra_strict:
+ autowaf.add_compiler_flags(conf.env, 'c', {
+ 'clang': [
+ '-Wno-bad-function-cast',
+ '-Wno-missing-noreturn',
+ ],
+ 'gcc': [
+ '-Wno-bad-function-cast',
+ '-Wno-c++-compat',
+ ],
+ })
+
+ autowaf.add_compiler_flags(conf.env, '*', {
+ 'clang': [
+ '-Wno-atomic-implicit-seq-cst',
+ '-Wno-c99-extensions',
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-documentation-unknown-command',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-format-nonliteral',
+ '-Wno-implicit-fallthrough',
+ '-Wno-implicit-float-conversion',
+ '-Wno-padded',
+ '-Wno-redundant-parens',
+ '-Wno-reserved-id-macro',
+ '-Wno-shorten-64-to-32',
+ '-Wno-sign-conversion',
+ '-Wno-switch-enum',
+ '-Wno-unused-macros',
+ '-Wno-unused-parameter',
+ '-Wno-vla',
+ ],
+ 'gcc': [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-conversion',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-padded',
+ '-Wno-pedantic',
+ '-Wno-stack-protector',
+ '-Wno-switch-enum',
+ '-Wno-unused-macros',
+ '-Wno-unused-parameter',
+ '-Wno-vla',
+ ],
+ })
+
+ autowaf.add_compiler_flags(conf.env, 'cxx', {
+ 'clang': [
+ '-Wno-extra-semi-stmt',
+ '-Wno-old-style-cast',
+ '-Wno-weak-vtables',
+ '-Wno-zero-as-null-pointer-constant',
+ ],
+ 'gcc': [
+ '-Wno-effc++',
+ ],
+ })
+
conf.check_pkg('lv2 >= 1.17.2', uselib_store='LV2')
conf.check_pkg('lilv-0 >= 0.24.0', uselib_store='LILV')
conf.check_pkg('serd-0 >= 0.24.0', uselib_store='SERD')
@@ -49,31 +114,45 @@ def configure(conf):
conf.check_pkg('sratom-0 >= 0.6.0', uselib_store='SRATOM')
if Options.options.portaudio:
conf.check_pkg('portaudio-2.0 >= 2.0.0',
- uselib_store='PORTAUDIO', mandatory=False)
+ uselib_store='PORTAUDIO',
+ system=True,
+ mandatory=False)
else:
- conf.check_pkg('jack >= 0.120.0', uselib_store='JACK')
+ conf.check_pkg('jack >= 0.120.0',
+ uselib_store='JACK',
+ system=True)
if not Options.options.no_gui and not Options.options.no_gtk:
if not Options.options.no_gtk2:
- conf.check_pkg('gtk+-2.0 >= 2.18.0', uselib_store='GTK2',
+ conf.check_pkg('gtk+-2.0 >= 2.18.0',
+ uselib_store='GTK2',
+ system=True,
mandatory=False)
if not Options.options.no_gtkmm:
- conf.check_pkg('gtkmm-2.4 >= 2.20.0', uselib_store='GTKMM2',
+ conf.check_pkg('gtkmm-2.4 >= 2.20.0',
+ uselib_store='GTKMM2',
+ system=True,
mandatory=False)
if not Options.options.no_gtk3:
- conf.check_pkg('gtk+-3.0 >= 3.0.0', uselib_store='GTK3',
+ conf.check_pkg('gtk+-3.0 >= 3.0.0',
+ uselib_store='GTK3',
+ system=True,
mandatory=False)
if not Options.options.no_gui and not Options.options.no_qt:
if not Options.options.no_qt4:
- conf.check_pkg('QtGui >= 4.0.0', uselib_store='QT4',
+ conf.check_pkg('QtGui >= 4.0.0',
+ uselib_store='QT4',
+ system=True,
mandatory=False)
if conf.env.HAVE_QT4:
if not conf.find_program('moc-qt4', var='MOC4', mandatory=False):
conf.find_program('moc', var='MOC4')
if not Options.options.no_qt5:
- conf.check_pkg('Qt5Widgets >= 5.1.0', uselib_store='QT5',
+ conf.check_pkg('Qt5Widgets >= 5.1.0',
+ uselib_store='QT5',
+ system=True,
mandatory=False)
if conf.env.HAVE_QT5:
if not conf.find_program('moc-qt5', var='MOC5', mandatory=False):
@@ -90,12 +169,20 @@ def configure(conf):
header_name = 'jack/jack.h',
define_name = 'HAVE_JACK_PORT_TYPE_GET_BUFFER_SIZE',
uselib = 'JACK',
+ return_type = 'size_t',
+ arg_types = 'jack_client_t*,const char*',
mandatory = False)
conf.check_function('c', 'jack_set_property',
header_name = 'jack/metadata.h',
define_name = 'HAVE_JACK_METADATA',
uselib = 'JACK',
+ return_type = 'int',
+ arg_types = '''jack_client_t*,
+ jack_uuid_t,
+ const char*,
+ const char*,
+ const char*''',
mandatory = False)
defines = ['_POSIX_C_SOURCE=200809L']
@@ -104,24 +191,34 @@ def configure(conf):
header_name = 'unistd.h',
defines = defines,
define_name = 'HAVE_ISATTY',
+ return_type = 'int',
+ arg_types = 'int',
mandatory = False)
conf.check_function('c', 'fileno',
header_name = 'stdio.h',
defines = defines,
define_name = 'HAVE_FILENO',
+ return_type = 'int',
+ arg_types = 'FILE*',
mandatory = False)
conf.check_function('c', 'mlock',
header_name = 'sys/mman.h',
defines = defines,
define_name = 'HAVE_MLOCK',
+ return_type = 'int',
+ arg_types = 'const void*,size_t',
mandatory = False)
conf.check_function('c', 'sigaction',
header_name = 'signal.h',
defines = defines,
define_name = 'HAVE_SIGACTION',
+ return_type = 'int',
+ arg_types = '''int,
+ const struct sigaction*,
+ struct sigaction*''',
mandatory = False)
if not Options.options.no_jack_session: