Skip to content

Commit b29d95d

Browse files
committed
[#3211] Renamed getDataAsVP
1 parent a7e0c79 commit b29d95d

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

src/lib/dhcp/pkt_filter_inet.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ PktFilterInet::send(const Iface&, uint16_t sockfd, const Pkt4Ptr& pkt) {
269269
memset(&v, 0, sizeof(v));
270270
// iov_base field is of void * type. We use it for packet
271271
// transmission, so this buffer will not be modified.
272-
v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVP());
272+
v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVoidPtr());
273273
v.iov_len = pkt->getBuffer().getLength();
274274
m.msg_iov = &v;
275275
m.msg_iovlen = 1;

src/lib/dhcp/pkt_filter_inet6.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ PktFilterInet6::send(const Iface&, uint16_t sockfd, const Pkt6Ptr& pkt) {
322322
// to assign const void* to void*.
323323
struct iovec v;
324324
memset(&v, 0, sizeof(v));
325-
v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVP());
325+
v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVoidPtr());
326326
v.iov_len = pkt->getBuffer().getLength();
327327
m.msg_iov = &v;
328328
m.msg_iovlen = 1;

src/lib/dhcp/tests/pkt_filter6_test_utils.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ PktFilter6Test::sendMessage() {
119119
// The iovec structure holds the packet data.
120120
struct iovec v;
121121
memset(&v, 0, sizeof(v));
122-
v.iov_base = const_cast<void *>(test_message_->getBuffer().getDataAsVP());
122+
v.iov_base = const_cast<void *>(test_message_->getBuffer().getDataAsVoidPtr());
123123
v.iov_len = test_message_->getBuffer().getLength();
124124
// Assign the iovec to msghdr structure.
125125
m.msg_iov = &v;

src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ Dhcp4o6IpcBaseTest::testReceiveError(const Pkt6Ptr& pkt) {
336336
buf.clear();
337337
ASSERT_NO_THROW(pkt->pack());
338338

339-
ASSERT_NE(-1, ::send(ipc_src.getSocketFd(), buf.getDataAsVP(),
339+
ASSERT_NE(-1, ::send(ipc_src.getSocketFd(), buf.getDataAsVoidPtr(),
340340
buf.getLength(), 0));
341341

342342
// Call receive with a timeout. The data should appear on the socket

src/lib/util/buffer.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,20 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
295295
/// // pass the buffer to a DNS message object to construct a wire-format
296296
/// // DNS message.
297297
/// struct sockaddr to;
298-
/// sendto(s, buffer.getDataAsVP(), buffer.getLength(), 0, &to, sizeof(to));
298+
/// sendto(s, buffer.getDataAsVoidPtr(), buffer.getLength(), 0, &to, sizeof(to));
299299
/// @endcode
300300
///
301-
/// where the @c getData() method gives a reference to the internal
302-
/// memory region stored in the @c buffer object. This is a
303-
/// suboptimal design in that it exposes an encapsulated "handle" of
304-
/// an object to its user. Unfortunately, there is no easy way to
305-
/// avoid this without involving expensive data copy if we want to use
306-
/// this object with a legacy API such as a BSD socket interface.
307-
/// And, indeed, this is one major purpose for this object.
308-
/// Applications should use this method only under such a special
309-
/// circumstance. It should also be noted that the memory region
310-
/// returned by @c getData() may be invalidated after a subsequent
311-
/// write operation.
301+
/// where the @c getData() (in fact @getDataAsVoidPtr()) method gives
302+
/// a reference to the internal memory region stored in the @c buffer
303+
/// object. This is a suboptimal design in that it exposes an
304+
/// encapsulated "handle" of an object to its user. Unfortunately,
305+
/// there is no easy way to avoid this without involving expensive
306+
/// data copy if we want to use this object with a legacy API such as
307+
/// a BSD socket interface. And, indeed, this is one major purpose
308+
/// for this object. Applications should use this method only under
309+
/// such a special circumstance. It should also be noted that the
310+
/// memory region returned by @c getData() may be invalidated after a
311+
/// subsequent write operation.
312312
///
313313
/// An @c OutputBuffer class object automatically extends its memory
314314
/// region when data is written beyond the end of the current buffer.
@@ -404,7 +404,7 @@ class OutputBuffer {
404404
}
405405

406406
/// @brief Return data as a pointer to void.
407-
const void* getDataAsVP() const {
407+
const void* getDataAsVoidPtr() const {
408408
return (static_cast<const void*>(getData()));
409409
}
410410

src/lib/util/io/socketsession.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ SocketSessionForwarder::push(int sock, int family, int type, int protocol,
241241
impl_->buf_.writeUint16At(impl_->buf_.getLength() - sizeof(uint16_t), 0);
242242

243243
const struct iovec iov[2] = {
244-
{ const_cast<void*>(impl_->buf_.getDataAsVP()), impl_->buf_.getLength() },
244+
{ const_cast<void*>(impl_->buf_.getDataAsVoidPtr()),
245+
impl_->buf_.getLength() },
245246
{ const_cast<void*>(data), data_len }
246247
};
247248
const int cc = writev(impl_->fd_, iov, 2);

0 commit comments

Comments
 (0)