Changeset 3003 for branches/libc-0.6


Ignore:
Timestamp:
Apr 7, 2007, 2:01:49 AM (18 years ago)
Author:
bird
Message:

Fixed a typo in the collate default data. Optimized strcoll and added a primitive strcoll testcase.

Location:
branches/libc-0.6/src/emx/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/locale/locale_collate.c

    r1519 r3003  
    3333    {
    3434          0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
    35          10,  11,  13,  12,  14,  15,  16,  17,  18,  19,
    36          20,  21,  23,  22,  24,  25,  26,  27,  28,  29,
    37          30,  31,  33,  32,  34,  35,  36,  37,  38,  39,
    38          40,  41,  43,  42,  44,  45,  46,  47,  48,  49,
    39          50,  51,  53,  52,  54,  55,  56,  57,  58,  59,
    40          60,  61,  63,  62,  64,  65,  66,  67,  68,  69,
    41          70,  71,  73,  72,  74,  75,  76,  77,  78,  79,
    42          80,  81,  83,  82,  84,  85,  86,  87,  88,  89,
    43          90,  91,  93,  92,  94,  95,  96,  97,  98,  99,
    44         100, 101, 103, 102, 104, 105, 106, 107, 108, 109,
    45         110, 111, 113, 112, 114, 115, 116, 117, 118, 119,
    46         120, 121, 123, 122, 124, 125, 126, 127, 128, 129,
    47         130, 131, 133, 132, 134, 135, 136, 137, 138, 139,
    48         140, 141, 143, 142, 144, 145, 146, 147, 148, 149,
    49         150, 151, 153, 152, 154, 155, 156, 157, 158, 159,
    50         160, 161, 163, 162, 164, 165, 166, 167, 168, 169,
    51         170, 171, 173, 172, 174, 175, 176, 177, 178, 179,
    52         180, 181, 183, 182, 184, 185, 186, 187, 188, 189,
    53         190, 191, 193, 192, 194, 195, 196, 197, 198, 199,
    54         200, 201, 203, 202, 204, 205, 206, 207, 208, 209,
    55         210, 211, 213, 212, 214, 215, 216, 217, 218, 219,
    56         220, 221, 223, 222, 224, 225, 226, 227, 228, 229,
    57         230, 231, 233, 232, 234, 235, 236, 237, 238, 239,
    58         240, 241, 243, 242, 244, 245, 246, 247, 248, 249,
    59         250, 251, 253, 252, 254, 255
     35         10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
     36         20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
     37         30,  31,  32,  33,  34,  35,  36,  37,  38,  39,
     38         40,  41,  42,  43,  44,  45,  46,  47,  48,  49,
     39         50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
     40         60,  61,  62,  63,  64,  65,  66,  67,  68,  69,
     41         70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
     42         80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
     43         90,  91,  92,  93,  94,  95,  96,  97,  98,  99,
     44        100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
     45        110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
     46        120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
     47        130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
     48        140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
     49        150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
     50        160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
     51        170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
     52        180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
     53        190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
     54        200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
     55        210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
     56        220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
     57        230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
     58        240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
     59        250, 251, 252, 253, 254, 255
    6060    },
    6161    .au2MBCSPrefixs =
  • branches/libc-0.6/src/emx/src/lib/str/strcoll.c

    r1454 r3003  
    2525  if (__libc_gLocaleCollate.mbcs)
    2626  {
    27     FS_VAR();
    28     FS_SAVE_LOAD();
    2927    /* MBCS case. We compare the strings as usual, but as soon as we
    3028       encounter a MBCS character we translate the rests of the strings
     
    3836        UniChar *ucs [2];
    3937        const char *sbcs [2] = { s1, s2 };
     38        FS_VAR_SAVE_LOAD();
    4039
    4140        /* I can't imagine X bytes to convert into more
     
    4847          UniChar *outbuf = ucs [i] = alloca (sl * sizeof (UniChar));
    4948
    50           if (UniUconvToUcs (__libc_gLocaleCollate.uobj, &inbuf, &in_left, &outbuf,
    51                 &out_left, &nonid))
     49          if (UniUconvToUcs (__libc_gLocaleCollate.uobj, &inbuf, &in_left, &outbuf, &out_left, &nonid))
    5250          {
    5351            /* Oops, something bad happened (invalid character code). Suppose
     
    6462      }
    6563
    66       d = __libc_gLocaleCollate.auchWeight [c1] - __libc_gLocaleCollate.auchWeight [c2];
    67       if (d || !c1 || !c2)
     64      if (c1 != c2)
    6865      {
    69         FS_RESTORE();
    70         return d;
     66        d = __libc_gLocaleCollate.auchWeight [c1] - __libc_gLocaleCollate.auchWeight [c2];
     67        if (d || !c1 || !c2)
     68          return d;
    7169      }
     70      else if (!c1)
     71        return 0;
    7272      c1 = *++s1;
    7373      c2 = *++s2;
    7474    } /* endfor */
    75     FS_RESTORE();
    7675  }
    7776  else
     
    7978    for (;;)
    8079    {
    81       d = __libc_gLocaleCollate.auchWeight [c1] - __libc_gLocaleCollate.auchWeight [c2];
    82       if (d || !c1 || !c2)
    83         return d;
     80      if (c1 != c2)
     81      {
     82        d = __libc_gLocaleCollate.auchWeight [c1] - __libc_gLocaleCollate.auchWeight [c2];
     83        if (d || !c1 || !c2)
     84          return d;
     85      }
     86      else if (!c1)
     87        return 0;
    8488      c1 = *++s1;
    8589      c2 = *++s2;
Note: See TracChangeset for help on using the changeset viewer.