Ignore:
Timestamp:
Feb 26, 2002, 9:28:01 PM (23 years ago)
Author:
umoeller
Message:

Misc minor fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/stringh.c

    r143 r144  
    873873 *
    874874 *@@added V0.9.6 (2000-11-12) [umoeller]
     875 *@@changed V0.9.18 (2002-02-23) [umoeller]: fixed end char check
    875876 */
    876877
    877878BOOL strhIsWord(PCSZ pcszBuf,
    878879                PCSZ p,                 // in: start of word
    879                 ULONG cbSearch,                // in: length of word
     880                ULONG cbSearch,         // in: length of word
    880881                PCSZ pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
    881882                PCSZ pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
    882883{
    883     BOOL    fEndOK = FALSE;
    884 
    885884    // check previous char
    886885    if (    (p == pcszBuf)
     
    890889        // OK, valid begin char:
    891890        // check end char
    892         CHAR    cNextChar = *(p + cbSearch);
    893         if (cNextChar == 0)
    894             fEndOK = TRUE;
     891        CHAR    cNextChar;
     892        if (!(cNextChar = p[cbSearch]))
     893            // null terminator:
     894            return TRUE;
    895895        else
    896896        {
    897             char *pc = strchr(pcszEndChars, cNextChar);
    898             if (pc)
     897            // not null terminator: check if char is
     898            // in the list of valid end chars
     899            if (strchr(pcszEndChars, cNextChar))
     900            {
    899901                // OK, is end char: avoid doubles of that char,
    900902                // but allow spaces
    901                 if (    (cNextChar+1 != *pc)
    902                      || (cNextChar+1 == ' ')
    903                      || (cNextChar+1 == 0)
     903                // fixed V0.9.18 (2002-02-23) [umoeller]
     904                CHAR cNextNext = p[cbSearch + 1];
     905                if (    (cNextNext != cNextChar)
     906                     || (cNextNext == ' ')
     907                     || (cNextNext == 0)
    904908                   )
    905                     fEndOK = TRUE;
    906         }
    907     }
    908 
    909     return (fEndOK);
     909                    return TRUE;
     910            }
     911        }
     912    }
     913
     914    return FALSE;
    910915}
    911916
Note: See TracChangeset for help on using the changeset viewer.