From 669ac2cc8f0496c6f31eea741d09b7b7d66044f8 Mon Sep 17 00:00:00 2001 From: Ben Kuper Date: Sat, 22 Jun 2024 20:11:46 +0200 Subject: [PATCH] added allow special chars in address --- modules/juce_osc/juce_osc.h | 8 ++++++++ modules/juce_osc/osc/juce_OSCAddress.cpp | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/juce_osc/juce_osc.h b/modules/juce_osc/juce_osc.h index d171c10355..19eeb7665c 100644 --- a/modules/juce_osc/juce_osc.h +++ b/modules/juce_osc/juce_osc.h @@ -60,6 +60,14 @@ #pragma once #define JUCE_OSC_H_INCLUDED + +/** 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 /** Config: JUCE_IP_AND_PORT_DETECTION If enabled, this will add remoteIP and remotePort variables to osc packets, corresponding to the sender's ip and port when receiving messages. */ diff --git a/modules/juce_osc/osc/juce_OSCAddress.cpp b/modules/juce_osc/osc/juce_OSCAddress.cpp index c13872cf7e..99e1358de6 100644 --- a/modules/juce_osc/osc/juce_OSCAddress.cpp +++ b/modules/juce_osc/osc/juce_OSCAddress.cpp @@ -285,7 +285,11 @@ namespace static bool isDisallowedChar (juce_wchar c) noexcept { - return CharPointer_ASCII (Traits::getDisallowedChars()).indexOf (c, false) >= 0; +#if JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS + return false; +#else + return CharPointer_ASCII( Traits::getDisallowedChars()).indexOf (c, false) >= 0; +#endif } static bool containsOnlyAllowedPrintableASCIIChars (const String& string) noexcept