summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/messaging/AddressParser.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2012-01-03 19:50:37 +0000
committerGordon Sim <gsim@apache.org>2012-01-03 19:50:37 +0000
commitafde8bd2a03b6ea2416f3a74c060efe78390edcb (patch)
tree0ff61ea3f0e82d05a6d9e75488e84f243e280ccb /cpp/src/qpid/messaging/AddressParser.cpp
parent87cc45e5db0a78d7d1f0e56033cadeeff1bb98e1 (diff)
downloadqpid-python-afde8bd2a03b6ea2416f3a74c060efe78390edcb.tar.gz
QPID-3492: Fix quoted values as well as unquoted values; added a test case
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1226931 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/messaging/AddressParser.cpp')
-rw-r--r--cpp/src/qpid/messaging/AddressParser.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/cpp/src/qpid/messaging/AddressParser.cpp b/cpp/src/qpid/messaging/AddressParser.cpp
index d76210ee5d..67249e188e 100644
--- a/cpp/src/qpid/messaging/AddressParser.cpp
+++ b/cpp/src/qpid/messaging/AddressParser.cpp
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -191,13 +191,14 @@ bool AddressParser::readQuotedValue(Variant& value)
std::string s;
if (readQuotedString(s)) {
value = s;
+ value.setEncoding("utf8");
return true;
} else {
return false;
}
}
-
-bool AddressParser::readSimpleValue(Variant& value)
+
+bool AddressParser::readSimpleValue(Variant& value)
{
std::string s;
if (readWord(s)) {
@@ -217,7 +218,7 @@ bool AddressParser::readWord(std::string& value, const std::string& delims)
//read any number of non-whitespace, non-reserved chars into value
std::string::size_type start = current;
while (!eos() && !iswhitespace() && !in(delims)) ++current;
-
+
if (current > start) {
value = input.substr(start, current - start);
return true;
@@ -229,8 +230,8 @@ bool AddressParser::readWord(std::string& value, const std::string& delims)
bool AddressParser::readChar(char c)
{
while (!eos()) {
- if (iswhitespace()) {
- ++current;
+ if (iswhitespace()) {
+ ++current;
} else if (input.at(current) == c) {
++current;
return true;