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.
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 @@
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() {