]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sunrpc/xdr_rec.c
Sync "language", "lang_name", "territory", "country_name" with CLDR/langtable
[thirdparty/glibc.git] / sunrpc / xdr_rec.c
index a66462c599d5f175cb358086f7e576bebdaee986..c9a1eaad6349ba5f374b8f2880ff7b08f5ab37a7 100644 (file)
@@ -2,7 +2,7 @@
  * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
  * layer above tcp (for rpc's use).
  *
- * Copyright (C) 1984, Sun Microsystems, Inc.
+ * Copyright (c) 2010, Oracle America, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -14,7 +14,7 @@
  *       copyright notice, this list of conditions and the following
  *       disclaimer in the documentation and/or other materials
  *       provided with the distribution.
- *     * Neither the name of Sun Microsystems, Inc. nor the names of its
+ *     * Neither the name of the "Oracle America, Inc." nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
  *
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdint.h>
 #include <rpc/rpc.h>
 #include <libintl.h>
-
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-# include <libio/iolibio.h>
-#endif
+#include <wchar.h>
+#include <libio/iolibio.h>
+#include <shlib-compat.h>
 
 static bool_t xdrrec_getlong (XDR *, long *);
 static bool_t xdrrec_putlong (XDR *, const long *);
@@ -103,7 +102,7 @@ typedef struct rec_strm
     caddr_t out_base;          /* output buffer (points to frag header) */
     caddr_t out_finger;                /* next output position */
     caddr_t out_boundry;       /* data cannot up to this address */
-    u_int32_t *frag_header;    /* beginning of curren fragment */
+    uint32_t *frag_header;     /* beginning of curren fragment */
     bool_t frag_sent;          /* true if buffer sent in middle of record */
     /*
      * in-coming bits
@@ -120,11 +119,11 @@ typedef struct rec_strm
   }
 RECSTREAM;
 
-static u_int fix_buf_size (u_int) internal_function;
-static bool_t skip_input_bytes (RECSTREAM *, long) internal_function;
-static bool_t flush_out (RECSTREAM *, bool_t) internal_function;
-static bool_t set_input_fragment (RECSTREAM *) internal_function;
-static bool_t get_input_bytes (RECSTREAM *, caddr_t, int) internal_function;
+static u_int fix_buf_size (u_int);
+static bool_t skip_input_bytes (RECSTREAM *, long);
+static bool_t flush_out (RECSTREAM *, bool_t);
+static bool_t set_input_fragment (RECSTREAM *);
+static bool_t get_input_bytes (RECSTREAM *, caddr_t, int);
 
 /*
  * Create an xdr handle for xdrrec
@@ -182,7 +181,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
   rstrm->readit = readit;
   rstrm->writeit = writeit;
   rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
-  rstrm->frag_header = (u_int32_t *) rstrm->out_base;
+  rstrm->frag_header = (uint32_t *) rstrm->out_base;
   rstrm->out_finger += 4;
   rstrm->out_boundry += sendsize;
   rstrm->frag_sent = FALSE;
@@ -192,7 +191,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
   rstrm->fbtbc = 0;
   rstrm->last_frag = TRUE;
 }
-INTDEF(xdrrec_create)
+libc_hidden_nolink_sunrpc (xdrrec_create, GLIBC_2_0)
 
 
 /*
@@ -480,7 +479,7 @@ xdrrec_skiprecord (XDR *xdrs)
   rstrm->last_frag = FALSE;
   return TRUE;
 }
-INTDEF(xdrrec_skiprecord)
+libc_hidden_nolink_sunrpc (xdrrec_skiprecord, GLIBC_2_0)
 
 /*
  * Lookahead function.
@@ -504,7 +503,7 @@ xdrrec_eof (XDR *xdrs)
     return TRUE;
   return FALSE;
 }
-INTDEF(xdrrec_eof)
+libc_hidden_nolink_sunrpc (xdrrec_eof, GLIBC_2_0)
 
 /*
  * The client must tell the package when an end-of-record has occurred.
@@ -527,18 +526,17 @@ xdrrec_endofrecord (XDR *xdrs, bool_t sendnow)
   len = (rstrm->out_finger - (char *) rstrm->frag_header
         - BYTES_PER_XDR_UNIT);
   *rstrm->frag_header = htonl ((u_long) len | LAST_FRAG);
-  rstrm->frag_header = (u_int32_t *) rstrm->out_finger;
+  rstrm->frag_header = (uint32_t *) rstrm->out_finger;
   rstrm->out_finger += BYTES_PER_XDR_UNIT;
   return TRUE;
 }
-INTDEF(xdrrec_endofrecord)
+libc_hidden_nolink_sunrpc (xdrrec_endofrecord, GLIBC_2_0)
 
 
 /*
  * Internal useful routines
  */
 static bool_t
-internal_function
 flush_out (RECSTREAM *rstrm, bool_t eor)
 {
   u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
@@ -550,7 +548,7 @@ flush_out (RECSTREAM *rstrm, bool_t eor)
   if ((*(rstrm->writeit)) (rstrm->tcp_handle, rstrm->out_base, (int) len)
       != (int) len)
     return FALSE;
-  rstrm->frag_header = (u_int32_t *) rstrm->out_base;
+  rstrm->frag_header = (uint32_t *) rstrm->out_base;
   rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT;
   return TRUE;
 }
@@ -575,7 +573,6 @@ fill_input_buf (RECSTREAM *rstrm)
 }
 
 static bool_t  /* knows nothing about records!  Only about input buffers */
-internal_function
 get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
 {
   int current;
@@ -599,7 +596,6 @@ get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
 }
 
 static bool_t /* next two bytes of the input stream are treated as a header */
-internal_function
 set_input_fragment (RECSTREAM *rstrm)
 {
   uint32_t header;
@@ -625,7 +621,6 @@ set_input_fragment (RECSTREAM *rstrm)
 }
 
 static bool_t  /* consumes input bytes; knows nothing about records! */
-internal_function
 skip_input_bytes (RECSTREAM *rstrm, long cnt)
 {
   int current;
@@ -647,7 +642,6 @@ skip_input_bytes (RECSTREAM *rstrm, long cnt)
 }
 
 static u_int
-internal_function
 fix_buf_size (u_int s)
 {
   if (s < 100)