Diff for /np2/codecnv/sjisucs2.c between versions 1.1 and 1.2

version 1.1, 2005/02/12 12:13:56 version 1.2, 2005/04/01 15:35:48
Line 1145  static const UINT32 utftbl[] = { Line 1145  static const UINT32 utftbl[] = {
 UINT codecnv_sjis2utf(UINT16 *dst, UINT dcnt, const char *src, UINT scnt) {  UINT codecnv_sjis2utf(UINT16 *dst, UINT dcnt, const char *src, UINT scnt) {
   
         UINT    orgdcnt;          UINT    orgdcnt;
           BOOL    stringmode;
         UINT    s;          UINT    s;
         UINT    r;          UINT    r;
   
         (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--;
                 s = (UINT8)*src++;                  s = (UINT8)*src++;
                 if (s == 0) {                  if ((s == 0) && (stringmode)) {
                         break;                          break;
                 }                  }
                 r = utftbl[s];                  r = utftbl[s];
                 if (r & 0xffff0000) {                  if (r & 0xffff0000) {
                           if (scnt == 0) {
                                   break;
                           }
                           scnt--;
                         s = (UINT8)*src++;                          s = (UINT8)*src++;
                         if (s == 0) {                          if (s == 0) {
                                 break;                                  break;
Line 1178  UINT codecnv_sjis2utf(UINT16 *dst, UINT  Line 1186  UINT codecnv_sjis2utf(UINT16 *dst, UINT 
                                 r = UDCODE;                                  r = UDCODE;
                         }                          }
                 }                  }
                   if (dcnt == 0) {
                           break;
                   }
                 dcnt--;                  dcnt--;
                 if (dst) {                  if (dst) {
                         dst[0] = (UINT16)r;                          dst[0] = (UINT16)r;
                         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.1  
changed lines
  Added in v.1.2


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