diff options
| author | Neil <nyamatongwe@gmail.com> | 2013-12-15 12:49:06 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2013-12-15 12:49:06 +1100 | 
| commit | b4c46f78da230ff3077bc2b96ac66f5ac017c7a2 (patch) | |
| tree | 3a06d1dc7b2deb5e25d5e148666f086fb0864ff4 | |
| parent | 982a9be5d39fb042e1deb86af5930cb54729f83f (diff) | |
| download | scintilla-mirror-b4c46f78da230ff3077bc2b96ac66f5ac017c7a2.tar.gz | |
Make single argument constructors explicit to avoid unexpected conversions.
| -rw-r--r-- | cocoa/QuartzTextLayout.h | 2 | ||||
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 2 | ||||
| -rw-r--r-- | gtk/PlatGTK.cxx | 4 | ||||
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 4 | ||||
| -rw-r--r-- | lexers/LexCPP.cxx | 4 | ||||
| -rw-r--r-- | lexlib/LexAccessor.h | 2 | ||||
| -rw-r--r-- | lexlib/LexerSimple.h | 2 | ||||
| -rw-r--r-- | lexlib/SparseState.h | 2 | ||||
| -rw-r--r-- | lexlib/SubStyles.h | 2 | ||||
| -rw-r--r-- | lexlib/WordList.h | 2 | ||||
| -rw-r--r-- | src/Decoration.h | 2 | ||||
| -rw-r--r-- | src/Document.cxx | 2 | ||||
| -rw-r--r-- | src/Document.h | 4 | ||||
| -rw-r--r-- | src/Editor.cxx | 6 | ||||
| -rw-r--r-- | src/ExternalLexer.h | 2 | ||||
| -rw-r--r-- | src/Partitioning.h | 4 | ||||
| -rw-r--r-- | src/PositionCache.cxx | 2 | ||||
| -rw-r--r-- | src/PositionCache.h | 4 | ||||
| -rw-r--r-- | src/RESearch.h | 2 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 2 | ||||
| -rw-r--r-- | src/Selection.cxx | 2 | ||||
| -rw-r--r-- | src/Selection.h | 4 | ||||
| -rw-r--r-- | src/XPM.h | 6 | ||||
| -rw-r--r-- | win32/PlatWin.cxx | 6 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 6 | 
25 files changed, 40 insertions, 40 deletions
diff --git a/cocoa/QuartzTextLayout.h b/cocoa/QuartzTextLayout.h index edf357682..1e2fbce50 100644 --- a/cocoa/QuartzTextLayout.h +++ b/cocoa/QuartzTextLayout.h @@ -20,7 +20,7 @@ class QuartzTextLayout  {  public:      /** Create a text layout for drawing on the specified context. */ -    QuartzTextLayout( CGContextRef context ) +    explicit QuartzTextLayout( CGContextRef context )      {  		mString = NULL;  		mLine = NULL; diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index aaaf63c16..a10a2381a 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -524,7 +524,7 @@ static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) {  class CaseFolderDBCS : public CaseFolderTable {  	CFStringEncoding encoding;  public: -	CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) { +	explicit CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) {  		StandardASCII();  	}  	virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index f3a75466e..da9171470 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -253,7 +253,7 @@ class FontCached : Font {  	int usage;  	LOGFONT lf;  	int hash; -	FontCached(const FontParameters &fp); +	explicit FontCached(const FontParameters &fp);  	~FontCached() {}  	bool SameAs(const FontParameters &fp);  	virtual void Release(); @@ -1963,7 +1963,7 @@ class DynamicLibraryImpl : public DynamicLibrary {  protected:  	GModule* m;  public: -	DynamicLibraryImpl(const char *modulePath) { +	explicit DynamicLibraryImpl(const char *modulePath) {  		m = g_module_open(modulePath, G_MODULE_BIND_LAZY);  	} diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index b0e99e7a6..f2efd84fc 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -165,7 +165,7 @@ class ScintillaGTK : public ScintillaBase {  	ScintillaGTK &operator=(const ScintillaGTK &);  public: -	ScintillaGTK(_ScintillaObject *sci_); +	explicit ScintillaGTK(_ScintillaObject *sci_);  	virtual ~ScintillaGTK();  	static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class);  private: @@ -1244,7 +1244,7 @@ const char *ScintillaGTK::CharacterSetID() const {  class CaseFolderDBCS : public CaseFolderTable {  	const char *charSet;  public: -	CaseFolderDBCS(const char *charSet_) : charSet(charSet_) { +	explicit CaseFolderDBCS(const char *charSet_) : charSet(charSet_) {  		StandardASCII();  	}  	virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 91d308217..1ec16898f 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -336,7 +336,7 @@ class LexerCPP : public ILexerWithSubStyles {  	enum { ssIdentifier, ssDocKeyword };  	SubStyles subStyles;  public: -	LexerCPP(bool caseSensitive_) : +	explicit LexerCPP(bool caseSensitive_) :  		caseSensitive(caseSensitive_),  		setWord(CharacterSet::setAlphaNum, "._", 0x80, true),  		setNegationOp(CharacterSet::setNone, "!"), @@ -485,7 +485,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {  // Functor used to truncate history  struct After {  	int line; -	After(int line_) : line(line_) {} +	explicit After(int line_) : line(line_) {}  	bool operator()(PPDefinition &p) const {  		return p.line > line;  	} diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h index 59e73cf6e..45a3a0a93 100644 --- a/lexlib/LexAccessor.h +++ b/lexlib/LexAccessor.h @@ -53,7 +53,7 @@ private:  	}  public: -	LexAccessor(IDocument *pAccess_) : +	explicit LexAccessor(IDocument *pAccess_) :  		pAccess(pAccess_), startPos(extremePosition), endPos(0),  		codePage(pAccess->CodePage()),  		encodingType(enc8bit), diff --git a/lexlib/LexerSimple.h b/lexlib/LexerSimple.h index 89631936f..e9fa9003f 100644 --- a/lexlib/LexerSimple.h +++ b/lexlib/LexerSimple.h @@ -17,7 +17,7 @@ class LexerSimple : public LexerBase {  	const LexerModule *module;  	std::string wordLists;  public: -	LexerSimple(const LexerModule *module_); +	explicit LexerSimple(const LexerModule *module_);  	const char * SCI_METHOD DescribeWordListSets();  	void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);  	void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); diff --git a/lexlib/SparseState.h b/lexlib/SparseState.h index 08ff104d3..e767d6710 100644 --- a/lexlib/SparseState.h +++ b/lexlib/SparseState.h @@ -38,7 +38,7 @@ class SparseState {  	}  public: -	SparseState(int positionFirst_=-1) { +	explicit SparseState(int positionFirst_=-1) {  		positionFirst = positionFirst_;  	}  	void Set(int position, T value) { diff --git a/lexlib/SubStyles.h b/lexlib/SubStyles.h index 961715c3c..579107819 100644 --- a/lexlib/SubStyles.h +++ b/lexlib/SubStyles.h @@ -20,7 +20,7 @@ class WordClassifier {  public: -	WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { +	explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {  	}  	void Allocate(int firstStyle_, int lenStyles_) { diff --git a/lexlib/WordList.h b/lexlib/WordList.h index 9c8285ece..382be2812 100644 --- a/lexlib/WordList.h +++ b/lexlib/WordList.h @@ -22,7 +22,7 @@ class WordList {  	bool onlyLineEnds;	///< Delimited by any white space or only line ends  	int starts[256];  public: -	WordList(bool onlyLineEnds_ = false); +	explicit WordList(bool onlyLineEnds_ = false);  	~WordList();  	operator bool() const;  	bool operator!=(const WordList &other) const; diff --git a/src/Decoration.h b/src/Decoration.h index 23d70c7ca..a0c434af8 100644 --- a/src/Decoration.h +++ b/src/Decoration.h @@ -17,7 +17,7 @@ public:  	RunStyles rs;  	int indicator; -	Decoration(int indicator_); +	explicit Decoration(int indicator_);  	~Decoration();  	bool Empty() const; diff --git a/src/Document.cxx b/src/Document.cxx index acf4d9755..1788cf74e 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2103,7 +2103,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {   */  class BuiltinRegex : public RegexSearchBase {  public: -	BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {} +	explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {}  	virtual ~BuiltinRegex() {  	} diff --git a/src/Document.h b/src/Document.h index 1e43076ca..effdd5fe5 100644 --- a/src/Document.h +++ b/src/Document.h @@ -32,7 +32,7 @@ public:  	Position start;  	Position end; -	Range(Position pos=0) : +	explicit Range(Position pos=0) :  		start(pos), end(pos) {  	}  	Range(Position start_, Position end_) : @@ -165,7 +165,7 @@ protected:  	ILexer *instance;  	bool performingStyle;	///< Prevent reentrance  public: -	LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) { +	explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {  	}  	virtual ~LexInterface() {  	} diff --git a/src/Editor.cxx b/src/Editor.cxx index 764e00dce..7e1da9e20 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4206,7 +4206,7 @@ void Editor::ClearSelection(bool retainMultipleSelections) {  				sel.Range(r).End().Position())) {  				pdoc->DeleteChars(sel.Range(r).Start().Position(),  					sel.Range(r).Length()); -				sel.Range(r) = sel.Range(r).Start(); +				sel.Range(r) = SelectionRange(sel.Range(r).Start());  			}  		}  	} @@ -4324,9 +4324,9 @@ void Editor::Clear() {  			if (!RangeContainsProtected(sel.Range(r).caret.Position(), sel.Range(r).caret.Position() + 1)) {  				if (sel.Range(r).Start().VirtualSpace()) {  					if (sel.Range(r).anchor < sel.Range(r).caret) -						sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).anchor.Position(), sel.Range(r).anchor.VirtualSpace())); +						sel.Range(r) = SelectionRange(InsertSpace(sel.Range(r).anchor.Position(), sel.Range(r).anchor.VirtualSpace()));  					else -						sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace())); +						sel.Range(r) = SelectionRange(InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace()));  				}  				if ((sel.Count() == 1) || !pdoc->IsPositionInLineEnd(sel.Range(r).caret.Position())) {  					pdoc->DelChar(sel.Range(r).caret.Position()); diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h index bf175a631..a2ec93946 100644 --- a/src/ExternalLexer.h +++ b/src/ExternalLexer.h @@ -54,7 +54,7 @@ class LexerLibrary {  	LexerMinder		*last;  public: -	LexerLibrary(const char *ModuleName); +	explicit LexerLibrary(const char *ModuleName);  	~LexerLibrary();  	void Release(); diff --git a/src/Partitioning.h b/src/Partitioning.h index 18bcbc004..688b38d7d 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -18,7 +18,7 @@ namespace Scintilla {  class SplitVectorWithRangeAdd : public SplitVector<int> {  public: -	SplitVectorWithRangeAdd(int growSize_) { +	explicit SplitVectorWithRangeAdd(int growSize_) {  		SetGrowSize(growSize_);  		ReAllocate(growSize_);  	} @@ -88,7 +88,7 @@ private:  	}  public: -	Partitioning(int growSize) { +	explicit Partitioning(int growSize) {  		Allocate(growSize);  	} diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 413796f85..db64b1160 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -359,7 +359,7 @@ void SpecialRepresentations::SetRepresentation(const char *charBytes, const char  		// New entry so increment for first byte  		startByteHasReprs[static_cast<unsigned char>(charBytes[0])]++;  	} -	mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = value; +	mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = Representation(value);  }  void SpecialRepresentations::ClearRepresentation(const char *charBytes) { diff --git a/src/PositionCache.h b/src/PositionCache.h index 6d14cf0a3..2b4223769 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -53,7 +53,7 @@ public:  	int lines;  	XYPOSITION wrapIndent; // In pixels -	LineLayout(int maxLineLength_); +	explicit LineLayout(int maxLineLength_);  	virtual ~LineLayout();  	void Resize(int maxLineLength_);  	void Free(); @@ -116,7 +116,7 @@ public:  class Representation {  public:  	std::string stringRep; -	Representation(const char *value="") : stringRep(value) { +	explicit Representation(const char *value="") : stringRep(value) {  	}  }; diff --git a/src/RESearch.h b/src/RESearch.h index 702259d52..48533a41c 100644 --- a/src/RESearch.h +++ b/src/RESearch.h @@ -31,7 +31,7 @@ public:  class RESearch {  public: -	RESearch(CharClassify *charClassTable); +	explicit RESearch(CharClassify *charClassTable);  	~RESearch();  	void GrabMatches(CharacterIndexer &ci);  	const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 1fb4d6f27..f8b989bd4 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -486,7 +486,7 @@ class LexState : public LexInterface {  public:  	int lexLanguage; -	LexState(Document *pdoc_); +	explicit LexState(Document *pdoc_);  	virtual ~LexState();  	void SetLexer(uptr_t wParam);  	void SetLexerLanguage(const char *languageName); diff --git a/src/Selection.cxx b/src/Selection.cxx index 385e2360e..0c02c198b 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -166,7 +166,7 @@ void SelectionRange::MinimizeVirtualSpace() {  }  Selection::Selection() : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) { -	AddSelection(SelectionPosition(0)); +	AddSelection(SelectionRange(SelectionPosition(0)));  }  Selection::~Selection() { diff --git a/src/Selection.h b/src/Selection.h index d7c7d79ad..956a0f99d 100644 --- a/src/Selection.h +++ b/src/Selection.h @@ -88,9 +88,9 @@ struct SelectionRange {  	SelectionRange() : caret(), anchor() {  	} -	SelectionRange(SelectionPosition single) : caret(single), anchor(single) { +	explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) {  	} -	SelectionRange(int single) : caret(single), anchor(single) { +	explicit SelectionRange(int single) : caret(single), anchor(single) {  	}  	SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) {  	} @@ -25,8 +25,8 @@ class XPM {  	ColourDesired ColourFromCode(int ch) const;  	void FillRun(Surface *surface, int code, int startX, int y, int x);  public: -	XPM(const char *textForm); -	XPM(const char *const *linesForm); +	explicit XPM(const char *textForm); +	explicit XPM(const char *const *linesForm);  	~XPM();  	void Init(const char *textForm);  	void Init(const char *const *linesForm); @@ -53,7 +53,7 @@ class RGBAImage {  	std::vector<unsigned char> pixelBytes;  public:  	RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_); -	RGBAImage(const XPM &xpm); +	explicit RGBAImage(const XPM &xpm);  	virtual ~RGBAImage();  	int GetHeight() const { return height; }  	int GetWidth() const { return width; } diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 89e3f9c97..d2bc4c05f 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -334,7 +334,7 @@ class FontCached : Font {  	LOGFONTA lf;  	int technology;  	int hash; -	FontCached(const FontParameters &fp); +	explicit FontCached(const FontParameters &fp);  	~FontCached() {}  	bool SameAs(const FontParameters &fp);  	virtual void Release(); @@ -490,7 +490,7 @@ class VarBuffer {  	VarBuffer &operator=(const VarBuffer &);  public:  	T *buffer; -	VarBuffer(size_t length) : buffer(0) { +	explicit VarBuffer(size_t length) : buffer(0) {  		if (length > lengthStandard) {  			buffer = new T[length];  		} else { @@ -3058,7 +3058,7 @@ class DynamicLibraryImpl : public DynamicLibrary {  protected:  	HMODULE h;  public: -	DynamicLibraryImpl(const char *modulePath) { +	explicit DynamicLibraryImpl(const char *modulePath) {  		h = ::LoadLibraryA(modulePath);  	} diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 465d74d85..2a6ac369d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -212,7 +212,7 @@ class ScintillaWin :  	bool renderTargetValid;  #endif -	ScintillaWin(HWND hwnd); +	explicit ScintillaWin(HWND hwnd);  	ScintillaWin(const ScintillaWin &);  	virtual ~ScintillaWin();  	ScintillaWin &operator=(const ScintillaWin &); @@ -1461,7 +1461,7 @@ class CaseFolderDBCS : public CaseFolderTable {  	std::vector<wchar_t> utf16Folded;  	UINT cp;  public: -	CaseFolderDBCS(UINT cp_) : cp(cp_) { +	explicit CaseFolderDBCS(UINT cp_) : cp(cp_) {  		StandardASCII();  	}  	virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { @@ -1634,7 +1634,7 @@ public:  	void *ptr;  	GlobalMemory() : hand(0), ptr(0) {  	} -	GlobalMemory(HGLOBAL hand_) : hand(hand_), ptr(0) { +	explicit GlobalMemory(HGLOBAL hand_) : hand(hand_), ptr(0) {  		if (hand) {  			ptr = ::GlobalLock(hand);  		}  | 
