Navigation


Changeset 738:d666051658bd in freeDiameter for libfdproto/ostr.c


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

Fix broken 'almostcasecmp' logic

File:
1 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       
Note: See TracChangeset for help on using the changeset viewer.