diff options
author | Robin Gareus <robin@gareus.org> | 2016-06-01 19:01:13 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-06-01 19:01:13 +0200 |
commit | 10a91850f2a8663e8825166f7ee3c326c1c63abd (patch) | |
tree | f8f04fb4177350aa8c4efb6977955e6b33fc7c87 /libs | |
parent | 81a2fe39e8e5172b66658eaf3437a2e4584c971d (diff) |
strip trailing whitespace from lv2 log message
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 4c3ca31d2d..5b97b68333 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -237,6 +237,18 @@ log_vprintf(LV2_Log_Handle /*handle*/, { char* str = NULL; const int ret = g_vasprintf(&str, fmt, args); + /* strip trailing whitespace */ + while (strlen (str) > 0 + && ( str[strlen (str) - 1] == '\n' + || str[strlen (str) - 1] == '\r' + || str[strlen (str) - 1] == ' ' + || str[strlen (str) - 1] == '\t')) { + str[strlen (str) - 1] = '\0'; + } + if (strlen (str) == 0) { + return 0; + } + if (type == URIMap::instance().urids.log_Error) { error << str << endmsg; } else if (type == URIMap::instance().urids.log_Warning) { |