Fix MSVC warning C4309

truncation of constant value

The value 0xFFFF does not fit a signed 16 bit integer.
Use -1 instead.
This commit is contained in:
2025-11-05 13:06:32 +01:00
committed by mdavidsaver
parent 1492b3d5af
commit b4557d6a5a
2 changed files with 2 additions and 2 deletions

View File

@@ -73,7 +73,7 @@ const epics::pvData::int16 PVA_DEFAULT_PRIORITY = 0;
const epics::pvData::uint32 MAX_CHANNEL_NAME_LENGTH = 500;
/** Invalid data type. */
const epics::pvData::int16 INVALID_DATA_TYPE = 0xFFFF;
const epics::pvData::int16 INVALID_DATA_TYPE = -1;
/** Invalid IOID. */
const epics::pvData::int32 INVALID_IOID = 0;

View File

@@ -38,7 +38,7 @@ void encodeAsIPv6Address(ByteBuffer* buffer, const osiSockAddr* address) {
buffer->putLong(0);
buffer->putShort(0);
// next 16-bits are 1
buffer->putShort(0xFFFF);
buffer->putShort(-1);
// following IPv4 address in big-endian (network) byte order
uint32_t ipv4Addr = ntohl(address->ia.sin_addr.s_addr);
buffer->putByte((int8)((ipv4Addr>>24)&0xFF));