Navigation


Changeset 738:d666051658bd in freeDiameter for libfdproto


Ignore:
Timestamp:
Mar 2, 2011, 6:21:59 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fix broken 'almostcasecmp' logic

Location:
libfdproto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/ostr.c

    r730 r738  
    6969}
    7070
    71 /* a little less sensitive to case, slower. */
    72 int fd_os_almostcasecmp_int(uint8_t * os1, size_t os1sz, uint8_t * os2, size_t os2sz)
     71/* less sensitive to case, slower. */
     72int fd_os_almostcasesrch_int(uint8_t * os1, size_t os1sz, uint8_t * os2, size_t os2sz, int *maybefurther)
    7373{
    7474        int i;
     75        int res = 0;
     76       
    7577        ASSERT( os1 && os2);
     78        if (maybefurther)
     79                *maybefurther = 0;
     80       
    7681        if (os1sz < os2sz)
    7782                return -1;
     83       
     84        if (maybefurther)
     85                *maybefurther = 1;
     86       
    7887        if (os1sz > os2sz)
    7988                return 1;
     
    8392                        continue;
    8493               
     94                if (!res)
     95                        res = os1[i] < os2[i] ? -1 : 1;
     96               
    8597                if (asciitolower(os1[i]) == asciitolower(os2[i]))
    8698                        continue;
    8799               
    88                 return os1[i] < os2[i] ? -1 : 1;
     100                return res;
    89101        }
    90102       
  • libfdproto/rt_data.c

    r717 r738  
    160160        for (li = rtd->candidates.next; li != &rtd->candidates; li = li->next) {
    161161                struct rtd_candidate * c = (struct rtd_candidate *) li;
    162                
    163                 int cmp = fd_os_almostcasecmp(id, idsz, c->diamid, c->diamidlen);
     162                int cont;
     163                int cmp = fd_os_almostcasesrch(id, idsz, c->diamid, c->diamidlen, &cont);
    164164               
    165165                if (!cmp) {
     
    172172                }
    173173               
    174                 if (cmp > 0)
     174                if (cont)
    175175                        continue;
    176176               
Note: See TracChangeset for help on using the changeset viewer.