From 7d47e34e5e8c8c4e452949f74b2842a3af9ed1a0 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Thu, 5 Jul 2007 00:46:09 +0000 Subject: [PATCH] fixed SEMS-9: bug preventing the last parameter to be extracted correctly from contact git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@386 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/registrar_client/ContactInfo.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/registrar_client/ContactInfo.cpp b/apps/registrar_client/ContactInfo.cpp index 06c5b2a4..be6828d3 100644 --- a/apps/registrar_client/ContactInfo.cpp +++ b/apps/registrar_client/ContactInfo.cpp @@ -269,12 +269,15 @@ bool ContactInfo::parse_params(string& line, int& pos) { size_t p1=pos, p2=pos; int st = 0; int quoted = false; char last_c = ' '; + bool hit_comma = false; params.clear(); while((size_t)pos < line.length()) { char c = line[pos]; if (!quoted) { - if (c == ',') + if (c == ',') { + hit_comma = true; break; + } if (c == '\"') { quoted = 1; } else if (c == '=') { @@ -299,9 +302,12 @@ bool ContactInfo::parse_params(string& line, int& pos) { pos++; } - if (st == pS2) - params[line.substr(p1, p2-p1)] = line.substr(p2+1, pos-p2); - + if (st == pS2) { + if (hit_comma) + params[line.substr(p1, p2-p1)] = line.substr(p2+1, pos-p2 -1); + else + params[line.substr(p1, p2-p1)] = line.substr(p2+1, pos-p2); + } return true; }