Changeset 6054


Ignore:
Timestamp:
Jul 4, 2012 7:29:04 AM (2 years ago)
Author:
tboeckel
Message:
  • YAM_FI.c: replaced even more numeric values by approriate CP_#? constants.
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/YAM_FI.c

    r6053 r6054  
    664664/// FI_PrepareSearch 
    665665//  Initializes Search structure 
    666 BOOL FI_PrepareSearch(struct Search *search, enum SearchMode mode, 
    667                       int persmode, enum Comparison compare, 
    668                       char stat, const char *match, const char *field, const int flags) 
     666BOOL FI_PrepareSearch(struct Search *search, const enum SearchMode mode, 
     667                      const int persmode, const enum Comparison compare, 
     668                      const char stat, const char *match, const char *field, const int flags) 
    669669{ 
    670670  BOOL success = TRUE; 
     
    787787      else if(isFlagSet(search->flags, SEARCHF_SUBSTRING)) 
    788788      { 
    789         // a simple substring search using the Boyer/Moore algorithm 
     789        // do a substring search using the Boyer/Moore algorithm 
    790790        if((search->bmContext = BoyerMooreInit(search->Match, isFlagSet(flags, SEARCHF_CASE_SENSITIVE))) == NULL) 
    791791          success = FALSE; 
    792792      } 
     793      else 
     794      { 
     795        // do an exact string match 
     796        // there is nothing to prepare here 
     797    } 
    793798    } 
    794799  } 
     
    864869    case SM_HEADER: 
    865870    { 
    866       int oldCompare = search->Compare; 
     871      enum Comparison oldCompare = search->Compare; 
    867872 
    868873      // always perform a matching search 
    869       search->Compare = 0; 
     874      search->Compare = CP_EQUAL; 
    870875      found = FI_SearchPatternInHeader(search, mail); 
    871876      search->Compare = oldCompare; 
    872877 
    873878      // invert the result in case a non-matching search was requested 
    874       if(oldCompare == 1) 
     879      if(oldCompare == CP_NOTEQUAL) 
    875880        found = !found; 
    876881 
     
    884889    case SM_BODY: 
    885890    { 
    886       int oldCompare = search->Compare; 
     891      enum Comparison oldCompare = search->Compare; 
    887892 
    888893      // always perform a matching search 
    889       search->Compare = 0; 
     894      search->Compare = CP_EQUAL; 
    890895      found = FI_SearchPatternInBody(search, mail); 
    891896      search->Compare = oldCompare; 
    892897 
    893898      // invert the result in case a non-matching search was requested 
    894       if(oldCompare == 1) 
     899      if(oldCompare == CP_NOTEQUAL) 
    895900        found = !found; 
    896901 
     
    904909    case SM_WHOLE: 
    905910    { 
    906       int oldCompare = search->Compare; 
     911      enum Comparison oldCompare = search->Compare; 
    907912 
    908913      // always perform a matching search 
    909       search->Compare = 0; 
     914      search->Compare = CP_EQUAL; 
    910915      found = FI_SearchPatternInHeader(search, mail); 
    911916      if(found == FALSE) 
     
    914919 
    915920      // invert the result in case a non-matching search was requested 
    916       if(oldCompare == 1) 
     921      if(oldCompare == CP_NOTEQUAL) 
    917922        found = !found; 
    918923 
     
    970975 
    971976      // invert the result in case a non-matching search was requested 
    972       if(search->Compare == 1) 
     977      if(search->Compare == CP_NOTEQUAL) 
    973978        found = !found; 
    974979 
  • trunk/src/YAM_find.h

    r6052 r6054  
    181181extern const char mailStatusCycleMap[11]; 
    182182 
    183 BOOL FI_PrepareSearch(struct Search *search, enum SearchMode mode, int persmode, 
    184                       enum Comparison compare, char stat, const char *match, const char *field, const int flags); 
     183BOOL FI_PrepareSearch(struct Search *search, const enum SearchMode mode, const int persmode, 
     184                      const enum Comparison compare, const char stat, const char *match, const char *field, const int flags); 
    185185BOOL FI_DoSearch(struct Search *search, const struct Mail *mail); 
    186186BOOL FI_FilterSingleMail(const struct MinList *filterList, struct Mail *mail, int *matches, struct FilterResult *result); 
Note: See TracChangeset for help on using the changeset viewer.