about summary refs log tree commit diff
path: root/sunrpc/xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/xdr.c')
-rw-r--r--sunrpc/xdr.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index 21e339b4ee..d99a9985c4 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -131,7 +131,7 @@ bool_t
 xdr_u_int (XDR *xdrs, u_int *up)
 {
 #if UINT_MAX < ULONG_MAX
-  long l;
+  u_long l;
 
   switch (xdrs->x_op)
     {
@@ -144,7 +144,7 @@ xdr_u_int (XDR *xdrs, u_int *up)
 	{
 	  return FALSE;
 	}
-      *up = (u_int) (u_long) l;
+      *up = (u_int) l;
     case XDR_FREE:
       return TRUE;
     }
@@ -225,7 +225,8 @@ INTDEF(xdr_u_long)
 bool_t
 xdr_hyper (XDR *xdrs, quad_t *llp)
 {
-  long int t1, t2;
+  long t1;
+  unsigned long int t2;
 
   if (xdrs->x_op == XDR_ENCODE)
     {
@@ -239,7 +240,7 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
 	return FALSE;
       *llp = ((quad_t) t1) << 32;
-      *llp |= (uint32_t) t2;
+      *llp |= t2;
       return TRUE;
     }
 
@@ -258,7 +259,8 @@ INTDEF(xdr_hyper)
 bool_t
 xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
 {
-  long int t1, t2;
+  unsigned long t1;
+  unsigned long t2;
 
   if (xdrs->x_op == XDR_ENCODE)
     {
@@ -272,7 +274,7 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
 	return FALSE;
       *ullp = ((u_quad_t) t1) << 32;
-      *ullp |= (uint32_t) t2;
+      *ullp |= t2;
       return TRUE;
     }
 
@@ -330,7 +332,7 @@ INTDEF(xdr_short)
 bool_t
 xdr_u_short (XDR *xdrs, u_short *usp)
 {
-  long l;
+  u_long l;
 
   switch (xdrs->x_op)
     {
@@ -343,7 +345,7 @@ xdr_u_short (XDR *xdrs, u_short *usp)
 	{
 	  return FALSE;
 	}
-      *usp = (u_short) (u_long) l;
+      *usp = (u_short) l;
       return TRUE;
 
     case XDR_FREE:
@@ -563,7 +565,12 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
 	}
       if (sp == NULL)
 	{
-	  (void) __fxprintf (NULL, "%s", _("xdr_bytes: out of memory\n"));
+#ifdef USE_IN_LIBIO
+	  if (_IO_fwide (stderr, 0) > 0)
+	    (void) __fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n"));
+	  else
+#endif
+	    (void) fputs (_("xdr_bytes: out of memory\n"), stderr);
 	  return FALSE;
 	}
       /* fall into ... */
@@ -715,7 +722,13 @@ xdr_string (xdrs, cpp, maxsize)
 	*cpp = sp = (char *) mem_alloc (nodesize);
       if (sp == NULL)
 	{
-	  (void) __fxprintf (NULL, "%s", _("xdr_string: out of memory\n"));
+#ifdef USE_IN_LIBIO
+	  if (_IO_fwide (stderr, 0) > 0)
+	    (void) __fwprintf (stderr, L"%s",
+			       _("xdr_string: out of memory\n"));
+	  else
+#endif
+	    (void) fputs (_("xdr_string: out of memory\n"), stderr);
 	  return FALSE;
 	}
       sp[size] = 0;