diff options
-rw-r--r-- | osc_server.cpp | 8 | ||||
-rw-r--r-- | osc_server.h | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/osc_server.cpp b/osc_server.cpp index 119d276..7b220cd 100644 --- a/osc_server.cpp +++ b/osc_server.cpp @@ -65,7 +65,7 @@ OSCServer::OSCServer(const char *port) { server = lo_server_thread_new(port, error_handler); - add_method(NULL, generic_handler, NULL, ""); + add_method(NULL, generic_handler, NULL, NULL); } void @@ -75,8 +75,10 @@ OSCServer::add_method_v(MethodHandlerId **hnd, const char *types, { char buf[255]; - vsnprintf(buf, sizeof(buf), fmt, ap); - lo_server_thread_add_method(server, buf, types, handler, data); + if (fmt) + vsnprintf(buf, sizeof(buf), fmt, ap); + lo_server_thread_add_method(server, fmt ? buf : NULL, types, + handler, data); if (hnd) *hnd = new MethodHandlerId(types, buf, data); diff --git a/osc_server.h b/osc_server.h index b14dfa8..2380028 100644 --- a/osc_server.h +++ b/osc_server.h @@ -37,7 +37,8 @@ public: private: void add_method_v(MethodHandlerId **hnd, const char *types, lo_method_handler handler, void *data, - const char *fmt, va_list ap); + const char *fmt, va_list ap) + __attribute__((format(printf, 6, 0))); public: typedef void (*MethodHandlerCb)(Layer *obj, lo_arg **argv); @@ -62,6 +63,7 @@ public: add_method(MethodHandlerId **hnd, const char *types, lo_method_handler handler, void *data, const char *fmt, ...) + __attribute__((format(printf, 6, 7))) { va_list ap; va_start(ap, fmt); @@ -72,6 +74,7 @@ public: add_method(const char *types, lo_method_handler handler, void *data, const char *fmt, ...) + __attribute__((format(printf, 5, 6))) { va_list ap; va_start(ap, fmt); @@ -79,7 +82,8 @@ public: va_end(ap); } - void del_method(const char *types, const char *fmt, ...); + void del_method(const char *types, const char *fmt, ...) + __attribute__((format(printf, 3, 4))); inline void del_method(MethodHandlerId *hnd) { |