From ee83c9fe805687b8dfef3b28b48dcd660b108031 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Mon, 5 Apr 1999 15:33:52 +0000 Subject: [PATCH] Add operators for byte quantities. Always return a 32-bit integer. --- common/convert.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/convert.c b/common/convert.c index 887214bc6..88f335f1e 100644 --- a/common/convert.c +++ b/common/convert.c @@ -23,7 +23,7 @@ #ifndef lint static char copyright[] = -"$Id: convert.c,v 1.6 1999/03/16 05:50:32 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: convert.c,v 1.7 1999/04/05 15:33:52 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -46,7 +46,7 @@ int32_t getLong (buf) return ntohl (ibuf); } -u_int16_t getUShort (buf) +u_int32_t getUShort (buf) unsigned char *buf; { unsigned short ibuf; @@ -55,7 +55,7 @@ u_int16_t getUShort (buf) return ntohs (ibuf); } -int16_t getShort (buf) +int32_t getShort (buf) unsigned char *buf; { short ibuf; @@ -96,3 +96,15 @@ void putShort (obuf, val) memcpy (obuf, &tmp, sizeof tmp); } +void putUChar (obuf, val) + unsigned char *obuf; + u_int32_t val; +{ + *obuf = val; +} + +u_int32_t getUChar (obuf) + unsigned char *obuf; +{ + return obuf [0]; +} -- 2.47.3