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

version 1.2, 2003/11/13 17:02:25 version 1.3, 2003/11/23 09:59:10
Line 72  void codecnv_sjis2euc(char *euc, UINT ec Line 72  void codecnv_sjis2euc(char *euc, UINT ec
         *euc = '\0';          *euc = '\0';
 }  }
   
   void codecnv_euc2sjis(char *sjis, UINT scnt, const char *euc, UINT ecnt) {
   
           UINT    h;
           UINT    l;
   
           (void)ecnt;                     // 判定してないのかよ
   
           if ((sjis == NULL) || (scnt == 0) || (euc == NULL)) {
                   return;
           }
           scnt--;
           while(1) {
                   h = (BYTE)*euc++;
                   if (h < 0x80) {                         // ascii
                           if (!h) {
                                   break;
                           }
                           if (scnt == 0) {
                                   break;
                           }
                           scnt--;
                           *sjis++ = (char)h;
                   }
                   else {
                           l = (BYTE)*euc++;
                           if ((!l) || (scnt < 2)) {
                                   break;
                           }
                           h &= 0x7f;
                           l &= 0x7f;
                           l += ((h & 1) - 1) & 0x5e;
                           if (l >= 0x60) {
                                   l++;
                           }
                           h += 0x121;
                           l += 0x1f;
                           h >>= 1;
                           h ^= 0x20;
                           *sjis++ = (char)h;
                           *sjis++ = (char)l;
                           scnt -= 2;
                   }
           }
           *sjis = '\0';
   }
   
   
 // ----  // ----
   

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


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