From b4bbf80dcb7276baf3405c12162f28f8de77a1e5 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sun, 1 May 2016 20:15:12 -0400 Subject: [PATCH] Minor adjustments to reIterBegin and reIterNext --- Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp index 210a3c4..4c24ac8 100644 --- a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp @@ -459,7 +459,6 @@ bool reIterBegin(Linker::SimObject* obj, S32 argc, const char* argv[]) currentRegex = std::regex(argv[1], std::regex::extended); currentString = std::string(argv[2]); matchBegin = std::sregex_iterator(currentString.begin(), currentString.end(), currentRegex); - matchEnd = std::sregex_iterator(); currentMatchIter = matchBegin; return true; @@ -480,8 +479,11 @@ bool reIterEnd(Linker::SimObject* obj, S32 argc, const char* argv[]) const char* reIterNext(Linker::SimObject* obj, S32 argc, const char* argv[]) { + if (currentMatchIter == matchEnd) + return "-1"; + std::string currentResult = (*currentMatchIter).str(); ++currentMatchIter; - return currentResult.c_str(); + return currentResult.data(); } \ No newline at end of file