From 6f438012be8aa9424b7545d57896f40689afed89 Mon Sep 17 00:00:00 2001 From: Ben Kuper Date: Mon, 13 May 2019 18:48:15 +0200 Subject: [PATCH] add option in JUCE to allow forbidden characters in OSC addresses. --- modules/juce_osc/juce_osc.h | 8 ++++++++ modules/juce_osc/osc/juce_OSCAddress.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/modules/juce_osc/juce_osc.h b/modules/juce_osc/juce_osc.h index a9ce36f25d..f8ff29ddd9 100644 --- a/modules/juce_osc/juce_osc.h +++ b/modules/juce_osc/juce_osc.h @@ -54,6 +54,14 @@ #include #include +/** Config: JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS + Enables the use of characters in adress that are not allowed by the OSC specifications (like spaces), but that are used + by some applications anyway (e.g. /my spaced/address) +*/ +#ifndef JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS +#define JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS 0 +#endif + //============================================================================== #include "osc/juce_OSCTypes.h" #include "osc/juce_OSCTimeTag.h" diff --git a/modules/juce_osc/osc/juce_OSCAddress.cpp b/modules/juce_osc/osc/juce_OSCAddress.cpp index f9c17ea94b..8495b5f814 100644 --- a/modules/juce_osc/osc/juce_OSCAddress.cpp +++ b/modules/juce_osc/osc/juce_OSCAddress.cpp @@ -274,10 +274,17 @@ namespace return c >= ' ' && c <= '~'; } +#pragma warning(push) +#pragma warning(disable: 4100) static bool isDisallowedChar (juce_wchar c) noexcept { +#if JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS + return false; +#else return CharPointer_ASCII (Traits::getDisallowedChars()).indexOf (c, false) >= 0; +#endif } +#pragma warning(pop) static bool containsOnlyAllowedPrintableASCIIChars (const String& string) noexcept {