xdrchar.c 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*!
  2. \file lib/db/dbmi_base/xdrchar.c
  3. \brief DBMI Library (base) - external data representation (char)
  4. (C) 1999-2009, 2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
  8. \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
  9. */
  10. #include "xdr.h"
  11. /*!
  12. \brief ?
  13. \param d
  14. \return
  15. */
  16. int db__send_char(int d)
  17. {
  18. int stat = DB_OK;
  19. char c = (char)d;
  20. if (!db__send(&c, sizeof(c)))
  21. stat = DB_PROTOCOL_ERR;
  22. if (stat == DB_PROTOCOL_ERR)
  23. db_protocol_error();
  24. return stat;
  25. }
  26. /*!
  27. \brief ?
  28. \param d
  29. \return
  30. */
  31. int db__recv_char(char *d)
  32. {
  33. int stat = DB_OK;
  34. if (!db__recv(d, sizeof(*d)))
  35. stat = DB_PROTOCOL_ERR;
  36. if (stat == DB_PROTOCOL_ERR)
  37. db_protocol_error();
  38. return stat;
  39. }