mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Merge pull request #2031 from bluca/vector_data
Problem: std:vector.data breaks compat with C++98
This commit is contained in:
commit
7292de8de5
@ -100,7 +100,7 @@ int zmq::ipc_listener_t::create_wildcard_address(std::string& path_,
|
|||||||
|
|
||||||
// We need room for tmp_path + trailing NUL
|
// We need room for tmp_path + trailing NUL
|
||||||
std::vector<char> buffer(tmp_path.length()+1);
|
std::vector<char> buffer(tmp_path.length()+1);
|
||||||
strcpy(buffer.data(), tmp_path.c_str());
|
strcpy (&buffer[0], tmp_path.c_str ());
|
||||||
|
|
||||||
#ifdef HAVE_MKDTEMP
|
#ifdef HAVE_MKDTEMP
|
||||||
// Create the directory. POSIX requires that mkdtemp() creates the
|
// Create the directory. POSIX requires that mkdtemp() creates the
|
||||||
@ -109,22 +109,22 @@ int zmq::ipc_listener_t::create_wildcard_address(std::string& path_,
|
|||||||
// each socket is created in a directory created by mkdtemp(), and
|
// each socket is created in a directory created by mkdtemp(), and
|
||||||
// mkdtemp() guarantees a unique directory name, there will be no
|
// mkdtemp() guarantees a unique directory name, there will be no
|
||||||
// collision.
|
// collision.
|
||||||
if ( mkdtemp(buffer.data()) == 0 ) {
|
if (mkdtemp (&buffer[0]) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
path_.assign(buffer.data());
|
path_.assign (&buffer[0]);
|
||||||
file_.assign (path_ + "/socket");
|
file_.assign (path_ + "/socket");
|
||||||
#else
|
#else
|
||||||
// Silence -Wunused-parameter. #pragma and __attribute__((unused)) are not
|
// Silence -Wunused-parameter. #pragma and __attribute__((unused)) are not
|
||||||
// very portable unfortunately...
|
// very portable unfortunately...
|
||||||
(void) path_;
|
(void) path_;
|
||||||
int fd = mkstemp (buffer.data());
|
int fd = mkstemp (&buffer[0]);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return -1;
|
return -1;
|
||||||
::close (fd);
|
::close (fd);
|
||||||
|
|
||||||
file_.assign (buffer.data());
|
file_.assign (&buffer[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user