From 39bd641b3932a32ff5c46e09545d70088e2fdbfe Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 3 Oct 2014 09:43:18 -0400 Subject: [PATCH] extract last parameter --- SAM.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SAM.cpp b/SAM.cpp index 4f0c956c..b038c1a4 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -359,9 +359,11 @@ namespace stream void SAMSocket::ExtractParams (char * buf, size_t len, std::map& params) { - while (char * separator = strchr (buf, ' ')) + char * separator; + do { - *separator = 0; + separator = strchr (buf, ' '); + if (separator) *separator = 0; char * value = strchr (buf, '='); if (value) { @@ -371,6 +373,7 @@ namespace stream } buf = separator + 1; } + while (separator); } void SAMSocket::Receive ()