From b8ab2ab672050835a79b3d8752c71cb146e07da8 Mon Sep 17 00:00:00 2001 From: Benjamin Jurk <106487517+bnjmnjrk@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:13:23 +0200 Subject: [PATCH] make nsm.h (c)importable from zig The zig cImport feature is not happy with the line `OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") );` because out_msg is a string list and "" is just a string. --- extras/nsm.h/nsm.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/extras/nsm.h/nsm.h b/extras/nsm.h/nsm.h index ad98c97..16d33ab 100644 --- a/extras/nsm.h/nsm.h +++ b/extras/nsm.h/nsm.h @@ -486,8 +486,13 @@ NSM_EXPORT int _nsm_osc_open ( const char *path, const char *types, lo_arg **arg int r = nsm->open( &argv[0]->s, &argv[1]->s, &argv[2]->s, &out_msg, nsm->open_userdata ); - if ( r ) - OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + if ( r ) { + if ( out_msg == NULL) { + OSC_REPLY_ERR( r, ""); + else { + OSC_REPLY_ERR( r, out_msg); + } + } else OSC_REPLY( "OK" ); @@ -513,8 +518,13 @@ NSM_EXPORT int _nsm_osc_save ( const char *path, const char *types, lo_arg **arg int r = nsm->save(&out_msg, nsm->save_userdata ); - if ( r ) - OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + if ( r ) { + if ( out_msg == NULL) { + OSC_REPLY_ERR( r, ""); + else { + OSC_REPLY_ERR( r, out_msg); + } + } else OSC_REPLY( "OK" );