avoid deprecated ByteBuffer::getArray()
use identical, but not overloaded, getBuffer()
This commit is contained in:
@ -91,7 +91,7 @@ string deserializeString(ByteBuffer* buffer) {
|
||||
{
|
||||
// entire string is in buffer, simply create a string out of it (copy)
|
||||
std::size_t pos = buffer->getPosition();
|
||||
string str(buffer->getArray()+pos, size);
|
||||
string str(buffer->getBuffer()+pos, size);
|
||||
buffer->setPosition(pos+size);
|
||||
return str;
|
||||
}
|
||||
@ -359,7 +359,7 @@ bool discoverServers(double timeOut)
|
||||
LOG(logLevelDebug, "UDP Tx (%zu) -> %s", sendBuffer.getPosition(), strBuffer);
|
||||
}
|
||||
|
||||
status = ::sendto(socket, sendBuffer.getArray(), sendBuffer.getPosition(), 0,
|
||||
status = ::sendto(socket, sendBuffer.getBuffer(), sendBuffer.getPosition(), 0,
|
||||
&broadcastAddresses[i].sa, sizeof(sockaddr));
|
||||
if (status < 0)
|
||||
{
|
||||
@ -388,7 +388,7 @@ bool discoverServers(double timeOut)
|
||||
receiveBuffer.clear();
|
||||
|
||||
// receive packet from socket
|
||||
int bytesRead = ::recvfrom(socket, (char*)receiveBuffer.getArray(),
|
||||
int bytesRead = ::recvfrom(socket, (char*)receiveBuffer.getBuffer(),
|
||||
receiveBuffer.getRemaining(), 0,
|
||||
(sockaddr*)&fromAddress, &addrStructSize);
|
||||
|
||||
@ -443,7 +443,7 @@ bool discoverServers(double timeOut)
|
||||
for (size_t i = 0; i < broadcastAddresses.size(); i++)
|
||||
{
|
||||
// send the packet
|
||||
status = ::sendto(socket, sendBuffer.getArray(), sendBuffer.getPosition(), 0,
|
||||
status = ::sendto(socket, sendBuffer.getBuffer(), sendBuffer.getPosition(), 0,
|
||||
&broadcastAddresses[i].sa, sizeof(sockaddr));
|
||||
if (status < 0)
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ void BlockingUDPTransport::run() {
|
||||
|
||||
try {
|
||||
|
||||
char* recvfrom_buffer_start = (char*)(_receiveBuffer.getArray()+RECEIVE_BUFFER_PRE_RESERVE);
|
||||
char* recvfrom_buffer_start = (char*)(_receiveBuffer.getBuffer()+RECEIVE_BUFFER_PRE_RESERVE);
|
||||
size_t recvfrom_buffer_len =_receiveBuffer.getSize()-RECEIVE_BUFFER_PRE_RESERVE;
|
||||
while(!_closed.get())
|
||||
{
|
||||
@ -438,7 +438,7 @@ bool BlockingUDPTransport::send(ByteBuffer* buffer, const osiSockAddr& address)
|
||||
buffer->getRemaining(), _remoteName.c_str(), inetAddressToString(address).c_str());
|
||||
}
|
||||
|
||||
int retval = sendto(_channel, buffer->getArray(),
|
||||
int retval = sendto(_channel, buffer->getBuffer(),
|
||||
buffer->getLimit(), 0, &(address.sa), sizeof(sockaddr));
|
||||
if(unlikely(retval<0))
|
||||
{
|
||||
@ -475,7 +475,7 @@ bool BlockingUDPTransport::send(ByteBuffer* buffer, InetAddressType target) {
|
||||
buffer->getRemaining(), _remoteName.c_str(), inetAddressToString(_sendAddresses[i]).c_str());
|
||||
}
|
||||
|
||||
int retval = sendto(_channel, buffer->getArray(),
|
||||
int retval = sendto(_channel, buffer->getBuffer(),
|
||||
buffer->getLimit(), 0, &(_sendAddresses[i].sa),
|
||||
sizeof(sockaddr));
|
||||
if(unlikely(retval<0))
|
||||
|
@ -1257,7 +1257,7 @@ int BlockingTCPTransportCodec::write(
|
||||
while((remaining=src->getRemaining()) > 0) {
|
||||
|
||||
int bytesSent = ::send(_channel,
|
||||
&src->getArray()[src->getPosition()],
|
||||
&src->getBuffer()[src->getPosition()],
|
||||
remaining, 0);
|
||||
|
||||
// NOTE: do not log here, you might override SOCKERRNO relevant to recv() operation above
|
||||
@ -1317,7 +1317,7 @@ int BlockingTCPTransportCodec::read(epics::pvData::ByteBuffer* dst) {
|
||||
std::size_t pos = dst->getPosition();
|
||||
|
||||
int bytesRead = recv(_channel,
|
||||
(char*)(dst->getArray()+pos), remaining, 0);
|
||||
(char*)(dst->getBuffer()+pos), remaining, 0);
|
||||
|
||||
// NOTE: do not log here, you might override SOCKERRNO relevant to recv() operation above
|
||||
|
||||
|
@ -2674,7 +2674,7 @@ public:
|
||||
payloadBuffer->setPosition(newStartPos);
|
||||
|
||||
// copy part of a header, and add: command, payloadSize, NIF address
|
||||
payloadBuffer->put(payloadBuffer->getArray(), startPosition-PVA_MESSAGE_HEADER_SIZE, PVA_MESSAGE_HEADER_SIZE-5);
|
||||
payloadBuffer->put(payloadBuffer->getBuffer(), startPosition-PVA_MESSAGE_HEADER_SIZE, PVA_MESSAGE_HEADER_SIZE-5);
|
||||
payloadBuffer->putByte(CMD_ORIGIN_TAG);
|
||||
payloadBuffer->putInt(16);
|
||||
// encode this socket bind address
|
||||
@ -2690,7 +2690,7 @@ public:
|
||||
// set to end of a message
|
||||
payloadBuffer->setPosition(payloadBuffer->getLimit());
|
||||
|
||||
bt->send(payloadBuffer->getArray()+newStartPos, payloadBuffer->getPosition()-newStartPos,
|
||||
bt->send(payloadBuffer->getBuffer()+newStartPos, payloadBuffer->getPosition()-newStartPos,
|
||||
bt->getLocalMulticastAddress());
|
||||
|
||||
return;
|
||||
|
@ -312,7 +312,7 @@ void ServerSearchHandler::handleResponse(osiSockAddr* responseFrom,
|
||||
payloadBuffer->setPosition(newStartPos);
|
||||
|
||||
// copy part of a header, and add: command, payloadSize, NIF address
|
||||
payloadBuffer->put(payloadBuffer->getArray(), startPosition-PVA_MESSAGE_HEADER_SIZE, PVA_MESSAGE_HEADER_SIZE-5);
|
||||
payloadBuffer->put(payloadBuffer->getBuffer(), startPosition-PVA_MESSAGE_HEADER_SIZE, PVA_MESSAGE_HEADER_SIZE-5);
|
||||
payloadBuffer->putByte(CMD_ORIGIN_TAG);
|
||||
payloadBuffer->putInt(16);
|
||||
// encode this socket bind address
|
||||
@ -328,7 +328,7 @@ void ServerSearchHandler::handleResponse(osiSockAddr* responseFrom,
|
||||
// set to end of a message
|
||||
payloadBuffer->setPosition(payloadBuffer->getLimit());
|
||||
|
||||
bt->send(payloadBuffer->getArray()+newStartPos, payloadBuffer->getPosition()-newStartPos,
|
||||
bt->send(payloadBuffer->getBuffer()+newStartPos, payloadBuffer->getPosition()-newStartPos,
|
||||
bt->getLocalMulticastAddress());
|
||||
|
||||
return;
|
||||
|
@ -132,7 +132,7 @@ void test_encodeAsIPv6Address()
|
||||
encodeAsIPv6Address(buff.get(), &addr);
|
||||
testOk1(static_cast<size_t>(16) == buff->getPosition());
|
||||
|
||||
testOk1(strncmp(buff->getArray(), src, 16) == 0);
|
||||
testOk1(strncmp(buff->getBuffer(), src, 16) == 0);
|
||||
}
|
||||
|
||||
void test_isMulticastAddress()
|
||||
|
Reference in New Issue
Block a user