[cpp-sp] 03/06: Add back safe/unsafe string distinction while round-tripping.
Scott Cantor
cantor.2 at osu.edu
Fri Nov 1 13:04:16 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=ffd0e2c7325c6cdeeadc979809b729d966c1510f
commit ffd0e2c7325c6cdeeadc979809b729d966c1510f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon May 17 15:48:57 2021 -0400
Add back safe/unsafe string distinction while round-tripping.
---
shibsp/remoting/impl/ddf.cpp | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/shibsp/remoting/impl/ddf.cpp b/shibsp/remoting/impl/ddf.cpp
index bd994945..72e654a5 100644
--- a/shibsp/remoting/impl/ddf.cpp
+++ b/shibsp/remoting/impl/ddf.cpp
@@ -879,7 +879,8 @@ void serialize(ddf_body_t* p, ostream& os)
break;
case ddf_body_t::DDF_STRING:
- os << ddf_body_t::DDF_STRING;
+ case ddf_body_t::DDF_STRING_UNSAFE:
+ os << p->type;
if (p->value.string) {
os << ' ';
encode(os, p->value.string);
@@ -971,11 +972,17 @@ DDF deserialize(istream& is)
return obj;
case ddf_body_t::DDF_STRING:
+ case ddf_body_t::DDF_STRING_UNSAFE:
{
string valstr;
source >> valstr;
if (!source || valstr.empty()) {
- obj.string(valstr.c_str());
+ if (type == ddf_body_t::DDF_STRING) {
+ obj.string(valstr.c_str());
+ }
+ else {
+ obj.unsafe_string(valstr.c_str());
+ }
return obj;
}
char* dup = strdup(valstr.c_str());
@@ -994,7 +1001,7 @@ DDF deserialize(istream& is)
dup[x] = '\0';
// Store without extra copy.
- obj.string(dup, false);
+ obj.string(dup, false, type == ddf_body_t::DDF_STRING);
}
break;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list