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] --- .../src/ex_import/classExImContactBase.cpp | 48 +++--- .../src/ex_import/classExImContactXML.cpp | 46 +++--- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 24 +-- .../src/ex_import/dlg_ExImOpenSaveFile.cpp | 4 +- .../UserInfoEx/src/ex_import/dlg_ExImProgress.cpp | 8 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 26 ++-- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 46 +++--- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 36 ++--- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 14 +- plugins/UserInfoEx/src/ex_import/tinyxml.cpp | 164 ++++++++++----------- plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp | 92 ++++++------ 11 files changed, 254 insertions(+), 254 deletions(-) (limited to 'plugins/UserInfoEx/src/ex_import') diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 34eb007d36..af55004dc5 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -30,13 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CExImContactBase::CExImContactBase() { - _pszNick = NULL; - _pszDisp = NULL; - _pszGroup = NULL; - _pszProto = NULL; - _pszProtoOld = NULL; - _pszAMPro = NULL; - _pszUIDKey = NULL; + _pszNick = nullptr; + _pszDisp = nullptr; + _pszGroup = nullptr; + _pszProto = nullptr; + _pszProtoOld = nullptr; + _pszAMPro = nullptr; + _pszUIDKey = nullptr; _dbvUIDHash = NULL; memset(&_dbvUID, 0, sizeof(DBVARIANT)); _hContact = INVALID_CONTACT_ID; @@ -115,7 +115,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) else { uidSetting = (LPCSTR)CallProtoService(pszProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); // valid - if (uidSetting != NULL && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { + if (uidSetting != nullptr && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { _pszUIDKey = mir_strdup(uidSetting); if (!DB::Setting::GetAsIs(_hContact, pszProto, uidSetting, &_dbvUID)) { ret = TRUE; @@ -158,8 +158,8 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) **/ BYTE CExImContactBase::fromIni(LPSTR& row) { - LPSTR p1, p2 = NULL; - LPSTR pszUIDValue, pszUIDSetting, pszProto = NULL; + LPSTR p1, p2 = nullptr; + LPSTR pszUIDValue, pszUIDSetting, pszProto = nullptr; LPSTR pszBuf = &row[0]; size_t cchBuf = mir_strlen(row); @@ -230,7 +230,7 @@ MCONTACT CExImContactBase::toDB() // create new contact if none exists if (_hContact == INVALID_CONTACT_ID && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { PROTOACCOUNT *pszAccount = Proto_GetAccount(_pszProto); - if (pszAccount == NULL) { + if (pszAccount == nullptr) { //account does not exist return _hContact = INVALID_CONTACT_ID; } @@ -279,7 +279,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) if (_hContact){ int loaded = _pszUIDKey ? 1 : 0; - if (_pszProto == NULL || !loaded) { + if (_pszProto == nullptr || !loaded) { if (_pszProto){ if (_pszNick) mir_snprintf(name,"%s (%s)", _pszNick, _pszProto); @@ -384,8 +384,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_WCHAR: //'u' pwszVal is valid r = mir_utf8encodeW(_dbvUID.pwszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 'u'; @@ -399,8 +399,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_ASCIIZ: r = mir_utf8encode(_dbvUID.pszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 's'; @@ -411,8 +411,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) if (bPrependType) { //True = XML baselen = mir_base64_encode_bufsize(_dbvUID.cpbVal); r = (LPSTR)mir_alloc((baselen + 8)); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset((r + baselen), 0, 8); ptr = r; if (bPrependType) { // Allways true. @@ -421,15 +421,15 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } if (!mir_base64_encodebuf(_dbvUID.pbVal, _dbvUID.cpbVal, ptr, baselen)) { mir_free(r); - return NULL; + return nullptr; } return r; } else { //FALSE = INI baselen = ((_dbvUID.cpbVal * 3) + 8); r = (LPSTR)mir_alloc(baselen); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset(r, 0, baselen); ptr = r; for (SIZE_T j = 0; j < _dbvUID.cpbVal; j ++, ptr += 3) { @@ -439,7 +439,7 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } break; default: - return NULL; + return nullptr; } return mir_strdup(szUID); } @@ -460,7 +460,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) // compare protocols pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto == NULL || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) + if (pszProto == nullptr || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) return FALSE; // compare uids @@ -477,7 +477,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszProto = mir_a2u(_pszProto); - int ans = MsgBox(NULL, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), + int ans = MsgBox(nullptr, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), LPGENW("The contact %s(%s) has no unique ID in the vCard,\nbut there is a contact in your contact list with the same nick and protocol.\nDo you wish to use this contact?"), ptszNick, ptszProto); MIR_FREE(ptszNick); diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index de3135c5b4..f01d6a66fb 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -49,7 +49,7 @@ static int SortProc(const LPDWORD item1, const LPDWORD item2) CExImContactXML::CExImContactXML(CFileXml *pXmlFile) : CExImContactBase() { - _xmlNode = NULL; + _xmlNode = nullptr; _pXmlFile = pXmlFile; _hEvent = NULL; } @@ -84,7 +84,7 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey) char buf[MAXSETTING]; // convert to hash and make bsearch as it is much faster then working with strings const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, _countof(buf)))); - return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL; + return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != nullptr; } return FALSE; } @@ -131,7 +131,7 @@ TiXmlElement* CExImContactXML::CreateXmlElement() } } } - else _xmlNode = NULL; + else _xmlNode = nullptr; } else _xmlNode = new TiXmlElement(XKEY_OWNER); @@ -238,14 +238,14 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) // add xContact to document if (_xmlNode->NoChildren()) { delete _xmlNode; - _xmlNode = NULL; + _xmlNode = nullptr; return ERROR_NOT_ADDED; } _xmlNode->Print(xmlfile, 1); fputc('\n', xmlfile); delete _xmlNode; - _xmlNode = NULL; + _xmlNode = nullptr; return ERROR_OK; } @@ -294,10 +294,10 @@ int CExImContactXML::ExportModule(LPCSTR pszModule) int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LPCSTR pszSetting) { - TiXmlElement *xmlEntry = NULL; - TiXmlText *xmlValue = NULL; + TiXmlElement *xmlEntry = nullptr; + TiXmlText *xmlValue = nullptr; CHAR buf[32]; - LPSTR str = NULL; + LPSTR str = nullptr; DBVARIANT dbv; if (DB::Setting::GetAsIs(_hContact, pszModule, pszSetting, &dbv)) @@ -353,7 +353,7 @@ int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LP // new buffer for base64 encoded data INT_PTR baselen = mir_base64_encode_bufsize(dbv.cpbVal); str = (LPSTR)mir_alloc(baselen + 6); - assert(str != NULL); + assert(str != nullptr); // encode data if ( mir_base64_encodebuf(dbv.pbVal, dbv.cpbVal, str+1, baselen)) { str[baselen+1] = 0; @@ -420,7 +420,7 @@ BYTE CExImContactXML::ExportEvents() // find module TiXmlNode *xmlModule; - for (xmlModule = _xmlNode->FirstChild(); xmlModule != NULL; xmlModule = xmlModule->NextSibling()) + for (xmlModule = _xmlNode->FirstChild(); xmlModule != nullptr; xmlModule = xmlModule->NextSibling()) if (!mir_strcmpi(((TiXmlElement*)xmlModule)->Attribute("key"), dbei.szModule)) break; @@ -458,10 +458,10 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) numSettings = numEvents = 0; for (TiXmlNode *xmod = _xmlNode->FirstChild(); - xmod != NULL; + xmod != nullptr; xmod = xmod->NextSibling(XKEY_MOD)) { for (TiXmlNode *xkey = xmod->FirstChild(); - xkey != NULL; + xkey != nullptr; xkey = xkey->NextSibling()) { if (!mir_strcmpi(xkey->Value(), XKEY_SET)) numSettings++; @@ -481,7 +481,7 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) { - if (xContact == NULL) + if (xContact == nullptr) return ERROR_INVALID_PARAMS; // delete last contact @@ -504,7 +504,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) // meta contact must be uniquelly identified by its subcontacts // the metaID may change during an export or import call - for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != NULL; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) { + for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != nullptr; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) { CExImContactXML vSub(_pXmlFile); if (vSub = xSub) { // identify metacontact by the first valid subcontact in xmlfile @@ -536,9 +536,9 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) if (_pszUIDKey && mir_strcmp("#NV", _pszUIDKey) != 0) { LPCSTR pUID = xContact->Attribute("uidv"); - if (pUID != NULL) { + if (pUID != nullptr) { unsigned valLen; - PBYTE pbVal = NULL; + PBYTE pbVal = nullptr; switch (*(pUID++)) { case 'b': @@ -559,11 +559,11 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) break; case 'n': pbVal = (PBYTE)mir_base64_decode(pUID, &valLen); - if (pbVal != NULL) + if (pbVal != nullptr) uidn(pbVal, valLen); break; default: - uidu((LPCSTR)NULL); + uidu((LPCSTR)nullptr); break; } } @@ -597,12 +597,12 @@ int CExImContactXML::ImportContact() _pXmlFile->_numEventsTodo += numEvents; // import all modules - for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != NULL; xmod = xmod->NextSibling(XKEY_MOD)) { + for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != nullptr; xmod = xmod->NextSibling(XKEY_MOD)) { // import module if (ImportModule(xmod) == ERROR_ABORTED) { // ask to delete new incomplete contact if (_isNewContact && _hContact != NULL) { - int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING, + int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING, LPGENW("Question"), LPGENW("Importing a new contact was aborted!"), LPGENW("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?")); @@ -741,7 +741,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) if (_isNewContact && _hContact != NULL) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszMetaNick = mir_utf8decodeW(pMetaContact->_pszNick); - int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING, + int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING, LPGENW("Question"), LPGENW("Importing a new meta subcontact failed!"), LPGENW("The newly created meta subcontact '%s'\ncould not be added to metacontact '%s'!\n\nDo you want to delete this contact?"), @@ -789,7 +789,7 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule) if (!mir_strcmpi(pszModule, "Protocol")) return ERROR_OK; - for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != NULL; xKey = xKey->NextSiblingElement()) { + for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != nullptr; xKey = xKey->NextSiblingElement()) { // import setting if (!mir_strcmpi(xKey->Value(), XKEY_SET)) { // check if the module to import is the contact's protocol module @@ -892,7 +892,7 @@ int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry) case 'n': dbv.type = DBVT_BLOB; dbv.pbVal = (PBYTE)mir_base64_decode(value + 1, &baselen); - if (dbv.pbVal != NULL) + if (dbv.pbVal != nullptr) dbv.cpbVal = baselen; else { mir_free(dbv.pbVal); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 13d8558ec7..35b5b31444 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -85,20 +85,20 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) TVITEMA tvi; CHAR szBuf[128]; - if (!pszText || !*pszText) return NULL; + if (!pszText || !*pszText) return nullptr; tvi.mask = TVIF_TEXT; tvi.pszText = szBuf; tvi.cchTextMax = _countof(szBuf); for (tvi.hItem = TreeView_GetChild(hTree, hParent); - tvi.hItem != NULL; + tvi.hItem != nullptr; tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem)) { if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_strcmpi(tvi.pszText, pszText)) return tvi.hItem; } - return NULL; + return nullptr; } /** @@ -114,7 +114,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE bUseImages, BYTE bState) { TVINSERTSTRUCTA tvii; - HTREEITEM hItem = NULL; + HTREEITEM hItem = nullptr; tvii.hParent = hParent; tvii.hInsertAfter = TVI_SORT; @@ -176,13 +176,13 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar if (GetVersionEx(&osvi)) { HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,0, 1); - if (hImages != NULL) + if (hImages != nullptr) { SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages); HICON hIcon; - bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon)) - && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon))); + bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != nullptr) && 0 == ImageList_AddIcon(hImages, hIcon)) + && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != nullptr) && 1 == ImageList_AddIcon(hImages, hIcon))); } } } @@ -195,7 +195,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar } // Set the Window Title and description { - LPCTSTR name = NULL; + LPCTSTR name = nullptr; wchar_t oldTitle[MAXDATASIZE], newTitle[MAXDATASIZE]; switch (pDat->ExImContact->Typ) { @@ -236,7 +236,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar pszProto = (pDat->ExImContact->Typ == EXIM_CONTACT && pDat->ExImContact->hContact != NULL) ? (LPSTR)Proto_GetBaseAccountName(pDat->ExImContact->hContact) - : NULL; + : nullptr; // add items that are always exported tviiT.hParent = TVI_ROOT; @@ -369,7 +369,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items for (hParent = TreeView_GetRoot(hTree); - hParent != NULL; + hParent != nullptr; hParent = TreeView_GetNextSibling(hTree, hParent)) { ExportTree_AppendModuleList(hTree, hParent, pDat->pModules); @@ -393,7 +393,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL); - tvi.hItem != NULL && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); + tvi.hItem != nullptr && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { if (!mir_strcmpi(tvi.pszText, pszRoot)) { @@ -402,7 +402,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar tvi.stateMask = TVIS_STATEIMAGEMASK; for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tvi.hItem); - tvi.hItem != NULL; + tvi.hItem != nullptr; tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { SendMessageA(hTree, TVM_SETITEMA, NULL, (LPARAM)&tvi); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 466ad2a89c..8cf1ef0cc9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -90,7 +90,7 @@ static void InitAlteredPlacesBar() **/ static void ResetAlteredPlaceBars() { - RegOverridePredefKey(HKEY_CURRENT_USER, NULL); + RegOverridePredefKey(HKEY_CURRENT_USER, nullptr); SHDeleteKey(HKEY_CURRENT_USER, HKEY_MIRANDA_PLACESBAR); } @@ -174,7 +174,7 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM, LP HWND hPlacesBar = GetDlgItem(GetParent(hDlg), ctl1); // we have a places bar? - if (hPlacesBar != NULL) { + if (hPlacesBar != nullptr) { InitAlteredPlacesBar(); // finally subclass the places bar mir_subclassWindow(hPlacesBar, PlacesBarSubclassProc); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index aaf300bc55..67b1f7a288 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar CProgress::CProgress() { _dwStartTime = GetTickCount(); - _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress); + _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); } /** @@ -167,7 +167,7 @@ BYTE CProgress::Update() UpdateWindow(_hDlg); while (PeekMessage(&msg, _hDlg, 0, 0, PM_REMOVE) != 0) { - if (_hDlg == NULL || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */ + if (_hDlg == nullptr || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } @@ -184,7 +184,7 @@ BYTE CProgress::Update() **/ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) { - if (_hDlg != NULL) { + if (_hDlg != nullptr) { HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS2); if (pszFormat) { wchar_t buf[MAX_PATH]; @@ -210,7 +210,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) **/ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...) { - if (_hDlg != NULL) { + if (_hDlg != nullptr) { HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS); if (pszFormat) { wchar_t buf[MAX_PATH]; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index dfc1499a08..8dc1e60c31 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -165,19 +165,19 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) { DB::CEnumList Modules; - if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) + if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *file; errno_t err = fopen_s(&file, pszFileName, "wt"); if (err != NULL) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor saving contact information could not be opened."), pszFileName); return 1; } - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // write header SYSTEMTIME now; @@ -208,7 +208,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) ExportContact(ExImContact->hContact, &Modules, file); fclose(file); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; } @@ -226,7 +226,7 @@ LPSTR strnrchr(LPSTR string, int ch, DWORD len) while (--string != start && *string != (CHAR)ch); if (*string == (CHAR)ch) /* char found ? */ return ((LPSTR)string); - return(NULL); + return(nullptr); } /** @@ -327,7 +327,7 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) // check Module and filter "Protocol" if (!pszModule || !*pszModule || mir_strncmp(pszModule, "Protocol", 8) == 0) return 1; - if ((end = value = mir_strchr(pszLine, '=')) == NULL) + if ((end = value = mir_strchr(pszLine, '=')) == nullptr) return 1; // truncate setting string if it has spaces at the end @@ -407,8 +407,8 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) dbv.pbVal = (PBYTE)value; for ( dest = dbv.pbVal, value = strtok(value, " "); value && *value; - value = strtok(NULL, " ")) - *(dest++) = (BYTE)strtol(value, NULL, 16); + value = strtok(nullptr, " ")) + *(dest++) = (BYTE)strtol(value, nullptr, 16); *dest = 0; break; } @@ -439,7 +439,7 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) numContactsAdded = 0; // number of contacts, that were added to the database CHAR *strBuf = (CHAR *) mir_alloc(1); *strBuf = 0; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); while (ImportreadLine(file, strBuf)) { numLines++; @@ -495,23 +495,23 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) } //end while fclose(file); mir_free(strBuf); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // the contact was not found in the file if (numContactsInFile > 0 && !numContactsAdded) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("None of the %d contacts, stored in the ini-file, match the selected contact!\nNothing will be imported"), numContactsInFile); } // Import complete else{ - MsgBox(NULL, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), + MsgBox(nullptr, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), LPGENW("Added %d of %d contacts stored in the ini-file."), numContactsAdded, numContactsInFile); } return 0; } - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor reading contact information could not be opened."), pszFileName); return 1; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index ca7fdc4a25..1231a72c84 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -42,7 +42,7 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) PBYTE s = (PBYTE)pBuffer; BYTE bIsUTF = 0; - if (s == NULL) return 1; + if (s == nullptr) return 1; while ((c = *s++) != 0) { if (c < 0x80) continue; if (!pcbBuffer) return 0; @@ -68,8 +68,8 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) **/ CLineBuffer::CLineBuffer() { - _pVal = NULL; - _pTok = NULL; + _pVal = nullptr; + _pTok = nullptr; _cbVal = 0; _cbUsed = 0; } @@ -458,7 +458,7 @@ int CLineBuffer::fgetEncoded(FILE *inFile) case '=': if (_resizeBuf(1)) { fread(hex, 2, 1, inFile); - *(_pVal + _cbUsed++) = (BYTE)strtol(hex, NULL, 16); + *(_pVal + _cbUsed++) = (BYTE)strtol(hex, nullptr, 16); wAdd++; } break; @@ -502,7 +502,7 @@ size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok; *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -537,7 +537,7 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok; *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -572,7 +572,7 @@ int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, con iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok); *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -608,7 +608,7 @@ int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, cons iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok); *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -647,9 +647,9 @@ int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, **/ CVCardFileVCF::CVCardFileVCF() { - _pFile = NULL; + _pFile = nullptr; _hContact = INVALID_CONTACT_ID; - _pszBaseProto = NULL; + _pszBaseProto = nullptr; _hasUtf8 = 0; _useUtf8 = FALSE; _cbRew = 0; @@ -690,12 +690,12 @@ size_t CVCardFileVCF::packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *c BYTE CVCardFileVCF::GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv) { int type = _useUtf8 ? DBVT_UTF8 : DBVT_ASCIIZ; - dbv->pszVal = NULL; + dbv->pszVal = nullptr; if (!pszModule || db_get_s(_hContact, pszModule, pszSetting, dbv, type) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal)) if (!_pszBaseProto || db_get_s(_hContact, _pszBaseProto, pszSetting, dbv) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal)) return DBVT_DELETED; - _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, NULL); + _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, nullptr); return dbv->type; } @@ -869,9 +869,9 @@ void CVCardFileVCF::Close(void) { if (_pFile) fclose(_pFile); - _pFile = NULL; + _pFile = nullptr; _hContact = INVALID_CONTACT_ID; - _pszBaseProto = NULL; + _pszBaseProto = nullptr; } /** @@ -1055,7 +1055,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) { MAnnivDate mdb; - if (!mdb.DBGetBirthDate(_hContact, NULL)) + if (!mdb.DBGetBirthDate(_hContact, nullptr)) fprintf(_pFile, "BDAY:%d%02d%02d\n", mdb.Year(), mdb.Month(), mdb.Day()); } @@ -1165,8 +1165,8 @@ BYTE CVCardFileVCF::Import() if (!mir_strcmp(szEnt, "ADR")) { if (!pszParam) continue; if (!mir_strcmp(pszParam, "HOME")) { - _clVal.GetTokenFirst(';', NULL); - _clVal.GetTokenNext(';', NULL); + _clVal.GetTokenFirst(';', nullptr); + _clVal.GetTokenNext(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_CITY, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STATE, ';'); @@ -1175,7 +1175,7 @@ BYTE CVCardFileVCF::Import() continue; } if (!mir_strcmp(pszParam, "WORK")) { - _clVal.GetTokenFirst(';', NULL); + _clVal.GetTokenFirst(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_OFFICE, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_CITY, ';'); @@ -1185,8 +1185,8 @@ BYTE CVCardFileVCF::Import() continue; } if (!mir_strcmp(pszParam, "POSTAL")) { - _clVal.GetTokenFirst(';', NULL); - _clVal.GetTokenNext(';', NULL); + _clVal.GetTokenFirst(';', nullptr); + _clVal.GetTokenNext(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_CITY, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STATE, ';'); @@ -1203,13 +1203,13 @@ BYTE CVCardFileVCF::Import() memcpy(buf, _clVal.GetBuffer(), 4); buf[4] = 0; - db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, NULL, 10)); + db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, nullptr, 10)); memcpy(buf, _clVal.GetBuffer() + 4, 2); buf[2] = 0; - db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, NULL, 10)); + db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, nullptr, 10)); memcpy(buf, _clVal.GetBuffer() + 6, 2); buf[2] = 0; - db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, NULL, 10)); + db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, nullptr, 10)); } } continue; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index aee6a83b5f..170b39329f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -92,7 +92,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) DWORD result = (DWORD) DialogBox(ghInst, MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY), - NULL, DlgProc_DataHistory); + nullptr, DlgProc_DataHistory); if (LOWORD(result) != IDOK) { return 0; @@ -101,13 +101,13 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // show dialog to enable user to select modules for export if (!(_wExport & EXPORT_DATA) || - !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) + !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *xmlfile = fopen(pszFileName, "wt"); if (!xmlfile) { - MsgErr(NULL, LPGENW("Can't create xml file!\n%S"), pszFileName); + MsgErr(nullptr, LPGENW("Can't create xml file!\n%S"), pszFileName); return 1; } @@ -183,7 +183,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) } // *end for #ifdef _DEBUG QueryPerformanceCounter(&t2); - MsgErr(NULL, LPGENW("Export took %f ms"), + MsgErr(nullptr, LPGENW("Export took %f ms"), (long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.); #endif }// *end other export mode @@ -250,7 +250,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) CExImContactXML vContact(this); // import contacts - for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) { + for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != nullptr; xContact = xContact->NextSiblingElement()) { if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) { // update progressbar and abort if user clicked cancel LPTSTR pszNick = mir_utf8decodeW(xContact->Attribute("nick")); @@ -271,7 +271,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Importing %s caused error %d"), pszNick, result); + MsgErr(nullptr, LPGENW("Importing %s caused error %d"), pszNick, result); break; #endif } @@ -282,7 +282,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result); + MsgErr(nullptr, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result); break; #endif } @@ -300,7 +300,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Importing Owner caused error %d"), result); + MsgErr(nullptr, LPGENW("Importing Owner caused error %d"), result); #endif } } @@ -319,7 +319,7 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent) try { DWORD dwCount = 0; // count contacts in file for progress bar - for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling()) + for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != nullptr; xContact = xContact->NextSibling()) if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER)) dwCount += CountContacts(xContact->ToElement()) + 1; @@ -345,19 +345,19 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) // load xml file TiXmlDocument doc; if (!doc.LoadFile(pszFileName)) { - MsgErr(NULL, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"), + MsgErr(nullptr, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"), pszFileName, doc.ErrorId(), doc.ErrorDesc()); return 1; } // is xmlfile a XMLCard ? TiXmlElement *xmlCard = doc.FirstChildElement("XMLCard"); - if (xmlCard == NULL) { - MsgErr(NULL, LPGENW("The selected file is no valid XMLCard")); + if (xmlCard == nullptr) { + MsgErr(nullptr, LPGENW("The selected file is no valid XMLCard")); return 1; } // check version if (mir_strcmp(xmlCard->Attribute("ver"), XMLCARD_VERSION)) { - MsgErr(NULL, LPGENW("The version of the XMLCard is not supported by UserInfoEx")); + MsgErr(nullptr, LPGENW("The version of the XMLCard is not supported by UserInfoEx")); return 1; } @@ -373,13 +373,13 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) db_set_safety_mode(1); if (!ret) { - MsgBox(NULL, MB_ICONINFORMATION, + MsgBox(nullptr, MB_ICONINFORMATION, LPGENW("Complete"), LPGENW("Import complete"), LPGENW("Owner contact successfully imported.")); return 0; } else { - MsgErr(NULL, LPGENW("Selected XMLCard does not contain an owner contact!")); + MsgErr(nullptr, LPGENW("Selected XMLCard does not contain an owner contact!")); return 1; } } @@ -406,11 +406,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) #ifdef _DEBUG QueryPerformanceCounter(&t2); - MsgErr(NULL, LPGENW("Import took %f ms"), + MsgErr(nullptr, LPGENW("Import took %f ms"), (long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.); #endif // show results - MsgBox(NULL, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"), + MsgBox(nullptr, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"), LPGENW("added contacts: %u / %u\nadded settings: %u / %u\nadded events %u / %u\nduplicated events: %u"), _numContactsDone, _numContactsTodo, _numSettingsDone, _numSettingsTodo, @@ -421,7 +421,7 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) return 0; } catch(...) { - MsgErr(NULL, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!")); + MsgErr(nullptr, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!")); return 1; } } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index f18d2a2d1b..4d6d2fc829 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -35,8 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName) { - LPCSTR disp = 0; - LPSTR temp = 0; + LPCSTR disp = nullptr; + LPSTR temp = nullptr; cchFileName--; pszFileName[0] = 0; @@ -88,7 +88,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO LPCSTR FilterString(lpExImParam ExImContact) { - LPCSTR pszFilter = 0; + LPCSTR pszFilter = nullptr; switch (ExImContact->Typ) { case EXIM_SUBGROUP: case EXIM_ACCOUNT: @@ -135,12 +135,12 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent) case 3: // .vcf { CVCardFileVCF vcfFile; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); if (vcfFile.Open(ExImContact->hContact, szFileName, "wt")) { vcfFile.Export(FALSE); vcfFile.Close(); } - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return 0; } } @@ -184,10 +184,10 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) case 3: CVCardFileVCF vcfFile; if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) { - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); vcfFile.Import(); vcfFile.Close(); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; } diff --git a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp index 61342c94fe..be5292e438 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp @@ -148,19 +148,19 @@ TiXmlBase::StringToBuffer::~StringToBuffer() TiXmlNode::TiXmlNode(NodeType _type) : TiXmlBase() { - parent = 0; + parent = nullptr; type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; + firstChild = nullptr; + lastChild = nullptr; + prev = nullptr; + next = nullptr; } TiXmlNode::~TiXmlNode() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -182,7 +182,7 @@ void TiXmlNode::CopyTo(TiXmlNode* target) const void TiXmlNode::Clear() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -191,27 +191,27 @@ void TiXmlNode::Clear() delete temp; } - firstChild = 0; - lastChild = 0; + firstChild = nullptr; + lastChild = nullptr; } TiXmlNode* TiXmlNode::LinkEndChild(TiXmlNode* node) { - assert(node->parent == 0 || node->parent == this); - assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument()); + assert(node->parent == nullptr || node->parent == this); + assert(node->GetDocument() == nullptr || node->GetDocument() == this->GetDocument()); if (node->Type() == TiXmlNode::DOCUMENT) { delete node; - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } node->parent = this; node->prev = lastChild; - node->next = 0; + node->next = nullptr; if (lastChild) lastChild->next = node; @@ -227,12 +227,12 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) { if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; return LinkEndChild(node); } @@ -241,17 +241,17 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis) { if (!beforeThis || beforeThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->next = beforeThis; @@ -273,17 +273,17 @@ TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis) { if (!afterThis || afterThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->prev = afterThis; @@ -305,11 +305,11 @@ TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& ad TiXmlNode* TiXmlNode::ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis) { if (replaceThis->parent != this) - return 0; + return nullptr; TiXmlNode* node = withThis.Clone(); if (!node) - return 0; + return nullptr; node->next = replaceThis->next; node->prev = replaceThis->prev; @@ -360,7 +360,7 @@ const TiXmlNode* TiXmlNode::FirstChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -372,7 +372,7 @@ TiXmlNode* TiXmlNode::FirstChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -384,7 +384,7 @@ const TiXmlNode* TiXmlNode::LastChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::LastChild(const char * _value) @@ -395,7 +395,7 @@ TiXmlNode* TiXmlNode::LastChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::IterateChildren(const TiXmlNode* previous) const @@ -458,7 +458,7 @@ const TiXmlNode* TiXmlNode::NextSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::NextSibling(const char * _value) @@ -469,7 +469,7 @@ TiXmlNode* TiXmlNode::NextSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const @@ -480,7 +480,7 @@ const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) @@ -491,7 +491,7 @@ TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } void TiXmlElement::RemoveAttribute(const char * name) @@ -516,7 +516,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement() @@ -530,7 +530,7 @@ TiXmlElement* TiXmlNode::FirstChildElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const @@ -544,7 +544,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) @@ -558,7 +558,7 @@ TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement() const @@ -572,7 +572,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement() @@ -586,7 +586,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const @@ -600,7 +600,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) @@ -614,7 +614,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } @@ -627,7 +627,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlDocument* TiXmlNode::GetDocument() @@ -639,13 +639,13 @@ TiXmlDocument* TiXmlNode::GetDocument() if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlElement::TiXmlElement (const char * _value) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; value = _value; } @@ -663,7 +663,7 @@ TiXmlElement::TiXmlElement(const std::string& _value) TiXmlElement::TiXmlElement(const TiXmlElement& copy) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; copy.CopyTo(this); } @@ -701,7 +701,7 @@ const char * TiXmlElement::Attribute(const char * name) const if (node) return node->Value(); - return 0; + return nullptr; } @@ -801,7 +801,7 @@ void TiXmlElement::SetAttribute(const char * cname, const char * cvalue) else { TiXmlDocument* document = GetDocument(); - if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN); + if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); } } @@ -965,7 +965,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const // Element class: // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; + const TiXmlAttribute* attribute = nullptr; for ( attribute = attributeSet.First(); attribute; attribute = attribute->Next()) @@ -973,7 +973,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const target->SetAttribute(attribute->Name(), attribute->Value()); } - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -985,7 +985,7 @@ TiXmlNode* TiXmlElement::Clone() const { TiXmlElement* clone = new TiXmlElement(Value()); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1001,7 +1001,7 @@ const char* TiXmlElement::GetText() const return childText->Value(); } } - return 0; + return nullptr; } @@ -1120,7 +1120,7 @@ bool TiXmlDocument::LoadFile(const char* filename, TiXmlEncoding encoding) } else { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } } @@ -1129,7 +1129,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) { if (!file) { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1146,7 +1146,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) // Strange case, but good to handle up front. if (length == 0) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1181,7 +1181,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) if (fread(buf, length, 1, file) != 1) { delete [] buf; - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1229,9 +1229,9 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) data.append(lastPos, p-lastPos); } delete [] buf; - buf = 0; + buf = nullptr; - Parse(data.c_str(), 0, encoding); + Parse(data.c_str(), nullptr, encoding); if ( Error()) return false; @@ -1278,7 +1278,7 @@ void TiXmlDocument::CopyTo(TiXmlDocument* target) const target->error = error; target->errorDesc = errorDesc.c_str (); - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -1290,7 +1290,7 @@ TiXmlNode* TiXmlDocument::Clone() const { TiXmlDocument* clone = new TiXmlDocument(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1342,7 +1342,7 @@ const TiXmlAttribute* TiXmlAttribute::Next() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1351,7 +1351,7 @@ TiXmlAttribute* TiXmlAttribute::Next() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1360,7 +1360,7 @@ const TiXmlAttribute* TiXmlAttribute::Previous() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1369,7 +1369,7 @@ TiXmlAttribute* TiXmlAttribute::Previous() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1494,7 +1494,7 @@ TiXmlNode* TiXmlComment::Clone() const TiXmlComment* clone = new TiXmlComment(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1558,11 +1558,11 @@ void TiXmlText::CopyTo(TiXmlText* target) const TiXmlNode* TiXmlText::Clone() const { - TiXmlText* clone = 0; + TiXmlText* clone = nullptr; clone = new TiXmlText(""); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1667,7 +1667,7 @@ TiXmlNode* TiXmlDeclaration::Clone() const TiXmlDeclaration* clone = new TiXmlDeclaration(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1704,7 +1704,7 @@ TiXmlNode* TiXmlUnknown::Clone() const TiXmlUnknown* clone = new TiXmlUnknown(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1746,8 +1746,8 @@ void TiXmlAttributeSet::Remove(TiXmlAttribute* removeMe) { node->prev->next = node->next; node->next->prev = node->prev; - node->next = 0; - node->prev = 0; + node->next = nullptr; + node->prev = nullptr; return; } } @@ -1763,7 +1763,7 @@ const TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) const if (node->name == name) return node; } - return 0; + return nullptr; } TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) @@ -1775,7 +1775,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) if (node->name == name) return node; } - return 0; + return nullptr; } #ifdef TIXML_USE_STL @@ -1818,7 +1818,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1830,7 +1830,7 @@ TiXmlHandle TiXmlHandle::FirstChild(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1842,7 +1842,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1854,7 +1854,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1873,7 +1873,7 @@ TiXmlHandle TiXmlHandle::Child(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1892,7 +1892,7 @@ TiXmlHandle TiXmlHandle::Child(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1911,7 +1911,7 @@ TiXmlHandle TiXmlHandle::ChildElement(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1930,5 +1930,5 @@ TiXmlHandle TiXmlHandle::ChildElement(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp index 2c7a65bec9..eb5e97134e 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp @@ -303,7 +303,7 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding) const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding) { if (!p || !*p) { - return 0; + return nullptr; } if (encoding == TIXML_ENCODING_UTF8) { while (*p) { @@ -400,7 +400,7 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin } return p; } - return 0; + return nullptr; } const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlEncoding encoding) @@ -417,12 +417,12 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*(p + 2) == 'x') { // Hexadecimal. - if (!*(p + 3)) return 0; + if (!*(p + 3)) return nullptr; const char* q = p + 3; q = strchr(q, ';'); - if (!q || !*q) return 0; + if (!q || !*q) return nullptr; delta = q - p; --q; @@ -435,19 +435,19 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE else if (*q >= 'A' && *q <= 'F') ucs += mult * (*q - 'A' + 10); else - return 0; + return nullptr; mult *= 16; --q; } } else { // Decimal. - if (!*(p + 2)) return 0; + if (!*(p + 2)) return nullptr; const char* q = p + 2; q = strchr(q, ';'); - if (!q || !*q) return 0; + if (!q || !*q) return nullptr; delta = q - p; --q; @@ -456,7 +456,7 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*q >= '0' && *q <= '9') ucs += mult * (*q - '0'); else - return 0; + return nullptr; mult *= 10; --q; } @@ -646,8 +646,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // contains nothing but other tags, most of what happens // here is skipping white space. if (!p || !*p) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } // Note that, for a document, this needs to come @@ -678,8 +678,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm p = SkipWhiteSpace(p, encoding); if (!p) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } while (p && *p) { @@ -714,8 +714,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // Was this empty? if (!firstChild) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, encoding); + return nullptr; } // All is well. @@ -743,18 +743,18 @@ void TiXmlDocument::SetError(int err, const char* pError, TiXmlParsingData* data TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) { - TiXmlNode* returnNode = 0; + TiXmlNode* returnNode = nullptr; p = SkipWhiteSpace(p, encoding); if (!p || !*p || *p != '<') { - return 0; + return nullptr; } TiXmlDocument* doc = GetDocument(); p = SkipWhiteSpace(p, encoding); if (!p || !*p) { - return 0; + return nullptr; } // What is this thing? @@ -815,7 +815,7 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) } else { if (doc) - doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN); + doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); } return returnNode; } @@ -944,8 +944,8 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlDocument* document = GetDocument(); if (!p || !*p) { - if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, nullptr, nullptr, encoding); + return nullptr; } if (data) { @@ -955,7 +955,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (*p != '<') { if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding); - return 0; + return nullptr; } p = SkipWhiteSpace(p + 1, encoding); @@ -966,7 +966,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = ReadName(p, &value, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding); - return 0; + return nullptr; } TIXML_STRING endTag("SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding); - return 0; + return nullptr; } if (*p == '/') { ++p; // Empty tag. if (*p != '>') { if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding); - return 0; + return nullptr; } return (p + 1); } @@ -998,7 +998,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco ++p; p = ReadValue(p, data, encoding); // Note this is an Element method, and will set the error if one happens. if (!p || !*p) - return 0; + return nullptr; // We should find the end tag now if (StringEqual(p, endTag.c_str(), false, encoding)) { @@ -1007,7 +1007,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } else { if (document) document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding); - return 0; + return nullptr; } } else { @@ -1015,7 +1015,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlAttribute* attrib = new TiXmlAttribute(); if (!attrib) { if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding); - return 0; + return nullptr; } attrib->SetDocument(document); @@ -1025,7 +1025,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding); delete attrib; - return 0; + return nullptr; } // Handle the strange case of double attributes: @@ -1033,7 +1033,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (node) { node->SetValue(attrib->Value()); delete attrib; - return 0; + return nullptr; } attributeSet.Add(attrib); @@ -1057,8 +1057,8 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml TiXmlText* textNode = new TiXmlText(""); if (!textNode) { - if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, encoding); + return nullptr; } if (TiXmlBase::IsWhiteSpaceCondensed()) { @@ -1089,7 +1089,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml LinkEndChild(node); } else { - return 0; + return nullptr; } } } @@ -1098,7 +1098,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml } if (!p) { - if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding); + if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, nullptr, nullptr, encoding); } return p; } @@ -1137,7 +1137,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } if (!p || !*p || *p != '<') { if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding); - return 0; + return nullptr; } ++p; value = ""; @@ -1148,7 +1148,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } if (!p) { - if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding); + if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, nullptr, nullptr, encoding); } if (*p == '>') return p + 1; @@ -1196,7 +1196,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!StringEqual(p, startTag, false, encoding)) { document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding); - return 0; + return nullptr; } p += mir_strlen(startTag); p = ReadText(p, &value, false, endTag, false, encoding); @@ -1207,7 +1207,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding) { p = SkipWhiteSpace(p, encoding); - if (!p || !*p) return 0; + if (!p || !*p) return nullptr; // int tabsize = 4; // if (document) @@ -1222,19 +1222,19 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn p = ReadName(p, &name, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding); - return 0; + return nullptr; } p = SkipWhiteSpace(p, encoding); if (!p || !*p || *p != '=') { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } ++p; // skip '=' p = SkipWhiteSpace(p, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } const char* end; @@ -1265,7 +1265,7 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn // We did not have an opening quote but seem to have a // closing one. Give up and throw an error. if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } value += *p; ++p; @@ -1332,7 +1332,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin if (!StringEqual(p, startTag, false, encoding)) { document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding); - return 0; + return nullptr; } p += mir_strlen(startTag); @@ -1355,7 +1355,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin p = ReadText(p, &value, ignoreWhite, end, false, encoding); if (p) return p - 1; // don't truncate the '<' - return 0; + return nullptr; } } @@ -1387,8 +1387,8 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml // the stuff in-between. TiXmlDocument* document = GetDocument(); if (!p || !*p || !StringEqual(p, "SetError(TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, nullptr, nullptr, _encoding); + return nullptr; } if (data) { data->Stamp(p, _encoding); @@ -1428,7 +1428,7 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml ++p; } } - return 0; + return nullptr; } bool TiXmlText::Blank() const -- cgit v1.2.3