From 9c4273063485d100dd99e92ba718214c6863861f Mon Sep 17 00:00:00 2001 From: Nep Date: Wed, 16 Jun 2021 11:14:45 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=97=E3=82=87=E3=81=BC=E3=81=84=E3=82=AB?= =?UTF-8?q?=E3=83=AC=E3=83=B3=E3=83=80=E3=83=BC=E3=81=AE=E8=A9=B1=E6=95=B0?= =?UTF-8?q?=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AnnictRecorder/SyoboCalApi.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/AnnictRecorder/SyoboCalApi.h b/AnnictRecorder/SyoboCalApi.h index 4fbc56f..c0fd1f0 100644 --- a/AnnictRecorder/SyoboCalApi.h +++ b/AnnictRecorder/SyoboCalApi.h @@ -60,12 +60,13 @@ namespace SyoboCal float_t countEnd = 0; // 複数話同時放送の場合 SubTitle フィールドに #[\d\.]+~#[\d\.]+ という形式で格納されている - const auto subTitle = node.child_value("SubTitle"); - const auto subTitleRegex = std::regex(R"(^#([\d\.]+)~#([\d\.]+)$)"); - if (std::cmatch match; std::regex_match(subTitle, match, subTitleRegex)) + // マルチバイトな正規表現に難があるので wchar を経由する + const auto subTitle = Multi2Wide(node.child_value("SubTitle")); + const auto subTitleRegex = std::wregex(LR"(^#([\d\.]+)~#([\d\.]+)$)"); + if (std::wcmatch match; std::regex_match(subTitle.c_str(), match, subTitleRegex)) { - countStart = strtof(match[1].str().c_str(), nullptr); - countEnd = strtof(match[2].str().c_str(), nullptr); + countStart = static_cast(_wtof(match[1].str().c_str())); + countEnd = static_cast(_wtof(match[2].str().c_str())); } // 通常 (単話放送) 時 else