ucs2internal.h
上传用户:yingmei828
上传日期:2007-01-01
资源大小:1646k
文件大小:1k
源码类别:

源码/资料

开发平台:

Unix_Linux

  1. /*
  2.  * UCS-2-INTERNAL = UCS-2 with machine dependent endianness and alignment
  3.  */
  4. static int
  5. ucs2internal_mbtowc (conv_t conv, wchar_t *pwc, const unsigned char *s, int n)
  6. {
  7.   if (n >= 2) {
  8.     *pwc = *(unsigned short *)s;
  9.     return 2;
  10.   }
  11.   return RET_TOOFEW(0);
  12. }
  13. static int
  14. ucs2internal_wctomb (conv_t conv, unsigned char *r, wchar_t wc, int n)
  15. {
  16.   if (wc < 0x10000) {
  17.     if (n >= 2) {
  18.       *(unsigned short *)r = wc;
  19.       return 2;
  20.     } else
  21.       return RET_TOOSMALL;
  22.   } else
  23.     return RET_ILSEQ;
  24. }