diff options
author | nyamatongwe <unknown> | 2001-04-09 23:25:52 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-04-09 23:25:52 +0000 |
commit | c4a42c8794aa5cc2002a734b93732ee5eea2a835 (patch) | |
tree | b0b1cf6107a017e99fb7a4a08b7768e1e27c0363 | |
parent | 4d04d1c5cbfd95f7116acc653895ae7af2100622 (diff) | |
download | scintilla-mirror-c4a42c8794aa5cc2002a734b93732ee5eea2a835.tar.gz |
Philippe provided fix for EM_GETLINE and reformatting.
-rw-r--r-- | src/Document.cxx | 71 | ||||
-rw-r--r-- | src/Editor.cxx | 156 | ||||
-rw-r--r-- | src/PropSet.cxx | 62 |
3 files changed, 167 insertions, 122 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 4a915314d..80135f245 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -46,7 +46,7 @@ Document::Document() { useTabs = true; watchers = 0; lenWatchers = 0; - + matchesValid = false; pre = 0; substituted = 0; @@ -733,6 +733,10 @@ int Document::NextWordStart(int pos, int delta) { return pos; } +/** + * Check that the character before the given position + * is not a word character. + */ bool Document::IsWordStartAt(int pos) { if (pos > 0) { return !IsWordChar(CharAt(pos - 1)); @@ -740,6 +744,10 @@ bool Document::IsWordStartAt(int pos) { return true; } +/** + * Check that the character after the given position + * is not a word character. + */ bool Document::IsWordEndAt(int pos) { if (pos < Length() - 1) { return !IsWordChar(CharAt(pos)); @@ -747,6 +755,10 @@ bool Document::IsWordEndAt(int pos) { return true; } +/** + * Check that the given range is delimited by + * non word characters. + */ bool Document::IsWordAt(int start, int end) { return IsWordStartAt(start) && IsWordEndAt(end); } @@ -772,31 +784,32 @@ static inline char MakeLowerCase(char ch) { class DocumentIndexer : public CharacterIndexer { Document *pdoc; int end; -public: - DocumentIndexer(Document *pdoc_, int end_) : - pdoc(pdoc_), end(end_) { - } +public: +DocumentIndexer(Document *pdoc_, int end_) : + pdoc(pdoc_), end(end_) {} + virtual char CharAt(int index) { if (index < 0 || index >= end) return 0; - else + else return pdoc->CharAt(index); } }; -// Find text in document, supporting both forward and backward -// searches (just pass minPos > maxPos to do a backward search) -// Has not been tested with backwards DBCS searches yet. +/** + * Find text in document, supporting both forward and backward + * searches (just pass minPos > maxPos to do a backward search) + * Has not been tested with backwards DBCS searches yet. + */ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, - int *length) { + int *length) { if (regExp) { - if (!pre) pre = new RESearch(); if (!pre) return -1; - + int startPos; int endPos; @@ -826,18 +839,18 @@ long Document::FindText(int minPos, int maxPos, const char *s, int lenRet = 0; char searchEnd = '\0'; if (*s) - searchEnd = s[strlen(s)-1]; - for (int line=lineRangeStart; line<=lineRangeEnd; line++) { + searchEnd = s[strlen(s) - 1]; + for (int line = lineRangeStart; line <= lineRangeEnd; line++) { int startOfLine = LineStart(line); int endOfLine = LineEnd(line); if (line == lineRangeStart) { if ((startPos != startOfLine) && (s[0] == '^')) - continue; // Can't match start of line if start position after start of line + continue; // Can't match start of line if start position after start of line startOfLine = startPos; } if (line == lineRangeEnd) { if ((endPos != endOfLine) && (searchEnd == '$')) - continue; // Can't match end of line if end position before end of line + continue; // Can't match end of line if end position before end of line endOfLine = endPos; } DocumentIndexer di(this, endOfLine); @@ -852,14 +865,14 @@ long Document::FindText(int minPos, int maxPos, const char *s, return pos; } else { - + bool forward = minPos <= maxPos; int increment = forward ? 1 : -1; - + // Range endpoints should not be inside DBCS characters, but just in case, move them. int startPos = MovePositionOutsideChar(minPos, increment, false); int endPos = MovePositionOutsideChar(maxPos, increment, false); - + // Compute actual search ranges needed int lengthFind = strlen(s); int endSearch = endPos; @@ -883,8 +896,8 @@ long Document::FindText(int minPos, int maxPos, const char *s, } if (found) { if ((!word && !wordStart) || - word && IsWordAt(pos, pos + lengthFind) || - wordStart && IsWordStartAt(pos)) + word && IsWordAt(pos, pos + lengthFind) || + wordStart && IsWordStartAt(pos)) return pos; } } @@ -898,8 +911,8 @@ long Document::FindText(int minPos, int maxPos, const char *s, } if (found) { if ((!word && !wordStart) || - word && IsWordAt(pos, pos + lengthFind) || - wordStart && IsWordStartAt(pos)) + word && IsWordAt(pos, pos + lengthFind) || + wordStart && IsWordStartAt(pos)) return pos; } } @@ -924,9 +937,9 @@ const char *Document::SubstituteByPosition(const char *text) { if (!pre->GrabMatches(di)) return 0; unsigned int lenResult = 0; - for (const char *t=text; *t; t++) { - if ((*t == '\\') && (*(t+1) >= '1' && *(t+1) <= '9')) { - unsigned int patNum = *(t+1) - '0'; + for (const char *t = text; *t; t++) { + if ((*t == '\\') && (*(t + 1) >= '1' && *(t + 1) <= '9')) { + unsigned int patNum = *(t + 1) - '0'; lenResult += pre->eopat[patNum] - pre->bopat[patNum]; t++; } else { @@ -937,9 +950,9 @@ const char *Document::SubstituteByPosition(const char *text) { if (!substituted) return 0; char *o = substituted; - for (const char *s=text; *s; s++) { - if ((*s == '\\') && (*(s+1) >= '1' && *(s+1) <= '9')) { - unsigned int patNum = *(s+1) - '0'; + for (const char *s = text; *s; s++) { + if ((*s == '\\') && (*(s + 1) >= '1' && *(s + 1) <= '9')) { + unsigned int patNum = *(s + 1) - '0'; unsigned int len = pre->eopat[patNum] - pre->bopat[patNum]; strcpy(o, pre->pat[patNum]); o += len; diff --git a/src/Editor.cxx b/src/Editor.cxx index 8590c362f..185f15415 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -79,7 +79,7 @@ Editor::Editor() { visiblePolicy = VISIBLE_SLOP; visibleSlop = 0; - + searchAnchor = 0; ucWheelScrollLines = 0; @@ -94,7 +94,7 @@ Editor::Editor() { targetStart = 0; targetEnd = 0; - + topLine = 0; posTopLine = 0; @@ -823,7 +823,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll.positions[0] = 0; unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars; bool lastSegItalics = false; - + for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) { if ((ll.styles[charInLine] != ll.styles[charInLine + 1]) || IsControlCharacter(ll.chars[charInLine]) || IsControlCharacter(ll.chars[charInLine + 1])) { @@ -864,7 +864,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } // Small hack to make lines that end with italics not cut off the edge of the last character if ((startseg > 0) && lastSegItalics) { - ll.positions[startseg] +=2; + ll.positions[startseg] += 2; } ll.numCharsInLine = numCharsInLine; } @@ -1342,6 +1342,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { //g_timer_destroy(tim); // Right column limit indicator + PRectangle rcBeyondEOF = rcClient; rcBeyondEOF.left = vs.fixedColumnWidth; rcBeyondEOF.right = rcBeyondEOF.right; @@ -1410,7 +1411,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.selbackset = false; vsPrint.selforeset = false; vsPrint.showCaretLineBackground = false; - + // Set colours for printing according to users settings for (int sty = 0;sty <= STYLE_MAX;sty++) { if (printColourMode == SC_PRINT_INVERTLIGHT) { @@ -1573,7 +1574,7 @@ void Editor::AddCharUTF(char *s, unsigned int len) { void Editor::ClearSelection() { if (selType == selRectangle) { - pdoc->BeginUndoAction(); + pdoc->BeginUndoAction(); int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int startPos = SelectionStart(); @@ -1585,16 +1586,16 @@ void Editor::ClearSelection() { } } SetEmptySelection(startPos); - pdoc->EndUndoAction(); + pdoc->EndUndoAction(); selType = selStream; } else { int startPos = SelectionStart(); unsigned int chars = SelectionEnd() - startPos; SetEmptySelection(startPos); if (0 != chars) { - pdoc->BeginUndoAction(); + pdoc->BeginUndoAction(); pdoc->DeleteChars(startPos, chars); - pdoc->EndUndoAction(); + pdoc->EndUndoAction(); } } } @@ -1628,7 +1629,7 @@ void Editor::Cut() { void Editor::PasteRectangular(int pos, const char *ptr, int len) { if (pdoc->IsReadOnly()) { - return; + return ; } currentPos = pos; int insertPos = currentPos; @@ -1648,8 +1649,8 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) { } // Pad the end of lines with spaces if required currentPos = PositionFromLineX(line, xInsert); - if ((XFromPosition(currentPos) < xInsert) && (i+1 < len)) { - for (int i=0; i < xInsert - XFromPosition(currentPos); i++) { + if ((XFromPosition(currentPos) < xInsert) && (i + 1 < len)) { + for (int i = 0; i < xInsert - XFromPosition(currentPos); i++) { pdoc->InsertChar(currentPos, ' '); currentPos++; } @@ -2036,7 +2037,8 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long case SCI_NEWLINE: default: // printf("Filtered out %ld of macro recording\n", iMessage); - return; + + return ; } // Send notification @@ -2239,7 +2241,7 @@ int Editor::KeyCommand(unsigned int iMessage) { ShowCaretAtCurrentPosition(); NotifyUpdateUI(); break; - case SCI_CANCEL: // Cancel any modes - handled in subclass + case SCI_CANCEL: // Cancel any modes - handled in subclass // Also unselect text CancelModes(); break; @@ -2314,7 +2316,7 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_DELLINELEFT: { int line = pdoc->LineFromPosition(currentPos); int start = pdoc->LineStart(line); - pdoc->DeleteChars(start,currentPos - start); + pdoc->DeleteChars(start, currentPos - start); MovePositionTo(start); SetLastXChosen(); } @@ -2322,7 +2324,7 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_DELLINERIGHT: { int line = pdoc->LineFromPosition(currentPos); int end = pdoc->LineEnd(line); - pdoc->DeleteChars(currentPos,end - currentPos); + pdoc->DeleteChars(currentPos, end - currentPos); MovePositionTo(currentPos); } break; @@ -2459,15 +2461,24 @@ void Editor::Indent(bool forwards) { } } -long Editor::FindText(unsigned int iMessage, unsigned long wParam, long lParam) { +/** + * Search of a text in the document, in the given range. + * @return The position of the found text, -1 if not found. + */ +long Editor::FindText( + unsigned int iMessage, ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT. + unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP. + long lParam) { ///< @c TextToFind structure: The text to search for in the given range. + TextToFind *ft = reinterpret_cast<TextToFind *>(lParam); int lengthFound = strlen(ft->lpstrText); int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, - wParam & SCFIND_MATCHCASE, - wParam & SCFIND_WHOLEWORD, - wParam & SCFIND_WORDSTART, - wParam & SCFIND_REGEXP, - &lengthFound); + wParam & SCFIND_MATCHCASE, + wParam & SCFIND_WHOLEWORD, + wParam & SCFIND_WORDSTART, + wParam & SCFIND_REGEXP, + &lengthFound); if (pos != -1) { if (iMessage != EM_FINDTEXT) { ft->chrgText.cpMin = pos; @@ -2477,40 +2488,49 @@ long Editor::FindText(unsigned int iMessage, unsigned long wParam, long lParam) return pos; } -// Relocatable search support : Searches relative to current selection -// point and sets the selection to the found text range with -// each search. - -// Anchor following searches at current selection start: This allows -// multiple incremental interactive searches to be macro recorded -// while still setting the selection to found text so the find/select -// operation is self-contained. +/** + * Relocatable search support : Searches relative to current selection + * point and sets the selection to the found text range with + * each search. + */ +/** + * Anchor following searches at current selection start: This allows + * multiple incremental interactive searches to be macro recorded + * while still setting the selection to found text so the find/select + * operation is self-contained. + */ void Editor::SearchAnchor() { searchAnchor = SelectionStart(); } -// Find text from current search anchor: Must call SearchAnchor first. -// Accepts both SCI_SEARCHNEXT and SCI_SEARCHPREV. -// wParam contains search modes : ORed FR_MATCHCASE and FR_WHOLEWORD. -// lParam contains the text to search for. -long Editor::SearchText(unsigned int iMessage, unsigned long wParam, long lParam) { +/** + * Find text from current search anchor: Must call @c SearchAnchor first. + * Used for next text and previous text requests. + * @return The position of the found text, -1 if not found. + */ +long Editor::SearchText( + unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. + unsigned long wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP. + long lParam) { ///< The text to search for. + const char *txt = reinterpret_cast<char *>(lParam); int pos; int lengthFound = strlen(txt); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, - wParam & SCFIND_MATCHCASE, - wParam & SCFIND_WHOLEWORD, - wParam & SCFIND_WORDSTART, - wParam & SCFIND_REGEXP, - &lengthFound); + wParam & SCFIND_MATCHCASE, + wParam & SCFIND_WHOLEWORD, + wParam & SCFIND_WORDSTART, + wParam & SCFIND_REGEXP, + &lengthFound); } else { pos = pdoc->FindText(searchAnchor, 0, txt, - wParam & SCFIND_MATCHCASE, - wParam & SCFIND_WHOLEWORD, - wParam & SCFIND_WORDSTART, - wParam & SCFIND_REGEXP, - &lengthFound); + wParam & SCFIND_MATCHCASE, + wParam & SCFIND_WHOLEWORD, + wParam & SCFIND_WORDSTART, + wParam & SCFIND_REGEXP, + &lengthFound); } if (pos != -1) { @@ -3405,31 +3425,37 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return topLine; case EM_GETLINE: { - if (lParam == 0) + if (lParam == 0) { return 0; - int lineStart = pdoc->LineStart(wParam); - int lineEnd = pdoc->LineStart(wParam + 1); + } char *ptr = reinterpret_cast<char *>(lParam); short *pBufSize = reinterpret_cast<short *>(lParam); - if (*pBufSize < lineEnd - lineStart) { - ptr[0] = '\0'; // If no characters copied have to put a NUL into buffer + short bufSize = *pBufSize; + ptr[0] = '\0'; // If no characters copied have to put a NUL into buffer + if (static_cast<int>(wParam) > pdoc->LinesTotal()) { return 0; } + int lineStart = pdoc->LineStart(wParam); + int lineEnd = pdoc->LineStart(wParam + 1); + // The first word of the buffer is the size, in TCHARs, of the buffer int iPlace = 0; - for (int iChar = lineStart; iChar < lineEnd; iChar++) + for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) { ptr[iPlace++] = pdoc->CharAt(iChar); + } return iPlace; } - case SCI_GETLINE: { - if (lParam == 0) + case SCI_GETLINE: { // Simplier than EM_GETLINE, but with risk of overwritting the end of the buffer + if (lParam == 0) { return 0; + } int lineStart = pdoc->LineStart(wParam); int lineEnd = pdoc->LineStart(wParam + 1); char *ptr = reinterpret_cast<char *>(lParam); int iPlace = 0; - for (int iChar = lineStart; iChar < lineEnd; iChar++) + for (int iChar = lineStart; iChar < lineEnd; iChar++) { ptr[iPlace++] = pdoc->CharAt(iChar); + } return iPlace; } @@ -3535,7 +3561,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (wParam == 0) return 0; // Even if there is no text, there is a first line that starts at 0 if (static_cast<int>(wParam) > pdoc->LinesTotal()) - return - 1; + return -1; //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... // return -1; return pdoc->LineStart(wParam); @@ -3578,15 +3604,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETTARGETSTART: targetStart = wParam; break; - + case SCI_SETTARGETEND: targetEnd = wParam; break; - - case SCI_REPLACETARGET: + + case SCI_REPLACETARGET: PLATFORM_ASSERT(lParam); return ReplaceTarget(wParam, reinterpret_cast<char *>(lParam)); - + case EM_LINESCROLL: case SCI_LINESCROLL: ScrollTo(topLine + lParam); @@ -3912,15 +3938,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_GETCURLINE: { - if (lParam == 0) + if (lParam == 0) { return 0; + } int lineCurrentPos = pdoc->LineFromPosition(currentPos); int lineStart = pdoc->LineStart(lineCurrentPos); unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); char *ptr = reinterpret_cast<char *>(lParam); unsigned int iPlace = 0; - for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam; iChar++) + for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { ptr[iPlace++] = pdoc->CharAt(iChar); + } ptr[iPlace] = '\0'; return currentPos - lineStart; } @@ -3943,7 +3971,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { pdoc->SetStyleFor(wParam, static_cast<char>(lParam)); break; - case SCI_SETSTYLINGEX: // Specify a complete styling buffer + case SCI_SETSTYLINGEX: // Specify a complete styling buffer if (lParam == 0) return 0; pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam)); @@ -4243,7 +4271,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { vs.caretLineBackground.desired = wParam; InvalidateStyleRedraw(); break; - + // Folding messages case SCI_VISIBLEFROMDOCLINE: @@ -4322,7 +4350,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { visiblePolicy = wParam; visibleSlop = lParam; break; - + case SCI_LINESONSCREEN: return LinesOnScreen(); diff --git a/src/PropSet.cxx b/src/PropSet.cxx index d0722f632..465f5f680 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -137,7 +137,7 @@ SString PropSet::Get(const char *key) { static bool IncludesVar(const char *value, const char *key) { const char *var = strstr(value, "$("); while (var) { - if (isprefix(var+2, key) && (var[2 + strlen(key)] == ')')) { + if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) { // Found $(key) which would lead to an infinite loop so exit return true; } @@ -150,7 +150,7 @@ static bool IncludesVar(const char *value, const char *key) { SString PropSet::GetExpanded(const char *key) { SString val = Get(key); - if (IncludesVar(val.c_str(), key)) + if (IncludesVar(val.c_str(), key)) return val; else return Expand(val.c_str()); @@ -208,8 +208,8 @@ static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) { if (lensuffix > lentarget) return false; for (int i = lensuffix - 1; i >= 0; i--) { - if (MakeUpperCase(target[i + lentarget - lensuffix]) != - MakeUpperCase(suffix[i])) + if (MakeUpperCase(target[i + lentarget - lensuffix]) != + MakeUpperCase(suffix[i])) return false; } return true; @@ -274,7 +274,7 @@ SString PropSet::GetWild(const char *keybase, const char *filename) { } } -// GetNewExpand does not use Expand as it has to use GetWild with the filename for each +// GetNewExpand does not use Expand as it has to use GetWild with the filename for each // variable reference found. SString PropSet::GetNewExpand(const char *keybase, const char *filename) { char *base = StringDup(GetWild(keybase, filename).c_str()); @@ -318,9 +318,11 @@ void PropSet::Clear() { } } -// Called to initiate enumeration +/** + * Initiate enumeration. + */ bool PropSet::GetFirst(char **key, char **val) { - for (int i=0; i<hashRoots; i++) { + for (int i = 0; i < hashRoots; i++) { for (Property *p = props[i]; p; p = p->next) { if (p) { *key = p->key; @@ -334,17 +336,19 @@ bool PropSet::GetFirst(char **key, char **val) { return false; } -// Called to continue enumeration -bool PropSet::GetNext(char ** key,char ** val) { +/** + * Continue enumeration. + */ +bool PropSet::GetNext(char ** key, char ** val) { bool firstloop = true; // search begins where we left it : in enumhash block - for (int i=enumhash; i<hashRoots; i++) { - if (!firstloop) - enumnext=props[i]; // Begin with first property in block + for (int i = enumhash; i < hashRoots; i++) { + if (!firstloop) + enumnext = props[i]; // Begin with first property in block // else : begin where we left - firstloop=false; - + firstloop = false; + for (Property *p = enumnext; p; p = p->next) { if (p) { *key = p->key; @@ -366,8 +370,10 @@ static bool iswordsep(char ch, bool onlyLineEnds) { return ch == '\r' || ch == '\n'; } -// Creates an array that points into each word in the string and puts \0 terminators -// after each word. +/** + * Creates an array that points into each word in the string and puts \0 terminators + * after each word. + */ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { char prev = '\n'; int words = 0; @@ -531,15 +537,15 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1 return NULL; } -/** - * Find the length of a 'word' which is actually an identifier in a string +/** + * Find the length of a 'word' which is actually an identifier in a string * which looks like "identifier(..." or "identifier:" or "identifier" and where - * there may be extra spaces after the identifier that should not be + * there may be extra spaces after the identifier that should not be * counted in the length. */ static unsigned int LengthWord(const char *word, char otherSeparator) { // Find a '(', or ':'. If that fails go to the end of the string. - const char *endWord = strchr(word, '('); + const char *endWord = strchr(word, '('); if (!endWord) endWord = strchr(word, ':'); if (!endWord && otherSeparator) @@ -547,7 +553,7 @@ static unsigned int LengthWord(const char *word, char otherSeparator) { if (!endWord) endWord = word + strlen(word); // Last case always succeeds so endWord != 0 - + // Drop any space characters. if (endWord > word) { endWord--; // Back from the '(', ':', or '\0' @@ -570,10 +576,10 @@ static unsigned int LengthWord(const char *word, char otherSeparator) { * NOTE: returned buffer has to be freed with delete[]. */ char *WordList::GetNearestWords( - const char *wordStart, - int searchLen /*= -1*/, - bool ignoreCase /*= false*/, - char otherSeparator /*= '\0'*/) { + const char *wordStart, + int searchLen /*= -1*/, + bool ignoreCase /*= false*/, + char otherSeparator /*= '\0'*/) { int wordlen; // length of the word part (before the '(' brace) of the api array element SString wordsNear; wordsNear.setsizegrowth(1000); @@ -616,8 +622,7 @@ char *WordList::GetNearestWords( wordsNear.append(word, wordlen, ' '); } return wordsNear.detach(); - } - else if (cond < 0) + } else if (cond < 0) end = pivot - 1; else if (cond > 0) start = pivot + 1; @@ -648,8 +653,7 @@ char *WordList::GetNearestWords( wordsNear.append(word, wordlen, ' '); } return wordsNear.detach(); - } - else if (cond < 0) + } else if (cond < 0) end = pivot - 1; else if (cond > 0) start = pivot + 1; |