diff options
36 files changed, 209 insertions, 213 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index 86c64df56..dd52410d4 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -47,8 +47,8 @@ bool AutoComplete::Active() { return active; } -void AutoComplete::Start(Window &parent, int ctrlID, - int position, Point location, int startLen_, +void AutoComplete::Start(Window &parent, int ctrlID, + int position, Point location, int startLen_, int lineHeight, bool unicodeMode) { if (active) { Cancel(); diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 3ea2d48fd..126428213 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -95,7 +95,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, int maxEnd = 0; const int numEnds = 10; int ends[numEnds + 2]; - for (int i=0;i<len;i++) { + for (int i=0; i<len; i++) { if ((maxEnd < numEnds) && (IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) { if (i > 0) diff --git a/src/CallTip.h b/src/CallTip.h index a64755fd1..e5a657940 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -61,7 +61,7 @@ public: /// Setup the calltip and return a rectangle of the area required. PRectangle CallTipStart(int pos, Point pt, const char *defn, - const char *faceName, int size, int codePage_, + const char *faceName, int size, int codePage_, int characterSet, Window &wParent); void CallTipCancel(); diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index be0440304..ac327dfad 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -197,7 +197,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng // Insertions must be immediately after to coalesce currentAction++; } else if (at == removeAction) { - if ((lengthData == 1) || (lengthData == 2)){ + if ((lengthData == 1) || (lengthData == 2)) { if ((position + lengthData) == actPrevious->position) { ; // Backspace -> OK } else if (position == actPrevious->position) { @@ -349,7 +349,7 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { lengthRetrieve, substance.Length()); return; } - + for (int i=0; i<lengthRetrieve; i++) { *buffer++ = substance.ValueAt(position + i); } @@ -359,7 +359,7 @@ char CellBuffer::StyleAt(int position) { return style.ValueAt(position); } -const char *CellBuffer::BufferPointer() { +const char *CellBuffer::BufferPointer() { return substance.BufferPointer(); } diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 08de5cf1f..f2cc2f07b 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -232,11 +232,11 @@ void ContractionState::ShowAll() { void ContractionState::Check() const { #ifdef CHECK_CORRECTNESS - for (int vline = 0;vline < LinesDisplayed(); vline++) { + for (int vline = 0; vline < LinesDisplayed(); vline++) { const int lineDoc = DocFromDisplay(vline); PLATFORM_ASSERT(GetVisible(lineDoc)); } - for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { + for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) { const int displayThis = DisplayFromDoc(lineDoc); const int displayNext = DisplayFromDoc(lineDoc + 1); const int height = displayNext - displayThis; diff --git a/src/Document.cxx b/src/Document.cxx index a5d1adbbb..e76211395 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -140,13 +140,13 @@ void Document::SetSavePoint() { NotifySavePoint(true); } -int Document::GetMark(int line) { - return static_cast<LineMarkers*>(perLineData[ldMarkers])->MarkValue(line); +int Document::GetMark(int line) { + return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line); } int Document::AddMark(int line, int markerNum) { if (line <= LinesTotal()) { - int prev = static_cast<LineMarkers*>(perLineData[ldMarkers])-> + int prev = static_cast<LineMarkers *>(perLineData[ldMarkers])-> AddMark(line, markerNum, LinesTotal()); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); @@ -160,20 +160,20 @@ void Document::AddMarkSet(int line, int valueSet) { unsigned int m = valueSet; for (int i = 0; m; i++, m >>= 1) if (m & 1) - static_cast<LineMarkers*>(perLineData[ldMarkers])-> + static_cast<LineMarkers *>(perLineData[ldMarkers])-> AddMark(line, i, LinesTotal()); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { - static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); + static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::DeleteMarkFromHandle(int markerHandle) { - static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); + static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); @@ -181,15 +181,15 @@ void Document::DeleteMarkFromHandle(int markerHandle) { void Document::DeleteAllMarks(int markerNum) { for (int line = 0; line < LinesTotal(); line++) { - static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); + static_cast<LineMarkers *>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); } DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); } -int Document::LineFromHandle(int markerHandle) { - return static_cast<LineMarkers*>(perLineData[ldMarkers])->LineFromHandle(markerHandle); +int Document::LineFromHandle(int markerHandle) { + return static_cast<LineMarkers *>(perLineData[ldMarkers])->LineFromHandle(markerHandle); } int Document::LineStart(int line) const { @@ -226,7 +226,7 @@ int Document::VCHomePosition(int position) const { int startPosition = LineStart(line); int endLine = LineEnd(line); int startText = startPosition; - while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) startText++; if (position == startText) return startPosition; @@ -235,7 +235,7 @@ int Document::VCHomePosition(int position) const { } int Document::SetLevel(int line, int level) { - int prev = static_cast<LineLevels*>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); + int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); @@ -246,12 +246,12 @@ int Document::SetLevel(int line, int level) { return prev; } -int Document::GetLevel(int line) { - return static_cast<LineLevels*>(perLineData[ldLevels])->GetLevel(line); +int Document::GetLevel(int line) { + return static_cast<LineLevels *>(perLineData[ldLevels])->GetLevel(line); } -void Document::ClearLevels() { - static_cast<LineLevels*>(perLineData[ldLevels])->ClearLevels(); +void Document::ClearLevels() { + static_cast<LineLevels *>(perLineData[ldLevels])->ClearLevels(); } static bool IsSubordinate(int levelStart, int levelTry) { @@ -437,7 +437,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { while (posCheck < pos) { char mbstr[maxBytesInDBCSCharacter+1]; int i; - for(i=0;i<Platform::DBCSCharMaxLength();i++) { + for (i=0; i<Platform::DBCSCharMaxLength(); i++) { mbstr[i] = cb.CharAt(posCheck+i); } mbstr[i] = '\0'; @@ -739,7 +739,7 @@ int Document::GetLineIndentation(int line) { if ((line >= 0) && (line < LinesTotal())) { int lineStart = LineStart(line); int length = Length(); - for (int i = lineStart;i < length;i++) { + for (int i = lineStart; i < length; i++) { char ch = cb.CharAt(i); if (ch == ' ') indent++; @@ -782,7 +782,7 @@ int Document::GetColumn(int pos) { int column = 0; int line = LineFromPosition(pos); if ((line >= 0) && (line < LinesTotal())) { - for (int i = LineStart(line);i < pos;) { + for (int i = LineStart(line); i < pos;) { char ch = cb.CharAt(i); if (ch == '\t') { column = NextTab(column, tabInChars); @@ -1256,7 +1256,7 @@ void Document::EnsureStyledTo(int pos) { } int Document::SetLineState(int line, int state) { - int statePrevious = static_cast<LineState*>(perLineData[ldState])->SetLineState(line, state); + int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state); if (state != statePrevious) { DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); NotifyModified(mh); @@ -1264,59 +1264,59 @@ int Document::SetLineState(int line, int state) { return statePrevious; } -int Document::GetLineState(int line) { - return static_cast<LineState*>(perLineData[ldState])->GetLineState(line); +int Document::GetLineState(int line) { + return static_cast<LineState *>(perLineData[ldState])->GetLineState(line); } -int Document::GetMaxLineState() { - return static_cast<LineState*>(perLineData[ldState])->GetMaxLineState(); +int Document::GetMaxLineState() { + return static_cast<LineState *>(perLineData[ldState])->GetMaxLineState(); } StyledText Document::MarginStyledText(int line) { - LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldMargin]); - return StyledText(pla->Length(line), pla->Text(line), + LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); } void Document::MarginSetText(int line, const char *text) { - static_cast<LineAnnotation*>(perLineData[ldMargin])->SetText(line, text); + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetText(line, text); DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); NotifyModified(mh); } void Document::MarginSetStyle(int line, int style) { - static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyle(line, style); + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyle(line, style); } void Document::MarginSetStyles(int line, const unsigned char *styles) { - static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyles(line, styles); + static_cast<LineAnnotation *>(perLineData[ldMargin])->SetStyles(line, styles); } int Document::MarginLength(int line) const { - return static_cast<LineAnnotation*>(perLineData[ldMargin])->Length(line); + return static_cast<LineAnnotation *>(perLineData[ldMargin])->Length(line); } void Document::MarginClearAll() { int maxEditorLine = LinesTotal(); - for (int l=0;l<maxEditorLine;l++) + for (int l=0; l<maxEditorLine; l++) MarginSetText(l, 0); // Free remaining data - static_cast<LineAnnotation*>(perLineData[ldMargin])->ClearAll(); + static_cast<LineAnnotation *>(perLineData[ldMargin])->ClearAll(); } bool Document::AnnotationAny() const { - return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->AnySet(); + return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->AnySet(); } StyledText Document::AnnotationStyledText(int line) { - LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldAnnotation]); - return StyledText(pla->Length(line), pla->Text(line), + LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); } void Document::AnnotationSetText(int line, const char *text) { const int linesBefore = AnnotationLines(line); - static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetText(line, text); + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetText(line, text); const int linesAfter = AnnotationLines(line); DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); mh.annotationLinesAdded = linesAfter - linesBefore; @@ -1324,27 +1324,27 @@ void Document::AnnotationSetText(int line, const char *text) { } void Document::AnnotationSetStyle(int line, int style) { - static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyle(line, style); + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyle(line, style); } void Document::AnnotationSetStyles(int line, const unsigned char *styles) { - static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyles(line, styles); + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->SetStyles(line, styles); } int Document::AnnotationLength(int line) const { - return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Length(line); + return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->Length(line); } int Document::AnnotationLines(int line) const { - return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Lines(line); + return static_cast<LineAnnotation *>(perLineData[ldAnnotation])->Lines(line); } void Document::AnnotationClearAll() { int maxEditorLine = LinesTotal(); - for (int l=0;l<maxEditorLine;l++) + for (int l=0; l<maxEditorLine; l++) AnnotationSetText(l, 0); // Free remaining data - static_cast<LineAnnotation*>(perLineData[ldAnnotation])->ClearAll(); + static_cast<LineAnnotation *>(perLineData[ldAnnotation])->ClearAll(); } void Document::IncrementStyleClock() { @@ -1523,11 +1523,11 @@ bool IsLineEndChar(char c) { int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int sStart = cb.StyleAt(pos); if (delta < 0) { - while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) pos--; pos++; } else { - while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) + while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) pos++; } return pos; @@ -1600,7 +1600,7 @@ public: bool caseSensitive, bool word, bool wordStart, int flags, int *length); - virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length); + virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length); private: RESearch search; @@ -1715,7 +1715,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s return pos; } -const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, int *length) { +const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, int *length) { delete []substituted; substituted = 0; DocumentIndexer di(doc, doc->Length()); diff --git a/src/Document.h b/src/Document.h index 240d59e39..c61c56892 100644 --- a/src/Document.h +++ b/src/Document.h @@ -81,17 +81,17 @@ class Document; */ class RegexSearchBase { public: - virtual ~RegexSearchBase(){} + virtual ~RegexSearchBase() {} - virtual long FindText(Document* doc, int minPos, int maxPos, const char *s, + virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; ///@return String with the substitutions, must remain valid until the next call or destruction - virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length) = 0; + virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length) = 0; }; /// Factory function for RegexSearchBase -extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable); +extern RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable); struct StyledText { size_t length; @@ -99,7 +99,7 @@ struct StyledText { bool multipleStyles; size_t style; const unsigned char *styles; - StyledText( size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : + StyledText(size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) { } // Return number of bytes from start to before '\n' or end of text. @@ -147,11 +147,11 @@ private: int lenWatchers; // ldSize is not real data - it is for dimensions and loops - enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; + enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; PerLine *perLineData[ldSize]; bool matchesValid; - RegexSearchBase* regex; + RegexSearchBase *regex; public: int stylingBits; @@ -324,7 +324,7 @@ class UndoGroup { Document *pdoc; bool groupNeeded; public: - UndoGroup(Document *pdoc_, bool groupNeeded_=true) : + UndoGroup(Document *pdoc_, bool groupNeeded_=true) : pdoc(pdoc_), groupNeeded(groupNeeded_) { if (groupNeeded) { pdoc->BeginUndoAction(); diff --git a/src/DocumentAccessor.cxx b/src/DocumentAccessor.cxx index a25979dc2..3ea80a40b 100644 --- a/src/DocumentAccessor.cxx +++ b/src/DocumentAccessor.cxx @@ -187,7 +187,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || - (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; diff --git a/src/DocumentAccessor.h b/src/DocumentAccessor.h index 899865fc1..39a0f2521 100644 --- a/src/DocumentAccessor.h +++ b/src/DocumentAccessor.h @@ -38,9 +38,9 @@ protected: void Fill(int position); public: - DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) : + DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) : Accessor(), pdoc(pdoc_), props(props_), id(id_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0), + lenDoc(-1), validLen(0), chFlags(0), chWhile(0), startSeg(0), startPosStyling(0), mask(127) { // Initialize the mask to be big enough for any lexer. } @@ -54,8 +54,8 @@ public: void Flush(); int GetLineState(int line); int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); } char *GetProperties() { return props.ToString(); diff --git a/src/Editor.cxx b/src/Editor.cxx index d9ffb3ee0..0b54fa927 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -52,7 +52,7 @@ using namespace Scintilla; return whether this modification represents an operation that may reasonably be deferred (not done now OR [possibly] at all) */ -static bool CanDeferToLastStep(const DocModification& mh) { +static bool CanDeferToLastStep(const DocModification &mh) { if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) @@ -62,7 +62,7 @@ static bool CanDeferToLastStep(const DocModification& mh) { return false; // PRESUMABLY must do } -static bool CanEliminate(const DocModification& mh) { +static bool CanEliminate(const DocModification &mh) { return (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } @@ -71,7 +71,7 @@ static bool CanEliminate(const DocModification& mh) { return whether this modification represents the FINAL step in a [possibly lengthy] multi-step Undo/Redo sequence */ -static bool IsLastStep(const DocModification& mh) { +static bool IsLastStep(const DocModification &mh) { return (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 @@ -1501,7 +1501,7 @@ static int istrlen(const char *s) { bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) { if (st.multipleStyles) { - for (size_t iStyle=0;iStyle<st.length; iStyle++) { + for (size_t iStyle=0; iStyle<st.length; iStyle++) { if (!vs.ValidStyle(styleOffset + st.styles[iStyle])) return false; } @@ -2487,7 +2487,7 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x surface->LineTo(rcSegment.left, rcSegment.bottom); surface->MoveTo(rcSegment.right, rcSegment.top); surface->LineTo(rcSegment.right, rcSegment.bottom); - if (subLine == ll->lines){ + if (subLine == ll->lines) { surface->MoveTo(rcSegment.left, rcSegment.top); surface->LineTo(rcSegment.right, rcSegment.top); } @@ -2846,7 +2846,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } } } - if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { + if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd) { PRectangle rcUL = rcSegment; rcUL.top = rcUL.top + vsDraw.maxAscent + 1; rcUL.bottom = rcUL.top + 1; @@ -3480,7 +3480,7 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { vsPrint.showCaretLineBackground = false; // Set colours for printing according to users settings - for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { + for (size_t sty = 0; sty < vsPrint.stylesSize; sty++) { if (printColourMode == SC_PRINT_INVERTLIGHT) { vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); @@ -4020,7 +4020,7 @@ void Editor::NotifyStyleToNeeded(int endStyleNeeded) { NotifyParent(scn); } -void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { +void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { NotifyStyleToNeeded(endStyleNeeded); } @@ -4145,12 +4145,12 @@ void Editor::NotifyZoom() { } // Notifications from document -void Editor::NotifyModifyAttempt(Document*, void *) { +void Editor::NotifyModifyAttempt(Document *, void *) { //Platform::DebugPrintf("** Modify Attempt\n"); NotifyModifyAttempt(); } -void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { +void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); NotifySavePoint(atSavePoint); } @@ -4193,7 +4193,7 @@ static inline int MovePositionForDeletion(int position, int startDeletion, int l } } -void Editor::NotifyModified(Document*, DocModification mh, void *) { +void Editor::NotifyModified(Document *, DocModification mh, void *) { needUpdateUI = true; if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); @@ -5799,7 +5799,7 @@ void Editor::SetHotSpotRange(Point *pt) { } } -void Editor::GetHotSpotRange(int& hsStart_, int& hsEnd_) { +void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) { hsStart_ = hsStart; hsEnd_ = hsEnd; } @@ -6309,11 +6309,11 @@ void Editor::AddStyledText(char *buffer, int appendLength) { size_t textLength = appendLength / 2; char *text = new char[textLength]; size_t i; - for (i = 0;i < textLength;i++) { + for (i = 0; i < textLength; i++) { text[i] = buffer[i*2]; } pdoc->InsertString(CurrentPosition(), text, textLength); - for (i = 0;i < textLength;i++) { + for (i = 0; i < textLength; i++) { text[i] = buffer[i*2+1]; } pdoc->StartStyling(CurrentPosition(), static_cast<char>(0xff)); diff --git a/src/Editor.h b/src/Editor.h index 92dcfb14b..ea3718ff3 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -338,7 +338,7 @@ protected: // ScintillaBase subclass needs access to much of Editor PRectangle rcLine, LineLayout *ll, int subLine); void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, PRectangle rcLine, LineLayout *ll, int subLine); - void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, + void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour); void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart, PRectangle rcLine, LineLayout *ll, int subLine); @@ -461,7 +461,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void SetAnnotationHeights(int start, int end); void SetDocPointer(Document *document); - + void SetAnnotationVisible(int visible); void Expand(int &line, bool doExpand); @@ -472,7 +472,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool PositionIsHotspot(int position); bool PointIsHotspot(Point pt); void SetHotSpotRange(Point *pt); - void GetHotSpotRange(int& hsStart, int& hsEnd); + void GetHotSpotRange(int &hsStart, int &hsEnd); int CodePage() const; virtual bool ValidCodePage(int /* codePage */) const { return true; } diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx index 098df4dd5..a0e58185c 100644 --- a/src/ExternalLexer.cxx +++ b/src/ExternalLexer.cxx @@ -40,7 +40,7 @@ char **WordListsToStrings(WordList *val[]) { while (val[dim]) dim++; char **wls = new char * [dim + 1]; - for (int i = 0;i < dim;i++) { + for (int i = 0; i < dim; i++) { std::string words; words = ""; for (int n = 0; n < val[i]->len; n++) { @@ -114,7 +114,7 @@ void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction f // //------------------------------------------ -LexerLibrary::LexerLibrary(const char* ModuleName) { +LexerLibrary::LexerLibrary(const char *ModuleName) { // Initialise some members... first = NULL; last = NULL; @@ -195,15 +195,14 @@ void LexerLibrary::Release() { /// Return the single LexerManager instance... LexerManager *LexerManager::GetInstance() { - if(!theInstance) + if (!theInstance) theInstance = new LexerManager; return theInstance; } /// Delete any LexerManager instance... -void LexerManager::DeleteInstance() -{ - if(theInstance) { +void LexerManager::DeleteInstance() { + if (theInstance) { delete theInstance; theInstance = NULL; } @@ -219,13 +218,11 @@ LexerManager::~LexerManager() { Clear(); } -void LexerManager::Load(const char* path) -{ +void LexerManager::Load(const char *path) { LoadLexerLibrary(path); } -void LexerManager::LoadLexerLibrary(const char* module) -{ +void LexerManager::LoadLexerLibrary(const char *module) { LexerLibrary *lib = new LexerLibrary(module); if (NULL != first) { last->next = lib; @@ -236,8 +233,7 @@ void LexerManager::LoadLexerLibrary(const char* module) } } -void LexerManager::Clear() -{ +void LexerManager::Clear() { if (NULL != first) { LexerLibrary *cur = first; LexerLibrary *next; @@ -257,8 +253,7 @@ void LexerManager::Clear() // //------------------------------------------ -LMMinder::~LMMinder() -{ +LMMinder::~LMMinder() { LexerManager::DeleteInstance(); } diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h index 29f42ccf7..913098ddc 100644 --- a/src/ExternalLexer.h +++ b/src/ExternalLexer.h @@ -23,7 +23,7 @@ typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int char *words[], WindowID window, char *props); typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props); -typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); +typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); @@ -37,8 +37,8 @@ protected: int externalLanguage; char name[100]; public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ + ExternalLexerModule(int language_, LexerFunction fnLexer_, + const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_) { strncpy(name, languageName_, sizeof(name)); name[sizeof(name)-1] = '\0'; languageName = name; @@ -64,10 +64,10 @@ class LexerLibrary { LexerMinder *last; public: - LexerLibrary(const char* ModuleName); + LexerLibrary(const char *ModuleName); ~LexerLibrary(); void Release(); - + LexerLibrary *next; std::string m_sModuleName; }; @@ -76,18 +76,18 @@ public: class LexerManager { public: ~LexerManager(); - + static LexerManager *GetInstance(); static void DeleteInstance(); - - void Load(const char* path); + + void Load(const char *path); void Clear(); private: LexerManager(); static LexerManager *theInstance; - void LoadLexerLibrary(const char* module); + void LoadLexerLibrary(const char *module); LexerLibrary *first; LexerLibrary *last; }; diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx index 5e4de668d..17bda8766 100644 --- a/src/KeyWords.cxx +++ b/src/KeyWords.cxx @@ -33,7 +33,7 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa // For rapid determination of whether a character is a separator, build // a look up table. bool wordSeparator[256]; - for (int i=0;i<256; i++) { + for (int i=0; i<256; i++) { wordSeparator[i] = false; } wordSeparator['\r'] = true; @@ -92,11 +92,11 @@ void WordList::Set(const char *s) { extern "C" int cmpString(const void *a1, const void *a2) { // Can't work out the correct incantation to use modern casts here - return strcmp(*(char**)(a1), *(char**)(a2)); + return strcmp(*(char **)(a1), *(char **)(a2)); } static void SortWordList(char **words, unsigned int len) { - qsort(reinterpret_cast<void*>(words), len, sizeof(*words), + qsort(reinterpret_cast<void *>(words), len, sizeof(*words), cmpString); } @@ -216,7 +216,7 @@ LexerModule::LexerModule(int language_, LexerFunction fnLexer_, const char *languageName_, LexerFunction fnFolder_, - const char * const wordListDescriptions_[], + const char *const wordListDescriptions_[], int styleBits_) : language(language_), fnLexer(fnLexer_), diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index 9577afbda..8a9395e17 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -59,8 +59,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo WordList &keywords4 = *keywordlists[3]; // property styling.within.preprocessor - // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default) - // or only from the initial # to the end of the command word(1). + // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default) + // or only from the initial # to the end of the command word(1). bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); @@ -72,7 +72,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); // property lexer.cpp.allow.dollars - // Set to 0 to disallow the '$' character in identifiers with the cpp lexer. + // Set to 0 to disallow the '$' character in identifiers with the cpp lexer. if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { setWordStart.Add('$'); setWord.Add('$'); @@ -379,20 +379,20 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { // property fold.comment - // This option enables folding multi-line comments and explicit fold points when using the C++ lexer. - // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} - // at the end of a section that should fold. + // This option enables folding multi-line comments and explicit fold points when using the C++ lexer. + // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} + // at the end of a section that should fold. bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // property fold.preprocessor - // This option enables folding preprocessor directives when using the C++ lexer. - // Includes C#'s explicit #region and #endregion folding directives. + // This option enables folding preprocessor directives when using the C++ lexer. + // Includes C#'s explicit #region and #endregion folding directives. bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - // property fold.at.else - // This option enables C++ folding on a "} else {" line of an if statement. + // property fold.at.else + // This option enables C++ folding on a "} else {" line of an if statement. bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; @@ -483,14 +483,14 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, } } -static const char * const cppWordLists[] = { +static const char *const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Unused", "Global classes and typedefs", 0, - }; +}; static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 75458f6d5..205e0e14a 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -723,10 +723,10 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList * unsigned int linePos = 0; unsigned int startLine = startPos; - // property lexer.props.allow.initial.spaces - // For properties files, set to 0 to style all lines that start with whitespace in the default style. - // This is not suitable for SciTE .properties files which use indentation for flow control but - // can be used for RFC2822 text where indentation is used for continuation lines. + // property lexer.props.allow.initial.spaces + // For properties files, set to 0 to style all lines that start with whitespace in the default style. + // This is not suitable for SciTE .properties files which use indentation for flow control but + // can be used for RFC2822 text where indentation is used for continuation lines. bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; for (unsigned int i = startPos; i < startPos + length; i++) { @@ -961,17 +961,17 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin } else if (strstart(lineBuffer, "Warning ")) { // Borland warning message return SCE_ERR_BORLAND; - } else if (strstr(lineBuffer, "at line " ) && - (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) && + } else if (strstr(lineBuffer, "at line ") && + (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, "file ") && (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { // Lua 4 error message return SCE_ERR_LUA; - } else if (strstr(lineBuffer, " at " ) && - (strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) && + } else if (strstr(lineBuffer, " at ") && + (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, " line ") && (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && - (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) { + (strstr(lineBuffer, " at ") < (strstr(lineBuffer, " line ")))) { // perl error message return SCE_ERR_PERL; } else if ((memcmp(lineBuffer, " at ", 6) == 0) && @@ -1131,11 +1131,11 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi styler.StartSegment(startPos); unsigned int linePos = 0; - // property lexer.errorlist.value.separate - // For lines in the output pane that are matches from Find in Files or GCC-style - // diagnostics, style the path and line number separately from the rest of the - // line with style 21 used for the rest of the line. - // This allows matched text to be more easily distinguished from its location. + // property lexer.errorlist.value.separate + // For lines in the output pane that are matches from Find in Files or GCC-style + // diagnostics, style the path and line number separately from the rest of the + // line with style 21 used for the rest of the line. + // This allows matched text to be more easily distinguished from its location. bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; @@ -1252,13 +1252,13 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, styler.ColourTo(lengthDoc-1, state); } -static const char * const batchWordListDesc[] = { +static const char *const batchWordListDesc[] = { "Internal Commands", "External Commands", 0 }; -static const char * const emptyWordListDesc[] = { +static const char *const emptyWordListDesc[] = { 0 }; diff --git a/src/LexPython.cxx b/src/LexPython.cxx index 897a136e9..b8921865c 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -36,7 +36,7 @@ static bool IsPyComment(Accessor &styler, int pos, int len) { enum literalsAllowed { litNone=0, litU=1, litB=2}; static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) { - return + return ((allowed & litB) && (ch == 'b' || ch == 'B')) || ((allowed & litU) && (ch == 'u' || ch == 'U')); } @@ -136,13 +136,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, WordList &keywords2 = *keywordlists[1]; // property tab.timmy.whinge.level - // For Python code, checks whether indenting is consistent. - // The default, 0 turns off indentation checking, - // 1 checks whether each line is potentially inconsistent with the previous line, - // 2 checks whether any space characters occur before a tab character in the indentation, - // 3 checks whether any spaces are in the indentation, and + // For Python code, checks whether indenting is consistent. + // The default, 0 turns off indentation checking, + // 1 checks whether each line is potentially inconsistent with the previous line, + // 2 checks whether any space characters occur before a tab character in the indentation, + // 3 checks whether any spaces are in the indentation, and // 4 checks for any tab characters in the indentation. - // 1 is a good level to use. + // 1 is a good level to use. const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); // property lexer.python.literals.binary @@ -353,7 +353,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { base_n_number = true; sc.SetState(SCE_P_NUMBER); - } else if (sc.ch == '0' && + } else if (sc.ch == '0' && (sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) { if (base2or8Literals) { base_n_number = true; @@ -538,7 +538,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse } // Set fold header on non-quote/non-comment line - if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) { + if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) lev |= SC_FOLDLEVELHEADERFLAG; } @@ -558,7 +558,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse //styler.SetLevel(lineCurrent, indentCurrent); } -static const char * const pythonWordListDesc[] = { +static const char *const pythonWordListDesc[] = { "Keywords", "Highlighted identifiers", 0 diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index 0bfd47938..41efe48ca 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -31,7 +31,7 @@ void LineMarker::SetXPM(const char *textForm) { markType = SC_MARK_PIXMAP; } -void LineMarker::SetXPM(const char * const *linesForm) { +void LineMarker::SetXPM(const char *const *linesForm) { delete pxpm; pxpm = new XPM(linesForm); markType = SC_MARK_PIXMAP; @@ -154,7 +154,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcSmall.bottom = rc.bottom - 2; surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); - } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || + } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) { // An invisible marker so don't draw anything diff --git a/src/LineMarker.h b/src/LineMarker.h index 3cb4139f0..ca15cb814 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -51,7 +51,7 @@ public: } void RefreshColourPalette(Palette &pal, bool want); void SetXPM(const char *textForm); - void SetXPM(const char * const *linesForm); + void SetXPM(const char *const *linesForm); void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter); }; diff --git a/src/Partitioning.h b/src/Partitioning.h index 225e350e0..17925b926 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -8,7 +8,7 @@ #ifndef PARTITIONING_H #define PARTITIONING_H -/// A split vector of integers with a method for adding a value to all elements +/// A split vector of integers with a method for adding a value to all elements /// in a range. /// Used by the Partitioning class. diff --git a/src/PerLine.cxx b/src/PerLine.cxx index 3e02d65fa..a19c117bc 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -241,7 +241,7 @@ void LineLevels::Init() { void LineLevels::InsertLine(int line) { if (levels.Length()) { int level = SC_FOLDLEVELBASE; - if ((line > 0) && (line < levels.Length())) { + if ((line > 0) && (line < levels.Length())) { level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG; } levels.InsertValue(line, 1, level); @@ -421,7 +421,7 @@ void LineAnnotation::SetText(int line, const char *text) { delete []annotations[line]; } annotations[line] = AllocateAnnotation(strlen(text), style); - AnnotationHeader *pah = reinterpret_cast<AnnotationHeader*>(annotations[line]); + AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]); pah->style = static_cast<short>(style); pah->length = strlen(text); pah->lines = static_cast<short>(NumberLines(text)); diff --git a/src/PerLine.h b/src/PerLine.h index ab34c46fe..8f1566bd3 100644 --- a/src/PerLine.h +++ b/src/PerLine.h @@ -11,7 +11,7 @@ #ifdef SCI_NAMESPACE namespace Scintilla { #endif - + /** * This holds the marker identifier and the marker type to display. * MarkerHandleNumbers are members of lists. diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 7bb0106fa..b2c2c2ede 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -361,7 +361,8 @@ void BreakFinder::Insert(int val) { for (unsigned int j = 0; j<saeLen; j++) { if (val == selAndEdge[j]) { return; - } if (val < selAndEdge[j]) { + } + if (val < selAndEdge[j]) { for (unsigned int k = saeLen; k>j; k--) { selAndEdge[k] = selAndEdge[k-1]; } @@ -534,7 +535,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, clock = clock_; if (s_ && positions_) { positions = new short[len + (len + 1) / 2]; - for (unsigned int i=0;i<len;i++) { + for (unsigned int i=0; i<len; i++) { positions[i] = static_cast<short>(positions_[i]); } memcpy(reinterpret_cast<char *>(positions + len), s_, len); @@ -557,7 +558,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const { if ((styleNumber == styleNumber_) && (len == len_) && (memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) { - for (unsigned int i=0;i<len;i++) { + for (unsigned int i=0; i<len; i++) { positions_[i] = positions[i]; } return true; @@ -603,7 +604,7 @@ PositionCache::~PositionCache() { void PositionCache::Clear() { if (!allClear) { - for (size_t i=0;i<size;i++) { + for (size_t i=0; i<size; i++) { pces[i].Clear(); } } @@ -647,7 +648,7 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned if (clock > 60000) { // Since there are only 16 bits for the clock, wrap it round and // reset all cache entries so none get stuck with a high clock. - for (size_t i=0;i<size;i++) { + for (size_t i=0; i<size; i++) { pces[i].ResetClock(); } clock = 2; diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 9936c39d1..e67a2126f 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -96,7 +96,7 @@ const char *PropSetSimple::Get(const char *key) const { // for that, through a recursive function and a simple chain of pointers. struct VarChain { - VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} + VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} bool contains(const char *testVar) const { return (var && (0 == strcmp(var, testVar))) diff --git a/src/SVector.h b/src/SVector.h index 7b929190d..12a7d5d40 100644 --- a/src/SVector.h +++ b/src/SVector.h @@ -19,19 +19,19 @@ namespace Scintilla { */ class SVector { enum { allocSize = 4000 }; - + int *v; ///< The vector unsigned int size; ///< Number of elements allocated unsigned int len; ///< Number of elements used in vector - + /** Internally allocate more elements than the user wants * to avoid thrashing the memory allocator. */ void SizeTo(int newSize) { if (newSize < allocSize) newSize += allocSize; - else + else newSize = (newSize * 3) / 2; - int* newv = new int[newSize]; + int *newv = new int[newSize]; size = newSize; unsigned int i=0; for (; i<len; i++) { @@ -43,7 +43,7 @@ class SVector { delete []v; v = newv; } - + public: SVector() { v = 0; @@ -60,7 +60,7 @@ public: size = 0; if (other.Length() > 0) { SizeTo(other.Length()); - for (int i=0;i<other.Length();i++) + for (int i=0; i<other.Length(); i++) v[i] = other.v[i]; len = other.Length(); } @@ -74,7 +74,7 @@ public: size = 0; if (other.Length() > 0) { SizeTo(other.Length()); - for (int i=0;i<other.Length();i++) + for (int i=0; i<other.Length(); i++) v[i] = other.v[i]; len = other.Length(); } diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 8b1a0485f..714e989e7 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -56,7 +56,7 @@ ScintillaBase::ScintillaBase() { lexLanguage = SCLEX_CONTAINER; performingStyle = false; lexCurrent = 0; - for (int wl = 0;wl < numWordLists;wl++) + for (int wl = 0; wl < numWordLists; wl++) keyWordLists[wl] = new WordList; keyWordLists[numWordLists] = 0; #endif @@ -64,7 +64,7 @@ ScintillaBase::ScintillaBase() { ScintillaBase::~ScintillaBase() { #ifdef SCI_LEXER - for (int wl = 0;wl < numWordLists;wl++) + for (int wl = 0; wl < numWordLists; wl++) delete keyWordLists[wl]; #endif } @@ -202,8 +202,8 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { return Editor::KeyCommand(iMessage); } -void ScintillaBase::AutoCompleteDoubleClick(void* p) { - ScintillaBase* sci = reinterpret_cast<ScintillaBase*>(p); +void ScintillaBase::AutoCompleteDoubleClick(void *p) { + ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p); sci->AutoCompleteCompleted(); } diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index f1fdc5dfd..704ca88f8 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -76,7 +76,7 @@ protected: void AutoCompleteCharacterDeleted(); void AutoCompleteCompleted(); void AutoCompleteMoveToCurrentWord(); - static void AutoCompleteDoubleClick(void* p); + static void AutoCompleteDoubleClick(void *p); void CallTipClick(); void CallTipShow(Point pt, const char *defn); diff --git a/src/Selection.cxx b/src/Selection.cxx index 2cdbe60f2..6f3267dfa 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -127,7 +127,7 @@ bool SelectionRange::Trim(SelectionRange range) { } else if (start <= startRange) { // Trim end end = startRange; - } else { // + } else { // PLATFORM_ASSERT(end >= endRange); // Trim start start = endRange; @@ -267,7 +267,7 @@ void Selection::TrimSelection(SelectionRange range) { for (size_t i=0; i<ranges.size();) { if ((i != mainRange) && (ranges[i].Trim(range))) { // Trimmed to empty so remove - for (size_t j=i;j<ranges.size()-1;j++) { + for (size_t j=i; j<ranges.size()-1; j++) { ranges[j] = ranges[j+1]; if (j == mainRange-1) mainRange--; diff --git a/src/Selection.h b/src/Selection.h index a3bac724a..bb2926642 100644 --- a/src/Selection.h +++ b/src/Selection.h @@ -57,7 +57,7 @@ public: }; // Ordered range to make drawing simpler -struct SelectionSegment { +struct SelectionSegment { SelectionPosition start; SelectionPosition end; SelectionSegment() { @@ -148,7 +148,7 @@ public: int MainAnchor() const; SelectionRange &Rectangular(); SelectionSegment Limits() const; - // This is for when you want to move the caret in response to a + // This is for when you want to move the caret in response to a // user direction command - for rectangular selections, use the range // that covers all selected text otherwise return the main selection. SelectionSegment LimitsForRectangularElseMain() const; diff --git a/src/SplitVector.h b/src/SplitVector.h index af4e890e3..2c5c7a1d0 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -1,6 +1,6 @@ // Scintilla source code edit control /** @file SplitVector.h - ** Main data structure for holding arrays that handle insertions + ** Main data structure for holding arrays that handle insertions ** and deletions efficiently. **/ // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> @@ -97,7 +97,7 @@ public: /// Retrieve the character at a particular position. /// Retrieving positions outside the range of the buffer returns 0. - /// The assertions here are disabled since calling code can be + /// The assertions here are disabled since calling code can be /// simpler if out of range access works and returns 0. T ValueAt(int position) const { if (position < part1Length) { @@ -135,7 +135,7 @@ public: } } - T& operator[](int position) const { + T &operator[](int position) const { PLATFORM_ASSERT(position >= 0 && position < lengthBody); if (position < part1Length) { return body[position]; @@ -182,14 +182,14 @@ public: } } - /// Ensure at least length elements allocated, + /// Ensure at least length elements allocated, /// appending zero valued elements if needed. void EnsureLength(int wantedLength) { if (Length() < wantedLength) { InsertValue(Length(), wantedLength - Length(), 0); } } - + /// Insert text into the buffer from an array. void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); @@ -238,7 +238,7 @@ public: DeleteRange(0, lengthBody); } - T* BufferPointer() { + T *BufferPointer() { RoomFor(1); GapTo(lengthBody); body[lengthBody] = 0; diff --git a/src/StyleContext.h b/src/StyleContext.h index 9342ebd68..a2e058a70 100644 --- a/src/StyleContext.h +++ b/src/StyleContext.h @@ -16,7 +16,7 @@ namespace Scintilla { class StyleContext { Accessor &styler; unsigned int endPos; - StyleContext& operator=(const StyleContext&); + StyleContext &operator=(const StyleContext &); void GetNextChar(unsigned int pos) { chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1)); if (styler.IsLeadByte(static_cast<char>(chNext))) { diff --git a/src/UniConversion.cxx b/src/UniConversion.cxx index 7dbe9e23d..482a0a581 100644 --- a/src/UniConversion.cxx +++ b/src/UniConversion.cxx @@ -64,7 +64,7 @@ void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned unsigned int UTF16Length(const char *s, unsigned int len) { unsigned int ulen = 0; unsigned int charLen; - for (unsigned int i=0;i<len;) { + for (unsigned int i=0; i<len;) { unsigned char ch = static_cast<unsigned char>(s[i]); if (ch < 0x80) { charLen = 1; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 8e9c4a463..d29ee8612 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -41,7 +41,7 @@ FontNames::~FontNames() { } void FontNames::Clear() { - for (int i=0;i<max;i++) { + for (int i=0; i<max; i++) { delete []names[i]; } max = 0; @@ -50,7 +50,7 @@ void FontNames::Clear() { const char *FontNames::Save(const char *name) { if (!name) return 0; - for (int i=0;i<max;i++) { + for (int i=0; i<max; i++) { if (strcmp(names[i], name) == 0) { return names[i]; } @@ -59,7 +59,7 @@ const char *FontNames::Save(const char *name) { // Grow array int sizeNew = size * 2; char **namesNew = new char *[sizeNew]; - for (int j=0;j<max;j++) { + for (int j=0; j<max; j++) { namesNew[j] = names[j]; } delete []names; @@ -78,15 +78,15 @@ ViewStyle::ViewStyle() { ViewStyle::ViewStyle(const ViewStyle &source) { Init(source.stylesSize); - for (unsigned int sty=0;sty<source.stylesSize;sty++) { + for (unsigned int sty=0; sty<source.stylesSize; sty++) { styles[sty] = source.styles[sty]; // Can't just copy fontname as its lifetime is relative to its owning ViewStyle styles[sty].fontName = fontNames.Save(source.styles[sty].fontName); } - for (int mrk=0;mrk<=MARKER_MAX;mrk++) { + for (int mrk=0; mrk<=MARKER_MAX; mrk++) { markers[mrk] = source.markers[mrk]; } - for (int ind=0;ind<=INDIC_MAX;ind++) { + for (int ind=0; ind<=INDIC_MAX; ind++) { indicators[ind] = source.indicators[ind]; } @@ -131,7 +131,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { someStylesProtected = false; leftMarginWidth = source.leftMarginWidth; rightMarginWidth = source.rightMarginWidth; - for (int i=0;i < margins; i++) { + for (int i=0; i < margins; i++) { ms[i] = source.ms[i]; } symbolMargin = source.symbolMargin; @@ -257,14 +257,14 @@ void ViewStyle::Init(size_t stylesSize_) { void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { unsigned int i; - for (i=0;i<stylesSize;i++) { + for (i=0; i<stylesSize; i++) { pal.WantFind(styles[i].fore, want); pal.WantFind(styles[i].back, want); } - for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) { + for (i=0; i<(sizeof(indicators)/sizeof(indicators[0])); i++) { pal.WantFind(indicators[i].fore, want); } - for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) { + for (i=0; i<(sizeof(markers)/sizeof(markers[0])); i++) { markers[i].RefreshColourPalette(pal, want); } pal.WantFind(selforeground, want); diff --git a/src/WindowAccessor.cxx b/src/WindowAccessor.cxx index 9de106fb7..ac0ebbcd2 100644 --- a/src/WindowAccessor.cxx +++ b/src/WindowAccessor.cxx @@ -7,7 +7,7 @@ #include <stdlib.h> #include <string.h> -#include <ctype.h> +#include <ctype.h> #include <stdio.h> #include "Platform.h" @@ -28,7 +28,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) { if (SC_CP_UTF8 == codePage) // For lexing, all characters >= 0x80 are treated the // same so none is considered a lead byte. - return false; + return false; else return Platform::IsDBCSLeadByte(codePage, ch); } @@ -75,10 +75,10 @@ int WindowAccessor::LevelAt(int line) { return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); } -int WindowAccessor::Length() { - if (lenDoc == -1) +int WindowAccessor::Length() { + if (lenDoc == -1) lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); - return lenDoc; + return lenDoc; } int WindowAccessor::GetLineState(int line) { @@ -129,7 +129,7 @@ void WindowAccessor::Flush() { startPos = extremePosition; lenDoc = -1; if (validLen > 0) { - Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, + Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, styleBuf); validLen = 0; } @@ -138,12 +138,12 @@ void WindowAccessor::Flush() { int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent + + // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines + // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. - + int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; @@ -170,11 +170,11 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC } ch = (*this)[++pos]; } - + *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... - if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; diff --git a/src/XPM.cxx b/src/XPM.cxx index 7fc05bb9b..2a0399837 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -62,7 +62,7 @@ XPM::XPM(const char *textForm) : Init(textForm); } -XPM::XPM(const char * const *linesForm) : +XPM::XPM(const char *const *linesForm) : data(0), codes(0), colours(0), lines(0) { Init(linesForm); } @@ -88,7 +88,7 @@ void XPM::Init(const char *textForm) { } } -void XPM::Init(const char * const *linesForm) { +void XPM::Init(const char *const *linesForm) { Clear(); height = 1; width = 1; @@ -185,7 +185,7 @@ void XPM::Draw(Surface *surface, PRectangle &rc) { // Centre the pixmap int startY = rc.top + (rc.Height() - height) / 2; int startX = rc.left + (rc.Width() - width) / 2; - for (int y=0;y<height;y++) { + for (int y=0; y<height; y++) { int prevCode = 0; int xStartRun = 0; for (int x=0; x<width; x++) { @@ -30,10 +30,10 @@ class XPM { ColourPair *colourCodeTable[256]; public: XPM(const char *textForm); - XPM(const char * const *linesForm); + XPM(const char *const *linesForm); ~XPM(); void Init(const char *textForm); - void Init(const char * const *linesForm); + void Init(const char *const *linesForm); void Clear(); /// Similar to same named method in ViewStyle: void RefreshColourPalette(Palette &pal, bool want); |