Diff for /np2/codecnv/ucs2utf8.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 5 Line 5
 UINT codecnv_ucs2toutf8(char *dst, UINT dcnt, const UINT16 *src, UINT scnt) {  UINT codecnv_ucs2toutf8(char *dst, UINT dcnt, const UINT16 *src, UINT scnt) {
   
         UINT    orgdcnt;          UINT    orgdcnt;
           BOOL    stringmode;
         UINT    c;          UINT    c;
   
         (void)scnt;          if (src == NULL) {
         orgdcnt = dcnt;                  return(0);
           }
         if (dcnt == 0) {          if (dcnt == 0) {
                 dst = NULL;                  dst = NULL;
                   dcnt = (UINT)-1;
         }          }
           orgdcnt = dcnt;
         dcnt--;          stringmode = (((SINT)scnt) < 0);
         while(dcnt) {          if (stringmode) {
                   dcnt--;
           }
           while(scnt > 0) {
                 c = *src++;                  c = *src++;
                 if (!c) {                  scnt--;
                   if ((c == '\0') && (stringmode)) {
                         break;                          break;
                 }                  }
                 else if (c < 0x80) {                  else if (c < 0x80) {
                           if (dcnt == 0) {
                                   break;
                           }
                         dcnt--;                          dcnt--;
                         if (dst) {                          if (dst) {
                                 dst[0] = (char)c;                                  dst[0] = (char)c;
Line 50  UINT codecnv_ucs2toutf8(char *dst, UINT  Line 60  UINT codecnv_ucs2toutf8(char *dst, UINT 
                         }                          }
                 }                  }
         }          }
         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>