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

version 1.1.1.1, 2003/10/16 17:57:16 version 1.3, 2003/11/23 09:59:10
Line 28  void codecnv_sjis2euc(char *euc, UINT ec Line 28  void codecnv_sjis2euc(char *euc, UINT ec
         }          }
         ecnt--;          ecnt--;
         while(1) {          while(1) {
                 s = *sjis++;                  s = (BYTE)*sjis++;
                 if (s < 0x80) {                         // ascii                  if (s < 0x80) {                         // ascii
                         if (!s) {                          if (!s) {
                                 break;                                  break;
Line 40  void codecnv_sjis2euc(char *euc, UINT ec Line 40  void codecnv_sjis2euc(char *euc, UINT ec
                         *euc++ = (char)s;                          *euc++ = (char)s;
                 }                  }
                 else if ((((s ^ 0x20) - 0xa1) & 0xff) < 0x2f) {                  else if ((((s ^ 0x20) - 0xa1) & 0xff) < 0x2f) {
                         c = *sjis++;                          c = (BYTE)*sjis++;
                         if (!c) {                          if (!c) {
                                 break;                                  break;
                         }                          }
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.1.1.1  
changed lines
  Added in v.1.3


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