From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp | 4 +- .../MirandaG15/src/LCDFramework/CLCDConnection.cpp | 6 +- .../src/LCDFramework/CLCDConnectionLogitech.cpp | 64 +++++++-------- plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp | 90 ++++++++++----------- plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp | 24 +++--- plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp | 4 +- .../src/LCDFramework/CLCDOutputManager.cpp | 32 ++++---- plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp | 8 +- .../MirandaG15/src/LCDFramework/CLCDTextLog.cpp | 10 +-- .../MirandaG15/src/LCDFramework/CLCDTextObject.cpp | 8 +- plugins/MirandaG15/src/LCDFramework/ConStream.cpp | Bin 3638 -> 3650 bytes plugins/MirandaG15/src/LCDFramework/misc.cpp | 20 ++--- 12 files changed, 135 insertions(+), 135 deletions(-) (limited to 'plugins/MirandaG15/src/LCDFramework') diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp index 5ce448769d..b9aadd3bfc 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp @@ -3,7 +3,7 @@ CLCDBitmap::CLCDBitmap() { - m_hBitmap = NULL; + m_hBitmap = nullptr; } CLCDBitmap::~CLCDBitmap() @@ -43,6 +43,6 @@ bool CLCDBitmap::Draw(CLCDGfx *pGfx) void CLCDBitmap::SetBitmap(HBITMAP hBitmap) { - ASSERT(NULL != hBitmap); + ASSERT(nullptr != hBitmap); m_hBitmap = hBitmap; } \ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp index 6b449f5db2..929f801d8e 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp @@ -133,7 +133,7 @@ int CLCDConnection::GetColorCount() //************************************************************************ PBYTE CLCDConnection::GetPixelBuffer() { - return NULL; + return nullptr; } //************************************************************************ @@ -141,7 +141,7 @@ PBYTE CLCDConnection::GetPixelBuffer() //************************************************************************ CLCDDevice* CLCDConnection::GetAttachedDevice(int) { - return NULL; + return nullptr; } //************************************************************************ @@ -173,5 +173,5 @@ void CLCDConnection::SetReconnect(bool bSet) //************************************************************************ CLCDDevice* CLCDConnection::GetConnectedDevice() { - return NULL; + return nullptr; } \ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp index 768e586c39..2ec4f18332 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp @@ -27,8 +27,8 @@ void __cdecl initializeDrawingThread(void *pParam) } void CLCDConnectionLogitech::runDrawingThread() { - m_hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - m_hDrawEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + m_hStopEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); + m_hDrawEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); DWORD dwRes = 0; @@ -70,7 +70,7 @@ void CLCDConnectionLogitech::runDrawingThread() { } // the connection instance -CLCDConnectionLogitech *CLCDConnectionLogitech::m_pInstance = NULL; +CLCDConnectionLogitech *CLCDConnectionLogitech::m_pInstance = nullptr; //************************************************************************ // returns the connection type @@ -88,9 +88,9 @@ CLCDConnectionLogitech::CLCDConnectionLogitech() m_iNumQVGADevices = 0; m_iNumBWDevices = 0; - m_pDrawingBuffer = NULL; - m_pConnectedDevice = NULL; - m_hKeyboardHook = NULL; + m_pDrawingBuffer = nullptr; + m_pConnectedDevice = nullptr; + m_hKeyboardHook = nullptr; m_bVolumeWheelHook = false; m_dwButtonState = 0; @@ -98,14 +98,14 @@ CLCDConnectionLogitech::CLCDConnectionLogitech() m_bSetAsForeground = false; m_dwForegroundCheck = 0; - m_hHIDDeviceHandle = NULL; + m_hHIDDeviceHandle = nullptr; m_hConnection = LGLCD_INVALID_CONNECTION; m_hDevice = LGLCD_INVALID_DEVICE; m_bIsForeground = false; - m_hDrawEvent = NULL; - m_hStopEvent = NULL; + m_hDrawEvent = nullptr; + m_hStopEvent = nullptr; CLCDConnectionLogitech::m_pInstance = this; @@ -121,7 +121,7 @@ CLCDConnectionLogitech::~CLCDConnectionLogitech() SetEvent(m_hStopEvent); } while (WaitForSingleObject(m_hDrawingThread, 500) == WAIT_TIMEOUT); - if (m_pDrawingBuffer != NULL) { + if (m_pDrawingBuffer != nullptr) { free(m_pDrawingBuffer); } SetVolumeWheelHook(false); @@ -152,9 +152,9 @@ bool CLCDConnectionLogitech::Initialize(tstring strAppletName, bool bAutostart, m_connectContext.onConfigure.configCallback = CLCDOutputManager::configDialogCallback; } else { - m_connectContext.onConfigure.configCallback = NULL; + m_connectContext.onConfigure.configCallback = nullptr; } - m_connectContext.onConfigure.configContext = NULL; + m_connectContext.onConfigure.configContext = nullptr; lgLcdSetDeviceFamiliesToUse(m_connectContext.connection, LGLCD_DEVICE_FAMILY_ALL, NULL); @@ -184,7 +184,7 @@ CLgLCDDevice* CLCDConnectionLogitech::GetAttachedDevice(int iIndex) { } } - return NULL; + return nullptr; } //************************************************************************ @@ -194,9 +194,9 @@ bool CLCDConnectionLogitech::Disconnect() { if (!m_bConnected) return false; - if (m_pConnectedDevice != NULL) { + if (m_pConnectedDevice != nullptr) { delete m_pConnectedDevice; - m_pConnectedDevice = NULL; + m_pConnectedDevice = nullptr; } m_bReconnect = false; @@ -246,10 +246,10 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // check if the specified device exists m_pConnectedDevice = GetAttachedDevice(iIndex); - if (m_pConnectedDevice == NULL) { + if (m_pConnectedDevice == nullptr) { iIndex = (!iIndex || iIndex == LGLCD_DEVICE_BW) ? LGLCD_DEVICE_BW : LGLCD_DEVICE_QVGA; m_pConnectedDevice = GetAttachedDevice(iIndex); - if (m_pConnectedDevice == NULL) { + if (m_pConnectedDevice == nullptr) { return false; } } @@ -279,7 +279,7 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // Create the pixel buffer m_lcdBitmap.hdr.Format = OpenContext.deviceType == LGLCD_DEVICE_QVGA ? LGLCD_BMP_FORMAT_QVGAx32 : LGLCD_BMP_FORMAT_160x43x1; - if (m_pDrawingBuffer != NULL) { + if (m_pDrawingBuffer != nullptr) { free(m_pDrawingBuffer); } @@ -323,7 +323,7 @@ bool CLCDConnectionLogitech::Shutdown() //************************************************************************ bool CLCDConnectionLogitech::HIDReadData(BYTE* data) { static OVERLAPPED olRead; - static HANDLE hReadEvent = CreateEvent(NULL, false, true, L"ReadEvent"); + static HANDLE hReadEvent = CreateEvent(nullptr, false, true, L"ReadEvent"); static BYTE privateBuffer[9]; DWORD TransBytes; @@ -613,7 +613,7 @@ int CLCDConnectionLogitech::GetColorCount() PBYTE CLCDConnectionLogitech::GetPixelBuffer() { if (!GetConnectionState() == CONNECTED) - return NULL; + return nullptr; return (PBYTE)m_pDrawingBuffer; } @@ -676,8 +676,8 @@ bool CLCDConnectionLogitech::HIDInit() LONG Result; DWORD Length = 0; - PSP_DEVICE_INTERFACE_DETAIL_DATA detailData = NULL; - HANDLE hDevInfo = NULL; + PSP_DEVICE_INTERFACE_DETAIL_DATA detailData = nullptr; + HANDLE hDevInfo = nullptr; GUID HidGuid; ULONG Required = 0; @@ -699,8 +699,8 @@ bool CLCDConnectionLogitech::HIDInit() hDevInfo = SetupDiGetClassDevs (&HidGuid, - NULL, - NULL, + nullptr, + nullptr, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); devInfoData.cbSize = sizeof(devInfoData); @@ -725,7 +725,7 @@ bool CLCDConnectionLogitech::HIDInit() Result = SetupDiEnumDeviceInterfaces (hDevInfo, - 0, + nullptr, &HidGuid, MemberIndex, &devInfoData); @@ -758,10 +758,10 @@ bool CLCDConnectionLogitech::HIDInit() Result = SetupDiGetDeviceInterfaceDetail (hDevInfo, &devInfoData, - NULL, + nullptr, 0, &Length, - NULL); + nullptr); //Allocate memory for the hDevInfo structure, using the returned Length. @@ -779,7 +779,7 @@ bool CLCDConnectionLogitech::HIDInit() detailData, Length, &Required, - NULL); + nullptr); // Open a handle to the device. // To enable retrieving information about a system mouse or keyboard, @@ -797,10 +797,10 @@ bool CLCDConnectionLogitech::HIDInit() (detailData->DevicePath, FILE_GENERIC_READ | FILE_GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, - NULL); + nullptr); /* API function: HidD_GetAttributes @@ -875,7 +875,7 @@ bool CLCDConnectionLogitech::HIDDeInit() return false; CloseHandle(m_hHIDDeviceHandle); - m_hHIDDeviceHandle = NULL; + m_hHIDDeviceHandle = nullptr; return true; } @@ -1001,7 +1001,7 @@ void CLCDConnectionLogitech::SetVolumeWheelHook(bool bEnable) m_bVolumeWheelHook = bEnable; if (bEnable) - m_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDConnectionLogitech::KeyboardHook, GetModuleHandle(NULL), 0); + m_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDConnectionLogitech::KeyboardHook, GetModuleHandle(nullptr), 0); else if (m_hKeyboardHook) UnhookWindowsHookEx(m_hKeyboardHook); } diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index f7bed6776c..8dfc6c98e3 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -23,13 +23,13 @@ CLCDGfx::CLCDGfx(void) { m_nWidth = 0; m_nHeight = 0; - m_pBitmapInfo = NULL; - m_hDC = NULL; - m_hBitmap = NULL; - m_hPrevBitmap = NULL; - m_pBitmapBits = NULL; - m_pLcdBitmapBits = NULL; - m_pSavedBitmapBits = NULL; + m_pBitmapInfo = nullptr; + m_hDC = nullptr; + m_hBitmap = nullptr; + m_hPrevBitmap = nullptr; + m_pBitmapBits = nullptr; + m_pLcdBitmapBits = nullptr; + m_pSavedBitmapBits = nullptr; m_bInitialized = false; m_bTransition = false; @@ -57,8 +57,8 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits m_nHeight = nHeight; m_nBPP = nBPP; - m_hDC = CreateCompatibleDC(NULL); - if(NULL == m_hDC) + m_hDC = CreateCompatibleDC(nullptr); + if(nullptr == m_hDC) { TRACE(L"CLCDGfx::Initialize(): failed to create compatible DC.\n"); Shutdown(); @@ -67,7 +67,7 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD); m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize]; - if(NULL == m_pBitmapInfo) + if(nullptr == m_pBitmapInfo) { TRACE(L"CLCDGfx::Initialize(): failed to allocate bitmap info.\n"); Shutdown(); @@ -97,8 +97,8 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits } } - m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0); - if(NULL == m_hBitmap) + m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, nullptr, 0); + if(nullptr == m_hBitmap) { TRACE(L"CLCDGfx::Initialize(): failed to create bitmap.\n"); Shutdown(); @@ -125,26 +125,26 @@ bool CLCDGfx::Shutdown(void) { EndTransition(); - if(NULL != m_hBitmap) + if(nullptr != m_hBitmap) { DeleteObject(m_hBitmap); - m_hBitmap = NULL; - m_pBitmapBits = NULL; + m_hBitmap = nullptr; + m_pBitmapBits = nullptr; } - ASSERT(NULL == m_hPrevBitmap); - m_hPrevBitmap = NULL; + ASSERT(nullptr == m_hPrevBitmap); + m_hPrevBitmap = nullptr; - if(NULL != m_pBitmapInfo) + if(nullptr != m_pBitmapInfo) { delete [] m_pBitmapInfo; - m_pBitmapInfo = NULL; + m_pBitmapInfo = nullptr; } - if(NULL != m_hDC) + if(nullptr != m_hDC) { DeleteDC(m_hDC); - m_hDC = NULL; + m_hDC = nullptr; } m_nWidth = 0; @@ -159,7 +159,7 @@ bool CLCDGfx::Shutdown(void) //************************************************************************ void CLCDGfx::SetClipRegion(int iX,int iY,int iWidth,int iHeight) { - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); m_rClipRegion.left = iX; m_rClipRegion.right = iX+iWidth; @@ -184,11 +184,11 @@ RECT CLCDGfx::GetClipRegion() //************************************************************************ void CLCDGfx::BeginDraw(void) { - ASSERT(NULL != m_hBitmap); - if(m_hPrevBitmap != NULL) + ASSERT(nullptr != m_hBitmap); + if(m_hPrevBitmap != nullptr) Sleep(1); - ASSERT(NULL == m_hPrevBitmap); - if(NULL == m_hPrevBitmap) + ASSERT(nullptr == m_hPrevBitmap); + if(nullptr == m_hPrevBitmap) { m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hBitmap); SetTextColor(m_hDC, RGB(255, 255, 255)); @@ -202,7 +202,7 @@ void CLCDGfx::BeginDraw(void) void CLCDGfx::ClearScreen(void) { // this means, we're inside BeginDraw()/EndDraw() - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); RECT rc = { 0, 0, m_nWidth, m_nHeight }; FillRect(m_hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH)); } @@ -219,7 +219,7 @@ COLORREF CLCDGfx::GetPixel(int nX, int nY) { //************************************************************************ void CLCDGfx::SetPixel(int nX, int nY, COLORREF color) { // this means, we're inside BeginDraw()/EndDraw() - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); ::SetPixel(m_hDC, nX, nY, color); } @@ -241,10 +241,10 @@ void CLCDGfx::SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b) void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2) { // this means, we're inside BeginDraw()/EndDraw() - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); HPEN hPrevPen = (HPEN) SelectObject(m_hDC, GetStockObject(WHITE_PEN)); - ::MoveToEx(m_hDC, nX1, nY1, NULL); + ::MoveToEx(m_hDC, nX1, nY1, nullptr); ::LineTo(m_hDC, nX2, nY2); SelectObject(m_hDC, hPrevPen); } @@ -258,7 +258,7 @@ void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2) void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight) { // this means, we're inside BeginDraw()/EndDraw() - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH)); RECT r = { nX, nY, nX + nWidth, nY + nHeight }; @@ -272,7 +272,7 @@ void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight) void CLCDGfx::DrawRect(int iX, int iY, int iWidth, int iHeight) { // this means, we're inside BeginDraw()/EndDraw() - ASSERT(NULL != m_hPrevBitmap); + ASSERT(nullptr != m_hPrevBitmap); HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH)); @@ -355,13 +355,13 @@ void CLCDGfx::DrawBitmap(int nX, int nY,int nWidth, int nHeight, HBITMAP hBitmap //************************************************************************ void CLCDGfx::EndDraw(void) { - ASSERT(NULL != m_hPrevBitmap); - if(NULL != m_hPrevBitmap) + ASSERT(nullptr != m_hPrevBitmap); + if(nullptr != m_hPrevBitmap) { GdiFlush(); m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap); ASSERT(m_hPrevBitmap == m_hBitmap); - m_hPrevBitmap = NULL; + m_hPrevBitmap = nullptr; } if(m_nBPP != 1 || !m_bTransition) @@ -486,7 +486,7 @@ void CLCDGfx::EndDraw(void) double dPixelPercent = dPercent; memset(m_pLcdBitmapBits,0x00,m_nHeight * m_nWidth); - SLCDPixel *pPixel = NULL; + SLCDPixel *pPixel = nullptr; vector::iterator iter = m_LMovingPixels.begin(); int iIndex = 0,iMoved = 0; @@ -542,7 +542,7 @@ void CLCDGfx::EndDraw(void) //************************************************************************ HDC CLCDGfx::GetHDC(void) { - ASSERT(NULL != m_hDC); + ASSERT(nullptr != m_hDC); return m_hDC; } @@ -551,7 +551,7 @@ HDC CLCDGfx::GetHDC(void) //************************************************************************ BITMAPINFO *CLCDGfx::GetBitmapInfo(void) { - ASSERT(NULL != m_pBitmapInfo); + ASSERT(nullptr != m_pBitmapInfo); return m_pBitmapInfo; } @@ -561,7 +561,7 @@ BITMAPINFO *CLCDGfx::GetBitmapInfo(void) HBITMAP CLCDGfx::GetHBITMAP(void) { - ASSERT(NULL != m_hBitmap); + ASSERT(nullptr != m_hBitmap); return m_hBitmap; } @@ -609,8 +609,8 @@ void CLCDGfx::Cache() // Initialize pixels if(m_eTransition == TRANSITION_MORPH) { - SLCDPixel *pPixel = NULL; - SLCDPixel *pSource = NULL; + SLCDPixel *pPixel = nullptr; + SLCDPixel *pSource = nullptr; int iIndex = 0; bool bBreak = false; @@ -732,7 +732,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) if(!m_bInitialized) return; - if(rect != NULL) { + if(rect != nullptr) { m_rTransitionRegion.left = rect->left; m_rTransitionRegion.right = rect->right; m_rTransitionRegion.top = rect->top; @@ -751,7 +751,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) memcpy(m_pBitmapBits,m_pLcdBitmapBits,sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP); } - if(m_pSavedBitmapBits == NULL) + if(m_pSavedBitmapBits == nullptr) m_pSavedBitmapBits = (BYTE*)malloc(sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP); memcpy(m_pSavedBitmapBits, m_pBitmapBits,sizeof(BYTE)* m_nWidth * m_nHeight * m_nBPP); @@ -763,10 +763,10 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) void CLCDGfx::EndTransition() { - if(m_pSavedBitmapBits != NULL) + if(m_pSavedBitmapBits != nullptr) free(m_pSavedBitmapBits); - m_pSavedBitmapBits = NULL; + m_pSavedBitmapBits = nullptr; if(!m_LMovingPixels.empty()) { diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp index 2a121c22c1..92723e0501 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp @@ -5,9 +5,9 @@ //************************************************************************ // CLCDInput::CLCDInput //************************************************************************ -CLCDInput::CLCDInput() : m_hKBHook(0), m_bShowSymbols(true), m_bShowMarker(false), +CLCDInput::CLCDInput() : m_hKBHook(nullptr), m_bShowSymbols(true), m_bShowMarker(false), m_lInputTime(0), m_iLinePosition(0), m_iLineCount(0), m_iBreakKeys(KEYS_RETURN), - m_lBlinkTimer(0), m_pScrollbar(NULL) + m_lBlinkTimer(0), m_pScrollbar(nullptr) { memset(&m_Marker, 0, sizeof(m_Marker)); @@ -101,7 +101,7 @@ bool CLCDInput::Draw(CLCDGfx *pGfx) int iLine = m_iLinePosition; int iEndLine = m_iLinePosition + m_iLineCount; int iLen = 0; - wchar_t *pcOffset = NULL; + wchar_t *pcOffset = nullptr; while(iLine < iEndLine && iLine < m_vLineOffsets.size()) { // Calculate the text length @@ -174,7 +174,7 @@ void CLCDInput::SetBreakKeys(int iKeys) //************************************************************************ bool CLCDInput::IsInputActive() { - return m_pInput != NULL; + return m_pInput != nullptr; } @@ -241,7 +241,7 @@ void CLCDInput::ActivateInput() CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(1); - m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(NULL), 0); + m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(nullptr), 0); if(!m_hKBHook) return; m_pInput = this; @@ -256,9 +256,9 @@ void CLCDInput::DeactivateInput() if(!m_pInput) return; UnhookWindowsHookEx(m_hKBHook); - m_hKBHook = NULL; + m_hKBHook = nullptr; - m_pInput = NULL; + m_pInput = nullptr; CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(0); @@ -267,7 +267,7 @@ void CLCDInput::DeactivateInput() //************************************************************************ // CLCDInput::KeyboardHook //************************************************************************ -CLCDInput* CLCDInput::m_pInput = NULL; +CLCDInput* CLCDInput::m_pInput = nullptr; LRESULT CALLBACK CLCDInput::KeyboardHook(int Code, WPARAM wParam, LPARAM lParam) { @@ -484,8 +484,8 @@ void CLCDInput::MoveMarker(int iDir,int iMove,bool bShift) else iLen = (int)m_strText.length() - m_vLineOffsets[m_Marker[0].iLine].iOffset; - HDC hDC = CreateCompatibleDC(NULL); - if(NULL == hDC) + HDC hDC = CreateCompatibleDC(nullptr); + if(nullptr == hDC) return; SelectObject(hDC, m_hFont); m_Marker[0].iXWidth = 1; @@ -590,8 +590,8 @@ void CLCDInput::UpdateOffsets(int iModified) if(m_vLineOffsets.size() == 0 && m_strText.empty()) return; - HDC hDC = CreateCompatibleDC(NULL); - if(NULL == hDC) + HDC hDC = CreateCompatibleDC(nullptr); + if(nullptr == hDC) return; // Reset the marker diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp index e416be2810..3a87774f97 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp @@ -130,10 +130,10 @@ void CLCDLabel::UpdateCutOffIndex() } // variables - HDC hDC = CreateCompatibleDC(NULL); + HDC hDC = CreateCompatibleDC(nullptr); SelectObject(hDC, m_hFont); - if(NULL == hDC) + if(nullptr == hDC) return; int iWidth = GetWidth(); diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp index cf8c680d12..a40b18d2a8 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp @@ -9,16 +9,16 @@ #include "CLCDOutputManager.h" #include -CLCDOutputManager *CLCDOutputManager::m_pInstance = NULL; +CLCDOutputManager *CLCDOutputManager::m_pInstance = nullptr; //************************************************************************ // Constructor //************************************************************************ -CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(0), - m_pdwButtonRepeatTimers(0), m_pdwButtonRepeatStarts(0), m_pbButtonStates(0), - m_pLcdConnection(0), m_bInitialized(false), m_dwLastUpdate(0), m_pActiveScreen(NULL) +CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(nullptr), + m_pdwButtonRepeatTimers(nullptr), m_pdwButtonRepeatStarts(nullptr), m_pbButtonStates(nullptr), + m_pLcdConnection(nullptr), m_bInitialized(false), m_dwLastUpdate(0), m_pActiveScreen(nullptr) { - ASSERT(m_pInstance == NULL); + ASSERT(m_pInstance == nullptr); m_pInstance = this; m_strAppletName = L""; @@ -29,7 +29,7 @@ CLCDOutputManager::CLCDOutputManager() : m_dwButtonRepeatDelay(300), m_pGfx(0), //************************************************************************ CLCDOutputManager::~CLCDOutputManager() { - m_pInstance = NULL; + m_pInstance = nullptr; } //************************************************************************ @@ -37,7 +37,7 @@ CLCDOutputManager::~CLCDOutputManager() //************************************************************************ CLCDOutputManager* CLCDOutputManager::GetInstance() { - ASSERT(m_pInstance != NULL); + ASSERT(m_pInstance != nullptr); return m_pInstance; } @@ -47,7 +47,7 @@ CLCDOutputManager* CLCDOutputManager::GetInstance() //************************************************************************ CLCDConnection *CLCDOutputManager::GetLCDConnection() { - ASSERT(m_pLcdConnection != NULL); + ASSERT(m_pLcdConnection != nullptr); return m_pLcdConnection; } @@ -64,7 +64,7 @@ CLCDScreen *CLCDOutputManager::GetActiveScreen() //************************************************************************ bool CLCDOutputManager::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog) { - srand ( time(NULL) ); + srand ( time(nullptr) ); InitDebug(); @@ -96,8 +96,8 @@ bool CLCDOutputManager::IsInitialized() //************************************************************************ bool CLCDOutputManager::Shutdown() { - ASSERT(NULL != m_pLcdConnection); - ASSERT(NULL != m_pGfx); + ASSERT(nullptr != m_pLcdConnection); + ASSERT(nullptr != m_pGfx); // Shutdown all screens vector::iterator iter = m_Screens.begin(); @@ -194,7 +194,7 @@ bool CLCDOutputManager::Update() ASSERT(m_bInitialized); // Update the active screen - if(m_pActiveScreen != NULL) + if(m_pActiveScreen != nullptr) { m_pActiveScreen->Update(); // Check if the active screen has expired @@ -256,7 +256,7 @@ bool CLCDOutputManager::Update() // Draw - if(m_pActiveScreen != NULL && m_pGfx->IsInitialized()) + if(m_pActiveScreen != nullptr && m_pGfx->IsInitialized()) { m_pGfx->BeginDraw(); m_pGfx->ClearScreen(); @@ -278,11 +278,11 @@ bool CLCDOutputManager::Update() //************************************************************************ bool CLCDOutputManager::DeactivateScreen() { - if(m_pActiveScreen == NULL) + if(m_pActiveScreen == nullptr) return false; CLCDScreen *pActiveScreen = m_pActiveScreen; - m_pActiveScreen = NULL; + m_pActiveScreen = nullptr; if(pActiveScreen->HasExpired()) { @@ -306,7 +306,7 @@ bool CLCDOutputManager::ActivateScreen(CLCDScreen *pScreen) return false; // If another screen is currently active, deactivate it - if(m_pActiveScreen != NULL) + if(m_pActiveScreen != nullptr) DeactivateScreen(); m_pActiveScreen = pScreen; diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp index d599220b69..9373977239 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp @@ -72,7 +72,7 @@ bool CLCDScreen::Update() { // Loop through all objects and call their update function vector::iterator iter = m_Objects.begin(); - CLCDObject *pObject = NULL; + CLCDObject *pObject = nullptr; while(iter != m_Objects.end()) { pObject = *(iter); @@ -91,7 +91,7 @@ bool CLCDScreen::Draw(CLCDGfx *pGfx) POINT ptPrevViewportOrg = { 0, 0 }; // Loop through all objects and call their draw function vector::iterator iter = m_Objects.begin(); - CLCDObject *pObject = NULL; + CLCDObject *pObject = nullptr; while(iter != m_Objects.end()) { pObject = *(iter); @@ -126,13 +126,13 @@ bool CLCDScreen::Draw(CLCDGfx *pGfx) iter++; } // set the clipping region to nothing - SelectClipRgn(pGfx->GetHDC(), NULL); + SelectClipRgn(pGfx->GetHDC(), nullptr); // restore the viewport origin SetViewportOrgEx(pGfx->GetHDC(), 0, 0, - NULL); + nullptr); return true; } diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp index bbb9b689df..7c8ec5ca69 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp @@ -12,7 +12,7 @@ CLCDTextLog::CLCDTextLog() m_iLogSize = 10; m_iPosition = 0; m_iTextLines = 0; - m_pScrollbar = NULL; + m_pScrollbar = nullptr; m_eExpandMode = EXPAND_SCROLL; m_eAutoScroll = SCROLL_MESSAGE; m_iLastScrollDirection = 0; @@ -78,7 +78,7 @@ bool CLCDTextLog::Draw(CLCDGfx *pGfx) int iSpacing = (GetHeight() - iLineCount*m_iFontHeight)/2; list::iterator iter = m_Entrys.begin(); - CLogEntry *pEntry = NULL; + CLogEntry *pEntry = nullptr; RECT rBoundary = { 0, iSpacing,GetWidth() , GetHeight()-iSpacing}; int iPosition = 0; int iLinesDrawn = 0; @@ -291,10 +291,10 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) pEntry->vLines.clear(); tstring strString = pEntry->strString; - HDC hDC = CreateCompatibleDC(NULL); + HDC hDC = CreateCompatibleDC(nullptr); SelectObject(hDC, m_hFont); - if(NULL == hDC) + if(nullptr == hDC) return; int iLen = (int)strString.size(); @@ -422,7 +422,7 @@ void CLCDTextLog::RefreshLines() m_iTextLines = 0; - CLogEntry *pEntry = NULL; + CLogEntry *pEntry = nullptr; list::iterator iter = m_Entrys.begin(); while(iter != m_Entrys.end()) { diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp index 236cefc71b..01026cf43d 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp @@ -6,7 +6,7 @@ //************************************************************************ // constructor //************************************************************************ -CLCDTextObject::CLCDTextObject() : m_bWordWrap(false), m_hFont(NULL), m_iFontHeight(0) +CLCDTextObject::CLCDTextObject() : m_bWordWrap(false), m_hFont(nullptr), m_iFontHeight(0) { // Initialize DRAWTEXTPARAMS memset(&m_dtp, 0, sizeof(DRAWTEXTPARAMS)); @@ -32,7 +32,7 @@ CLCDTextObject::~CLCDTextObject() bool CLCDTextObject::Initialize() { m_hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT); - if(NULL != m_hFont) + if(nullptr != m_hFont) { SetFontFaceName(L"Small Fonts"); SetFontPointSize(6); @@ -72,7 +72,7 @@ bool CLCDTextObject::SetFont(LOGFONT& lf) if (m_hFont) { DeleteObject(m_hFont); - m_hFont = NULL; + m_hFont = nullptr; } m_hFont = CreateFontIndirect(&lf); @@ -81,7 +81,7 @@ bool CLCDTextObject::SetFont(LOGFONT& lf) return false; // Calculate the font's height - HDC hDC = CreateCompatibleDC(NULL); + HDC hDC = CreateCompatibleDC(nullptr); SelectObject(hDC, m_hFont); TEXTMETRIC tmFontInfo; diff --git a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp index c9b7c2689c..88b2510e1f 100644 Binary files a/plugins/MirandaG15/src/LCDFramework/ConStream.cpp and b/plugins/MirandaG15/src/LCDFramework/ConStream.cpp differ diff --git a/plugins/MirandaG15/src/LCDFramework/misc.cpp b/plugins/MirandaG15/src/LCDFramework/misc.cpp index d71597c745..f3397cd7ee 100644 --- a/plugins/MirandaG15/src/LCDFramework/misc.cpp +++ b/plugins/MirandaG15/src/LCDFramework/misc.cpp @@ -36,14 +36,14 @@ BOOL IsUnicodeAscii(const wchar_t* pBuffer, int nSize) wstring toWideString( const char* pStr , int len ) { - if ( pStr == NULL ) + if ( pStr == nullptr ) return L"" ; //ASSERT_PTR( pStr ) ; ASSERT( len >= 0 || len == -1); // figure out how many wide characters we are going to get - int nChars = MultiByteToWideChar( CP_ACP , 0 , pStr , len , NULL , 0 ) ; + int nChars = MultiByteToWideChar( CP_ACP , 0 , pStr , len , nullptr , 0 ) ; if ( len == -1 ) -- nChars ; if ( nChars == 0 ) @@ -69,7 +69,7 @@ toNarrowString( const wchar_t* pStr , int len ) // figure out how many narrow characters we are going to get int nChars = WideCharToMultiByte( CP_ACP , 0 , - pStr , len , NULL , 0 , NULL , NULL ) ; + pStr , len , nullptr , 0 , nullptr , nullptr ) ; if ( len == -1 ) -- nChars ; if ( nChars == 0 ) @@ -81,7 +81,7 @@ toNarrowString( const wchar_t* pStr , int len ) buf.resize( nChars ) ; //char *test = (char*)malloc((nChars+1)*sizeof(char)); WideCharToMultiByte( CP_ACP , 0 , pStr , len , - const_cast(buf.c_str()), nChars , NULL , NULL ) ; + const_cast(buf.c_str()), nChars , nullptr , nullptr ) ; return buf ; } @@ -112,14 +112,14 @@ tstring Utf8_Decode(const char *str) int i; char *p; - WCHAR *wszTemp = NULL; + WCHAR *wszTemp = nullptr; - if (str == NULL) + if (str == nullptr) return strRes; size_t len = mir_strlen(str); - if ((wszTemp = (WCHAR *) malloc(sizeof(wchar_t) * (len + 2))) == NULL) + if ((wszTemp = (WCHAR *) malloc(sizeof(wchar_t) * (len + 2))) == nullptr) return strRes; p = (char *) str; @@ -154,11 +154,11 @@ string Utf8_Encode(const WCHAR *str) { string strRes = ""; - unsigned char *szOut = NULL; + unsigned char *szOut = nullptr; int len, i; const WCHAR *wszTemp, *w; - if (str == NULL) + if (str == nullptr) return strRes; wszTemp = str; @@ -171,7 +171,7 @@ string Utf8_Encode(const WCHAR *str) else len += 3; } - if ((szOut = (unsigned char *) malloc(len + 2)) == NULL) + if ((szOut = (unsigned char *) malloc(len + 2)) == nullptr) return strRes; i = 0; -- cgit v1.2.3