[BACK]Return to lcGenConv.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / xsrc / external / mit / libX11 / dist / modules / lc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c between version 1.1 and 1.2

version 1.1, 2008/07/30 02:43:29 version 1.2, 2010/10/03 22:10:48
Line 1 
Line 1 
 /* $Xorg: lcGenConv.c,v 1.5 2000/08/17 19:45:17 cpqbld Exp $ */  
 /*  /*
  * Copyright 1992, 1993 by TOSHIBA Corp.   * Copyright 1992, 1993 by TOSHIBA Corp.
  *   *
Line 32 
Line 31 
  *   *
  */   */
 /*  /*
  *  2000   *  2000
  *  Modifier: Ivan Pascal      The XFree86 Project   *  Modifier: Ivan Pascal      The XFree86 Project
  */   */
 /* $XFree86: xc/lib/X11/lcGenConv.c,v 3.27tsi Exp $ */  
   
 /*  /*
  * A generic locale loader for all kinds of ISO-2022 based codesets.   * A generic locale loader for all kinds of ISO-2022 based codesets.
Line 55 
Line 53 
 #include "XlcGeneric.h"  #include "XlcGeneric.h"
 #include <stdio.h>  #include <stdio.h>
   
 #if !defined(macII) && !defined(Lynx_22) && !defined(X_LOCALE)  #if !defined(Lynx_22) && !defined(X_LOCALE)
 #define STDCVT  #define STDCVT
 #endif  #endif
   
Line 201  mb_to_gi(
Line 199  mb_to_gi(
             return(mb_tmp);              return(mb_tmp);
     }      }
   
     if (codeset->side == XlcC0 || codeset->side == XlcGL ||      if (codeset->side == XlcC0 || codeset->side == XlcGL ||
         codeset->side == XlcC1 || codeset->side == XlcGR) {          codeset->side == XlcC1 || codeset->side == XlcGR) {
   
         for (i = 0; i < codeset->length; i++)          for (i = 0; i < codeset->length; i++)
Line 283  wc_to_gi(
Line 281  wc_to_gi(
   
     wc = wc & ~wc_encode_mask;      wc = wc & ~wc_encode_mask;
     for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--)      for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--)
         *glyph_index = (*glyph_index << 8) |          *glyph_index = (*glyph_index << 8) |
                       ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask );                        ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask );
   
     return(True);      return(True);
Line 302  mb_parse_codeset(
Line 300  mb_parse_codeset(
     ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list);      ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list);
     ParseInfo parse_info;      ParseInfo parse_info;
     CodeSet codeset;      CodeSet codeset;
   
     for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) {      for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) {
        len = compare(src, parse_info->encoding, from_len);         len = compare(src, parse_info->encoding, from_len);
        if (len > 0) {         if (len > 0) {
Line 344  byteM_parse_codeset(
Line 342  byteM_parse_codeset(
             continue;              continue;
   
         for (j = 0; j < codeset->length; j++) {          for (j = 0; j < codeset->length; j++) {
             ch = *((unsigned char *)(inbufptr + j));              ch = *((unsigned char *)(inbufptr + j));
             byteM_rec = byteM[j];              byteM_rec = byteM[j];
             byteinfo = byteM_rec.byteinfo;              byteinfo = byteM_rec.byteinfo;
   
Line 365  byteM_parse_codeset(
Line 363  byteM_parse_codeset(
     }      }
   
     return(NULL);      return(NULL);
 }  }
   
 #define GLGR_parse_codeset(ch) \  #define GLGR_parse_codeset(ch) \
      (isrightside(ch) ? (state->GR_codeset) : \       (isrightside(ch) ? (state->GR_codeset) : \
Line 430  ct_parse_csi(
Line 428  ct_parse_csi(
         if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) )          if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) )
             continue;              continue;
   
         if ( strncmp(inbufptr, directionality_data[i].encoding,          if ( strncmp(inbufptr, directionality_data[i].encoding,
                                                 *ctr_seq_len) == 0)                                                  *ctr_seq_len) == 0)
             return(True);              return(True);
     }      }
Line 573  segment_conversion(
Line 571  segment_conversion(
     range = segment_conv[i].range;      range = segment_conv[i].range;
     if (*glyph_index < range.start || range.end < *glyph_index)      if (*glyph_index < range.start || range.end < *glyph_index)
         return(True);          return(True);
   
     *charset = segment_conv[i].dest;      *charset = segment_conv[i].dest;
     conv_rec.conv_num = segment_conv[i].conv_num;      conv_rec.conv_num = segment_conv[i].conv_num;
     conv_rec.convlist = segment_conv[i].conv;      conv_rec.convlist = segment_conv[i].conv;
Line 766  mbstowcs_org(
Line 764  mbstowcs_org(
         return( 0 );          return( 0 );
     }      }
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 801  mbstowcs_org(
Line 801  mbstowcs_org(
                 continue;                  continue;
             }              }
         }          }
   
         /* next mb char data for byteM ? */          /* next mb char data for byteM ? */
         if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))))          if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))))
             goto next_mb_char;              goto next_mb_char;
Line 809  mbstowcs_org(
Line 809  mbstowcs_org(
         /* next mb char data for GL or GR side ? */          /* next mb char data for GL or GR side ? */
         if ((codeset = GLGR_parse_codeset(ch)))          if ((codeset = GLGR_parse_codeset(ch)))
             goto next_mb_char;              goto next_mb_char;
   
         /* can't find codeset for the ch */          /* can't find codeset for the ch */
         unconv_num++;          unconv_num++;
         continue;          continue;
Line 878  stdc_mbstowcs(
Line 878  stdc_mbstowcs(
             /* null ? */              /* null ? */
             src++;              src++;
             src_left--;              src_left--;
             if (dst)              if (dst)
                 *dst++ = L'\0';                  *dst++ = L'\0';
             dst_left--;              dst_left--;
         }          }
Line 918  wcstombs_org(
Line 918  wcstombs_org(
     const wchar_t *inbufptr = (const wchar_t *) *from;      const wchar_t *inbufptr = (const wchar_t *) *from;
     char *outbufptr = *to;      char *outbufptr = *to;
     int from_size = *from_left;      int from_size = *from_left;
   
     const char *default_string = XLC_PUBLIC(lcd, default_string);      const char *default_string = XLC_PUBLIC(lcd, default_string);
     int defstr_len = strlen(default_string);      int defstr_len = strlen(default_string);
   
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 1033  stdc_wcstombs(
Line 1035  stdc_wcstombs(
         if (length > 0) {          if (length > 0) {
             src++;              src++;
             src_left--;              src_left--;
             if (dst)              if (dst)
                 dst += length;                  dst += length;
             dst_left -= length;              dst_left -= length;
         } else if (length < 0) {          } else if (length < 0) {
             src++;              src++;
             src_left--;              src_left--;
             unconv_num++;              unconv_num++;
         }          }
     }      }
   
     *from = (XPointer) src;      *from = (XPointer) src;
Line 1082  wcstocts(
Line 1084  wcstocts(
     int from_size = *from_left;      int from_size = *from_left;
     char *ext_seg_len = NULL;      char *ext_seg_len = NULL;
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 1119  wcstocts(
Line 1123  wcstocts(
          * +-----+-----+-----+-----+-----+-----+-----+----   ----+-----+-----+           * +-----+-----+-----+-----+-----+-----+-----+----   ----+-----+-----+
          * |     esc sequence      |  M  |  L  |     encoding name     | STX |           * |     esc sequence      |  M  |  L  |     encoding name     | STX |
          * +-----+-----+-----+-----+-----+-----+-----+----   ----+-----+-----+           * +-----+-----+-----+-----+-----+-----+-----+----   ----+-----+-----+
          *           4bytes         1byte 1byte     variable length     1byte           *           4bytes         1byte 1byte     variable length     1byte
          *                         |                                         |           *                         |                                         |
          *                         +-----------------------------------------+           *                         +-----------------------------------------+
          *                           name length  = ((M - 128) * 128) + (L - 128)           *                           name length  = ((M - 128) * 128) + (L - 128)
Line 1147  wcstocts(
Line 1151  wcstocts(
                 *ext_seg_len   = i % 128 + 128;                  *ext_seg_len   = i % 128 + 128;
                 ext_seg_len = NULL;                  ext_seg_len = NULL;
             }              }
   
             if (*to_left < total_len + 1) {              if (*to_left < total_len + 1) {
                 unconv_num++;                  unconv_num++;
                 break;                  break;
Line 1221  stdc_wcstocts(
Line 1225  stdc_wcstocts(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = stdc_wcstombs(conv,      unconv_num1 = stdc_wcstombs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = buf_ptr1 - buf_ptr2;      buf_left2 = buf_ptr1 - buf_ptr2;
   
     unconv_num2 = mbstocts(conv,      unconv_num2 = mbstocts(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 1274  ctstowcs(
Line 1278  ctstowcs(
         return( 0 );          return( 0 );
     }      }
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 1321  ctstowcs(
Line 1327  ctstowcs(
   
         /* escape sequence ? */          /* escape sequence ? */
         if (ch == ESC) {          if (ch == ESC) {
             if ( !ct_parse_charset(lcd,              if ( !ct_parse_charset(lcd,
                         inbufptr - 1, &state->charset, &ctr_seq_len) )                          inbufptr - 1, &state->charset, &ctr_seq_len) )
                 goto skip_the_seg;                  goto skip_the_seg;
   
             if (state->charset->side == XlcC0 ||              if (state->charset->side == XlcC0 ||
                 state->charset->side == XlcGL)                  state->charset->side == XlcGL)
               {                {
                 state->GL_charset = state->charset;                  state->GL_charset = state->charset;
               }                }
             else if (state->charset->side == XlcC1 ||              else if (state->charset->side == XlcC1 ||
                      state->charset->side == XlcGR)                       state->charset->side == XlcGR)
               {                {
                 state->GR_charset = state->charset;                  state->GR_charset = state->charset;
               }                }
             else if (state->charset->side == XlcGLGR)              else if (state->charset->side == XlcGLGR)
               {                {
                 state->GL_charset = state->charset;                  state->GL_charset = state->charset;
                 state->GR_charset = state->charset;                  state->GR_charset = state->charset;
               }                }
   
             if (*from_left + 1 < ctr_seq_len) {              if (*from_left + 1 < ctr_seq_len) {
                 inbufptr--;                  inbufptr--;
Line 1353  ctstowcs(
Line 1359  ctstowcs(
             *from_left -= (ctr_seq_len - 1);              *from_left -= (ctr_seq_len - 1);
   
             continue;              continue;
         }          }
   
         /* check current state */          /* check current state */
         if (isleftside(ch))          if (isleftside(ch))
Line 1380  output_one_wc:
Line 1386  output_one_wc:
             segment_conversion(lcd, &charset_tmp, &glyph_index);              segment_conversion(lcd, &charset_tmp, &glyph_index);
   
             /* get codeset */              /* get codeset */
             if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,              if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,
                                                 &codeset, &glyph_index) ) {                                                  &codeset, &glyph_index) ) {
                 unconv_num += gi_len;                  unconv_num += gi_len;
                 continue;                  continue;
Line 1499  cstowcs(
Line 1505  cstowcs(
             segment_conversion(lcd, &charset_tmp, &glyph_index);              segment_conversion(lcd, &charset_tmp, &glyph_index);
   
             /* get codeset */              /* get codeset */
             if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,              if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,
                                                 &codeset, &glyph_index) ) {                                                  &codeset, &glyph_index) ) {
                 unconv_num += gi_len;                  unconv_num += gi_len;
                 continue;                  continue;
Line 1544  stdc_ctstowcs(
Line 1550  stdc_ctstowcs(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = ctstombs(conv,      unconv_num1 = ctstombs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = buf_ptr1 - buf_ptr2;      buf_left2 = buf_ptr1 - buf_ptr2;
   
     unconv_num2 = stdc_mbstowcs(conv,      unconv_num2 = stdc_mbstowcs(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 1580  stdc_cstowcs(
Line 1586  stdc_cstowcs(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = cstombs(conv,      unconv_num1 = cstombs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = buf_ptr1 - buf_ptr2;      buf_left2 = buf_ptr1 - buf_ptr2;
   
     unconv_num2 = stdc_mbstowcs(conv,      unconv_num2 = stdc_mbstowcs(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 1616  mbstocts(
Line 1622  mbstocts(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = mbstowcs_org(conv,      unconv_num1 = mbstowcs_org(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);      buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
   
     unconv_num2 += wcstocts(conv,      unconv_num2 += wcstocts(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 1668  mbstostr(
Line 1674  mbstostr(
         return( 0 );          return( 0 );
     }      }
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 1711  mbstostr(
Line 1719  mbstostr(
         /* next char data : GL or GR side ? */          /* next char data : GL or GR side ? */
         if ((codeset = GLGR_parse_codeset(ch)))          if ((codeset = GLGR_parse_codeset(ch)))
             goto next_mb_char;              goto next_mb_char;
   
         /* can't find codeset for the ch */          /* can't find codeset for the ch */
         unconv_num++;          unconv_num++;
         continue;          continue;
Line 1786  mbtocs(
Line 1794  mbtocs(
         return( 0 );          return( 0 );
     }      }
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 1823  mbtocs(
Line 1833  mbtocs(
         /* next mb char data for GL or GR side ? */          /* next mb char data for GL or GR side ? */
         if ((codeset = GLGR_parse_codeset(ch)))          if ((codeset = GLGR_parse_codeset(ch)))
             goto next_mb_char;              goto next_mb_char;
   
         /* can't find codeset for the ch */          /* can't find codeset for the ch */
         unconv_num = 1;          unconv_num = 1;
         break;          break;
Line 1906  mbstocs(
Line 1916  mbstocs(
   
     ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1);      ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1);
     charset_old = charset;      charset_old = charset;
   
     while ( ret == 0 && *from_left && *to_left) {      while ( ret == 0 && *from_left && *to_left) {
         inbufptr = *from;          inbufptr = *from;
         in_left = *from_left;          in_left = *from_left;
Line 1957  wcstostr(
Line 1967  wcstostr(
     const wchar_t *inbufptr = (const wchar_t *) *from;      const wchar_t *inbufptr = (const wchar_t *) *from;
     char *outbufptr = *to;      char *outbufptr = *to;
     int from_size = *from_left;      int from_size = *from_left;
   
     const char *default_string = XLC_PUBLIC(lcd, default_string);      const char *default_string = XLC_PUBLIC(lcd, default_string);
     int defstr_len = strlen(default_string);      int defstr_len = strlen(default_string);
   
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 2073  stdc_wcstostr(
Line 2085  stdc_wcstostr(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = stdc_wcstombs(conv,      unconv_num1 = stdc_wcstombs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = buf_ptr1 - buf_ptr2;      buf_left2 = buf_ptr1 - buf_ptr2;
   
     unconv_num2 = mbstostr(conv,      unconv_num2 = mbstostr(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 2119  wctocs(
Line 2131  wctocs(
     char *outbufptr = *to;      char *outbufptr = *to;
     int from_size = *from_left;      int from_size = *from_left;
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     if (*from_left && *to_left) {      if (*from_left && *to_left) {
   
Line 2206  stdc_wctocs(
Line 2220  stdc_wctocs(
         } else {          } else {
             goto end;              goto end;
         }          }
   
         if (length < 0)          if (length < 0)
             goto end;              goto end;
   
Line 2351  ctstombs(
Line 2365  ctstombs(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = ctstowcs(conv,      unconv_num1 = ctstowcs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);      buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
   
     unconv_num2 += wcstombs_org(conv,      unconv_num2 += wcstombs_org(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 2387  cstombs(
Line 2401  cstombs(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = cstowcs(conv,      unconv_num1 = cstowcs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);      buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
   
     unconv_num2 += wcstombs_org(conv,      unconv_num2 += wcstombs_org(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 2432  strtombs(
Line 2446  strtombs(
     char *outbufptr = *to;      char *outbufptr = *to;
     int from_size = *from_left;      int from_size = *from_left;
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 2542  strtowcs(
Line 2558  strtowcs(
     wchar_t *outbufptr = (wchar_t *)*to;      wchar_t *outbufptr = (wchar_t *)*to;
     int from_size = *from_left;      int from_size = *from_left;
   
   #ifdef notdef
     if (*from_left > *to_left)      if (*from_left > *to_left)
         *from_left = *to_left;          *from_left = *to_left;
   #endif
   
     while (*from_left && *to_left) {      while (*from_left && *to_left) {
   
Line 2602  stdc_strtowcs(
Line 2620  stdc_strtowcs(
     int buf_left2;      int buf_left2;
     int unconv_num1 = 0, unconv_num2 = 0;      int unconv_num1 = 0, unconv_num2 = 0;
   
     unconv_num1 = strtombs(conv,      unconv_num1 = strtombs(conv,
                 from, from_left, &buf_ptr1, &buf_left1, args, num_args);                  from, from_left, &buf_ptr1, &buf_left1, args, num_args);
     if (unconv_num1 < 0)      if (unconv_num1 < 0)
         goto ret;          goto ret;
   
     buf_left2 = buf_ptr1 - buf_ptr2;      buf_left2 = buf_ptr1 - buf_ptr2;
   
     unconv_num2 = stdc_mbstowcs(conv,      unconv_num2 = stdc_mbstowcs(conv,
                 &buf_ptr2, &buf_left2, to, to_left, args, num_args);                  &buf_ptr2, &buf_left2, to, to_left, args, num_args);
     if (unconv_num2 < 0)      if (unconv_num2 < 0)
         goto ret;          goto ret;
Line 2655  create_conv(
Line 2673  create_conv(
     conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));      conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
     if (conv == NULL)      if (conv == NULL)
         return (XlcConv) NULL;          return (XlcConv) NULL;
   
     conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec));      conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec));
     if (conv->methods == NULL)      if (conv->methods == NULL)
         goto err;          goto err;
     *conv->methods = *methods;      *conv->methods = *methods;
     conv->methods->reset = init_state;      conv->methods->reset = init_state;
   
     conv->state = (XPointer) Xmalloc(sizeof(StateRec));      conv->state = (XPointer) Xmalloc(sizeof(StateRec));
     if (conv->state == NULL)      if (conv->state == NULL)
         goto err;          goto err;
     bzero((char *) conv->state, sizeof(StateRec));      bzero((char *) conv->state, sizeof(StateRec));
   
     state = (State) conv->state;      state = (State) conv->state;
     state->lcd = lcd;      state->lcd = lcd;
   
     _XlcResetConverter(conv);      _XlcResetConverter(conv);
   
     return conv;      return conv;
   
 err:  err:
Line 3112  _XlcGenericLoader(
Line 3130  _XlcGenericLoader(
     _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs);      _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs);
     _XlcSetConverter(lcd, XlcNString,    lcd, XlcNMultiByte,    open_strtombs);      _XlcSetConverter(lcd, XlcNString,    lcd, XlcNMultiByte,    open_strtombs);
     _XlcSetConverter(lcd, XlcNCharSet,   lcd, XlcNMultiByte,    open_cstombs);      _XlcSetConverter(lcd, XlcNCharSet,   lcd, XlcNMultiByte,    open_cstombs);
   
 #ifdef STDCVT  #ifdef STDCVT
      gen = XLC_GENERIC_PART(lcd);       gen = XLC_GENERIC_PART(lcd);
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

CVSweb <webmaster@jp.NetBSD.org>