2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

636. [port] Shut up MSVC++ about a possible loss of precision

in the ISC__BUFFER_PUTUINT*() macros. [RT #592]

This is the basically the same change made to buffer.c before the macros
were created:

   revision 1.18
   date: 1999/09/23 17:54:57;  author: tale;  state: Exp;  lines: +4 -4
   Shut up MSVC++ compiler warning about loss of precision when assigning
   8 bits masked out of a 32 bit int to individual bytes.

Also, an #if 0 around "#define ISC_BUFFER_USEINLINE" was removed, per the
ISC coding style, and instead a comment was used to disable the definition.
This commit is contained in:
David Lawrence
2000-12-26 20:51:14 +00:00
parent 2115bc7d64
commit 0b3427d15c

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: buffer.h,v 1.36 2000/08/17 02:09:12 bwelling Exp $ */
/* $Id: buffer.h,v 1.37 2000/12/26 20:51:14 tale Exp $ */
#ifndef ISC_BUFFER_H
#define ISC_BUFFER_H 1
@@ -112,9 +112,7 @@
* To make many functions be inline macros (via #define) define this.
* If it is undefined, a function will be used.
*/
#if 0
#define ISC_BUFFER_USEINLINE
#endif
/* #define ISC_BUFFER_USEINLINE */
ISC_LANG_BEGINDECLS
@@ -730,7 +728,7 @@ ISC_LANG_ENDDECLS
isc_uint8_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used++; \
_cp[0] = (_val2 & 0x00ff); \
_cp[0] = _val2 & 0x00ff; \
} while (0)
#define ISC__BUFFER_PUTUINT16(_b, _val) \
@@ -739,8 +737,8 @@ ISC_LANG_ENDDECLS
isc_uint16_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used += 2; \
_cp[0] = (_val2 & 0xff00U) >> 8; \
_cp[1] = (_val2 & 0x00ffU); \
_cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \
_cp[1] = (unsigned char)(_val2 & 0x00ffU); \
} while (0)
#define ISC__BUFFER_PUTUINT32(_b, _val) \
@@ -749,10 +747,10 @@ ISC_LANG_ENDDECLS
isc_uint32_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used += 4; \
_cp[0] = (_val2 & 0xff000000) >> 24; \
_cp[1] = (_val2 & 0x00ff0000) >> 16; \
_cp[2] = (_val2 & 0x0000ff00) >> 8; \
_cp[3] = (_val2 & 0x000000ff); \
_cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \
_cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \
_cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \
_cp[3] = (unsigned char)((_val2 & 0x000000ff)); \
} while (0)
#if defined(ISC_BUFFER_USEINLINE)