From 70a71074990a86e0f8ea2f3f079709aa47d1c038 Mon Sep 17 00:00:00 2001 From: x7z4w Date: Thu, 20 Nov 2025 12:06:00 +0000 Subject: [PATCH] [tts] Fix invalid formatting Signed-off-by: x7z4w --- libs/routing/turns_tts_text.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/routing/turns_tts_text.cpp b/libs/routing/turns_tts_text.cpp index 2dd63f50a..32d93c10b 100644 --- a/libs/routing/turns_tts_text.cpp +++ b/libs/routing/turns_tts_text.cpp @@ -213,15 +213,18 @@ std::string GetTtsText::GetTurnNotification(Notification const & notification) c } } - std::string ttsOut = distDirOntoStreetStr + distStr + // in 100 feet - dirStr + // turn right / take exit - ontoStr + // onto / null - streetOut + // Main Street / 543:: M4: Queens Parkway, London - dirVerb; // (optional "turn right" verb) + char ttsOut[1024]; + std::snprintf(ttsOut, std::size(ttsOut), distDirOntoStreetStr.c_str(), + distStr.c_str(), // in 100 feet + dirStr.c_str(), // turn right / take exit + ontoStr.c_str(), // onto / null + streetOut.c_str(), // Main Street / 543:: M4: Queens Parkway, London + dirVerb.c_str() // (optional "turn right" verb) + ); // remove floating punctuation static boost::regex const rP(" [,\\.:;]+ "); - std::string cleanOut = boost::regex_replace(ttsOut, rP, " "); + std::string cleanOut = boost::regex_replace(std::string(ttsOut), rP, " "); // remove repetitious spaces or colons static boost::regex const rS("[ :]{2,99}"); cleanOut = boost::regex_replace(cleanOut, rS, " ");