aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CallTip.h5
-rw-r--r--src/CellBuffer.cxx4
-rw-r--r--src/CellBuffer.h2
-rw-r--r--src/Document.cxx4
-rw-r--r--src/Document.h2
-rw-r--r--src/DocumentAccessor.cxx2
-rw-r--r--src/DocumentAccessor.h6
-rw-r--r--src/Editor.cxx12
-rw-r--r--src/Editor.h3
-rw-r--r--src/KeyMap.cxx100
-rw-r--r--src/LexPerl.cxx10
-rw-r--r--src/LineMarker.cxx20
-rw-r--r--src/PropSet.cxx2
-rw-r--r--src/ScintillaBase.cxx2
-rw-r--r--src/ScintillaBase.h3
-rw-r--r--src/Style.cxx12
-rw-r--r--src/Style.h1
-rw-r--r--src/WindowAccessor.cxx2
18 files changed, 91 insertions, 101 deletions
diff --git a/src/CallTip.h b/src/CallTip.h
index cd5b093c8..cb5bc2903 100644
--- a/src/CallTip.h
+++ b/src/CallTip.h
@@ -6,13 +6,14 @@
#ifndef CALLTIP_H
#define CALLTIP_H
-const char callClassName[] = "CallTip";
-
class CallTip {
int startHighlight;
int endHighlight;
char *val;
Font font;
+ // Private so CallTip objects can not be copied
+ CallTip(const CallTip &) {}
+ CallTip &operator=(const CallTip &) { return *this; }
public:
Window wCallTip;
Window wDraw;
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 4d032f94f..c89c1c8dd 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -678,7 +678,7 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) {
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
char curVal = ByteAt(position*2 + 1);
if ((curVal & mask) != style) {
- SetByteAt(position*2 + 1, (curVal & ~mask) | style);
+ SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style));
return true;
} else {
return false;
@@ -691,7 +691,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas
while (lengthStyle--) {
char curVal = ByteAt(bytePos);
if ((curVal & mask) != style) {
- SetByteAt(bytePos, (curVal & ~mask) | style);
+ SetByteAt(bytePos, static_cast<char>((curVal & ~mask) | style));
changed = true;
}
bytePos += 2;
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 1d7f57b05..2fcaca3a5 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -172,7 +172,7 @@ public:
// Setting styles for positions outside the range of the buffer is safe and has no effect.
// True is returned if the style of a character changed.
- bool SetStyleAt(int position, char style, char mask=(char)0xff);
+ bool SetStyleAt(int position, char style, char mask='\377');
bool SetStyleFor(int position, int length, char style, char mask);
const char *DeleteChars(int position, int deleteLength);
diff --git a/src/Document.cxx b/src/Document.cxx
index 650c0ced2..44e55671f 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -634,11 +634,9 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
// Compute actual search ranges needed
int lengthFind = strlen(s);
- int endSearch = 0;
+ int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
- } else {
- endSearch = endPos;
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
char firstChar = s[0];
diff --git a/src/Document.h b/src/Document.h
index ae25d69f4..2e00efee5 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -74,7 +74,7 @@ private:
CellBuffer cb;
bool wordchars[256];
int stylingPos;
- int stylingMask;
+ char stylingMask;
int endStyled;
int enteredCount;
int enteredReadOnlyCount;
diff --git a/src/DocumentAccessor.cxx b/src/DocumentAccessor.cxx
index e6eb1d935..d28840c16 100644
--- a/src/DocumentAccessor.cxx
+++ b/src/DocumentAccessor.cxx
@@ -101,7 +101,7 @@ void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) {
Flush();
if (validLen + (pos - startSeg + 1) >= bufferSize) {
// Too big for buffer so send directly
- pdoc->SetStyleFor(pos - startSeg + 1, chAttr);
+ pdoc->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
} else {
if (chAttr != chWhile)
chFlags = 0;
diff --git a/src/DocumentAccessor.h b/src/DocumentAccessor.h
index 942579559..ab11544e2 100644
--- a/src/DocumentAccessor.h
+++ b/src/DocumentAccessor.h
@@ -5,6 +5,9 @@
class Document;
class DocumentAccessor : public Accessor {
+ // Private so DocumentAccessor objects can not be copied
+ DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
+ DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
protected:
Document *pdoc;
PropSet &props;
@@ -20,7 +23,8 @@ protected:
void Fill(int position);
public:
DocumentAccessor(Document *pdoc_, PropSet &props_) :
- pdoc(pdoc_), props(props_), lenDoc(-1), validLen(0), chFlags(0) {
+ Accessor(), pdoc(pdoc_), props(props_),
+ lenDoc(-1), validLen(0), chFlags(0) {
}
~DocumentAccessor();
char StyleAt(int position);
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 111142d90..9b958b7d4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -189,7 +189,7 @@ bool IsControlCharacter(char ch) {
return ch >= 0 && ch < ' ';
}
-const char *ControlCharacterString(char ch) {
+const char *ControlCharacterString(unsigned char ch) {
const char *reps[] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
@@ -488,7 +488,7 @@ void Editor::ScrollTo(int line) {
}
}
-void Editor::ScrollText(int linesToMove) {
+void Editor::ScrollText(int /* linesToMove */) {
//Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove);
Redraw();
}
@@ -1019,13 +1019,11 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
}
//Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
- Surface *surface = 0;
if (rcArea.right > vs.fixedColumnWidth) {
+ Surface *surface = surfaceWindow;
if (bufferedDraw) {
surface = &pixmapLine;
- } else {
- surface = surfaceWindow;
}
surface->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
@@ -2651,7 +2649,7 @@ int Editor::BraceMatch(int position, int /*maxReStyle*/) {
position = position + direction;
while ((position >= 0) && (position < pdoc->Length())) {
char chAtPos = pdoc->CharAt(position);
- char styAtPos = pdoc->StyleAt(position) & pdoc->stylingBitsMask;
+ char styAtPos = static_cast<char>(pdoc->StyleAt(position) & pdoc->stylingBitsMask);
if ((position > pdoc->GetEndStyled()) || (styAtPos == styBrace)) {
if (chAtPos == chBrace)
depth++;
@@ -2761,7 +2759,7 @@ void Editor::EnsureLineVisible(int line) {
}
static bool ValidMargin(WPARAM wParam) {
- return (wParam >= 0 && wParam < ViewStyle::margins);
+ return wParam < ViewStyle::margins;
}
diff --git a/src/Editor.h b/src/Editor.h
index 0c04b41cd..1dccf35c7 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -38,6 +38,9 @@ public:
};
class Editor : public DocWatcher {
+ // Private so Editor objects can not be copied
+ Editor(const Editor &) : DocWatcher() {}
+ Editor &operator=(const Editor &) { return *this; }
protected: // ScintillaBase subclass needs access to much of Editor
// On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx
index 9ab9694df..a9a4adf33 100644
--- a/src/KeyMap.cxx
+++ b/src/KeyMap.cxx
@@ -61,56 +61,56 @@ UINT KeyMap::Find(int key, int modifiers) {
}
KeyToCommand KeyMap::MapDefault[] = {
- VK_DOWN, SCI_NORM, SCI_LINEDOWN,
- VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND,
- VK_UP, SCI_NORM, SCI_LINEUP,
- VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND,
- VK_LEFT, SCI_NORM, SCI_CHARLEFT,
- VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND,
- VK_LEFT, SCI_CTRL, SCI_WORDLEFT,
- VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND,
- VK_RIGHT, SCI_NORM, SCI_CHARRIGHT,
- VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND,
- VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT,
- VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND,
- VK_HOME, SCI_NORM, SCI_VCHOME,
- VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND,
- VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART,
- VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND,
- VK_END, SCI_NORM, SCI_LINEEND,
- VK_END, SCI_SHIFT, SCI_LINEENDEXTEND,
- VK_END, SCI_CTRL, SCI_DOCUMENTEND,
- VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND,
- VK_PRIOR, SCI_NORM, SCI_PAGEUP,
- VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND,
- VK_NEXT, SCI_NORM, SCI_PAGEDOWN,
- VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND,
- VK_DELETE, SCI_NORM, WM_CLEAR,
- VK_DELETE, SCI_SHIFT, WM_CUT,
- VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT,
- VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE,
- VK_INSERT, SCI_SHIFT, WM_PASTE,
- VK_INSERT, SCI_CTRL, WM_COPY,
- VK_ESCAPE, SCI_NORM, SCI_CANCEL,
- VK_BACK, SCI_NORM, SCI_DELETEBACK,
- VK_BACK, SCI_CTRL, SCI_DELWORDLEFT,
- 'Z', SCI_CTRL, WM_UNDO,
- 'Y', SCI_CTRL, SCI_REDO,
- 'X', SCI_CTRL, WM_CUT,
- 'C', SCI_CTRL, WM_COPY,
- 'V', SCI_CTRL, WM_PASTE,
- 'A', SCI_CTRL, SCI_SELECTALL,
- VK_TAB, SCI_NORM, SCI_TAB,
- VK_TAB, SCI_SHIFT, SCI_BACKTAB,
- VK_RETURN, SCI_NORM, SCI_NEWLINE,
- VK_ADD, SCI_CTRL, SCI_ZOOMIN,
- VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT,
+ {VK_DOWN, SCI_NORM, SCI_LINEDOWN},
+ {VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
+ {VK_UP, SCI_NORM, SCI_LINEUP},
+ {VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
+ {VK_LEFT, SCI_NORM, SCI_CHARLEFT},
+ {VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
+ {VK_LEFT, SCI_CTRL, SCI_WORDLEFT},
+ {VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
+ {VK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
+ {VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
+ {VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
+ {VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
+ {VK_HOME, SCI_NORM, SCI_VCHOME},
+ {VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
+ {VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
+ {VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
+ {VK_END, SCI_NORM, SCI_LINEEND},
+ {VK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
+ {VK_END, SCI_CTRL, SCI_DOCUMENTEND},
+ {VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
+ {VK_PRIOR, SCI_NORM, SCI_PAGEUP},
+ {VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
+ {VK_NEXT, SCI_NORM, SCI_PAGEDOWN},
+ {VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND},
+ {VK_DELETE, SCI_NORM, WM_CLEAR},
+ {VK_DELETE, SCI_SHIFT, WM_CUT},
+ {VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
+ {VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE},
+ {VK_INSERT, SCI_SHIFT, WM_PASTE},
+ {VK_INSERT, SCI_CTRL, WM_COPY},
+ {VK_ESCAPE, SCI_NORM, SCI_CANCEL},
+ {VK_BACK, SCI_NORM, SCI_DELETEBACK},
+ {VK_BACK, SCI_CTRL, SCI_DELWORDLEFT},
+ {'Z', SCI_CTRL, WM_UNDO},
+ {'Y', SCI_CTRL, SCI_REDO},
+ {'X', SCI_CTRL, WM_CUT},
+ {'C', SCI_CTRL, WM_COPY},
+ {'V', SCI_CTRL, WM_PASTE},
+ {'A', SCI_CTRL, SCI_SELECTALL},
+ {VK_TAB, SCI_NORM, SCI_TAB},
+ {VK_TAB, SCI_SHIFT, SCI_BACKTAB},
+ {VK_RETURN, SCI_NORM, SCI_NEWLINE},
+ {VK_ADD, SCI_CTRL, SCI_ZOOMIN},
+ {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
//'L', SCI_CTRL, SCI_FORMFEED,
- 'L', SCI_CTRL, SCI_LINECUT,
- 'L', SCI_CSHIFT, SCI_LINEDELETE,
- 'T', SCI_CTRL, SCI_LINETRANSPOSE,
- 'U', SCI_CTRL, SCI_LOWERCASE,
- 'U', SCI_CSHIFT, SCI_UPPERCASE,
- 0,0,0,
+ {'L', SCI_CTRL, SCI_LINECUT},
+ {'L', SCI_CSHIFT, SCI_LINEDELETE},
+ {'T', SCI_CTRL, SCI_LINETRANSPOSE},
+ {'U', SCI_CTRL, SCI_LOWERCASE},
+ {'U', SCI_CSHIFT, SCI_UPPERCASE},
+ {0,0,0},
};
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx
index 155a0c1a2..c57934866 100644
--- a/src/LexPerl.cxx
+++ b/src/LexPerl.cxx
@@ -67,16 +67,6 @@ static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
return true;
}
-static bool isOKQuote(char ch) {
- if (isalnum(ch))
- return false;
- if (isspace(ch))
- return false;
- if (iscntrl(ch))
- return false;
- return true;
-}
-
static char opposite(char ch) {
if (ch == '(')
return ')';
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 9afccb822..f54978c3f 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -51,20 +51,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
} else if (markType == SC_MARK_PLUS) {
int armSize = dimOn2-2;
- Point xpts[] = {
- Point(centreX - armSize, centreY),
- Point(centreX, centreY),
- Point(centreX, centreY - armSize),
- Point(centreX, centreY - armSize),
- Point(centreX, centreY),
- Point(centreX + armSize, centreY),
- Point(centreX + armSize, centreY),
- Point(centreX, centreY),
- Point(centreX, centreY + armSize),
- Point(centreX, centreY + armSize),
- Point(centreX, centreY),
- Point(centreX - armSize, centreY),
- };
Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX - 1, centreY - 1),
@@ -90,12 +76,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
Point(centreX + armSize, centreY +1),
Point(centreX - armSize, centreY + 1),
};
- Point xpts[] = {
- Point(centreX - armSize, centreY),
- Point(centreX + armSize, centreY),
- Point(centreX + armSize, centreY),
- Point(centreX - armSize, centreY),
- };
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
diff --git a/src/PropSet.cxx b/src/PropSet.cxx
index 101b7f563..6d90aed34 100644
--- a/src/PropSet.cxx
+++ b/src/PropSet.cxx
@@ -376,7 +376,7 @@ bool WordList::InList(const char *s) {
for (int i = 0; words[i][0]; i++)
len++;
SortWordList(words, len);
- for (int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
+ for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index ce8883bc3..6683c0146 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -387,7 +387,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
break;
case SCI_SETKEYWORDS:
- if ((wParam >= 0) && (wParam < numWordLists)) {
+ if (wParam < numWordLists) {
keyWordLists[wParam]->Clear();
keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
}
diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h
index ec1b0665b..ec64ab5dd 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -7,6 +7,9 @@
#define SCINTILLABASE_H
class ScintillaBase : public Editor {
+ // Private so ScintillaBase objects can not be copied
+ ScintillaBase(const ScintillaBase &) : Editor() {}
+ ScintillaBase &operator=(const ScintillaBase &) { return *this; }
protected:
// Enumeration of commands and child windows
enum {
diff --git a/src/Style.cxx b/src/Style.cxx
index 483023321..47ca196f3 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -16,6 +16,18 @@ Style::Style() {
false, false, false);
}
+Style::Style(const Style &source) {
+ Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
+ 0, 0,
+ false, false, false);
+ fore.desired = source.fore.desired;
+ back.desired = source.back.desired;
+ bold = source.bold;
+ italic = source.italic;
+ size = source.size;
+ eolFilled = source.eolFilled;
+}
+
Style::~Style() {
if (aliasOfDefaultFont)
font.SetID(0);
diff --git a/src/Style.h b/src/Style.h
index a610ff8ba..95e006135 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -26,6 +26,7 @@ public:
unsigned int spaceWidth;
Style();
+ Style(const Style &source);
~Style();
Style &operator=(const Style &source);
void Clear(Colour fore_, Colour back_,
diff --git a/src/WindowAccessor.cxx b/src/WindowAccessor.cxx
index e1e8ed876..059c877bd 100644
--- a/src/WindowAccessor.cxx
+++ b/src/WindowAccessor.cxx
@@ -105,7 +105,7 @@ void WindowAccessor::ColourTo(unsigned int pos, int chAttr) {
chFlags = 0;
chAttr |= chFlags;
for (unsigned int i = startSeg; i <= pos; i++) {
- styleBuf[validLen++] = chAttr;
+ styleBuf[validLen++] = static_cast<char>(chAttr);
}
}
}