NO-JIRA: cpp: fix clang c++11 compile error in url::impl url::impl had explict dtor (delete[] raw C char array) but no explict copy ctor. Replaced raw char* with vector<char> and removed the explicit dtor.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/8c306f29 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/8c306f29 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/8c306f29 Branch: refs/heads/go1 Commit: 8c306f2964a5f19898b258729393814646d3acb6 Parents: 6af49b8 Author: Alan Conway <[email protected]> Authored: Wed Nov 23 11:24:11 2016 -0500 Committer: Alan Conway <[email protected]> Committed: Wed Nov 23 11:24:11 2016 -0500 ---------------------------------------------------------------------- proton-c/bindings/cpp/src/url.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c306f29/proton-c/bindings/cpp/src/url.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/url.cpp b/proton-c/bindings/cpp/src/url.cpp index 1aa01e1..867f605 100644 --- a/proton-c/bindings/cpp/src/url.cpp +++ b/proton-c/bindings/cpp/src/url.cpp @@ -29,6 +29,7 @@ #include <cstring> #include <iomanip> #include <sstream> +#include <vector> namespace { @@ -156,20 +157,15 @@ struct url::impl { const char* host; const char* port; const char* path; - char* cstr; + std::vector<char> cstr; mutable std::string str; impl(const std::string& s) : - scheme(0), username(0), password(0), host(0), port(0), path(0), - cstr(new char[s.size()+1]) + scheme(0), username(0), password(0), host(0), port(0), path(0), + cstr(s.size()+1, '\0') { - std::strncpy(cstr, s.c_str(), s.size()); - cstr[s.size()] = 0; - parse_url(cstr, &scheme, &username, &password, &host, &port, &path); - } - - ~impl() { - delete [] cstr; + std::copy(s.begin(), s.end(), cstr.begin()); + parse_url(&cstr[0], &scheme, &username, &password, &host, &port, &path); } void defaults() { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
