From 2fec84461da29c67656f6b07a3816bd3ac89778c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 29 Sep 2018 15:01:11 -0700 Subject: [PATCH] use of CMD_* instead of magic numbers --- src/remote/codec.cpp | 2 +- src/remote/pv/codec.h | 2 +- src/server/beaconEmitter.cpp | 2 +- src/server/responseHandlers.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/remote/codec.cpp b/src/remote/codec.cpp index 72d59b34..012b0294 100644 --- a/src/remote/codec.cpp +++ b/src/remote/codec.cpp @@ -1398,7 +1398,7 @@ class SecurityPluginMessageTransportSender : public TransportSender { } void send(ByteBuffer* buffer, TransportSendControl* control) { - control->startMessage((int8)5, 0); + control->startMessage(CMD_AUTHNZ, 0); SerializationHelper::serializeFull(buffer, control, _data); // send immediately control->flush(true); diff --git a/src/remote/pv/codec.h b/src/remote/pv/codec.h index c1563afe..e792bdf3 100644 --- a/src/remote/pv/codec.h +++ b/src/remote/pv/codec.h @@ -339,7 +339,7 @@ class BlockingTCPTransportCodec: } virtual void processControlMessage() OVERRIDE FINAL { - if (_command == 2) + if (_command == CMD_SET_ENDIANESS) { // check 7-th bit setByteOrder(_flags < 0 ? EPICS_ENDIAN_BIG : EPICS_ENDIAN_LITTLE); diff --git a/src/server/beaconEmitter.cpp b/src/server/beaconEmitter.cpp index 5341f3ce..4a0f1576 100644 --- a/src/server/beaconEmitter.cpp +++ b/src/server/beaconEmitter.cpp @@ -62,7 +62,7 @@ void BeaconEmitter::send(ByteBuffer* buffer, TransportSendControl* control) } // send beacon - control->startMessage((int8)0, 12+2+2+16+2); + control->startMessage((int8)CMD_BEACON, 12+2+2+16+2); buffer->put(_guid.value, 0, sizeof(_guid.value)); diff --git a/src/server/responseHandlers.cpp b/src/server/responseHandlers.cpp index dcd41b05..80d1d883 100644 --- a/src/server/responseHandlers.cpp +++ b/src/server/responseHandlers.cpp @@ -443,7 +443,7 @@ void ServerChannelFindRequesterImpl::channelFindResult(const Status& /*status*/, void ServerChannelFindRequesterImpl::send(ByteBuffer* buffer, TransportSendControl* control) { - control->startMessage((int8)4, 12+4+16+2); + control->startMessage(CMD_SEARCH_RESPONSE, 12+4+16+2); Lock guard(_mutex); buffer->put(_guid.value, 0, sizeof(_guid.value)); @@ -1802,7 +1802,7 @@ void ServerChannelPutGetRequesterImpl::send(ByteBuffer* buffer, TransportSendCon return; } - control->startMessage((int32)12, sizeof(int32)/sizeof(int8) + 1); + control->startMessage(CMD_PUT_GET, sizeof(int32)/sizeof(int8) + 1); buffer->putInt(_ioid); buffer->putByte((int8)request); {