Remove some ugly coding styles

This commit is contained in:
Don HO 2019-03-13 02:02:35 +01:00
parent e4f9778358
commit 5356f648c2
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
30 changed files with 88 additions and 87 deletions

View File

@ -126,7 +126,7 @@ protected:
class StringBuffer final
{
public:
~StringBuffer() { if(_allocLen) delete[] _str; }
~StringBuffer() { if (_allocLen) delete[] _str; }
void sizeTo(size_t size)
{

View File

@ -130,7 +130,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
WINDOWPLACEMENT posInfo;
posInfo.length = sizeof(WINDOWPLACEMENT);
posInfo.flags = 0;
if(_isPrelaunch)
if (_isPrelaunch)
posInfo.showCmd = SW_HIDE;
else
posInfo.showCmd = nppGUI._isMaximized ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL;

View File

@ -1855,7 +1855,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_ENDSESSION:
{
if(wParam == TRUE)
if (wParam == TRUE)
::DestroyWindow(hwnd);
return 0;
}

View File

@ -783,11 +783,11 @@ void Notepad_plus::command(int id)
const int index = id - IDM_VIEW_TAB1;
BufferID buf = _pDocTab->getBufferByIndex(index);
_isFolding = true;
if(buf == BUFFER_INVALID)
if (buf == BUFFER_INVALID)
{
// No buffer at chosen index, select the very last buffer instead.
const int last_index = _pDocTab->getItemCount() - 1;
if(last_index > 0)
if (last_index > 0)
switchToFile(_pDocTab->getBufferByIndex(last_index));
}
else
@ -803,7 +803,7 @@ void Notepad_plus::command(int id)
const int current_index = _pDocTab->getCurrentTabIndex();
const int last_index = _pDocTab->getItemCount() - 1;
_isFolding = true;
if(current_index < last_index)
if (current_index < last_index)
switchToFile(_pDocTab->getBufferByIndex(current_index + 1));
else
{
@ -817,7 +817,7 @@ void Notepad_plus::command(int id)
{
const int current_index = _pDocTab->getCurrentTabIndex();
_isFolding = true;
if(current_index > 0)
if (current_index > 0)
switchToFile(_pDocTab->getBufferByIndex(current_index - 1));
else
{
@ -1280,7 +1280,7 @@ void Notepad_plus::command(int id)
if (braceOpposite != -1)
{
if(id == IDM_SEARCH_GOTOMATCHINGBRACE)
if (id == IDM_SEARCH_GOTOMATCHINGBRACE)
_pEditView->execute(SCI_GOTOPOS, braceOpposite);
else
_pEditView->execute(SCI_SETSEL, min(braceAtCaret, braceOpposite), max(braceAtCaret, braceOpposite) + 1); // + 1 so we always include the ending brace in the selection.

View File

@ -908,7 +908,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
{
// warning user and save it if user want it.
activateBuffer(id, MAIN_VIEW);
if(!activateBuffer(id, SUB_VIEW))
if (!activateBuffer(id, SUB_VIEW))
switchEditViewTo(MAIN_VIEW);
int res = _nativeLangSpeaker.messageBox("NoBackupDoSaveFile",
@ -934,7 +934,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
else
{
activateBuffer(id, MAIN_VIEW);
if(!activateBuffer(id, SUB_VIEW))
if (!activateBuffer(id, SUB_VIEW))
switchEditViewTo(MAIN_VIEW);
int res = doSaveOrNot(buf->getFullPathName());
@ -1042,10 +1042,10 @@ bool Notepad_plus::fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes)
}
else if (buf->isDirty())
{
if(_activeView == MAIN_VIEW)
if (_activeView == MAIN_VIEW)
{
activateBuffer(id, MAIN_VIEW);
if(!activateBuffer(id, SUB_VIEW))
if (!activateBuffer(id, SUB_VIEW))
switchEditViewTo(MAIN_VIEW);
}
else
@ -1120,7 +1120,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
else if (buf->isDirty())
{
activateBuffer(id, MAIN_VIEW);
if(!activateBuffer(id, SUB_VIEW))
if (!activateBuffer(id, SUB_VIEW))
switchEditViewTo(MAIN_VIEW);
int res = doSaveOrNot(buf->getFullPathName());

View File

@ -736,7 +736,7 @@ winVer NppParameters::getWindowsVersion()
}
pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo");
if(pGNSI != NULL)
if (pGNSI != NULL)
pGNSI(&si);
else
GetSystemInfo(&si);
@ -5029,16 +5029,16 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
{
int leftmost = 0;
element->Attribute(TEXT("leftmostDelimiter"), &leftmost);
if(leftmost > 0 && leftmost < 256)
if (leftmost > 0 && leftmost < 256)
_nppGUI._leftmostDelimiter = static_cast<char>(leftmost);
int rightmost = 0;
element->Attribute(TEXT("rightmostDelimiter"), &rightmost);
if(rightmost > 0 && rightmost < 256)
if (rightmost > 0 && rightmost < 256)
_nppGUI._rightmostDelimiter = static_cast<char>(rightmost);
const TCHAR *delimiterSelectionOnEntireDocument = element->Attribute(TEXT("delimiterSelectionOnEntireDocument"));
if(delimiterSelectionOnEntireDocument != NULL && !lstrcmp(delimiterSelectionOnEntireDocument, TEXT("yes")))
if (delimiterSelectionOnEntireDocument != NULL && !lstrcmp(delimiterSelectionOnEntireDocument, TEXT("yes")))
_nppGUI._delimiterSelectionOnEntireDocument = true;
else
_nppGUI._delimiterSelectionOnEntireDocument = false;
@ -6301,7 +6301,7 @@ int NppParameters::langTypeToCommandID(LangType lt) const
default :
if(lt >= L_EXTERNAL && lt < L_END)
if (lt >= L_EXTERNAL && lt < L_END)
id = lt - L_EXTERNAL + IDM_LANG_EXTERNAL;
else
id = IDM_LANG_TEXT;

View File

@ -164,7 +164,7 @@ void AutoCompletion::getWordArray(vector<generic_string> & wordArray, TCHAR *beg
static generic_string addTrailingSlash(generic_string path)
{
if(path.length() >=1 && path[path.length() - 1] == '\\')
if (path.length() >=1 && path[path.length() - 1] == '\\')
return path;
else
return path + L"\\";
@ -172,7 +172,7 @@ static generic_string addTrailingSlash(generic_string path)
static generic_string removeTrailingSlash(generic_string path)
{
if(path.length() >= 1 && path[path.length() - 1] == '\\')
if (path.length() >= 1 && path[path.length() - 1] == '\\')
return path.substr(0, path.length() - 1);
else
return path;
@ -204,13 +204,13 @@ static bool getRawPath(generic_string input, generic_string &rawPath_out)
// a quotation mark.
locale loc;
size_t lastOccurrence = input.rfind(L":");
if(lastOccurrence == std::string::npos) // No match.
if (lastOccurrence == std::string::npos) // No match.
return false;
else if(lastOccurrence == 0)
else if (lastOccurrence == 0)
return false;
else if(!std::isalpha(input[lastOccurrence - 1], loc))
else if (!std::isalpha(input[lastOccurrence - 1], loc))
return false;
else if(lastOccurrence >= 2 && !isAllowedBeforeDriveLetter(input[lastOccurrence - 2]))
else if (lastOccurrence >= 2 && !isAllowedBeforeDriveLetter(input[lastOccurrence - 2]))
return false;
rawPath_out = input.substr(lastOccurrence - 1);
@ -220,15 +220,15 @@ static bool getRawPath(generic_string input, generic_string &rawPath_out)
static bool getPathsForPathCompletion(generic_string input, generic_string &rawPath_out, generic_string &pathToMatch_out)
{
generic_string rawPath;
if(! getRawPath(input, rawPath))
if (! getRawPath(input, rawPath))
{
return false;
}
else if(isFile(rawPath) || isFile(removeTrailingSlash(rawPath)))
else if (isFile(rawPath) || isFile(removeTrailingSlash(rawPath)))
{
return false;
}
else if(isDirectory(rawPath))
else if (isDirectory(rawPath))
{
rawPath_out = rawPath;
pathToMatch_out = rawPath;
@ -237,7 +237,7 @@ static bool getPathsForPathCompletion(generic_string input, generic_string &rawP
else
{
size_t last_occurrence = rawPath.rfind(L"\\");
if(last_occurrence == std::string::npos) // No match.
if (last_occurrence == std::string::npos) // No match.
return false;
else
{
@ -270,7 +270,7 @@ void AutoCompletion::showPathCompletion()
exists, this means we should list all files and directories in C:.
*/
generic_string rawPath, pathToMatch;
if(! getPathsForPathCompletion(currentLine, rawPath, pathToMatch))
if (! getPathsForPathCompletion(currentLine, rawPath, pathToMatch))
return;
// Get all files and directories in the path.
@ -281,7 +281,7 @@ void AutoCompletion::showPathCompletion()
generic_string pathToMatchPlusSlash = addTrailingSlash(pathToMatch);
generic_string searchString = pathToMatchPlusSlash + TEXT("*.*");
hFind = ::FindFirstFile(searchString.c_str(), &data);
if(hFind != INVALID_HANDLE_VALUE)
if (hFind != INVALID_HANDLE_VALUE)
{
// Maximum number of entries to show. Without this it appears to the user like N++ hangs when autocompleting
// some really large directories (c:\windows\winxsys on my system for instance).
@ -289,18 +289,18 @@ void AutoCompletion::showPathCompletion()
unsigned int counter = 0;
do
{
if(++counter > maxEntries)
if (++counter > maxEntries)
break;
if(generic_string(data.cFileName) == TEXT(".") || generic_string(data.cFileName) == TEXT(".."))
if (generic_string(data.cFileName) == TEXT(".") || generic_string(data.cFileName) == TEXT(".."))
continue;
if(! autoCompleteEntries.empty())
if (! autoCompleteEntries.empty())
autoCompleteEntries += TEXT("\n");
autoCompleteEntries += pathToMatchPlusSlash;
autoCompleteEntries += data.cFileName;
if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // If directory, add trailing slash.
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // If directory, add trailing slash.
autoCompleteEntries += TEXT("\\");
} while(::FindNextFile(hFind, &data));
@ -796,7 +796,7 @@ bool AutoCompletion::setLanguage(LangType language) {
_funcCompletionActive = true;
}
if(_funcCompletionActive) //try setting up environment
if (_funcCompletionActive) //try setting up environment
{
//setup defaults
_ignoreCase = true;

View File

@ -884,7 +884,7 @@ bool FileManager::backupCurrentBuffer()
UnicodeConvertor.fclose();
// Note that fwrite() doesn't return the number of bytes written, but rather the number of ITEMS.
if(items_written == 1) // backup file has been saved
if (items_written == 1) // backup file has been saved
{
buffer->setModifiedStatus(false);
result = true; //all done
@ -1014,9 +1014,9 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
// Error, we didn't write the entire document to disk.
// Note that fwrite() doesn't return the number of bytes written, but rather the number of ITEMS.
if(items_written != 1)
if (items_written != 1)
{
if(error_msg != NULL)
if (error_msg != NULL)
*error_msg = TEXT("Failed to save file.\nNot enough space on disk to save file?");
return false;

View File

@ -2243,7 +2243,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
if (::SendMessage(_hParent, cmdid, 0, 0))
{
if(_findAllResult == 1)
if (_findAllResult == 1)
wsprintf(_findAllResultStr, TEXT("1 hit"));
else
wsprintf(_findAllResultStr, TEXT("%s hits"), commafyInt(_findAllResult).c_str());
@ -2982,7 +2982,7 @@ void Finder::addFileNameTitle(const TCHAR * fileName)
void Finder::addFileHitCount(int count)
{
TCHAR text[20];
if(count == 1)
if (count == 1)
wsprintf(text, TEXT(" (1 hit)"));
else
wsprintf(text, TEXT(" (%i hits)"), count);
@ -2996,13 +2996,13 @@ void Finder::addSearchHitCount(int count, bool isMatchLines)
{
const TCHAR *moreInfo = isMatchLines ? TEXT(" - Line Filter Mode: only display the filtered results") :TEXT("");
TCHAR text[100];
if(count == 1 && _nbFoundFiles == 1)
if (count == 1 && _nbFoundFiles == 1)
wsprintf(text, TEXT(" (1 hit in 1 file%s)"), moreInfo);
else if(count == 1 && _nbFoundFiles != 1)
else if (count == 1 && _nbFoundFiles != 1)
wsprintf(text, TEXT(" (1 hit in %i files%s)"), _nbFoundFiles, moreInfo);
else if(count != 1 && _nbFoundFiles == 1)
else if (count != 1 && _nbFoundFiles == 1)
wsprintf(text, TEXT(" (%i hits in 1 file%s)"), count, moreInfo);
else if(count != 1 && _nbFoundFiles != 1)
else if (count != 1 && _nbFoundFiles != 1)
wsprintf(text, TEXT(" (%i hits in %i files%s)"), count, _nbFoundFiles, moreInfo);
setFinderReadOnly(false);
_scintView.insertGenericTextFrom(_lastSearchHeaderPos, text);
@ -3558,7 +3558,7 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted)
void FindIncrementDlg::addToRebar(ReBar * rebar)
{
if(_pRebar)
if (_pRebar)
return;
_pRebar = rebar;

View File

@ -268,7 +268,7 @@ bool FunctionCallTip::getCursorFunction()
bool same = false;
if (_funcName)
{
if(_ignoreCase)
if (_ignoreCase)
same = testNameNoCase(_funcName, funcToken.token, lstrlen(_funcName)) == 0;
else
same = generic_strncmp(_funcName, funcToken.token, lstrlen(_funcName)) == 0;

View File

@ -552,7 +552,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
void ScintillaEditView::setHotspotStyle(Style& styleToSet)
{
StyleMap* styleMap;
if( _hotspotStyles.find(_currentBuffer) == _hotspotStyles.end() )
if ( _hotspotStyles.find(_currentBuffer) == _hotspotStyles.end() )
{
_hotspotStyles[_currentBuffer] = new StyleMap;
}
@ -2283,9 +2283,9 @@ void ScintillaEditView::beginOrEndSelect()
void ScintillaEditView::updateBeginEndSelectPosition(const bool is_insert, const int position, const int length)
{
if(_beginSelectPosition != -1 && position < _beginSelectPosition - 1)
if (_beginSelectPosition != -1 && position < _beginSelectPosition - 1)
{
if(is_insert)
if (is_insert)
_beginSelectPosition += length;
else
_beginSelectPosition -= length;
@ -3332,7 +3332,7 @@ void ScintillaEditView::insertNewLineAboveCurrentLine()
{
generic_string newline = getEOLString();
const auto current_line = getCurrentLineNumber();
if(current_line == 0)
if (current_line == 0)
{
// Special handling if caret is at first line.
insertGenericTextFrom(0, newline.c_str());
@ -3352,7 +3352,7 @@ void ScintillaEditView::insertNewLineBelowCurrentLine()
generic_string newline = getEOLString();
const auto line_count = static_cast<size_t>(execute(SCI_GETLINECOUNT));
const auto current_line = getCurrentLineNumber();
if(current_line == line_count - 1)
if (current_line == line_count - 1)
{
// Special handling if caret is at last line.
appandGenericText(newline.c_str());

View File

@ -485,7 +485,7 @@ public:
long length = 0;
while(*c != '\0')
{
if( (*c & 0xC0) != 0x80)
if ( (*c & 0xC0) != 0x80)
++length;
++c;
}

View File

@ -600,11 +600,11 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr)
const FindResult startFound = findText(codeBeginTag.c_str(), caret, 0, 0); // This searches backwards from "caret".
const FindResult endFound= findText(codeEndTag.c_str(), caret, 0, 0); // This searches backwards from "caret".
if(startFound.success)
if (startFound.success)
{
if(! endFound.success)
if (! endFound.success)
return;
else if(endFound.success && endFound.start <= startFound.end)
else if (endFound.success && endFound.start <= startFound.end)
return;
}
}

View File

@ -522,7 +522,7 @@ TiXmlNodeA* TiXmlNodeA::Identify( const char* p )
TiXmlNodeA* returnNode = 0;
p = SkipWhiteSpace( p );
if( !p || !*p || *p != '<' )
if ( !p || !*p || *p != '<' )
{
return 0;
}

View File

@ -504,7 +504,7 @@ TiXmlNode* TiXmlNode::Identify( const TCHAR* p )
TiXmlNode* returnNode = 0;
p = SkipWhiteSpace( p );
if( !p || !*p || *p != '<' )
if ( !p || !*p || *p != '<' )
{
return 0;
}

View File

@ -349,8 +349,8 @@ size_t Utf8_16_Write::fwrite(const void* p, size_t _size)
buf[bufIndex++] = iter8.get();
}
++iter8;
if(bufIndex == bufSize || !iter8) {
if(!::fwrite(buf, bufIndex*sizeof(utf16), 1, m_pFile)) return 0;
if (bufIndex == bufSize || !iter8) {
if (!::fwrite(buf, bufIndex*sizeof(utf16), 1, m_pFile)) return 0;
bufIndex = 0;
}
}

View File

@ -151,9 +151,9 @@ void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest)
void URLCtrl::destroy()
{
if(_hfUnderlined)
if (_hfUnderlined)
::DeleteObject(_hfUnderlined);
if(_hCursor)
if (_hCursor)
::DestroyCursor(_hCursor);
}
@ -171,7 +171,7 @@ void URLCtrl::action()
::UpdateWindow(_hSelf);
// Open a browser
if(_URL != TEXT(""))
if (_URL != TEXT(""))
{
::ShellExecute(NULL, TEXT("open"), _URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
@ -201,9 +201,9 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
DWORD dwDTStyle = DT_SINGLELINE;
//Test if centered horizontally or vertically
if(dwStyle & SS_CENTER) dwDTStyle |= DT_CENTER;
if(dwStyle & SS_RIGHT) dwDTStyle |= DT_RIGHT;
if(dwStyle & SS_CENTERIMAGE) dwDTStyle |= DT_VCENTER;
if (dwStyle & SS_CENTER) dwDTStyle |= DT_CENTER;
if (dwStyle & SS_RIGHT) dwDTStyle |= DT_RIGHT;
if (dwStyle & SS_CENTERIMAGE) dwDTStyle |= DT_VCENTER;
RECT rect;
::GetClientRect(hwnd, &rect);
@ -216,7 +216,7 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
::SetBkColor(hdc, getCtrlBgColor(GetParent(hwnd))); ///*::GetSysColor(COLOR_3DFACE)*/);
// Create an underline font
if(_hfUnderlined == 0)
if (_hfUnderlined == 0)
{
// Get the default GUI font
LOGFONT lf;
@ -266,7 +266,7 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
break;
case WM_LBUTTONUP:
if(_clicking)
if (_clicking)
{
_clicking = false;
@ -277,12 +277,12 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
//Support using space to activate this object
case WM_KEYDOWN:
if(wParam == VK_SPACE)
if (wParam == VK_SPACE)
_clicking = true;
break;
case WM_KEYUP:
if(wParam == VK_SPACE && _clicking)
if (wParam == VK_SPACE && _clicking)
{
_clicking = false;

View File

@ -44,7 +44,7 @@ static HHOOK hookMouse = NULL;
static LRESULT CALLBACK hookProcMouse(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode >= 0)
if (nCode >= 0)
{
switch (wParam)
{

View File

@ -510,7 +510,7 @@ void goToCenter(HWND hwnd)
::GetClientRect(hParent, &rc);
//If window coordinates are all zero(ie,window is minimised),then assign desktop as the parent window.
if(rc.left == 0 && rc.right == 0 && rc.top == 0 && rc.bottom == 0)
if (rc.left == 0 && rc.right == 0 && rc.top == 0 && rc.bottom == 0)
{
//hParent = ::GetDesktopWindow();
::ShowWindow(hParent, SW_SHOWNORMAL);

View File

@ -2106,7 +2106,7 @@ void trim(generic_string & str)
{
str.erase(pos + 1);
pos = str.find_first_not_of(' ');
if(pos != generic_string::npos) str.erase(0, pos);
if (pos != generic_string::npos) str.erase(0, pos);
}
else str.erase(str.begin(), str.end());
};

View File

@ -317,7 +317,7 @@ void TreeView::dragItem(HWND parentHandle, int x, int y)
hitTestInfo.pt.x = point.x;
hitTestInfo.pt.y = point.y;
HTREEITEM targetItem = reinterpret_cast<HTREEITEM>(::SendMessage(_hSelf, TVM_HITTEST, 0, reinterpret_cast<LPARAM>(&hitTestInfo)));
if(targetItem)
if (targetItem)
{
::SendMessage(_hSelf, TVM_SELECTITEM, TVGN_DROPHILITE, reinterpret_cast<LPARAM>(targetItem));
}

View File

@ -126,7 +126,7 @@ VOID CALLBACK CReadChangesRequest::NotificationCompletion(
_ASSERTE(dwNumberOfBytesTransfered >= offsetof(FILE_NOTIFY_INFORMATION, FileName) + sizeof(WCHAR));
// This might mean overflow? Not sure.
if(!dwNumberOfBytesTransfered)
if (!dwNumberOfBytesTransfered)
return;
pBlock->BackupBuffer(dwNumberOfBytesTransfered);

View File

@ -325,7 +325,7 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
if (const TCHAR *fn = fd.doOpenSingleFileDlg())
{
if(wcschr(fn, ' ') != NULL)
if (wcschr(fn, ' ') != NULL)
{
generic_string fn_quotes(fn);
fn_quotes = TEXT("\"") + fn_quotes + TEXT("\"");

View File

@ -777,7 +777,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
int currentTabOn = getTabIndexAt(xPos, yPos);
if (_isDragging)
{
if(::GetCapture() == _hSelf)
if (::GetCapture() == _hSelf)
::ReleaseCapture();
notify(_isDraggingInside?TCN_TABDROPPED:TCN_TABDROPPEDOUTSIDE, currentTabOn);

View File

@ -246,7 +246,8 @@ void ToolBar::setToUglyIcons()
void ToolBar::reset(bool create)
{
if(create && _hSelf) {
if (create && _hSelf)
{
//Store current button state information
TBBUTTON tempBtn;
for(size_t i = 0; i < _nbCurrentButtons; ++i)
@ -258,7 +259,7 @@ void ToolBar::reset(bool create)
_hSelf = NULL;
}
if(!_hSelf)
if (!_hSelf)
{
_hSelf = ::CreateWindowEx(
WS_EX_PALETTEWINDOW,
@ -362,7 +363,7 @@ void ToolBar::doPopop(POINT chevPoint)
while(start < _nbCurrentButtons)
{
::SendMessage(_hSelf, TB_GETITEMRECT, start, reinterpret_cast<LPARAM>(&btnRect));
if(btnRect.right > width)
if (btnRect.right > width)
break;
++start;
}

View File

@ -62,7 +62,7 @@ inline static DWORD GetExStyle(HWND hWnd) {
inline static BOOL ModifyStyle(HWND hWnd, DWORD dwRemove, DWORD dwAdd) {
DWORD dwStyle = (DWORD)::GetWindowLongPtr(hWnd, GWL_STYLE);
DWORD dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
if(dwStyle == dwNewStyle)
if (dwStyle == dwNewStyle)
return FALSE;
::SetWindowLongPtr(hWnd, GWL_STYLE, dwNewStyle);
return TRUE;
@ -71,7 +71,7 @@ inline static BOOL ModifyStyle(HWND hWnd, DWORD dwRemove, DWORD dwAdd) {
inline static BOOL ModifyStyleEx(HWND hWnd, DWORD dwRemove, DWORD dwAdd) {
DWORD dwStyle = (DWORD)::GetWindowLongPtr(hWnd, GWL_EXSTYLE);
DWORD dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
if(dwStyle == dwNewStyle)
if (dwStyle == dwNewStyle)
return FALSE;
::SetWindowLongPtr(hWnd, GWL_EXSTYLE, dwNewStyle);
return TRUE;
@ -306,7 +306,7 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{
NMLVDISPINFO *pLvdi = (NMLVDISPINFO *)pNMHDR;
if(pLvdi->item.mask & LVIF_TEXT)
if (pLvdi->item.mask & LVIF_TEXT)
{
pLvdi->item.pszText[0] = 0;
size_t index = pLvdi->item.iItem;

View File

@ -223,7 +223,7 @@ KeyCombo ScintillaKeyMap::getKeyComboByIndex(size_t index) const {
void ScintillaKeyMap::setKeyComboByIndex(int index, KeyCombo combo)
{
if(combo._key == 0 && (_size > 1))
if (combo._key == 0 && (_size > 1))
{ //remove the item if possible
_keyCombos.erase(_keyCombos.begin() + index);
}
@ -837,7 +837,7 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
scnN.nmhdr.code = SCN_CHARADDED;
scnN.nmhdr.hwndFrom = pEditView->getHSelf();
scnN.nmhdr.idFrom = 0;
if(_sParameter.empty())
if (_sParameter.empty())
scnN.ch = 0;
else
scnN.ch = _sParameter.at(0);

View File

@ -154,7 +154,7 @@ public:
virtual generic_string toString() const; //the hotkey part
generic_string toMenuItemString() const { //generic_string suitable for menu
generic_string str = _menuName;
if(isEnabled())
if (isEnabled())
{
str += TEXT("\t");
str += toString();

View File

@ -154,7 +154,7 @@ float nsLatin1Prober::GetConfidence(void)
for (PRInt32 i = 0; i < FREQ_CAT_NUM; i++)
total += mFreqCounter[i];
if(!total)
if (!total)
confidence = 0.0f;
else
{

View File

@ -102,7 +102,7 @@ nsUniversalDetector::Reset()
nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
{
if(mDone)
if (mDone)
return NS_OK;
if (aLen > 0)