Diff for /np2/codecnv/eucucs2.c between versions 1.2 and 1.3

version 1.2, 2005/02/13 05:31:25 version 1.3, 2005/04/01 15:35:48
Line 1181  static const UINT16 euc8e[] = { Line 1181  static const UINT16 euc8e[] = {
 UINT codecnv_euctoucs2(UINT16 *dst, UINT dcnt, const char *src, UINT scnt) {  UINT codecnv_euctoucs2(UINT16 *dst, UINT dcnt, const char *src, UINT scnt) {
   
         UINT            orgdcnt;          UINT            orgdcnt;
           BOOL            stringmode;
         UINT            h;          UINT            h;
         UINT            l;          UINT            l;
         UINT16          code;          UINT16          code;
 const UINT16    *t;  const UINT16    *t;
   
         (void)scnt;  
         if (src == NULL) {          if (src == NULL) {
                 return(0);                  return(0);
         }          }
           if (dcnt == 0) {
         orgdcnt = dcnt;  
         if (dst == NULL) {  
                 dst = NULL;                  dst = NULL;
                   dcnt = (UINT)-1;
           }
           orgdcnt = dcnt;
           stringmode = (((SINT)scnt) < 0);
           if (stringmode) {
                   dcnt--;
         }          }
         dcnt--;          while(scnt > 0) {
         while(dcnt) {                  scnt--;
                 h = (UINT8)*src++;                  h = (UINT8)*src++;
                 if (h == 0) {                  if ((h == 0) && (stringmode)) {
                         break;                          break;
                 }                  }
                 else if (h < 0x80) {                  else if (h < 0x80) {
                         code = (UINT16)h;                          code = (UINT16)h;
                 }                  }
                 else if (h >= 0xa0) {                  else if (h >= 0xa0) {
                           if (scnt == 0) {
                                   break;
                           }
                           scnt--;
                         l = (UINT8)*src++;                          l = (UINT8)*src++;
                         if (l == 0) {                          if (l == 0) {
                                 break;                                  break;
Line 1219  const UINT16 *t; Line 1227  const UINT16 *t;
                         }                          }
                 }                  }
                 else if (h == 0x8e) {                  else if (h == 0x8e) {
                           if (scnt == 0) {
                                   break;
                           }
                           scnt--;
                         l = (UINT8)*src++;                          l = (UINT8)*src++;
                         if (l == 0) {                          if (l == 0) {
                                 break;                                  break;
Line 1233  const UINT16 *t; Line 1245  const UINT16 *t;
                 else {                  else {
                         code = UDCODE;                          code = UDCODE;
                 }                  }
                   if (dcnt == 0) {
                           break;
                   }
                 dcnt--;                  dcnt--;
                 if (dst) {                  if (dst) {
                         dst[0] = code;                          dst[0] = code;
                         dst++;                          dst++;
                 }                  }
         }          }
         if (dst) {          if (dst != NULL) {
                 dst[0] = 0;                  if (stringmode) {
                           *dst = '\0';
                   }
   #if 1   // 一応互換の為に NULLつける
                   else if (dcnt) {
                           *dst = '\0';
                   }
   #endif
         }          }
         return((UINT)(orgdcnt - dcnt));          return((UINT)(orgdcnt - dcnt));
 }  }

Removed from v.1.2  
changed lines
  Added in v.1.3


RetroPC.NET-CVS <cvs@retropc.net>