Diff for /np2/common/milstr.c between versions 1.10 and 1.11

version 1.10, 2004/06/20 11:19:45 version 1.11, 2004/06/23 16:06:12
Line 118  int milsjis_cmp(const char *str, const c Line 118  int milsjis_cmp(const char *str, const c
         int             c;          int             c;
   
         do {          do {
                 s = (BYTE)*str++;                  s = (UINT8)*str++;
                 if ((((s ^ 0x20) - 0xa1) & 0xff) < 0x3c) {                  if ((((s ^ 0x20) - 0xa1) & 0xff) < 0x3c) {
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         if (s != c) {                          if (s != c) {
                                 goto mscp_err;                                  goto mscp_err;
                         }                          }
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                 }                  }
                 else {                  else {
                         if (((s - 'a') & 0xff) < 26) {                          if (((s - 'a') & 0xff) < 26) {
                                 s -= 0x20;                                  s -= 0x20;
                         }                          }
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         if (((c - 'a') & 0xff) < 26) {                          if (((c - 'a') & 0xff) < 26) {
                                 c -= 0x20;                                  c -= 0x20;
                         }                          }
Line 152  int milsjis_memcmp(const char *str, cons Line 152  int milsjis_memcmp(const char *str, cons
         int             c;          int             c;
   
         do {          do {
                 c = (BYTE)*cmp++;                  c = (UINT8)*cmp++;
                 if ((((c ^ 0x20) - 0xa1) & 0xff) < 0x3c) {                  if ((((c ^ 0x20) - 0xa1) & 0xff) < 0x3c) {
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                         if (c != s) {                          if (c != s) {
                                 break;                                  break;
                         }                          }
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                 }                  }
                 else if (c) {                  else if (c) {
                         if (((c - 'a') & 0xff) < 26) {                          if (((c - 'a') & 0xff) < 26) {
                                 c &= ~0x20;                                  c &= ~0x20;
                         }                          }
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                         if (((s - 'a') & 0xff) < 26) {                          if (((s - 'a') & 0xff) < 26) {
                                 s &= ~0x20;                                  s &= ~0x20;
                         }                          }
Line 191  int milsjis_kanji1st(const char *str, in Line 191  int milsjis_kanji1st(const char *str, in
   
 int milsjis_kanji2nd(const char *str, int pos) {  int milsjis_kanji2nd(const char *str, int pos) {
   
         int             ret = 0;          int             ret;
   
           ret = 0;
         while((pos > 0) && ((((str[--pos] ^ 0x20) - 0xa1) & 0xff) < 0x3c)) {          while((pos > 0) && ((((str[--pos] ^ 0x20) - 0xa1) & 0xff) < 0x3c)) {
                 ret ^= 1;                  ret ^= 1;
         }          }
Line 270  int mileuc_charsize(const char *str) { Line 271  int mileuc_charsize(const char *str) {
   
         int             pos;          int             pos;
   
         pos = (((str[0] - 0xa1) & 0xff) < 0x5d)?1:0;          pos = (str[0] & 0x80)?1:0;
         return((str[pos] != '\0')?(pos+1):0);          return((str[pos] != '\0')?(pos+1):0);
 }  }
   
Line 280  int mileuc_cmp(const char *str, const ch Line 281  int mileuc_cmp(const char *str, const ch
         int             c;          int             c;
   
         do {          do {
                 s = (BYTE)*str++;                  s = (UINT8)*str++;
                 if (((s - 0xa1) & 0xff) < 0x5d) {                  if (s & 0x80) {
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         if (s != c) {                          if (s != c) {
                                 goto mscp_err;                                  goto mscp_err;
                         }                          }
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                 }                  }
                 else {                  else {
                         if (((s - 'a') & 0xff) < 26) {                          if (((s - 'a') & 0xff) < 26) {
                                 s -= 0x20;                                  s -= 0x20;
                         }                          }
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         if (((c - 'a') & 0xff) < 26) {                          if (((c - 'a') & 0xff) < 26) {
                                 c -= 0x20;                                  c -= 0x20;
                         }                          }
Line 314  int mileuc_memcmp(const char *str, const Line 315  int mileuc_memcmp(const char *str, const
         int             c;          int             c;
   
         do {          do {
                 c = (BYTE)*cmp++;                  c = (UINT8)*cmp++;
                 if (((c - 0xa1) & 0xff) < 0x5d) {                  if (c & 0x80) {
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                         if (c != s) {                          if (c != s) {
                                 break;                                  break;
                         }                          }
                         c = (BYTE)*cmp++;                          c = (UINT8)*cmp++;
                         s = (BYTE)*str++;                          s = (UINT8)*str++;
                 }                  }
                 else if (c) {                  else if (c) {
                         if (((c - 'a') & 0xff) < 26) {                          if (((c - 'a') & 0xff) < 26) {
Line 344  int mileuc_kanji1st(const char *str, int Line 345  int mileuc_kanji1st(const char *str, int
         int             ret;          int             ret;
   
         ret = 0;          ret = 0;
         while((pos >= 0) &&          while((pos >= 0) && (str[pos--] & 0x80)) {
                 (((str[pos--] - 0xa1) & 0xff) < 0x5d)) {  
                 ret ^= 1;                  ret ^= 1;
         }          }
         return(ret);          return(ret);
Line 353  int mileuc_kanji1st(const char *str, int Line 353  int mileuc_kanji1st(const char *str, int
   
 int mileuc_kanji2nd(const char *str, int pos) {  int mileuc_kanji2nd(const char *str, int pos) {
   
         int             ret = 0;          int             ret;
   
         while((pos > 0) && (((str[--pos] - 0xa1) & 0xff) < 0x5d)) {          ret = 0;
           while((pos > 0) && (str[--pos] & 0x80)) {
                 ret ^= 1;                  ret ^= 1;
         }          }
         return(ret);          return(ret);
Line 413  char *mileuc_chr(const char *str, int c) Line 414  char *mileuc_chr(const char *str, int c)
                         if (s == c) {                          if (s == c) {
                                 return((char *)str);                                  return((char *)str);
                         }                          }
                         if (((s - 0xa1) & 0xff) < 0x5d) {                          if (s & 0x80) {
                                 str++;                                  str++;
                                 s = *str;                                  s = *str;
                         }                          }

Removed from v.1.10  
changed lines
  Added in v.1.11


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