diff options
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/PlatWin.cxx | 68 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 26 | 
2 files changed, 42 insertions, 52 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 222eac26b..59ac5d820 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -75,8 +75,8 @@ ID2D1Factory *pD2DFactory = nullptr;  IDWriteRenderingParams *defaultRenderingParams = nullptr;  IDWriteRenderingParams *customClearTypeRenderingParams = nullptr; -static HMODULE hDLLD2D = NULL; -static HMODULE hDLLDWrite = NULL; +static HMODULE hDLLD2D {}; +static HMODULE hDLLDWrite {};  bool LoadD2D() {  	static bool triedLoadingD2D = false; @@ -156,7 +156,7 @@ struct FormatAndMetrics {  	FormatAndMetrics(HFONT hfont_, int extraFontFlag_, int characterSet_) :  		technology(SCWIN_TECH_GDI), hfont(hfont_),  #if defined(USE_D2D) -		pTextFormat(0), +		pTextFormat(nullptr),  #endif  		extraFontFlag(extraFontFlag_), characterSet(characterSet_), yAscent(2), yDescent(1), yInternalLeading(0) {  	} @@ -168,7 +168,7 @@ struct FormatAndMetrics {  	        FLOAT yDescent_,  	        FLOAT yInternalLeading_) :  		technology(SCWIN_TECH_DIRECTWRITE), -		hfont(0), +		hfont{},  		pTextFormat(pTextFormat_),  		extraFontFlag(extraFontFlag_),  		characterSet(characterSet_), @@ -238,9 +238,9 @@ void SetWindowPointer(HWND hWnd, void *ptr) {  }  CRITICAL_SECTION crPlatformLock; -HINSTANCE hinstPlatformRes = 0; +HINSTANCE hinstPlatformRes {}; -HCURSOR reverseArrowCursor = NULL; +HCURSOR reverseArrowCursor {};  FormatAndMetrics *FamFromFontID(void *fid) {  	return static_cast<FormatAndMetrics *>(fid); @@ -332,7 +332,7 @@ public:  FontCached *FontCached::first = nullptr;  FontCached::FontCached(const FontParameters &fp) : -	next(0), usage(0), size(1.0), hash(0) { +	next(nullptr), usage(0), size(1.0), hash(0) {  	SetLogFont(lf, fp.faceName, fp.characterSet, fp.size, fp.weight, fp.italic, fp.extraFontFlag);  	technology = fp.technology;  	hash = HashFont(fp); @@ -407,7 +407,7 @@ void FontCached::Release() {  }  FontID FontCached::FindOrCreate(const FontParameters &fp) { -	FontID ret = 0; +	FontID ret {};  	::EnterCriticalSection(&crPlatformLock);  	const int hashFind = HashFont(fp);  	for (FontCached *cur=first; cur; cur=cur->next) { @@ -446,7 +446,7 @@ void FontCached::ReleaseId(FontID fid_) {  	::LeaveCriticalSection(&crPlatformLock);  } -Font::Font() noexcept : fid(0) { +Font::Font() noexcept : fid{} {  }  Font::~Font() { @@ -513,21 +513,22 @@ public:  typedef VarBuffer<XYPOSITION, stackBufferLength> TextPositions;  class SurfaceGDI : public Surface { -	bool unicodeMode; -	HDC hdc; -	bool hdcOwned; -	HPEN pen; -	HPEN penOld; -	HBRUSH brush; -	HBRUSH brushOld; -	HFONT font; -	HFONT fontOld; -	HBITMAP bitmap; -	HBITMAP bitmapOld; -	int maxWidthMeasure; -	int maxLenText; +	bool unicodeMode=false; +	HDC hdc{}; +	bool hdcOwned=false; +	HPEN pen{}; +	HPEN penOld{}; +	HBRUSH brush{}; +	HBRUSH brushOld{}; +	HFONT font{}; +	HFONT fontOld{}; +	HBITMAP bitmap{}; +	HBITMAP bitmapOld{}; +	int maxWidthMeasure = INT_MAX; +	// There appears to be a 16 bit string length limit in GDI on NT. +	int maxLenText = 65535; -	int codePage; +	int codePage = 0;  	void BrushColor(ColourDesired back);  	void SetFont(Font &font_); @@ -588,18 +589,7 @@ public:  	void SetBidiR2L(bool bidiR2L_) override;  }; -SurfaceGDI::SurfaceGDI() : -	unicodeMode(false), -	hdc(0), 	hdcOwned(false), -	pen(0), 	penOld(0), -	brush(0), brushOld(0), -	font(0), 	fontOld(0), -	bitmap(0), bitmapOld(0) { -	maxWidthMeasure = INT_MAX; -	// There appears to be a 16 bit string length limit in GDI on NT. -	maxLenText = 65535; - -	codePage = 0; +SurfaceGDI::SurfaceGDI() {  }  SurfaceGDI::~SurfaceGDI() { @@ -1228,7 +1218,7 @@ void SurfaceD2D::SetScale() {  }  bool SurfaceD2D::Initialised() { -	return pRenderTarget != 0; +	return pRenderTarget != nullptr;  }  HRESULT SurfaceD2D::FlushDrawing() { @@ -1374,7 +1364,7 @@ void SurfaceD2D::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesi  	if (pRenderTarget) {  		ID2D1Factory *pFactory = nullptr;  		pRenderTarget->GetFactory(&pFactory); -		ID2D1PathGeometry *geometry=0; +		ID2D1PathGeometry *geometry=nullptr;  		HRESULT hr = pFactory->CreatePathGeometry(&geometry);  		if (SUCCEEDED(hr)) {  			ID2D1GeometrySink *sink = nullptr; @@ -2526,7 +2516,7 @@ class ListBoxX : public ListBox {  	static const Point ImageInset;	// Padding around image  public: -	ListBoxX() : lineHeight(10), fontCopy(0), technology(0), lb(0), unicodeMode(false), +	ListBoxX() : lineHeight(10), fontCopy{}, technology(0), lb{}, unicodeMode(false),  		desiredVisibleRows(9), maxItemCharacters(0), aveCharWidth(8),  		parent(nullptr), ctrlID(0),  		delegate(nullptr), @@ -3334,7 +3324,7 @@ bool ListBoxX_Unregister() {  } -Menu::Menu() noexcept : mid(0) { +Menu::Menu() noexcept : mid{} {  }  void Menu::CreatePopUp() { diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 71b6d9e5e..174b8aa15 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -429,7 +429,7 @@ private:  	int sysCaretHeight;  }; -HINSTANCE ScintillaWin::hInstance = 0; +HINSTANCE ScintillaWin::hInstance {};  ATOM ScintillaWin::scintillaClassAtom = 0;  ATOM ScintillaWin::callClassAtom = 0; @@ -474,7 +474,7 @@ ScintillaWin::ScintillaWin(HWND hwnd) {  	sysCaretHeight = 0;  #if defined(USE_D2D) -	pRenderTarget = 0; +	pRenderTarget = nullptr;  	renderTargetValid = true;  #endif @@ -604,7 +604,7 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) {  void ScintillaWin::DropRenderTarget() {  	if (pRenderTarget) {  		pRenderTarget->Release(); -		pRenderTarget = 0; +		pRenderTarget = nullptr;  	}  } @@ -2185,12 +2185,12 @@ bool ScintillaWin::CanPaste() {  namespace {  class GlobalMemory { -	HGLOBAL hand; +	HGLOBAL hand {};  public: -	void *ptr; -	GlobalMemory() : hand(0), ptr(0) { +	void *ptr {}; +	GlobalMemory() {  	} -	explicit GlobalMemory(HGLOBAL hand_) : hand(hand_), ptr(0) { +	explicit GlobalMemory(HGLOBAL hand_) : hand(hand_) {  		if (hand) {  			ptr = ::GlobalLock(hand);  		} @@ -2223,7 +2223,7 @@ public:  		::SetClipboardData(uFormat, Unlock());  	}  	operator bool() const { -		return ptr != 0; +		return ptr != nullptr;  	}  	SIZE_T Size() {  		return ::GlobalSize(hand); @@ -2470,7 +2470,7 @@ static VFunction *vtDropSource[] = {  DropSource::DropSource() {  	vtbl = vtDropSource; -	sci = 0; +	sci = nullptr;  }  /// Implement IUnkown @@ -2596,7 +2596,7 @@ static VFunction *vtDataObject[] = {  DataObject::DataObject() {  	vtbl = vtDataObject; -	sci = 0; +	sci = nullptr;  }  /// Implement IUnknown @@ -2659,7 +2659,7 @@ static VFunction *vtDropTarget[] = {  DropTarget::DropTarget() {  	vtbl = vtDropTarget; -	sci = 0; +	sci = nullptr;  }  /** @@ -3316,7 +3316,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc(  	ScintillaWin *sciThis = static_cast<ScintillaWin *>(PointerFromWindow(hWnd));  	try {  		// ctp will be zero if WM_CREATE not seen yet -		if (sciThis == 0) { +		if (sciThis == nullptr) {  			if (iMessage == WM_CREATE) {  				// Associate CallTip object with window  				CREATESTRUCT *pCreate = static_cast<CREATESTRUCT *>(PtrFromSPtr(lParam)); @@ -3430,7 +3430,7 @@ LRESULT PASCAL ScintillaWin::SWndProc(  	// Find C++ object associated with window.  	ScintillaWin *sci = static_cast<ScintillaWin *>(PointerFromWindow(hWnd));  	// sci will be zero if WM_CREATE not seen yet -	if (sci == 0) { +	if (sci == nullptr) {  		try {  			if (iMessage == WM_CREATE) {  				// Create C++ object associated with window  | 
