Use unary operator '!' instead of "not"

This commit is contained in:
Don HO 2021-02-20 04:44:34 +01:00
parent 1eaaf45d87
commit dbac42edd0
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
19 changed files with 109 additions and 109 deletions

View File

@ -616,21 +616,21 @@ generic_string PathAppend(generic_string& strDest, const generic_string& str2app
return strDest;
}
if (strDest.empty() && not str2append.empty()) // "" + titi
if (strDest.empty() && !str2append.empty()) // "" + titi
{
strDest = str2append;
return strDest;
}
if (strDest[strDest.length() - 1] == '\\' && (not str2append.empty() && str2append[0] == '\\')) // toto\ + \titi
if (strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] == '\\')) // toto\ + \titi
{
strDest.erase(strDest.length() - 1, 1);
strDest += str2append;
return strDest;
}
if ((strDest[strDest.length() - 1] == '\\' && (not str2append.empty() && str2append[0] != '\\')) // toto\ + titi
|| (strDest[strDest.length() - 1] != '\\' && (not str2append.empty() && str2append[0] == '\\'))) // toto + \titi
if ((strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] != '\\')) // toto\ + titi
|| (strDest[strDest.length() - 1] != '\\' && (!str2append.empty() && str2append[0] == '\\'))) // toto + \titi
{
strDest += str2append;
return strDest;
@ -945,7 +945,7 @@ bool allPatternsAreExclusion(const std::vector<generic_string> patterns)
break;
}
}
return not oneInclusionPatternFound;
return !oneInclusionPatternFound;
}
generic_string GetLastErrorAsString(DWORD errorCode)
@ -1087,7 +1087,7 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
CertInfo.SerialNumber = pSignerInfo->SerialNumber;
pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_CERT, (PVOID)&CertInfo, NULL);
if (not pCertContext)
if (!pCertContext)
{
generic_string errorMessage = TEXT("Certificate context: ");
errorMessage += GetLastErrorAsString(GetLastError());

View File

@ -271,8 +271,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_mainEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine);
_mainEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
_subEditView.execute(SCI_SETENDATLASTLINE, !svp1._scrollBeyondLastLine);
if (svp1._doSmoothFont)
{
@ -1708,7 +1708,7 @@ bool Notepad_plus::findInFiles()
{
const TCHAR *dir2Search = _findReplaceDlg.getDir2Search();
if (not dir2Search[0] || not ::PathFileExists(dir2Search))
if (!dir2Search[0] || !::PathFileExists(dir2Search))
{
return false;
}
@ -2098,7 +2098,7 @@ void Notepad_plus::checkDocState()
bool isSysReadOnly = curBuf->getFileReadOnly();
enableCommand(IDM_EDIT_CLEARREADONLY, isSysReadOnly, MENU);
bool doEnable = not (curBuf->isMonitoringOn() || isSysReadOnly);
bool doEnable = !(curBuf->isMonitoringOn() || isSysReadOnly);
enableCommand(IDM_EDIT_SETREADONLY, doEnable, MENU);
bool isUserReadOnly = curBuf->getUserReadOnly();
@ -2124,7 +2124,7 @@ void Notepad_plus::checkDocState()
if (_pAnsiCharPanel)
_pAnsiCharPanel->switchEncoding();
enableCommand(IDM_VIEW_MONITORING, not curBuf->isUntitled(), MENU | TOOLBAR);
enableCommand(IDM_VIEW_MONITORING, !curBuf->isUntitled(), MENU | TOOLBAR);
checkMenuItem(IDM_VIEW_MONITORING, curBuf->isMonitoringOn());
_toolBar.setCheck(IDM_VIEW_MONITORING, curBuf->isMonitoringOn());
}
@ -3181,14 +3181,14 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
BOOL Notepad_plus::processFindAccel(MSG *msg) const
{
if (not ::IsChild(_findReplaceDlg.getHSelf(), ::GetFocus()))
if (!::IsChild(_findReplaceDlg.getHSelf(), ::GetFocus()))
return FALSE;
return ::TranslateAccelerator(_findReplaceDlg.getHSelf(), _accelerator.getFindAccTable(), msg);
}
BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const
{
if (not ::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus()))
if (!::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus()))
return FALSE;
return ::TranslateAccelerator(_incrementFindDlg.getHSelf(), _accelerator.getIncrFindAccTable(), msg);
}
@ -3786,7 +3786,7 @@ void Notepad_plus::dropFiles(HDROP hdrop)
switchToFile(lastOpened);
}
}
else if (not isOldMode && (folderPaths.size() != 0 && filePaths.size() != 0)) // new mode && both folders & files
else if (!isOldMode && (folderPaths.size() != 0 && filePaths.size() != 0)) // new mode && both folders & files
{
// display error & do nothing
_nativeLangSpeaker.messageBox("DroppingFolderAsProjectModeWarning",
@ -3795,7 +3795,7 @@ void Notepad_plus::dropFiles(HDROP hdrop)
TEXT("Invalid action"),
MB_OK | MB_APPLMODAL);
}
else if (not isOldMode && (folderPaths.size() != 0 && filePaths.size() == 0)) // new mode && only folders
else if (!isOldMode && (folderPaths.size() != 0 && filePaths.size() == 0)) // new mode && only folders
{
// process new mode
generic_string emptyStr;
@ -4627,7 +4627,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
const TCHAR aSpace[] { TEXT(" ") };
//Only values that have passed through will be assigned, to be sure they are valid!
if (not isSingleLineAdvancedMode)
if (!isSingleLineAdvancedMode)
{
comment = commentLineSymbol;
@ -4690,7 +4690,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (currCommentMode != cm_comment) // uncomment/toggle
{
if (not isSingleLineAdvancedMode)
if (!isSingleLineAdvancedMode)
{
// In order to do get case insensitive comparison use strnicmp() instead case-sensitive comparison.
// Case insensitive comparison is needed e.g. for "REM" and "rem" in Batchfiles.
@ -4778,7 +4778,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (currCommentMode != cm_uncomment) // comment/toggle
{
if (not isSingleLineAdvancedMode)
if (!isSingleLineAdvancedMode)
{
_pEditView->insertGenericTextFrom(lineIndent, comment.c_str());

View File

@ -239,7 +239,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize];
bool isFirstTime = not _findReplaceDlg.isCreated();
bool isFirstTime = !_findReplaceDlg.isCreated();
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL());
const NppGUI & nppGui = nppParam.getNppGUI();
@ -263,7 +263,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
TCHAR str[strSize];
Finder *launcher = reinterpret_cast<Finder *>(wParam);
bool isFirstTime = not _findInFinderDlg.isCreated();
bool isFirstTime = !_findInFinderDlg.isCreated();
_findInFinderDlg.doDialog(launcher, _nativeLangSpeaker.isRTL());
@ -1360,7 +1360,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_FINDKEYCONFLICTS:
{
if (not wParam || not lParam) // Clean up current session
if (!wParam || !lParam) // Clean up current session
{
delete _pShortcutMapper;
_pShortcutMapper = nullptr;

View File

@ -1496,7 +1496,7 @@ bool Notepad_plus::fileSave(BufferID id)
TCHAR *name = ::PathFindFileName(fn);
generic_string fn_bak;
if (nppgui._useDir && not nppgui._backupDir.empty())
if (nppgui._useDir && !nppgui._backupDir.empty())
{
// Get the custom directory, make sure it has a trailing slash
fn_bak = nppgui._backupDir;

View File

@ -46,7 +46,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
case SCN_MODIFIED:
{
if (not notifyView)
if (!notifyView)
return FALSE;
static bool prevWasEdit = false;
@ -549,7 +549,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_tabPopupMenu.checkItem(IDM_EDIT_SETREADONLY, isUserReadOnly);
bool isSysReadOnly = buf->getFileReadOnly();
_tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, not isSysReadOnly && not buf->isMonitoringOn());
_tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, !isSysReadOnly && !buf->isMonitoringOn());
_tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly);
bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
@ -659,7 +659,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_DOUBLECLICK:
{
if (not notifyView)
if (!notifyView)
return FALSE;
if (notification->modifiers == SCMOD_CTRL)
@ -835,7 +835,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_UPDATEUI:
{
if (not notifyView)
if (!notifyView)
return FALSE;
NppParameters& nppParam = NppParameters::getInstance();
@ -962,7 +962,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_ZOOM:
{
if (not notifyView)
if (!notifyView)
return FALSE;
ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView;
@ -985,7 +985,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_PAINTED:
{
if (not notifyView)
if (!notifyView)
return FALSE;
// Check if a restore position is needed.
@ -1021,7 +1021,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_linkTriggered = false;
}
if (_pDocMap && (not _pDocMap->isClosed()) && _pDocMap->isVisible() && not _pDocMap->isTemporarilyShowing())
if (_pDocMap && (!_pDocMap->isClosed()) && _pDocMap->isVisible() && !_pDocMap->isTemporarilyShowing())
{
_pDocMap->wrapMap();
_pDocMap->scrollMap();

View File

@ -709,7 +709,7 @@ bool LocalizationSwitcher::addLanguageFromXml(const std::wstring& xmlFullPath)
{
wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str());
wstring foundLang = getLangFromXmlFileName(fn);
if (not foundLang.empty())
if (!foundLang.empty())
{
_localizationList.push_back(pair<wstring, wstring>(foundLang, xmlFullPath));
return true;
@ -1311,7 +1311,7 @@ bool NppParameters::load()
// LocalizationSwitcher should use always user path
_localizationSwitcher._nativeLangPath = nativeLangPath;
if (not _startWithLocFileName.empty()) // localization argument detected, use user wished localization
if (!_startWithLocFileName.empty()) // localization argument detected, use user wished localization
{
// overwrite nativeLangPath variable
nativeLangPath = _nppPath;
@ -1681,7 +1681,7 @@ bool NppParameters::getUserParametersFromXmlTree()
return false;
TiXmlNode *root = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not root)
if (!root)
return false;
// Get GUI parameters
@ -1980,7 +1980,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
if (not menuEntryName.empty() and not menuItemName.empty())
if (!menuEntryName.empty() && !menuItemName.empty())
{
int cmd = getCmdIdFromMenuEntryItemName(mainMenuHadle, menuEntryName, menuItemName);
if (cmd != -1)
@ -1997,7 +1997,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty())
if (pluginsMenu && !pluginName.empty() && !pluginCmdName.empty())
{
int pluginCmdId = getPluginCmdIdFromMenuEntryItemName(pluginsMenu, pluginName, pluginCmdName);
if (pluginCmdId != -1)
@ -3247,9 +3247,9 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
void NppParameters::writeShortcuts()
{
if (not _isAnyShortcutModified) return;
if (!_isAnyShortcutModified) return;
if (not _pXmlShortcutDoc)
if (!_pXmlShortcutDoc)
{
//do the treatment
_pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath);
@ -3689,16 +3689,16 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const
{
if (not _pXmlUserDoc) return false;
if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}
TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History"));
if (not historyNode)
if (!historyNode)
{
historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History")));
}
@ -3714,7 +3714,7 @@ bool NppParameters::writeProjectPanelsSettings() const
if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}
@ -3749,7 +3749,7 @@ bool NppParameters::writeFileBrowserSettings(const vector<generic_string> & root
if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}
@ -3787,13 +3787,13 @@ bool NppParameters::writeFileBrowserSettings(const vector<generic_string> & root
bool NppParameters::writeHistory(const TCHAR *fullpath)
{
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}
TiXmlNode *historyNode = nppRoot->FirstChildElement(TEXT("History"));
if (not historyNode)
if (!historyNode)
{
historyNode = nppRoot->InsertEndChild(TiXmlElement(TEXT("History")));
}
@ -5704,19 +5704,19 @@ bool NppParameters::writeScintillaParams()
const TCHAR *pViewName = TEXT("ScintillaPrimaryView");
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}
TiXmlNode *configsRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs"));
if (not configsRoot)
if (!configsRoot)
{
configsRoot = nppRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfigs")));
}
TiXmlNode *scintNode = getChildElementByAttribut(configsRoot, TEXT("GUIConfig"), TEXT("name"), pViewName);
if (not scintNode)
if (!scintNode)
{
scintNode = configsRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig")));
(scintNode->ToElement())->SetAttribute(TEXT("name"), pViewName);
@ -6274,10 +6274,10 @@ void NppParameters::createXmlTreeFromGUIParams()
bool NppParameters::writeFindHistory()
{
if (not _pXmlUserDoc) return false;
if (!_pXmlUserDoc) return false;
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot)
if (!nppRoot)
{
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
}

View File

@ -220,14 +220,14 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
bool isWow64Off = false;
NppParameters& nppParam = NppParameters::getInstance();
if (not PathFileExists(_fullPathName.c_str()))
if (!PathFileExists(_fullPathName.c_str()))
{
nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
bool isOK = false;
if (_currentStatus != DOC_DELETED && not PathFileExists(_fullPathName.c_str())) //document has been deleted
if (_currentStatus != DOC_DELETED && !PathFileExists(_fullPathName.c_str())) //document has been deleted
{
_currentStatus = DOC_DELETED;
_isFileReadOnly = false;
@ -917,7 +917,7 @@ bool FileManager::backupCurrentBuffer()
else // buffer not dirty, sync: delete the backup file
{
generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty())
if (!backupFilePath.empty())
{
// delete backup file
generic_string file2Delete = buffer->getBackupFileName();
@ -945,7 +945,7 @@ bool FileManager::deleteBufferBackup(BufferID id)
Buffer* buffer = getBufferByID(id);
bool result = true;
generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty())
if (!backupFilePath.empty())
{
// delete backup file
buffer->setBackupFileName(generic_string());
@ -1062,7 +1062,7 @@ SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool i
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
generic_string backupFilePath = buffer->getBackupFileName();
if (not backupFilePath.empty())
if (!backupFilePath.empty())
{
// delete backup file
buffer->setBackupFileName(generic_string());
@ -1260,7 +1260,7 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data,
bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
{
FILE *fp = generic_fopen(filename, TEXT("rb"));
if (not fp)
if (!fp)
return false;
//Get file size

View File

@ -589,13 +589,13 @@ vector<generic_string> Finder::getResultFilePaths() const
// make sure that path is not already in
generic_string & path2add = (*_pMainFoundInfos)[i]._fullPath;
bool found = path2add.empty();
for (size_t j = 0; j < paths.size() && not found; ++j)
for (size_t j = 0; j < paths.size() && !found; ++j)
{
if (paths[j] == path2add)
found = true;
}
if (not found)
if (!found)
paths.push_back(path2add);
}
return paths;
@ -2038,7 +2038,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
{
int nbProcessed = 0;
if (!isCreated() && not findReplaceInfo._txt2find)
if (!isCreated() && !findReplaceInfo._txt2find)
return nbProcessed;
ScintillaEditView *pEditView = *_ppEditView;
@ -2057,7 +2057,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
LRESULT stringSizeReplace = 0;
TCHAR *pTextFind = NULL;
if (not findReplaceInfo._txt2find)
if (!findReplaceInfo._txt2find)
{
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
generic_string str2Search = getTextFromCombo(hFindCombo);
@ -2081,7 +2081,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
TCHAR *pTextReplace = NULL;
if (op == ProcessReplaceAll)
{
if (not findReplaceInfo._txt2replace)
if (!findReplaceInfo._txt2replace)
{
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
generic_string str2Replace = getTextFromCombo(hReplaceCombo);
@ -2193,7 +2193,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
case ProcessFindInFinder:
{
if (not pFindersInfo || not pFindersInfo->_pSourceFinder || not pFindersInfo->_pDestFinder)
if (!pFindersInfo || !pFindersInfo->_pSourceFinder || !pFindersInfo->_pDestFinder)
break;
const TCHAR *pFileName = pFindersInfo->_pFileName ? pFindersInfo->_pFileName : TEXT("");

View File

@ -86,13 +86,13 @@ void FunctionCallTip::setLanguageXML(TiXmlElement * pXmlKeyword)
bool FunctionCallTip::updateCalltip(int ch, bool needShown)
{
if (not needShown && ch != _start && ch != _param && not isVisible()) //must be already visible
if (!needShown && ch != _start && ch != _param && !isVisible()) //must be already visible
return false;
_curPos = static_cast<int32_t>(_pEditView->execute(SCI_GETCURRENTPOS));
//recalculate everything
if (not getCursorFunction())
if (!getCursorFunction())
{ //cannot display calltip (anymore)
close();
return false;

View File

@ -1312,13 +1312,13 @@ void ScintillaEditView::addCustomWordChars()
break;
}
}
if (not found)
if (!found)
{
chars2addStr.push_back(char2check);
}
}
if (not chars2addStr.empty())
if (!chars2addStr.empty())
{
string newCharList = _defaultCharList;
newCharList += chars2addStr;
@ -1837,7 +1837,7 @@ void ScintillaEditView::restoreCurrentPosPreStep()
execute(SCI_SETANCHOR, pos._startPos);
execute(SCI_SETCURRENTPOS, pos._endPos);
execute(SCI_CANCEL); //disable
if (not isWrap()) //only offset if not wrapping, otherwise the offset isnt needed at all
if (!isWrap()) //only offset if not wrapping, otherwise the offset isnt needed at all
{
execute(SCI_SETSCROLLWIDTH, pos._scrollWidth);
execute(SCI_SETXOFFSET, pos._xOffset);
@ -2877,7 +2877,7 @@ void ScintillaEditView::changeCase(__inout wchar_t * const strWToConvert, const
{
if (::IsCharAlphaW(strWToConvert[i]))
{
if ((i < 1) ? true : not ::IsCharAlphaNumericW(strWToConvert[i - 1]))
if ((i < 1) ? true : !::IsCharAlphaNumericW(strWToConvert[i - 1]))
strWToConvert[i] = (WCHAR)(UINT_PTR)::CharUpperW((LPWSTR)strWToConvert[i]);
else if (caseToConvert == TITLECASE_FORCE)
strWToConvert[i] = (WCHAR)(UINT_PTR)::CharLowerW((LPWSTR)strWToConvert[i]);

View File

@ -84,7 +84,7 @@ void ListView::destroy()
void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam, int pos2insert)
{
if (not values2Add.size())
if (!values2Add.size())
return;
if (pos2insert == -1)

View File

@ -220,7 +220,7 @@ void DocumentMap::scrollMap()
// Get bottom position of orange marker window
LRESULT lowerY = 0;
LRESULT lineHeightMapView = _pMapView->execute(SCI_TEXTHEIGHT, 0);
if (not (*_ppEditView)->isWrap())
if (!(*_ppEditView)->isWrap())
{ // not wrapped: mimic height of edit view
LRESULT lineHeightEditView = (*_ppEditView)->execute(SCI_TEXTHEIGHT, 0);
lowerY = higherY + lineHeightMapView * (rcEditView.bottom - rcEditView.top) / lineHeightEditView;
@ -261,7 +261,7 @@ void DocumentMap::scrollMapWith(const MapPosition & mapPos)
// Get the editor's higher/lower Y, then compute the map's higher/lower Y
LRESULT higherY = 0;
LRESULT lowerY = 0;
if (not mapPos._isWrap)
if (!mapPos._isWrap)
{
auto higherPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._firstVisibleDocLine);
auto lowerPos = _pMapView->execute(SCI_POSITIONFROMLINE, mapPos._lastVisibleDocLine);

View File

@ -425,7 +425,7 @@ void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin
fi._pos = foundPos;
}
if (not classStructName.empty())
if (!classStructName.empty())
{
fi._data2 = classStructName;
fi._pos2 = -1; // change -1 valeur for validated data2
@ -585,7 +585,7 @@ void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair
generic_string classStructName = parseSubLevel(targetStart, targetEnd, _classNameExprArray, foundPos, ppEditView);
if (not _openSymbole.empty() && not _closeSymbole.empty())
if (!_openSymbole.empty() && !_closeSymbole.empty())
{
targetEnd = static_cast<int32_t>(getBodyClosePos(targetEnd, _openSymbole.c_str(), _closeSymbole.c_str(), commentZones, ppEditView));
}

View File

@ -1642,7 +1642,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
wsprintf(buffer, TEXT("%05d-%03d"), LPBGcell->row,LPBGcell->col);
if (not BGHS[SelfIndex].INITIALCONTENT) // performance enhancement while adding new data
if (!BGHS[SelfIndex].INITIALCONTENT) // performance enhancement while adding new data
{
//see if that cell is already loaded
FindResult = BinarySearchListBox(BGHS[SelfIndex].hlist1,buffer);
@ -2988,7 +2988,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//This function needs a static placement position inside a parent window (default in Npp).
//For a dynamic position (e.g. sizing of the parenet window) an adjustment to this function is needed!
if (not BGHS[SelfIndex].SHOWINTEGRALROWS)
if (!BGHS[SelfIndex].SHOWINTEGRALROWS)
break;
ShowHscroll(hWnd, SelfIndex);

View File

@ -536,7 +536,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case NPPM_INTERNAL_FINDKEYCONFLICTS:
{
if (not wParam || not lParam)
if (!wParam || !lParam)
break;
generic_string conflictInfo;
@ -684,7 +684,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
}
if (not isModified)
if (!isModified)
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
return TRUE;
@ -842,7 +842,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
break;
}
if (not isModified)
if (!isModified)
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
return TRUE;
@ -1135,7 +1135,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment
if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1148,7 +1148,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict;
else
{
if (not keyConflictLocation->empty())
if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | ");
@ -1169,7 +1169,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment
if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1182,7 +1182,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict;
else
{
if (not keyConflictLocation->empty())
if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | ");
@ -1203,7 +1203,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment
if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1216,7 +1216,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict;
else
{
if (not keyConflictLocation->empty())
if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | ");
@ -1237,7 +1237,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment
if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1250,7 +1250,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict;
else
{
if (not keyConflictLocation->empty())
if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | ");
@ -1271,7 +1271,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
size_t nbItems = vShortcuts.size();
for (size_t itemIndex = 0; itemIndex < nbItems; ++itemIndex)
{
if (not vShortcuts[itemIndex].isEnabled()) //no key assignment
if (!vShortcuts[itemIndex].isEnabled()) //no key assignment
continue;
if ((itemIndex == itemIndexToTest) && (gridState == static_cast<size_t>(_currentState))) //don't catch oneself
@ -1287,7 +1287,7 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
return retIsConflict;
else
{
if (not keyConflictLocation->empty())
if (!keyConflictLocation->empty())
*keyConflictLocation += TEXT("\r\n");
*keyConflictLocation += _tabNames[gridState];
*keyConflictLocation += TEXT(" | ");

View File

@ -68,7 +68,7 @@ Version::Version(const generic_string& versionStr)
void Version::setVersionFrom(const generic_string& filePath)
{
if (not filePath.empty() && ::PathFileExists(filePath.c_str()))
if (!filePath.empty() && ::PathFileExists(filePath.c_str()))
{
DWORD handle = 0;
DWORD bufferSize = ::GetFileVersionInfoSize(filePath.c_str(), &handle);
@ -169,20 +169,20 @@ generic_string PluginUpdateInfo::describe()
{
generic_string desc;
const TCHAR *EOL = TEXT("\r\n");
if (not _description.empty())
if (!_description.empty())
{
desc = _description;
desc += EOL;
}
if (not _author.empty())
if (!_author.empty())
{
desc += TEXT("Author: ");
desc += _author;
desc += EOL;
}
if (not _homepage.empty())
if (!_homepage.empty())
{
desc += TEXT("Homepage: ");
desc += _homepage;

View File

@ -245,7 +245,7 @@ void PreferenceDlg::makeCategoryList()
int32_t PreferenceDlg::getIndexFromName(const TCHAR *name) const
{
if (not name)
if (!name)
return -1;
int32_t i = 0;
@ -3047,7 +3047,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not tab.empty() && not warnEnd.empty())
if (!warnBegin.empty() && !space.empty() && !tab.empty() && !warnEnd.empty())
{
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
@ -3066,7 +3066,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" TAB(s) in your character list.");
}
}
else if (nbSp && not nbTab)
else if (nbSp && !nbTab)
{
generic_string nbSpStr = std::to_wstring(nbSp);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
@ -3074,7 +3074,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not warnEnd.empty())
if (!warnBegin.empty() && !space.empty() && !warnEnd.empty())
{
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
msg = warnBegin;
@ -3088,7 +3088,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" space(s) in your character list.");
}
}
else if (not nbSp && nbTab)
else if (!nbSp && nbTab)
{
generic_string nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
@ -3096,7 +3096,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not tab.empty() && not warnEnd.empty())
if (!warnBegin.empty() && !tab.empty() && !warnEnd.empty())
{
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
msg = warnBegin;
@ -3110,7 +3110,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
msg += TEXT(" TAB(s) in your character list.");
}
}
else //(not nbSp && not nbTab)
else // (!nbSp && !nbTab)
{
// do nothing
}
@ -3122,7 +3122,7 @@ void DelimiterSubDlg::setWarningIfNeed() const
{
generic_string msg;
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance()).getNppGUI());
if (not nppGUI._isWordCharDefault)
if (!nppGUI._isWordCharDefault)
{
int nbSp = 0;
int nbTab = 0;
@ -3185,8 +3185,8 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, nppGUI._customWordChars.c_str());
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, not nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, !nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
setWarningIfNeed();
@ -3280,7 +3280,7 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0);
nppGUI._isWordCharDefault = true;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, TEXT(""));
return TRUE;
}
@ -3290,7 +3290,7 @@ INT_PTR CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0);
nppGUI._isWordCharDefault = false;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
setWarningIfNeed();
return TRUE;
}

View File

@ -529,7 +529,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
}
setActiveTab(tabIndex);
}
else if (not _isMultiLine) // don't scroll if in multi-line mode
else if (!_isMultiLine) // don't scroll if in multi-line mode
{
RECT rcTabCtrl, rcLastTab;
::SendMessage(_hSelf, TCM_GETITEMRECT, lastTabIndex, reinterpret_cast<LPARAM>(&rcLastTab));
@ -549,7 +549,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
LONG maxLengthUpDownCtrl = NppParameters::getInstance()._dpiManager.scaleX(44); // sufficient static value
// scroll forward as long as the last tab is hidden; scroll backward till the first tab
if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || not isForward)
if ((_isVertical ? ((rcTabCtrl.bottom - rcLastTab.bottom) < maxLengthUpDownCtrl) : ((rcTabCtrl.right - rcLastTab.right) < maxLengthUpDownCtrl)) || !isForward)
{
if (isForward)
++scrollTabIndex;

View File

@ -238,22 +238,22 @@ generic_string NativeLangSpeaker::getShortcutNameString(int itemID) const
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const
{
if (not _nativeLangA)
if (!_nativeLangA)
return defaultString;
if (not strID)
if (!strID)
return defaultString;
TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings");
if (not node) return defaultString;
if (!node) return defaultString;
node = node->FirstChild(strID);
if (not node) return defaultString;
if (!node) return defaultString;
TiXmlElementA *element = node->ToElement();
const char *value = element->Attribute("value");
if (not value) return defaultString;
if (!value) return defaultString;
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
return wmc.char2wchar(value, _nativeLangEncoding);