Skip to content

Commit

Permalink
Remove unused alignBuffer() and alignData()
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Nov 14, 2020
1 parent cca473e commit 3b2261a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 47 deletions.
1 change: 0 additions & 1 deletion src/remote/channelSearchManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class MockTransportSendControl: public pva::TransportSendControl
void setRecipient(const osiSockAddr& /*sendTo*/) {}
void startMessage(epics::pvData::int8 /*command*/, std::size_t /*ensureCapacity*/, epics::pvData::int32 /*payloadSize*/) {}
void ensureBuffer(std::size_t /*size*/) {}
void alignBuffer(std::size_t /*alignment*/) {}
void flushSerializeBuffer() {}
void cachedSerialize(const std::tr1::shared_ptr<const epics::pvData::Field>& field, epics::pvData::ByteBuffer* buffer)
{
Expand Down
36 changes: 0 additions & 36 deletions src/remote/codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,29 +542,6 @@ std::size_t AbstractCodec::alignedValue(
return (value + k) & (~k);
}


void AbstractCodec::alignData(std::size_t alignment) {

std::size_t k = (alignment - 1);
std::size_t pos = _socketBuffer.getPosition();
std::size_t newpos = (pos + k) & (~k);
if (pos == newpos)
return;

std::size_t diff = _socketBuffer.getLimit() - newpos;
if (diff > 0)
{
_socketBuffer.setPosition(newpos);
return;
}

ensureData(diff);

// position has changed, recalculate
newpos = (_socketBuffer.getPosition() + k) & (~k);
_socketBuffer.setPosition(newpos);
}

static const char PADDING_BYTES[] =
{
static_cast<char>(0xFF),
Expand All @@ -577,19 +554,6 @@ static const char PADDING_BYTES[] =
static_cast<char>(0xFF)
};

void AbstractCodec::alignBuffer(std::size_t alignment) {

std::size_t k = (alignment - 1);
std::size_t pos = _sendBuffer.getPosition();
std::size_t newpos = (pos + k) & (~k);
if (pos == newpos)
return;

// for safety reasons we really pad (override previous message data)
std::size_t padCount = newpos - pos;
_sendBuffer.put(PADDING_BYTES, 0, padCount);
}


void AbstractCodec::startMessage(
epics::pvData::int8 command,
Expand Down
8 changes: 0 additions & 8 deletions src/remote/pv/blockingUDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ class BlockingUDPTransport :

virtual void ensureData(std::size_t size) OVERRIDE FINAL;

virtual void alignData(std::size_t alignment) OVERRIDE FINAL {
_receiveBuffer.align(alignment);
}

virtual bool directSerialize(epics::pvData::ByteBuffer* /*existingBuffer*/, const char* /*toSerialize*/,
std::size_t /*elementCount*/, std::size_t /*elementSize*/) OVERRIDE FINAL
{
Expand Down Expand Up @@ -178,10 +174,6 @@ class BlockingUDPTransport :
// noop
}

virtual void alignBuffer(std::size_t alignment) OVERRIDE FINAL {
_sendBuffer.align(alignment);
}

virtual void cachedSerialize(
const std::tr1::shared_ptr<const epics::pvData::Field>& field, epics::pvData::ByteBuffer* buffer) OVERRIDE FINAL
{
Expand Down
2 changes: 0 additions & 2 deletions src/remote/pv/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ class epicsShareClass AbstractCodec :
{
}

virtual void alignBuffer(std::size_t alignment) OVERRIDE FINAL;
virtual void ensureData(std::size_t size) OVERRIDE FINAL;
virtual void alignData(std::size_t alignment) OVERRIDE FINAL;
virtual void startMessage(
epics::pvData::int8 command,
std::size_t ensureCapacity = 0,
Expand Down

0 comments on commit 3b2261a

Please sign in to comment.