Browse files

Unbreak buildworld.

Reported-by: marino
  • Loading branch information...
1 parent 97c4bd9 commit 0ce716ae28bcdb9d17311fa9884267ad78c27dc6 Sascha Wildner committed Nov 19, 2012
Showing with 24 additions and 18 deletions.
  1. +15 −9 contrib/smbfs/lib/smb/mbuf.c
  2. +2 −2 contrib/smbfs/lib/smb/nb_name.c
  3. +5 −5 contrib/smbfs/lib/smb/rap.c
  4. +2 −2 contrib/smbfs/smbutil/view.c
View
24 contrib/smbfs/lib/smb/mbuf.c
@@ -33,7 +33,7 @@
*/
#include <sys/types.h>
-#include <sys/mchain.h>
+#include <sys/endian.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
@@ -264,15 +264,15 @@ int
mb_put_int64be(struct mbdata *mbp, int64_t x)
{
MB_PUT(int64_t);
- *p = htobeq(x);
+ *p = htobe64(x);
return 0;
}
int
mb_put_int64le(struct mbdata *mbp, int64_t x)
{
MB_PUT(int64_t);
- *p = htoleq(x);
+ *p = htole64(x);
return 0;
}
@@ -363,7 +363,8 @@ mb_get_uint16le(struct mbdata *mbp, u_int16_t *x)
u_int16_t v;
int error = mb_get_uint16(mbp, &v);
- *x = letohs(v);
+ if (x != NULL)
+ *x = le16toh(v);
return error;
}
@@ -372,7 +373,8 @@ mb_get_uint16be(struct mbdata *mbp, u_int16_t *x) {
u_int16_t v;
int error = mb_get_uint16(mbp, &v);
- *x = betohs(v);
+ if (x != NULL)
+ *x = be16toh(v);
return error;
}
@@ -389,7 +391,8 @@ mb_get_uint32be(struct mbdata *mbp, u_int32_t *x)
int error;
error = mb_get_uint32(mbp, &v);
- *x = betohl(v);
+ if (x != NULL)
+ *x = be32toh(v);
return error;
}
@@ -400,7 +403,8 @@ mb_get_uint32le(struct mbdata *mbp, u_int32_t *x)
int error;
error = mb_get_uint32(mbp, &v);
- *x = letohl(v);
+ if (x != NULL)
+ *x = le32toh(v);
return error;
}
@@ -417,7 +421,8 @@ mb_get_int64be(struct mbdata *mbp, int64_t *x)
int error;
error = mb_get_int64(mbp, &v);
- *x = betohq(v);
+ if (x != NULL)
+ *x = be64toh(v);
return error;
}
@@ -428,7 +433,8 @@ mb_get_int64le(struct mbdata *mbp, int64_t *x)
int error;
error = mb_get_int64(mbp, &v);
- *x = letohq(v);
+ if (x != NULL)
+ *x = le64toh(v);
return error;
}
View
4 contrib/smbfs/lib/smb/nb_name.c
@@ -33,7 +33,7 @@
*/
#include <sys/param.h>
#include <sys/socket.h>
-#include <sys/mchain.h> /* for endiand macros */
+#include <sys/endian.h>
#include <ctype.h>
#include <err.h>
@@ -139,7 +139,7 @@ nb_encname_len(const char *str)
return len;
}
-#define NBENCODE(c) (htoles((u_short)(((u_char)(c) >> 4) | \
+#define NBENCODE(c) (htole16((u_short)(((u_char)(c) >> 4) | \
(((u_char)(c) & 0xf) << 8)) + 0x4141))
static void
View
10 contrib/smbfs/lib/smb/rap.c
@@ -45,7 +45,7 @@
#include <stdlib.h>
#include <sysexits.h>
-#include <sys/mchain.h>
+#include <sys/endian.h>
#include <netsmb/smb_lib.h>
#include <netsmb/smb_conn.h>
@@ -290,7 +290,7 @@ smb_rap_getNparam(struct smb_rap *rap, long *value)
return error;
switch (ptype) {
case 'h':
- *value = letohs(*(u_int16_t*)rap->r_npbuf);
+ *value = le16toh(*(u_int16_t*)rap->r_npbuf);
break;
default:
return EINVAL;
@@ -320,16 +320,16 @@ smb_rap_request(struct smb_rap *rap, struct smb_ctx *ctx)
if (error)
return error;
rp = (u_int16_t*)rap->r_pbuf;
- rap->r_result = letohs(*rp++);
- conv = letohs(*rp++);
+ rap->r_result = le16toh(*rp++);
+ conv = le16toh(*rp++);
rap->r_npbuf = (char*)rp;
rap->r_entries = entries = 0;
done = 0;
while (!done && *p) {
ptype = *p;
switch (ptype) {
case 'e':
- rap->r_entries = entries = letohs(*(u_int16_t*)rap->r_npbuf);
+ rap->r_entries = entries = le16toh(*(u_int16_t*)rap->r_npbuf);
rap->r_npbuf += 2;
p++;
break;
View
4 contrib/smbfs/smbutil/view.c
@@ -44,7 +44,7 @@
#include <cflib.h>
-#include <sys/mchain.h>
+#include <sys/endian.h>
#include <netsmb/smb_lib.h>
#include <netsmb/smb_conn.h>
@@ -113,7 +113,7 @@ cmd_view(int argc, char *argv[])
exit(1);
}
for (ep = rpbuf, i = 0; i < entries; i++, ep++) {
- type = letohs(ep->shi1_type);
+ type = le16toh(ep->shi1_type);
cp = (char*)rpbuf + ep->shi1_remark;
printf("%-12s %-10s %s\n", ep->shi1_netname,

0 comments on commit 0ce716a

Please sign in to comment.