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

version 1.3, 2003/11/23 09:59:10 version 1.4, 2004/01/15 06:20:42
Line 2 Line 2
 #include        "codecnv.h"  #include        "codecnv.h"
   
   
 static const BYTE euctbl[0x80] = {  
         0xa1, 0xa1, 0xa1, 0xa3, 0xa1, 0xd6, 0xa1, 0xd7, 0xa1, 0xa2, 0xa1, 0xa6,  
         0xa5, 0xf2, 0xa5, 0xa1, 0xa5, 0xa3, 0xa5, 0xa5, 0xa5, 0xa7, 0xa5, 0xa9,  
         0xa5, 0xe3, 0xa5, 0xe5, 0xa5, 0xe7, 0xa5, 0xc3, 0xa1, 0xbc, 0xa5, 0xa2,  
         0xa5, 0xa4, 0xa5, 0xa6, 0xa5, 0xa8, 0xa5, 0xaa, 0xa5, 0xab, 0xa5, 0xad,  
         0xa5, 0xaf, 0xa5, 0xb1, 0xa5, 0xb3, 0xa5, 0xb5, 0xa5, 0xb7, 0xa5, 0xb9,  
         0xa5, 0xbb, 0xa5, 0xbd, 0xa5, 0xbf, 0xa5, 0xc1, 0xa5, 0xc4, 0xa5, 0xc6,  
         0xa5, 0xc8, 0xa5, 0xca, 0xa5, 0xcb, 0xa5, 0xcc, 0xa5, 0xcd, 0xa5, 0xce,  
         0xa5, 0xcf, 0xa5, 0xd2, 0xa5, 0xd5, 0xa5, 0xd8, 0xa5, 0xdb, 0xa5, 0xde,  
         0xa5, 0xdf, 0xa5, 0xe0, 0xa5, 0xe1, 0xa5, 0xe2, 0xa5, 0xe4, 0xa5, 0xe6,  
         0xa5, 0xe8, 0xa5, 0xe9, 0xa5, 0xea, 0xa5, 0xeb, 0xa5, 0xec, 0xa5, 0xed,  
         0xa5, 0xef, 0xa5, 0xf3, 0xa1, 0xab, 0xa1, 0xac};  
   
   
 void codecnv_sjis2euc(char *euc, UINT ecnt, const char *sjis, UINT scnt) {  void codecnv_sjis2euc(char *euc, UINT ecnt, const char *sjis, UINT scnt) {
   
         int             s;          int             s;
Line 56  void codecnv_sjis2euc(char *euc, UINT ec Line 42  void codecnv_sjis2euc(char *euc, UINT ec
                         *euc++ = (char)(((s & 0x3f) << 1) + (c >> 8));                          *euc++ = (char)(((s & 0x3f) << 1) + (c >> 8));
                         *euc++ = (char)c;                          *euc++ = (char)c;
                 }                  }
                 else {                  else if (((s - 0xa0) & 0xff) < 0x40) {
                         s = (s - 0xa0) & 0xff;                          if (ecnt < 2) {
                         if (s < 0x40) {                                  break;
                                 if (ecnt < 2) {  
                                         break;  
                                 }  
                                 ecnt -= 2;  
                                 s <<= 1;  
                                 *euc++ = (char)euctbl[s+0];  
                                 *euc++ = (char)euctbl[s+1];  
                         }                          }
                           ecnt -= 2;
                           *euc++ = (char)0x8e;
                           *euc++ = (char)s;
                 }                  }
         }          }
         *euc = '\0';          *euc = '\0';
Line 83  void codecnv_euc2sjis(char *sjis, UINT s Line 65  void codecnv_euc2sjis(char *sjis, UINT s
                 return;                  return;
         }          }
         scnt--;          scnt--;
         while(1) {          while(scnt) {
                 h = (BYTE)*euc++;                  h = (BYTE)*euc++;
                 if (h < 0x80) {                         // ascii                  if (h < 0x80) {                         // ascii
                         if (!h) {                          if (!h) {
                                 break;                                  break;
                         }                          }
                         if (scnt == 0) {                          scnt--;
                           *sjis++ = (char)h;
                   }
                   else if (h == 0x8e) {
                           l = (BYTE)*euc++;
                           if (!l) {
                                 break;                                  break;
                         }                          }
                         scnt--;                          scnt--;

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


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