From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/AVS/src/acc.cpp | 58 +-- plugins/AVS/src/cache.cpp | 32 +- plugins/AVS/src/image_utils.cpp | 44 +-- plugins/AVS/src/main.cpp | 40 +-- plugins/AVS/src/options.cpp | 54 +-- plugins/AVS/src/poll.cpp | 12 +- plugins/AVS/src/services.cpp | 84 ++--- plugins/AVS/src/utils.cpp | 30 +- plugins/AddContactPlus/src/addcontact.cpp | 22 +- plugins/AddContactPlus/src/main.cpp | 10 +- plugins/AdvaImg/src/main.cpp | 46 +-- plugins/Alarms/src/alarm_win.cpp | 22 +- plugins/Alarms/src/alarmlist.cpp | 16 +- plugins/Alarms/src/alarms.cpp | 10 +- plugins/Alarms/src/frame.cpp | 54 +-- plugins/Alarms/src/options.cpp | 12 +- plugins/AsSingleWindow/src/AsSingleWindow.cpp | 2 +- plugins/AssocMgr/src/assoclist.cpp | 154 ++++---- plugins/AssocMgr/src/dde.cpp | 40 +-- plugins/AssocMgr/src/reg.cpp | 218 +++++------ plugins/AssocMgr/src/utils.cpp | 38 +- plugins/AuthState/src/main.cpp | 2 +- plugins/AutoRun/src/main.cpp | 6 +- plugins/AutoShutdown/src/cpuusage.cpp | 22 +- plugins/AutoShutdown/src/frame.cpp | 106 +++--- plugins/AutoShutdown/src/options.cpp | 4 +- plugins/AutoShutdown/src/settingsdlg.cpp | 38 +- plugins/AutoShutdown/src/shutdownsvc.cpp | 48 +-- plugins/AutoShutdown/src/utils.cpp | 34 +- plugins/AutoShutdown/src/watcher.cpp | 36 +- plugins/AvatarHistory/src/AvatarDlg.cpp | 18 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 20 +- plugins/AvatarHistory/src/icolib.cpp | 2 +- plugins/AvatarHistory/src/options.cpp | 10 +- plugins/AvatarHistory/src/popup.cpp | 16 +- plugins/AvatarHistory/src/utils.cpp | 26 +- plugins/BASS_interface/src/Main.cpp | 46 +-- plugins/BasicHistory/src/BasicHistory.cpp | 30 +- plugins/BasicHistory/src/BinaryExport.cpp | 6 +- plugins/BasicHistory/src/DatExport.cpp | 4 +- plugins/BasicHistory/src/EventList.cpp | 28 +- plugins/BasicHistory/src/ExportManager.cpp | 20 +- plugins/BasicHistory/src/HistoryWindow.cpp | 118 +++--- plugins/BasicHistory/src/ImageDataObject.cpp | 20 +- plugins/BasicHistory/src/Options.cpp | 48 +-- plugins/BasicHistory/src/PlainHtmlExport.cpp | 2 +- plugins/BasicHistory/src/RichHtmlExport.cpp | 32 +- plugins/BasicHistory/src/Scheduler.cpp | 142 ++++---- plugins/BasicHistory/src/Searcher.cpp | 2 +- plugins/Boltun/src/Engine/Mind.cpp | 2 +- plugins/Boltun/src/actionQueue.cpp | 12 +- plugins/Boltun/src/boltun.cpp | 22 +- plugins/BossKeyPlus/src/BossKey.cpp | 42 +-- plugins/BossKeyPlus/src/BossKeyIdle.cpp | 4 +- plugins/BossKeyPlus/src/Options.cpp | 8 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 22 +- plugins/BuddyExpectator/src/options.cpp | 20 +- plugins/BuddyPounce/src/dialog.cpp | 24 +- plugins/BuddyPounce/src/main.cpp | 12 +- plugins/CSList/src/cslist.cpp | 46 +-- plugins/ChangeKeyboardLayout/src/hook_events.cpp | 8 +- plugins/ChangeKeyboardLayout/src/options.cpp | 4 +- .../ChangeKeyboardLayout/src/text_operations.cpp | 48 +-- plugins/ClientChangeNotify/src/CString.cpp | 2 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 8 +- plugins/ClientChangeNotify/src/OptDlg.cpp | 12 +- plugins/ClientChangeNotify/src/Options.cpp | 30 +- plugins/ClientChangeNotify/src/pcre.cpp | 8 +- plugins/Clist_blind/src/clcopts.cpp | 2 +- plugins/Clist_blind/src/clcpaint.cpp | 12 +- plugins/Clist_blind/src/clistopts.cpp | 4 +- plugins/Clist_blind/src/cluiopts.cpp | 14 +- plugins/Clist_blind/src/contact.cpp | 2 +- plugins/Clist_blind/src/init.cpp | 58 +-- plugins/Clist_modern/src/cluiframes.cpp | 72 ++-- plugins/Clist_modern/src/init.cpp | 4 +- plugins/Clist_modern/src/modern_aniavatars.cpp | 4 +- plugins/Clist_modern/src/modern_awaymsg.cpp | 4 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 6 +- plugins/Clist_modern/src/modern_clcidents.cpp | 2 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 6 +- plugins/Clist_modern/src/modern_clistevents.cpp | 4 +- plugins/Clist_modern/src/modern_clistmod.cpp | 4 +- plugins/Clist_modern/src/modern_clisttray.cpp | 2 +- plugins/Clist_modern/src/modern_clui.cpp | 24 +- plugins/Clist_modern/src/modern_docking.cpp | 4 +- plugins/Clist_modern/src/modern_global.cpp | 2 +- plugins/Clist_modern/src/modern_newrowopts.cpp | 2 +- .../Clist_modern/src/modern_rowheight_funcs.cpp | 2 +- plugins/Clist_modern/src/modern_skinbutton.cpp | 24 +- plugins/Clist_modern/src/modern_skinengine.cpp | 18 +- plugins/Clist_modern/src/modern_skinopt.cpp | 12 +- plugins/Clist_modern/src/modern_skinselector.cpp | 6 +- plugins/Clist_modern/src/modern_statusbar.cpp | 6 +- .../Clist_modern/src/modern_statusbar_options.cpp | 4 +- plugins/Clist_modern/src/modern_toolbar.cpp | 2 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 28 +- plugins/Clist_nicer/src/CLCButton.cpp | 72 ++-- plugins/Clist_nicer/src/Docking.cpp | 4 +- plugins/Clist_nicer/src/alphablend.cpp | 14 +- plugins/Clist_nicer/src/clc.cpp | 100 +++--- plugins/Clist_nicer/src/clcitems.cpp | 44 +-- plugins/Clist_nicer/src/clcmsgs.cpp | 16 +- plugins/Clist_nicer/src/clcopts.cpp | 6 +- plugins/Clist_nicer/src/clcpaint.cpp | 54 +-- plugins/Clist_nicer/src/clcutils.cpp | 34 +- plugins/Clist_nicer/src/clistevents.cpp | 24 +- plugins/Clist_nicer/src/clistmenus.cpp | 28 +- plugins/Clist_nicer/src/clistmod.cpp | 16 +- plugins/Clist_nicer/src/clistopts.cpp | 2 +- plugins/Clist_nicer/src/clisttray.cpp | 22 +- plugins/Clist_nicer/src/clnplus.cpp | 4 +- plugins/Clist_nicer/src/clui.cpp | 140 ++++---- plugins/Clist_nicer/src/cluiframes.cpp | 214 +++++------ plugins/Clist_nicer/src/cluiopts.cpp | 12 +- plugins/Clist_nicer/src/cluiservices.cpp | 20 +- plugins/Clist_nicer/src/config.cpp | 22 +- plugins/Clist_nicer/src/contact.cpp | 12 +- plugins/Clist_nicer/src/coolsblib.cpp | 22 +- plugins/Clist_nicer/src/coolscroll.cpp | 22 +- plugins/Clist_nicer/src/extBackg.cpp | 100 +++--- plugins/Clist_nicer/src/groupmenu.cpp | 6 +- plugins/Clist_nicer/src/init.cpp | 4 +- plugins/Clist_nicer/src/rowheight_funcs.cpp | 16 +- plugins/Clist_nicer/src/statusbar.cpp | 4 +- plugins/Clist_nicer/src/viewmodes.cpp | 56 +-- plugins/Cln_skinedit/src/main.cpp | 16 +- plugins/CloudFile/src/Services/dropbox_service.cpp | 4 +- plugins/CloudFile/src/Services/google_service.cpp | 8 +- .../CloudFile/src/Services/microsoft_service.cpp | 8 +- plugins/CloudFile/src/Services/yandex_service.cpp | 8 +- plugins/CloudFile/src/cloud_service.cpp | 4 +- plugins/CloudFile/src/icons.cpp | 6 +- plugins/CloudFile/src/srmm.cpp | 2 +- plugins/CloudFile/src/utils.cpp | 6 +- plugins/CmdLine/src/CmdLine.cpp | 2 +- plugins/CmdLine/src/hooked_events.cpp | 2 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 46 +-- plugins/CmdLine/src/mimcmd_ipc.cpp | 32 +- plugins/CmdLine/src/services.cpp | 6 +- plugins/CmdLine/src/utils.cpp | 18 +- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 86 ++--- plugins/ConnectionNotify/src/filter.cpp | 30 +- plugins/ConnectionNotify/src/netstat.cpp | 22 +- plugins/Console/src/Console.cpp | 60 ++-- plugins/Console/src/init.cpp | 2 +- plugins/ContactsPlus/src/main.cpp | 6 +- plugins/ContactsPlus/src/receive.cpp | 18 +- plugins/ContactsPlus/src/send.cpp | 26 +- plugins/ContactsPlus/src/utils.cpp | 16 +- plugins/CountryFlags/src/icons.cpp | 62 ++-- plugins/CountryFlags/src/ip2country.cpp | 16 +- plugins/CountryFlags/src/utils.cpp | 16 +- plugins/CrashDumper/src/crshdmp.cpp | 14 +- plugins/CrashDumper/src/crshdmp_icons.cpp | 4 +- plugins/CrashDumper/src/dumper.cpp | 84 ++--- plugins/CrashDumper/src/exhndlr.cpp | 24 +- plugins/CrashDumper/src/ui.cpp | 16 +- plugins/CrashDumper/src/upload.cpp | 4 +- plugins/CrashDumper/src/utils.cpp | 28 +- plugins/CryptoPP/src/base16.cpp | 2 +- plugins/CryptoPP/src/cpp_cntx.cpp | 4 +- plugins/CryptoPP/src/cpp_gpgw.cpp | 14 +- plugins/CryptoPP/src/cpp_keys.cpp | 4 +- plugins/CryptoPP/src/cpp_misc.cpp | 10 +- plugins/CryptoPP/src/cpp_pgpw.cpp | 16 +- plugins/CryptoPP/src/cpp_rsam.cpp | 48 +-- plugins/CryptoPP/src/cpp_rsau.cpp | 2 +- plugins/CryptoPP/src/cpp_svcs.cpp | 44 +-- plugins/CryptoPP/src/main.cpp | 16 +- plugins/CryptoPP/src/mmi.cpp | 4 +- plugins/CryptoPP/src/utf8.cpp | 18 +- plugins/CyrTranslit/src/MirandaContact.cpp | 4 +- plugins/CyrTranslit/src/TransliterationMap.cpp | 2 +- plugins/Db3x_mmap/src/database.cpp | 4 +- plugins/Db3x_mmap/src/dbcrypt.cpp | 2 +- plugins/Db3x_mmap/src/dbsettings.cpp | 8 +- plugins/Db3x_mmap/src/ui.cpp | 4 +- plugins/DbChecker/src/main.cpp | 4 +- plugins/DbChecker/src/openerror.cpp | 2 +- plugins/DbChecker/src/progress.cpp | 28 +- plugins/DbChecker/src/selectdb.cpp | 26 +- plugins/DbChecker/src/welcome.cpp | 4 +- plugins/DbChecker/src/wizard.cpp | 26 +- plugins/DbChecker/src/worker.cpp | 18 +- plugins/DbEditorPP/src/copymodule.cpp | 8 +- plugins/DbEditorPP/src/deletemodule.cpp | 8 +- plugins/DbEditorPP/src/exportimport.cpp | 32 +- plugins/DbEditorPP/src/findwindow.cpp | 18 +- plugins/DbEditorPP/src/icons.cpp | 6 +- plugins/DbEditorPP/src/main.cpp | 12 +- plugins/DbEditorPP/src/main_window.cpp | 20 +- plugins/DbEditorPP/src/modsettingenum.cpp | 28 +- plugins/DbEditorPP/src/moduletree.cpp | 36 +- plugins/DbEditorPP/src/options.cpp | 2 +- plugins/DbEditorPP/src/renamemodule.cpp | 2 +- plugins/DbEditorPP/src/settinglist.cpp | 42 +-- plugins/DbEditorPP/src/settingsdlg.cpp | 4 +- plugins/DbEditorPP/src/watchedvars.cpp | 24 +- plugins/Db_autobackups/src/backup.cpp | 42 +-- plugins/Db_autobackups/src/main.cpp | 6 +- plugins/Db_autobackups/src/options.cpp | 18 +- plugins/Db_autobackups/src/zip.cpp | 6 +- plugins/Dropbox/src/dropbox.cpp | 2 +- plugins/Dropbox/src/dropbox_commands.cpp | 8 +- plugins/Dropbox/src/dropbox_icons.cpp | 4 +- plugins/Dropbox/src/dropbox_menus.cpp | 2 +- plugins/Dropbox/src/dropbox_options.cpp | 4 +- plugins/Dropbox/src/dropbox_services.cpp | 14 +- plugins/Dropbox/src/dropbox_transfers.cpp | 2 +- plugins/Dropbox/src/dropbox_utils.cpp | 10 +- plugins/Exchange/src/MirandaExchange.cpp | 234 ++++++------ plugins/Exchange/src/dlg_handlers.cpp | 12 +- plugins/Exchange/src/emails.cpp | 12 +- plugins/Exchange/src/exchange.cpp | 4 +- plugins/Exchange/src/hooked_events.cpp | 14 +- plugins/Exchange/src/utils.cpp | 4 +- plugins/FTPFileYM/src/dbentry.cpp | 12 +- plugins/FTPFileYM/src/deletetimer.cpp | 12 +- plugins/FTPFileYM/src/dialog.cpp | 24 +- plugins/FTPFileYM/src/ftpfile.cpp | 12 +- plugins/FTPFileYM/src/job_delete.cpp | 6 +- plugins/FTPFileYM/src/job_generic.cpp | 6 +- plugins/FTPFileYM/src/job_packer.cpp | 14 +- plugins/FTPFileYM/src/job_upload.cpp | 26 +- plugins/FTPFileYM/src/manager.cpp | 24 +- plugins/FTPFileYM/src/options.cpp | 8 +- plugins/FTPFileYM/src/serverlist.cpp | 4 +- plugins/FTPFileYM/src/utils.cpp | 8 +- plugins/FavContacts/src/contact_cache.cpp | 16 +- plugins/FavContacts/src/cserver.cpp | 2 +- plugins/FavContacts/src/main.cpp | 2 +- plugins/FavContacts/src/menu.cpp | 28 +- plugins/FavContacts/src/options.cpp | 14 +- plugins/FavContacts/src/services.cpp | 6 +- plugins/FileAsMessage/src/dialog.cpp | 64 ++-- plugins/FileAsMessage/src/main.cpp | 16 +- plugins/FingerprintNG/src/fingerprint.cpp | 106 +++--- plugins/FingerprintNG/src/main.cpp | 2 +- plugins/FloatingContacts/src/bitmap_funcs.cpp | 46 +-- plugins/FloatingContacts/src/filedrop.cpp | 40 +-- plugins/FloatingContacts/src/main.cpp | 66 ++-- plugins/FloatingContacts/src/options.cpp | 4 +- plugins/FloatingContacts/src/thumbs.cpp | 74 ++-- plugins/Folders/src/dlg_handlers.cpp | 10 +- plugins/Folders/src/events.cpp | 2 +- plugins/Folders/src/folderItem.cpp | 10 +- plugins/Folders/src/services.cpp | 2 +- plugins/GmailNotifier/src/check.cpp | 22 +- plugins/GmailNotifier/src/main.cpp | 4 +- plugins/GmailNotifier/src/notify.cpp | 24 +- plugins/GmailNotifier/src/options.cpp | 10 +- plugins/GmailNotifier/src/utility.cpp | 12 +- plugins/HTTPServer/src/FileShareNode.cpp | 12 +- plugins/HTTPServer/src/GuiElements.cpp | 44 +-- plugins/HTTPServer/src/HttpUser.cpp | 22 +- plugins/HTTPServer/src/IndexHTML.cpp | 32 +- plugins/HTTPServer/src/IndexXML.cpp | 38 +- plugins/HTTPServer/src/MimeHandling.cpp | 42 +-- plugins/HTTPServer/src/main.cpp | 88 ++--- plugins/HistoryLinkListPlus/src/linklist.cpp | 24 +- plugins/HistoryLinkListPlus/src/linklist_dlg.cpp | 52 +-- plugins/HistoryLinkListPlus/src/linklist_fct.cpp | 64 ++-- plugins/HistoryStats/src/bandctrlimpl.cpp | 74 ++-- plugins/HistoryStats/src/canvas.cpp | 14 +- plugins/HistoryStats/src/colbase_words.cpp | 6 +- plugins/HistoryStats/src/column.cpp | 4 +- plugins/HistoryStats/src/column_chatduration.cpp | 6 +- plugins/HistoryStats/src/column_events.cpp | 2 +- plugins/HistoryStats/src/column_inout.cpp | 6 +- plugins/HistoryStats/src/column_inoutgraph.cpp | 14 +- plugins/HistoryStats/src/column_nick.cpp | 4 +- plugins/HistoryStats/src/column_split.cpp | 14 +- plugins/HistoryStats/src/column_splittimeline.cpp | 16 +- plugins/HistoryStats/src/column_timeline.cpp | 14 +- plugins/HistoryStats/src/column_wordcount.cpp | 8 +- plugins/HistoryStats/src/column_words.cpp | 18 +- plugins/HistoryStats/src/contact.cpp | 2 +- plugins/HistoryStats/src/dlgconfigure.cpp | 12 +- plugins/HistoryStats/src/dlgfilterwords.cpp | 10 +- plugins/HistoryStats/src/dlgoption.cpp | 10 +- plugins/HistoryStats/src/dlgoption_subbase.cpp | 2 +- plugins/HistoryStats/src/dlgoption_subcolumns.cpp | 40 +-- plugins/HistoryStats/src/dlgoption_subexclude.cpp | 4 +- plugins/HistoryStats/src/dlgoption_subglobal.cpp | 34 +- plugins/HistoryStats/src/dlgoption_subinput.cpp | 40 +-- plugins/HistoryStats/src/dlgoption_suboutput.cpp | 78 ++-- plugins/HistoryStats/src/iconlib.cpp | 18 +- plugins/HistoryStats/src/main.cpp | 30 +- plugins/HistoryStats/src/mirandacontact.cpp | 12 +- plugins/HistoryStats/src/mu_common.cpp | 22 +- plugins/HistoryStats/src/optionsctrlimpl.cpp | 54 +-- .../HistoryStats/src/optionsctrlimpl_button.cpp | 8 +- plugins/HistoryStats/src/optionsctrlimpl_color.cpp | 10 +- plugins/HistoryStats/src/optionsctrlimpl_combo.cpp | 8 +- .../HistoryStats/src/optionsctrlimpl_datetime.cpp | 8 +- plugins/HistoryStats/src/optionsctrlimpl_edit.cpp | 8 +- plugins/HistoryStats/src/optionsctrlimpl_item.cpp | 2 +- plugins/HistoryStats/src/settings.cpp | 8 +- plugins/HistoryStats/src/settingstree.cpp | 8 +- plugins/HistoryStats/src/statistic.cpp | 86 ++--- plugins/HistoryStats/src/utils.cpp | 18 +- .../src/historysweeperlight.cpp | 12 +- plugins/HistorySweeperLight/src/options.cpp | 6 +- plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp | 2 +- plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp | 2 +- plugins/IEHistory/src/IEHistory.cpp | 8 +- plugins/IEHistory/src/dlgHandlers.cpp | 18 +- plugins/IEHistory/src/services.cpp | 6 +- plugins/IEHistory/src/utils.cpp | 8 +- plugins/IEView/src/ChatHTMLBuilder.cpp | 12 +- plugins/IEView/src/HTMLBuilder.cpp | 76 ++-- plugins/IEView/src/HistoryHTMLBuilder.cpp | 16 +- plugins/IEView/src/IEView.cpp | 152 ++++---- plugins/IEView/src/MUCCHTMLBuilder.cpp | 14 +- plugins/IEView/src/Options.cpp | 110 +++--- plugins/IEView/src/ScriverHTMLBuilder.cpp | 20 +- plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 24 +- plugins/IEView/src/Template.cpp | 60 ++-- plugins/IEView/src/TemplateHTMLBuilder.cpp | 106 +++--- plugins/IEView/src/TextToken.cpp | 68 ++-- plugins/IEView/src/Utils.cpp | 8 +- plugins/IEView/src/external_funcs.cpp | 4 +- plugins/IEView/src/ieview_main.cpp | 2 +- plugins/IEView/src/ieview_services.cpp | 14 +- plugins/IgnoreState/src/main.cpp | 8 +- plugins/IgnoreState/src/options.cpp | 4 +- plugins/Import/src/import.cpp | 76 ++-- plugins/Import/src/main.cpp | 6 +- plugins/Import/src/miranda.cpp | 8 +- plugins/Import/src/utils.cpp | 6 +- plugins/Import/src/wizard.cpp | 6 +- plugins/KeyboardNotify/src/EnumProc.cpp | 2 +- plugins/KeyboardNotify/src/flash.cpp | 2 +- plugins/KeyboardNotify/src/ignore.cpp | 10 +- plugins/KeyboardNotify/src/keyboard.cpp | 6 +- plugins/KeyboardNotify/src/main.cpp | 58 +-- plugins/KeyboardNotify/src/options.cpp | 22 +- plugins/ListeningTo/src/listeningto.cpp | 94 ++--- plugins/ListeningTo/src/main.cpp | 2 +- plugins/ListeningTo/src/music.cpp | 4 +- plugins/ListeningTo/src/options.cpp | 16 +- plugins/ListeningTo/src/players/generic.cpp | 40 +-- plugins/ListeningTo/src/players/itunes.cpp | 26 +- plugins/ListeningTo/src/players/player.cpp | 36 +- plugins/ListeningTo/src/players/watrack.cpp | 18 +- plugins/ListeningTo/src/players/wmp.cpp | 34 +- plugins/ListeningTo/src/variables.cpp | 4 +- plugins/LotusNotify/src/LotusNotify.cpp | 56 +-- plugins/LotusNotify/src/debug.cpp | 2 +- plugins/LotusNotify/src/lotusnotes.cpp | 2 +- plugins/MenuItemEx/src/images.cpp | 28 +- plugins/MenuItemEx/src/main.cpp | 78 ++-- plugins/MessageState/src/clist_extra.cpp | 2 +- plugins/MimCmd/src/MimCmd.cpp | 2 +- plugins/MimCmd/src/commands.cpp | 18 +- .../src/MirFoxCommons/MirFoxCommons_logger.cpp | 4 +- .../MirFoxCommons_messageQueueBySM.cpp | 6 +- .../MirFoxCommons/MirFoxCommons_sharedMemory.cpp | 4 +- plugins/MirFox/src/MirandaOptions.cpp | 12 +- plugins/MirFox/src/MirandaUtils.cpp | 66 ++-- plugins/MirFox/src/MirfoxData.cpp | 32 +- plugins/MirFox/src/MirfoxMiranda.cpp | 18 +- plugins/MirLua/Modules/WinAPI/src/winapi.cpp | 90 ++--- plugins/MirLua/Modules/m_popup/src/main.cpp | 6 +- plugins/MirLua/Modules/m_schedule/src/main.cpp | 52 +-- plugins/MirLua/Modules/m_toptoolbar/src/main.cpp | 4 +- plugins/MirLua/Modules/m_variables/src/main.cpp | 4 +- plugins/MirLua/src/m_chat.cpp | 2 +- plugins/MirLua/src/m_clist.cpp | 2 +- plugins/MirLua/src/m_core.cpp | 28 +- plugins/MirLua/src/m_database.cpp | 20 +- plugins/MirLua/src/m_genmenu.cpp | 2 +- plugins/MirLua/src/m_hotkeys.cpp | 8 +- plugins/MirLua/src/m_http.cpp | 14 +- plugins/MirLua/src/m_icolib.cpp | 8 +- plugins/MirLua/src/m_json.cpp | 6 +- plugins/MirLua/src/m_message.cpp | 4 +- plugins/MirLua/src/m_options.cpp | 2 +- plugins/MirLua/src/m_protocols.cpp | 12 +- plugins/MirLua/src/m_sounds.cpp | 2 +- plugins/MirLua/src/m_srmm.cpp | 2 +- plugins/MirLua/src/main.cpp | 4 +- plugins/MirLua/src/mlua.cpp | 8 +- plugins/MirLua/src/mlua_enviroment.cpp | 2 +- plugins/MirLua/src/mlua_icons.cpp | 4 +- plugins/MirLua/src/mlua_options.cpp | 8 +- plugins/MirLua/src/mlua_utils.cpp | 2 +- plugins/MirOTR/src/dbfilter.cpp | 28 +- plugins/MirOTR/src/dialogs.cpp | 26 +- plugins/MirOTR/src/dllmain.cpp | 2 +- plugins/MirOTR/src/entities.cpp | 6 +- plugins/MirOTR/src/mirotrmenu.cpp | 16 +- plugins/MirOTR/src/options.cpp | 18 +- plugins/MirOTR/src/otr.cpp | 24 +- plugins/MirOTR/src/striphtml.cpp | 4 +- plugins/MirOTR/src/svcs_proto.cpp | 14 +- plugins/MirOTR/src/svcs_srmm.cpp | 2 +- plugins/MirOTR/src/utils.cpp | 34 +- plugins/MirandaG15/src/CAppletManager.cpp | 40 +-- plugins/MirandaG15/src/CChatScreen.cpp | 8 +- plugins/MirandaG15/src/CConfig.cpp | 10 +- plugins/MirandaG15/src/CContactList.cpp | 58 +-- plugins/MirandaG15/src/CEventScreen.cpp | 2 +- plugins/MirandaG15/src/CNotificationScreen.cpp | 10 +- plugins/MirandaG15/src/CScreen.cpp | 6 +- plugins/MirandaG15/src/LCDFramework/CLCDBitmap.cpp | 4 +- .../MirandaG15/src/LCDFramework/CLCDConnection.cpp | 6 +- .../src/LCDFramework/CLCDConnectionLogitech.cpp | 64 ++-- plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp | 90 ++--- plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp | 24 +- plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp | 4 +- .../src/LCDFramework/CLCDOutputManager.cpp | 32 +- plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp | 8 +- .../MirandaG15/src/LCDFramework/CLCDTextLog.cpp | 10 +- .../MirandaG15/src/LCDFramework/CLCDTextObject.cpp | 8 +- plugins/MirandaG15/src/LCDFramework/ConStream.cpp | Bin 3638 -> 3650 bytes plugins/MirandaG15/src/LCDFramework/misc.cpp | 20 +- plugins/MirandaG15/src/Miranda.cpp | 2 +- plugins/MobileState/src/main.cpp | 2 +- plugins/MsgPopup/src/main.cpp | 8 +- plugins/MsgPopup/src/options.cpp | 8 +- plugins/Msg_Export/src/FileViewer.cpp | 64 ++-- plugins/Msg_Export/src/main.cpp | 6 +- plugins/Msg_Export/src/options.cpp | 16 +- plugins/Msg_Export/src/utils.cpp | 68 ++-- plugins/MyDetails/src/data.cpp | 30 +- plugins/MyDetails/src/frame.cpp | 254 ++++++------- plugins/MyDetails/src/mydetails.cpp | 4 +- plugins/MyDetails/src/services.cpp | 40 +-- plugins/NewAwaySysMod/src/AwayOpt.cpp | 6 +- plugins/NewAwaySysMod/src/AwaySys.cpp | 8 +- plugins/NewAwaySysMod/src/Client.cpp | 8 +- plugins/NewAwaySysMod/src/ContactList.cpp | 32 +- plugins/NewAwaySysMod/src/GroupCheckbox.cpp | 22 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 6 +- plugins/NewAwaySysMod/src/MsgTree.cpp | 34 +- plugins/NewAwaySysMod/src/Options.cpp | 8 +- plugins/NewAwaySysMod/src/Properties.cpp | 4 +- plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 6 +- plugins/NewAwaySysMod/src/Services.cpp | 2 +- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 44 +-- plugins/NewEventNotify/src/main.cpp | 2 +- plugins/NewEventNotify/src/options.cpp | 10 +- plugins/NewEventNotify/src/popup.cpp | 36 +- plugins/NewXstatusNotify/src/indsnd.cpp | 18 +- plugins/NewXstatusNotify/src/main.cpp | 86 ++--- plugins/NewXstatusNotify/src/options.cpp | 16 +- plugins/NewXstatusNotify/src/popup.cpp | 18 +- plugins/NewXstatusNotify/src/utils.cpp | 10 +- plugins/NewXstatusNotify/src/xstatus.cpp | 38 +- plugins/New_GPG/src/icons.cpp | 2 +- plugins/New_GPG/src/init.cpp | 8 +- plugins/New_GPG/src/jabber_account.cpp | 4 +- plugins/New_GPG/src/log.cpp | 2 +- plugins/New_GPG/src/main.cpp | 162 ++++----- plugins/New_GPG/src/messages.cpp | 26 +- plugins/New_GPG/src/options.cpp | 52 +-- plugins/New_GPG/src/utilities.cpp | 80 ++--- plugins/NewsAggregator/Src/Authentication.cpp | 2 +- plugins/NewsAggregator/Src/CheckFeed.cpp | 68 ++-- plugins/NewsAggregator/Src/ExportImport.cpp | 34 +- plugins/NewsAggregator/Src/Icons.cpp | 2 +- plugins/NewsAggregator/Src/Menus.cpp | 4 +- plugins/NewsAggregator/Src/NewsAggregator.cpp | 8 +- plugins/NewsAggregator/Src/Options.cpp | 16 +- plugins/NewsAggregator/Src/Services.cpp | 24 +- plugins/NewsAggregator/Src/Update.cpp | 32 +- plugins/NewsAggregator/Src/Utils.cpp | 52 +-- plugins/NoHistory/src/dllmain.cpp | 6 +- plugins/NoHistory/src/options.cpp | 8 +- plugins/Non-IM Contact/src/contactinfo.cpp | 10 +- plugins/Non-IM Contact/src/dialog.cpp | 22 +- plugins/Non-IM Contact/src/files.cpp | 6 +- plugins/Non-IM Contact/src/main.cpp | 4 +- plugins/Non-IM Contact/src/namereplacing.cpp | 32 +- plugins/Non-IM Contact/src/timer.cpp | 4 +- plugins/NotesAndReminders/src/hotkeys.cpp | 16 +- plugins/NotesAndReminders/src/main.cpp | 32 +- plugins/NotesAndReminders/src/miscutils.cpp | 12 +- plugins/NotesAndReminders/src/notes.cpp | 170 ++++----- plugins/NotesAndReminders/src/options.cpp | 28 +- plugins/NotesAndReminders/src/reminders.cpp | 110 +++--- plugins/NotifyAnything/src/main.cpp | 32 +- plugins/NotifyAnything/src/options.cpp | 2 +- plugins/Nudge/src/main.cpp | 22 +- plugins/Nudge/src/options.cpp | 12 +- plugins/Nudge/src/shake.cpp | 24 +- plugins/OpenFolder/src/openFolder.cpp | 8 +- plugins/OpenSSL/src/ssl_openssl.cpp | 60 ++-- plugins/PackUpdater/Src/Events.cpp | 6 +- plugins/PackUpdater/Src/Notifications.cpp | 54 +-- plugins/PackUpdater/Src/Options.cpp | 4 +- plugins/PackUpdater/Src/PackUpdater.cpp | 6 +- plugins/PackUpdater/Src/Utils.cpp | 62 ++-- plugins/PasteIt/src/Options.cpp | 10 +- plugins/PasteIt/src/PasteIt.cpp | 30 +- plugins/PasteIt/src/PasteToWeb.cpp | 56 +-- plugins/PasteIt/src/PasteToWeb1.cpp | 6 +- plugins/PasteIt/src/PasteToWeb2.cpp | 30 +- plugins/Ping/src/icmp.cpp | 12 +- plugins/Ping/src/log.cpp | 4 +- plugins/Ping/src/options.cpp | 4 +- plugins/Ping/src/ping.cpp | 6 +- plugins/Ping/src/pinggraph.cpp | 44 +-- plugins/Ping/src/pingthread.cpp | 68 ++-- plugins/Ping/src/rawping.cpp | 4 +- plugins/Ping/src/utils.cpp | 6 +- plugins/PluginUpdater/pu_stub/pu_stub.cpp | 12 +- plugins/PluginUpdater/src/DlgListNew.cpp | 38 +- plugins/PluginUpdater/src/DlgUpdate.cpp | 112 +++--- plugins/PluginUpdater/src/Events.cpp | 4 +- plugins/PluginUpdater/src/Notifications.cpp | 6 +- plugins/PluginUpdater/src/Options.cpp | 4 +- plugins/PluginUpdater/src/PluginUpdater.cpp | 2 +- plugins/PluginUpdater/src/Services.cpp | 6 +- plugins/PluginUpdater/src/Utils.cpp | 78 ++-- plugins/PluginUpdater/src/checksum.cpp | 10 +- plugins/PluginUpdater/src/unzipfile.cpp | 10 +- plugins/Popup/src/avatars_gif.cpp | 10 +- plugins/Popup/src/avatars_simple.cpp | 4 +- plugins/Popup/src/bitmap_funcs.cpp | 44 +-- plugins/Popup/src/font.cpp | 2 +- plugins/Popup/src/history.cpp | 36 +- plugins/Popup/src/icons.cpp | 4 +- plugins/Popup/src/main.cpp | 26 +- plugins/Popup/src/notifications.cpp | 10 +- plugins/Popup/src/opt_adv.cpp | 38 +- plugins/Popup/src/opt_class.cpp | 16 +- plugins/Popup/src/opt_contacts.cpp | 2 +- plugins/Popup/src/opt_gen.cpp | 30 +- plugins/Popup/src/opt_skins.cpp | 48 +-- plugins/Popup/src/opttree.cpp | 14 +- plugins/Popup/src/popup_gdiplus.cpp | 14 +- plugins/Popup/src/popup_thread.cpp | 26 +- plugins/Popup/src/popup_wnd2.cpp | 104 +++--- plugins/Popup/src/services.cpp | 14 +- plugins/Popup/src/skin.cpp | 54 +-- plugins/Popup/src/srmm_menu.cpp | 4 +- plugins/ProfileManager/src/pmanagerEx.cpp | 16 +- plugins/QuickContacts/src/options.cpp | 22 +- plugins/QuickContacts/src/quickcontacts.cpp | 42 +-- plugins/QuickMessages/src/Utils.cpp | 42 +-- plugins/QuickMessages/src/main.cpp | 20 +- plugins/QuickMessages/src/options.cpp | 108 +++--- plugins/QuickReplies/src/events.cpp | 6 +- plugins/QuickReplies/src/options.cpp | 2 +- plugins/QuickReplies/src/quickreplies.cpp | 2 +- plugins/Quotes/src/ComHelper.cpp | 4 +- plugins/Quotes/src/CommonOptionDlg.cpp | 2 +- plugins/Quotes/src/CurrencyConverter.cpp | 12 +- plugins/Quotes/src/DBUtils.cpp | 8 +- plugins/Quotes/src/ExtraImages.cpp | 2 +- plugins/Quotes/src/Forex.cpp | 20 +- plugins/Quotes/src/HTMLParserMS.cpp | 8 +- plugins/Quotes/src/HTTPSession.cpp | 12 +- plugins/Quotes/src/IconLib.cpp | 4 +- plugins/Quotes/src/ImportExport.cpp | 6 +- plugins/Quotes/src/Locale.cpp | 6 +- plugins/Quotes/src/ModuleInfo.cpp | 6 +- plugins/Quotes/src/OptionDukasCopy.cpp | 4 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 10 +- plugins/Quotes/src/QuotesProviderBase.cpp | 10 +- plugins/Quotes/src/QuotesProviderGoogle.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogleFinance.cpp | 2 +- .../Quotes/src/QuotesProviderVisitorDbSettings.cpp | 48 +-- plugins/Quotes/src/QuotesProviders.cpp | 2 +- plugins/Quotes/src/SettingsDlg.cpp | 6 +- plugins/Quotes/src/XMLEngineMI.cpp | 6 +- plugins/Rate/src/main.cpp | 6 +- plugins/RecentContacts/src/RecentContacts.cpp | 36 +- plugins/RemovePersonalSettings/src/rps.cpp | 50 +-- plugins/SMS/src/SMS_svc.cpp | 4 +- plugins/SMS/src/functions.cpp | 12 +- plugins/SMS/src/main.cpp | 8 +- plugins/SMS/src/options.cpp | 2 +- plugins/SMS/src/receive.cpp | 24 +- plugins/SMS/src/recvdlg.cpp | 40 +-- plugins/SMS/src/send.cpp | 8 +- plugins/SMS/src/senddlg.cpp | 96 ++--- plugins/Scriver/src/chat_options.cpp | 18 +- plugins/Scriver/src/chat_window.cpp | 10 +- plugins/Scriver/src/infobar.cpp | 8 +- plugins/Scriver/src/msgdialog.cpp | 12 +- plugins/Scriver/src/msgs.cpp | 2 +- plugins/Scriver/src/tabs.cpp | 10 +- plugins/SecureIM/src/commonheaders.cpp | 8 +- plugins/SecureIM/src/crypt_check.cpp | 8 +- plugins/SecureIM/src/crypt_dll.cpp | 4 +- plugins/SecureIM/src/crypt_icons.cpp | 6 +- plugins/SecureIM/src/crypt_lists.cpp | 20 +- plugins/SecureIM/src/crypt_misc.cpp | 8 +- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SecureIM/src/images.cpp | 40 +-- plugins/SecureIM/src/loadicons.cpp | 18 +- plugins/SecureIM/src/loadlib.cpp | 4 +- plugins/SecureIM/src/main.cpp | 8 +- plugins/SecureIM/src/mmi.cpp | 8 +- plugins/SecureIM/src/options.cpp | 44 +-- plugins/SecureIM/src/splitmsg.cpp | 6 +- plugins/SecureIM/src/svcs_clist.cpp | 10 +- plugins/SecureIM/src/svcs_menu.cpp | 14 +- plugins/SecureIM/src/svcs_proto.cpp | 26 +- plugins/SecureIM/src/svcs_rsa.cpp | 10 +- plugins/SeenPlugin/src/file.cpp | 2 +- plugins/SeenPlugin/src/history.cpp | 14 +- plugins/SeenPlugin/src/main.cpp | 4 +- plugins/SeenPlugin/src/menu.cpp | 6 +- plugins/SeenPlugin/src/missed.cpp | 12 +- plugins/SeenPlugin/src/options.cpp | 12 +- plugins/SeenPlugin/src/userinfo.cpp | 2 +- plugins/SeenPlugin/src/utils.cpp | 26 +- plugins/SendScreenshotPlus/src/CSend.cpp | 66 ++-- plugins/SendScreenshotPlus/src/CSendEmail.cpp | 20 +- plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 8 +- .../src/CSendHost_ImageShack.cpp | 4 +- plugins/SendScreenshotPlus/src/Main.cpp | 38 +- plugins/SendScreenshotPlus/src/UAboutForm.cpp | 4 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 84 ++--- plugins/SendScreenshotPlus/src/Utils.cpp | 30 +- plugins/SendScreenshotPlus/src/ctrl_button.cpp | 66 ++-- plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 10 +- plugins/Sessions/Src/Main.cpp | 68 ++-- plugins/Sessions/Src/Options.cpp | 32 +- plugins/Sessions/Src/Utils.cpp | 8 +- plugins/ShellExt/src/main.cpp | 22 +- plugins/ShellExt/src/options.cpp | 2 +- plugins/ShellExt/src/shlcom.cpp | 60 ++-- plugins/ShellExt/src/shlext.cpp | 154 ++++---- plugins/ShellExt/src/shlfactory.cpp | 8 +- plugins/ShellExt/src/shlicons.cpp | 16 +- plugins/ShellExt/src/shlipc.cpp | 38 +- plugins/SimpleAR/src/Main.cpp | 20 +- plugins/SimpleAR/src/Options.cpp | 6 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 36 +- plugins/SimpleStatusMsg/src/main.cpp | 154 ++++---- plugins/SimpleStatusMsg/src/msgbox.cpp | 78 ++-- plugins/SimpleStatusMsg/src/options.cpp | 58 +-- plugins/SimpleStatusMsg/src/utils.cpp | 6 +- plugins/SkypeStatusChange/src/main.cpp | 26 +- plugins/SkypeStatusChange/src/options.cpp | 4 +- plugins/SmileyAdd/src/AniSmileyObject.cpp | 20 +- plugins/SmileyAdd/src/SmileyBase.cpp | 52 +-- plugins/SmileyAdd/src/anim.cpp | 8 +- plugins/SmileyAdd/src/customsmiley.cpp | 8 +- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 10 +- plugins/SmileyAdd/src/download.cpp | 12 +- plugins/SmileyAdd/src/general.cpp | 14 +- plugins/SmileyAdd/src/imagecache.cpp | 96 ++--- plugins/SmileyAdd/src/options.cpp | 26 +- plugins/SmileyAdd/src/regexp/WCPattern.cpp | 44 +-- plugins/SmileyAdd/src/richcall.cpp | 22 +- plugins/SmileyAdd/src/services.cpp | 56 +-- plugins/SmileyAdd/src/smileyroutines.cpp | 48 +-- plugins/SmileyAdd/src/smileys.cpp | 94 ++--- plugins/SmileyAdd/src/smltool.cpp | 32 +- plugins/Spamotron/src/bayes.cpp | 96 ++--- plugins/Spamotron/src/options.cpp | 8 +- plugins/Spamotron/src/popups.cpp | 12 +- plugins/Spamotron/src/spamotron.cpp | 40 +-- plugins/Spamotron/src/utils.cpp | 126 +++---- plugins/SpellChecker/src/RichEdit.cpp | 38 +- plugins/SpellChecker/src/ardialog.cpp | 10 +- plugins/SpellChecker/src/autoreplace.cpp | 16 +- plugins/SpellChecker/src/dictionary.cpp | 64 ++-- plugins/SpellChecker/src/options.cpp | 4 +- plugins/SpellChecker/src/spellchecker.cpp | 24 +- plugins/SpellChecker/src/utils.cpp | 124 +++---- plugins/SplashScreen/src/bitmap_funcs.cpp | 40 +-- plugins/SplashScreen/src/main.cpp | 14 +- plugins/SplashScreen/src/options.cpp | 8 +- plugins/SplashScreen/src/services.cpp | 2 +- plugins/SplashScreen/src/splash.cpp | 40 +-- plugins/StartupSilence/src/main.cpp | 22 +- .../src/AdvancedAutoAway/advancedautoaway.cpp | 4 +- .../StatusManager/src/KeepStatus/keepstatus.cpp | 6 +- .../StatusManager/src/StartupStatus/ss_options.cpp | 2 +- .../src/StartupStatus/ss_profiles.cpp | 2 +- .../src/StartupStatus/ss_toolbars.cpp | 2 +- plugins/StatusManager/src/commonstatus.cpp | 4 +- plugins/StatusManager/src/confirmdialog.cpp | 2 +- plugins/StopSpamMod/src/init.cpp | 4 +- plugins/StopSpamMod/src/options.cpp | 4 +- plugins/StopSpamMod/src/utilities.cpp | 10 +- plugins/StopSpamPlus/src/events.cpp | 2 +- plugins/StopSpamPlus/src/opt_proto.cpp | 4 +- plugins/StopSpamPlus/src/options.cpp | 4 +- plugins/StopSpamPlus/src/services.cpp | 10 +- plugins/TabSRMM/src/TSButton.cpp | 36 +- plugins/TabSRMM/src/buttonsbar.cpp | 6 +- plugins/TabSRMM/src/chat_log.cpp | 2 +- plugins/TabSRMM/src/chat_main.cpp | 4 +- plugins/TabSRMM/src/chat_options.cpp | 14 +- plugins/TabSRMM/src/chat_tools.cpp | 8 +- plugins/TabSRMM/src/chat_window.cpp | 32 +- plugins/TabSRMM/src/contactcache.cpp | 34 +- plugins/TabSRMM/src/container.cpp | 86 ++--- plugins/TabSRMM/src/containeroptions.cpp | 8 +- plugins/TabSRMM/src/controls.cpp | 68 ++-- plugins/TabSRMM/src/eventpopups.cpp | 32 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 46 +-- plugins/TabSRMM/src/globals.cpp | 24 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 76 ++-- plugins/TabSRMM/src/infopanel.cpp | 74 ++-- plugins/TabSRMM/src/mim.cpp | 56 +-- plugins/TabSRMM/src/modplus.cpp | 4 +- plugins/TabSRMM/src/msgdialog.cpp | 64 ++-- plugins/TabSRMM/src/msgdlgutils.cpp | 28 +- plugins/TabSRMM/src/msglog.cpp | 10 +- plugins/TabSRMM/src/msgoptions.cpp | 20 +- plugins/TabSRMM/src/msgs.cpp | 38 +- plugins/TabSRMM/src/muchighlight.cpp | 18 +- plugins/TabSRMM/src/selectcontainer.cpp | 8 +- plugins/TabSRMM/src/sendlater.cpp | 32 +- plugins/TabSRMM/src/sendqueue.cpp | 16 +- plugins/TabSRMM/src/sidebar.cpp | 60 ++-- plugins/TabSRMM/src/srmm.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 34 +- plugins/TabSRMM/src/taskbar.cpp | 44 +-- plugins/TabSRMM/src/templates.cpp | 2 +- plugins/TabSRMM/src/themeio.cpp | 20 +- plugins/TabSRMM/src/themes.cpp | 148 ++++---- plugins/TabSRMM/src/translator.cpp | 4 +- plugins/TabSRMM/src/trayicon.cpp | 32 +- plugins/TabSRMM/src/typingnotify.cpp | 4 +- plugins/TabSRMM/src/userprefs.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 46 +-- plugins/TipperYM/src/bitmap_func.cpp | 34 +- plugins/TipperYM/src/message_pump.cpp | 50 +-- plugins/TipperYM/src/mir_smileys.cpp | 32 +- plugins/TipperYM/src/options.cpp | 66 ++-- plugins/TipperYM/src/popwin.cpp | 138 +++---- plugins/TipperYM/src/preset_items.cpp | 112 +++--- plugins/TipperYM/src/skin_parser.cpp | 10 +- plugins/TipperYM/src/str_utils.cpp | 24 +- plugins/TipperYM/src/subst.cpp | 74 ++-- plugins/TipperYM/src/tipper.cpp | 8 +- plugins/TipperYM/src/translations.cpp | 66 ++-- plugins/Toaster/src/main.cpp | 10 +- plugins/Toaster/src/services.cpp | 10 +- plugins/Toaster/src/toast_notification.cpp | 12 +- plugins/Toaster/src/utils.cpp | 2 +- plugins/TooltipNotify/src/Tooltip.cpp | 16 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 26 +- plugins/TooltipNotify/src/main.cpp | 16 +- plugins/TopToolBar/src/InternalButtons.cpp | 14 +- plugins/TopToolBar/src/toolbar.cpp | 70 ++-- plugins/TopToolBar/src/toolbarwnd.cpp | 22 +- plugins/TopToolBar/src/topbutton.cpp | 6 +- plugins/TopToolBar/src/ttbopt.cpp | 44 +-- plugins/TrafficCounter/src/TrafficCounter.cpp | 50 +-- plugins/TrafficCounter/src/misc.cpp | 2 +- plugins/TrafficCounter/src/options.cpp | 98 ++--- plugins/TrafficCounter/src/opttree.cpp | 14 +- plugins/TrafficCounter/src/statistics.cpp | 30 +- plugins/TrafficCounter/src/vars.cpp | 26 +- plugins/TranslitSwitcher/src/Layoutproc.cpp | 28 +- plugins/TranslitSwitcher/src/TranslitSwitcher.cpp | 2 +- plugins/UserGuide/src/main.cpp | 6 +- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 4 +- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 58 +-- plugins/UserInfoEx/src/classMAnnivDate.cpp | 16 +- plugins/UserInfoEx/src/classMTime.cpp | 12 +- plugins/UserInfoEx/src/classPsTree.cpp | 66 ++-- plugins/UserInfoEx/src/classPsTreeItem.cpp | 42 +-- plugins/UserInfoEx/src/commonheaders.cpp | 12 +- plugins/UserInfoEx/src/ctrl_annivedit.cpp | 26 +- plugins/UserInfoEx/src/ctrl_button.cpp | 60 ++-- plugins/UserInfoEx/src/ctrl_combo.cpp | 6 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 56 +-- plugins/UserInfoEx/src/ctrl_edit.cpp | 20 +- plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 6 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 36 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 10 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 80 ++--- .../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 ++--- plugins/UserInfoEx/src/init.cpp | 4 +- plugins/UserInfoEx/src/mir_contactqueue.cpp | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 26 +- plugins/UserInfoEx/src/mir_icolib.cpp | 12 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 60 ++-- plugins/UserInfoEx/src/mir_string.cpp | 18 +- plugins/UserInfoEx/src/psp_anniversary.cpp | 8 +- plugins/UserInfoEx/src/psp_options.cpp | 2 +- plugins/UserInfoEx/src/psp_origin.cpp | 4 +- plugins/UserInfoEx/src/psp_profile.cpp | 52 +-- plugins/UserInfoEx/src/svc_avatar.cpp | 4 +- plugins/UserInfoEx/src/svc_constants.cpp | 400 ++++++++++----------- plugins/UserInfoEx/src/svc_email.cpp | 34 +- plugins/UserInfoEx/src/svc_gender.cpp | 18 +- plugins/UserInfoEx/src/svc_homepage.cpp | 28 +- plugins/UserInfoEx/src/svc_phone.cpp | 22 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 42 +-- plugins/UserInfoEx/src/svc_reminder.cpp | 40 +-- plugins/UserInfoEx/src/svc_timezone.cpp | 4 +- plugins/Variables/src/contact.cpp | 38 +- plugins/Variables/src/help.cpp | 162 ++++----- plugins/Variables/src/lookup3.cpp | 6 +- plugins/Variables/src/options.cpp | 14 +- plugins/Variables/src/parse_alias.cpp | 40 +-- plugins/Variables/src/parse_external.cpp | 42 +-- plugins/Variables/src/parse_inet.cpp | 22 +- plugins/Variables/src/parse_logic.cpp | 46 +-- plugins/Variables/src/parse_math.cpp | 38 +- plugins/Variables/src/parse_metacontacts.cpp | 24 +- plugins/Variables/src/parse_miranda.cpp | 142 ++++---- plugins/Variables/src/parse_regexp.cpp | 18 +- plugins/Variables/src/parse_str.cpp | 192 +++++----- plugins/Variables/src/parse_system.cpp | 254 ++++++------- plugins/Variables/src/parse_variables.cpp | 24 +- plugins/Variables/src/tokenregister.cpp | 60 ++-- plugins/Variables/src/variables.cpp | 56 +-- plugins/Watrack_MPD/src/main.cpp | 34 +- plugins/Watrack_MPD/src/options.cpp | 4 +- plugins/Weather/src/weather.cpp | 16 +- plugins/Weather/src/weather_addstn.cpp | 28 +- plugins/Weather/src/weather_contacts.cpp | 28 +- plugins/Weather/src/weather_conv.cpp | 64 ++-- plugins/Weather/src/weather_data.cpp | 14 +- plugins/Weather/src/weather_http.cpp | 14 +- plugins/Weather/src/weather_icons.cpp | 4 +- plugins/Weather/src/weather_info.cpp | 18 +- plugins/Weather/src/weather_ini.cpp | 62 ++-- plugins/Weather/src/weather_mwin.cpp | 36 +- plugins/Weather/src/weather_opt.cpp | 34 +- plugins/Weather/src/weather_popup.cpp | 14 +- plugins/Weather/src/weather_svcs.cpp | 10 +- plugins/Weather/src/weather_update.cpp | 42 +-- plugins/Weather/src/weather_userinfo.cpp | 10 +- plugins/WebView/src/main.cpp | 14 +- plugins/WebView/src/webview.cpp | 20 +- plugins/WebView/src/webview_alerts.cpp | 42 +-- plugins/WebView/src/webview_cleanup.cpp | 52 +-- plugins/WebView/src/webview_datawnd.cpp | 16 +- plugins/WebView/src/webview_getdata.cpp | 14 +- plugins/WebView/src/webview_opts.cpp | 92 ++--- plugins/WebView/src/webview_services.cpp | 40 +-- plugins/WhenWasIt/src/WhenWasIt.cpp | 8 +- plugins/WhenWasIt/src/birthdays.cpp | 6 +- plugins/WhenWasIt/src/date_utils.cpp | 2 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 46 +-- plugins/WhenWasIt/src/hooked_events.cpp | 10 +- plugins/WhenWasIt/src/icons.cpp | 6 +- plugins/WhenWasIt/src/notifiers.cpp | 4 +- plugins/WhenWasIt/src/services.cpp | 10 +- plugins/WhenWasIt/src/utils.cpp | 12 +- plugins/WhoUsesMyFiles/src/list.cpp | 16 +- plugins/WhoUsesMyFiles/src/wumf.cpp | 36 +- plugins/WhoUsesMyFiles/src/wumfplug.cpp | 50 +-- plugins/WinterSpeak/src/AnnounceDialog.cpp | 6 +- plugins/WinterSpeak/src/DialogConfigActive.cpp | 12 +- plugins/WinterSpeak/src/DialogConfigEngine.cpp | 6 +- plugins/WinterSpeak/src/MirandaDialog.cpp | 2 +- plugins/WinterSpeak/src/ProtocolInformation.cpp | 14 +- plugins/WinterSpeak/src/SpeakConfig.cpp | 2 +- plugins/WinterSpeak/src/SpeechApi40a.cpp | 28 +- plugins/WinterSpeak/src/SpeechApi40aLexicon.cpp | 4 +- plugins/WinterSpeak/src/SpeechApi51.cpp | 24 +- plugins/WinterSpeak/src/SpeechApi51Lexicon.cpp | 2 +- plugins/WinterSpeak/src/SpeechInterface.cpp | 2 +- plugins/WinterSpeak/src/UserInformation.cpp | 4 +- plugins/WinterSpeak/src/main.cpp | 8 +- plugins/XSoundNotify/src/dialog.cpp | 18 +- plugins/XSoundNotify/src/options.cpp | 24 +- plugins/XSoundNotify/src/xsn_main.cpp | 10 +- plugins/YAMN/src/account.cpp | 186 +++++----- plugins/YAMN/src/browser/badconnect.cpp | 34 +- plugins/YAMN/src/browser/mailbrowser.cpp | 250 ++++++------- plugins/YAMN/src/debug.cpp | 8 +- plugins/YAMN/src/filterplugin.cpp | 32 +- plugins/YAMN/src/mails/decode.cpp | 20 +- plugins/YAMN/src/mails/mails.cpp | 96 ++--- plugins/YAMN/src/mails/mime.cpp | 114 +++--- plugins/YAMN/src/main.cpp | 48 +-- plugins/YAMN/src/proto/netlib.cpp | 18 +- plugins/YAMN/src/proto/pop3/pop3.cpp | 16 +- plugins/YAMN/src/proto/pop3/pop3comm.cpp | 250 ++++++------- plugins/YAMN/src/proto/pop3/pop3opt.cpp | 130 +++---- plugins/YAMN/src/protoplugin.cpp | 42 +-- plugins/YAMN/src/services.cpp | 52 +-- plugins/YAMN/src/synchro.cpp | 38 +- plugins/YAMN/src/yamn.cpp | 34 +- plugins/YAPP/src/message_pump.cpp | 12 +- plugins/YAPP/src/options.cpp | 6 +- plugins/YAPP/src/popwin.cpp | 54 +-- plugins/YAPP/src/services.cpp | 30 +- plugins/YAPP/src/yapp.cpp | 8 +- plugins/YAPP/src/yapp_history.cpp | 6 +- plugins/YAPP/src/yapp_history_dlg.cpp | 20 +- plugins/YARelay/src/main.cpp | 2 +- plugins/YARelay/src/options.cpp | 4 +- plugins/ZeroNotification/src/main.cpp | 2 +- plugins/ZeroSwitch/src/ZeroSwitch.cpp | 24 +- plugins/helpers/gen_helpers.cpp | 2 +- plugins/mTextControl/src/FormattedTextDraw.cpp | 24 +- plugins/mTextControl/src/ImageDataObjectHlp.cpp | 24 +- plugins/mTextControl/src/dataobject.cpp | 10 +- plugins/mTextControl/src/enumformat.cpp | 8 +- plugins/mTextControl/src/fancy_rtf.cpp | 20 +- plugins/mTextControl/src/main.cpp | 8 +- plugins/mTextControl/src/richeditutils.cpp | 22 +- plugins/mTextControl/src/services.cpp | 16 +- plugins/mTextControl/src/textcontrol.cpp | 16 +- plugins/mTextControl/src/textusers.cpp | 8 +- plugins/wbOSD/src/events.cpp | 2 +- plugins/wbOSD/src/main.cpp | 2 +- plugins/wbOSD/src/options.cpp | 22 +- plugins/wbOSD/src/wbOSD.cpp | 24 +- protocols/AimOscar/src/avatars.cpp | 12 +- protocols/AimOscar/src/away.cpp | 8 +- protocols/AimOscar/src/chat.cpp | 20 +- protocols/AimOscar/src/client.cpp | 28 +- protocols/AimOscar/src/connection.cpp | 46 +-- protocols/AimOscar/src/conv.cpp | 50 +-- protocols/AimOscar/src/direct_connect.cpp | 2 +- protocols/AimOscar/src/file.cpp | 14 +- protocols/AimOscar/src/links.cpp | 24 +- protocols/AimOscar/src/popup.cpp | 12 +- protocols/AimOscar/src/proto.cpp | 42 +-- protocols/AimOscar/src/server.cpp | 92 ++--- protocols/AimOscar/src/services.cpp | 36 +- protocols/AimOscar/src/theme.cpp | 6 +- protocols/AimOscar/src/thread.cpp | 4 +- protocols/AimOscar/src/tlv.cpp | 6 +- protocols/AimOscar/src/ui.cpp | 72 ++-- protocols/AimOscar/src/utility.cpp | 50 +-- protocols/Discord/src/dispatch.cpp | 6 +- protocols/Discord/src/guilds.cpp | 4 +- protocols/Discord/src/menus.cpp | 4 +- protocols/Discord/src/utils.cpp | 2 +- protocols/Dummy/src/dummy_proto.cpp | 8 +- protocols/EmLanProto/src/amdproto.cpp | 6 +- protocols/EmLanProto/src/lan.cpp | 14 +- protocols/EmLanProto/src/mlan.cpp | 80 ++--- protocols/FacebookRM/src/avatars.cpp | 8 +- protocols/FacebookRM/src/captcha.cpp | 6 +- protocols/FacebookRM/src/chat.cpp | 16 +- protocols/FacebookRM/src/communication.cpp | 24 +- protocols/FacebookRM/src/connection.cpp | 40 +-- protocols/FacebookRM/src/contacts.cpp | 22 +- protocols/FacebookRM/src/dialogs.cpp | 8 +- protocols/FacebookRM/src/events.cpp | 18 +- protocols/FacebookRM/src/json.cpp | 10 +- protocols/FacebookRM/src/main.cpp | 2 +- protocols/FacebookRM/src/messages.cpp | 12 +- protocols/FacebookRM/src/process.cpp | 28 +- protocols/FacebookRM/src/proto.cpp | 54 +-- protocols/FacebookRM/src/theme.cpp | 6 +- protocols/Gadu-Gadu/src/avatar.cpp | 42 +-- protocols/Gadu-Gadu/src/core.cpp | 112 +++--- protocols/Gadu-Gadu/src/dialogs.cpp | 26 +- protocols/Gadu-Gadu/src/dynstuff.cpp | 24 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 50 +-- protocols/Gadu-Gadu/src/gg.cpp | 18 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 28 +- protocols/Gadu-Gadu/src/groupchat.cpp | 40 +-- protocols/Gadu-Gadu/src/icolib.cpp | 3 +- protocols/Gadu-Gadu/src/image.cpp | 86 ++--- protocols/Gadu-Gadu/src/import.cpp | 32 +- protocols/Gadu-Gadu/src/keepalive.cpp | 10 +- protocols/Gadu-Gadu/src/links.cpp | 18 +- protocols/Gadu-Gadu/src/oauth.cpp | 52 +-- protocols/Gadu-Gadu/src/ownerinfo.cpp | 4 +- protocols/Gadu-Gadu/src/popups.cpp | 16 +- protocols/Gadu-Gadu/src/services.cpp | 16 +- protocols/Gadu-Gadu/src/sessions.cpp | 18 +- protocols/Gadu-Gadu/src/token.cpp | 12 +- protocols/Gadu-Gadu/src/userutils.cpp | 50 +-- protocols/ICQCorp/src/corp.cpp | 8 +- protocols/ICQCorp/src/event.cpp | 8 +- protocols/ICQCorp/src/options.cpp | 4 +- protocols/ICQCorp/src/packet.cpp | 4 +- protocols/ICQCorp/src/protocol.cpp | 86 ++--- protocols/ICQCorp/src/services.cpp | 18 +- protocols/ICQCorp/src/socket.cpp | 2 +- protocols/ICQCorp/src/transfer.cpp | 34 +- protocols/ICQCorp/src/user.cpp | 16 +- protocols/IRCG/src/clist.cpp | 8 +- protocols/IRCG/src/commandmonitor.cpp | 160 ++++----- protocols/IRCG/src/input.cpp | 72 ++-- protocols/IRCG/src/irclib.cpp | 118 +++--- protocols/IRCG/src/ircproto.cpp | 52 +-- protocols/IRCG/src/main.cpp | 2 +- protocols/IRCG/src/options.cpp | 46 +-- protocols/IRCG/src/output.cpp | 6 +- protocols/IRCG/src/scripting.cpp | 8 +- protocols/IRCG/src/services.cpp | 28 +- protocols/IRCG/src/tools.cpp | 32 +- protocols/IRCG/src/userinfo.cpp | 6 +- protocols/IRCG/src/windows.cpp | 36 +- protocols/IcqOscarJ/src/capabilities.cpp | 2 +- protocols/IcqOscarJ/src/chan_04close.cpp | 18 +- protocols/IcqOscarJ/src/chan_05ping.cpp | 4 +- protocols/IcqOscarJ/src/constants.cpp | 2 +- protocols/IcqOscarJ/src/cookies.cpp | 8 +- protocols/IcqOscarJ/src/db.cpp | 4 +- protocols/IcqOscarJ/src/directpackets.cpp | 6 +- protocols/IcqOscarJ/src/dlgproc.cpp | 16 +- protocols/IcqOscarJ/src/editlist.cpp | 18 +- protocols/IcqOscarJ/src/editstring.cpp | 30 +- protocols/IcqOscarJ/src/fam_01service.cpp | 12 +- protocols/IcqOscarJ/src/fam_02location.cpp | 14 +- protocols/IcqOscarJ/src/fam_03buddy.cpp | 40 +-- protocols/IcqOscarJ/src/fam_04message.cpp | 76 ++-- protocols/IcqOscarJ/src/fam_0alookup.cpp | 4 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 78 ++-- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 36 +- protocols/IcqOscarJ/src/i18n.cpp | 48 +-- protocols/IcqOscarJ/src/icq_advsearch.cpp | 6 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 78 ++-- protocols/IcqOscarJ/src/icq_clients.cpp | 12 +- protocols/IcqOscarJ/src/icq_db.cpp | 8 +- protocols/IcqOscarJ/src/icq_direct.cpp | 26 +- protocols/IcqOscarJ/src/icq_directmsg.cpp | 14 +- protocols/IcqOscarJ/src/icq_fieldnames.cpp | 28 +- protocols/IcqOscarJ/src/icq_filerequests.cpp | 10 +- protocols/IcqOscarJ/src/icq_filetransfer.cpp | 16 +- protocols/IcqOscarJ/src/icq_http.cpp | 6 +- protocols/IcqOscarJ/src/icq_infoupdate.cpp | 16 +- protocols/IcqOscarJ/src/icq_menu.cpp | 12 +- protocols/IcqOscarJ/src/icq_opts.cpp | 16 +- protocols/IcqOscarJ/src/icq_packet.cpp | 8 +- protocols/IcqOscarJ/src/icq_popups.cpp | 16 +- protocols/IcqOscarJ/src/icq_proto.cpp | 90 ++--- protocols/IcqOscarJ/src/icq_rates.cpp | 8 +- protocols/IcqOscarJ/src/icq_server.cpp | 20 +- protocols/IcqOscarJ/src/icq_servlist.cpp | 106 +++--- protocols/IcqOscarJ/src/icq_uploadui.cpp | 44 +-- protocols/IcqOscarJ/src/icq_xstatus.cpp | 34 +- protocols/IcqOscarJ/src/icq_xtraz.cpp | 24 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 38 +- protocols/IcqOscarJ/src/init.cpp | 2 +- protocols/IcqOscarJ/src/log.cpp | 6 +- protocols/IcqOscarJ/src/loginpassword.cpp | 2 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 42 +-- protocols/IcqOscarJ/src/stdpackets.cpp | 70 ++-- protocols/IcqOscarJ/src/tlv.cpp | 26 +- protocols/IcqOscarJ/src/upload.cpp | 2 +- protocols/IcqOscarJ/src/userinfotab.cpp | 10 +- protocols/IcqOscarJ/src/utilities.cpp | 64 ++-- protocols/JabberG/src/jabber_chat.cpp | 8 +- protocols/JabberG/src/jabber_console.cpp | 8 +- protocols/JabberG/src/jabber_disco.cpp | 10 +- protocols/JabberG/src/jabber_events.cpp | 2 +- protocols/JabberG/src/jabber_filterlist.cpp | 6 +- protocols/JabberG/src/jabber_form.cpp | 18 +- protocols/JabberG/src/jabber_groupchat.cpp | 10 +- protocols/JabberG/src/jabber_icolib.cpp | 8 +- protocols/JabberG/src/jabber_iq.cpp | 2 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 6 +- protocols/JabberG/src/jabber_menu.cpp | 4 +- protocols/JabberG/src/jabber_misc.cpp | 2 +- protocols/JabberG/src/jabber_notes.cpp | 6 +- protocols/JabberG/src/jabber_omemo.cpp | 24 +- protocols/JabberG/src/jabber_opt.cpp | 6 +- protocols/JabberG/src/jabber_opttree.cpp | 4 +- protocols/JabberG/src/jabber_privacy.cpp | 10 +- protocols/JabberG/src/jabber_proto.cpp | 24 +- protocols/JabberG/src/jabber_rc.cpp | 2 +- protocols/JabberG/src/jabber_search.cpp | 14 +- protocols/JabberG/src/jabber_svc.cpp | 2 +- protocols/JabberG/src/jabber_userinfo.cpp | 8 +- protocols/JabberG/src/jabber_util.cpp | 2 +- protocols/JabberG/src/jabber_xml.cpp | 2 +- protocols/MRA/src/Mra.cpp | 2 +- protocols/MRA/src/MraAdvancedSearch.cpp | 8 +- protocols/MRA/src/MraAvatars.cpp | 48 +-- protocols/MRA/src/MraChat.cpp | 22 +- protocols/MRA/src/MraFilesQueue.cpp | 54 +-- protocols/MRA/src/MraIcons.cpp | 14 +- protocols/MRA/src/MraMPop.cpp | 12 +- protocols/MRA/src/MraMRIMProxy.cpp | 12 +- protocols/MRA/src/MraOfflineMsg.cpp | 14 +- protocols/MRA/src/MraPopUp.cpp | 22 +- protocols/MRA/src/MraProto.cpp | 34 +- protocols/MRA/src/MraRTFMsg.cpp | 8 +- protocols/MRA/src/MraSelectEMail.cpp | 2 +- protocols/MRA/src/MraSendQueue.cpp | 8 +- protocols/MRA/src/Mra_menus.cpp | 18 +- protocols/MRA/src/Mra_options.cpp | 8 +- protocols/MRA/src/Mra_proto.cpp | 68 ++-- protocols/MRA/src/Mra_svcs.cpp | 52 +-- protocols/MSN/src/msn.cpp | 2 +- protocols/MSN/src/msn_auth.cpp | 64 ++-- protocols/MSN/src/msn_avatar.cpp | 18 +- protocols/MSN/src/msn_chat.cpp | 36 +- protocols/MSN/src/msn_commands.cpp | 106 +++--- protocols/MSN/src/msn_contact.cpp | 8 +- protocols/MSN/src/msn_errors.cpp | 6 +- protocols/MSN/src/msn_http.cpp | 18 +- protocols/MSN/src/msn_ieembed.cpp | 40 +-- protocols/MSN/src/msn_libstr.cpp | 40 +-- protocols/MSN/src/msn_links.cpp | 24 +- protocols/MSN/src/msn_lists.cpp | 36 +- protocols/MSN/src/msn_mail.cpp | 38 +- protocols/MSN/src/msn_menu.cpp | 12 +- protocols/MSN/src/msn_mime.cpp | 22 +- protocols/MSN/src/msn_misc.cpp | 94 ++--- protocols/MSN/src/msn_msgsplit.cpp | 4 +- protocols/MSN/src/msn_opts.cpp | 12 +- protocols/MSN/src/msn_proto.cpp | 42 +-- protocols/MSN/src/msn_skypeab.cpp | 34 +- protocols/MSN/src/msn_soapab.cpp | 158 ++++---- protocols/MSN/src/msn_soapstore.cpp | 56 +-- protocols/MSN/src/msn_srv.cpp | 44 +-- protocols/MSN/src/msn_ssl.cpp | 12 +- protocols/MSN/src/msn_std.cpp | 2 +- protocols/MSN/src/msn_svcs.cpp | 40 +-- protocols/MSN/src/msn_threads.cpp | 58 +-- protocols/MinecraftDynmap/src/chat.cpp | 6 +- protocols/MinecraftDynmap/src/communication.cpp | 24 +- protocols/MinecraftDynmap/src/dialogs.cpp | 2 +- protocols/MinecraftDynmap/src/proto.cpp | 18 +- protocols/Omegle/src/chat.cpp | 44 +-- protocols/Omegle/src/communication.cpp | 42 +-- protocols/Omegle/src/connection.cpp | 22 +- protocols/Omegle/src/messages.cpp | 4 +- protocols/Omegle/src/proto.cpp | 14 +- protocols/Omegle/src/theme.cpp | 2 +- protocols/Sametime/src/conference.cpp | 18 +- protocols/Sametime/src/files.cpp | 38 +- protocols/Sametime/src/messaging.cpp | 8 +- protocols/Sametime/src/options.cpp | 6 +- protocols/Sametime/src/places.cpp | 2 +- protocols/Sametime/src/sametime.cpp | 6 +- protocols/Sametime/src/sametime_proto.cpp | 22 +- protocols/Sametime/src/sametime_session.cpp | 48 +-- protocols/Sametime/src/session_announce_win.cpp | 2 +- protocols/Sametime/src/userlist.cpp | 64 ++-- protocols/Sametime/src/utils.cpp | 6 +- protocols/SkypeWeb/src/main.cpp | 2 +- protocols/SkypeWeb/src/request_queue.cpp | 14 +- protocols/SkypeWeb/src/skype_accounts.cpp | 2 +- protocols/SkypeWeb/src/skype_avatars.cpp | 8 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 64 ++-- protocols/SkypeWeb/src/skype_contacts.cpp | 14 +- protocols/SkypeWeb/src/skype_db.cpp | 2 +- protocols/SkypeWeb/src/skype_dialogs.cpp | 4 +- protocols/SkypeWeb/src/skype_events.cpp | 24 +- protocols/SkypeWeb/src/skype_files.cpp | 2 +- protocols/SkypeWeb/src/skype_history_sync.cpp | 4 +- protocols/SkypeWeb/src/skype_icons.cpp | 4 +- protocols/SkypeWeb/src/skype_login.cpp | 16 +- protocols/SkypeWeb/src/skype_messages.cpp | 12 +- protocols/SkypeWeb/src/skype_mslogin.cpp | 10 +- protocols/SkypeWeb/src/skype_network.cpp | 2 +- protocols/SkypeWeb/src/skype_oauth.cpp | 6 +- protocols/SkypeWeb/src/skype_polling.cpp | 4 +- protocols/SkypeWeb/src/skype_popups.cpp | 2 +- protocols/SkypeWeb/src/skype_profile.cpp | 2 +- protocols/SkypeWeb/src/skype_proto.cpp | 8 +- protocols/SkypeWeb/src/skype_request.cpp | 2 +- protocols/SkypeWeb/src/skype_search.cpp | 2 +- protocols/SkypeWeb/src/skype_timers.cpp | 6 +- protocols/SkypeWeb/src/skype_trouter.cpp | 16 +- protocols/SkypeWeb/src/skype_utils.cpp | 18 +- protocols/Steam/src/request_queue.cpp | 18 +- protocols/Steam/src/steam_avatars.cpp | 4 +- protocols/Steam/src/steam_contacts.cpp | 56 +-- protocols/Steam/src/steam_dialogs.cpp | 10 +- protocols/Steam/src/steam_events.cpp | 2 +- protocols/Steam/src/steam_history.cpp | 6 +- protocols/Steam/src/steam_instances.cpp | 6 +- protocols/Steam/src/steam_login.cpp | 6 +- protocols/Steam/src/steam_menus.cpp | 4 +- protocols/Steam/src/steam_polling.cpp | 14 +- protocols/Steam/src/steam_proto.cpp | 14 +- protocols/Steam/src/steam_request.cpp | 6 +- protocols/Steam/src/steam_utils.cpp | 16 +- protocols/Steam/src/steam_xstatus.cpp | 6 +- protocols/Tlen/src/tlen.cpp | 26 +- protocols/Tlen/src/tlen_advsearch.cpp | 16 +- protocols/Tlen/src/tlen_avatar.cpp | 66 ++-- protocols/Tlen/src/tlen_file.cpp | 116 +++--- protocols/Tlen/src/tlen_iq.cpp | 12 +- protocols/Tlen/src/tlen_iqid.cpp | 162 ++++----- protocols/Tlen/src/tlen_list.cpp | 46 +-- protocols/Tlen/src/tlen_misc.cpp | 14 +- protocols/Tlen/src/tlen_muc.cpp | 22 +- protocols/Tlen/src/tlen_opt.cpp | 10 +- protocols/Tlen/src/tlen_p2p_new.cpp | 46 +-- protocols/Tlen/src/tlen_p2p_old.cpp | 90 ++--- protocols/Tlen/src/tlen_picture.cpp | 28 +- protocols/Tlen/src/tlen_presence.cpp | 60 ++-- protocols/Tlen/src/tlen_svc.cpp | 156 ++++---- protocols/Tlen/src/tlen_thread.cpp | 250 ++++++------- protocols/Tlen/src/tlen_userinfo.cpp | 28 +- protocols/Tlen/src/tlen_util.cpp | 60 ++-- protocols/Tlen/src/tlen_voice.cpp | 100 +++--- protocols/Tlen/src/tlen_ws.cpp | 14 +- protocols/Tlen/src/tlen_xml.cpp | 114 +++--- protocols/Tox/src/main.cpp | 4 +- protocols/Tox/src/tox_accounts.cpp | 2 +- protocols/Tox/src/tox_avatars.cpp | 12 +- protocols/Tox/src/tox_bootstrap.cpp | 10 +- protocols/Tox/src/tox_connection.cpp | 8 +- protocols/Tox/src/tox_contacts.cpp | 14 +- protocols/Tox/src/tox_icons.cpp | 2 +- protocols/Tox/src/tox_messages.cpp | 4 +- protocols/Tox/src/tox_multimedia.cpp | 10 +- protocols/Tox/src/tox_netlib.cpp | 2 +- protocols/Tox/src/tox_options.cpp | 28 +- protocols/Tox/src/tox_profile.cpp | 6 +- protocols/Tox/src/tox_proto.cpp | 10 +- protocols/Tox/src/tox_search.cpp | 10 +- protocols/Tox/src/tox_transfer.cpp | 40 +-- protocols/Tox/src/tox_utils.cpp | 8 +- protocols/Twitter/src/chat.cpp | 4 +- protocols/Twitter/src/connection.cpp | 10 +- protocols/Twitter/src/contacts.cpp | 6 +- protocols/Twitter/src/proto.cpp | 22 +- protocols/Twitter/src/theme.cpp | 6 +- protocols/Twitter/src/utility.cpp | 4 +- protocols/VKontakte/src/misc.cpp | 2 +- protocols/VKontakte/src/vk_captcha.cpp | 2 +- protocols/VKontakte/src/vk_files.cpp | 6 +- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/VKontakte/src/vk_status.cpp | 2 +- protocols/WhatsApp/src/WASocketConnection.cpp | 4 +- protocols/WhatsApp/src/avatars.cpp | 16 +- protocols/WhatsApp/src/chat.cpp | 36 +- protocols/WhatsApp/src/connection.cpp | 20 +- protocols/WhatsApp/src/contacts.cpp | 6 +- protocols/WhatsApp/src/dialogs.cpp | 2 +- protocols/WhatsApp/src/media.cpp | 20 +- protocols/WhatsApp/src/messages.cpp | 8 +- protocols/WhatsApp/src/proto.cpp | 30 +- protocols/WhatsApp/src/theme.cpp | 6 +- protocols/WhatsApp/src/utils.cpp | 8 +- src/core/stdaway/src/awaymsg.cpp | 6 +- src/core/stdaway/src/sendmsg.cpp | 18 +- src/core/stdclist/src/clcfonts.cpp | 4 +- src/core/stdclist/src/clcopts.cpp | 8 +- src/core/stdclist/src/clcpaint.cpp | 12 +- src/core/stdclist/src/clistopts.cpp | 4 +- src/core/stdclist/src/cluiopts.cpp | 14 +- src/core/stdclist/src/contact.cpp | 2 +- src/core/stdclist/src/init.cpp | 6 +- src/core/stdcrypt/src/Rijndael.cpp | 2 +- src/core/stdcrypt/src/encrypt.cpp | 20 +- src/core/stdcrypt/src/utils.cpp | 8 +- src/core/stdemail/src/email.cpp | 6 +- src/core/stdfile/src/file.cpp | 36 +- src/core/stdfile/src/fileexistsdlg.cpp | 12 +- src/core/stdfile/src/fileopts.cpp | 4 +- src/core/stdfile/src/filerecvdlg.cpp | 18 +- src/core/stdfile/src/filesenddlg.cpp | 20 +- src/core/stdfile/src/filexferdlg.cpp | 72 ++-- src/core/stdfile/src/ftmanager.cpp | 28 +- src/core/stdfile/src/main.cpp | 2 +- src/core/stdhelp/src/about.cpp | 2 +- src/core/stdhelp/src/help.cpp | 4 +- src/core/stdidle/src/idle.cpp | 8 +- src/core/stdmsg/src/chat_options.cpp | 6 +- src/core/stdmsg/src/chat_window.cpp | 2 +- src/core/stdmsg/src/cmdlist.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 12 +- src/core/stdmsg/src/msgs.cpp | 2 +- src/core/stdmsg/src/msgtimedout.cpp | 2 +- src/core/stdmsg/src/statusicon.cpp | 2 +- src/core/stdmsg/src/tabs.cpp | 6 +- src/core/stdssl/src/netlibssl.cpp | 102 +++--- src/core/stduihist/src/history.cpp | 10 +- src/core/stduserinfo/src/contactinfo.cpp | 14 +- src/core/stduserinfo/src/stdinfo.cpp | 26 +- src/core/stduserinfo/src/userinfo.cpp | 40 +-- src/core/stduseronline/src/useronline.cpp | 2 +- src/mir_app/src/DefaultExtraIcons.cpp | 4 +- src/mir_app/src/Docking.cpp | 2 +- src/mir_app/src/FontOptions.cpp | 10 +- src/mir_app/src/FontService.cpp | 12 +- src/mir_app/src/button.cpp | 2 +- src/mir_app/src/chat_manager.cpp | 6 +- src/mir_app/src/chat_tools.cpp | 14 +- src/mir_app/src/clc.cpp | 2 +- src/mir_app/src/clcmsgs.cpp | 2 +- src/mir_app/src/clistcore.cpp | 2 +- src/mir_app/src/clistgroups.cpp | 4 +- src/mir_app/src/clistmod.cpp | 2 +- src/mir_app/src/clui.cpp | 16 +- src/mir_app/src/contacts.cpp | 4 +- src/mir_app/src/database.cpp | 4 +- src/mir_app/src/db_ini.cpp | 4 +- src/mir_app/src/descbutton.cpp | 6 +- src/mir_app/src/dll_sniffer.cpp | 2 +- src/mir_app/src/extracticon.cpp | 2 +- src/mir_app/src/extraicons.cpp | 18 +- src/mir_app/src/filter.cpp | 2 +- src/mir_app/src/findadd.cpp | 12 +- src/mir_app/src/headerbar.cpp | 6 +- src/mir_app/src/hotkeys.cpp | 6 +- src/mir_app/src/icolib.cpp | 8 +- src/mir_app/src/iconheader.cpp | 4 +- src/mir_app/src/lpopts.cpp | 4 +- src/mir_app/src/menu_clist.cpp | 6 +- src/mir_app/src/menu_groups.cpp | 14 +- src/mir_app/src/menu_options.cpp | 4 +- src/mir_app/src/menu_tray.cpp | 2 +- src/mir_app/src/menu_utils.cpp | 12 +- src/mir_app/src/meta_edit.cpp | 4 +- src/mir_app/src/meta_menu.cpp | 6 +- src/mir_app/src/meta_services.cpp | 10 +- src/mir_app/src/meta_utils.cpp | 14 +- src/mir_app/src/miranda.cpp | 2 +- src/mir_app/src/movetogroup.cpp | 2 +- src/mir_app/src/netlib.cpp | 8 +- src/mir_app/src/netlibbind.cpp | 2 +- src/mir_app/src/netlibhttp.cpp | 6 +- src/mir_app/src/netliblog.cpp | 4 +- src/mir_app/src/netlibopenconn.cpp | 8 +- src/mir_app/src/netlibupnp.cpp | 2 +- src/mir_app/src/newplugins.cpp | 2 +- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/options_ei.cpp | 8 +- src/mir_app/src/path.cpp | 6 +- src/mir_app/src/pluginopts.cpp | 2 +- src/mir_app/src/profilemanager.cpp | 6 +- src/mir_app/src/proto_internal.cpp | 2 +- src/mir_app/src/proto_opts.cpp | 2 +- src/mir_app/src/searchresults.cpp | 2 +- src/mir_app/src/skin2opts.cpp | 4 +- src/mir_app/src/skinicons.cpp | 116 +++--- src/mir_app/src/srmm_base.cpp | 10 +- src/mir_app/src/srmm_toolbar.cpp | 6 +- src/mir_app/src/xmlParser.cpp | 4 +- src/mir_core/src/CCtrlTreeView.cpp | 4 +- src/mir_core/src/CDbLink.cpp | 2 +- src/mir_core/src/binbuffer.cpp | 8 +- src/mir_core/src/bitmaps.cpp | 4 +- src/mir_core/src/cmdline.cpp | 8 +- src/mir_core/src/colourpicker.cpp | 6 +- src/mir_core/src/db.cpp | 92 ++--- src/mir_core/src/http.cpp | 28 +- src/mir_core/src/hyperlink.cpp | 40 +-- src/mir_core/src/icons.cpp | 4 +- src/mir_core/src/langpack.cpp | 66 ++-- src/mir_core/src/lists.cpp | 24 +- src/mir_core/src/logger.cpp | 46 +-- src/mir_core/src/mc.cpp | 32 +- src/mir_core/src/md5.cpp | 2 +- src/mir_core/src/memory.cpp | 58 +-- src/mir_core/src/miranda.cpp | 18 +- src/mir_core/src/modules.cpp | 76 ++-- src/mir_core/src/mstring.cpp | 12 +- src/mir_core/src/openurl.cpp | 4 +- src/mir_core/src/path.cpp | 40 +-- src/mir_core/src/resizer.cpp | 4 +- src/mir_core/src/sha256.cpp | 6 +- src/mir_core/src/subclass.cpp | 10 +- src/mir_core/src/threads.cpp | 52 +-- src/mir_core/src/timezones.cpp | 80 ++--- src/mir_core/src/utf.cpp | 56 +-- src/mir_core/src/utils.cpp | 152 ++++---- src/mir_core/src/windowlist.cpp | 14 +- src/mir_core/src/winutil.cpp | 2 +- src/mir_core/src/winver.cpp | 6 +- src/miranda32/src/miranda.cpp | 2 +- utils/mir_fonts.cpp | 2 +- utils/mir_options.cpp | 28 +- utils/mir_smileys.cpp | 34 +- utils/std_string_utils.cpp | 12 +- 1374 files changed, 17255 insertions(+), 17254 deletions(-) diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 416c50279b..94142a7895 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -78,11 +78,11 @@ typedef struct BOOL AnimatedGifGetData(ACCData *data) { FIBITMAP *page = fei->FI_LockPage(data->ag.multi, 0); - if (page == NULL) + if (page == nullptr) return FALSE; // Get info - FITAG *tag = NULL; + FITAG *tag = nullptr; if (!fei->FI_GetMetadata(FIMD_ANIMATION, page, "LogicalWidth", &tag)) goto ERR; data->ag.logicalWidth = *(WORD *)fei->FI_GetTagValue(tag); @@ -124,16 +124,16 @@ void AnimatedGifMountFrame(ACCData* data, int page) { data->ag.frame.num = page; - if (data->ag.hbms[page] != NULL) { + if (data->ag.hbms[page] != nullptr) { data->ag.frame.disposal_method = GIF_DISPOSAL_LEAVE; return; } FIBITMAP *dib = fei->FI_LockPage(data->ag.multi, data->ag.frame.num); - if (dib == NULL) + if (dib == nullptr) return; - FITAG *tag = NULL; + FITAG *tag = nullptr; if (fei->FI_GetMetadata(FIMD_ANIMATION, dib, "FrameLeft", &tag)) data->ag.frame.left = *(WORD *)fei->FI_GetTagValue(tag); else @@ -194,14 +194,14 @@ void AnimatedGifMountFrame(ACCData* data, int page) void AnimatedGifDeleteTmpValues(ACCData* data) { - if (data->ag.multi != NULL) { + if (data->ag.multi != nullptr) { fei->FI_CloseMultiBitmap(data->ag.multi, 0); - data->ag.multi = NULL; + data->ag.multi = nullptr; } - if (data->ag.dib != NULL) { + if (data->ag.dib != nullptr) { fei->FI_Unload(data->ag.dib); - data->ag.dib = NULL; + data->ag.dib = nullptr; } } @@ -212,18 +212,18 @@ void DestroyAnimatedGif(ACCData* data) AnimatedGifDeleteTmpValues(data); - if (data->ag.hbms != NULL) { + if (data->ag.hbms != nullptr) { for (int i = 0; i < data->ag.frameCount; i++) - if (data->ag.hbms[i] != NULL) + if (data->ag.hbms[i] != nullptr) DeleteObject(data->ag.hbms[i]); free(data->ag.hbms); - data->ag.hbms = NULL; + data->ag.hbms = nullptr; } - if (data->ag.times != NULL) { + if (data->ag.times != nullptr) { free(data->ag.times); - data->ag.times = NULL; + data->ag.times = nullptr; } data->showingAnimatedGif = FALSE; @@ -232,16 +232,16 @@ void DestroyAnimatedGif(ACCData* data) void StartAnimatedGif(ACCData* data) { - if (fei == NULL) + if (fei == nullptr) return; - AVATARCACHEENTRY *ace = NULL; + AVATARCACHEENTRY *ace = nullptr; if (data->hContact != NULL) ace = (AVATARCACHEENTRY*)GetAvatarBitmap(data->hContact, 0); else ace = (AVATARCACHEENTRY*)GetMyAvatar(0, (LPARAM)data->proto); - if (ace == NULL) + if (ace == nullptr) return; int format = ProtoGetAvatarFormat(ace->szFilename); @@ -253,7 +253,7 @@ void StartAnimatedGif(ACCData* data) fif = fei->FI_GetFIFFromFilenameU(ace->szFilename); data->ag.multi = fei->FI_OpenMultiBitmapU(fif, ace->szFilename, FALSE, TRUE, FALSE, GIF_LOAD256); - if (data->ag.multi == NULL) + if (data->ag.multi == nullptr) return; data->ag.frameCount = fei->FI_GetPageCount(data->ag.multi); @@ -265,7 +265,7 @@ void StartAnimatedGif(ACCData* data) // allocate entire logical area data->ag.dib = fei->FI_Allocate(data->ag.logicalWidth, data->ag.logicalHeight, 32, 0, 0, 0); - if (data->ag.dib == NULL) + if (data->ag.dib == nullptr) goto ERR; // fill with background color to start @@ -288,7 +288,7 @@ void StartAnimatedGif(ACCData* data) return; ERR: fei->FI_CloseMultiBitmap(data->ag.multi, 0); - data->ag.multi = NULL; + data->ag.multi = nullptr; } void DestroyAnimation(ACCData* data) @@ -334,12 +334,12 @@ static void Invalidate(HWND hwnd) ScreenToClient(parent, &rc); InvalidateRect(parent, &rc, TRUE); } - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } static void NotifyAvatarChange(HWND hwnd) { - PSHNOTIFY pshn = { 0 }; + PSHNOTIFY pshn = {}; pshn.hdr.idFrom = GetDlgCtrlID(hwnd); pshn.hdr.hwndFrom = hwnd; pshn.hdr.code = NM_AVATAR_CHANGED; @@ -382,7 +382,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_TRANSPARENT); data = (ACCData*)mir_calloc(sizeof(ACCData)); - if (data == NULL) + if (data == nullptr) return FALSE; SetWindowLongPtr(hwnd, 0, (LONG_PTR)data); @@ -502,7 +502,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP else ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0); - if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) { + if (ace == nullptr || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) { *width = 0; *height = 0; return TRUE; @@ -553,7 +553,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP PAINTSTRUCT ps; { HDC hdc = BeginPaint(hwnd, &ps); - if (hdc == NULL) + if (hdc == nullptr) break; int oldBkMode = SetBkMode(hdc, TRANSPARENT); @@ -597,7 +597,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ret = 1; if (!data->ag.started) { - SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], NULL); + SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], nullptr); data->ag.started = TRUE; } } @@ -642,7 +642,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE; case WM_SIZE: - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); break; case WM_TIMER: @@ -664,7 +664,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP AnimatedGifMountFrame(data, frame); data->ag.started = FALSE; - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); break; } @@ -677,7 +677,7 @@ int LoadACC() wc.cbSize = sizeof(wc); wc.lpszClassName = AVATAR_CONTROL_CLASS; wc.lpfnWndProc = ACCWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(ACCData*); wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 18250bddd7..160f1a3d1b 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -25,7 +25,7 @@ CacheNode::CacheNode() CacheNode::~CacheNode() { - if (hbmPic != 0) + if (hbmPic != nullptr) DeleteObject(hbmPic); } @@ -69,11 +69,11 @@ void PushAvatarRequest(CacheNode *cc) CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) { if (g_shutDown) - return NULL; + return nullptr; char *szProto = GetContactProto(hContact); - if (szProto == NULL || !db_get_b(NULL, AVS_MODULE, szProto, 1)) - return NULL; + if (szProto == nullptr || !db_get_b(NULL, AVS_MODULE, szProto, 1)) + return nullptr; AVATARCACHEENTRY tmp; tmp.hContact = hContact; @@ -82,13 +82,13 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) CacheNode *cc = arCache.find((CacheNode*)&tmp); if (cc) { - cc->t_lastAccess = time(NULL); - return (cc->loaded || findAny) ? cc : NULL; + cc->t_lastAccess = time(nullptr); + return (cc->loaded || findAny) ? cc : nullptr; } // not found if (!add) - return NULL; + return nullptr; cc = new CacheNode(); cc->hContact = hContact; @@ -97,7 +97,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) PushAvatarRequest(cc); SetEvent(hLoaderEvent); // wake him up - return NULL; + return nullptr; } // output a notification message. @@ -133,7 +133,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) // Get hash char *szProto = GetContactProto(hContact); - if (szProto != NULL) { + if (szProto != nullptr) { DBVARIANT dbv = { 0 }; if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) { if (dbv.type == DBVT_WCHAR) @@ -198,7 +198,7 @@ int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode) mir_cslock lck(cachecs); CacheNode *cc = arCache.find((CacheNode*)&tmp); - if (cc != NULL) { + if (cc != nullptr) { DWORD dwFlags = cc->dwFlags; cc->dwFlags = mode ? (cc->dwFlags | attrib) : (cc->dwFlags & ~attrib); if (cc->dwFlags != dwFlags) @@ -231,7 +231,7 @@ void PicLoader(LPVOID) if (node) arQueue.remove(0); } - if (node == NULL) + if (node == nullptr) break; if (db_get_b(node->hContact, "ContactPhoto", "NeedUpdate", 0)) @@ -239,18 +239,18 @@ void PicLoader(LPVOID) AVATARCACHEENTRY ace_temp; memcpy(&ace_temp, node, sizeof(AVATARCACHEENTRY)); - ace_temp.hbmPic = 0; + ace_temp.hbmPic = nullptr; - int result = CreateAvatarInCache(node->hContact, &ace_temp, NULL); + int result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr); if (result == -2) { char *szProto = GetContactProto(node->hContact); - if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto)) + if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto)) QueueAdd(node->hContact); else if (FetchAvatarFor(node->hContact, szProto) == GAIR_SUCCESS) // Try to create again - result = CreateAvatarInCache(node->hContact, &ace_temp, NULL); + result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr); } - if (result == 1 && ace_temp.hbmPic != 0) { // Loaded + if (result == 1 && ace_temp.hbmPic != nullptr) { // Loaded HBITMAP oldPic = node->hbmPic; { mir_cslock l(cachecs); diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 6219f7d8f5..020b618285 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -13,7 +13,7 @@ void MakeBmpTransparent(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); BYTE *p = (BYTE *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return; memset(p, 0, dwLen); @@ -31,8 +31,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * 4; BYTE *p = (BYTE *)malloc(dwLen); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; // Create bitmap BITMAPINFO RGB32BitsBITMAPINFO; @@ -44,14 +44,14 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; BYTE *ptPixels; - HBITMAP hDirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); + HBITMAP hDirectBitmap = CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); // Copy data if (bmp.bmBitsPixel != 32) { - HDC hdcOrig = CreateCompatibleDC(NULL); + HDC hdcOrig = CreateCompatibleDC(nullptr); HBITMAP oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap); - HDC hdcDest = CreateCompatibleDC(NULL); + HDC hdcDest = CreateCompatibleDC(nullptr); HBITMAP oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap); BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY); @@ -85,7 +85,7 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; UINT *ptPixels; - return CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); + return CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); } // Set the color of points that are transparent @@ -99,7 +99,7 @@ void SetTranspBkgColor(HBITMAP hBitmap, COLORREF color) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); BYTE *p = (BYTE *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return; memset(p, 0, dwLen); @@ -161,22 +161,22 @@ void SetHIMETRICtoDP(HDC hdc, SIZE* sz) HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) { - if (fei == NULL) - return 0; + if (fei == nullptr) + return nullptr; FIBITMAP *dib = (FIBITMAP*)CallService(MS_IMG_LOAD, (WPARAM)ptszFilename, IMGL_RETURNDIB | IMGL_WCHAR); - if (dib == NULL) - return 0; + if (dib == nullptr) + return nullptr; - FIBITMAP *dib32 = NULL; + FIBITMAP *dib32 = nullptr; if (fei->FI_GetBPP(dib) != 32) { dib32 = fei->FI_ConvertTo32Bits(dib); fei->FI_Unload(dib); } else dib32 = dib; - if (dib32 == NULL) - return NULL; + if (dib32 == nullptr) + return nullptr; if (fei->FI_IsTransparent(dib32)) if (bIsTransparent) @@ -185,8 +185,8 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) if (fei->FI_GetWidth(dib32) > 128 || fei->FI_GetHeight(dib32) > 128) { FIBITMAP *dib_new = fei->FI_MakeThumbnail(dib32, 128, FALSE); fei->FI_Unload(dib32); - if (dib_new == NULL) - return 0; + if (dib_new == nullptr) + return nullptr; dib32 = dib_new; } @@ -196,7 +196,7 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename) return bitmap; } -static HWND hwndClui = 0; +static HWND hwndClui = nullptr; // // Save /////////////////////////////////////////////////////////////////////////////////////////// @@ -205,7 +205,7 @@ static HWND hwndClui = 0; int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags) { - if (fei == NULL) + if (fei == nullptr) return -1; wchar_t tszFilename[MAX_PATH]; @@ -278,7 +278,7 @@ DWORD GetImgHash(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); WORD *p = (WORD *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return 0; memset(p, 0, dwLen); @@ -334,7 +334,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) DWORD dwLen = width * height * 4; BYTE *p = (BYTE *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return FALSE; HBITMAP hBmpTmp; @@ -490,7 +490,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) bool transpProportional = (db_get_b(NULL, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", 0) != 0); int *stack = (int *)malloc(width * height * 2 * sizeof(int)); - if (stack == NULL) { + if (stack == nullptr) { free(p); return FALSE; } diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index ab86b8d03d..f691a0945d 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -26,15 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CLIST_INTERFACE *pcli; -HINSTANCE g_hInst = 0; -HICON g_hIcon = 0; +HINSTANCE g_hInst = nullptr; +HICON g_hIcon = nullptr; bool g_shutDown = false; int hLangpack; wchar_t g_szDataPath[MAX_PATH]; // user datae path (read at startup only) BOOL g_AvatarHistoryAvail = FALSE; -HWND hwndSetMyAvatar = 0; +HWND hwndSetMyAvatar = nullptr; HANDLE hMyAvatarsFolder; HANDLE hGlobalAvatarFolder; @@ -56,14 +56,14 @@ OBJLIST g_ProtoPictures(10, ComparePicture), g_MyAvatars(10, ComparePicture); -char *g_szMetaName = NULL; +char *g_szMetaName = nullptr; // Stores the id of the dialog int OnDetailsInit(WPARAM wParam, LPARAM lParam); int OptInit(WPARAM wParam, LPARAM lParam); -FI_INTERFACE *fei = 0; +FI_INTERFACE *fei = nullptr; PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), @@ -82,10 +82,10 @@ PLUGININFOEX pluginInfoEx = { static int ProtocolAck(WPARAM, LPARAM lParam) { ACKDATA *ack = (ACKDATA*)lParam; - if (ack != NULL && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) { + if (ack != nullptr && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) { if (ack->result == ACKRESULT_SUCCESS) { - if (ack->hProcess == NULL) - ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, NULL, ack->szModule); + if (ack->hProcess == nullptr) + ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, nullptr, ack->szModule); else ProcessAvatarInfo(ack->hContact, GAIR_SUCCESS, (PROTO_AVATAR_INFORMATION*)ack->hProcess, ack->szModule); } @@ -94,7 +94,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam) } else if (ack->result == ACKRESULT_STATUS) { char *szProto = GetContactProto(ack->hContact); - if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto)) { + if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto)) { // Queue db_set_b(ack->hContact, "ContactPhoto", "NeedUpdate", 1); QueueAdd(ack->hContact); @@ -115,7 +115,7 @@ static int MetaChanged(WPARAM hMeta, LPARAM hSubContact) // Get the node CacheNode *node = FindAvatarInCache(hSubContact, true); - if (node == NULL || !node->loaded) { + if (node == nullptr || !node->loaded) { ace = (AVATARCACHEENTRY*)GetProtoDefaultAvatar(hSubContact); QueueAdd(hSubContact); } @@ -198,7 +198,7 @@ static int OnAccChanged(WPARAM wParam, LPARAM lParam) static int ContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; - if (cws == NULL || g_shutDown) + if (cws == nullptr || g_shutDown) return 0; if (hContact == 0) @@ -219,7 +219,7 @@ static int ShutdownProc(WPARAM, LPARAM) g_shutDown = true; SetEvent(hLoaderEvent); SetEvent(hShutdownEvent); - CloseHandle(hShutdownEvent); hShutdownEvent = NULL; + CloseHandle(hShutdownEvent); hShutdownEvent = nullptr; return 0; } @@ -257,7 +257,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm if (GetClipRgn(r->hTargetDC, oldRgn) != 1) { DeleteObject(oldRgn); - oldRgn = NULL; + oldRgn = nullptr; } HRGN rgn; @@ -324,9 +324,9 @@ static int ModulesLoaded(WPARAM, LPARAM) { wchar_t szEventName[100]; mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId()); - hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName); + hLoaderEvent = CreateEvent(nullptr, TRUE, FALSE, szEventName); - SetThreadPriority(mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE); + SetThreadPriority(mir_forkthread(PicLoader, nullptr), THREAD_PRIORITY_IDLE); // Folders plugin support hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars"); @@ -335,10 +335,10 @@ static int ModulesLoaded(WPARAM, LPARAM) g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED); int accCount; - PROTOACCOUNT **accs = NULL; + PROTOACCOUNT **accs = nullptr; Proto_EnumAccounts(&accCount, &accs); - if (fei != NULL) { + if (fei != nullptr) { LoadDefaultInfo(); int protoCount; @@ -364,7 +364,7 @@ static int ModulesLoaded(WPARAM, LPARAM) static int LoadAvatarModule() { - hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + hShutdownEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); @@ -406,8 +406,8 @@ extern "C" int __declspec(dllexport) Load(void) if (ServiceExists(MS_IMG_GETINTERFACE)) result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei); - if (fei == NULL || result != S_OK) { - MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK); + if (fei == nullptr || result != S_OK) { + MessageBox(nullptr, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK); return 1; } LoadACC(); diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 97e6190c51..0ef9d71dd5 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -47,7 +47,7 @@ struct WindowData static void RemoveProtoPic(const char *szProto) { - if (szProto == NULL) + if (szProto == nullptr) return; db_unset(NULL, PPICT_MODULE, szProto); @@ -55,7 +55,7 @@ static void RemoveProtoPic(const char *szProto) if (!mir_strcmp(AVS_DEFAULT, szProto)) { for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry &p = g_ProtoPictures[i]; - if (p.szProtoname == NULL) + if (p.szProtoname == nullptr) continue; p.clear(); @@ -72,10 +72,10 @@ static void RemoveProtoPic(const char *szProto) for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry &p = g_ProtoPictures[i]; - if (p.szProtoname == NULL) + if (p.szProtoname == nullptr) continue; PROTOACCOUNT *pdescr = Proto_GetAccount(p.szProtoname); - if (pdescr == NULL && mir_strcmp(p.szProtoname, szProto)) + if (pdescr == nullptr && mir_strcmp(p.szProtoname, szProto)) continue; if (!mir_strcmp(p.szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) { @@ -104,7 +104,7 @@ static void SetProtoPic(char *szProto) OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.lpstrFilter = filter; - ofn.hwndOwner = 0; + ofn.hwndOwner = nullptr; ofn.lpstrFile = FileName; ofn.nMaxFile = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH; @@ -128,7 +128,7 @@ static void SetProtoPic(char *szProto) if (mir_strlen(p.szProtoname) == 0) continue; - if (p.hbmPic == 0 || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) { + if (p.hbmPic == nullptr || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) { CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); } @@ -140,13 +140,13 @@ static void SetProtoPic(char *szProto) mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1); for (int i = 0; i < g_ProtoPictures.getCount(); i++) { PROTOACCOUNT* pdescr = Proto_GetAccount(g_ProtoPictures[i].szProtoname); - if (pdescr == NULL && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto)) + if (pdescr == nullptr && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto)) continue; if (!mir_strcmp(g_ProtoPictures[i].szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) { protoPicCacheEntry& p = g_ProtoPictures[i]; if (mir_strlen(p.szProtoname) != 0) { - if (p.hbmPic == 0) { + if (p.hbmPic == nullptr) { CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); } @@ -161,7 +161,7 @@ static void SetProtoPic(char *szProto) break; if (!mir_strcmp(p.szProtoname, szProto) && mir_strlen(p.szProtoname) == mir_strlen(szProto)) { - if (p.hbmPic != 0) + if (p.hbmPic != nullptr) DeleteObject(p.hbmPic); memset(&p, 0, sizeof(AVATARCACHEENTRY)); CreateAvatarInCache(0, &p, szProto); @@ -277,10 +277,10 @@ static char* GetProtoFromList(HWND hwndDlg, int iItem) item.mask = LVIF_PARAM; item.iItem = iItem; if (!ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROTOCOLS), &item)) - return NULL; + return nullptr; protoPicCacheEntry *pce = (protoPicCacheEntry *)item.lParam; - return (pce == NULL) ? NULL : pce->szProtoname; + return (pce == nullptr) ? nullptr : pce->szProtoname; } static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -392,12 +392,12 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar } else SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, dbv.ptszVal); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); db_free(&dbv); } else { SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, L""); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); } } } @@ -493,7 +493,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA } SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); ShowWindow(hwndDlg, SW_SHOWNORMAL); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, FALSE); CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, db_get_b(hContact, "ContactPhoto", "Hidden", 0) ? BST_CHECKED : BST_UNCHECKED); @@ -573,7 +573,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_RESET: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -597,7 +597,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case IDC_DELETE: - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; ProtectAvatar(hContact, 0); if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { @@ -612,7 +612,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA db_unset(hContact, "ContactPhoto", "Format"); DeleteAvatarFromCache(hContact, FALSE); SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; } break; @@ -685,11 +685,11 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case DM_REALODAVATAR: SaveTransparentData(hwndDlg, hContact, IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR)); ChangeAvatar(hContact, true); - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; case DM_AVATARCHANGED: - InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE); break; case WM_NCDESTROY: @@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa break; case IDC_RESET: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -843,7 +843,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa case IDC_DELETE: ProtectAvatar(hContact, 0); - if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { + if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); @@ -883,7 +883,7 @@ static char* GetSelectedProtocol(HWND hwndDlg) // Get selection int iItem = ListView_GetSelectionMark(hwndList); if (iItem < 0) - return NULL; + return nullptr; // Get protocol name LVITEM item = { 0 }; @@ -896,7 +896,7 @@ static char* GetSelectedProtocol(HWND hwndDlg) static void EnableDisableControls(HWND hwndDlg, char *proto) { if (IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO)) { - if (proto == NULL) { + if (proto == nullptr) { EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); } @@ -954,7 +954,7 @@ static void EnableDisableProtocols(HWND hwndDlg, BOOL init) } char * proto = GetSelectedProtocol(hwndDlg); - if (proto == NULL) { + if (proto == nullptr) { ListView_SetItemState(hwndList, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x0F); } else { @@ -1064,7 +1064,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP SetMyAvatar(NULL, NULL); else { char *proto = GetSelectedProtocol(hwndDlg); - if (proto != NULL) + if (proto != nullptr) SetMyAvatar((WPARAM)proto, NULL); } break; @@ -1076,7 +1076,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP } else { char *proto = GetSelectedProtocol(hwndDlg); - if (proto == NULL) + if (proto == nullptr) break; char description[256]; @@ -1113,7 +1113,7 @@ int OnDetailsInit(WPARAM wParam, LPARAM lParam) } else { char *szProto = GetContactProto(hContact); - if (szProto == NULL || db_get_b(NULL, AVS_MODULE, szProto, 1)) { + if (szProto == nullptr || db_get_b(NULL, AVS_MODULE, szProto, 1)) { // Contact dialog odp.pfnDlgProc = DlgProcAvatarUserInfo; odp.position = -2000000000; diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 1b02acda79..3a2a091e3b 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -63,7 +63,7 @@ static mir_cs cs; void InitPolls() { // Init request queue - mir_forkthread(RequestThread, NULL); + mir_forkthread(RequestThread, nullptr); } void UninitPolls() @@ -97,7 +97,7 @@ static BOOL PollContactCanHaveAvatar(MCONTACT hContact, const char *szProto) // Return true if this contact has to be checked static BOOL PollCheckContact(MCONTACT hContact) { - return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != NULL; + return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != nullptr; } static void QueueRemove(MCONTACT hContact) @@ -114,7 +114,7 @@ static void QueueRemove(MCONTACT hContact) // Add an contact to a queue void QueueAdd(MCONTACT hContact, int waitTime) { - if (fei == NULL || g_shutDown) + if (fei == nullptr || g_shutDown) return; mir_cslock lck(cs); @@ -135,7 +135,7 @@ void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATION *pa QueueRemove(hContact); if (type == GAIR_SUCCESS) { - if (pai == NULL) + if (pai == nullptr) return; // Fix settings in DB @@ -186,10 +186,10 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto) { int result = GAIR_NOAVATAR; - if (szProto == NULL) + if (szProto == nullptr) szProto = GetContactProto(hContact); - if (szProto != NULL && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) { + if (szProto != nullptr && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) { // Can have avatar, but must request it? if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0)) || (PollCheckProtocol(szProto) && PollCheckContact(hContact))) { diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index c09163c78d..458ab27664 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -28,14 +28,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM) { - if (hContact == 0 || g_shutDown || fei == NULL) + if (hContact == 0 || g_shutDown || fei == nullptr) return 0; hContact = GetContactThatHaveTheAvatar(hContact); // Get the node CacheNode *node = FindAvatarInCache(hContact, true); - if (node == NULL || !node->loaded) + if (node == nullptr || !node->loaded) return (INT_PTR)GetProtoDefaultAvatar(hContact); return (INT_PTR)node; } @@ -46,7 +46,7 @@ INT_PTR ProtectAvatar(WPARAM hContact, LPARAM lParam) { BYTE was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); - if (fei == NULL || was_locked == (BYTE)lParam) // no need for redundant lockings... + if (fei == nullptr || was_locked == (BYTE)lParam) // no need for redundant lockings... return 0; if (hContact) { @@ -98,8 +98,8 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_NOTIFY: if (data->setView) { HWND hwndParent = GetParent(hwnd); - HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL); - if (hwndLv != NULL) { + HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr); + if (hwndLv != nullptr) { SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0); data->setView = FALSE; } @@ -121,19 +121,19 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam) wchar_t *szFinalName; BYTE locking_request; - if (hContact == NULL || fei == NULL) + if (hContact == NULL || fei == nullptr) return 0; int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); wchar_t *tszPath = (wchar_t*)lParam; - if (tszPath == NULL) { + if (tszPath == nullptr) { wchar_t filter[256]; Bitmap_GetFilter(filter, _countof(filter)); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = 0; + ofn.hwndOwner = nullptr; ofn.lpstrFile = FileName; ofn.lpstrFilter = filter; ofn.nMaxFile = MAX_PATH; @@ -179,7 +179,7 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam) static INT_PTR CanSetMyAvatar(WPARAM wParam, LPARAM) { char *protocol = (char *)wParam; - if (protocol == NULL || fei == NULL) + if (protocol == nullptr || fei == nullptr) return 0; return ProtoServiceExists(protocol, PS_SETMYAVATAR); @@ -196,9 +196,9 @@ static int InternalRemoveMyAvatar(char *protocol) // Remove avatar int ret = 0; - if (protocol != NULL) { + if (protocol != nullptr) { if (ProtoServiceExists(protocol, PS_SETMYAVATAR)) - ret = SaveAvatar(protocol, NULL); + ret = SaveAvatar(protocol, nullptr); else ret = -3; @@ -225,7 +225,7 @@ static int InternalRemoveMyAvatar(char *protocol) continue; // Found a protocol - int retTmp = SaveAvatar(accs[i]->szModuleName, NULL); + int retTmp = SaveAvatar(accs[i]->szModuleName, nullptr); if (retTmp != 0) ret = retTmp; } @@ -240,7 +240,7 @@ static int InternalRemoveMyAvatar(char *protocol) SetIgnoreNotify(protocol, FALSE); - ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0); + ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0); return ret; } @@ -293,7 +293,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM CheckDlgButton(hwnd, IDC_MAKE_SQUARE, data->square ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_GROW, data->grow ? BST_CHECKED : BST_UNCHECKED); - if (data->protocol != NULL && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE)) + if (data->protocol != nullptr && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE)) EnableWindow(GetDlgItem(hwnd, IDC_MAKE_SQUARE), FALSE); break; @@ -301,8 +301,8 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM data = (SetMyAvatarHookData *)ofn->lCustData; if (data->thumbnail) { HWND hwndParent = GetParent(hwnd); - HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL); - if (hwndLv != NULL) { + HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr); + if (hwndLv != nullptr) { SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0); data->thumbnail = FALSE; } @@ -314,7 +314,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM data->square = IsDlgButtonChecked(hwnd, IDC_MAKE_SQUARE); data->grow = IsDlgButtonChecked(hwnd, IDC_GROW); - hwndSetMyAvatar = NULL; + hwndSetMyAvatar = nullptr; break; } @@ -407,7 +407,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen d.hBmpProto = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0); - if (d.hBmpProto == NULL) { + if (d.hBmpProto == nullptr) { if (d.temp_file[0] != '\0') DeleteFile(d.temp_file); return -1; @@ -489,7 +489,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar return -3; // file exists... - HBITMAP hBmp = NULL; + HBITMAP hBmp = nullptr; if (format == PA_FORMAT_SWF) { if (!allAcceptSWF) @@ -502,14 +502,14 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar else { // Try to open if is not a flash or XML hBmp = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFinalName, IMGL_WCHAR); - if (hBmp == NULL) + if (hBmp == nullptr) return -4; } SetIgnoreNotify(protocol, TRUE); int ret = 0; - if (protocol != NULL) { + if (protocol != nullptr) { ret = SetProtoMyAvatar(protocol, hBmp, szFinalName, format, data.square, data.grow); if (ret == 0) { DeleteGlobalUserAvatar(); @@ -542,7 +542,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar BOOL saved = TRUE; if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) { mir_snwprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar"); - CreateDirectory(globalFile, NULL); + CreateDirectory(globalFile, nullptr); } wchar_t *ext = wcsrchr(szFinalName, '.'); // Can't be NULL here @@ -563,7 +563,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar HBITMAP hBmpTmp = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0); // Check if need to resize - if (hBmpTmp == hBmp || hBmpTmp == NULL) { + if (hBmpTmp == hBmp || hBmpTmp == nullptr) { // Use original image mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext); CopyFile(szFinalName, globalFile, FALSE); @@ -595,34 +595,34 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar SetIgnoreNotify(protocol, FALSE); - ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0); + ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0); return ret; } INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) { wchar_t FileName[MAX_PATH]; - wchar_t *szFinalName = NULL; + wchar_t *szFinalName = nullptr; BOOL allAcceptXML; BOOL allAcceptSWF; // Protocol allow seting of avatar? char* protocol = (char*)wParam; - if (protocol != NULL && !CanSetMyAvatar((WPARAM)protocol, 0)) + if (protocol != nullptr && !CanSetMyAvatar((WPARAM)protocol, 0)) return -1; wchar_t* tszPath = (wchar_t*)lParam; - if (tszPath == NULL && hwndSetMyAvatar != 0) { + if (tszPath == nullptr && hwndSetMyAvatar != nullptr) { SetForegroundWindow(hwndSetMyAvatar); SetFocus(hwndSetMyAvatar); ShowWindow(hwndSetMyAvatar, SW_SHOW); return -2; } - SetMyAvatarHookData data = { 0 }; + SetMyAvatarHookData data = {}; // Check for XML and SWF - if (protocol == NULL) { + if (protocol == nullptr) { allAcceptXML = TRUE; allAcceptSWF = TRUE; @@ -651,7 +651,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) || db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0); } - if (tszPath == NULL) { + if (tszPath == nullptr) { data.protocol = protocol; CMStringW filter; @@ -677,7 +677,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) ofn.hInstance = g_hInst; wchar_t title[256]; - if (protocol == NULL) + if (protocol == nullptr) mir_snwprintf(title, TranslateT("Set my avatar")); else { wchar_t* prototmp = mir_a2u(protocol); @@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA static INT_PTR ContactOptions(WPARAM wParam, LPARAM) { if (wParam) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), 0, DlgProcAvatarOptions, (LPARAM)wParam); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), nullptr, DlgProcAvatarOptions, (LPARAM)wParam); return 0; } @@ -715,29 +715,29 @@ static INT_PTR ContactOptions(WPARAM wParam, LPARAM) INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) { - AVATARCACHEENTRY *ace = NULL; + AVATARCACHEENTRY *ace = nullptr; AVATARDRAWREQUEST *r = (AVATARDRAWREQUEST*)lParam; - if (fei == NULL || r == NULL || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST))) + if (fei == nullptr || r == nullptr || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST))) return 0; if (r->cbSize != sizeof(AVATARDRAWREQUEST)) return 0; if (r->dwFlags & AVDRQ_PROTOPICT) { - if (r->szProto == NULL) + if (r->szProto == nullptr) return 0; for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry& p = g_ProtoPictures[i]; - if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != 0) { + if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != nullptr) { ace = (AVATARCACHEENTRY *)&g_ProtoPictures[i]; break; } } } else if (r->dwFlags & AVDRQ_OWNPIC) { - if (r->szProto == NULL) + if (r->szProto == nullptr) return 0; if (r->szProto[0] == '\0' && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1)) @@ -748,9 +748,9 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) else ace = (AVATARCACHEENTRY *)GetAvatarBitmap((WPARAM)r->hContact, 0); if (ace && (!(r->dwFlags & AVDRQ_RESPECTHIDDEN) || !(ace->dwFlags & AVS_HIDEONCLIST))) { - ace->t_lastAccess = time(NULL); + ace->t_lastAccess = time(nullptr); - if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == 0) + if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == nullptr) return 0; InternalDrawAvatar(r, ace->hbmPic, ace->bmWidth, ace->bmHeight, ace->dwFlags); @@ -764,7 +764,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam) { - if (wParam || g_shutDown || fei == NULL) + if (wParam || g_shutDown || fei == nullptr) return 0; char *szProto = (char *)lParam; @@ -772,7 +772,7 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam) return 0; for (int i = 0; i < g_MyAvatars.getCount(); i++) - if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != 0) + if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != nullptr) return (INT_PTR)&g_MyAvatars[i]; return 0; @@ -818,7 +818,7 @@ static void ReloadMyAvatar(LPVOID lpParam) INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM) { const char *proto = (const char*)wParam; - if (proto == NULL) + if (proto == nullptr) return -1; for (int i = 0; i < g_MyAvatars.getCount(); i++) { diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index a20372b9dc..1aa82f4515 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -70,16 +70,16 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) ptrW tszValue; wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0; - ace->hbmPic = 0; + ace->hbmPic = nullptr; ace->dwFlags = 0; ace->bmHeight = 0; ace->bmWidth = 0; - ace->lpDIBSection = NULL; + ace->lpDIBSection = nullptr; ace->szFilename[0] = 0; - if (szProto == NULL) { + if (szProto == nullptr) { char *proto = GetContactProto(hContact); - if (proto == NULL || !db_get_b(NULL, AVS_MODULE, proto, 1)) + if (proto == nullptr || !db_get_b(NULL, AVS_MODULE, proto, 1)) return -1; if (db_get_b(hContact, "ContactPhoto", "Locked", 0) && (tszValue = db_get_wsa(hContact, "ContactPhoto", "Backup"))) @@ -100,7 +100,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) if (!strstr(szProto, "Global avatar for")) { PROTOACCOUNT* pdescr = Proto_GetAccount(szProto); - if (pdescr == NULL) + if (pdescr == nullptr) return -1; char key[MAX_PATH]; mir_snprintf(key, "Global avatar for %s accounts", pdescr->szProtoName); @@ -148,10 +148,10 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) ace->dwFlags = 0; ace->bmHeight = 0; ace->bmWidth = 0; - ace->lpDIBSection = NULL; + ace->lpDIBSection = nullptr; wcsncpy(ace->szFilename, tszFilename, MAX_PATH); ace->szFilename[MAX_PATH - 1] = 0; - if (ace->hbmPic == 0) + if (ace->hbmPic == nullptr) return -1; BITMAP bminfo; @@ -232,7 +232,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto) int GetFileHash(wchar_t* filename) { - HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile == INVALID_HANDLE_VALUE) return 0; @@ -242,7 +242,7 @@ int GetFileHash(wchar_t* filename) do { // Read file chunk dwRead = 0; - ReadFile(hFile, data, 1024, &dwRead, NULL); + ReadFile(hFile, data, 1024, &dwRead, nullptr); /* loop through each byte of data */ for (int byte = 0; byte < (int)dwRead; ++byte) { @@ -269,7 +269,7 @@ int GetFileHash(wchar_t* filename) protoPicCacheEntry::~protoPicCacheEntry() { - if (hbmPic != 0) + if (hbmPic != nullptr) DeleteObject(hbmPic); mir_free(szProtoname); mir_free(tszAccName); @@ -277,7 +277,7 @@ protoPicCacheEntry::~protoPicCacheEntry() void protoPicCacheEntry::clear() { - if (hbmPic != 0) + if (hbmPic != nullptr) DeleteObject(hbmPic); memset(this, 0, sizeof(AVATARCACHEENTRY)); @@ -384,11 +384,11 @@ protoPicCacheEntry* GetProtoDefaultAvatar(MCONTACT hContact) if (szProto) { for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry& p = g_ProtoPictures[i]; - if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != NULL) + if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != nullptr) return &g_ProtoPictures[i]; } } - return NULL; + return nullptr; } MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked) @@ -412,7 +412,7 @@ int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist, int pa_format) // Get the node CacheNode *node = FindAvatarInCache(hContact, g_AvatarHistoryAvail && fNotifyHist, true); - if (node == NULL) + if (node == nullptr) return 0; if (fNotifyHist) @@ -446,7 +446,7 @@ void DeleteGlobalUserAvatar() void SetIgnoreNotify(char *protocol, BOOL ignore) { for (int i = 0; i < g_MyAvatars.getCount(); i++) { - if (protocol == NULL || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) { + if (protocol == nullptr || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) { if (ignore) g_MyAvatars[i].dwFlags |= AVS_IGNORENOTIFY; else diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index e1d0a79bd0..f77bd1f5de 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -100,7 +100,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) } if (iAccCount == 0) { - if (GetParent(hdlg) == NULL) + if (GetParent(hdlg) == nullptr) DestroyWindow(hdlg); else EndDialog(hdlg, 0); @@ -172,7 +172,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) HookEventMessage(ME_PROTO_ACCLISTCHANGED, hdlg, DM_ADDCONTACT_CHANGEACCLIST); { wchar_t *szGroup; - for (int i = 1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { + for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) { int id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)szGroup); SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA, (WPARAM)id, (LPARAM)i); } @@ -239,10 +239,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) GetDlgItemText(hdlg, IDC_USERID, szUserId, _countof(szUserId)); if (*rtrimw(szUserId) == 0 || - (strstr(acs->proto, "GG") && wcstoul(szUserId, NULL, 10) > INT_MAX) || // Gadu-Gadu protocol - ((CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_NUMERICUSERID) && !wcstoul(szUserId, NULL, 10))) + (strstr(acs->proto, "GG") && wcstoul(szUserId, nullptr, 10) > INT_MAX) || // Gadu-Gadu protocol + ((CallProtoService(acs->proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_NUMERICUSERID) && !wcstoul(szUserId, nullptr, 10))) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("The contact cannot be added to your contact list. Please make sure the contact ID is entered correctly."), TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); break; @@ -250,8 +250,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) PROTOSEARCHRESULT *psr; if (strstr(acs->proto, "TLEN")) { // Tlen protocol - if (wcschr(szUserId, '@') == NULL) { - MessageBox(NULL, + if (wcschr(szUserId, '@') == nullptr) { + MessageBox(nullptr, TranslateT("The contact cannot be added to your contact list. Please make sure the contact ID is entered correctly."), TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); break; @@ -271,7 +271,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) MCONTACT hContact = (MCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr); if (hContact == NULL) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("The contact cannot be added to your contact list. If you are not logged into the selected account, please try to do so. Also, make sure the contact ID is entered correctly."), TranslateT("Add contact"), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); break; @@ -310,7 +310,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) } // fall through case IDCANCEL: - if (GetParent(hdlg) == NULL) + if (GetParent(hdlg) == nullptr) DestroyWindow(hdlg); else EndDialog(hdlg, 0); @@ -319,7 +319,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_CLOSE: /* if there is no parent for the dialog, its a modeless dialog and can't be killed using EndDialog() */ - if (GetParent(hdlg) == NULL) + if (GetParent(hdlg) == nullptr) DestroyWindow(hdlg); else EndDialog(hdlg, 0); @@ -335,7 +335,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) break; case WM_DESTROY: - hAddDlg = NULL; + hAddDlg = nullptr; Window_FreeIcon_IcoLib(hdlg); ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_GETIMAGELIST, 0, 0)); if (acs) { diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 1326ab1206..26df21c584 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; -static HANDLE hToolBarItem = 0; -static HGENMENU hMainMenuItem = 0; +static HANDLE hToolBarItem = nullptr; +static HGENMENU hMainMenuItem = nullptr; HWND hAddDlg; static IconItem icon = { LPGEN("Add contact"), ICON_ADD, IDI_ADDCONTACT }; @@ -68,7 +68,7 @@ static INT_PTR AddContactPlusDialog(WPARAM, LPARAM) SetForegroundWindow(hAddDlg); SetFocus(hAddDlg); } - else hAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), NULL, AddContactDlgProc, 0); + else hAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), nullptr, AddContactDlgProc, 0); return 0; } @@ -107,7 +107,7 @@ static int OnAccListChanged(WPARAM, LPARAM) Menu_RemoveItem(hMainMenuItem); CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hToolBarItem, 0); - hMainMenuItem = 0; + hMainMenuItem = nullptr; } return 0; @@ -115,7 +115,7 @@ static int OnAccListChanged(WPARAM, LPARAM) static int CreateButton(WPARAM, LPARAM) { - TTBButton tbb = { 0 }; + TTBButton tbb = {}; tbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; tbb.pszService = MS_ADDCONTACTPLUS_SHOW; tbb.name = tbb.pszTooltipUp = LPGEN("Add contact"); diff --git a/plugins/AdvaImg/src/main.cpp b/plugins/AdvaImg/src/main.cpp index b9be9dcb58..d2294db9a9 100644 --- a/plugins/AdvaImg/src/main.cpp +++ b/plugins/AdvaImg/src/main.cpp @@ -71,7 +71,7 @@ static void FI_CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); p = (BYTE *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return; memset(p, 0, dwLen); @@ -119,7 +119,7 @@ static BOOL FreeImage_PreMultiply(HBITMAP hBitmap) int height = bmp.bmHeight; int dwLen = width * height * 4; BYTE *p = (BYTE *)malloc(dwLen); - if (p != NULL) { + if (p != nullptr) { GetBitmapBits(hBitmap, dwLen, p); for (int y = 0; y < height; ++y) { @@ -149,7 +149,7 @@ static BOOL FreeImage_PreMultiply(HBITMAP hBitmap) static HBITMAP FreeImage_CreateHBITMAPFromDIB(FIBITMAP *in) { - FIBITMAP *dib = NULL; + FIBITMAP *dib = nullptr; int bpp = FreeImage_GetBPP(in); if (bpp == 48) @@ -161,8 +161,8 @@ static HBITMAP FreeImage_CreateHBITMAPFromDIB(FIBITMAP *in) BYTE *ptPixels; BITMAPINFO *info = FreeImage_GetInfo(dib); - HBITMAP hBmp = CreateDIBSection(NULL, info, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); - if (ptPixels != NULL) + HBITMAP hBmp = CreateDIBSection(nullptr, info, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); + if (ptPixels != nullptr) memmove(ptPixels, FreeImage_GetBits(dib), FreeImage_GetPitch(dib) * FreeImage_GetHeight(dib)); if (dib != in) @@ -181,16 +181,16 @@ static FIBITMAP *FreeImage_CreateDIBFromHBITMAP(HBITMAP hBmp) // The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO members (dont't know why) // So we save these infos below. This is needed for palettized images only. int nColors = FreeImage_GetColorsUsed(dib); - HDC dc = GetDC(NULL); + HDC dc = GetDC(nullptr); int Success = GetDIBits(dc, hBmp, 0, FreeImage_GetHeight(dib), FreeImage_GetBits(dib), FreeImage_GetInfo(dib), DIB_RGB_COLORS); - ReleaseDC(NULL, dc); + ReleaseDC(nullptr, dc); // restore BITMAPINFO members FreeImage_GetInfoHeader(dib)->biClrUsed = nColors; FreeImage_GetInfoHeader(dib)->biClrImportant = nColors; return dib; } - return NULL; + return nullptr; } @@ -210,8 +210,8 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) int xOrig, yOrig, widthOrig, heightOrig; ResizeBitmap *info = (ResizeBitmap *) wParam; - if (info == NULL || info->size != sizeof(ResizeBitmap) - || info->hBmp == NULL + if (info == nullptr || info->size != sizeof(ResizeBitmap) + || info->hBmp == nullptr || info->max_width < 0 || info->max_height < 0 || (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) < RESIZEBITMAP_STRETCH || (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) > RESIZEBITMAP_MAKE_SQUARE) @@ -296,7 +296,7 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) else { FIBITMAP *dib = FreeImage_CreateDIBFromHBITMAP(info->hBmp); - if (dib == NULL) + if (dib == nullptr) return NULL; FIBITMAP *dib_tmp; @@ -305,7 +305,7 @@ static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam) else dib_tmp = dib; - if (dib_tmp == NULL) + if (dib_tmp == nullptr) { FreeImage_Unload(dib); return NULL; @@ -334,13 +334,13 @@ FIBITMAP* FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, FreeImage_CloseMemory(hmem); } - return NULL; + return nullptr; } FIMEMORY* FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags) { if (handle) { - FIMEMORY *hmem = FreeImage_OpenMemory(NULL, 0); + FIMEMORY *hmem = FreeImage_OpenMemory(nullptr, 0); if(fif == FIF_UNKNOWN) fif = FIF_BMP; handle->curpos = 0; @@ -348,7 +348,7 @@ FIMEMORY* FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_han FreeImage_AcquireMemory(hmem, (BYTE **)&handle->data, (DWORD *)&handle->datalen); return hmem; } - return NULL; + return nullptr; } /////////////////////////////////////////////////////////////////////////////// @@ -379,7 +379,7 @@ static INT_PTR serviceGetInterface(WPARAM wParam, LPARAM lParam) static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam) { char *lpszFilename = (char *)wParam; - if(lpszFilename==NULL) return 0; + if(lpszFilename==nullptr) return 0; FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; if(lParam & IMGL_WCHAR) @@ -404,7 +404,7 @@ static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam) else dib = FreeImage_Load(fif, lpszFilename, 0); - if(dib == NULL || (lParam & IMGL_RETURNDIB)) + if(dib == nullptr || (lParam & IMGL_RETURNDIB)) return (INT_PTR)dib; HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(dib); @@ -418,7 +418,7 @@ static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam) static INT_PTR serviceLoadFromMem(WPARAM wParam, LPARAM lParam) { IMGSRVC_MEMIO *mio = (IMGSRVC_MEMIO *)wParam; - if(mio->iLen == 0 || mio->pBuf == NULL) + if(mio->iLen == 0 || mio->pBuf == nullptr) return 0; FIMEMORY *hmem = FreeImage_OpenMemory((BYTE *)mio->pBuf, mio->iLen); @@ -426,7 +426,7 @@ static INT_PTR serviceLoadFromMem(WPARAM wParam, LPARAM lParam) FIBITMAP *dib = FreeImage_LoadFromMemory(fif, hmem, mio->flags); FreeImage_CloseMemory(hmem); - if(dib == NULL || (lParam & IMGL_RETURNDIB)) + if(dib == nullptr || (lParam & IMGL_RETURNDIB)) return (INT_PTR)dib; HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(dib); @@ -450,7 +450,7 @@ static INT_PTR serviceSave(WPARAM wParam, LPARAM lParam) IMGSRVC_INFO *isi = (IMGSRVC_INFO *)wParam; FREE_IMAGE_FORMAT fif; BOOL fUnload = FALSE; - FIBITMAP *dib = NULL; + FIBITMAP *dib = nullptr; if(isi) { if(isi->cbSize != sizeof(IMGSRVC_INFO)) @@ -469,13 +469,13 @@ static INT_PTR serviceSave(WPARAM wParam, LPARAM lParam) if(fif == FIF_UNKNOWN) fif = FIF_BMP; // default, save as bmp - if(isi->hbm != 0 && (isi->dwMask & IMGI_HBITMAP) && !(isi->dwMask & IMGI_FBITMAP)) { + if(isi->hbm != nullptr && (isi->dwMask & IMGI_HBITMAP) && !(isi->dwMask & IMGI_FBITMAP)) { // create temporary dib, because we got a HBTIMAP passed fUnload = TRUE; FI_CorrectBitmap32Alpha(isi->hbm, FALSE); dib = FreeImage_CreateDIBFromHBITMAP(isi->hbm); } - else if(isi->dib != NULL && (isi->dwMask & IMGI_FBITMAP) && !(isi->dwMask & IMGI_HBITMAP)) + else if(isi->dib != nullptr && (isi->dwMask & IMGI_FBITMAP) && !(isi->dwMask & IMGI_HBITMAP)) dib = isi->dib; int ret = 0; @@ -517,7 +517,7 @@ static INT_PTR serviceGetVersion(WPARAM wParam, LPARAM lParam) DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle) { - return FreeImage_Rotate(dib, angle, NULL); + return FreeImage_Rotate(dib, angle, nullptr); } void FI_Populate(void) diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index f00893fbc9..f47f1f566d 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -4,13 +4,13 @@ #define ID_TIMER_SOUND 10101 #define SOUND_REPEAT_PERIOD 5000 // milliseconds #define SPEACH_REPEAT_PERIOD 15000 // milliseconds -MWindowList hAlarmWindowList = 0; +MWindowList hAlarmWindowList = nullptr; FontIDW title_font_id, window_font_id; ColourIDW bk_colour_id; -HFONT hTitleFont = 0, hWindowFont = 0; +HFONT hTitleFont = nullptr, hWindowFont = nullptr; COLORREF title_font_colour, window_font_colour; -HBRUSH hBackgroundBrush = 0; +HBRUSH hBackgroundBrush = nullptr; #define WMU_SETFONTS (WM_USER + 61) #define WMU_REFRESH (WM_USER + 62) @@ -43,7 +43,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar wd = new WindowData; wd->moving = false; - wd->alarm = 0; + wd->alarm = nullptr; wd->win_num = win_num++; if (wd->win_num > 0) { @@ -52,7 +52,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar r.top += 20; r.left += 20; - SetWindowPos(hwndDlg, 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(hwndDlg, nullptr, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify"); } SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wd); @@ -65,7 +65,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return FALSE; case WMU_REFRESH: - InvalidateRect(hwndDlg, 0, TRUE); + InvalidateRect(hwndDlg, nullptr, TRUE); return TRUE; case WM_CTLCOLORSTATIC: @@ -99,7 +99,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (hBackgroundBrush) { SetClassLongPtr(hwndDlg, GCLP_HBRBACKGROUND, (LONG_PTR)hBackgroundBrush); - InvalidateRect(hwndDlg, 0, TRUE); + InvalidateRect(hwndDlg, nullptr, TRUE); } return TRUE; @@ -154,9 +154,9 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (data->action & AAF_SOUND && options.loop_sound) { if (data->sound_num <= 3) - SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, 0); + SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, nullptr); else if (data->sound_num == 4) - SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, 0); + SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, nullptr); } HWND hw = GetDlgItem(hwndDlg, IDC_SNOOZE); @@ -181,7 +181,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar Skin_PlaySound(buff); } else if (data->sound_num == 4) { - if (data->szTitle != NULL && data->szTitle[0] != '\0') { + if (data->szTitle != nullptr && data->szTitle[0] != '\0') { if (ServiceExists("Speak/Say")) { CallService("Speak/Say", 0, (LPARAM)data->szTitle); } @@ -312,7 +312,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT r; GetWindowRect(hwndDlg, &r); - SetWindowPos(hwndDlg, 0, r.left + (newp.x - wd->p.x), r.top + (newp.y - wd->p.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(hwndDlg, nullptr, r.left + (newp.x - wd->p.x), r.top + (newp.y - wd->p.y), 0, 0, SWP_NOSIZE | SWP_NOZORDER); } wd->p.x = newp.x; wd->p.y = newp.y; diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 0ea5f59810..cfa1310cf1 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -20,10 +20,10 @@ bool is_idle = false; void free_alarm_data(ALARM *alarm) { - mir_free(alarm->szTitle); alarm->szTitle = 0; - mir_free(alarm->szDesc); alarm->szDesc = 0; - mir_free(alarm->szCommand); alarm->szCommand = 0; - mir_free(alarm->szCommandParams); alarm->szCommandParams = 0; + mir_free(alarm->szTitle); alarm->szTitle = nullptr; + mir_free(alarm->szDesc); alarm->szDesc = nullptr; + mir_free(alarm->szCommand); alarm->szCommand = nullptr; + mir_free(alarm->szCommandParams); alarm->szCommandParams = nullptr; } void copy_alarm_data(ALARM *dest, ALARM *src) @@ -651,7 +651,7 @@ void DoAlarm(ALARM *alarm) Skin_PlaySound(buff); } else if (alarm->sound_num == 4) { - if (alarm->szTitle != NULL && alarm->szTitle[0] != '\0') { + if (alarm->szTitle != nullptr && alarm->szTitle[0] != '\0') { if (ServiceExists("Speak/Say")) { CallService("Speak/Say", 0, (LPARAM)alarm->szTitle); } @@ -679,7 +679,7 @@ void DoAlarm(ALARM *alarm) } if (alarm->action & AAF_COMMAND) - ShellExecute(0, 0, alarm->szCommand, alarm->szCommandParams, 0, SW_NORMAL); + ShellExecute(nullptr, nullptr, alarm->szCommand, alarm->szCommandParams, nullptr, SW_NORMAL); if (alarm->action & AAF_SYSTRAY) { CLISTEVENT cle = {}; @@ -802,7 +802,7 @@ void InitList() InitAlarmWin(); - timer_id = SetTimer(0, 0, TIMER_PERIOD, TimerProc); + timer_id = SetTimer(nullptr, 0, TIMER_PERIOD, TimerProc); HookEvent(ME_IDLE_CHANGED, IdleChanged); } @@ -814,7 +814,7 @@ void DeinitList() // i don't think this should be necessary, but... mir_cslock lck(alarm_cs); - KillTimer(0, timer_id); + KillTimer(nullptr, timer_id); DestroyHookableEvent(hAlarmTriggeredEvent); diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index dc7de3ca63..0e3139bc50 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -78,7 +78,7 @@ void ShowPopup(MCONTACT hContact, const wchar_t *msg) ppd.colorBack = GetSysColor(COLOR_BTNFACE); ppd.colorText = RGB(0, 0, 0); ppd.PluginWindowProc = PopupDlgProc; - ppd.PluginData = 0; + ppd.PluginData = nullptr; ppd.iSeconds = 3; // Now that every field has been filled, we want to see the popup. @@ -103,18 +103,18 @@ HBITMAP LoadBmpFromIcon(int IdRes) rc.right = bih.biWidth; rc.bottom = bih.biHeight; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight); HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE)); FillRect(hdcMem, &rc, hBkgBrush); - DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, nullptr, DI_NORMAL); SelectObject(hdcMem, hoBmp); DeleteDC(hdcMem); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); DeleteObject(hBkgBrush); DeleteObject(hIcon); @@ -124,7 +124,7 @@ HBITMAP LoadBmpFromIcon(int IdRes) static int InitTopToolbarButton(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBUP)); ttb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBDN)); ttb.pszService = MODULE "/NewAlarm"; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 2d3fc23d8e..fcbc4d75e0 100755 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -1,24 +1,24 @@ #include "stdafx.h" #include "frame.h" -HWND hwnd_plugin = 0; -HWND hwnd_frame = 0; -HWND hwnd_list = 0; +HWND hwnd_plugin = nullptr; +HWND hwnd_frame = nullptr; +HWND hwnd_list = nullptr; int frame_id = -1; FontID font_id; ColourID framebk_colour_id; -HFONT hFont = 0; +HFONT hFont = nullptr; COLORREF fontColour, framebk; -HBRUSH bk_brush = 0; +HBRUSH bk_brush = nullptr; #define CLUIFrameTitleBarClassName "CLUIFrameTitleBar" AlarmList alarm_list; mir_cs list_cs; -HGENMENU hMenuShowReminders = 0; +HGENMENU hMenuShowReminders = nullptr; #define ID_FRAME_UPDATE_TIMER 1011 #define ID_FRAME_SHOWHIDE_TIMER 1012 @@ -62,9 +62,9 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP RECT r; GetClientRect(hwnd, &r); - SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); - InvalidateRect(child, 0, TRUE); - InvalidateRect(hwnd, 0, TRUE); + SetWindowPos(child, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); + InvalidateRect(child, nullptr, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } break; @@ -100,13 +100,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_CREATE: hwnd_list = CreateWindow(L"LISTBOX", L"", (WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_STANDARD | LBS_NOTIFY | LBS_OWNERDRAWFIXED) & ~LBS_SORT - & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst, 0); + & ~WS_BORDER, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr); return FALSE; case WMU_INITIALIZE: PostMessage(hwnd, WMU_FILL_LIST, 0, 0); - SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, 0); - SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, 0); + SetTimer(hwnd, ID_FRAME_UPDATE_TIMER, 5000, nullptr); + SetTimer(hwnd, ID_FRAME_SHOWHIDE_TIMER, 200, nullptr); return TRUE; case WM_MEASUREITEM: @@ -135,7 +135,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetTextColor(dis->hDC, fontColour); HICON hIcon = (min <= 5 ? hIconList2 : hIconList1); - DrawIconEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 0, 0, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 0, 0, 0, nullptr, DI_NORMAL); GetTextExtentPoint32(dis->hDC, alarm.szTitle, (int)mir_wstrlen(alarm.szTitle), &textSize); @@ -213,7 +213,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (frame_id != -1) CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, FU_TBREDRAW); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } break; @@ -228,7 +228,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (options.auto_size_vert && IsWindowVisible(hwnd)) { if (FrameIsFloating()) { int height = height_client_to_frame(itemheight * count, GetWindowLongPtr(GetParent(hwnd), GWL_STYLE), GetWindowLongPtr(GetParent(hwnd), GWL_EXSTYLE)); - HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), 0, _A2W(CLUIFrameTitleBarClassName), 0); + HWND titleBarHwnd = FindWindowEx(GetParent(hwnd), nullptr, _A2W(CLUIFrameTitleBarClassName), nullptr); if (titleBarHwnd) { RECT tbr; GetWindowRect(titleBarHwnd, &tbr); @@ -236,7 +236,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar } RECT rp_window; GetWindowRect(GetParent(hwnd), &rp_window); - SetWindowPos(GetParent(hwnd), 0, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + SetWindowPos(GetParent(hwnd), nullptr, 0, 0, rp_window.right - rp_window.left, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); } else if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME) && frame_id != -1) { CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), count * itemheight); @@ -254,8 +254,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar height = min(count * itemheight, winheight - (winheight % itemheight)); if (r2.right - r2.left != width || (r.bottom - r.top > 0 && r2.bottom - r2.top != height)) { - SetWindowPos(hwnd_list, 0, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - InvalidateRect(hwnd_list, 0, FALSE); + SetWindowPos(hwnd_list, nullptr, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + InvalidateRect(hwnd_list, nullptr, FALSE); } if (options.auto_showhide) { @@ -374,7 +374,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar //ClientToScreen(hwnd_list, &pt); GetCursorPos(&pt); - BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); DestroyMenu(menu); if (ret) PostMessage(hwnd, WM_COMMAND, ret, 0); @@ -461,7 +461,7 @@ bool ReminderFrameVisible() void SetReminderFrameVisible(bool visible) { - if (frame_id == -1 && hwnd_frame != 0) + if (frame_id == -1 && hwnd_frame != nullptr) ShowWindow(hwnd_frame, visible ? SW_SHOW : SW_HIDE); } @@ -481,7 +481,7 @@ INT_PTR ShowHideMenuFunc(WPARAM, LPARAM) int CreateFrame() { WNDCLASS wndclass = {}; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hInstance = hInst; wndclass.lpfnWndProc = FrameWindowProc; wndclass.lpszClassName = L"AlarmsFrame"; @@ -490,7 +490,7 @@ int CreateFrame() if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"), WS_CHILD | WS_CLIPCHILDREN, - 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL); + 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr); CLISTFrame Frame = { sizeof(CLISTFrame) }; Frame.tname = TranslateT("Alarms"); @@ -502,7 +502,7 @@ int CreateFrame() frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0); } else { - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hInstance = hInst; wndclass.lpfnWndProc = FrameContainerWindowProc; wndclass.lpszClassName = L"AlarmsFrameContainer"; @@ -510,11 +510,11 @@ int CreateFrame() hwnd_frame = CreateWindowEx(WS_EX_TOOLWINDOW, L"AlarmsFrameContainer", TranslateT("Alarms"), (WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~WS_VISIBLE, - 0, 0, 200, 100, pcli->hwndContactList, NULL, hInst, NULL); + 0, 0, 200, 100, pcli->hwndContactList, nullptr, hInst, nullptr); hwnd_plugin = CreateWindow(L"AlarmsFrame", TranslateT("Alarms"), WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE, - 0, 0, 10, 10, hwnd_frame, NULL, hInst, NULL); + 0, 0, 10, 10, hwnd_frame, nullptr, hInst, nullptr); SetWindowLongPtr(hwnd_frame, GWLP_USERDATA, (LONG_PTR)hwnd_plugin); @@ -594,9 +594,9 @@ void RefreshReminderFrame() SendMessage(hwnd_plugin, WMU_FILL_LIST, 0, 0); if (frame_id == -1) - InvalidateRect(hwnd_frame, 0, TRUE); + InvalidateRect(hwnd_frame, nullptr, TRUE); else - InvalidateRect(hwnd_plugin, 0, TRUE); + InvalidateRect(hwnd_plugin, nullptr, TRUE); } void InitFrames() diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index dbc5cf3dcc..ec2a9a3467 100755 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -18,10 +18,10 @@ struct AddEditParam BOOL self_add; }; -HGENMENU hMainMenuItem = 0; +HGENMENU hMainMenuItem = nullptr; // store options dialog window handle statically so it can be refreshed by non-modal add alarm dialog -HWND hwndOptionsDialog = 0; +HWND hwndOptionsDialog = nullptr; static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_DESC, buff, _countof(buff)); replaceStrW(add_edit_alarm->szDesc, buff); - if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') { + if (add_edit_alarm->szTitle == nullptr || add_edit_alarm->szTitle[0] == '\0') { MessageBox(hwndDlg, TranslateT("Please enter a title for this alarm."), TranslateT("Error"), MB_OK | MB_ICONERROR); return TRUE; } @@ -847,13 +847,13 @@ public: class Node { public: - Node() : next(0) {} + Node() : next(nullptr) {} unsigned short value; Node *next; }; - ShortList() : head(0) {} + ShortList() : head(nullptr) {} virtual ~ShortList() { clear(); } void clear() @@ -1198,7 +1198,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_DESTROY: - hwndOptionsDialog = 0; + hwndOptionsDialog = nullptr; added_list.clear(); modified_list.clear(); deleted_list.clear(); diff --git a/plugins/AsSingleWindow/src/AsSingleWindow.cpp b/plugins/AsSingleWindow/src/AsSingleWindow.cpp index 4459f498c3..371db5e7f3 100644 --- a/plugins/AsSingleWindow/src/AsSingleWindow.cpp +++ b/plugins/AsSingleWindow/src/AsSingleWindow.cpp @@ -73,7 +73,7 @@ int MsgWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData* data = (MessageWindowEventData*)lParam; - if (data == NULL) + if (data == nullptr) return 0; switch (data->uType) { diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 873283fea4..1a153b144e 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -60,7 +60,7 @@ static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled) mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName); db_set_b(NULL, "AssocMgr", szSetting, (BYTE)fEnabled); // dll name for uninstall - if (assoc->hInstance != NULL && assoc->hInstance != hInst && assoc->hInstance != GetModuleHandle(NULL)) + if (assoc->hInstance != nullptr && assoc->hInstance != hInst && assoc->hInstance != GetModuleHandle(nullptr)) if (GetModuleFileName(assoc->hInstance, szBuf, _countof(szBuf))) if (PathToRelativeW(szBuf, szDLL)) { mir_snprintf(szSetting, "module_%s", assoc->pszClassName); @@ -97,7 +97,7 @@ void CleanupAssocEnabledSettings(void) if (!db_get_ws(NULL, "AssocMgr", szSetting, &dbv)) { if (PathToAbsoluteW(dbv.ptszVal, szDLL)) { // file still exists? - hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile == INVALID_HANDLE_VALUE) { db_unset(NULL, "AssocMgr", ppszSettings[i]); db_unset(NULL, "AssocMgr", szSetting); @@ -174,7 +174,7 @@ static void CALLBACK NotifyTimerProc(HWND hwnd, UINT, UINT_PTR nTimerID, DWORD) mir_cslock lck(csNotifyTimer); KillTimer(hwnd, nTimerID); if (nNotifyTimerID == nTimerID) // might be stopped previously - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, NULL); + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, nullptr, nullptr); nNotifyTimerID = 0; } @@ -183,9 +183,9 @@ static void NotifyAssocChange(BOOL fNow) mir_cslock lck(csNotifyTimer); if (fNow) { nNotifyTimerID = 0; // stop previous timer - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, NULL, NULL); + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, nullptr, nullptr); } - else nNotifyTimerID = SetTimer(NULL, nNotifyTimerID, SHELLNOTIFY_DELAY, NotifyTimerProc); + else nNotifyTimerID = SetTimer(nullptr, nNotifyTimerID, SHELLNOTIFY_DELAY, NotifyTimerProc); } /************************* Assoc List Utils ***********************/ @@ -214,7 +214,7 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) { ASSOCDATA *assoc2; assoc2 = (ASSOCDATA*)mir_alloc(sizeof(ASSOCDATA)); - if (assoc2 == NULL) return NULL; + if (assoc2 == nullptr) return nullptr; assoc2->pszClassName = mir_strdup(assoc->pszClassName); assoc2->pszDescription = mir_wstrdup(assoc->pszDescription); assoc2->hInstance = assoc->hInstance; @@ -224,8 +224,8 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) assoc2->pszFileExt = mir_strdup(assoc->pszFileExt); assoc2->pszMimeType = mir_strdup(assoc->pszMimeType); assoc2->pszVerbDesc = mir_wstrdup(assoc->pszVerbDesc); - if (assoc2->pszClassName == NULL || assoc2->pszDescription == NULL || - (assoc2->pszFileExt == NULL && assoc->pszFileExt != NULL)) { + if (assoc2->pszClassName == nullptr || assoc2->pszDescription == nullptr || + (assoc2->pszFileExt == nullptr && assoc->pszFileExt != nullptr)) { mir_free(assoc2->pszClassName); // does NULL check mir_free(assoc2->pszDescription); // does NULL check mir_free(assoc2->pszService); // does NULL check @@ -233,7 +233,7 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) mir_free(assoc2->pszMimeType); // does NULL check mir_free(assoc2->pszVerbDesc); // does NULL check mir_free(assoc2); - return NULL; + return nullptr; } return assoc2; } @@ -242,19 +242,19 @@ static ASSOCDATA* CopyAssocItem(const ASSOCDATA *assoc) // this function assumes CoInitialize() has been called before static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, int iPrevIndex) { - HICON hIcon = NULL; + HICON hIcon = nullptr; int index; - if (himl == NULL) return -1; + if (himl == nullptr) return -1; // load icon hIcon = LoadRegClassSmallIcon(assoc->pszClassName); - if (hIcon == NULL) { + if (hIcon == nullptr) { SHFILEINFOA sfi; - if (SHGetFileInfoA((assoc->pszFileExt != NULL) ? assoc->pszFileExt : "", FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES)) + if (SHGetFileInfoA((assoc->pszFileExt != nullptr) ? assoc->pszFileExt : "", FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES)) hIcon = sfi.hIcon; // WinXP: this icon is not updated until the process exits } // add icon - if (hIcon == NULL) return -1; + if (hIcon == nullptr) return -1; index = ImageList_ReplaceIcon(himl, iPrevIndex, hIcon); DestroyIcon(hIcon); return index; @@ -265,7 +265,7 @@ static int ReplaceImageListAssocIcon(HIMAGELIST himl, const ASSOCDATA *assoc, in static wchar_t* GetAssocTypeDesc(const ASSOCDATA *assoc) { static wchar_t szDesc[32]; - if (assoc->pszFileExt == NULL) + if (assoc->pszFileExt == nullptr) mir_snwprintf(szDesc, L"%hs:", assoc->pszClassName); else mir_snwprintf(szDesc, TranslateT("%hs files"), assoc->pszFileExt); @@ -277,12 +277,12 @@ static BOOL IsAssocRegistered(const ASSOCDATA *assoc) { BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine; - fIsUrl = (assoc->pszFileExt == NULL); - fUseMainCmdLine = (assoc->pszService == NULL); + fIsUrl = (assoc->pszFileExt == nullptr); + fUseMainCmdLine = (assoc->pszService == nullptr); // class wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine); - if (pszRunCmd != NULL) + if (pszRunCmd != nullptr) fSuccess = IsRegClass(assoc->pszClassName, pszRunCmd); mir_free(pszRunCmd); // does NULL check // file ext @@ -299,34 +299,34 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc) BOOL fSuccess = FALSE, fIsUrl, fUseMainCmdLine; wchar_t *pszIconLoc, *pszRunCmd, *pszDdeCmd, *pszAppFileName; - fIsUrl = (assoc->pszFileExt == NULL); - fUseMainCmdLine = (assoc->pszService == NULL); + fIsUrl = (assoc->pszFileExt == nullptr); + fUseMainCmdLine = (assoc->pszService == nullptr); pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine); - if (pszRunCmd != NULL) { + if (pszRunCmd != nullptr) { fSuccess = TRUE; // tentatively // do not overwrite user customized settings if (!IsRegClass(assoc->pszClassName, pszRunCmd)) { // class icon - if (!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(NULL, 0); // miranda logo + if (!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(nullptr, 0); // miranda logo else if (!assoc->nIconResID) pszIconLoc = MakeIconLocation(hInst, IDI_MIRANDAFILE); // generic file else pszIconLoc = MakeIconLocation(assoc->hInstance, assoc->nIconResID); // register class - if (fUseMainCmdLine) pszDdeCmd = NULL; + if (fUseMainCmdLine) pszDdeCmd = nullptr; else pszDdeCmd = fIsUrl ? DDEURLCMD : DDEFILECMD; fSuccess = AddRegClass(assoc->pszClassName, assoc->pszDescription, pszIconLoc, _A2W(MIRANDANAME), pszRunCmd, pszDdeCmd, DDEAPP, DDETOPIC, assoc->pszVerbDesc, assoc->flags&FTDF_BROWSERAUTOOPEN, fIsUrl, assoc->flags&FTDF_ISSHORTCUT); mir_free(pszIconLoc); // does NULL check // file type if (fSuccess && !fIsUrl) { // register mime type - if (assoc->pszMimeType != NULL) + if (assoc->pszMimeType != nullptr) if (AddRegMimeType(assoc->pszMimeType, assoc->pszFileExt)) RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, TRUE); // register file ext fSuccess = AddRegFileExt(assoc->pszFileExt, assoc->pszClassName, assoc->pszMimeType, assoc->flags&FTDF_ISTEXT); // register open-with pszAppFileName = MakeAppFileName(fUseMainCmdLine); - if (pszAppFileName != NULL) + if (pszAppFileName != nullptr) AddRegOpenWithExtEntry(pszAppFileName, assoc->pszFileExt, assoc->pszDescription); mir_free(pszAppFileName); // does NULL check } @@ -344,12 +344,12 @@ static BOOL UnregisterAssoc(const ASSOCDATA *assoc) BOOL fIsUrl, fUseMainCmdLine; wchar_t *pszAppFileName; - fIsUrl = (assoc->pszFileExt == NULL); - fUseMainCmdLine = (assoc->pszService == NULL); + fIsUrl = (assoc->pszFileExt == nullptr); + fUseMainCmdLine = (assoc->pszService == nullptr); // class might have been registered by another instance wchar_t *pszRunCmd = MakeRunCommand(fUseMainCmdLine, !fUseMainCmdLine); - if (pszRunCmd != NULL && !IsRegClass(assoc->pszClassName, pszRunCmd)) { + if (pszRunCmd != nullptr && !IsRegClass(assoc->pszClassName, pszRunCmd)) { mir_free(pszRunCmd); return TRUE; // succeed anyway } @@ -360,14 +360,14 @@ static BOOL UnregisterAssoc(const ASSOCDATA *assoc) // file extension RemoveRegFileExt(assoc->pszFileExt, assoc->pszClassName); // mime type - if (assoc->pszMimeType != NULL) + if (assoc->pszMimeType != nullptr) if (WasMimeTypeAdded(assoc->pszMimeType)) { RemoveRegMimeType(assoc->pszMimeType, assoc->pszFileExt); RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, FALSE); } // open-with entry pszAppFileName = MakeAppFileName(fUseMainCmdLine); - if (pszAppFileName != NULL) + if (pszAppFileName != nullptr) RemoveRegOpenWithExtEntry(pszAppFileName, assoc->pszFileExt); mir_free(pszAppFileName); // does NULL check } @@ -402,7 +402,7 @@ static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, // resize storage array pAssocListBuf = (ASSOCDATA*)mir_realloc(pAssocList, (nAssocListCount + 1)*sizeof(ASSOCDATA)); - if (pAssocListBuf == NULL) + if (pAssocListBuf == nullptr) return FALSE; pAssocList = pAssocListBuf; @@ -419,7 +419,7 @@ static BOOL AddNewAssocItem_Worker(char *pszClassName, const TYPEDESCHEAD *tdh, assoc->pszVerbDesc = pszVerbDesc; // error check - if (assoc->pszDescription == NULL || (assoc->pszService == NULL && tdh->pszService != NULL)) { + if (assoc->pszDescription == nullptr || (assoc->pszService == nullptr && tdh->pszService != nullptr)) { mir_free(assoc->pszService); // does NULL check mir_free(assoc->pszDescription); // does NULL check return FALSE; @@ -448,7 +448,7 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) // delete registry keys and db setting UnregisterAssoc(assoc); - if (assoc->pszMimeType != NULL) + if (assoc->pszMimeType != nullptr) RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, FALSE); DeleteAssocEnabledSetting(assoc); @@ -464,7 +464,7 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) if ((index + 1) < nAssocListCount) memmove(assoc, &pAssocList[index + 1], ((nAssocListCount - index - 1)*sizeof(ASSOCDATA))); pAssocListBuf = (ASSOCDATA*)mir_realloc(pAssocList, (nAssocListCount - 1)*sizeof(ASSOCDATA)); - if (pAssocListBuf != NULL) pAssocList = pAssocListBuf; + if (pAssocListBuf != nullptr) pAssocList = pAssocListBuf; --nAssocListCount; NotifyAssocChange(FALSE); @@ -478,12 +478,12 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam) const FILETYPEDESC *ftd = (FILETYPEDESC*)lParam; if (ftd->cbSize < sizeof(FILETYPEDESC)) return 1; - if (ftd->pszFileExt == NULL || ftd->pszFileExt[0] != '.') + if (ftd->pszFileExt == nullptr || ftd->pszFileExt[0] != '.') return 2; char *pszFileExt = mir_strdup(ftd->pszFileExt); char *pszClassName = MakeFileClassName(ftd->pszFileExt); - if (pszFileExt != NULL && pszClassName != NULL) { + if (pszFileExt != nullptr && pszClassName != nullptr) { wchar_t *pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); // does NULL check char *pszMimeType = mir_strdup(ftd->pszMimeType); // does NULL check if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)ftd, pszFileExt, pszVerbDesc, pszMimeType)) @@ -498,9 +498,9 @@ static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam) static INT_PTR ServiceRemoveFileType(WPARAM, LPARAM lParam) { - if ((char*)lParam == NULL) return 2; + if ((char*)lParam == nullptr) return 2; char *pszClassName = MakeFileClassName((char*)lParam); - if (pszClassName != NULL) + if (pszClassName != nullptr) if (RemoveAssocItem_Worker(pszClassName)) { mir_free(pszClassName); return 0; @@ -515,14 +515,14 @@ static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam) if (utd->cbSize < sizeof(URLTYPEDESC)) return 1; - if (utd->pszService == NULL) + if (utd->pszService == nullptr) return 2; - if (utd->pszProtoPrefix == NULL || utd->pszProtoPrefix[mir_strlen(utd->pszProtoPrefix) - 1] != ':') + if (utd->pszProtoPrefix == nullptr || utd->pszProtoPrefix[mir_strlen(utd->pszProtoPrefix) - 1] != ':') return 2; char *pszClassName = MakeUrlClassName(utd->pszProtoPrefix); - if (pszClassName != NULL) - if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)utd, NULL, NULL, NULL)) + if (pszClassName != nullptr) + if (AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)utd, nullptr, nullptr, nullptr)) // no need to free pszClassName, as its ownership got transferred to storage list return 0; mir_free(pszClassName); // does NULL check @@ -531,9 +531,9 @@ static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam) static INT_PTR ServiceRemoveUrlType(WPARAM, LPARAM lParam) { - if ((char*)lParam == NULL) return 2; + if ((char*)lParam == nullptr) return 2; char *pszClassName = MakeUrlClassName((char*)lParam); - if (pszClassName != NULL) + if (pszClassName != nullptr) if (RemoveAssocItem_Worker(pszClassName)) { mir_free(pszClassName); return 0; @@ -556,11 +556,11 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const wchar_t *pszPar return FALSE; ASSOCDATA *assoc = &pAssocList[index]; // no service specified? correct registry to use main commandline - if (assoc->pszService == NULL) { + if (assoc->pszService == nullptr) { EnsureAssocRegistered(assoc); NotifyAssocChange(FALSE); // try main command line - if ((INT_PTR)ShellExecute(NULL, NULL, pszParam, NULL, NULL, SW_SHOWNORMAL) >= 32) + if ((INT_PTR)ShellExecute(nullptr, nullptr, pszParam, nullptr, nullptr, SW_SHOWNORMAL) >= 32) *res = 0; // success return TRUE; } @@ -569,7 +569,7 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const wchar_t *pszPar pvParam = t2s(pszParam, assoc->flags&FTDF_UNICODE, FALSE); // call service - if (pszService != NULL && pvParam != NULL) + if (pszService != nullptr && pvParam != nullptr) *res = CallService(pszService, 0, (LPARAM)pvParam); mir_free(pszService); // does NULL check mir_free(pvParam); // does NULL check @@ -583,12 +583,12 @@ INT_PTR InvokeFileHandler(const wchar_t *pszFileName) // find extension wchar_t *p = (wchar_t*)wcsrchr(pszFileName, '.'); - if (p != NULL) { + if (p != nullptr) { pszFileExt = t2a(p); - if (pszFileExt != NULL) { + if (pszFileExt != nullptr) { // class name pszClassName = MakeFileClassName(pszFileExt); - if (pszClassName != NULL) + if (pszClassName != nullptr) if (!InvokeHandler_Worker(pszClassName, pszFileName, &res)) { // correct registry on error (no longer in list) RemoveRegFileExt(pszFileExt, pszClassName); @@ -608,13 +608,13 @@ INT_PTR InvokeUrlHandler(const wchar_t *pszUrl) // find prefix pszProtoPrefix = t2a(pszUrl); - if (pszProtoPrefix != NULL) { + if (pszProtoPrefix != nullptr) { p = strchr(pszProtoPrefix, ':'); - if (p != NULL) { + if (p != nullptr) { *(++p) = 0; // remove trailing : // class name pszClassName = MakeUrlClassName(pszProtoPrefix); - if (pszClassName != NULL) + if (pszClassName != nullptr) if (!InvokeHandler_Worker(pszClassName, pszUrl, &res)) // correct registry on error (no longer in list) RemoveRegClass(pszClassName); @@ -630,12 +630,12 @@ INT_PTR InvokeUrlHandler(const wchar_t *pszUrl) static int CALLBACK ListViewSortDesc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { int cmp; - if (((ASSOCDATA*)lParam1)->pszFileExt != NULL && ((ASSOCDATA*)lParam2)->pszFileExt != NULL) + if (((ASSOCDATA*)lParam1)->pszFileExt != nullptr && ((ASSOCDATA*)lParam2)->pszFileExt != nullptr) cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszFileExt, -1, ((ASSOCDATA*)lParam2)->pszFileExt, -1); else if (((ASSOCDATA*)lParam1)->pszFileExt == ((ASSOCDATA*)lParam2)->pszFileExt) // both NULL cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszClassName, -1, ((ASSOCDATA*)lParam2)->pszClassName, -1); else // different types, incomparable - cmp = (((ASSOCDATA*)lParam1)->pszFileExt == NULL) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; + cmp = (((ASSOCDATA*)lParam1)->pszFileExt == nullptr) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; if (cmp == CSTR_EQUAL) cmp = CompareString((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszDescription, -1, ((ASSOCDATA*)lParam2)->pszDescription, -1); if (cmp != 0) cmp -= 2; // maintain CRT conventions @@ -652,7 +652,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); - CoInitialize(NULL); + CoInitialize(nullptr); HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST); ListView_SetUnicodeFormat(hwndList, TRUE); @@ -675,11 +675,11 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara mir_cslock lck(csAssocList); { HDC hdc = GetDC(hwndList); - if (hdc != NULL) { // BITSPIXEL is compatible with ILC_COLOR flags + if (hdc != nullptr) { // BITSPIXEL is compatible with ILC_COLOR flags himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), GetDeviceCaps(hdc, BITSPIXEL) | ILC_MASK, nAssocListCount, 0); ReleaseDC(hwndList, hdc); } - else himl = NULL; + else himl = nullptr; } ListView_SetImageList(hwndList, himl, LVSIL_SMALL); // autodestroyed // enum assoc list @@ -729,8 +729,8 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.mask = LVIF_PARAM | LVIF_GROUPID; for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) { assoc = (ASSOCDATA*)lvi.lParam; - if (assoc == NULL) continue; // groups - lvi.iGroupId = (assoc->pszFileExt == NULL) + 1; + if (assoc == nullptr) continue; // groups + lvi.iGroupId = (assoc->pszFileExt == nullptr) + 1; ListView_SetItem(hwndList, &lvi); } } @@ -742,7 +742,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara // autostart wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE); - if (pszRunCmd != NULL) { + if (pszRunCmd != nullptr) { CheckDlgButton(hwndDlg, IDC_AUTOSTART, IsRegRunEntry(L"MirandaNG", pszRunCmd) ? BST_CHECKED : BST_UNCHECKED); mir_free(pszRunCmd); } @@ -759,7 +759,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.mask = LVIF_PARAM | LVIF_IMAGE; for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) { assoc = (ASSOCDATA*)lvi.lParam; - if (assoc == NULL) continue; // groups + if (assoc == nullptr) continue; // groups lvi.iImage = ReplaceImageListAssocIcon(himl, assoc, lvi.iImage); ListView_SetItem(hwndList, &lvi); } @@ -777,7 +777,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara HBRUSH hBrush = (HBRUSH)SendMessage(hwndDlg, msg, wParam, lParam); COLORREF clr; HTHEME hTheme = GetWindowTheme((HWND)lParam); - if (hTheme != NULL && !GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) { + if (hTheme != nullptr && !GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) { SetBkMode((HDC)wParam, TRANSPARENT); SetTextColor((HDC)wParam, clr); } @@ -831,7 +831,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem = ListView_GetNextItem(nmhdr->hwndFrom, lvi.iItem, LVNI_ABOVE); if (lvi.iItem != -1) if (ListView_GetItem(nmhdr->hwndFrom, &lvi)) - if ((ASSOCDATA*)lvi.lParam == NULL) // groups + if ((ASSOCDATA*)lvi.lParam == nullptr) // groups lvi.iItem = -1; if (lvi.iItem == -1) { SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); // eat it @@ -846,7 +846,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem -= ListView_GetCountPerPage(nmhdr->hwndFrom); if (lvi.iItem >= 0) if (ListView_GetItem(nmhdr->hwndFrom, &lvi)) - if ((ASSOCDATA*)lvi.lParam == NULL) // groups + if ((ASSOCDATA*)lvi.lParam == nullptr) // groups lvi.iItem = -1; if (lvi.iItem < 0) { ListView_SetItemState(nmhdr->hwndFrom, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); @@ -874,14 +874,14 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara mir_cslock lck(csAssocList); for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) { assoc = (ASSOCDATA*)lvi.lParam; - if (assoc == NULL) continue; // groups + if (assoc == nullptr) continue; // groups fEnabled = ListView_GetCheckState(hwndList, lvi.iItem); SetAssocEnabled(assoc, fEnabled); // re-register registery keys if (fEnabled ? !EnsureAssocRegistered(assoc) : !UnregisterAssoc(assoc)) { char *pszErr = GetWinErrorDescription(GetLastError()); - ShowInfoMessage(NIIF_ERROR, Translate("File association error"), Translate("There was an error writing to the registry to modify the file/url associations.\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown")); + ShowInfoMessage(NIIF_ERROR, Translate("File association error"), Translate("There was an error writing to the registry to modify the file/url associations.\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown")); mir_free(pszErr); // does NULL check fRegFailed = TRUE; // just show one time } @@ -892,12 +892,12 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara // autostart wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE); fRegFailed = FALSE; - if (pszRunCmd != NULL) { + if (pszRunCmd != nullptr) { fEnabled = IsDlgButtonChecked(hwndDlg, IDC_AUTOSTART); if (fEnabled ? !AddRegRunEntry(L"MirandaNG", pszRunCmd) : !RemoveRegRunEntry(L"MirandaNG", pszRunCmd)) { char *pszErr; pszErr = GetWinErrorDescription(GetLastError()); - ShowInfoMessage(NIIF_ERROR, Translate("Autostart error"), Translate("There was an error writing to the registry to modify the autostart list.\n\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown")); + ShowInfoMessage(NIIF_ERROR, Translate("Autostart error"), Translate("There was an error writing to the registry to modify the autostart list.\n\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown")); mir_free(pszErr); // does NULL check fRegFailed = TRUE; // just show one time } @@ -937,7 +937,7 @@ void InitAssocList(void) hHookOptInit = HookEvent(ME_OPT_INITIALISE, AssocListOptInit); // Assoc List - pAssocList = NULL; + pAssocList = nullptr; nAssocListCount = 0; // Services @@ -952,19 +952,19 @@ void InitAssocList(void) // register open-with app { wchar_t *pszAppFileName, *pszIconLoc, *pszRunCmd; - pszIconLoc = MakeIconLocation(NULL, 0); + pszIconLoc = MakeIconLocation(nullptr, 0); // miranda32.exe pszAppFileName = MakeAppFileName(TRUE); pszRunCmd = MakeRunCommand(TRUE, FALSE); - if (pszAppFileName != NULL && pszRunCmd != NULL) - AddRegOpenWith(pszAppFileName, FALSE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, NULL, NULL, NULL); + if (pszAppFileName != nullptr && pszRunCmd != nullptr) + AddRegOpenWith(pszAppFileName, FALSE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, nullptr, nullptr, nullptr); mir_free(pszRunCmd); // does NULL check mir_free(pszAppFileName); // does NULL check // assocmgr.dll pszAppFileName = MakeAppFileName(FALSE); pszRunCmd = MakeRunCommand(FALSE, TRUE); - if (pszAppFileName != NULL && pszRunCmd != NULL) + if (pszAppFileName != nullptr && pszRunCmd != nullptr) AddRegOpenWith(pszAppFileName, TRUE, _A2W(MIRANDANAME), pszIconLoc, pszRunCmd, DDEFILECMD, DDEAPP, DDETOPIC); mir_free(pszRunCmd); // does NULL check mir_free(pszAppFileName); // does NULL check @@ -977,12 +977,12 @@ void InitAssocList(void) FILETYPEDESC ftd; ftd.cbSize = sizeof(FILETYPEDESC); ftd.pszFileExt = ".dat"; - ftd.pszMimeType = NULL; + ftd.pszMimeType = nullptr; ftd.pwszDescription = TranslateT("Miranda NG database"); ftd.hInstance = hInst; ftd.nIconResID = IDI_MIRANDAFILE; - ftd.ptszVerbDesc = NULL; - ftd.pszService = NULL; + ftd.ptszVerbDesc = nullptr; + ftd.pszService = nullptr; ftd.flags = FTDF_DEFAULTDISABLED | FTDF_TCHAR; ServiceAddNewFileType(0, (LPARAM)&ftd); } diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp index 13da3b00eb..0e9d29fb0e 100644 --- a/plugins/AssocMgr/src/dde.cpp +++ b/plugins/AssocMgr/src/dde.cpp @@ -75,7 +75,7 @@ static wchar_t* GetExecuteParam(wchar_t **ppszString) if (fQuoted) pszParam++; wchar_t *p = wcschr(pszParam, (wchar_t)(fQuoted ? '"' : ',')); - if (p != NULL) { + if (p != nullptr) { *(p++) = 0; if (fQuoted && *p == ',') p++; } @@ -105,14 +105,14 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_DDE_EXECUTE: /* posted message */ HGLOBAL hCommand; - if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hCommand)) { + if (UnpackDDElParam(msg, lParam, nullptr, (PUINT_PTR)&hCommand)) { /* ANSI execute command can't happen for shell */ if (IsWindowUnicode((HWND)wParam)) { wchar_t *pszCommand = (wchar_t*)GlobalLock(hCommand); - if (pszCommand != NULL) { + if (pszCommand != nullptr) { wchar_t *pszAction = GetExecuteParam(&pszCommand); wchar_t *pszArg = GetExecuteParam(&pszCommand); - if (pszArg != NULL) { + if (pszArg != nullptr) { /* we are inside miranda here, we make it async so the shell does * not timeout regardless what the plugins try to do. */ if (!mir_wstrcmpi(pszAction, L"file")) @@ -147,7 +147,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPA ATOM hSzItem; DDEACK ack; memset(&ack, 0, sizeof(ack)); - if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hSzItem)) { + if (UnpackDDElParam(msg, lParam, nullptr, (PUINT_PTR)&hSzItem)) { lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT)hSzItem); if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) { if (hSzItem) GlobalDeleteAtom(hSzItem); @@ -166,18 +166,18 @@ static HANDLE StartupMainProcess(wchar_t *pszDatabasePath) wchar_t *p, szPath[MAX_PATH]; /* we are inside RunDll32 here */ - if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return NULL; + if (!GetModuleFileName(hInst, szPath, _countof(szPath))) return nullptr; p = wcsrchr(szPath, '\\'); - if (p != NULL) { *p = 0; p = wcsrchr(szPath, '\\'); } - if (p == NULL) return NULL; + if (p != nullptr) { *p = 0; p = wcsrchr(szPath, '\\'); } + if (p == nullptr) return nullptr; mir_wstrcpy(++p, L"miranda32.exe"); /* inherit startup data from RunDll32 process */ STARTUPINFO si; GetStartupInfo(&si); PROCESS_INFORMATION pi; - if (!CreateProcess(szPath, pszDatabasePath, NULL, NULL, TRUE, GetPriorityClass(GetCurrentProcess()), NULL, NULL, &si, &pi)) - return NULL; + if (!CreateProcess(szPath, pszDatabasePath, nullptr, nullptr, TRUE, GetPriorityClass(GetCurrentProcess()), nullptr, nullptr, &si, &pi)) + return nullptr; CloseHandle(pi.hThread); return pi.hProcess; } @@ -189,10 +189,10 @@ EXTERN_C __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, wchar_t DWORD dwTick; /* wait for dde window to be available (avoiding race condition) */ - pHandles[0] = CreateEvent(NULL, TRUE, FALSE, WNDCLASS_DDEMSGWINDOW); - if (pHandles[0] != NULL) { + pHandles[0] = CreateEvent(nullptr, TRUE, FALSE, WNDCLASS_DDEMSGWINDOW); + if (pHandles[0] != nullptr) { pHandles[1] = StartupMainProcess(pszCmdLine); /* obeys nCmdShow using GetStartupInfo() */ - if (pHandles[1] != NULL) { + if (pHandles[1] != nullptr) { dwTick = GetTickCount(); /* either process terminated or dde window created */ if (WaitForMultipleObjects(_countof(pHandles), pHandles, FALSE, DDEMESSAGETIMEOUT) == WAIT_OBJECT_0) { @@ -213,7 +213,7 @@ EXTERN_C __declspec(dllexport) void CALLBACK WaitForDDE(HWND, HINSTANCE, wchar_t static int DdePreShutdown(WPARAM, LPARAM) { /* dde needs to be stopped before any plugins are unloaded */ - if (hwndDdeMsg != NULL) DestroyWindow(hwndDdeMsg); + if (hwndDdeMsg != nullptr) DestroyWindow(hwndDdeMsg); UnregisterClass(WNDCLASS_DDEMSGWINDOW, hInst); return 0; } @@ -226,19 +226,19 @@ static int DdeModulesLoaded2(WPARAM, LPARAM) wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = hInst; - wcl.hCursor = NULL; + wcl.hCursor = nullptr; wcl.lpszClassName = WNDCLASS_DDEMSGWINDOW; - wcl.hbrBackground = NULL; - wcl.hIcon = NULL; - wcl.lpszMenuName = NULL; + wcl.hbrBackground = nullptr; + wcl.hIcon = nullptr; + wcl.lpszMenuName = nullptr; wcl.style = 0; RegisterClass(&wcl); /* Note: use of HWND_MESSAGE does not fit for DDE as the window must be a top-level one */ - hwndDdeMsg = CreateWindow(WNDCLASS_DDEMSGWINDOW, NULL, 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL); + hwndDdeMsg = CreateWindow(WNDCLASS_DDEMSGWINDOW, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr); /* make known dde startup code is passed */ HANDLE hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, WNDCLASS_DDEMSGWINDOW); - if (hEvent != NULL) { + if (hEvent != nullptr) { SetEvent(hEvent); CloseHandle(hEvent); } diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 7a717a0766..43976f1217 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -34,8 +34,8 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, pszErr = GetWinErrorDescription(res); pszInfo2 = s2t(pszInfo, fInfoUnicode, FALSE); // does NULL check mir_snwprintf(szMsg, TranslateT("Access failed:\n%.64hs(%.128s)\n%.250hs(%u)\n%.256hs (%u)"), pszFunc, pszInfo2, pszFile, nLine, pszErr, res); - MessageBox(NULL, szMsg, TranslateT("Registry warning"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL); - if (pszErr != NULL) LocalFree(pszErr); + MessageBox(nullptr, szMsg, TranslateT("Registry warning"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST | MB_TASKMODAL); + if (pszErr != nullptr) LocalFree(pszErr); mir_free(pszInfo2); // does NULL check } return res; @@ -100,7 +100,7 @@ char* MakeFileClassName(const char *pszFileExt) { size_t cbLen = mir_strlen(pszFileExt) + 12; char *pszClass = (char*)mir_alloc(cbLen); - if (pszClass != NULL) + if (pszClass != nullptr) // using correctly formated PROGID mir_snprintf(pszClass, cbLen, "miranda%sfile", pszFileExt); // includes dot, buffer safe return pszClass; @@ -110,7 +110,7 @@ char* MakeFileClassName(const char *pszFileExt) char* MakeUrlClassName(const char *pszUrl) { char *pszClass = mir_strdup(pszUrl); - if (pszClass != NULL) + if (pszClass != nullptr) // remove trailing : pszClass[mir_strlen(pszClass) - 1] = 0; return pszClass; @@ -119,7 +119,7 @@ char* MakeUrlClassName(const char *pszUrl) static BOOL IsFileClassName(char *pszClassName, char **ppszFileExt) { *ppszFileExt = strchr(pszClassName, '.'); - return *ppszFileExt != NULL; + return *ppszFileExt != nullptr; } // mir_free() the return value @@ -128,15 +128,15 @@ wchar_t* MakeRunCommand(BOOL fMirExe, BOOL fFixedDbProfile) wchar_t szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt; if (fFixedDbProfile) { if (Profile_GetNameW(_countof(szDbFile), szDbFile)) - return NULL; + return nullptr; wchar_t *p = wcsrchr(szDbFile, '.'); if (p) *p = 0; } else mir_wstrcpy(szDbFile, L"%1"); // buffer safe - if (!GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe))) - return NULL; + if (!GetModuleFileName(fMirExe ? nullptr : hInst, szExe, _countof(szExe))) + return nullptr; if (fMirExe) // run command for miranda32.exe @@ -148,7 +148,7 @@ wchar_t* MakeRunCommand(BOOL fMirExe, BOOL fFixedDbProfile) GetShortPathName(szExe, szExe, _countof(szExe)); // surround by quotes if failed size_t len = mir_wstrlen(szExe); - if (wcschr(szExe, ' ') != NULL && (len + 2) < _countof(szExe)) { + if (wcschr(szExe, ' ') != nullptr && (len + 2) < _countof(szExe)) { memmove(szExe, szExe + 1, (len + 1) * sizeof(wchar_t)); szExe[len + 2] = szExe[0] = '\"'; szExe[len + 3] = 0; @@ -168,29 +168,29 @@ static BOOL IsValidRunCommand(const wchar_t *pszRunCmd) // split into executable path and arguments if (buf[0] == '\"') { pargs = wcschr(&buf[1], '\"'); - if (pargs != NULL) *(pargs++) = 0; + if (pargs != nullptr) *(pargs++) = 0; pexe = &buf[1]; if (*pargs == ' ') ++pargs; } else { pargs = wcschr(buf, ' '); - if (pargs != NULL) *pargs = 0; + if (pargs != nullptr) *pargs = 0; pexe = buf; } - if (SearchPath(NULL, pexe, L".exe", _countof(szFullExe), szFullExe, &pszFilePart)) { - if (pszFilePart != NULL) + if (SearchPath(nullptr, pexe, L".exe", _countof(szFullExe), szFullExe, &pszFilePart)) { + if (pszFilePart != nullptr) if (!mir_wstrcmpi(pszFilePart, L"rundll32.exe") || !mir_wstrcmpi(pszFilePart, L"rundll.exe")) { // split into dll path and arguments if (pargs[0] == '\"') { ++pargs; pexe = wcschr(&pargs[1], '\"'); - if (pexe != NULL) *pexe = 0; + if (pexe != nullptr) *pexe = 0; } else { pexe = wcschr(pargs, ','); - if (pexe != NULL) *pexe = 0; + if (pexe != nullptr) *pexe = 0; } - return SearchPath(NULL, pargs, L".dll", 0, NULL, NULL) != 0; + return SearchPath(nullptr, pargs, L".dll", 0, nullptr, nullptr) != 0; } return TRUE; } @@ -200,11 +200,11 @@ static BOOL IsValidRunCommand(const wchar_t *pszRunCmd) // mir_free() the return value wchar_t* MakeIconLocation(HMODULE hModule, WORD nIconResID) { - wchar_t szModule[MAX_PATH], *pszIconLoc = NULL; + wchar_t szModule[MAX_PATH], *pszIconLoc = nullptr; int cch; if ((cch = GetModuleFileName(hModule, szModule, _countof(szModule))) != 0) { pszIconLoc = (wchar_t*)mir_alloc((cch += 8) * sizeof(wchar_t)); - if (pszIconLoc != NULL) + if (pszIconLoc != nullptr) mir_snwprintf(pszIconLoc, cch, L"%s,%i", szModule, -(int)nIconResID); // id may be 0, buffer safe } return pszIconLoc; @@ -214,13 +214,13 @@ wchar_t* MakeIconLocation(HMODULE hModule, WORD nIconResID) wchar_t* MakeAppFileName(BOOL fMirExe) { wchar_t szExe[MAX_PATH], *psz; - if (GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe))) { + if (GetModuleFileName(fMirExe ? nullptr : hInst, szExe, _countof(szExe))) { psz = wcsrchr(szExe, '\\'); - if (psz != NULL) ++psz; + if (psz != nullptr) ++psz; else psz = szExe; return mir_wstrdup(psz); } - return NULL; + return nullptr; } /************************* Helpers ********************************/ @@ -232,12 +232,12 @@ static LONG DeleteRegSubTree(HKEY hKey, const wchar_t *pszSubKey) wchar_t *pszSubKeyBuf; HKEY hSubKey; if ((res = RegOpenKeyEx(hKey, pszSubKey, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | DELETE, &hSubKey)) == ERROR_SUCCESS) { - if ((res = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, &nMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { + if ((res = RegQueryInfoKey(hSubKey, nullptr, nullptr, nullptr, nullptr, &nMaxSubKeyLen, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) { pszSubKeyBuf = (wchar_t*)mir_alloc((nMaxSubKeyLen + 1) * sizeof(wchar_t)); - if (pszSubKeyBuf == NULL) res = ERROR_NOT_ENOUGH_MEMORY; + if (pszSubKeyBuf == nullptr) res = ERROR_NOT_ENOUGH_MEMORY; while (!res) { cchSubKey = nMaxSubKeyLen + 1; - if ((res = RegEnumKeyEx(hSubKey, 0, pszSubKeyBuf, &cchSubKey, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) + if ((res = RegEnumKeyEx(hSubKey, 0, pszSubKeyBuf, &cchSubKey, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) res = DeleteRegSubTree(hSubKey, pszSubKeyBuf); // recursion } mir_free(pszSubKeyBuf); // does NULL check @@ -253,9 +253,9 @@ static LONG DeleteRegSubTree(HKEY hKey, const wchar_t *pszSubKey) static LONG SetRegSubKeyStrDefValue(HKEY hMainKey, const wchar_t *pszSubKey, const wchar_t *pszVal) { HKEY hSubKey; - LONG res = RegCreateKeyEx(hMainKey, pszSubKey, 0, NULL, 0, KEY_SET_VALUE | KEY_QUERY_VALUE, NULL, &hSubKey, NULL); + LONG res = RegCreateKeyEx(hMainKey, pszSubKey, 0, nullptr, 0, KEY_SET_VALUE | KEY_QUERY_VALUE, nullptr, &hSubKey, nullptr); if (!res) { - res = RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (BYTE*)pszVal, (int)(mir_wstrlen(pszVal) + 1) * sizeof(wchar_t)); + res = RegSetValueEx(hSubKey, nullptr, 0, REG_SZ, (BYTE*)pszVal, (int)(mir_wstrlen(pszVal) + 1) * sizeof(wchar_t)); RegCloseKey(hSubKey); } return res; @@ -267,7 +267,7 @@ static void SetRegStrPrefixValue(HKEY hKey, const wchar_t *pszValPrefix, const w size_t dwSize = (mir_wstrlen(pszVal) + mir_wstrlen(pszValPrefix) + 1) * sizeof(wchar_t); wchar_t *pszStr = (wchar_t*)_alloca(dwSize); mir_wstrcat(mir_wstrcpy(pszStr, pszValPrefix), pszVal); // buffer safe - RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize); + RegSetValueEx(hKey, nullptr, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize); } // hKey must have been opened with KEY_QUERY_VALUE access right @@ -276,11 +276,11 @@ static wchar_t* GetRegStrValue(HKEY hKey, const wchar_t *pszValName) { // get size DWORD dwSize, dwType; - if (!RegQueryValueEx(hKey, pszValName, NULL, NULL, NULL, &dwSize) && dwSize > sizeof(wchar_t)) { + if (!RegQueryValueEx(hKey, pszValName, nullptr, nullptr, nullptr, &dwSize) && dwSize > sizeof(wchar_t)) { wchar_t *pszVal = (wchar_t*)mir_alloc(dwSize + sizeof(wchar_t)); - if (pszVal != NULL) { + if (pszVal != nullptr) { // get value - if (!RegQueryValueEx(hKey, pszValName, NULL, &dwType, (BYTE*)pszVal, &dwSize)) { + if (!RegQueryValueEx(hKey, pszValName, nullptr, &dwType, (BYTE*)pszVal, &dwSize)) { pszVal[dwSize / sizeof(wchar_t)] = 0; if (dwType == REG_EXPAND_SZ) { dwSize = MAX_PATH; @@ -297,7 +297,7 @@ static wchar_t* GetRegStrValue(HKEY hKey, const wchar_t *pszValName) mir_free(pszVal); } } - return NULL; + return nullptr; } // hKey must have been opened with KEY_QUERY_VALUE access right @@ -305,7 +305,7 @@ static BOOL IsRegStrValue(HKEY hKey, const wchar_t *pszValName, const wchar_t *p { BOOL fSame = FALSE; wchar_t *pszVal = GetRegStrValue(hKey, pszValName); - if (pszVal != NULL) { + if (pszVal != nullptr) { fSame = !mir_wstrcmp(pszVal, pszCmpVal); mir_free(pszVal); } @@ -318,9 +318,9 @@ static BOOL IsRegStrValueA(HKEY hKey, const wchar_t *pszValName, const char *psz BOOL fSame = FALSE; char *pszValA; wchar_t *pszVal = GetRegStrValue(hKey, pszValName); - if (pszVal != NULL) { + if (pszVal != nullptr) { pszValA = t2a(pszVal); - if (pszValA != NULL) + if (pszValA != nullptr) fSame = !mir_strcmp(pszValA, pszCmpVal); mir_free(pszValA); // does NULL check mir_free(pszVal); @@ -377,14 +377,14 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup char *pszName; DWORD nDbPrefixLen; if ((res = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey)) == ERROR_SUCCESS) { - if ((res = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, &nMaxSubKeyLen, NULL, NULL, &nMaxValNameLen, &nMaxValSize, NULL, NULL)) == ERROR_SUCCESS) { + if ((res = RegQueryInfoKey(hKey, nullptr, nullptr, nullptr, nullptr, &nMaxSubKeyLen, nullptr, nullptr, &nMaxValNameLen, &nMaxValSize, nullptr, nullptr)) == ERROR_SUCCESS) { if (nMaxSubKeyLen > nMaxValNameLen) nMaxValNameLen = nMaxSubKeyLen; // prepare buffer nDbPrefixLen = (DWORD)(mir_strlen(*param->ppszDbPrefix) + mir_strlen(pszSubKey) + 1); cchName = nDbPrefixLen + nMaxValNameLen + 3; if (cchName > *param->pdwDbPrefixSize) { pszName = (char*)mir_realloc(*param->ppszDbPrefix, cchName); - if (pszName == NULL) return; + if (pszName == nullptr) return; *param->ppszDbPrefix = pszName; *param->pdwDbPrefixSize = cchName; } @@ -393,17 +393,17 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup pszName = (char*)mir_alloc(nMaxValNameLen + 1); if (nMaxValSize == 0) nMaxValSize = 1; BYTE *pData = (BYTE*)mir_alloc(nMaxValSize); - if (pszName != NULL && pData != NULL) { + if (pszName != nullptr && pData != nullptr) { DWORD index = 0; while (!res) { cchName = nMaxValNameLen + 1; cbData = nMaxValSize; - if ((res = RegEnumValueA(hKey, index++, pszName, &cchName, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { + if ((res = RegEnumValueA(hKey, index++, pszName, &cchName, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) { (*param->ppszDbPrefix)[nDbPrefixLen] = 0; mir_strcat(*param->ppszDbPrefix, pszName); // buffer safe ptrW ptszName(a2t(pszName)); if (ptszName != NULL) - if (!RegQueryValueEx(hKey, ptszName, NULL, &dwType, pData, &cbData)) + if (!RegQueryValueEx(hKey, ptszName, nullptr, &dwType, pData, &cbData)) WriteDbBackupData(*param->ppszDbPrefix, dwType, pData, cbData); } } @@ -412,12 +412,12 @@ static void BackupRegTree_Worker(HKEY hKey, const char *pszSubKey, struct Backup } mir_free(pData); // does NULL check // enum subkeys - if (param->level < 32 && pszName != NULL) { + if (param->level < 32 && pszName != nullptr) { ++param->level; // can be max 32 levels deep (after prefix), restriction of RegCreateKeyEx() DWORD index = 0; while (!res) { cchName = nMaxSubKeyLen + 1; - if ((res = RegEnumKeyExA(hKey, index++, pszName, &cchName, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) { + if ((res = RegEnumKeyExA(hKey, index++, pszName, &cchName, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) { (*param->ppszDbPrefix)[nDbPrefixLen] = 0; BackupRegTree_Worker(hKey, pszName, param); // recursion } @@ -448,12 +448,12 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr int nDbPrefixLen = (int)mir_strlen(pszDbPrefix); int nPrefixWithSubKeyLen = nDbPrefixLen + (int)mir_strlen(pszSubKey) + 1; char *pszPrefixWithSubKey = (char*)mir_alloc(nPrefixWithSubKeyLen + 1); - if (pszPrefixWithSubKey == NULL) + if (pszPrefixWithSubKey == nullptr) return ERROR_OUTOFMEMORY; mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey, pszDbPrefix), pszSubKey), "\\"); // buffer safe LONG res = ERROR_NO_MORE_ITEMS; - if (pszPrefixWithSubKey != NULL) { + if (pszPrefixWithSubKey != nullptr) { int nSettingsCount; char **ppszSettings; if (EnumDbPrefixSettings("AssocMgr", pszPrefixWithSubKey, &ppszSettings, &nSettingsCount)) { @@ -461,15 +461,15 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr char *pszSuffix = &ppszSettings[i][nDbPrefixLen]; // key hierachy char *pkeys = mir_strcpy((char*)_alloca(mir_strlen(pszSuffix) + 1), pszSuffix); - char *pnext = pkeys, *pslash = NULL; - while ((pnext = strchr(pnext + 1, '\\')) != NULL) + char *pnext = pkeys, *pslash = nullptr; + while ((pnext = strchr(pnext + 1, '\\')) != nullptr) pslash = pnext; - if (pslash != NULL) { + if (pslash != nullptr) { // create subkey *(pslash++) = 0; HKEY hSubKey = hKey; if (pslash != pkeys + 1) - if ((res = RegCreateKeyExA(hKey, pkeys, 0, NULL, 0, KEY_SET_VALUE, NULL, &hSubKey, NULL)) != ERROR_SUCCESS) + if ((res = RegCreateKeyExA(hKey, pkeys, 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hSubKey, nullptr)) != ERROR_SUCCESS) break; char *pszValName = pslash; // read data @@ -479,7 +479,7 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr // set value if (!(dwType & REGF_ANSI)) { WCHAR *pwszValName = a2u(pszValName, FALSE); - if (pwszValName != NULL) res = RegSetValueExW(hSubKey, pwszValName, 0, dwType, pData, cbData); + if (pwszValName != nullptr) res = RegSetValueExW(hSubKey, pwszValName, 0, dwType, pData, cbData); else res = ERROR_NOT_ENOUGH_MEMORY; mir_free(pwszValName); // does NULL check } @@ -506,9 +506,9 @@ static void DeleteRegTreeBackup(const char *pszSubKey, const char *pszDbPrefix) int nSettingsCount, i; char *pszPrefixWithSubKey = (char*)mir_alloc(mir_strlen(pszDbPrefix) + mir_strlen(pszSubKey) + 2); - if (pszPrefixWithSubKey == NULL) return; + if (pszPrefixWithSubKey == nullptr) return; mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey, pszDbPrefix), pszSubKey), "\\"); // buffer safe - if (pszPrefixWithSubKey != NULL) { + if (pszPrefixWithSubKey != nullptr) { if (EnumDbPrefixSettings("AssocMgr", pszPrefixWithSubKey, &ppszSettings, &nSettingsCount)) { for (i = 0; i < nSettingsCount; ++i) { db_unset(NULL, "AssocMgr", ppszSettings[i]); @@ -531,16 +531,16 @@ void CleanupRegTreeBackupSettings(void) for (int i = 0; i < nSettingsCount; ++i) { char *pszClassName = &ppszSettings[i][4]; char *pszBuf = strchr(pszClassName, '\\'); - if (pszBuf != NULL) { + if (pszBuf != nullptr) { *pszBuf = '\0'; // remove others in list with same class name if (i < nSettingsCount - 1) { for (int j = i + 1; j < nSettingsCount; ++j) { pszBuf = strchr(&ppszSettings[j][4], '\\'); - if (pszBuf != NULL) *pszBuf = '\0'; + if (pszBuf != nullptr) *pszBuf = '\0'; if (mir_strcmp(pszClassName, &ppszSettings[j][4])) { - if (pszBuf != NULL) *pszBuf = '\\'; + if (pszBuf != nullptr) *pszBuf = '\\'; continue; } @@ -582,7 +582,7 @@ BOOL AddRegClass(const char *pszClassName, const wchar_t *pszTypeDescription, co HKEY hRootKey, hClassKey, hShellKey, hVerbKey, hDdeKey; // some error checking for disallowed values (to avoid errors in registry) - if (strchr(pszClassName, '\\') != NULL || strchr(pszClassName, ' ') != NULL) { + if (strchr(pszClassName, '\\') != nullptr || strchr(pszClassName, ' ') != nullptr) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } @@ -591,50 +591,50 @@ BOOL AddRegClass(const char *pszClassName, const wchar_t *pszTypeDescription, co hRootKey = HKEY_CLASSES_ROOT; // might be write protected by security settings // class - if ((res = RegCreateKeyExA(hRootKey, pszClassName, 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE | KEY_QUERY_VALUE, NULL, &hClassKey, NULL)) == ERROR_SUCCESS) { + if ((res = RegCreateKeyExA(hRootKey, pszClassName, 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE | KEY_QUERY_VALUE, nullptr, &hClassKey, nullptr)) == ERROR_SUCCESS) { // backup class if shared if (fUrlProto) BackupRegTree(hRootKey, pszClassName, "bak_"); // type description if (fUrlProto) SetRegStrPrefixValue(hClassKey, L"URL:", pszTypeDescription); - else RegSetValueEx(hClassKey, NULL, 0, REG_SZ, (BYTE*)pszTypeDescription, (int)(mir_wstrlen(pszTypeDescription) + 1) * sizeof(wchar_t)); + else RegSetValueEx(hClassKey, nullptr, 0, REG_SZ, (BYTE*)pszTypeDescription, (int)(mir_wstrlen(pszTypeDescription) + 1) * sizeof(wchar_t)); // default icon - if (pszIconLoc != NULL) SetRegSubKeyStrDefValue(hClassKey, L"DefaultIcon", pszIconLoc); + if (pszIconLoc != nullptr) SetRegSubKeyStrDefValue(hClassKey, L"DefaultIcon", pszIconLoc); // url protocol if (!fUrlProto) RegDeleteValue(hClassKey, L"URL Protocol"); - else RegSetValueEx(hClassKey, L"URL Protocol", 0, REG_SZ, NULL, 0); + else RegSetValueEx(hClassKey, L"URL Protocol", 0, REG_SZ, nullptr, 0); // moniker clsid RegDeleteKey(hClassKey, L"CLSID"); // edit flags { DWORD dwFlags = 0, dwSize = sizeof(dwFlags); - RegQueryValueEx(hClassKey, L"EditFlags", NULL, NULL, (BYTE*)&dwFlags, &dwSize); + RegQueryValueEx(hClassKey, L"EditFlags", nullptr, nullptr, (BYTE*)&dwFlags, &dwSize); if (fBrowserAutoOpen) dwFlags = (dwFlags&~FTA_AlwaysUnsafe) | FTA_OpenIsSafe; if (!fUrlProto) dwFlags |= FTA_HasExtension; else dwFlags = (dwFlags&~FTA_HasExtension) | FTA_Show; // show classes without extension RegSetValueEx(hClassKey, L"EditFlags", 0, REG_DWORD, (BYTE*)&dwFlags, sizeof(dwFlags)); } if (fIsShortcut) { - RegSetValueExA(hClassKey, "IsShortcut", 0, REG_SZ, NULL, 0); - RegSetValueExA(hClassKey, "NeverShowExt", 0, REG_SZ, NULL, 0); + RegSetValueExA(hClassKey, "IsShortcut", 0, REG_SZ, nullptr, 0); + RegSetValueExA(hClassKey, "NeverShowExt", 0, REG_SZ, nullptr, 0); } // shell - if ((res = RegCreateKeyEx(hClassKey, L"shell", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hShellKey, NULL)) == ERROR_SUCCESS) { + if ((res = RegCreateKeyEx(hClassKey, L"shell", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hShellKey, nullptr)) == ERROR_SUCCESS) { // default verb (when empty "open" is used) - RegSetValueEx(hShellKey, NULL, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t)); + RegSetValueEx(hShellKey, nullptr, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t)); // verb - if ((res = RegCreateKeyEx(hShellKey, L"open", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, NULL, &hVerbKey, NULL)) == ERROR_SUCCESS) { + if ((res = RegCreateKeyEx(hShellKey, L"open", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, nullptr, &hVerbKey, nullptr)) == ERROR_SUCCESS) { // verb description - if (pszVerbDesc == NULL) RegDeleteValue(hVerbKey, NULL); - else RegSetValueEx(hVerbKey, NULL, 0, REG_SZ, (BYTE*)pszVerbDesc, (int)(mir_wstrlen(pszVerbDesc) + 1) * sizeof(wchar_t)); + if (pszVerbDesc == nullptr) RegDeleteValue(hVerbKey, nullptr); + else RegSetValueEx(hVerbKey, nullptr, 0, REG_SZ, (BYTE*)pszVerbDesc, (int)(mir_wstrlen(pszVerbDesc) + 1) * sizeof(wchar_t)); // friendly appname (mui string) RegSetValueEx(hVerbKey, L"FriendlyAppName", 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t)); // command SetRegSubKeyStrDefValue(hVerbKey, L"command", pszRunCmd); // ddeexec - if (pszDdeCmd != NULL) { - if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, NULL, &hDdeKey, NULL)) { + if (pszDdeCmd != nullptr) { + if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY | DELETE, nullptr, &hDdeKey, nullptr)) { // command - RegSetValueEx(hDdeKey, NULL, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t)); + RegSetValueEx(hDdeKey, nullptr, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t)); // application SetRegSubKeyStrDefValue(hDdeKey, L"application", pszDdeApp); // topic @@ -684,7 +684,7 @@ BOOL RemoveRegClass(const char *pszClassName) // class name ptszClassName = a2t(pszClassName); - if (ptszClassName != NULL) + if (ptszClassName != nullptr) res = DeleteRegSubTree(hRootKey, ptszClassName); else res = ERROR_OUTOFMEMORY; mir_free(ptszClassName); // does NULL check @@ -700,7 +700,7 @@ BOOL RemoveRegClass(const char *pszClassName) if (!RegOpenKeyEx(hShellKey, L"open", 0, KEY_QUERY_VALUE, &hVerbKey)) { // command ptszPrevRunCmd = GetRegStrValue(hVerbKey, L"command"); - if (ptszPrevRunCmd != NULL && !IsValidRunCommand(ptszPrevRunCmd)) + if (ptszPrevRunCmd != nullptr && !IsValidRunCommand(ptszPrevRunCmd)) res = DeleteRegSubTree(hRootKey, ptszClassName); // backup outdated, remove all mir_free(ptszPrevRunCmd); // does NULL check RegCloseKey(hVerbKey); @@ -742,7 +742,7 @@ BOOL IsRegClass(const char *pszClassName, const wchar_t *pszRunCmd) // command if (!RegOpenKeyEx(hVerbKey, L"command", 0, KEY_QUERY_VALUE, &hCmdKey)) { // it is enough to check if the command is right - fSuccess = IsRegStrValue(hCmdKey, NULL, pszRunCmd); + fSuccess = IsRegStrValue(hCmdKey, nullptr, pszRunCmd); RegCloseKey(hCmdKey); } RegCloseKey(hVerbKey); @@ -762,7 +762,7 @@ BOOL IsRegClass(const char *pszClassName, const wchar_t *pszRunCmd) // DestroyIcon() the return value HICON LoadRegClassSmallIcon(const char *pszClassName) { - HICON hIcon = NULL; + HICON hIcon = nullptr; HKEY hClassKey, hIconKey; wchar_t *pszIconLoc, *p; @@ -772,12 +772,12 @@ HICON LoadRegClassSmallIcon(const char *pszClassName) // default icon if (!RegOpenKeyEx(hClassKey, L"DefaultIcon", 0, KEY_QUERY_VALUE, &hIconKey)) { // extract icon - pszIconLoc = GetRegStrValue(hIconKey, NULL); - if (pszIconLoc != NULL) { + pszIconLoc = GetRegStrValue(hIconKey, nullptr); + if (pszIconLoc != nullptr) { p = wcsrchr(pszIconLoc, ','); - if (p != NULL) { + if (p != nullptr) { *(p++) = 0; - ExtractIconEx(pszIconLoc, _wtoi(p), NULL, &hIcon, 1); + ExtractIconEx(pszIconLoc, _wtoi(p), nullptr, &hIcon, 1); } mir_free(pszIconLoc); } @@ -806,7 +806,7 @@ BOOL AddRegFileExt(const char *pszFileExt, const char *pszClassName, const char HKEY hRootKey, hExtKey, hOpenWithKey; // some error checking for disallowed values (to avoid errors in registry) - if (strchr(pszFileExt, '\\') != NULL || strchr(pszFileExt, ' ') != NULL) + if (strchr(pszFileExt, '\\') != nullptr || strchr(pszFileExt, ' ') != nullptr) return FALSE; // try to open interactive user's classes key @@ -814,24 +814,24 @@ BOOL AddRegFileExt(const char *pszFileExt, const char *pszClassName, const char hRootKey = HKEY_CLASSES_ROOT; // file ext - if (!RegCreateKeyExA(hRootKey, pszFileExt, 0, NULL, 0, KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, NULL, &hExtKey, NULL)) { + if (!RegCreateKeyExA(hRootKey, pszFileExt, 0, nullptr, 0, KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hExtKey, nullptr)) { // backup previous app BackupRegTree(hRootKey, pszFileExt, "bak_"); // remove any no-open flag RegDeleteValue(hExtKey, L"NoOpen"); // open with progids - wchar_t *pszPrevClass = GetRegStrValue(hExtKey, NULL); - if (pszPrevClass != NULL && !IsRegStrValueA(hExtKey, NULL, pszClassName)) - if (!RegCreateKeyEx(hExtKey, L"OpenWithProgids", 0, NULL, 0, KEY_SET_VALUE, NULL, &hOpenWithKey, NULL)) { + wchar_t *pszPrevClass = GetRegStrValue(hExtKey, nullptr); + if (pszPrevClass != nullptr && !IsRegStrValueA(hExtKey, nullptr, pszClassName)) + if (!RegCreateKeyEx(hExtKey, L"OpenWithProgids", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hOpenWithKey, nullptr)) { // previous class (backup) - RegSetValueEx(hOpenWithKey, pszPrevClass, 0, REG_NONE, NULL, 0); + RegSetValueEx(hOpenWithKey, pszPrevClass, 0, REG_NONE, nullptr, 0); RegCloseKey(hOpenWithKey); } mir_free(pszPrevClass); // does NULL check // class name - fSuccess = !RegSetValueExA(hExtKey, NULL, 0, REG_SZ, (BYTE*)pszClassName, (int)mir_strlen(pszClassName) + 1); + fSuccess = !RegSetValueExA(hExtKey, nullptr, 0, REG_SZ, (BYTE*)pszClassName, (int)mir_strlen(pszClassName) + 1); // mime type e.g. "application/x-icq" - if (pszMimeType != NULL) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)mir_strlen(pszMimeType) + 1); + if (pszMimeType != nullptr) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)mir_strlen(pszMimeType) + 1); // perceived type e.g. text (WinXP+) if (fIsText) RegSetValueEx(hExtKey, L"PerceivedType", 0, REG_SZ, (BYTE*)L"text", 5 * sizeof(wchar_t)); RegCloseKey(hExtKey); @@ -846,7 +846,7 @@ void RemoveRegFileExt(const char *pszFileExt, const char *pszClassName) { HKEY hRootKey, hExtKey, hSubKey; DWORD nOpenWithCount; - wchar_t *pszPrevClassName = NULL; + wchar_t *pszPrevClassName = nullptr; BOOL fRestored = FALSE; // try to open interactive user's classes key @@ -857,25 +857,25 @@ void RemoveRegFileExt(const char *pszFileExt, const char *pszClassName) if (!RegOpenKeyExA(hRootKey, pszFileExt, 0, KEY_QUERY_VALUE | KEY_SET_VALUE | DELETE, &hExtKey)) { // class name (the important part) if (!RestoreRegTree(hRootKey, pszFileExt, "bak_")) { - pszPrevClassName = GetRegStrValue(hExtKey, NULL); - if (pszPrevClassName != NULL) { + pszPrevClassName = GetRegStrValue(hExtKey, nullptr); + if (pszPrevClassName != nullptr) { // previous class name still exists? // using the merged view classes key for reading if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, pszPrevClassName, 0, KEY_QUERY_VALUE, &hSubKey)) { fRestored = TRUE; RegCloseKey(hSubKey); } - else RegDeleteValue(hExtKey, NULL); + else RegDeleteValue(hExtKey, nullptr); mir_free(pszPrevClassName); } } - if (pszPrevClassName == NULL) RegDeleteValue(hExtKey, NULL); + if (pszPrevClassName == nullptr) RegDeleteValue(hExtKey, nullptr); // open with progids (remove if empty) nOpenWithCount = 0; if (!RegOpenKeyEx(hExtKey, L"OpenWithProgids", 0, KEY_SET_VALUE | KEY_QUERY_VALUE, &hSubKey)) { // remove current class (if set by another app) RegDeleteValueA(hSubKey, pszClassName); - RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &nOpenWithCount, NULL, NULL, NULL); + RegQueryInfoKey(hSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &nOpenWithCount, nullptr, nullptr, nullptr); RegCloseKey(hSubKey); } if (!nOpenWithCount) RegDeleteKey(hExtKey, L"OpenWithProgids"); // delete if no values @@ -904,7 +904,7 @@ BOOL IsRegFileExt(const char *pszFileExt, const char *pszClassName) if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, pszFileExt, 0, KEY_QUERY_VALUE, &hExtKey)) { // class name // it is enough to check if the class is right - fSuccess = IsRegStrValueA(hExtKey, NULL, pszClassName); + fSuccess = IsRegStrValueA(hExtKey, nullptr, pszClassName); RegCloseKey(hExtKey); } return fSuccess; @@ -924,7 +924,7 @@ BOOL AddRegMimeType(const char *pszMimeType, const char *pszFileExt) HKEY hRootKey, hDbKey, hTypeKey; // some error checking for disallowed values (to avoid errors in registry) - if (strchr(pszMimeType, '\\') != NULL || strchr(pszMimeType, ' ') != NULL) + if (strchr(pszMimeType, '\\') != nullptr || strchr(pszMimeType, ' ') != nullptr) return FALSE; // try to open interactive user's classes key @@ -934,9 +934,9 @@ BOOL AddRegMimeType(const char *pszMimeType, const char *pszFileExt) // database if (!RegOpenKeyEx(hRootKey, L"MIME\\Database\\Content Type", 0, KEY_CREATE_SUB_KEY, &hDbKey)) { // mime type - if (!RegCreateKeyExA(hDbKey, pszMimeType, 0, NULL, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, NULL, &hTypeKey, NULL)) { + if (!RegCreateKeyExA(hDbKey, pszMimeType, 0, nullptr, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, nullptr, &hTypeKey, nullptr)) { // file ext - if (RegQueryValueExA(hTypeKey, "Extension", NULL, NULL, NULL, NULL)) // only set if not present + if (RegQueryValueExA(hTypeKey, "Extension", nullptr, nullptr, nullptr, nullptr)) // only set if not present fSuccess = !RegSetValueExA(hTypeKey, "Extension", 0, REG_SZ, (BYTE*)pszFileExt, (int)mir_strlen(pszFileExt) + 1); RegCloseKey(hTypeKey); } @@ -989,31 +989,31 @@ void AddRegOpenWith(const wchar_t *pszAppFileName, BOOL fAllowOpenWith, const wc hRootKey = HKEY_CLASSES_ROOT; // database - if (!RegCreateKeyEx(hRootKey, L"Applications", 0, NULL, 0, KEY_CREATE_SUB_KEY, NULL, &hAppsKey, NULL)) { + if (!RegCreateKeyEx(hRootKey, L"Applications", 0, nullptr, 0, KEY_CREATE_SUB_KEY, nullptr, &hAppsKey, nullptr)) { // filename - if (!RegCreateKeyEx(hAppsKey, pszAppFileName, 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hExeKey, NULL)) { + if (!RegCreateKeyEx(hAppsKey, pszAppFileName, 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hExeKey, nullptr)) { // appname - RegSetValueEx(hExeKey, NULL, 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t)); + RegSetValueEx(hExeKey, nullptr, 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t)); // no open-with flag if (fAllowOpenWith) RegDeleteValue(hExeKey, L"NoOpenWith"); - else RegSetValueEx(hExeKey, L"NoOpenWith", 0, REG_SZ, NULL, 0); + else RegSetValueEx(hExeKey, L"NoOpenWith", 0, REG_SZ, nullptr, 0); // default icon - if (pszIconLoc != NULL) SetRegSubKeyStrDefValue(hExeKey, L"DefaultIcon", pszIconLoc); + if (pszIconLoc != nullptr) SetRegSubKeyStrDefValue(hExeKey, L"DefaultIcon", pszIconLoc); // shell - if (!RegCreateKeyEx(hExeKey, L"shell", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hShellKey, NULL)) { + if (!RegCreateKeyEx(hExeKey, L"shell", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hShellKey, nullptr)) { // default verb (when empty "open" is used) - RegSetValueEx(hShellKey, NULL, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t)); + RegSetValueEx(hShellKey, nullptr, 0, REG_SZ, (BYTE*)L"open", 5 * sizeof(wchar_t)); // verb - if (!RegCreateKeyEx(hShellKey, L"open", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hVerbKey, NULL)) { + if (!RegCreateKeyEx(hShellKey, L"open", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hVerbKey, nullptr)) { // friendly appname (mui string) RegSetValueEx(hVerbKey, L"FriendlyAppName", 0, REG_SZ, (BYTE*)pszAppName, (int)(mir_wstrlen(pszAppName) + 1) * sizeof(wchar_t)); // command SetRegSubKeyStrDefValue(hVerbKey, L"command", pszRunCmd); // ddeexec - if (pszDdeCmd != NULL) - if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, NULL, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, NULL, &hDdeKey, NULL)) { + if (pszDdeCmd != nullptr) + if (!RegCreateKeyEx(hVerbKey, L"ddeexec", 0, nullptr, 0, KEY_SET_VALUE | KEY_CREATE_SUB_KEY, nullptr, &hDdeKey, nullptr)) { // command - RegSetValueEx(hDdeKey, NULL, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t)); + RegSetValueEx(hDdeKey, nullptr, 0, REG_SZ, (BYTE*)pszDdeCmd, (int)(mir_wstrlen(pszDdeCmd) + 1) * sizeof(wchar_t)); // application SetRegSubKeyStrDefValue(hDdeKey, L"application", pszDdeApp); // topic @@ -1097,10 +1097,10 @@ void AddRegOpenWithExtEntry(const wchar_t *pszAppFileName, const char *pszFileEx // filename if (!RegOpenKeyEx(hAppsKey, pszAppFileName, 0, KEY_CREATE_SUB_KEY, &hExeKey)) { // supported types - if (!RegCreateKeyEx(hExeKey, L"SupportedTypes", 0, NULL, 0, KEY_SET_VALUE, NULL, &hTypesKey, NULL)) { + if (!RegCreateKeyEx(hExeKey, L"SupportedTypes", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hTypesKey, nullptr)) { wchar_t *ptszFileExt; ptszFileExt = a2t(pszFileExt); - if (ptszFileExt != NULL) + if (ptszFileExt != nullptr) RegSetValueEx(hTypesKey, ptszFileExt, 0, REG_SZ, (BYTE*)pszFileDesc, (int)(mir_wstrlen(pszFileDesc) + 1) * sizeof(wchar_t)); mir_free(ptszFileExt); // does NULL check RegCloseKey(hTypesKey); @@ -1152,7 +1152,7 @@ BOOL AddRegRunEntry(const wchar_t *pszAppName, const wchar_t *pszRunCmd) HKEY hRunKey; // run - if (!RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, 0, KEY_SET_VALUE, NULL, &hRunKey, NULL)) { + if (!RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, nullptr, 0, KEY_SET_VALUE, nullptr, &hRunKey, nullptr)) { // appname fSuccess = !RegSetValueEx(hRunKey, pszAppName, 0, REG_SZ, (BYTE*)pszRunCmd, (int)(mir_wstrlen(pszRunCmd) + 1) * sizeof(wchar_t)); RegCloseKey(hRunKey); diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 6f2a90b8d1..21cd8de4f6 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -29,15 +29,15 @@ WCHAR* a2u(const char *pszAnsi,BOOL fMirCp) UINT codepage,cch; WCHAR *psz; - if(pszAnsi==NULL) return NULL; + if(pszAnsi==nullptr) return nullptr; codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP; - cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,NULL,0); - if (!cch) return NULL; + cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,nullptr,0); + if (!cch) return nullptr; psz=(WCHAR*)mir_alloc(cch*sizeof(WCHAR)); - if(psz!=NULL && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) { + if(psz!=nullptr && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) { mir_free(psz); - return NULL; + return nullptr; } return psz; } @@ -49,17 +49,17 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp) char *psz; DWORD flags; - if(pszUnicode==NULL) return NULL; + if(pszUnicode==nullptr) return nullptr; codepage = fMirCp ? Langpack_GetDefaultCodePage() : CP_ACP; /* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */ - cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,NULL,0,NULL,NULL); - if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL); - if (!cch) return NULL; + cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,nullptr,0,nullptr,nullptr); + if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,nullptr,0,nullptr,nullptr); + if (!cch) return nullptr; psz=(char*)mir_alloc(cch); - if(psz!=NULL && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,NULL,NULL)) { + if(psz!=nullptr && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,nullptr,nullptr)) { mir_free(psz); - return NULL; + return nullptr; } return psz; } @@ -98,10 +98,10 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam) char **buf; /* resize storage array */ buf = (char**)mir_realloc(param->settings,(param->nSettingsCount+1)*sizeof(char*)); - if(buf!=NULL) { + if(buf!=nullptr) { param->settings=buf; buf[param->nSettingsCount]=mir_strdup(pszSetting); - if(buf[param->nSettingsCount]!=NULL) ++param->nSettingsCount; + if(buf[param->nSettingsCount]!=nullptr) ++param->nSettingsCount; } } return 0; @@ -111,7 +111,7 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam) BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,char ***pSettings,int *pnSettingsCount) { struct EnumPrefixSettingsParams param; - param.settings = NULL; + param.settings = nullptr; param.nSettingsCount = 0; param.pszPrefix = pszSettingPrefix; param.nPrefixLen = (int)mir_strlen(pszSettingPrefix); @@ -141,11 +141,11 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) mir_vsnprintf(szText,_countof(szText),pszTextFmt,va); va_end(va); - if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success + if (!Clist_TrayNotifyA(nullptr, pszTitle, szText, flags, 30000)) // success return; MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp)); - if(mbp == NULL) + if(mbp == nullptr) return; mbp->cbSize = sizeof(*mbp); @@ -164,10 +164,10 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) // LocalFree() the return value char* GetWinErrorDescription(DWORD dwLastError) { - char *buf=NULL; + char *buf=nullptr; DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM; - if (!FormatMessageA(flags,NULL,dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,NULL)) + if (!FormatMessageA(flags,nullptr,dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()),(char*)&buf,0,nullptr)) if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND) - FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL); + FormatMessageA(flags,nullptr,dwLastError,0,(char*)&buf,0,nullptr); return buf; } diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 9d971a72c7..db2de1db13 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -99,7 +99,7 @@ int onExtraImageApplying(WPARAM hContact, LPARAM lParam) if (hContact == NULL) return 0; int iIcon = getIconToUse((MCONTACT)hContact, lParam); - ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)hContact, iIcon == -1 ? NULL : iconList[iIcon].hIcolib); + ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)hContact, iIcon == -1 ? nullptr : iconList[iIcon].hIcolib); return 0; } diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 0923879dab..559f636240 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -28,7 +28,7 @@ void GetProfilePath(wchar_t *res, size_t resLen) { wchar_t dbname[MAX_PATH], exename[MAX_PATH]; Profile_GetNameW(_countof(dbname), dbname); - GetModuleFileName(NULL, exename, _countof(exename)); + GetModuleFileName(nullptr, exename, _countof(exename)); wchar_t *p = wcsrchr(dbname, '.'); if (p) *p = 0; @@ -42,7 +42,7 @@ static void SetAutorun(BOOL autorun) DWORD dw; switch (autorun) { case TRUE: - if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) { + if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, nullptr, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,nullptr,&hKey,&dw) == ERROR_SUCCESS) { wchar_t result[MAX_PATH]; GetProfilePath(result, _countof(result)); RegSetValueEx(hKey, L"MirandaNG", 0, REG_SZ, (BYTE*)result, sizeof(wchar_t)*(DWORD)mir_wstrlen(result)); @@ -66,7 +66,7 @@ static BOOL CmpCurrentAndRegistry() wchar_t result[MAX_PATH], dbpath[MAX_PATH]; DWORD dwBufLen = MAX_PATH; - if ( RegQueryValueEx(hKey, L"MirandaNG", NULL, NULL, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS) + if ( RegQueryValueEx(hKey, L"MirandaNG", nullptr, nullptr, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS) return FALSE; GetProfilePath(result, _countof(result)); diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index 555f1c8dbb..2959013407 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -35,7 +35,7 @@ static BOOL WinNT_PerfStatsSwitch(wchar_t *pszServiceName, BOOL fDisable) if (!RegOpenKeyEx(hKeyServices, pszServiceName, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyService)) { if (!RegOpenKeyEx(hKeyService, L"Performance", 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyPerf)) { dwDataSize = sizeof(DWORD); - if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", NULL, NULL, (BYTE*)&dwData, &dwDataSize)) + if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", nullptr, nullptr, (BYTE*)&dwData, &dwDataSize)) if ((dwData != 0) != fDisable) fSwitched = !RegSetValueEx(hKeyPerf, L"Disable Performance Counters", 0, REG_DWORD, (BYTE*)&fDisable, dwDataSize); RegCloseKey(hKeyPerf); @@ -59,11 +59,11 @@ struct CpuUsageThreadParams static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, BYTE nCpuUsage) { - if (param->hFirstEvent != NULL) { + if (param->hFirstEvent != nullptr) { /* return value for PollCpuUsage() */ *param->pidThread = GetCurrentThreadId(); SetEvent(param->hFirstEvent); - param->hFirstEvent = NULL; + param->hFirstEvent = nullptr; /* lower priority after first call */ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); } @@ -77,8 +77,8 @@ static void WinNT_PollThread(void *vparam) CpuUsageThreadParams *param = (CpuUsageThreadParams*)vparam; DWORD dwBufferSize = 0, dwCount; - BYTE *pBuffer = NULL; - PERF_DATA_BLOCK *pPerfData = NULL; + BYTE *pBuffer = nullptr; + PERF_DATA_BLOCK *pPerfData = nullptr; LONG res, lCount; PERF_OBJECT_TYPE *pPerfObj; PERF_COUNTER_DEFINITION *pPerfCounter; @@ -100,12 +100,12 @@ static void WinNT_PollThread(void *vparam) /* poll */ for (;;) { /* retrieve data for given object */ - res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, NULL, NULL, (BYTE*)pPerfData, &dwBufferSize); + res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, (BYTE*)pPerfData, &dwBufferSize); while (!pBuffer || res == ERROR_MORE_DATA) { pBuffer = (BYTE*)mir_realloc(pPerfData, dwBufferSize += 256); if (!pBuffer) break; pPerfData = (PERF_DATA_BLOCK*)pBuffer; - res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, NULL, NULL, pBuffer, &dwBufferSize); + res = RegQueryValueExW(HKEY_PERFORMANCE_DATA, wszValueName, nullptr, nullptr, pBuffer, &dwBufferSize); } if (res != ERROR_SUCCESS) break; @@ -174,7 +174,7 @@ static void WinNT_PollThread(void *vparam) WinNT_PerfStatsSwitch(L"PerfOS", TRUE); /* return error for PollCpuUsage() if never succeeded */ - if (param->hFirstEvent != NULL) + if (param->hFirstEvent != nullptr) SetEvent(param->hFirstEvent); mir_free(param); } @@ -188,11 +188,11 @@ DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, DWORD dwDe /* init params */ CpuUsageThreadParams *param = (struct CpuUsageThreadParams*)mir_alloc(sizeof(struct CpuUsageThreadParams)); - if (param == NULL) + if (param == nullptr) return FALSE; - HANDLE hFirstEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - if (hFirstEvent == NULL) { + HANDLE hFirstEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (hFirstEvent == nullptr) { mir_free(param); return FALSE; } diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index a450355f22..5908be544f 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -56,7 +56,7 @@ static LOGFONT* GetDefaultFont(LOGFONT *lf) *lf = ncm.lfStatusFont; return lf; } - return (LOGFONT*)NULL; + return nullptr; } static LRESULT CALLBACK ProgressBarSubclassProc(HWND hwndProgress, UINT msg, WPARAM wParam, LPARAM lParam) @@ -116,7 +116,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_NCCREATE: /* init window data */ dat = (struct CountdownFrameWndData*)mir_calloc(sizeof(*dat)); SetWindowLongPtr(hwndFrame, GWLP_USERDATA, (LONG_PTR)dat); - if (dat == NULL) return FALSE; /* creation failed */ + if (dat == nullptr) return FALSE; /* creation failed */ dat->fTimeFlags = *(WORD*)((CREATESTRUCT*)lParam)->lpCreateParams; dat->flags = FWPDF_COUNTDOWNINVALID; break; @@ -124,26 +124,26 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_CREATE: /* create childs */ { CREATESTRUCT *params = (CREATESTRUCT*)lParam; - dat->hwndIcon = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", NULL, WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE | SS_NOTIFY, - 3, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), hwndFrame, NULL, params->hInstance, NULL); + dat->hwndIcon = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", nullptr, WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE | SS_NOTIFY, + 3, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), hwndFrame, nullptr, params->hInstance, nullptr); dat->hwndProgress = CreateWindowEx(WS_EX_NOPARENTNOTIFY, PROGRESS_CLASS, (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"), - WS_CHILD | WS_VISIBLE | PBS_SMOOTH, GetSystemMetrics(SM_CXICON) + 5, 5, 90, (GetSystemMetrics(SM_CXICON) / 2) - 5, hwndFrame, NULL, params->hInstance, NULL); - if (dat->hwndProgress == NULL) return -1; /* creation failed, calls WM_DESTROY */ + WS_CHILD | WS_VISIBLE | PBS_SMOOTH, GetSystemMetrics(SM_CXICON) + 5, 5, 90, (GetSystemMetrics(SM_CXICON) / 2) - 5, hwndFrame, nullptr, params->hInstance, nullptr); + if (dat->hwndProgress == nullptr) return -1; /* creation failed, calls WM_DESTROY */ SendMessage(dat->hwndProgress, PBM_SETSTEP, 1, 0); mir_subclassWindow(dat->hwndProgress, ProgressBarSubclassProc); dat->hwndDesc = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", (dat->fTimeFlags&SDWTF_ST_TIME) ? TranslateT("Shutdown at:") : TranslateT("Time left:"), WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP | SS_NOTIFY, GetSystemMetrics(SM_CXICON) + 5, (GetSystemMetrics(SM_CXICON) / 2), 75, - (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, NULL, params->hInstance, NULL); - dat->hwndTime = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", NULL, WS_CHILD | WS_VISIBLE | SS_RIGHT | SS_NOTIFY | SS_ENDELLIPSIS, - (GetSystemMetrics(SM_CXICON) + 80), (GetSystemMetrics(SM_CXICON) / 2), 35, (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, NULL, params->hInstance, NULL); - if (dat->hwndTime == NULL) + (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, nullptr, params->hInstance, nullptr); + dat->hwndTime = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", nullptr, WS_CHILD | WS_VISIBLE | SS_RIGHT | SS_NOTIFY | SS_ENDELLIPSIS, + (GetSystemMetrics(SM_CXICON) + 80), (GetSystemMetrics(SM_CXICON) / 2), 35, (GetSystemMetrics(SM_CXICON) / 2), hwndFrame, nullptr, params->hInstance, nullptr); + if (dat->hwndTime == nullptr) return -1; /* creation failed, calls WM_DESTROY */ // create tooltips TTTOOLINFO ti; - dat->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndFrame, NULL, params->hInstance, NULL); - if (dat->hwndToolTip != NULL) { + dat->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndFrame, nullptr, params->hInstance, nullptr); + if (dat->hwndToolTip != nullptr) { SetWindowPos(dat->hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); @@ -155,11 +155,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP ti.uFlags &= ~TTF_TRANSPARENT; ti.uId = (UINT_PTR)dat->hwndProgress; SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - if (dat->hwndDesc != NULL) { + if (dat->hwndDesc != nullptr) { ti.uId = (UINT_PTR)dat->hwndDesc; SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); } - if (dat->hwndIcon != NULL) { + if (dat->hwndIcon != nullptr) { ti.uId = (UINT_PTR)dat->hwndIcon; SendMessage(dat->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); } @@ -173,26 +173,26 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(hwndFrame, M_REFRESH_ICONS, 0, 0); SendMessage(hwndFrame, M_SET_COUNTDOWN, 0, 0); SendMessage(hwndFrame, M_UPDATE_COUNTDOWN, 0, 0); - if (!SetTimer(hwndFrame, 1, 1000, NULL)) + if (!SetTimer(hwndFrame, 1, 1000, nullptr)) return -1; /* creation failed, calls WM_DESTROY */ } return 0; case WM_DESTROY: - if (dat == NULL) return 0; + if (dat == nullptr) return 0; UnhookEvent(dat->hHookColorsChanged); UnhookEvent(dat->hHookFontsChanged); UnhookEvent(dat->hHookIconsChanged); /* other childs are destroyed automatically */ - if (dat->hwndToolTip != NULL) + if (dat->hwndToolTip != nullptr) DestroyWindow(dat->hwndToolTip); break; case WM_NCDESTROY: - if (dat == NULL) return 0; - if (dat->hFont != NULL) DeleteObject(dat->hFont); - if (dat->hbrBackground != NULL) DeleteObject(dat->hbrBackground); + if (dat == nullptr) return 0; + if (dat->hFont != nullptr) DeleteObject(dat->hFont); + if (dat->hbrBackground != nullptr) DeleteObject(dat->hbrBackground); mir_free(dat); SetWindowLongPtr(hwndFrame, GWLP_USERDATA, 0); break; @@ -208,14 +208,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP /* progress */ LONG width = rc.right - GetSystemMetrics(SM_CXICON) - 10; LONG height = rc.bottom - (GetSystemMetrics(SM_CYICON) / 2) - 5; - if (NULL != dat->hwndProgress) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, dat->hwndProgress, NULL, 0, 0, width, height, SWP_NOMOVE | defflg); + if (nullptr != dat->hwndProgress) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, dat->hwndProgress, nullptr, 0, 0, width, height, SWP_NOMOVE | defflg); /* desc */ - if (dat->hwndDesc != NULL) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, dat->hwndDesc, NULL, GetSystemMetrics(SM_CXICON) + 5, 5 + height, 0, 0, SWP_NOSIZE | defflg); + if (dat->hwndDesc != nullptr) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, dat->hwndDesc, nullptr, GetSystemMetrics(SM_CXICON) + 5, 5 + height, 0, 0, SWP_NOSIZE | defflg); /* time */ - if (NULL != dat->hwndTime) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, dat->hwndTime, NULL, GetSystemMetrics(SM_CXICON) + 85, 5 + height, width - 80, (GetSystemMetrics(SM_CXICON) / 2), defflg); + if (nullptr != dat->hwndTime) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, dat->hwndTime, nullptr, GetSystemMetrics(SM_CXICON) + 85, 5 + height, width - 80, (GetSystemMetrics(SM_CXICON) / 2), defflg); EndDeferWindowPos(hdwp); } PostMessage(hwndFrame, M_CHECK_CLIPPED, 0, 0); @@ -231,13 +231,13 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP if (dat->clrBackground == -1) dat->clrBackground = GetDefaultColor(FRAMEELEMENT_BKGRND); - if (dat->hbrBackground != NULL) + if (dat->hbrBackground != nullptr) DeleteObject(dat->hbrBackground); dat->hbrBackground = CreateSolidBrush(dat->clrBackground); SendMessage(dat->hwndProgress, PBM_SETBARCOLOR, 0, (LPARAM)clrBar); SendMessage(dat->hwndProgress, PBM_SETBKCOLOR, 0, (LPARAM)dat->clrBackground); - InvalidateRect(hwndFrame, NULL, TRUE); + InvalidateRect(hwndFrame, nullptr, TRUE); return 0; case M_REFRESH_ICONS: @@ -247,13 +247,13 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP { LOGFONT lf; dat->clrText = Font_GetW(L"Automatic shutdown", L"Countdown on frame", &lf); - if (dat->hFont != NULL) DeleteObject(dat->hFont); + if (dat->hFont != nullptr) DeleteObject(dat->hFont); dat->hFont = CreateFontIndirect(&lf); } - if (dat->hwndDesc != NULL) + if (dat->hwndDesc != nullptr) SendMessage(dat->hwndDesc, WM_SETFONT, (WPARAM)dat->hFont, FALSE); SendMessage(dat->hwndTime, WM_SETFONT, (WPARAM)dat->hFont, FALSE); - InvalidateRect(hwndFrame, NULL, FALSE); + InvalidateRect(hwndFrame, nullptr, FALSE); return 0; case WM_SYSCOLORCHANGE: @@ -264,7 +264,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(hwndFrame, M_REFRESH_COLORS, 0, 0); SendMessage(hwndFrame, M_REFRESH_FONTS, 0, 0); SendMessage(hwndFrame, M_UPDATE_COUNTDOWN, 0, 0); - RedrawWindow(hwndFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); + RedrawWindow(hwndFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); break; case WM_TIMECHANGE: /* windows system clock changed */ @@ -281,7 +281,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case WM_ERASEBKGND: { RECT rc; - if (dat->hbrBackground != NULL && GetClientRect(hwndFrame, &rc)) { + if (dat->hbrBackground != nullptr && GetClientRect(hwndFrame, &rc)) { FillRect((HDC)wParam, &rc, dat->hbrBackground); return TRUE; } @@ -290,7 +290,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case M_SET_COUNTDOWN: if (dat->fTimeFlags&SDWTF_ST_TIME) { dat->settingLastTime = (time_t)db_get_dw(NULL, "AutoShutdown", "TimeStamp", SETTING_TIMESTAMP_DEFAULT); - dat->countdown = time(NULL); + dat->countdown = time(nullptr); if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown; else dat->countdown = 0; } @@ -303,7 +303,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SendMessage(dat->hwndProgress, PBM_SETRANGE32, 0, (LPARAM)dat->countdown); return 0; case WM_TIMER: - if (dat == NULL) return 0; + if (dat == nullptr) return 0; if (dat->countdown != 0 && !(dat->flags&FWPDF_COUNTDOWNINVALID) && !(dat->flags&FWPDF_PAUSED)) { dat->countdown--; PostMessage(dat->hwndProgress, PBM_STEPIT, 0, 0); @@ -332,7 +332,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SetWindowText(dat->hwndTime, szOutput); PostMessage(hwndFrame, M_CHECK_CLIPPED, 0, 0); /* update tooltip text (if shown) */ - if (dat->hwndToolTip != NULL && !(dat->flags&FWPDF_PAUSED)) { + if (dat->hwndToolTip != nullptr && !(dat->flags&FWPDF_PAUSED)) { TTTOOLINFO ti; ti.cbSize = sizeof(ti); if (SendMessage(dat->hwndToolTip, TTM_GETCURRENTTOOL, 0, (LPARAM)&ti) && (HWND)ti.uId != dat->hwndIcon) @@ -380,11 +380,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP pt.y = rc.top + ((int)(rc.bottom - rc.top) / 2); } HMENU hContextMenu = CreatePopupMenu(); - if (hContextMenu != NULL) { + if (hContextMenu != nullptr) { AppendMenu(hContextMenu, MF_STRING, MENUITEM_PAUSECOUNTDOWN, (dat->flags&FWPDF_PAUSED) ? TranslateT("&Unpause countdown") : TranslateT("&Pause countdown")); SetMenuDefaultItem(hContextMenu, MENUITEM_PAUSECOUNTDOWN, FALSE); AppendMenu(hContextMenu, MF_STRING, MENUITEM_STOPCOUNTDOWN, TranslateT("&Cancel countdown")); - TrackPopupMenuEx(hContextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON, pt.x, pt.y, hwndFrame, NULL); + TrackPopupMenuEx(hContextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON, pt.x, pt.y, hwndFrame, nullptr); DestroyMenu(hContextMenu); } } @@ -411,19 +411,19 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP RECT rc; HDC hdc; SIZE size; - HFONT hFontPrev = NULL; + HFONT hFontPrev = nullptr; wchar_t szOutput[256]; dat->flags &= ~FWPDF_TIMEISCLIPPED; if (GetWindowText(dat->hwndTime, szOutput, _countof(szOutput))) if (GetClientRect(dat->hwndTime, &rc)) { hdc = GetDC(dat->hwndTime); - if (hdc != NULL) { - if (dat->hFont != NULL) + if (hdc != nullptr) { + if (dat->hFont != nullptr) hFontPrev = (HFONT)SelectObject(hdc, dat->hFont); if (GetTextExtentPoint32(hdc, szOutput, (int)mir_wstrlen(szOutput), &size)) if (size.cx >= (rc.right - rc.left)) dat->flags &= FWPDF_TIMEISCLIPPED; - if (dat->hFont != NULL) + if (dat->hFont != nullptr) SelectObject(hdc, hFontPrev); ReleaseDC(dat->hwndTime, hdc); } @@ -440,7 +440,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP SetWindowLongPtr(dat->hwndToolTip, GWL_STYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_STYLE) | TTS_NOANIMATE); SetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE) | WS_EX_TRANSPARENT); SendMessage(dat->hwndToolTip, TTM_ADJUSTRECT, TRUE, (LPARAM)&rc); - SetWindowPos(dat->hwndToolTip, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(dat->hwndToolTip, nullptr, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); return TRUE; /* self-defined position */ } } @@ -450,7 +450,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case TTN_POP: /* workaround #5: frame does not get redrawn after * in-place tooltip hidden on dat->hwndTime */ - RedrawWindow(hwndCountdownFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); + RedrawWindow(hwndCountdownFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); return 0; case TTN_NEEDTEXT: { @@ -483,16 +483,16 @@ void ShowCountdownFrame(WORD fTimeFlags) { hwndCountdownFrame = CreateWindowEx(WS_EX_CONTROLPARENT | WS_EX_NOPARENTNOTIFY | WS_EX_TRANSPARENT, COUNTDOWNFRAME_CLASS, - NULL, + nullptr, WS_CHILD | WS_TABSTOP, 0, 0, GetSystemMetrics(SM_CXICON) + 103, GetSystemMetrics(SM_CYICON) + 2, pcli->hwndContactList, - NULL, + nullptr, hInst, &fTimeFlags); - if (hwndCountdownFrame == NULL) return; + if (hwndCountdownFrame == nullptr) return; if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { CLISTFrame clf = { sizeof(clf) }; @@ -517,7 +517,7 @@ void ShowCountdownFrame(WORD fTimeFlags) if (!(CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hFrame), 0)&F_VISIBLE)) CallService(MS_CLIST_FRAMES_SHFRAME, hFrame, 0); /* workaround #4: MS_CLIST_FRAMES_SHFRAME does cause redrawing problems when frame was hidden */ - RedrawWindow(hwndCountdownFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); + RedrawWindow(hwndCountdownFrame, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); /* workaround #5: for in-place tooltip TTN_POP * workaround #6 and #7: see CloseCountdownFrame() */ } @@ -526,7 +526,7 @@ void ShowCountdownFrame(WORD fTimeFlags) void CloseCountdownFrame(void) { - if (hwndCountdownFrame != NULL) { + if (hwndCountdownFrame != nullptr) { SendMessage(hwndCountdownFrame, M_CLOSE_COUNTDOWN, 0, 0); if (hFrame) { /* HACKS TO FIX CLUIFrames: @@ -540,7 +540,7 @@ void CloseCountdownFrame(void) #endif } else DestroyWindow(hwndCountdownFrame); - hwndCountdownFrame = NULL; + hwndCountdownFrame = nullptr; hFrame = 0; } @@ -573,12 +573,12 @@ int InitFrame(void) wcx.style = CS_DBLCLKS | CS_PARENTDC; wcx.lpfnWndProc = FrameWndProc; wcx.hInstance = hInst; - wcx.hCursor = (HCURSOR)LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED); + wcx.hCursor = (HCURSOR)LoadImage(nullptr, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED); wcx.lpszClassName = COUNTDOWNFRAME_CLASS; if (!RegisterClassEx(&wcx)) return 1; - hwndCountdownFrame = NULL; + hwndCountdownFrame = nullptr; hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, FrameModulesLoaded); return 0; } diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index 7a9f2001fd..c9b8a508ce 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -76,7 +76,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (LOWORD(wParam)) { case IDC_EDIT_CONFIRMDLGCOUNTDOWN: if (HIWORD(wParam) == EN_KILLFOCUS) - if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, NULL, TRUE) < 3) { + if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, TRUE) < 3) { SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(3, 0)); SetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, 3, FALSE); } @@ -92,7 +92,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (((NMHDR*)lParam)->code) { case PSN_APPLY: db_set_b(NULL, "AutoShutdown", "ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0)); - db_set_w(NULL, "AutoShutdown", "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, NULL, FALSE)); + db_set_w(NULL, "AutoShutdown", "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE)); db_set_b(NULL, "AutoShutdown", "RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0)); db_set_b(NULL, "AutoShutdown", "SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0)); if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER))) diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 15bcc187c5..662196b3ca 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -33,7 +33,7 @@ const wchar_t *unitNames[] = { LPGENW("Second(s)"), LPGENW("Minute(s)"), LPGENW( static void EnableDlgItem(HWND hwndDlg, int idCtrl, BOOL fEnable) { hwndDlg = GetDlgItem(hwndDlg, idCtrl); - if (hwndDlg != NULL && IsWindowEnabled(hwndDlg) != fEnable) + if (hwndDlg != nullptr && IsWindowEnabled(hwndDlg) != fEnable) EnableWindow(hwndDlg, fEnable); } @@ -80,7 +80,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L lf.lfWeight = FW_BOLD; hBoldFont = CreateFontIndirect(&lf); } - else hBoldFont = NULL; + else hBoldFont = nullptr; SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, (WPARAM)hBoldFont, FALSE); } /* read-in watcher flags */ @@ -183,9 +183,9 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L { HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_GETFONT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, 0, FALSE); /* no return value */ - if (hFont != NULL) + if (hFont != nullptr) DeleteObject(hFont); - hwndSettingsDlg = NULL; + hwndSettingsDlg = nullptr; } return TRUE; @@ -258,14 +258,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L GetLocalTime(&stBuf); if (SystemTimeToTimeStamp(&st, ×tamp)) { /* set to current date if earlier */ - if (timestamp < time(NULL)) { + if (timestamp < time(nullptr)) { st.wDay = stBuf.wDay; st.wDayOfWeek = stBuf.wDayOfWeek; st.wMonth = stBuf.wMonth; st.wYear = stBuf.wYear; if (SystemTimeToTimeStamp(&st, ×tamp)) { /* step one day up if still earlier */ - if (timestamp < time(NULL)) { + if (timestamp < time(nullptr)) { timestamp += 24 * 60 * 60; TimeStampToSystemTime(timestamp, &st); } @@ -307,7 +307,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_EDIT_COUNTDOWN: if (HIWORD(wParam) == EN_KILLFOCUS) { - if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, NULL, TRUE) < 1) { + if ((int)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, TRUE) < 1) { SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(1, 0)); SetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, 1, FALSE); } @@ -317,7 +317,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_EDIT_CPUUSAGE: if (HIWORD(wParam) == EN_KILLFOCUS) { - WORD val = (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, NULL, FALSE); + WORD val = (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE); if (val < 1) val = 1; else if (val>100) val = 100; SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(val, 0)); @@ -342,7 +342,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L HWND hwndEdit = GetDlgItem(hwndDlg, IDC_EDIT_MESSAGE); int len = GetWindowTextLength(hwndEdit) + 1; wchar_t *pszText = (wchar_t*)mir_alloc(len*sizeof(wchar_t)); - if (pszText != NULL && GetWindowText(hwndEdit, pszText, len + 1)) { + if (pszText != nullptr && GetWindowText(hwndEdit, pszText, len + 1)) { TrimString(pszText); db_set_ws(NULL, "AutoShutdown", "Message", pszText); } @@ -354,7 +354,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L time_t timestamp; DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */ if (!SystemTimeToTimeStamp(&st, ×tamp)) - timestamp = time(NULL); + timestamp = time(nullptr); db_set_dw(NULL, "AutoShutdown", "TimeStamp", (DWORD)timestamp); } /* shutdown type */ @@ -365,8 +365,8 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0); if (index != LB_ERR) db_set_dw(NULL, "AutoShutdown", "CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0)); - db_set_dw(NULL, "AutoShutdown", "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, NULL, FALSE)); - db_set_b(NULL, "AutoShutdown", "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, NULL, FALSE)); + db_set_dw(NULL, "AutoShutdown", "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE)); + db_set_b(NULL, "AutoShutdown", "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE)); } /* watcher type */ { @@ -399,11 +399,11 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L static INT_PTR ServiceShowSettingsDialog(WPARAM, LPARAM) { - if (hwndSettingsDlg != NULL) { /* already opened, bring to front */ + if (hwndSettingsDlg != nullptr) { /* already opened, bring to front */ SetForegroundWindow(hwndSettingsDlg); return 0; } - return CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETTINGS), NULL, SettingsDlgProc) == NULL; + return CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETTINGS), nullptr, SettingsDlgProc) == nullptr; } /************************* Toolbar ************************************/ @@ -412,7 +412,7 @@ static HANDLE hToolbarButton; int ToolbarLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconHandleUp = iconList[2].hIcolib; ttb.hIconHandleDn = iconList[1].hIcolib; ttb.pszService = "AutoShutdown/MenuCommand"; @@ -450,14 +450,14 @@ void SetShutdownMenuItem(bool fActive) } mi.pszService = "AutoShutdown/MenuCommand"; mi.flags = CMIF_UNICODE; - if (hMainMenuItem != NULL) + if (hMainMenuItem != nullptr) Menu_ModifyItem(hMainMenuItem, mi.name.w, mi.hIcolibItem); else hMainMenuItem = Menu_AddMainMenuItem(&mi); /* tray menu */ mi.position = 899999; - if (hTrayMenuItem != NULL) + if (hTrayMenuItem != nullptr) Menu_ModifyItem(hTrayMenuItem, mi.name.w, mi.hIcolibItem); else hTrayMenuItem = Menu_AddTrayMenuItem(&mi); @@ -479,11 +479,11 @@ void InitSettingsDlg(void) { /* Menu Item */ CreateServiceFunction("AutoShutdown/MenuCommand", MenuItemCommand); - hMainMenuItem = hTrayMenuItem = NULL; + hMainMenuItem = hTrayMenuItem = nullptr; SetShutdownMenuItem(false); /* Hotkey */ AddHotkey(); /* Services */ - hwndSettingsDlg = NULL; + hwndSettingsDlg = nullptr; CreateServiceFunction(MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG, ServiceShowSettingsDialog); } diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 095c55d25b..bce97d110c 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -52,10 +52,10 @@ static BOOL WinNT_SetPrivilege(wchar_t *pszPrivName, BOOL bEnable) if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { tkp.PrivilegeCount = 1; /* one privilege is to set */ /* get the LUID for the shutdown privilege */ - if (LookupPrivilegeValue(NULL, pszPrivName, &tkp.Privileges[0].Luid)) { + if (LookupPrivilegeValue(nullptr, pszPrivName, &tkp.Privileges[0].Luid)) { tkp.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0; /* get the shutdown privilege for this process */ - bReturn = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); + bReturn = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, nullptr, nullptr); } CloseHandle(hToken); } @@ -89,7 +89,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) bReturn = TRUE; if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { dwSize = sizeof(dwSetting); - if (RegQueryValueEx(hKey, L"NoLogOff", 0, NULL, (LPBYTE)&dwSetting, &dwSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, L"NoLogOff", nullptr, nullptr, (LPBYTE)&dwSetting, &dwSize) == ERROR_SUCCESS) if (dwSetting) bReturn = FALSE; RegCloseKey(hKey); } @@ -103,7 +103,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) bReturn = TRUE; if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { dwSize = sizeof(dwSetting); - if (!RegQueryValueEx(hKey, L"DisableLockWorkstation", 0, NULL, (LPBYTE)&dwSetting, &dwSize)) + if (!RegQueryValueEx(hKey, L"DisableLockWorkstation", nullptr, nullptr, (LPBYTE)&dwSetting, &dwSize)) if (dwSetting) bReturn = FALSE; RegCloseKey(hKey); @@ -183,16 +183,16 @@ static DWORD ShutdownNow(BYTE shutdownType) DWORD dwConnItems = 0; RASCONN *paConn = (RASCONN*)mir_alloc(dwConnSize); dwErrCode = ERROR_NOT_ENOUGH_MEMORY; - if (paConn != NULL) { + if (paConn != nullptr) { for (dwRetries = 5; dwRetries != 0; dwRetries--) { /* prevent infinite loop (rare) */ memset(paConn, 0, dwConnSize); paConn[0].dwSize = sizeof(RASCONN); dwErrCode = RasEnumConnections(paConn, &dwConnSize, &dwConnItems); if (dwErrCode != ERROR_BUFFER_TOO_SMALL) break; RASCONN *paConnBuf = (RASCONN*)mir_realloc(paConn, dwConnSize); - if (paConnBuf == NULL) { + if (paConnBuf == nullptr) { mir_free(paConn); - paConn = NULL; + paConn = nullptr; dwErrCode = ERROR_NOT_ENOUGH_MEMORY; break; } @@ -202,11 +202,11 @@ static DWORD ShutdownNow(BYTE shutdownType) for (dw = 0; dw < dwConnItems; ++dw) { if (dwErrCode) { if (RasHangUp(paConn[dw].hrasconn)) - paConn[dw].hrasconn = NULL; /* do not wait for on error */ + paConn[dw].hrasconn = nullptr; /* do not wait for on error */ } else { dwErrCode = RasHangUp(paConn[dw].hrasconn); - if (!dwErrCode) paConn[dw].hrasconn = NULL; /* do not wait for on error */ + if (!dwErrCode) paConn[dw].hrasconn = nullptr; /* do not wait for on error */ } } /* RAS does not allow to quit directly after HangUp (see docs) */ @@ -214,7 +214,7 @@ static DWORD ShutdownNow(BYTE shutdownType) memset(&rcs, 0, sizeof(RASCONNSTATUS)); rcs.dwSize = sizeof(RASCONNSTATUS); for (dw = 0; dw < dwConnItems; ++dw) { - if (paConn[dw].hrasconn != NULL) { + if (paConn[dw].hrasconn != nullptr) { while (RasGetConnectStatus(paConn[dw].hrasconn, &rcs) != ERROR_INVALID_HANDLE) { Sleep(0); /* give rest of time silce to other threads with equal priority */ /* infinite loop protection (3000ms defined in docs) */ @@ -248,7 +248,7 @@ static DWORD ShutdownNow(BYTE shutdownType) BroadcastEndSession(BSM_APPLICATIONS | BSM_ALLDESKTOPS, ENDSESSION_CLOSEAPP); /* app should close itself */ WinNT_SetPrivilege(SE_TCB_NAME, FALSE); - if (!InitiateSystemShutdownEx(NULL, TranslateT("AutoShutdown"), 0, TRUE, shutdownType == SDSDT_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) + if (!InitiateSystemShutdownEx(nullptr, TranslateT("AutoShutdown"), 0, TRUE, shutdownType == SDSDT_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) dwErrCode = GetLastError(); /* cleanly close Miranda */ @@ -317,7 +317,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L lf.lfWeight = FW_BOLD; hBoldFont = CreateFontIndirect(&lf); } - else hBoldFont = NULL; + else hBoldFont = nullptr; SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, (WPARAM)hBoldFont, FALSE); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG_PTR)hBoldFont); } @@ -329,7 +329,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg, M_UPDATE_COUNTDOWN, 0, countdown); } Skin_PlaySound("AutoShutdown_Countdown"); - if (!SetTimer(hwndDlg, 1, 1000, NULL)) + if (!SetTimer(hwndDlg, 1, 1000, nullptr)) PostMessage(hwndDlg, M_START_SHUTDOWN, 0, 0); Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "AutoShutdown", "ConfirmDlg_"); @@ -343,14 +343,14 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_DESTROY: { - hwndShutdownDlg = NULL; + hwndShutdownDlg = nullptr; ShowWindow(hwndDlg, SW_HIDE); /* reallow foreground window changes (WinMe/2000+) */ LockSetForegroundWindow(LSFW_UNLOCK); Utils_SaveWindowPosition(hwndDlg, NULL, "AutoShutdown", "ConfirmDlg_"); HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_GETFONT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, 0, FALSE); /* no return value */ - if (hFont != NULL) DeleteObject(hFont); + if (hFont != nullptr) DeleteObject(hFont); } return TRUE; @@ -361,8 +361,8 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DWORD dwErrCode = ShutdownNow(shutdownType); if (dwErrCode != ERROR_SUCCESS) { char *pszErr = GetWinErrorDescription(dwErrCode); - ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("The shutdown process failed!\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown")); - if (pszErr != NULL) LocalFree(pszErr); + ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("The shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown")); + if (pszErr != nullptr) LocalFree(pszErr); } DestroyWindow(hwndDlg); } @@ -419,7 +419,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) /* passing 0 as wParam is only to be used internally, undocumented */ if (!wParam) wParam = db_get_b(NULL, "AutoShutdown", "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT); if (!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */ - if ((BOOL)lParam && hwndShutdownDlg != NULL) return 2; + if ((BOOL)lParam && hwndShutdownDlg != nullptr) return 2; /* ask others if allowed */ if (NotifyEventHooks(hEventOkToShutdown, wParam, lParam)) { @@ -430,15 +430,15 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) NotifyEventHooks(hEventShutdown, wParam, lParam); /* show dialog */ if (lParam && db_get_b(NULL, "AutoShutdown", "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT)) - if (CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), NULL, ShutdownDlgProc, (BYTE)wParam) != NULL) + if (CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (BYTE)wParam) != nullptr) return 0; /* show error */ DWORD dwErrCode = ShutdownNow((BYTE)wParam); if (dwErrCode != ERROR_SUCCESS) { char *pszErr = GetWinErrorDescription(dwErrCode); - ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != NULL) ? pszErr : Translate("Unknown")); - if (pszErr != NULL) + ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown")); + if (pszErr != nullptr) LocalFree(pszErr); return 4; } @@ -482,7 +482,7 @@ INT_PTR ServiceGetTypeDescription(WPARAM wParam, LPARAM lParam) if (!(lParam&GSTDF_UNICODE)) { static char szConvBuf[128]; char *buf = u2a(pszDesc); - if (buf == NULL) return 0; + if (buf == nullptr) return 0; mir_strncpy(szConvBuf, buf, sizeof(szConvBuf)); mir_free(buf); return (INT_PTR)szConvBuf; @@ -495,7 +495,7 @@ INT_PTR ServiceGetTypeDescription(WPARAM wParam, LPARAM lParam) void InitShutdownSvc(void) { /* Shutdown Dialog */ - hwndShutdownDlg = NULL; + hwndShutdownDlg = nullptr; Skin_AddSound("AutoShutdown_Countdown", LPGENW("Alerts"), LPGENW("Automatic shutdown countdown")); /* Events */ @@ -511,7 +511,7 @@ void InitShutdownSvc(void) void UninitShutdownSvc(void) { /* Shutdown Dialog */ - if (hwndShutdownDlg != NULL) + if (hwndShutdownDlg != nullptr) DestroyWindow(hwndShutdownDlg); /* Services */ diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 32272d33fe..e288740dbb 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -26,23 +26,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // mir_free() the return value char* u2a(const WCHAR *pszUnicode) { - if (pszUnicode == NULL) - return NULL; + if (pszUnicode == nullptr) + return nullptr; int codepage = Langpack_GetDefaultCodePage(); /* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */ DWORD flags; - int cch = WideCharToMultiByte(codepage, flags = WC_COMPOSITECHECK, pszUnicode, -1, NULL, 0, NULL, NULL); + int cch = WideCharToMultiByte(codepage, flags = WC_COMPOSITECHECK, pszUnicode, -1, nullptr, 0, nullptr, nullptr); if (!cch) - cch = WideCharToMultiByte(codepage, flags = 0, pszUnicode, -1, NULL, 0, NULL, NULL); + cch = WideCharToMultiByte(codepage, flags = 0, pszUnicode, -1, nullptr, 0, nullptr, nullptr); if (!cch) - return NULL; + return nullptr; char *psz = (char*)mir_alloc(cch); - if (psz != NULL && !WideCharToMultiByte(codepage, flags, pszUnicode, -1, psz, cch, NULL, NULL)) { + if (psz != nullptr && !WideCharToMultiByte(codepage, flags, pszUnicode, -1, psz, cch, nullptr, nullptr)) { mir_free(psz); - return NULL; + return nullptr; } return psz; } @@ -84,11 +84,11 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, . mir_vsnprintf(szText, _countof(szText), pszTextFmt, va); va_end(va); - if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success + if (!Clist_TrayNotifyA(nullptr, pszTitle, szText, flags, 30000)) // success return; MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp)); - if (mbp == NULL) return; + if (mbp == nullptr) return; mbp->cbSize = sizeof(*mbp); mbp->lpszCaption = mir_strdup(pszTitle); mbp->lpszText = mir_strdup(szText); @@ -105,11 +105,11 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, . // LocalFree() the return value char* GetWinErrorDescription(DWORD dwLastError) { - char *buf = NULL; + char *buf = nullptr; DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM; - if (!FormatMessageA(flags, NULL, dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()), (char*)&buf, 0, NULL)) + if (!FormatMessageA(flags, nullptr, dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()), (char*)&buf, 0, nullptr)) if (GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND) - FormatMessageA(flags, NULL, dwLastError, 0, (char*)&buf, 0, NULL); + FormatMessageA(flags, nullptr, dwLastError, 0, (char*)&buf, 0, nullptr); return buf; } @@ -160,12 +160,12 @@ BOOL GetFormatedCountdown(wchar_t *pszOut, int nSize, time_t countdown) } /* WinVista */ - if (pfnGetDurationFormat != NULL) { + if (pfnGetDurationFormat != nullptr) { SYSTEMTIME st; LCID locale; locale = Langpack_GetDefaultLocale(); if (TimeStampToSystemTime(countdown, &st)) - if (pfnGetDurationFormat(locale, 0, &st, 0, NULL, pszOut, nSize)) + if (pfnGetDurationFormat(locale, 0, &st, 0, nullptr, pszOut, nSize)) return TRUE; return FALSE; } @@ -182,13 +182,13 @@ BOOL GetFormatedDateTime(wchar_t *pszOut, int nSize, time_t timestamp, BOOL fSho TimeStampToSystemTime(timestamp, &st); /* today: no need to show the date */ if (!fShowDateEvenToday && st.wDay == stNow.wDay && st.wMonth == stNow.wMonth && st.wYear == stNow.wYear) - return GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, NULL, pszOut, nSize) != 0; + return GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, nullptr, pszOut, nSize) != 0; /* show both date and time */ { wchar_t szDate[128], szTime[128]; - if (!GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, NULL, szTime, _countof(szTime))) + if (!GetTimeFormat(locale, ((st.wSecond == 0) ? TIME_NOSECONDS : 0) | TIME_FORCE24HOURFORMAT, &st, nullptr, szTime, _countof(szTime))) return FALSE; - if (!GetDateFormat(locale, DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate))) + if (!GetDateFormat(locale, DATE_SHORTDATE, &st, nullptr, szDate, _countof(szDate))) return FALSE; mir_snwprintf(pszOut, nSize, L"%s %s", szTime, szDate); return TRUE; diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index d5422b632f..04f8429eb0 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -45,15 +45,15 @@ static void __stdcall MainThreadMapping(void *param) HANDLE *phDoneEvent = (HANDLE*)param; ServiceShutdown(0, TRUE); /* ensure main thread (for cpu usage shutdown) */ ServiceStopWatcher(0, 0); - if (*phDoneEvent != NULL) + if (*phDoneEvent != nullptr) SetEvent(*phDoneEvent); } static void __inline ShutdownAndStopWatcher(void) { - HANDLE hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + HANDLE hDoneEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); CallFunctionAsync(MainThreadMapping, &hDoneEvent); - if (hDoneEvent != NULL) { + if (hDoneEvent != nullptr) { WaitForSingleObject(hDoneEvent, INFINITE); CloseHandle(hDoneEvent); } @@ -72,13 +72,13 @@ static wchar_t* GetMessageText(BYTE **ppBlob, DWORD *pcbBlob) return (WCHAR*)&(*ppBlob)[cb]; } /* no Unicode data present, convert from ANSI */ - int len = MultiByteToWideChar(CP_ACP, 0, (char*)*ppBlob, -1, NULL, 0); + int len = MultiByteToWideChar(CP_ACP, 0, (char*)*ppBlob, -1, nullptr, 0); if (!len) - return NULL; + return nullptr; BYTE *buf = (BYTE*)mir_realloc(*ppBlob, (*pcbBlob) + (len*sizeof(WCHAR))); - if (buf == NULL) - return NULL; + if (buf == nullptr) + return nullptr; *pcbBlob += len*sizeof(WCHAR); *ppBlob = buf; @@ -94,7 +94,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent) DBEVENTINFO dbe = {}; dbe.cbBlob = db_event_getBlobSize(hDbEvent); dbe.pBlob = (BYTE*)mir_alloc(dbe.cbBlob + 2); /* ensure term zero */ - if (dbe.pBlob == NULL) + if (dbe.pBlob == nullptr) return 0; if (!db_event_get(hDbEvent, &dbe)) if (dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) { @@ -102,7 +102,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent) if (!db_get_ws(NULL, "AutoShutdown", "Message", &dbv)) { TrimString(dbv.ptszVal); wchar_t *pszMsg = GetMessageText(&dbe.pBlob, &dbe.cbBlob); - if (pszMsg != NULL && wcsstr(pszMsg, dbv.ptszVal) != NULL) + if (pszMsg != nullptr && wcsstr(pszMsg, dbv.ptszVal) != nullptr) ShutdownAndStopWatcher(); /* msg with specified text recvd */ mir_free(dbv.ptszVal); /* does NULL check */ } @@ -131,7 +131,7 @@ static int ProtoAck(WPARAM, LPARAM lParam) break; /* already in list */ /* insert into list */ HANDLE *buf = (HANDLE*)mir_realloc(transfers, (nTransfersCount + 1)*sizeof(HANDLE)); - if (buf != NULL) { + if (buf != nullptr) { transfers = buf; transfers[nTransfersCount] = ack->hProcess; ++nTransfersCount; @@ -148,8 +148,8 @@ static int ProtoAck(WPARAM, LPARAM lParam) memmove(&transfers[i], &transfers[i + 1], (nTransfersCount - i - 1)*sizeof(HANDLE)); --nTransfersCount; HANDLE *buf = (HANDLE*)mir_realloc(transfers, nTransfersCount*sizeof(HANDLE)); - if (buf != NULL) transfers = buf; - else if (!nTransfersCount) transfers = NULL; + if (buf != nullptr) transfers = buf; + else if (!nTransfersCount) transfers = nullptr; /* stop watcher */ if (!nTransfersCount && (currentWatcherType&SDWTF_FILETRANSFER)) ShutdownAndStopWatcher(); @@ -178,7 +178,7 @@ static BOOL CheckAllContactsOffline(void) fSmartCheck = db_get_b(NULL, "AutoShutdown", "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *pszProto = GetContactProto(hContact); - if (pszProto != NULL && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) { + if (pszProto != nullptr && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) { if (db_get_b(hContact, pszProto, "ChatRoom", 0)) continue; if (db_get_w(hContact, pszProto, "Status", 0) != ID_STATUS_OFFLINE) { if (fSmartCheck) { @@ -197,9 +197,9 @@ static int StatusSettingChanged(WPARAM wParam, LPARAM lParam) { if (currentWatcherType&SDWTF_STATUS) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; - if ((HANDLE)wParam != NULL && dbcws->value.wVal == ID_STATUS_OFFLINE && !strcmp(dbcws->szSetting, "Status")) { + if ((HANDLE)wParam != nullptr && dbcws->value.wVal == ID_STATUS_OFFLINE && !strcmp(dbcws->szSetting, "Status")) { char *pszProto = GetContactProto(wParam); - if (pszProto != NULL && !strcmp(dbcws->szModule, pszProto)) + if (pszProto != nullptr && !strcmp(dbcws->szModule, pszProto)) if (CheckAllContactsOffline()) ShutdownAndStopWatcher(); } @@ -235,7 +235,7 @@ static BOOL CALLBACK CpuUsageWatcherProc(BYTE nCpuUsage, LPARAM lParam) static int WeatherUpdated(WPARAM wParam, LPARAM lParam) { char *pszProto = GetContactProto(wParam); - if ((BOOL)lParam && pszProto != NULL && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == THUNDER) + if ((BOOL)lParam && pszProto != nullptr && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) == THUNDER) if (db_get_b(NULL, "AutoShutdown", "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT)) ServiceShutdown(SDSDT_SHUTDOWN, TRUE); return 0; @@ -334,11 +334,11 @@ void InitWatcher(void) /* Idle Shutdown */ hHookIdleChanged = HookEvent(ME_IDLE_CHANGED, IdleChanged); /* Transfer Shutdown */ - transfers = NULL; + transfers = nullptr; nTransfersCount = 0; hHookProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck); /* Weather Shutdown */ - hHookWeatherUpdated = NULL; + hHookWeatherUpdated = nullptr; /* Services */ hEventWatcherChanged = CreateHookableEvent(ME_AUTOSHUTDOWN_WATCHERCHANGED); CreateServiceFunction(MS_AUTOSHUTDOWN_STARTWATCHER, ServiceStartWatcher); diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 42dbfa80ef..a352efd61b 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -20,7 +20,7 @@ Avatar History Plugin #include "stdafx.h" -HGENMENU hMenu = NULL; +HGENMENU hMenu = nullptr; static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact = NULL); @@ -49,8 +49,8 @@ public: ListEntry() { hDbEvent = NULL; - filename = NULL; - filelink = NULL; + filename = nullptr; + filelink = nullptr; } ~ListEntry() @@ -82,7 +82,7 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn) struct AvatarDialogData *avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData)); memset(avdlg, 0, sizeof(struct AvatarDialogData)); avdlg->hContact = hContact; - if (fn == NULL) + if (fn == nullptr) avdlg->fn[0] = '\0'; else MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, _countof(avdlg->fn)); @@ -143,7 +143,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA TranslateDialogDefault(hwnd); EnableDisableControls(hwnd); free(data); - data = NULL; + data = nullptr; } break; @@ -204,7 +204,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA POINT p; p.x = LOWORD(lParam); p.y = HIWORD(lParam); - int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwndList, NULL); + int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwndList, nullptr); DestroyMenu(menu); ListEntry *le = (ListEntry*)SendMessage(hwndList, LB_GETITEMDATA, pos, 0); @@ -312,7 +312,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA wchar_t avfolder[MAX_PATH]; MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); GetContactFolder(avfolder, hContact); - ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, nullptr, nullptr, SW_SHOWNORMAL); return TRUE; } break; @@ -352,7 +352,7 @@ int AddFileToList(wchar_t *path, wchar_t *lnk, wchar_t *filename, HWND list) le->filelink = mir_wstrdup(lnk); wchar_t *p = wcschr(filename, '.'); - if (p != NULL) + if (p != nullptr) p[0] = '\0'; int max_pos = SendMessage(list, LB_ADDSTRING, 0, (LPARAM)filename); SendMessage(list, LB_SETITEMDATA, max_pos, (LPARAM)le); @@ -464,7 +464,7 @@ bool UpdateAvatarPic(HWND hwnd) HBITMAP avpic = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)le->filename, IMGL_WCHAR); - bool found_image = (avpic != NULL); + bool found_image = (avpic != nullptr); avpic = (HBITMAP)SendMessage(hwndpic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)avpic); if (avpic) diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 0cc29ece82..cc4704a7c2 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -28,12 +28,12 @@ HINSTANCE hInst; DWORD mirVer; -HANDLE hFolder = NULL; +HANDLE hFolder = nullptr; wchar_t profilePath[MAX_PATH]; // database profile path (read at startup only) wchar_t basedir[MAX_PATH]; int hLangpack = 0; -MWindowList hAvatarWindowsList = NULL; +MWindowList hAvatarWindowsList = nullptr; int OptInit(WPARAM wParam, LPARAM lParam); @@ -109,7 +109,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) return 0; char *proto = GetContactProto(hContact); - if (proto == NULL) + if (proto == nullptr) return 0; if (mir_strcmp(META_PROTO, proto) == 0) @@ -119,7 +119,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) bool ret = (db_get_ws(hContact, MODULE_NAME, "AvatarHash", &dbvOldHash) == 0); CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam; - if (avatar == NULL) { + if (avatar == nullptr) { if (!ret || !mir_wstrcmp(dbvOldHash.ptszVal, L"-")) { //avoid duplicate "removed avatar" notifications //do not notify on an empty profile @@ -133,7 +133,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) db_set_ws(hContact, MODULE_NAME, "AvatarHash", L"-"); if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed) - ShowPopup(hContact, NULL, opts.popup_removed); + ShowPopup(hContact, nullptr, opts.popup_removed); } else { if (ret && !mir_wstrcmp(dbvOldHash.ptszVal, avatar->hash)) { @@ -177,7 +177,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) wchar_t *file = GetCachedAvatar(proto, hash); - if (file != NULL) { + if (file != nullptr) { mir_wstrncpy(history_filename, file, _countof(history_filename)); mir_free(file); } @@ -207,7 +207,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) } if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_changed) - ShowPopup(hContact, NULL, opts.popup_changed); + ShowPopup(hContact, nullptr, opts.popup_changed); if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY)) { wchar_t rel_path[MAX_PATH]; @@ -217,7 +217,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) DBEVENTINFO dbei = {}; dbei.szModule = GetContactProto(hContact); dbei.flags = DBEF_READ | DBEF_UTF; - dbei.timestamp = (DWORD)time(NULL); + dbei.timestamp = (DWORD)time(nullptr); dbei.eventType = EVENTTYPE_AVATAR_CHANGE; dbei.cbBlob = (DWORD)mir_strlen(blob) + 1; dbei.pBlob = blob; @@ -294,12 +294,12 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); - CoInitialize(NULL); + CoInitialize(nullptr); // Is first run? if (db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) { // Show dialog - int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0); + int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, FirstRunDlgProc, 0); if (ret == 0) return -1; diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 28cfbb9f6c..38ce5a44a7 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -25,7 +25,7 @@ static void ReleaseIconEx(HICON hIcon) static void IcoLibUpdateMenus() { HICON hIcon = createDefaultOverlayedIcon(FALSE); - Menu_ModifyItem(hMenu, 0, hIcon, 0); + Menu_ModifyItem(hMenu, nullptr, hIcon, 0); DestroyIcon(hIcon); } diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index 3d94a21e3c..7987f862a4 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -25,18 +25,18 @@ Options opts; // Prototypes ///////////////////////////////////////////////////////////////////////////////////// static OptPageControl optionsControls[] = { - { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE } + { nullptr, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "%sEnabled", TRUE } }; static OptPageControl popupsControls[] = { - { NULL, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS }, + { nullptr, CONTROL_CHECKBOX, IDC_POPUPS, "AvatarPopups", AVH_DEF_AVPOPUPS }, { &opts.popup_bkg_color, CONTROL_COLOR, IDC_BGCOLOR, "PopupsBgColor", AVH_DEF_POPUPBG }, { &opts.popup_text_color, CONTROL_COLOR, IDC_TEXTCOLOR, "PopupsTextColor", AVH_DEF_POPUPFG }, { &opts.popup_use_win_colors, CONTROL_CHECKBOX, IDC_WINCOLORS, "PopupsWinColors", FALSE }, { &opts.popup_use_default_colors, CONTROL_CHECKBOX, IDC_DEFAULTCOLORS, "PopupsDefaultColors", AVH_DEF_DEFPOPUPS }, { &opts.popup_delay_type, CONTROL_RADIO, IDC_DELAYFROMPU, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_DEFAULT }, - { NULL, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM }, - { NULL, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT }, + { nullptr, CONTROL_RADIO, IDC_DELAYCUSTOM, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_CUSTOM }, + { nullptr, CONTROL_RADIO, IDC_DELAYPERMANENT, "PopupsDelayType", POPUP_DELAY_DEFAULT, POPUP_DELAY_PERMANENT }, { &opts.popup_timeout, CONTROL_SPIN, IDC_DELAY, "PopupsTimeout", 10, IDC_DELAY_SPIN, (WORD)1, (WORD)255 }, { &opts.popup_right_click_action, CONTROL_COMBO, IDC_RIGHT_ACTION, "PopupsRightClick", POPUP_ACTION_CLOSEPOPUP }, { &opts.popup_left_click_action, CONTROL_COMBO, IDC_LEFT_ACTION, "PopupsLeftClick", POPUP_ACTION_OPENAVATARHISTORY }, @@ -127,7 +127,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT)) op.popup_delay_type = POPUP_DELAY_PERMANENT; - op.popup_timeout = GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); + op.popup_timeout = GetDlgItemInt(hwndDlg, IDC_DELAY, nullptr, FALSE); op.popup_bkg_color = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0); op.popup_text_color = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0); op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0; diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index 9fee0bb3ff..6d4ef5c8ab 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -HWND hPopupWindow = NULL; +HWND hPopupWindow = nullptr; static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -43,7 +43,7 @@ void InitPopups() // window needed for popup commands hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MODULE_NAME) L"_PopupWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, - NULL, hInst, NULL); + nullptr, hInst, nullptr); SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc); } @@ -56,14 +56,14 @@ void DeInitPopups() // Show an error popup void ShowErrPopup(const wchar_t *description, const wchar_t *title) { - ShowPopupEx(NULL, title == NULL ? _A2W(MODULE_NAME) L" Error" : title, description, - NULL, POPUP_TYPE_ERROR, NULL); + ShowPopupEx(NULL, title == nullptr ? _A2W(MODULE_NAME) L" Error" : title, description, + nullptr, POPUP_TYPE_ERROR, nullptr); } void ShowTestPopup(MCONTACT hContact, const wchar_t *title, const wchar_t *description, const Options *op) { - ShowPopupEx(hContact, title, description, NULL, POPUP_TYPE_TEST, op); + ShowPopupEx(hContact, title, description, nullptr, POPUP_TYPE_TEST, op); } @@ -101,13 +101,13 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip ((PopupDataType*)ppd.PluginData)->plugin_data = plugin_data; ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon; - if (title != NULL) + if (title != nullptr) mir_wstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName)); else if (hContact != NULL) mir_wstrncpy(ppd.lptzContactName, (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0), _countof(ppd.lptzContactName)); - if (description != NULL) + if (description != nullptr) mir_wstrncpy(ppd.lptzText, description, _countof(ppd.lptzText)); if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { @@ -163,7 +163,7 @@ void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *descrip PUAddPopupT(&ppd); } else { - MessageBox(NULL, description, title ? title : (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0), + MessageBox(nullptr, description, title ? title : (wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0), MB_OK); } diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 30f756839b..71214413a2 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -74,9 +74,9 @@ void ConvertToFilename(wchar_t *str, size_t size) wchar_t* GetExtension(wchar_t *file) { - if (file == NULL) return L""; + if (file == nullptr) return L""; wchar_t *ext = wcsrchr(file, '.'); - if (ext != NULL) + if (ext != nullptr) ext++; else ext = L""; @@ -86,7 +86,7 @@ wchar_t* GetExtension(wchar_t *file) wchar_t* GetHistoryFolder(wchar_t *fn) { - if (fn == NULL) return NULL; + if (fn == nullptr) return nullptr; FoldersGetCustomPathT(hFolder, fn, MAX_PATH, basedir); CreateDirectoryTreeW(fn); return fn; @@ -96,7 +96,7 @@ wchar_t* GetProtocolFolder(wchar_t *fn, char *proto) { GetHistoryFolder(fn); - if (proto == NULL) + if (proto == nullptr) proto = Translate("Unknown protocol"); mir_snwprintf(fn, MAX_PATH, L"%s\\%S", fn, proto); @@ -163,7 +163,7 @@ BOOL CopyImageFile(wchar_t *old_file, wchar_t *new_file) wchar_t* GetCachedAvatar(char *proto, wchar_t *hash) { - wchar_t *ret = NULL; + wchar_t *ret = nullptr; wchar_t file[1024] = L""; wchar_t search[1024] = L""; if (opts.log_keep_same_folder) @@ -176,7 +176,7 @@ wchar_t* GetCachedAvatar(char *proto, wchar_t *hash) WIN32_FIND_DATA finddata; HANDLE hFind = FindFirstFile(search, &finddata); if (hFind == INVALID_HANDLE_VALUE) - return NULL; + return nullptr; do { size_t len = mir_wstrlen(finddata.cFileName); @@ -198,12 +198,12 @@ wchar_t* GetCachedAvatar(char *proto, wchar_t *hash) BOOL CreateShortcut(wchar_t *file, wchar_t *shortcut) { - IShellLink *psl = NULL; - HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + IShellLink *psl = nullptr; + HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); if (SUCCEEDED(hr)) { psl->SetPath(file); - IPersistFile *ppf = NULL; + IPersistFile *ppf = nullptr; hr = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); if (SUCCEEDED(hr)) { hr = ppf->Save(shortcut, TRUE); @@ -218,18 +218,18 @@ BOOL CreateShortcut(wchar_t *file, wchar_t *shortcut) BOOL ResolveShortcut(wchar_t *shortcut, wchar_t *file) { - IShellLink* psl = NULL; + IShellLink* psl = nullptr; - HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); if (SUCCEEDED(hr)) { - IPersistFile* ppf = NULL; + IPersistFile* ppf = nullptr; hr = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); if (SUCCEEDED(hr)) { hr = ppf->Load(shortcut, STGM_READ); if (SUCCEEDED(hr)) { - hr = psl->Resolve(NULL, SLR_UPDATE); + hr = psl->Resolve(nullptr, SLR_UPDATE); if (SUCCEEDED(hr)) { WIN32_FIND_DATA wfd; hr = psl->GetPath(file, MAX_PATH, &wfd, SLGP_RAWPATH); diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 2630ff4e68..3363a4fb67 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -16,7 +16,7 @@ Copyright (C) 2010, 2011 tico-tico #pragma comment(lib, "src\\bass.lib") #endif -static HINSTANCE hBass = NULL; +static HINSTANCE hBass = nullptr; FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo dli) { @@ -25,7 +25,7 @@ FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo dli) case dliNotePreGetProcAddress: return GetProcAddress(hBass, dli->dlp.szProcName); } - return NULL; + return nullptr; } extern "C" PfnDliHook __pfnDliNotifyHook2 = delayHook; @@ -70,11 +70,11 @@ static int Volume; static int device = -1; static int newBass = 0; -HWND hwndSlider = NULL, hwndMute = NULL, hwndOptSlider = NULL, hwnd_plugin = NULL; +HWND hwndSlider = nullptr, hwndMute = nullptr, hwndOptSlider = nullptr, hwnd_plugin = nullptr; COLORREF clBack = 0; -HBRUSH hBkgBrush = 0; -HANDLE frame_id = NULL; -HANDLE hBASSFolder = NULL, hPlaySound = NULL; +HBRUSH hBkgBrush = nullptr; +HANDLE frame_id = nullptr; +HANDLE hBASSFolder = nullptr, hPlaySound = nullptr; static int OnPlaySnd(WPARAM wParam, LPARAM lParam) { @@ -178,7 +178,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara CheckDlgButton(hwndDlg, IDC_QUIETTIME, BST_CHECKED); } - if (hBass == NULL) { + if (hBass == nullptr) { EnableWindow(GetDlgItem(hwndDlg, IDC_VOLUME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCHANNEL), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_OUTDEVICE), FALSE); @@ -208,7 +208,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return TRUE; case WM_HSCROLL: - if (hBass != NULL) + if (hBass != nullptr) if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) { Volume = SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100); @@ -223,7 +223,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - if (hBass != NULL) { + if (hBass != nullptr) { SYSTEMTIME systime = { 0 }; GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, _countof(tmp)); @@ -269,7 +269,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return 1; case PSN_RESET: - if (hBass != NULL) + if (hBass != nullptr) BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100); return 1; @@ -361,14 +361,14 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch (msg) { case WM_CREATE: hwndMute = CreateWindow(MIRANDABUTTONCLASS, L"", WS_CHILD | WS_VISIBLE, 1, 1, 16, 16, hwnd, - 0, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL); + nullptr, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), nullptr); SendMessage(hwndMute, BUTTONSETASFLATBTN, 1, 0); SendMessage(hwndMute, BUTTONSETCUSTOMPAINT, 0, (LPARAM)&fnPainter); EnableFrameIcon(db_get_b(NULL, "Skin", "UseSound", 0) != 0); hwndSlider = CreateWindow(TRACKBAR_CLASS, L"", WS_CHILD | WS_VISIBLE | TBS_NOTICKS | TBS_TOOLTIPS, 21, 1, 100, 20, - hwnd, (HMENU)0, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL); + hwnd, (HMENU)nullptr, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), nullptr); SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN, SLIDER_MAX)); SendMessage(hwndSlider, TBM_SETPOS, TRUE, Volume); mir_subclassWindow(hwndSlider, SliderWndProc); @@ -383,7 +383,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_HSCROLL: - if (hBass != NULL) + if (hBass != nullptr) if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) { Volume = (DWORD)SendMessage(hwndSlider, TBM_GETPOS, 0, 0); db_set_b(NULL, ModuleName, OPT_VOLUME, Volume); @@ -399,7 +399,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR GetClientRect(hwnd, &rc); if (hwndMute) MoveWindow(hwndMute, rc.right - 20, 2, 16, 16, FALSE); - SetWindowPos(hwndSlider, 0, 1, rc.top + 1 + (20 - 18) / 2, rc.right - rc.left - 1 - 20, 18, SWP_NOZORDER); + SetWindowPos(hwndSlider, nullptr, 1, rc.top + 1 + (20 - 18) / 2, rc.right - rc.left - 1 - 20, 18, SWP_NOZORDER); InvalidateRect(hwnd, &rc, FALSE); return 0; @@ -430,9 +430,9 @@ int ReloadColors(WPARAM, LPARAM) DeleteObject(hBkgBrush); hBkgBrush = CreateSolidBrush(clBack); HWND hwnd = GetFocus(); - InvalidateRect(hwndSlider, NULL, TRUE); + InvalidateRect(hwndSlider, nullptr, TRUE); SetFocus(hwndSlider); - RedrawWindow(hwnd_plugin, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); + RedrawWindow(hwnd_plugin, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); SetFocus(hwnd); return 0; } @@ -445,12 +445,12 @@ void CreateFrame() WNDCLASS wndclass = { 0 }; wndclass.lpfnWndProc = FrameWindowProc; wndclass.hInstance = hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.lpszClassName = L"BassInterfaceFrame"; RegisterClass(&wndclass); hwnd_plugin = CreateWindow(L"BassInterfaceFrame", TranslateT("Bass Interface"), - WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, NULL); + WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr); CLISTFrame Frame = { sizeof(CLISTFrame) }; Frame.tname = TranslateT("Bass Interface"); @@ -488,7 +488,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) { hBass = LoadLibrary(ptszPath); - if (hBass != NULL) + if (hBass != nullptr) { newBass = (BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, TRUE) != 0); // will use new "Default" device @@ -512,7 +512,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) EnPreview = db_get_b(NULL, ModuleName, OPT_PREVIEW, 0); StatMask = db_get_w(NULL, ModuleName, OPT_STATUS, 0x3ff); - BASS_Init(device, 44100, 0, pcli->hwndContactList, NULL); + BASS_Init(device, 44100, 0, pcli->hwndContactList, nullptr); Volume = db_get_b(NULL, ModuleName, OPT_VOLUME, 33); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100); @@ -526,10 +526,10 @@ int OnFoldersChanged(WPARAM, LPARAM) FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L""); mir_wstrcat(CurrBassPath, L"\\bass.dll"); - if (hBass != NULL) { + if (hBass != nullptr) { BASS_Free(); FreeLibrary(hBass); - hBass = NULL; + hBass = nullptr; UnhookEvent(hPlaySound); DeleteFrame(); } @@ -580,7 +580,7 @@ int OnSettingChanged(WPARAM wParam, LPARAM lParam) int OnShutdown(WPARAM, LPARAM) { - if (hBass != NULL) { + if (hBass != nullptr) { BASS_Free(); FreeLibrary(hBass); } diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 8b42954c44..b017c33188 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -25,16 +25,16 @@ HINSTANCE hInst; #define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask" HCURSOR hCurSplitNS, hCurSplitWE; -HANDLE g_hMainThread = NULL; +HANDLE g_hMainThread = nullptr; -HANDLE *hEventIcons = NULL; +HANDLE *hEventIcons = nullptr; int iconsNum = 3; HANDLE hToolbarButton; HGENMENU hContactMenu, hDeleteContactMenu; HGENMENU hTaskMainMenu; std::vector taskMenus; bool g_SmileyAddAvail = false; -char* metaContactProto = NULL; +char* metaContactProto = nullptr; const IID IID_ITextDocument = { 0x8CC497C0, 0xA1DF, 0x11ce, {0x80, 0x98, 0x00, 0xAA, 0x00, 0x47, 0xBE, 0x5D} }; #define MODULE "BasicHistory" @@ -85,7 +85,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) int ToolbarModuleLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszService = MS_HISTORY_SHOWCONTACTHISTORY; ttb.name = ttb.pszTooltipUp = LPGEN("Open History"); ttb.dwFlags = TTBBF_SHOWTOOLTIP; @@ -122,7 +122,7 @@ void InitMenuItems() void InitTaskMenuItems() { if (Options::instance->taskOptions.size() > 0) { - if (hTaskMainMenu == NULL) { + if (hTaskMainMenu == nullptr) { CMenuItem mi; SET_UID(mi, 0xbf66499, 0x1b39, 0x47a2, 0x9b, 0x74, 0xa6, 0xae, 0x89, 0x95, 0x59, 0x59); mi.position = 500060005; @@ -151,7 +151,7 @@ void InitTaskMenuItems() taskMenus.push_back(menu); } } - else if (hTaskMainMenu != NULL) + else if (hTaskMainMenu != nullptr) Menu_ShowItem(hTaskMainMenu, false); } @@ -178,7 +178,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId) return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); - return 0; + return nullptr; } INT_PTR ShowContactHistory(WPARAM hContact, LPARAM) @@ -205,12 +205,12 @@ int ModulesLoaded(WPARAM, LPARAM) InitMenuItems(); wchar_t ftpExe[MAX_PATH]; - if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe))) { + if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) { wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); DWORD atr = GetFileAttributes(ftpExe); if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY) { #ifdef _WIN64 - if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe))) { + if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILESX86, nullptr, SHGFP_TYPE_CURRENT, ftpExe))) { wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); atr = GetFileAttributes(ftpExe); if (!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)) @@ -246,11 +246,11 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); - hTaskMainMenu = NULL; + hTaskMainMenu = nullptr; DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS); - hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); - hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); + hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); + hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory); CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory); @@ -271,16 +271,16 @@ extern "C" int __declspec(dllexport) Unload(void) { if (g_hMainThread) CloseHandle(g_hMainThread); - g_hMainThread = NULL; + g_hMainThread = nullptr; HistoryWindow::Deinit(); DestroyCursor(hCurSplitNS); DestroyCursor(hCurSplitWE); - if (Options::instance != NULL) { + if (Options::instance != nullptr) { delete Options::instance; - Options::instance = NULL; + Options::instance = nullptr; } delete[] hEventIcons; diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp index 619a9de152..bc67e95756 100644 --- a/plugins/BasicHistory/src/BinaryExport.cpp +++ b/plugins/BasicHistory/src/BinaryExport.cpp @@ -52,9 +52,9 @@ BinaryExport::~BinaryExport() void BinaryExport::WriteString(const std::wstring &str) { - int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL); + int conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr); char* buf = new char[conv]; - conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, NULL, NULL); + conv = WideCharToMultiByte(codepage, 0, str.c_str(), (int)str.length() + 1, buf, conv, nullptr, nullptr); EXP_FILE.write(buf, conv); delete[] buf; } @@ -95,7 +95,7 @@ bool BinaryExport::ReadString(std::wstring &str) if (totalSize == 0) return true; - int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, NULL, 0); + int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, nullptr, 0); str.resize(sizeW); MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, (wchar_t*)str.c_str(), sizeW); return true; diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 7c8f5af157..c21a030abe 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -58,11 +58,11 @@ DatExport::~DatExport() int DatExport::WriteString(const std::wstring &str) { - int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL); + int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, nullptr, 0, nullptr, nullptr); if (conv > (int)memBuf.size()) memBuf.resize(conv); - conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, NULL, NULL); + conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, (char*)memBuf.c_str(), conv, nullptr, nullptr); return conv; } diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 9378fab352..460fcddac0 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -30,9 +30,9 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true); std::wstring GetName(const std::wstring &path); HistoryEventList::HistoryEventList() : - m_hWnd(NULL), + m_hWnd(nullptr), m_isWnd(false), - m_hContact(NULL), + m_hContact(0), m_deltaTime(0), m_isFlat(false), m_useImportedMessages(true) @@ -42,7 +42,7 @@ HistoryEventList::HistoryEventList() : } HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) : - m_hWnd(NULL), + m_hWnd(nullptr), m_isWnd(false), m_hContact(_hContact), m_deltaTime(0), @@ -242,7 +242,7 @@ void HistoryEventList::RefreshEventList() if (it != m_contactFileMap.end()) { ExportManager imp(m_hWnd, m_hContact, 1); imp.SetAutoImport(it->second.file); - if (!imp.Import(it->second.type, messages, NULL)) + if (!imp.Import(it->second.type, messages, nullptr)) messages.clear(); } } @@ -310,7 +310,7 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, wchar_t *strFind, Comp if (it != m_contactFileMap.end()) { ExportManager imp(m_hWnd, hContact, 1); imp.SetAutoImport(it->second.file); - if (!imp.Import(it->second.type, messages, NULL)) + if (!imp.Import(it->second.type, messages, nullptr)) messages.clear(); } } @@ -364,7 +364,7 @@ void HistoryEventList::AddGroup(const EventIndex& ev) wchar_t eventText[256]; int i; eventText[0] = 0; - TimeZone_PrintTimeStamp(NULL, data.timestamp, L"d t", eventText, 64, 0); + TimeZone_PrintTimeStamp(nullptr, data.timestamp, L"d t", eventText, 64, 0); std::wstring time = eventText; std::wstring user; if (data.isMe) @@ -404,9 +404,9 @@ inline std::wstring GetProtocolName(MCONTACT hContact) { char* ac = Proto_GetBaseAccountName(hContact); std::wstring proto1; - if (ac != NULL) { + if (ac != nullptr) { PROTOACCOUNT* acnt = Proto_GetAccount(ac); - if (acnt != NULL && acnt->szModuleName != NULL) { + if (acnt != nullptr && acnt->szModuleName != nullptr) { wchar_t* proto = mir_a2u(acnt->szProtoName); proto1 = proto; mir_free(proto); @@ -424,7 +424,7 @@ std::wstring HistoryEventList::GetProtocolName() std::string HistoryEventList::GetBaseProtocol() { char* proto = GetContactProto(m_hContact); - return proto == NULL ? "" : proto; + return proto == nullptr ? "" : proto; } std::wstring HistoryEventList::GetMyId() @@ -511,9 +511,9 @@ void HistoryEventList::MargeMessages(const std::vector // For now I do not convert event data from string to blob, and event type must be message to handle it properly dbei.eventType = EVENTTYPE_MESSAGE; UINT cp = dbei.flags & DBEF_UTF ? CP_UTF8 : CP_ACP; - dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, NULL, 0, NULL, NULL); + dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, nullptr, 0, nullptr, nullptr); char* buf = new char[dbei.cbBlob]; - dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, NULL, NULL); + dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, nullptr, nullptr); dbei.pBlob = (PBYTE)buf; db_event_add(m_hContact, &dbei); delete[] buf; @@ -564,12 +564,12 @@ void HistoryEventList::GetExtEventDBei(const EventIndex& ev) HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev) { if (ev.isExternal) - return NULL; + return nullptr; HICON ico = DbEvent_GetIcon(&m_dbei, LR_SHARED); HICON icoMsg = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); if (icoMsg == ico) - return NULL; + return nullptr; return ico; } @@ -614,7 +614,7 @@ void HistoryEventList::Init() m_contactFileDir = temp; m_contactFileDir += L"BasicHistoryImportDir\\"; DeleteDirectory(m_contactFileDir.c_str()); - CreateDirectory(m_contactFileDir.c_str(), NULL); + CreateDirectory(m_contactFileDir.c_str(), nullptr); } int HistoryEventList::GetContactMessageNumber(MCONTACT hContact) diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 820abcf64b..111a813ed7 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -90,7 +90,7 @@ std::wstring ReplaceExt(const std::wstring& file, const wchar_t* ext) bool ExportManager::Export(IExport::ExportType type) { - m_exp = NULL; + m_exp = nullptr; UINT cp; std::wstring encoding; bool isBin = false; @@ -180,7 +180,7 @@ bool ExportManager::Export(IExport::ExportType type) const wchar_t* ExportManager::GetExt(IImport::ImportType type) { - IImport *imp = NULL; + IImport *imp = nullptr; switch (type) { case IImport::Binary: imp = new BinaryExport(); @@ -199,7 +199,7 @@ const wchar_t* ExportManager::GetExt(IImport::ImportType type) int ExportManager::Import(IImport::ImportType type, const std::vector& contacts) { - IImport *imp = NULL; + IImport *imp = nullptr; switch (type) { case IImport::Binary: imp = new BinaryExport(); @@ -238,7 +238,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector& bool ExportManager::Import(IImport::ImportType type, std::vector& eventList, std::wstring* err, bool* differentContact, std::vector* contacts) { - IImport *imp = NULL; + IImport *imp = nullptr; switch (type) { case IImport::Binary: imp = new BinaryExport(); @@ -269,10 +269,10 @@ bool ExportManager::Import(IImport::ImportType type, std::vectorIsContactInFile(v); if (contInFile == -1) { ret = false; - if (err != NULL) + if (err != nullptr) *err = TranslateT("File does not contain selected contact"); - if (contacts != NULL && differentContact != NULL) { + if (contacts != nullptr && differentContact != nullptr) { contInFile = imp->IsContactInFile(*contacts); if (contInFile >= 0) { *differentContact = true; @@ -282,12 +282,12 @@ bool ExportManager::Import(IImport::ImportType type, std::vectorGetEventList(eventList); - if (!ret && err != NULL) + if (!ret && err != nullptr) *err = TranslateT("File is corrupted"); } else { ret = false; - if (err != NULL) + if (err != nullptr) *err = TranslateT("File is corrupted"); } stream->close(); @@ -298,7 +298,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vectorWriteGroup(isMe, time, user, eventText); @@ -371,7 +371,7 @@ void ExportManager::DeleteExportedEvents() void ExportManager::SetDeleteWithoutExportEvents(int deltaTime, DWORD now) { - m_exp = NULL; + m_exp = nullptr; m_deltaTime = deltaTime; m_now = now; RefreshEventList(); diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index b12eafe799..f24c7792c3 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -44,22 +44,22 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) : splitterOrgY(0), splitterX(0), splitterOrgX(0), - plusIco(NULL), - minusIco(NULL), - findNextIco(NULL), - findPrevIco(NULL), - configIco(NULL), - deleteIco(NULL), + plusIco(nullptr), + minusIco(nullptr), + findNextIco(nullptr), + findPrevIco(nullptr), + configIco(nullptr), + deleteIco(nullptr), isContactList(false), isLoading(false), isGroupImages(false), allIconNumber(0), - eventIcons(NULL), - bkBrush(NULL), - bkFindBrush(NULL), + eventIcons(nullptr), + bkBrush(nullptr), + bkFindBrush(nullptr), hSystem(NULL), - splitterXhWnd(NULL), - splitterYhWnd(NULL), + splitterXhWnd(nullptr), + splitterYhWnd(nullptr), isStartSelect(true) { searcher.SetContect(this); @@ -78,36 +78,36 @@ HistoryWindow::HistoryWindow(MCONTACT hContact) : HistoryWindow::~HistoryWindow() { - if (eventIcons != NULL) { + if (eventIcons != nullptr) { for (int i = 0; i < iconsNum; ++i) - if (eventIcons[i] != NULL) + if (eventIcons[i] != nullptr) IcoLib_ReleaseIcon(eventIcons[i]); delete[] eventIcons; } - if (plusIco != NULL) + if (plusIco != nullptr) IcoLib_ReleaseIcon(plusIco); - if (minusIco != NULL) + if (minusIco != nullptr) IcoLib_ReleaseIcon(minusIco); - if (findNextIco != NULL) + if (findNextIco != nullptr) IcoLib_ReleaseIcon(findNextIco); - if (findPrevIco != NULL) + if (findPrevIco != nullptr) IcoLib_ReleaseIcon(findPrevIco); - if (himlSmall != NULL) + if (himlSmall != nullptr) ImageList_Destroy(himlSmall); - if (himlNone != NULL) + if (himlNone != nullptr) ImageList_Destroy(himlNone); - if (bkBrush != NULL) + if (bkBrush != nullptr) DeleteObject(bkBrush); - if (bkFindBrush != NULL) + if (bkFindBrush != nullptr) DeleteObject(bkFindBrush); } @@ -235,7 +235,7 @@ void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow) void HistoryWindow::Show() { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryWindow::DlgProcHistory, (LPARAM)this); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryWindow::DlgProcHistory, (LPARAM)this); } void HistoryWindow::Focus() @@ -264,10 +264,10 @@ int HistoryWindow::FontsChanged(WPARAM, LPARAM) void HistoryWindow::FontsChanged() { - if (bkBrush != NULL) + if (bkBrush != nullptr) DeleteObject(bkBrush); - if (bkFindBrush != NULL) + if (bkFindBrush != nullptr) DeleteObject(bkFindBrush); bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground)); @@ -281,8 +281,8 @@ void HistoryWindow::FontsChanged() LOGFONT font; ListView_SetTextColor(listWindow, Options::instance->GetFont(Options::GroupList, &font)); - InvalidateRect(listWindow, NULL, TRUE); - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(listWindow, nullptr, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); SelectEventGroup(selected); } @@ -359,7 +359,7 @@ void HistoryWindow::OptionsSearchingChanged() INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) { - HWND hWnd = NULL; + HWND hWnd = nullptr; int count = HistoryEventList::GetContactMessageNumber(hContact); if (!count) return FALSE; @@ -367,7 +367,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) for (auto it = windows.begin(); it != windows.end(); ++it) { if (!it->second->isDestroyed) { if (it->second->m_hContact == hContact) { - if (hWnd == NULL) { + if (hWnd == nullptr) { hWnd = it->second->m_hWnd; } else if (GetForegroundWindow() == it->second->m_hWnd) { @@ -380,7 +380,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) { if (!(*it)->isDestroyed) { if ((*it)->m_hContact == hContact) { - if (hWnd == NULL) + if (hWnd == nullptr) hWnd = (*it)->m_hWnd; else if (GetForegroundWindow() == (*it)->m_hWnd) hWnd = (*it)->m_hWnd; @@ -535,7 +535,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP DlgReturn(TRUE); case IDM_CONFIG: - Options_Open(NULL, LPGENW("History")); + Options_Open(nullptr, LPGENW("History")); DlgReturn(TRUE); case IDM_DELETE: @@ -576,7 +576,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP switch (pNmhdr->idFrom) { case IDC_LIST_CONTACTS: if (pNmhdr->code == CLN_LISTREBUILT) { - if (historyWindow != NULL) + if (historyWindow != nullptr) historyWindow->ReloadContacts(); DlgReturn(TRUE); @@ -646,7 +646,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg); HMENU hPopupMenu = CreatePopupMenu(); - if (hPopupMenu != NULL) { + if (hPopupMenu != nullptr) { if (chf.dwEffects & CFE_LINK) { AppendMenu(hPopupMenu, MF_STRING, IDM_OPENNEW, TranslateT("Open in &new window")); AppendMenu(hPopupMenu, MF_STRING, IDM_OPENEXISTING, TranslateT("&Open in existing window")); @@ -655,14 +655,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP else { AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message")); AppendMenu(hPopupMenu, MF_STRING, IDM_QUOTE, TranslateT("Reply &Quoted")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History")); } - int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0); + int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr); switch (selected) { case IDM_COPY: if (chrg.cpMax == chrg.cpMin && historyWindow->currentGroup.size() > 0) { @@ -831,14 +831,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP if (newSel >= 0) { HMENU hPopupMenu = CreatePopupMenu(); - if (hPopupMenu != NULL) { + if (hPopupMenu != nullptr) { AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); AppendMenu(hPopupMenu, MF_STRING, IDM_MESSAGE, TranslateT("Send Message")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History")); - int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, 0); + int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, clicked.x, clicked.y, 0, hwndDlg, nullptr); switch (selected) { case IDM_COPY: { @@ -1073,8 +1073,8 @@ void HistoryWindow::Initialise() SetDefFilter(Options::instance->defFilter); - InvalidateRect(listWindow, NULL, TRUE); - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(listWindow, nullptr, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); SendMessage(m_hWnd, DM_SETDEFID, IDM_FIND, 0); SendMessage(m_hWnd, WM_SIZE, 0, 0); SendMessage(m_hWnd, DM_HREBUILD, 0, 0); @@ -1306,7 +1306,7 @@ void HistoryWindow::SelectEventGroup(int sel) SendMessage(editWindow, EM_SETREADONLY, FALSE, 0); TextDocument->Freeze(&cnt); TextDocument->GetSelection(&TextSelection); - HDC hDC = GetDC(NULL); + HDC hDC = GetDC(nullptr); int caps = GetDeviceCaps(hDC, LOGPIXELSY); std::deque revDeq; std::deque &deq = m_eventList[sel]; @@ -1338,7 +1338,7 @@ void HistoryWindow::SelectEventGroup(int sel) ico = eventIcons[imId]; else { ico = GetEventCoreIcon(hDbEvent); - if (ico == NULL) + if (ico == nullptr) ico = eventIcons[imId]; } @@ -1429,7 +1429,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM { HWND hwndParent = GetParent(hwnd); HistoryWindow *dat = (HistoryWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); - if (dat == NULL) + if (dat == nullptr) return FALSE; switch (msg) { @@ -1462,7 +1462,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM case WM_LBUTTONUP: ReleaseCapture(); SendMessage(hwndParent, WM_SIZE, 0, 0); - RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwndParent, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); return 0; } @@ -1497,21 +1497,21 @@ void HistoryWindow::ReloadContacts() } for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { - if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) { + if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == nullptr || !db_mc_isSub(_hContact))) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); - if (hItem == NULL) + if (hItem == nullptr) SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0); } else { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); - if (hItem != NULL) + if (hItem != nullptr) SendMessage(contactList, CLM_DELETEITEM, (WPARAM)_hContact, 0); } } if (m_hContact != NULL) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, m_hContact, 0); - if (hItem != NULL) { + if (hItem != nullptr) { SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0); SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0); } @@ -1656,17 +1656,17 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc); MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2); HMENU hPopupMenu = CreatePopupMenu(); - if (hPopupMenu != NULL) { + if (hPopupMenu != nullptr) { AppendMenu(hPopupMenu, MF_STRING, IDM_FINDNEXT, TranslateT("Find Next")); AppendMenu(hPopupMenu, MF_STRING, IDM_FINDPREV, TranslateT("Find Previous")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); AppendMenu(hPopupMenu, searcher.IsMatchCase() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHCASE, TranslateT("Match Case")); AppendMenu(hPopupMenu, searcher.IsMatchWholeWords() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_MATCHWHOLE, TranslateT("Match Whole Word")); AppendMenu(hPopupMenu, searcher.IsOnlyIn() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYIN, TranslateT("Only Incoming Messages")); AppendMenu(hPopupMenu, searcher.IsOnlyOut() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYOUT, TranslateT("Only Outgoing Messages")); AppendMenu(hPopupMenu, searcher.IsOnlyGroup() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ONLYGROUP, TranslateT("Only Selected Group")); AppendMenu(hPopupMenu, searcher.IsAllUsers() ? MF_STRING | MF_CHECKED : MF_STRING, IDM_ALLUSERS, TranslateT("All Contacts")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); HMENU hFilterMenu = CreatePopupMenu(); int filter = GetFilterNr(); AppendMenu(hFilterMenu, filter == 0 ? MF_STRING | MF_CHECKED : MF_STRING, IDM_FILTERDEF, TranslateT("Default history events")); @@ -1684,7 +1684,7 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB) else SetMenuDefaultItem(hPopupMenu, IDM_FINDNEXT, FALSE); - int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0); + int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr); switch (iResult) { case IDM_FINDNEXT: searcher.ChangeFindDirection(false); @@ -1737,12 +1737,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc); MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2); HMENU hPopupMenu = CreatePopupMenu(); - if (hPopupMenu != NULL) { + if (hPopupMenu != nullptr) { AppendMenu(hPopupMenu, MF_STRING, IDM_OPTIONS, TranslateT("Options")); AppendMenu(hPopupMenu, MF_STRING, IDM_FONTS, TranslateT("Fonts and colors")); AppendMenu(hPopupMenu, MF_STRING, IDM_ICONS, TranslateT("Icons")); AppendMenu(hPopupMenu, MF_STRING, IDM_HOTKEYS, TranslateT("Hotkeys")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); HMENU hExportMenu = CreatePopupMenu(); AppendMenu(hExportMenu, MF_STRING, IDM_EXPORTRHTML, TranslateT("Rich Html")); @@ -1758,12 +1758,12 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB) AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hExportMenu, TranslateT("Export")); AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hImportMenu, TranslateT("Import")); - AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, NULL); + AppendMenu(hPopupMenu, MFT_SEPARATOR, 0, nullptr); AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOS, TranslateT("Save window position as default")); AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOSALL, TranslateT("Save window position for all contacts")); SetMenuDefaultItem(hPopupMenu, IDM_OPTIONS, FALSE); - int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0); + int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr); switch (iResult) { case IDM_OPTIONS: SendMessage(m_hWnd, WM_COMMAND, IDM_CONFIG, 0); @@ -1871,13 +1871,13 @@ void HistoryWindow::DeleteToolbarClicked(LPNMTOOLBAR lpnmTB) SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc); MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2); HMENU hPopupMenu = CreatePopupMenu(); - if (hPopupMenu != NULL) { + if (hPopupMenu != nullptr) { AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group")); AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History")); SetMenuDefaultItem(hPopupMenu, IDM_DELETE, FALSE); - int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0); + int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, nullptr); switch (iResult) { case IDM_DELETE: Delete(0); @@ -2016,7 +2016,7 @@ void HistoryWindow::FormatQuote(std::wstring "e, const MessageData &md, cons else quote += m_contactName; wchar_t str[32]; - TimeZone_PrintTimeStamp(NULL, md.timestamp, L"d t", str, 32, 0); + TimeZone_PrintTimeStamp(nullptr, md.timestamp, L"d t", str, 32, 0); quote += L", "; quote += str; quote += L"\n"; @@ -2090,7 +2090,7 @@ void HistoryWindow::SelectContact(MCONTACT hContact) HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS); if (hContact != NULL) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, hContact, 0); - if (hItem != NULL) { + if (hItem != nullptr) { SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0); SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0); } diff --git a/plugins/BasicHistory/src/ImageDataObject.cpp b/plugins/BasicHistory/src/ImageDataObject.cpp index d0cbc85843..481c91f8de 100644 --- a/plugins/BasicHistory/src/ImageDataObject.cpp +++ b/plugins/BasicHistory/src/ImageDataObject.cpp @@ -28,15 +28,15 @@ HBITMAP CacheIconToBMP(HICON hIcon, COLORREF backgroundColor, int sizeX, int siz rc.top = rc.left = 0; rc.right = sizeY; rc.bottom = sizeX; - HDC hdc = GetDC(0); + HDC hdc = GetDC(nullptr); HBITMAP hBmp = CreateCompatibleBitmap(hdc, sizeY, sizeX); HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); FillRect(hdcMem, &rc, hBkgBrush); - DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 0, 0, hIcon, sizeY, sizeX, 0, nullptr, DI_NORMAL); SelectObject(hdcMem, hoBmp); DeleteDC(hdcMem); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); DeleteObject(hBkgBrush); return hBmp; } @@ -72,8 +72,8 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) // Initialize a Storage Object // - LPLOCKBYTES lpLockBytes = NULL; - SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); + LPLOCKBYTES lpLockBytes = nullptr; + SCODE sc = ::CreateILockBytesOnHGlobal(nullptr, TRUE, &lpLockBytes); if (sc != S_OK) { pOleClientSite->Release(); return false; @@ -82,7 +82,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) IStorage *pStorage; sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage); if (sc != S_OK) { - lpLockBytes = NULL; + lpLockBytes = nullptr; pOleClientSite->Release(); return false; } @@ -90,7 +90,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) // IOleObject *pOleObject; pOleObject = pods->GetOleObject(pOleClientSite, pStorage); - if (pOleObject == NULL) { + if (pOleObject == nullptr) { pStorage->Release(); pOleClientSite->Release(); return false; @@ -142,11 +142,11 @@ void ImageDataObject::SetBitmap(HBITMAP hBitmap) STGMEDIUM stgm; stgm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle stgm.hBitmap = hBitmap; - stgm.pUnkForRelease = NULL; // Use ReleaseStgMedium + stgm.pUnkForRelease = nullptr; // Use ReleaseStgMedium FORMATETC fm; fm.cfFormat = CF_BITMAP; // Clipboard format = CF_BITMAP - fm.ptd = NULL; // Target Device = Screen + fm.ptd = nullptr; // Target Device = Screen fm.dwAspect = DVASPECT_CONTENT; // Level of detail = Full content fm.lindex = -1; // Index = Not applicaple fm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle @@ -160,6 +160,6 @@ IOleObject *ImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStora IOleObject *pOleObject; SCODE sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &m_format, pOleClientSite, pStorage, (void **)& pOleObject); if (sc != S_OK) - pOleObject = NULL; + pOleObject = nullptr; return pOleObject; } diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 61b0da8e06..cb54dcad5d 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -207,24 +207,24 @@ static ColorOptionsList g_ColorOptionsList[] = { static HotkeyOptionsList g_HotkeyOptionsList[] = { { "basichistory_hot_showall", LPGENW("Open global history"), LPGENW("History"), MS_HISTORY_SHOWCONTACTHISTORY, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'H') | HKF_MIRANDA_LOCAL, 0 }, - { "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), 0, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND }, - { "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), 0, VK_F3, HISTORY_HK_FINDNEXT }, - { "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), 0, VK_F2, HISTORY_HK_FINDPREV }, - { "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHCASE }, - { "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHWHOLE }, - { "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_SHOWCONTACTS }, - { "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYIN }, - { "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYOUT }, - { "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYGROUP }, - { "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_ALLCONTACTS }, - { "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), 0, VK_DELETE, HISTORY_HK_DELETE }, - { "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXRHTML }, - { "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXPHTML }, - { "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), 0, 0, HISTORY_HK_EXTXT }, - { "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), 0, 0, HISTORY_HK_EXBIN }, - { "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), 0, 0, HISTORY_HK_IMPBIN }, - { "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_EXDAT }, - { "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_IMPDAT }, + { "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND }, + { "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), nullptr, VK_F3, HISTORY_HK_FINDNEXT }, + { "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), nullptr, VK_F2, HISTORY_HK_FINDPREV }, + { "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHCASE }, + { "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), nullptr, 0, HISTORY_HK_MATCHWHOLE }, + { "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_SHOWCONTACTS }, + { "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYIN }, + { "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYOUT }, + { "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), nullptr, 0, HISTORY_HK_ONLYGROUP }, + { "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), nullptr, 0, HISTORY_HK_ALLCONTACTS }, + { "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), nullptr, VK_DELETE, HISTORY_HK_DELETE }, + { "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXRHTML }, + { "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXPHTML }, + { "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXTXT }, + { "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXBIN }, + { "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPBIN }, + { "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_EXDAT }, + { "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), nullptr, 0, HISTORY_HK_IMPDAT }, }; const int g_fontsSize = _countof(g_FontOptionsList); @@ -237,7 +237,7 @@ void Options::Load(void) { FontIDW fid = { 0 }; ColourIDW cid = { 0 }; - HOTKEYDESC hid = { 0 }; + HOTKEYDESC hid = {}; fid.cbSize = sizeof(FontIDW); cid.cbSize = sizeof(ColourIDW); strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); @@ -335,7 +335,7 @@ void Options::Load(void) while (eventsV.pszVal[k]) { if (eventsV.pszVal[k] == ';') { eventsV.pszVal[k] = 0; - fo.events.push_back(strtol(id, NULL, 16)); + fo.events.push_back(strtol(id, nullptr, 16)); id = eventsV.pszVal + k + 1; } @@ -729,7 +729,7 @@ int GetEventCB(HWND hwndCB, bool errorReport, int &eventId) if (selCpIdx < 0) { wchar_t text[24]; ComboBox_GetText(hwndCB, text, 24); - wchar_t * stopOn = NULL; + wchar_t * stopOn = nullptr; long cp = wcstol(text, &stopOn, 10); if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0)) { MessageBox(GetParent(hwndCB), TranslateT("Invalid event number"), TranslateT("Error"), MB_OK | MB_ICONERROR); @@ -1300,7 +1300,7 @@ unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int, const st name = str.substr(pos + 1); } - wchar_t * stopOn = NULL; + wchar_t * stopOn = nullptr; long cp = wcstol(text, &stopOn, 10); if ((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) { if (errorReport) { @@ -1569,7 +1569,7 @@ void SaveList(HWND hwnd, MCONTACT hSystem, TaskOptions* to) } } -bool IsValidTask(TaskOptions& to, std::list* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL); +bool IsValidTask(TaskOptions& to, std::list* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr); #ifndef LOCALE_SSHORTTIME #define LOCALE_SSHORTTIME 0x00000079 @@ -1808,7 +1808,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, break; } - toCp.lastExport = time(NULL); + toCp.lastExport = time(nullptr); *to = toCp; EndDialog(hwndDlg, IDOK); diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index 1f00085b7a..b3eb92f664 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -25,7 +25,7 @@ PlainHtmlExport::~PlainHtmlExport() { } -extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue >* positionMap = NULL); +extern std::wstring MakeTextHtmled(const std::wstring& message, std::queue >* positionMap = nullptr); extern std::wstring UrlHighlightHtml(const std::wstring& message, bool& isUrl); void PlainHtmlExport::WriteHeader(const std::wstring&, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string&, const std::wstring& encoding) diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 125aa51a5d..68ab4257b9 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -29,7 +29,7 @@ RichHtmlExport::~RichHtmlExport() extern HINSTANCE hInst; extern bool g_SmileyAddAvail; -std::wstring MakeTextHtmled(const std::wstring& message, std::queue >* positionMap = NULL) +std::wstring MakeTextHtmled(const std::wstring& message, std::queue >* positionMap = nullptr) { std::wstring ret; std::wstring search = L"&<>\t\r\n"; @@ -57,7 +57,7 @@ std::wstring MakeTextHtmled(const std::wstring& message, std::queuepush(std::pair(start + currentAdd, len)); @@ -123,12 +123,12 @@ std::wstring GetName(const std::wstring &path) void ExtractFile(short int iRes, const std::wstring &fileName) { HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES)); - if (rSrc != NULL) { + if (rSrc != nullptr) { HGLOBAL res = LoadResource(hInst, rSrc); int size = SizeofResource(hInst, rSrc); - if (res != NULL) { + if (res != nullptr) { char* resData = (char*)LockResource(res); - if (resData != NULL) { + if (resData != nullptr) { std::ofstream stream(fileName.c_str(), std::ios_base::binary); if (stream.is_open()) { stream.write(resData, size); @@ -196,13 +196,13 @@ void IcoSave(const std::wstring &fileName, HICON hicon) MYBITMAPINFO info1 = { 0 }; MYBITMAPINFO info2 = { 0 }; - HDC hDC = CreateCompatibleDC(NULL); + HDC hDC = CreateCompatibleDC(nullptr); info1.bmiHeader.biSize = sizeof(info1.bmiHeader); info1.bmiHeader.biWidth = bmiColor.bmWidth; info1.bmiHeader.biHeight = bmiColor.bmHeight; info1.bmiHeader.biPlanes = 1; info1.bmiHeader.biBitCount = bmiColor.bmBitsPixel; - unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info1, DIB_RGB_COLORS); + unsigned int size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info1, DIB_RGB_COLORS); char* bits1 = new char[info1.bmiHeader.biSizeImage]; size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, bits1, (BITMAPINFO*)&info1, DIB_RGB_COLORS); info2.bmiHeader.biSize = sizeof(info2.bmiHeader); @@ -210,7 +210,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon) info2.bmiHeader.biHeight = bmiMask.bmHeight; info2.bmiHeader.biPlanes = 1; info2.bmiHeader.biBitCount = bmiMask.bmBitsPixel; - size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, NULL, (BITMAPINFO*)&info2, DIB_RGB_COLORS); + size = GetDIBits(hDC, hbmColor, 0, info1.bmiHeader.biHeight, nullptr, (BITMAPINFO*)&info2, DIB_RGB_COLORS); char* bits2 = new char[info2.bmiHeader.biSizeImage]; size = GetDIBits(hDC, hbmMask, 0, info2.bmiHeader.biHeight, bits2, (BITMAPINFO*)&info2, DIB_RGB_COLORS); @@ -263,18 +263,18 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true) pszFrom[len + 1] = 0; SHFILEOPSTRUCT fileop; - fileop.hwnd = NULL; // no status display + fileop.hwnd = nullptr; // no status display fileop.wFunc = FO_DELETE; // delete operation fileop.pFrom = pszFrom; // source file name as double null terminated string - fileop.pTo = NULL; // no destination needed + fileop.pTo = nullptr; // no destination needed fileop.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; // do not prompt the user if (!noRecycleBin) fileop.fFlags |= FOF_ALLOWUNDO; fileop.fAnyOperationsAborted = FALSE; - fileop.lpszProgressTitle = NULL; - fileop.hNameMappings = NULL; + fileop.lpszProgressTitle = nullptr; + fileop.hNameMappings = nullptr; int ret = SHFileOperation(&fileop); delete[] pszFrom; @@ -287,7 +287,7 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin folder = RemoveExt(fileName) + L"_files"; folderName = GetName(folder); DeleteDirectory(folder.c_str()); - CreateDirectory(folder.c_str(), NULL); + CreateDirectory(folder.c_str(), nullptr); std::wstring css = folder + L"\\history.css"; BOOL cssCopied = FALSE; if (!Options::instance->extCssHtml2.empty()) @@ -410,14 +410,14 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, SMADD_BATCHPARSE2 sp = { 0 }; SMADD_BATCHPARSERES *spr; sp.cbSize = sizeof(sp); - sp.Protocolname = baseProto.length() == 0 ? NULL : baseProto.c_str(); + sp.Protocolname = baseProto.length() == 0 ? nullptr : baseProto.c_str(); sp.str = msgbuf; sp.flag = SAFL_TCHAR | SAFL_PATH | (isMe ? SAFL_OUTGOING : 0); spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp); delete[] msgbuf; // Did not find a simley - if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND) + if (spr == nullptr || (INT_PTR)spr == CALLSERVICE_NOTFOUND) return UrlHighlightHtml(MakeTextHtmled(msg), isUrl); std::queue > positionMap; @@ -457,7 +457,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, size_t size = endChar - startChar; - if (spr[i].filepath != NULL) { // For deffective smileypacks + if (spr[i].filepath != nullptr) { // For deffective smileypacks // Add text if (startChar - last_pos > 0) { smileyMsg += newMsg.substr(last_pos, startChar - last_pos); diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index f0adc1f203..2601eeacfa 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . extern HANDLE g_hMainThread; bool bPopupsEnabled; bool DoTask(TaskOptions& to); -bool IsValidTask(TaskOptions& to, std::list* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL); +bool IsValidTask(TaskOptions& to, std::list* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr); std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, std::map& existingContacts, bool replaceContact); std::wstring GetDirectoryName(const std::wstring &path); std::wstring GetName(const std::wstring &path); @@ -37,7 +37,7 @@ time_t GetNextExportTime(TaskOptions& to); void SchedulerThreadFunc(void*); volatile bool finishThread = false; bool initTask = false; -HANDLE hThread = NULL; +HANDLE hThread = nullptr; HANDLE hThreadEvent; time_t nextExportTime; void StartThread(bool init); @@ -99,15 +99,15 @@ int DoLastTask(WPARAM, LPARAM) bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err, std::wstring* errDescr) { if (to.taskName.empty()) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Name"); return false; } - if (top != NULL) { + if (top != nullptr) { for (std::list::iterator it = top->begin(); it != top->end(); ++it) { if (it->taskName == to.taskName) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Name"); return false; } @@ -115,9 +115,9 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err } if (!to.isSystem && to.contacts.size() == 0) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Contacts"); - if (errDescr != NULL) + if (errDescr != nullptr) *errDescr = TranslateT("At least one contact should be selected."); return false; } @@ -135,7 +135,7 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err } if (filter < 2) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Filter"); return false; } @@ -143,7 +143,7 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err to.filterId = filter; } else if (to.filterId < 0) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Filter"); return false; } @@ -153,63 +153,63 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err return true; if (!Options::FTPAvail() && to.useFtp) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Upload to FTP"); return false; } if (to.filePath.empty()) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Path to output file"); return false; } if (to.useFtp && to.ftpName.empty()) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Session name"); - if (errDescr != NULL) + if (errDescr != nullptr) *errDescr = TranslateT("To create session open WinSCP, click New Session, enter data and save with specific name. Remember if FTP server using password you should save it in WinSCP."); return false; } if (to.useFtp && (to.filePath.find('\\') < to.filePath.length() || to.filePath.find(':') < to.filePath.length() || to.filePath[0] != L'/')) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Path to file"); - if (errDescr != NULL) + if (errDescr != nullptr) *errDescr = TranslateT("FTP path must contain '/' instead '\\' and start with '/'."); return false; } if (isImportTask && to.filePath.find(L"") < to.filePath.length()) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Path to file"); - if (errDescr != NULL) + if (errDescr != nullptr) *errDescr = TranslateT("FTP path cannot contain in import task."); return false; } if (!isImportTask && (to.exportType < IExport::RichHtml || to.exportType > IExport::Dat)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Export to"); return false; } if (isImportTask && (to.importType < IImport::Binary || to.importType > IImport::Dat)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Import from"); return false; } if ((to.trigerType == TaskOptions::Daily || to.trigerType == TaskOptions::Weekly || to.trigerType == TaskOptions::Monthly) && (to.dayTime < 0 || to.dayTime >= 24 * 60)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Time"); return false; } if (to.trigerType == TaskOptions::Weekly && (to.dayOfWeek < 0 || to.dayOfWeek >= 7)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Day of week"); return false; } if (to.trigerType == TaskOptions::Monthly && (to.dayOfMonth <= 0 || to.dayOfMonth >= 32)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Day"); return false; } if ((to.trigerType == TaskOptions::DeltaMin || to.trigerType == TaskOptions::DeltaHour) && (to.deltaTime < 0 || to.deltaTime >= 10000)) { - if (err != NULL) + if (err != nullptr) *err = TranslateT("Delta time"); return false; } @@ -231,7 +231,7 @@ bool DoTask(TaskOptions& to) { std::wstring err; std::wstring errDescr; - if (!IsValidTask(to, NULL, &err, &errDescr)) { + if (!IsValidTask(to, nullptr, &err, &errDescr)) { wchar_t msg[256]; if (err.empty()) wcscpy_s(msg, TranslateT("Some value is invalid")); @@ -244,7 +244,7 @@ bool DoTask(TaskOptions& to) return true; } - DWORD now = time(NULL); + DWORD now = time(nullptr); long long int t = to.eventDeltaTime * 60; if (to.eventUnit > TaskOptions::Minute) t *= 60LL; @@ -260,20 +260,20 @@ bool DoTask(TaskOptions& to) std::list managers; if (to.type == TaskOptions::Delete) { if (to.isSystem) { - ExportManager *exp = new ExportManager(NULL, NULL, to.filterId); + ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId); exp->SetDeleteWithoutExportEvents(t, now); managers.push_back(exp); } for (size_t i = 0; i < to.contacts.size(); ++i) { - ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId); + ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId); exp->SetDeleteWithoutExportEvents(t, now); managers.push_back(exp); } } else if (to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge) { std::map existingContacts1; - ExportManager mExp = ExportManager(NULL, NULL, 1); + ExportManager mExp = ExportManager(nullptr, NULL, 1); std::wstring filePath = to.filePath; std::wstring dir; std::list files; @@ -292,7 +292,7 @@ bool DoTask(TaskOptions& to) dir = dir.substr(0, pos); DeleteDirectory(dir.c_str()); - CreateDirectory(dir.c_str(), NULL); + CreateDirectory(dir.c_str(), nullptr); } const wchar_t* ext = ExportManager::GetExt(to.importType); @@ -384,7 +384,7 @@ bool DoTask(TaskOptions& to) } else { std::vector messages; - if (mExp.Import(to.importType, messages, NULL)) { + if (mExp.Import(to.importType, messages, nullptr)) { mExp.MargeMessages(messages); contactList.push_back(mExp.m_hContact); } @@ -430,7 +430,7 @@ bool DoTask(TaskOptions& to) if (!to.useFtp && !to.compress) { dir = GetDirectoryName(filePath); if (!dir.empty()) - CreateDirectory(dir.c_str(), NULL); + CreateDirectory(dir.c_str(), nullptr); } else { filePath = GetName(filePath); @@ -446,11 +446,11 @@ bool DoTask(TaskOptions& to) dir = dir.substr(0, pos); DeleteDirectory(dir.c_str()); - CreateDirectory(dir.c_str(), NULL); + CreateDirectory(dir.c_str(), nullptr); filePath = dir + L"\\" + filePath; } if (to.isSystem) { - ExportManager *exp = new ExportManager(NULL, NULL, to.filterId); + ExportManager *exp = new ExportManager(nullptr, NULL, to.filterId); exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now); exp->m_useImportedMessages = to.exportImported; if (!exp->Export(to.exportType)) { @@ -472,7 +472,7 @@ bool DoTask(TaskOptions& to) if (!error) { for (size_t i = 0; i < to.contacts.size(); ++i) { - ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId); + ExportManager *exp = new ExportManager(nullptr, to.contacts[i], to.filterId); exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now); exp->m_useImportedMessages = to.exportImported; if (!exp->Export(to.exportType)) { @@ -503,7 +503,7 @@ bool DoTask(TaskOptions& to) if (!to.useFtp) { zipDir = GetDirectoryName(zipFilePath); if (!zipDir.empty()) - CreateDirectory(zipDir.c_str(), NULL); + CreateDirectory(zipDir.c_str(), nullptr); } else { zipFilePath = GetName(zipFilePath); @@ -514,7 +514,7 @@ bool DoTask(TaskOptions& to) zipDir += L"zip"; zipDir = GetFileName(zipDir, L"", existingContacts, true); DeleteDirectory(zipDir.c_str()); - CreateDirectory(zipDir.c_str(), NULL); + CreateDirectory(zipDir.c_str(), nullptr); zipFilePath = zipDir + L"\\" + zipFilePath; } error = ZipFiles(dir + L"\\", zipFilePath, to.zipPassword); @@ -715,7 +715,7 @@ void SchedulerThreadFunc(void*) while (!finishThread) { DWORD timeWait; - time_t now = time(NULL); + time_t now = time(nullptr); while (nextExportTime <= now) if (!ExecuteCurrentTask(now)) return; @@ -732,25 +732,25 @@ void StartThread(bool init) StopThread(); initTask = false; - bool isExport = GetNextExportTime(init, time(NULL)); + bool isExport = GetNextExportTime(init, time(nullptr)); if (isExport) { finishThread = false; - hThreadEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - hThread = mir_forkthread(SchedulerThreadFunc, NULL); + hThreadEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + hThread = mir_forkthread(SchedulerThreadFunc, nullptr); } } void StopThread() { - if (hThread == NULL) + if (hThread == nullptr) return; finishThread = true; SetEvent(hThreadEvent); WaitForSingleObject(hThread, INFINITE); CloseHandle(hThreadEvent); - hThread = NULL; - hThreadEvent = NULL; + hThread = nullptr; + hThreadEvent = nullptr; } bool GetNextExportTime(bool init, time_t now) @@ -791,7 +791,7 @@ bool GetNextExportTime(bool init, time_t now) static void CALLBACK DoTaskFinishInMainAPCFunc(ULONG_PTR dwParam) { wchar_t *item = (wchar_t*)dwParam; - MessageBox(NULL, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION); + MessageBox(nullptr, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION); delete[] item; } @@ -803,7 +803,7 @@ bool ExecuteCurrentTask(time_t now) mir_cslock lck(Options::instance->criticalSection); for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) { if (it->forceExecute) { - it->lastExport = time(NULL); + it->lastExport = time(nullptr); Options::instance->SaveTaskTime(*it); to = *it; isExport = true; @@ -812,7 +812,7 @@ bool ExecuteCurrentTask(time_t now) else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) { time_t t = GetNextExportTime(*it); if (t <= now) { - it->lastExport = time(NULL); + it->lastExport = time(nullptr); Options::instance->SaveTaskTime(*it); to = *it; isExport = true; @@ -869,11 +869,11 @@ bool GetFileCrc(const wchar_t *filenameinzip, unsigned char *buf, unsigned long, { unsigned long calculate_crc = 0; bool error = true; - HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile != INVALID_HANDLE_VALUE) { DWORD readed; do { - if (!ReadFile(hFile, buf, 1024, &readed, NULL)) { + if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) { error = false; break; } @@ -900,8 +900,8 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri fill_win32_filefunc(&pzlib_filefunc_def); zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true); zipFilePath = ReplaceExt(zipFilePath, L"zip"); - zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, NULL, &pzlib_filefunc_def); - if (zf != NULL) { + zipFile zf = zipOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), APPEND_STATUS_CREATE, nullptr, &pzlib_filefunc_def); + if (zf != nullptr) { unsigned char buf[1024]; char bufF[MAX_PATH + 20]; while (files.size() > 0) { @@ -915,15 +915,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri } BOOL badChar; - WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, &badChar); + WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, &badChar); int flag = 0; if (badChar) { flag = 0x800; // UTF - WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, nullptr, nullptr); } unsigned long calculate_crc = 0; - const char* passwordCh = NULL; + const char* passwordCh = nullptr; if (password.size() > 0) { if (!GetFileCrc(localDir.c_str(), buf, 1024, &calculate_crc)) { error = true; @@ -933,15 +933,15 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri passwordCh = password.c_str(); } - int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, + int err = zipOpenNewFileInZip4_64(zf, bufF, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, passwordCh, calculate_crc, 0, flag, 0); if (err == ZIP_OK) { - HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile != INVALID_HANDLE_VALUE) { DWORD readed; do { err = ZIP_OK; - if (!ReadFile(hFile, buf, 1024, &readed, NULL)) { + if (!ReadFile(hFile, buf, 1024, &readed, nullptr)) { error = true; break; } @@ -965,7 +965,7 @@ bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::stri files.pop_front(); } - zipClose(zf, NULL); + zipClose(zf, nullptr); } else error = true; } @@ -984,14 +984,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s zipFilePath = GetFileName(zipFilePath, L"", existingContacts, true); zipFilePath = ReplaceExt(zipFilePath, L"zip"); unzFile zf = unzOpen2((LPCSTR)(LPTSTR)zipFilePath.c_str(), &pzlib_filefunc_def); - if (zf == NULL) + if (zf == nullptr) return true; char buf[8192]; char bufF[MAX_PATH + 20]; unz_file_info file_info; do { - int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, NULL, 0); + int err = unzGetCurrentFileInfo(zf, &file_info, bufF, MAX_PATH + 20, buf, 8192, nullptr, 0); if (err == UNZ_OK) { UINT cp = CP_OEMCP; if (file_info.flag & 0x800)// UTF @@ -1019,7 +1019,7 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s } int sizeC = (int)mir_strlen(bufF); - int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, NULL, 0); + int sizeW = MultiByteToWideChar(cp, 0, bufF, sizeC, nullptr, 0); fileNameInZip.resize(sizeW); MultiByteToWideChar(cp, 0, bufF, sizeC, (wchar_t*)fileNameInZip.c_str(), sizeW); fileNameInZip = dir + L"\\" + fileNameInZip; @@ -1030,14 +1030,14 @@ bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::s if (file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY) CreatePath(fileNameInZip.c_str()); else { - const char* passwordCh = NULL; + const char* passwordCh = nullptr; if (password.size() > 0) passwordCh = password.c_str(); err = unzOpenCurrentFilePassword(zf, passwordCh); if (err == UNZ_OK) { CreatePath(GetDirectoryName(fileNameInZip).c_str()); - HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL); + HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, 0, nullptr); if (hFile != INVALID_HANDLE_VALUE) { DWORD writed; for (;;) { @@ -1116,7 +1116,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: stream.close(); std::wstring &log = Options::instance->ftpLogPath; - CreateDirectory(GetDirectoryName(log).c_str(), NULL); + CreateDirectory(GetDirectoryName(log).c_str(), nullptr); DeleteFile(log.c_str()); wchar_t cmdLine[MAX_PATH]; @@ -1126,7 +1126,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: startupInfo.cb = sizeof(STARTUPINFO); PROCESS_INFORMATION processInfo; - if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) { + if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) { WaitForSingleObject(processInfo.hProcess, INFINITE); CloseHandle(processInfo.hThread); CloseHandle(processInfo.hProcess); @@ -1208,14 +1208,14 @@ bool FtpGetFiles(const std::wstring& dir, const std::list& files, stream.close(); std::wstring &log = Options::instance->ftpLogPath; - CreateDirectory(GetDirectoryName(log).c_str(), NULL); + CreateDirectory(GetDirectoryName(log).c_str(), nullptr); DeleteFile(log.c_str()); wchar_t cmdLine[MAX_PATH]; mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); STARTUPINFO startupInfo = { 0 }; PROCESS_INFORMATION processInfo; startupInfo.cb = sizeof(STARTUPINFO); - if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) { + if (CreateProcess(nullptr, cmdLine, nullptr, nullptr, FALSE, 0, nullptr, dir.c_str(), &startupInfo, &processInfo)) { WaitForSingleObject(processInfo.hProcess, INFINITE); CloseHandle(processInfo.hThread); CloseHandle(processInfo.hProcess); @@ -1246,14 +1246,14 @@ void CreatePath(const wchar_t *szDir) return; pszLastBackslash = wcsrchr(szTestDir, '\\'); - if (pszLastBackslash == NULL) + if (pszLastBackslash == nullptr) return; *pszLastBackslash = '\0'; CreatePath(szTestDir); *pszLastBackslash = '\\'; - CreateDirectory(szTestDir, NULL); + CreateDirectory(szTestDir, nullptr); } INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM) @@ -1283,13 +1283,13 @@ void DoError(const TaskOptions& to, const std::wstring _error) DBEVENTINFO dbei = {}; dbei.szModule = MODULE; dbei.flags = DBEF_UTF | DBEF_READ; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); // For now I do not convert event data from string to blob, and event type must be message to handle it properly dbei.eventType = EVENTTYPE_MESSAGE; int len = (int)error.length() + 1; - dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, NULL, 0, NULL, NULL); + dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, nullptr, 0, nullptr, nullptr); char* buf = new char[dbei.cbBlob]; - dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, NULL, NULL); + dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, nullptr, nullptr); dbei.pBlob = (PBYTE)buf; db_event_add(NULL, &dbei); } diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index e47007893b..092d927adb 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -27,7 +27,7 @@ Searcher::Searcher() matchWholeWords(false), onlyIn(false), onlyOut(false), - context(NULL) + context(nullptr) { } diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index cfee26fbf0..59ca243b41 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -102,7 +102,7 @@ void Mind::Load(wstring filename) file.open(filename.c_str(), ios_base::in | ios_base::binary); wstring s1, st; - wchar_t *c, *co = NULL; + wchar_t *c, *co = nullptr; size_t count; int error = 0; int line = 1; diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index f45a362dd8..ea9b89d215 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -37,7 +37,7 @@ typedef struct _QueueElement { ActionHandler Handler; bool Sticky; int TimeOffset; - _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = NULL, bool sticky = false) + _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = nullptr, bool sticky = false) :hContact(contact), Handler(handler), TimeOffset(timeOffset), inf(info), Sticky(sticky) { } @@ -66,9 +66,9 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) void UpdateTimer() { if (timerID) - KillTimer(NULL, timerID); + KillTimer(nullptr, timerID); if (actionQueue.size()) - timerID = SetTimer(NULL, 0, actionQueue.front().TimeOffset, TimerProc); + timerID = SetTimer(nullptr, 0, actionQueue.front().TimeOffset, TimerProc); else timerID = 0; } @@ -94,7 +94,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = BOLTUN_NAME; - dbei.timestamp = (DWORD)time(NULL); + dbei.timestamp = (DWORD)time(nullptr); db_event_add(hContact, &dbei); bot->AnswerGiven(hContact, *info); @@ -148,7 +148,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = if (!actionQueue.empty() && actionQueue.front().hContact == hContact) { needTimerRearrange = true; - KillTimer(NULL, timerID); + KillTimer(nullptr, timerID); } if (!actionQueue.empty()) { @@ -184,7 +184,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = if (actionQueue.empty()) needTimerRearrange = true; if (thinkTime) - actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, NULL, sticky)); + actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, nullptr, sticky)); actionQueue.push_back(QueueElement(hContact, TimerAnswer, waitTime, info, sticky)); if (needTimerRearrange) UpdateTimer(); diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 920d325940..0c9e889d7b 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -22,7 +22,7 @@ int hLangpack; -TalkBot* bot = NULL; +TalkBot* bot = nullptr; #define MAX_WARN_TEXT 1024 #define MAX_MIND_FILE 1024 @@ -80,7 +80,7 @@ wchar_t* GetFullName(const wchar_t *filename) static bool LoadMind(const wchar_t* filename, int &line) { wchar_t* fullname = GetFullName(filename); - HCURSOR newCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)); + HCURSOR newCur = LoadCursor(nullptr, MAKEINTRESOURCE(IDC_WAIT)); HCURSOR oldCur = SetCursor(newCur); #ifdef DEBUG_LOAD_TIME unsigned __int64 t = __rdtsc(); @@ -207,7 +207,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) return 0; dbei.pBlob = (PBYTE)malloc(dbei.cbBlob); - if (dbei.pBlob == NULL) + if (dbei.pBlob == nullptr) return 0; db_event_get(hDbEvent, &dbei); @@ -402,7 +402,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (!bTranslated) { wchar_t message[5000]; mir_snwprintf(message, TranslateW(FAILED_TO_LOAD_BASE), line, c); - MessageBox(NULL, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK); + MessageBox(nullptr, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK); } } break; @@ -508,14 +508,14 @@ static int MessagePrebuild(WPARAM hContact, LPARAM) } else { if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE)) - Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED); + Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED); else - Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0); + Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0); if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE)) - Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED); + Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED); else - Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0); + Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0); } return 0; } @@ -559,7 +559,7 @@ extern "C" int __declspec(dllexport) Load(void) SET_UID(mi, 0x9e0117f3, 0xb7df, 0x4f1b, 0xae, 0xec, 0xc4, 0x72, 0x59, 0x72, 0xc8, 0x58); mi.flags = CMIF_NOTOFFLINE; mi.position = -50010000; //TODO: check the warning - mi.hIcolibItem = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RECVMSG)); + mi.hIcolibItem = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_RECVMSG)); mi.name.a = BOLTUN_START_CHATTING; mi.pszService = SERV_CONTACT_START_CHATTING; hMenuItemStartChatting = Menu_AddContactMenuItem(&mi); @@ -570,7 +570,7 @@ extern "C" int __declspec(dllexport) Load(void) if (!blInit) { wchar_t path[2000]; mir_snwprintf(path, TranslateW(FAILED_TO_LOAD_BASE), line, (const wchar_t*)Config.MindFileName); - MessageBox(NULL, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK); + MessageBox(nullptr, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK); } return 0; } @@ -578,7 +578,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { if (pTimer) - KillTimer(NULL, pTimer); + KillTimer(nullptr, pTimer); if (blInit) { #if 0 //No need to save, we don't have studying algorithm if (Config.MindFileName && !SaveMind(Config.MindFileName)) { diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index df57ea1998..9d7df65878 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -75,7 +75,7 @@ static BOOL IsAeroMode() INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static DWORD dwOldIcon = 0; - HICON hIcon = 0; + HICON hIcon = nullptr; UINT uid; switch (uMsg){ @@ -91,13 +91,13 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam SetWindowLongPtr(hDlg, GWL_EXSTYLE, GetWindowLongPtr(hDlg, GWL_EXSTYLE) | WS_EX_TOOLWINDOW); RECT rect; GetClientRect(hDlg, &rect); - SetWindowPos(hDlg, 0, 0, 0, rect.right, rect.bottom + GetSystemMetrics(SM_CYCAPTION), SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(hDlg, nullptr, 0, 0, rect.right, rect.bottom + GetSystemMetrics(SM_CYCAPTION), SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER); } SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon); TranslateDialogDefault(hDlg); - oldLangID = 0; - SetTimer(hDlg, 1, 200, NULL); + oldLangID = nullptr; + SetTimer(hDlg, 1, 200, nullptr); oldLayout = GetKeyboardLayout(0); if (MAKELCID(LOWORD(oldLayout) & 0xffffffff, SORT_DEFAULT) != (LCID)0x00000409) @@ -240,7 +240,7 @@ static int BackAllProtoStatuses(void) if (oldStatusMsg[i]) { mir_free(oldStatusMsg[i]); - oldStatusMsg[i] = 0; + oldStatusMsg[i] = nullptr; } oldStatus[i] = 0; } @@ -320,7 +320,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara DBVARIANT dbVar; if (g_wMask & OPT_USEDEFMSG || db_get_ws(NULL, MOD_NAME, "statmsg", &dbVar)) { - wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, 0); + wchar_t *ptszDefMsg = GetDefStatusMsg(uMode, nullptr); ChangeAllProtoStatuses(uMode, ptszDefMsg); mir_free(ptszDefMsg); } @@ -328,7 +328,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara { if (ServiceExists(MS_VARS_FORMATSTRING)) { - wchar_t *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0); + wchar_t *ptszParsed = variables_parse(dbVar.ptszVal, nullptr, 0); ChangeAllProtoStatuses(uMode, ptszParsed); mir_free(ptszParsed); } @@ -391,7 +391,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara BackAllProtoStatuses(); HWND_ITEM *pCurWnd = g_pMirWnds; - while (pCurWnd != NULL) + while (pCurWnd != nullptr) { HWND_ITEM *pNextWnd = pCurWnd->next; wchar_t szTemp[32]; @@ -403,12 +403,12 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara delete pCurWnd; // bye-bye pCurWnd = pNextWnd; // traverse to next item } - g_pMirWnds = NULL; + g_pMirWnds = nullptr; if (hOldForegroundWindow) { SetForegroundWindow(hOldForegroundWindow); - hOldForegroundWindow = NULL; + hOldForegroundWindow = nullptr; } RestoreOldSettings(); @@ -420,7 +420,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara // force a redraw // should prevent drawing problems - InvalidateRect(pcli->hwndContactList, NULL, true); + InvalidateRect(pcli->hwndContactList, nullptr, true); UpdateWindow(pcli->hwndContactList); PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE @@ -544,12 +544,12 @@ void BossKeyMenuItemInit(void) // Add menu item void BossKeyMenuItemUnInit(void) // Remove menu item { Menu_RemoveItem(g_hMenuItem); - g_hMenuItem = 0; + g_hMenuItem = nullptr; } void RegisterCoreHotKeys(void) { - HOTKEYDESC hotkey = { 0 }; + HOTKEYDESC hotkey = {}; hotkey.pszName = "Hide/Show Miranda"; hotkey.szDescription.a = LPGEN("Hide/Show Miranda"); hotkey.szSection.a = "BossKey"; @@ -561,7 +561,7 @@ void RegisterCoreHotKeys(void) static int TopToolbarInit(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszService = MS_BOSSKEY_HIDE; ttb.pszTooltipUp = ttb.name = LPGEN("Hide Miranda NG"); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; @@ -596,9 +596,9 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM) static wchar_t* VariablesBossKey(ARGUMENTSINFO *ai) { if (ai->cbSize < sizeof(ARGUMENTSINFO)) - return NULL; + return nullptr; if (ai->argc != 1) - return NULL; + return nullptr; ai->flags |= AIF_DONTPARSE; return GetBossKeyText(); @@ -616,7 +616,7 @@ static int EnumProtos(WPARAM, LPARAM) for (int i = 0; i < protoCount; i++) { oldStatus[i] = 0; - oldStatusMsg[i] = 0; + oldStatusMsg[i] = nullptr; } return 0; } @@ -627,7 +627,7 @@ int MirandaLoaded(WPARAM, LPARAM) RegisterCoreHotKeys(); - g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, NULL, WinEventProc, GetCurrentProcessId(), 0, 0); + g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, nullptr, WinEventProc, GetCurrentProcessId(), 0, 0); HookEvent(ME_TTB_MODULELOADED, TopToolbarInit); HookEvent(ME_OPT_INITIALISE, OptsDlgInit); @@ -647,7 +647,7 @@ int MirandaLoaded(WPARAM, LPARAM) if (RegisterClass(&winclass)) { - g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, NULL, g_hInstance, NULL); + g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_hInstance, nullptr); WTSRegisterSessionNotification(g_hListenWindow, 0); } @@ -717,7 +717,7 @@ extern "C" int __declspec(dllexport) Unload(void) { UninitIdleTimer(); - if (g_hWinHook != 0) + if (g_hWinHook != nullptr) UnhookWinEvent(g_hWinHook); if (g_hListenWindow) @@ -731,7 +731,7 @@ extern "C" int __declspec(dllexport) Unload(void) // free all sessions HWND_ITEM *pTemp = g_pMirWnds; - while (pTemp != NULL) + while (pTemp != nullptr) { HWND_ITEM *pNext = pTemp->next; delete pTemp; diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index 5c319ced6d..2bcb7fc61a 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -55,10 +55,10 @@ VOID CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD) void InitIdleTimer() { minutes = db_get_b(NULL, MOD_NAME, "time", 10); - hTimer = SetTimer(NULL, 0, 2000, IdleTimer); + hTimer = SetTimer(nullptr, 0, 2000, IdleTimer); } void UninitIdleTimer() { - KillTimer(NULL, hTimer); + KillTimer(nullptr, hTimer); } diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 1c9bce5ce4..3ce73335eb 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -115,7 +115,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam BYTE bSelection = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0); WORD wMode = STATUS_ARR_TO_ID[bSelection]; if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) { - wchar_t *ptszDefMsg = GetDefStatusMsg(wMode, 0); + wchar_t *ptszDefMsg = GetDefStatusMsg(wMode, nullptr); SetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, ptszDefMsg); if (ptszDefMsg) mir_free(ptszDefMsg); @@ -179,7 +179,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam return true; case IDC_MAINOPT_VARHELP: - variables_showhelp(hwndDlg, IDC_MAINOPT_STATMSG, VHF_INPUT | VHF_HELP, 0, 0); + variables_showhelp(hwndDlg, IDC_MAINOPT_STATMSG, VHF_INPUT | VHF_HELP, nullptr, nullptr); SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); return true; @@ -246,11 +246,11 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_RESTORE) == BST_CHECKED) wMaskAdv |= OPT_RESTORE; if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_MENUITEM) == BST_CHECKED) { - if (g_hMenuItem == 0) + if (g_hMenuItem == nullptr) BossKeyMenuItemInit(); wMaskAdv |= OPT_MENUITEM; } - else if (g_hMenuItem != 0) + else if (g_hMenuItem != nullptr) BossKeyMenuItemUnInit(); wchar_t szMinutes[4] = { 0 }; diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 0814711a6e..d8b1ef3749 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -74,7 +74,7 @@ time_t getLastSeen(MCONTACT hContact) void setLastSeen(MCONTACT hContact) { - db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL)); + db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(nullptr)); if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0)) db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0); } @@ -214,7 +214,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) { time_t lastSeen = getLastSeen(hContact); time_t lastInputMsg = getLastInputMsg(hContact); - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); int daysSinceOnline = -1; if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen) / (60 * 60 * 24)); @@ -271,7 +271,7 @@ void ReturnNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore; } ppd.PluginWindowProc = PopupDlgProc; - ppd.PluginData = NULL; + ppd.PluginData = nullptr; ppd.iSeconds = options.iPopupDelay; PUAddPopupT(&ppd); } @@ -308,7 +308,7 @@ void GoneNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore; } ppd.PluginWindowProc = PopupDlgProcNoSet; - ppd.PluginData = NULL; + ppd.PluginData = nullptr; ppd.iSeconds = options.iPopupDelay; PUAddPopupT(&ppd); @@ -463,7 +463,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0; char *proto = GetContactProto(hContact); - if (proto == 0 || (db_get_b(hContact, proto, "ChatRoom", 0) == 1) + if (proto == nullptr || (db_get_b(hContact, proto, "ChatRoom", 0) == 1) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)) return 0; @@ -491,7 +491,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) ppd.colorText = options.iPopupColorFore; } ppd.PluginWindowProc = MissYouPopupDlgProc; - ppd.PluginData = NULL; + ppd.PluginData = nullptr; ppd.iSeconds = -1; missyouactions[0].flags = PAF_ENABLED; @@ -579,7 +579,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) int ModulesLoaded2(WPARAM, LPARAM) { // check for 'still absent' contacts on startup - TimerProc(0, 0, 0, 0); + TimerProc(nullptr, 0, 0, 0); return 0; } @@ -597,7 +597,7 @@ int ModulesLoaded(WPARAM, LPARAM) Skin_AddSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event")); Skin_AddSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event")); - timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours + timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2); @@ -641,7 +641,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) int ContactAdded(WPARAM hContact, LPARAM) { - db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(0)); + db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(nullptr)); return 0; } @@ -671,7 +671,7 @@ extern "C" int __declspec(dllexport) Load(void) // ensure all contacts are timestamped DBVARIANT dbv; - DWORD current_time = (DWORD)time(0); + DWORD current_time = (DWORD)time(nullptr); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (!db_get(hContact, MODULE_NAME, "CreationTime", &dbv)) @@ -693,7 +693,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - KillTimer(0, timer_id); + KillTimer(nullptr, timer_id); return 0; } diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 158e328583..d431c5af96 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -203,7 +203,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (nmhdr->code) { case PSN_APPLY: //iAbsencePeriod - int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE); + int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, nullptr, FALSE); switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_GETCURSEL, 0, 0)) { case 1: options.iAbsencePeriod = 7 * num; break; case 2: options.iAbsencePeriod = 30 * num; break; @@ -212,7 +212,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, } //iAbsencePeriod2 - num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE); + num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, nullptr, FALSE); switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD2, CB_GETCURSEL, 0, 0)) { case 1: options.iAbsencePeriod2 = 7 * num; break; case 2: options.iAbsencePeriod2 = 30 * num; break; @@ -221,7 +221,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, } //iSilencePeriod - num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE); + num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, nullptr, FALSE); switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD3, CB_GETCURSEL, 0, 0)) { case 1: options.iSilencePeriod = 7 * num; break; case 2: options.iSilencePeriod = 30 * num; break; @@ -251,9 +251,9 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0); // restart timer & run check - KillTimer(0, timer_id); - timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours - TimerProc(0, 0, 0, 0); + KillTimer(nullptr, timer_id); + timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours + TimerProc(nullptr, 0, 0, 0); return TRUE; } break; @@ -317,7 +317,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP memset(&ppd, 0, sizeof(ppd)); //iPopupDelay - options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE); + options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE); if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED) options.iPopupDelay = -1; else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED) @@ -341,7 +341,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0); ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0); } - ppd.PluginData = NULL; + ppd.PluginData = nullptr; ppd.iSeconds = options.iPopupDelay; CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NO_HISTORY); @@ -409,7 +409,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP } //iPopupDelay - options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE); + options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE); if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED) options.iPopupDelay = -1; else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED) @@ -502,7 +502,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lparam)->lParam; if (hContact) { - db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE)); + db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, nullptr, FALSE)); db_set_b(hContact, MODULE_NAME, "MissYou", (IsDlgButtonChecked(hdlg, IDC_CHECK_MISSYOU) == BST_CHECKED) ? 1 : 0); db_set_b(hContact, MODULE_NAME, "MissYouNotifyAlways", (IsDlgButtonChecked(hdlg, IDC_CHECK_NOTIFYALWAYS) == BST_CHECKED) ? 1 : 0); db_set_b(hContact, MODULE_NAME, "NeverHide", (IsDlgButtonChecked(hdlg, IDC_CHECK_NEVERHIDE) == BST_CHECKED) ? 1 : 0); diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index ed2d9f0a85..024d51f8ad 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -105,12 +105,12 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!mir_wstrcmp(type, L"Any")) { if (LOWORD(wParam) == IDOK) db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", flag); - wi->SendIfMy = 0; + wi->SendIfMy = nullptr; } else { if (LOWORD(wParam) == IDOK) db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", flag); - wi->SendWhenThey = 0; + wi->SendWhenThey = nullptr; } DestroyWindow(hwnd); } @@ -129,7 +129,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta return; } else { - hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), 0, StatusModesDlgProc, (LPARAM)wi); + hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), nullptr, StatusModesDlgProc, (LPARAM)wi); statusFlag = db_get_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0); SetWindowText(hwnd, TranslateT("Send If My Status Is")); SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("Any")); @@ -150,7 +150,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta return; } else { - hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),0,StatusModesDlgProc, (LPARAM)wi); + hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),nullptr,StatusModesDlgProc, (LPARAM)wi); statusFlag = db_get_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0); SetWindowText(hwnd, TranslateT("Send If Their Status changes")); SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("From Offline")); @@ -231,7 +231,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L // fall through case IDCANCEL: if (LOWORD(wParam) == IDC_ADVANCED) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), 0, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA)); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA)); DestroyWindow(hwnd); } break; @@ -253,8 +253,8 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM DestroyWindow(hwnd); } wi->hContact = lParam; - wi->SendIfMy = 0; - wi->SendWhenThey = 0; + wi->SendIfMy = nullptr; + wi->SendWhenThey = nullptr; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi); getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact); @@ -296,7 +296,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM saveLastSetting(hContact, hwnd); } // fall through if (LOWORD(wParam) == IDC_SIMPLE) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), 0, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact); // fall through case IDCANCEL: @@ -385,8 +385,8 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, { windowInfo *wi = (windowInfo *)mir_alloc(sizeof(windowInfo)); wi->hContact = 0; - wi->SendIfMy = 0; - wi->SendWhenThey = 0; + wi->SendIfMy = nullptr; + wi->SendWhenThey = nullptr; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi); getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact); @@ -517,7 +517,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP db_free(&dbv); } } - SetTimer(hwnd,1,1000,NULL); + SetTimer(hwnd,1,1000,nullptr); SendMessage(hwnd,WM_TIMER,0,0); break; @@ -598,7 +598,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess) { - HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact); + HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, PounceSentDlgProc, hContact); wchar_t msg[256]; if (SentSuccess) { mir_snwprintf(msg, TranslateT("Message successfully sent to %s"), pcli->pfnGetContactDisplayName(hContact, 0)); diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index ca460f733b..250e76658f 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -64,7 +64,7 @@ int MsgAck(WPARAM, LPARAM lParam) CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS); if (ack->result == ACKRESULT_SUCCESS) { // wrtie it to the DB - DBEVENTINFO dbei = { 0 }; + DBEVENTINFO dbei = {}; DBVARIANT dbv; int reuse = db_get_b(ack->hContact,modname, "Reuse", 0); if (!db_get_ws(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) { @@ -72,7 +72,7 @@ int MsgAck(WPARAM, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT; dbei.szModule = (char*)ack->szModule; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; dbei.pBlob = (PBYTE)(char*)pszUtf; db_event_add(ack->hContact, &dbei); @@ -133,7 +133,7 @@ int statusCheck(int statusFlag, int status) } int CheckDate(MCONTACT hContact) { - time_t curtime = time (NULL); + time_t curtime = time (nullptr); if(!db_get_b(hContact,modname,"GiveUpDays",0)) return 1; if(db_get_b(hContact,modname,"GiveUpDays",0) && ( abs((time_t)db_get_dw(hContact,modname,"GiveUpDate",0)) > curtime)) @@ -171,7 +171,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) wchar_t *message = mir_wstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc spdps->hContact = hContact; spdps->message = message; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, SendPounceDlgProc, (LPARAM)spdps); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, SendPounceDlgProc, (LPARAM)spdps); // set the confirmation window to send the msg when the timeout is done mir_free(message); } @@ -188,9 +188,9 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM) { if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b(hContact, modname, "UseAdvanced", 0)) - CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),0,BuddyPounceDlgProc, hContact); + CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),nullptr,BuddyPounceDlgProc, hContact); else - CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),0,BuddyPounceSimpleDlgProc, hContact); + CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),nullptr,BuddyPounceSimpleDlgProc, hContact); return 0; } diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 24621383e2..10cfefe065 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -127,7 +127,7 @@ extern "C" __declspec(dllexport) int Load() wchar_t tszFile[MAX_PATH]; GetModuleFileName(g_hInst, tszFile, MAX_PATH); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.defaultFile.w = tszFile; sid.flags = SIDF_ALL_UNICODE; sid.section.w = MODULENAME; @@ -179,7 +179,7 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) return; PROTOACCOUNT* pdescr = Proto_GetAccount(szAccName); - if (pdescr == NULL) + if (pdescr == nullptr) return; if (!ProtoServiceExists(szAccName, PS_SETCUSTOMSTATUSEX)) @@ -195,10 +195,10 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) ics.ptszName = L""; ics.ptszMessage = L""; } - else if (code == IDOK && item != NULL) { + else if (code == IDOK && item != nullptr) { statusToSet = item->m_iIcon + 1; - ics.ptszName = variables_parsedup(item->m_tszTitle, NULL, NULL); - ics.ptszMessage = variables_parsedup(item->m_tszMessage, NULL, NULL); + ics.ptszName = variables_parsedup(item->m_tszTitle, nullptr, NULL); + ics.ptszMessage = variables_parsedup(item->m_tszMessage, nullptr, NULL); } else return; @@ -218,18 +218,18 @@ INT_PTR showList(WPARAM, LPARAM, LPARAM param) } } - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CSLIST), NULL, CSWindowProc, (LPARAM)new CSWindow(szProto)); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CSLIST), nullptr, CSWindowProc, (LPARAM)new CSWindow(szProto)); return 0; } void addProtoStatusMenuItem(char *protoName) { PROTOACCOUNT *pdescr = Proto_GetAccount(protoName); - if (pdescr == NULL || pdescr->ppro == NULL) + if (pdescr == nullptr || pdescr->ppro == nullptr) return; HGENMENU hRoot = Menu_GetProtocolRoot(pdescr->ppro); - if (hRoot == NULL) + if (hRoot == nullptr) return; char buf[200]; @@ -294,13 +294,13 @@ void importCustomStatuses(CSWindow* csw, int result) CSWindow::CSWindow(char *protoName) { m_protoName = protoName; - m_handle = NULL; + m_handle = nullptr; m_bExtraIcons = getByte("AllowExtraIcons", DEFAULT_ALLOW_EXTRA_ICONS); m_itemslist = new CSItemsList(m_protoName); - m_listview = NULL; - m_addModifyDlg = NULL; + m_listview = nullptr; + m_addModifyDlg = nullptr; m_bSomethingChanged = FALSE; - m_filterString = NULL; + m_filterString = nullptr; } void __fastcall SAFE_FREE(void** p) @@ -308,7 +308,7 @@ void __fastcall SAFE_FREE(void** p) if (*p) { free(*p); - *p = NULL; + *p = nullptr; } } @@ -321,11 +321,11 @@ CSWindow::~CSWindow() void CSWindow::initIcons() { PROTOACCOUNT *pdescr = Proto_GetAccount(m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; char *szUniqueID = (char*)CallProtoService(m_protoName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUniqueID == NULL) + if (szUniqueID == nullptr) return; DBVARIANT dbv; @@ -341,7 +341,7 @@ void CSWindow::initIcons() return; m_statusCount = (int)iNumStatuses; - if (NULL == (m_icons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, m_statusCount, 0))) + if (nullptr == (m_icons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, m_statusCount, 0))) return; for (int i = 1; i <= m_statusCount; i++) { @@ -448,7 +448,7 @@ CSAMWindow::CSAMWindow(WORD action, CSWindow* parent) m_action = action; m_parent = parent; m_bChanged = FALSE; - m_hCombo = m_hMessage = NULL; + m_hCombo = m_hMessage = nullptr; if (m_action == IDC_ADD) m_item = new StatusItem(); @@ -464,18 +464,18 @@ CSAMWindow::~CSAMWindow() void CSAMWindow::exec() { - DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ADDMODIFY), NULL, CSAMWindowProc, (LPARAM)this); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ADDMODIFY), nullptr, CSAMWindowProc, (LPARAM)this); } void CSAMWindow::setCombo() { PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; char *szUniqueID = (char*)CallProtoService(pdescr->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUniqueID == NULL) + if (szUniqueID == nullptr) return; DBVARIANT dbv; @@ -567,7 +567,7 @@ void CSAMWindow::checkItemValidity() GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, _countof(tszInputMessage)); PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName); - if (pdescr == NULL) + if (pdescr == nullptr) return; WPARAM i = SendMessage(m_hCombo, CB_GETCURSEL, 0, 0) + 1; @@ -648,7 +648,7 @@ void CSListView::addItem(StatusItem* item, int itemNumber) void CSListView::initItems(ListItem< StatusItem >* items) { ListItem< StatusItem >* help = items; - for (int i = 0; help != NULL; help = help->m_next, i++) + for (int i = 0; help != nullptr; help = help->m_next, i++) if (m_parent->itemPassedFilter(help)) addItem(help->m_item, i); } @@ -922,7 +922,7 @@ INT_PTR CALLBACK CSWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa if (LOWORD(wparam) == IDOK && csw->toggleButtons()) SetStatus(IDOK, csw->m_itemslist->m_list->get(csw->m_listview->getPositionInList()), csw->m_protoName); if (LOWORD(wparam) == IDC_CANCEL) - SetStatus(IDC_CANCEL, NULL, csw->m_protoName); + SetStatus(IDC_CANCEL, nullptr, csw->m_protoName); if (csw->m_bSomethingChanged) csw->m_itemslist->saveItems(csw->m_protoName); csw->saveWindowPosition(csw->m_handle); diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index f281d863b4..0ec26cf5f8 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -126,7 +126,7 @@ int ModulesLoaded(WPARAM, LPARAM) Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case")); // Õóê íà íàæàòèå êëàâèøè - kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId()); + kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId()); CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout); CreateServiceFunction(MS_CKL_GETLAYOUTOFTEXT, APIGetLayoutOfText); @@ -174,15 +174,15 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam) // Ïðîâåðêà íà ïóñòîé õîòêåé. Èíà÷å - ïèçäåö, êàê â âåðñèè 1.4 if (lcode != 0) { if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) { - ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout); + ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout); return 1; } if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam & 0x40000000))) { - ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout2); + ChangeLayout(nullptr, TOT_Layout, moOptions.CurrentWordLayout2); return 1; } if ((lcode == moOptions.dwHotkey_Case) && (!(lParam & 0x40000000))) { - ChangeLayout(NULL, TOT_Case, moOptions.CurrentWordCase); + ChangeLayout(nullptr, TOT_Case, moOptions.CurrentWordCase); return 1; } } diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 27540781fe..b91115217a 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -224,7 +224,7 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP SetDlgItemText(hWnd, IDC_EDIT_EXAMPLE, ptszMemLay); UnhookWindowsHookEx(kbHook_All); - kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId()); + kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId()); } } break; @@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, case IDC_EDIT_TIMEOUT: if (HIWORD(wParam) == EN_CHANGE) { - dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, NULL, FALSE); + dwTimeOut = GetDlgItemInt(hWnd, IDC_EDIT_TIMEOUT, nullptr, FALSE); if (dwTimeOut>255) poOptionsTemp.bTimeout = 255; else diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 7df6916a89..90967c017e 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -2,7 +2,7 @@ struct EditStreamData { - EditStreamData() { pbBuff = 0; cbBuff = iCurrent = 0; } + EditStreamData() { pbBuff = nullptr; cbBuff = iCurrent = 0; } ~EditStreamData() { free(pbBuff); } PBYTE pbBuff; @@ -48,7 +48,7 @@ LPTSTR GeTStringFromStreamData(EditStreamData *esd) BOOL CopyTextToClipboard(LPTSTR ptszText) { - if (!OpenClipboard(NULL)) + if (!OpenClipboard(nullptr)) return FALSE; EmptyClipboard(); @@ -85,7 +85,7 @@ HKL GetNextLayout(HKL hklCurLay) if (hklLayouts[i] == hklCurLay) return hklLayouts[(i+1)%(bLayNum)]; - return NULL; + return nullptr; } LPTSTR GenerateLayoutString(HKL hklLayout) @@ -133,7 +133,7 @@ LPTSTR GetLayoutString(HKL hklLayout) for (DWORD i = 0; i < bLayNum; i++) if (hklLayouts[i] == hklLayout) return ptszLayStrings[i]; - return NULL; + return nullptr; } LPTSTR ChangeTextCase(LPCTSTR ptszInText) @@ -154,12 +154,12 @@ LPTSTR ChangeTextLayout(LPCTSTR ptszInText, HKL hklCurLay, HKL hklToLay, BOOL Tw LPTSTR ptszOutText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t)); mir_wstrcpy(ptszOutText, ptszInText); - if (hklCurLay == NULL || hklToLay == NULL) + if (hklCurLay == nullptr || hklToLay == nullptr) return ptszOutText; LPTSTR ptszKeybCur = GetLayoutString(hklCurLay); LPTSTR ptszKeybNext = GetLayoutString(hklToLay); - if (ptszKeybCur == 0 || ptszKeybNext == 0) + if (ptszKeybCur == nullptr || ptszKeybNext == nullptr) return ptszOutText; for (DWORD i = 0; i < mir_wstrlen(ptszInText); i++) { @@ -189,7 +189,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) DWORD dwMaxSymbols = 0, dwTemp = 0; for (DWORD j = 0; j < mir_wstrlen(ptszInText); j++) - if (wcschr(ptszKeybBuff, ptszInText[j]) != NULL) + if (wcschr(ptszKeybBuff, ptszInText[j]) != nullptr) ++dwMaxSymbols; for (DWORD i = 1; i < bLayNum; i++) { @@ -197,7 +197,7 @@ HKL GetLayoutOfText(LPCTSTR ptszInText) DWORD dwCountSymbols = 0; for (DWORD j = 0; j 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--); - for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++); + for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (wcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == nullptr); dwStartWord--); + for (dwEndWord = crSelection.cpMin; (dwEndWord < (mir_wstrlen(ptszInText))) && (wcschr(ptszSeparators, ptszInText[dwEndWord]) == nullptr); dwEndWord++); crTemp.cpMin = dwStartWord; crTemp.cpMax = dwEndWord; @@ -368,7 +368,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) else { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hTextWnd, NULL, FALSE); + InvalidateRect(hTextWnd, nullptr, FALSE); return 1; } } @@ -382,7 +382,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (mir_wstrlen(ptszInText) == 0) { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hTextWnd, NULL, FALSE); + InvalidateRect(hTextWnd, nullptr, FALSE); return 1; } } @@ -432,7 +432,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if ((WindowType == WTYPE_Edit) || (WindowType == WTYPE_RichEdit)) { SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection); SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hTextWnd, NULL, FALSE); + InvalidateRect(hTextWnd, nullptr, FALSE); } if (TextOperation == TOT_Layout) @@ -488,7 +488,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pdtData, APF_NEWDATA) < 0) { mir_free(ptszPopupText); - MessageBox(NULL, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION); + MessageBox(nullptr, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION); } } } @@ -519,7 +519,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) } // Ïåðåêëþ÷èì ðàñêëàäêó èëè èçìåíèì ñîñòîÿíèå Caps Lock - if (TextOperation == TOT_Layout && hklToLay != NULL && moOptions.ChangeSystemLayout) + if (TextOperation == TOT_Layout && hklToLay != nullptr && moOptions.ChangeSystemLayout) ActivateKeyboardLayout(hklToLay, KLF_SETFORPROCESS); else if (TextOperation == TOT_Case) { // Åñëè íóæíî èíâåðòíóòü @@ -537,7 +537,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) } SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hTextWnd, NULL, FALSE); + InvalidateRect(hTextWnd, nullptr, FALSE); if (TextOperation == TOT_Layout) Skin_PlaySound(SND_ChangeLayout); diff --git a/plugins/ClientChangeNotify/src/CString.cpp b/plugins/ClientChangeNotify/src/CString.cpp index edee2fe0e6..2ed5f49062 100644 --- a/plugins/ClientChangeNotify/src/CString.cpp +++ b/plugins/ClientChangeNotify/src/CString.cpp @@ -39,7 +39,7 @@ void TString::Free() { // HeapFree(GetProcessHeap(), 0, pBuf); free(pBuf); - pBuf = NULL; + pBuf = nullptr; nBufSize = 0; nAllocSize = 0; } diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index cca57b1975..05a4423f30 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -70,12 +70,12 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) // wParam = hContact { POINT pt; - HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL); + HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr); SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc); HMENU hMenu = Menu_BuildContactMenu(wParam); GetCursorPos(&pt); SetForegroundWindow(hMenuWnd); - Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, NULL), MPCF_CONTACTMENU, wParam); + Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, nullptr), MPCF_CONTACTMENU, wParam); PostMessage(hMenuWnd, WM_NULL, 0, 0); DestroyMenu(hMenu); DestroyWindow(hMenuWnd); @@ -166,7 +166,7 @@ void ShowPopup(SHOWPOPUP_DATA *sd) if (!ppd.lchIcon || (INT_PTR)ppd.lchIcon == CALLSERVICE_NOTFOUND) { // if we didn't succeed retrieving client icon, show the usual status icon instead ppd.lchIcon = Skin_LoadProtoIcon(szProto, db_get_w(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE)); - pdata->hIcon = NULL; + pdata->hIcon = nullptr; } wcsncpy(ppd.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(sd->hContact, 0), _countof(ppd.lptzContactName) - 1); wcsncpy(ppd.lptzText, PopupText, _countof(ppd.lptzText) - 1); @@ -344,7 +344,7 @@ int MirandaLoaded(WPARAM, LPARAM) // seems that Fingerprint is not installed if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0)) - CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc); + CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc); return 0; } diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 80e1f117e0..21761ed59e 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -21,7 +21,7 @@ // ================================================ Popup options ================================================ -COptPage g_PopupOptPage(MOD_NAME, NULL); +COptPage g_PopupOptPage(MOD_NAME, nullptr); void EnablePopupOptDlgControls() { @@ -53,7 +53,7 @@ void EnablePopupOptDlgControls() } SetDlgItemText(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_STATIC_REGEXP, TranslateT("(you can use regular expressions here)")); g_PopupOptPage.MemToPage(true); - InvalidateRect(GetDlgItem(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_POPUPDELAY_SPIN), NULL, false); // update spin control + InvalidateRect(GetDlgItem(g_PopupOptPage.GetWnd(), IDC_POPUPOPTDLG_POPUPDELAY_SPIN), nullptr, false); // update spin control } static struct @@ -125,13 +125,13 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_POPUPOPTDLG_POPUPPREVIEW: g_PreviewOptPage = new COptPage(g_PopupOptPage); g_PreviewOptPage->PageToMem(); - DBCONTACTWRITESETTING cws = { 0 }; + DBCONTACTWRITESETTING cws = {}; cws.szModule = "ICQ"; cws.szSetting = DB_MIRVER; db_set_s(NULL, MOD_NAME, DB_OLDMIRVER, "ICQ Lite v5"); ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change delete g_PreviewOptPage; - g_PreviewOptPage = NULL; + g_PreviewOptPage = nullptr; break; } break; @@ -152,7 +152,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_DESTROY: - g_PopupOptPage.SetWnd(NULL); + g_PopupOptPage.SetWnd(nullptr); return 0; } return 0; @@ -161,7 +161,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsDlgInit(WPARAM wParam, LPARAM) { if (bPopupExists) { - OPTIONSDIALOGPAGE optDi = { sizeof(optDi) }; + OPTIONSDIALOGPAGE optDi = {}; optDi.position = 920000000; optDi.szGroup.a = LPGEN("Popups"); optDi.szTitle.a = LPGEN("ClientChangeNotify"); diff --git a/plugins/ClientChangeNotify/src/Options.cpp b/plugins/ClientChangeNotify/src/Options.cpp index d5647554f3..05660a21f7 100644 --- a/plugins/ClientChangeNotify/src/Options.cpp +++ b/plugins/ClientChangeNotify/src/Options.cpp @@ -98,7 +98,7 @@ COptItem *COptPage::Find(int m_dlgItemID) return Items[i]; _ASSERT(0); - return 0; + return nullptr; } COptPage& COptPage::operator = (const COptPage& Page) @@ -116,7 +116,7 @@ COptPage& COptPage::operator = (const COptPage& Page) int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*) { // default procedure for reading value from DB; used only for integral types - if (sDBSetting != NULL) { + if (sDBSetting != nullptr) { _ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD); DBVARIANT dbv; if (db_get(NULL, sModule, sDBSetting, &dbv)) @@ -129,7 +129,7 @@ int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*) void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*) { // default procedure for writing value to the DB; used only for integral types - if (sDBSetting != NULL && !m_bReadOnly) { + if (sDBSetting != nullptr && !m_bReadOnly) { _ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD); DBVARIANT dbv; @@ -141,7 +141,7 @@ void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*) TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix) { - if (sDBSetting != NULL) { + if (sDBSetting != nullptr) { _ASSERT(GetDefValue()); return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue()); } @@ -150,7 +150,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix) { - if (sDBSetting != NULL && !m_bReadOnly) { + if (sDBSetting != nullptr && !m_bReadOnly) { db_set_ws(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str); } } @@ -282,11 +282,11 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) pItem.ID = ID; pItem.ParentID = ParentID; pItem.Flags = Flags; - pItem.hItem = NULL; + pItem.hItem = nullptr; pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L""); - pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL : + pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(NULL, pData->sModule, - *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)NULL); + *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)nullptr); } } return 0; @@ -306,7 +306,7 @@ void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi } else { for (int i = 0; i < m_value.GetSize(); i++) { - if (m_value[i].Title == NULL) { + if (m_value[i].Title == nullptr) { m_value.RemoveElem(i); i--; } @@ -334,7 +334,7 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES) db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags); - if (User_Str1_DBName != NULL && m_value[i].User_Str1 != NULL) + if (User_Str1_DBName != nullptr && m_value[i].User_Str1 != nullptr) db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1); } COptItem::MemToDB(sModule, sDBSettingPrefix); @@ -372,7 +372,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) SetWindowLongPtr(hTreeView, GWL_STYLE, Style | TVS_CHECKBOXES); } - TVINSERTSTRUCT tvIn = { 0 }; + TVINSERTSTRUCT tvIn = {}; int ScrollPos = GetScrollPos(hTreeView, SB_VERT); int SelectOrder = IDToOrder(GetSelectedItemID(hWnd)); SendMessage(hTreeView, WM_SETREDRAW, false, 0); @@ -414,7 +414,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) i--; } } - TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : NULL)); + TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : nullptr)); SendMessage(hTreeView, WM_SETREDRAW, true, 0); SCROLLBARINFO sbi; sbi.cbSize = sizeof(sbi); @@ -460,7 +460,7 @@ int TreeDeleteEnum(const char *szSetting, LPARAM lParam) if (!strncmp(szSetting, CurSetting, CurSetting.GetLen())) TreeDeleteEnumData->TreeSettings.AddElem(szSetting); - if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != NULL) { + if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != nullptr) { CurSetting = *TreeDeleteEnumData->sDBSettingPrefix + TreeDeleteEnumData->TreeCtrl->sDBSetting + TreeDeleteEnumData->TreeCtrl->User_Str1_DBName; if (!strncmp(szSetting, CurSetting, CurSetting.GetLen())) TreeDeleteEnumData->TreeSettings.AddElem(szSetting); @@ -524,7 +524,7 @@ CTreeItem* COptItem_TreeCtrl::InsertItem(HWND hWnd, CTreeItem &Item) TVITEM tvi; int SelOrder = -1; Item.ParentID = RootItems[0].ID; - TVINSERTSTRUCT tvIn = { 0 }; + TVINSERTSTRUCT tvIn = {}; tvIn.hParent = RootItems[0].hItem; tvIn.hInsertAfter = TVI_FIRST; if (tvi.hItem = TreeView_GetSelection(hTreeView)) { @@ -668,7 +668,7 @@ void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value = m_defValue; else { for (int i = 0; i < m_value.GetSize(); i++) { - if (m_value[i].Text == NULL) { + if (m_value[i].Text == nullptr) { m_value.RemoveElem(i); i--; } diff --git a/plugins/ClientChangeNotify/src/pcre.cpp b/plugins/ClientChangeNotify/src/pcre.cpp index c7954f265f..d1796cfe81 100644 --- a/plugins/ClientChangeNotify/src/pcre.cpp +++ b/plugins/ClientChangeNotify/src/pcre.cpp @@ -59,7 +59,7 @@ void FreePcreCompileData() TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) { TCString Result(L""); - sPcreCompileData s = {0}; + sPcreCompileData s = {}; int NewID = PcreCompileData.AddElem(s); PcreCompileData[NewID].ID = ID; if (!bAddAsUsualSubstring) @@ -119,10 +119,10 @@ TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) Regexp.ReleaseBuffer(); } - PcreCompileData[NewID].pPcre = pcre16_compile(Regexp, PCRE_UTF8 | PCRE_NO_UTF8_CHECK | Flags, &Err, &ErrOffs, NULL); + PcreCompileData[NewID].pPcre = pcre16_compile(Regexp, PCRE_UTF8 | PCRE_NO_UTF8_CHECK | Flags, &Err, &ErrOffs, nullptr); if (PcreCompileData[NewID].pPcre) { - PcreCompileData[NewID].pExtra = NULL; + PcreCompileData[NewID].pExtra = nullptr; PcreCompileData[NewID].pExtra = pcre16_study(PcreCompileData[NewID].pPcre, 0, &Err); } else { @@ -157,7 +157,7 @@ int PcreCheck(TCString Str, int StartingID) if (PcreCompileData[I].pPcre) { - int Res = pcre16_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Str, Str.GetLen() - 1, 0, PCRE_NOTEMPTY | PCRE_NO_UTF8_CHECK, NULL, 0); + int Res = pcre16_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Str, Str.GetLen() - 1, 0, PCRE_NOTEMPTY | PCRE_NO_UTF8_CHECK, nullptr, 0); if (Res >= 0) { diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 4e726ab299..3721ec3e13 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -88,7 +88,7 @@ static const struct CheckBoxValues_t offlineValues[] = { static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (int i = 0; i < nValues; i++) { diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 2da3351ab1..de6c0c2e7c 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -148,7 +148,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE); int status = GetGeneralisedStatus(); int grey = 0, groupCountsFontTopShift; - HBRUSH hBrushAlternateGrey = NULL; + HBRUSH hBrushAlternateGrey = nullptr; // yes I know about GetSysColorBrush() COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour; @@ -157,13 +157,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS) grey = 1; GetClientRect(hwnd, &clRect); - if (rcPaint == NULL) + if (rcPaint == nullptr) rcPaint = &clRect; if (IsRectEmpty(rcPaint)) return; HDC hdcMem = CreateCompatibleDC(hdc); - HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr); HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb); { TEXTMETRIC tm; @@ -256,7 +256,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (group->scanIndex == group->cl.getCount()) { group = group->parent; indent--; - if (group == NULL) + if (group == nullptr) break; group->scanIndex++; continue; @@ -269,7 +269,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index; SIZE textSize, countsSize = { 0 }, spaceSize = { 0 }; int width, checkboxWidth; - wchar_t *szCounts = NULL; + wchar_t *szCounts = nullptr; // alternating grey if (style & CLS_GREYALTERNATE && index & 1) { @@ -398,7 +398,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) SetHotTrackColour(hdcMem, dat); rc.right--; ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, - (int)mir_wstrlen(cc->szText), NULL); + (int)mir_wstrlen(cc->szText), nullptr); } else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 1eb7292daa..b2866b67e4 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -30,7 +30,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { MCONTACT hContact = (MCONTACT)wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam; - if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && + if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr && strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED); } @@ -159,7 +159,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0); PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0); - if (pa == NULL) + if (pa == nullptr) db_unset(NULL, "CList", "PrimaryStatus"); else db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName); diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 1fc8925d6c..3dc4c83b17 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -153,7 +153,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); - db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); + db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE)); db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); @@ -189,11 +189,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW); if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { - HWND hProgMan = FindWindowA("Progman", NULL); + HWND hProgMan = FindWindowA("Progman", nullptr); if (IsWindow(hProgMan)) SetParent(pcli->hwndContactList, hProgMan); } - else SetParent(pcli->hwndContactList, NULL); + else SetParent(pcli->hwndContactList, nullptr); if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, @@ -202,11 +202,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) - SetMenu(pcli->hwndContactList, NULL); + SetMenu(pcli->hwndContactList, nullptr); else SetMenu(pcli->hwndContactList, pcli->hMenuMain); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { @@ -283,7 +283,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DestroyWindow(pcli->hwndStatus); flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; - pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL); + pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr); } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) ShowWindow(pcli->hwndStatus, SW_SHOW); diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp index 4dc6cbf55f..6270630213 100644 --- a/plugins/Clist_blind/src/contact.cpp +++ b/plugins/Clist_blind/src/contact.cpp @@ -63,7 +63,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1; } /* both are online, now check protocols */ - if (c1->proto != NULL && c2->proto != NULL) { + if (c1->proto != nullptr && c2->proto != nullptr) { int rc = mir_strcmp(c1->proto, c2->proto); if (rc != 0) return rc; diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 011c8574aa..eac2270f0d 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" int hLangpack; -HINSTANCE g_hInst = 0; -CLIST_INTERFACE *pcli = NULL, coreCli; -HIMAGELIST himlCListClc = NULL; +HINSTANCE g_hInst = nullptr; +CLIST_INTERFACE *pcli = nullptr, coreCli; +HIMAGELIST himlCListClc = nullptr; LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -189,13 +189,13 @@ wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* set MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len); else if (dbv.type == DBVT_WCHAR) mir_wstrncpy(out, dbv.pwszVal, (int)len); - else if (def != NULL) + else if (def != nullptr) mir_wstrncpy(out, def, (int)len); db_free(&dbv); } else { - if (def != NULL) + if (def != nullptr) mir_wstrncpy(out, def, (int)len); } @@ -219,7 +219,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) if (len == 0) return 0; - if (text == NULL) + if (text == nullptr) return 0; totalSize = str->used + len + 1; @@ -227,10 +227,10 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) if (totalSize > str->allocated) { totalSize += DATA_BLOCK - (totalSize % DATA_BLOCK); - if (str->text != NULL) { + if (str->text != nullptr) { wchar_t *tmp = (wchar_t *)mir_realloc(str->text, sizeof(wchar_t) * totalSize); - if (tmp == NULL) { + if (tmp == nullptr) { mir_free(str->text); return -1; } @@ -240,7 +240,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len) else { str->text = (wchar_t *)mir_alloc(sizeof(wchar_t) * totalSize); - if (str->text == NULL) { + if (str->text == nullptr) { return -2; } } @@ -262,7 +262,7 @@ wchar_t * ParseText(const wchar_t *text, { size_t length = mir_wstrlen(text); size_t nextPos = 0; - StringHelper ret = { 0 }; + StringHelper ret = {}; size_t i; // length - 1 because a % in last char will be a % and point @@ -271,11 +271,11 @@ wchar_t * ParseText(const wchar_t *text, BOOL found = FALSE; if (CopyData(&ret, &text[nextPos], i - nextPos)) - return NULL; + return nullptr; if (text[i + 1] == '%') { if (CopyData(&ret, L"%", 1)) - return NULL; + return nullptr; i++; @@ -291,7 +291,7 @@ wchar_t * ParseText(const wchar_t *text, if (wcsnicmp(&text[i], variables[j], vlen) == 0) { if (CopyData(&ret, data[j], mir_wstrlen(data[j]))) - return NULL; + return nullptr; i += vlen - 1; @@ -311,7 +311,7 @@ wchar_t * ParseText(const wchar_t *text, if (nextPos < length) if (CopyData(&ret, &text[nextPos], length - nextPos)) - return NULL; + return nullptr; return ret.text; } @@ -343,16 +343,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->hwnd_list = CreateWindow(L"LISTBOX", L"", (WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_VSCROLL), - 0, 0, 0, 0, hwnd, NULL, g_hInst, 0); + 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr); dat->need_rebuild = FALSE; GetClientRect(hwnd, &r); - SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); break; case WM_SIZE: GetClientRect(hwnd, &r); - SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); break; case WM_PRINTCLIENT: @@ -396,7 +396,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd, TIMERID_INFOTIP); KillTimer(hwnd, TIMERID_RENAME); dat->szQuickSearch[0] = 0; - pcli->pfnInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnInvalidateRect(hwnd, nullptr, FALSE); pcli->pfnEnsureVisible(hwnd, (ClcData*)dat, dat->selection, 0); UpdateWindow(hwnd); break; @@ -416,11 +416,11 @@ wchar_t* GetStatusName(struct ClcContact *item) int status; status_name[0] = '\0'; - if (item->hContact == NULL || item->proto == NULL) + if (item->hContact == NULL || item->proto == nullptr) return status_name; // Get XStatusName - MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL); + MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), nullptr); if (status_name[0] != '\0') return status_name; @@ -436,16 +436,16 @@ wchar_t status_message[256]; wchar_t* GetStatusMessage(struct ClcContact *item) { status_message[0] = '\0'; - if (item->hContact == NULL || item->proto == NULL) + if (item->hContact == NULL || item->proto == nullptr) return status_message; // Get XStatusMsg - MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL); + MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), nullptr); if (status_message[0] != '\0') return status_message; // Get status message - MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), NULL); + MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), nullptr); return status_message; } @@ -459,13 +459,13 @@ wchar_t* GetProtoName(struct ClcContact *item) #endif proto_name[0] = '\0'; - if (item->hContact == NULL || item->proto == NULL) { + if (item->hContact == NULL || item->proto == nullptr) { mir_wstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name)); return proto_name; } PROTOACCOUNT *acc = Proto_GetAccount(item->proto); - if (acc == NULL) { + if (acc == nullptr) { #ifdef UNICODE CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description); mir_snwprintf(proto_name, L"%S", description); @@ -516,7 +516,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) size_t size = _countof(tmp); while (true) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; text -= 2; size += 2; @@ -547,7 +547,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) count[0] = '\0'; wchar_t *txt = ParseText(template_group, t, _countof(t), v, _countof(v)); - if (txt != NULL) + if (txt != nullptr) mir_wstrncpy(text, txt, size); mir_free(txt); } @@ -569,7 +569,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) }; wchar_t *txt = ParseText(template_contact, t, _countof(t), v, _countof(v)); - if (txt != NULL) + if (txt != nullptr) mir_wstrncpy(text, txt, size); mir_free(txt); } @@ -599,7 +599,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) } SendMessage(dat->hwnd_list, WM_SETREDRAW, TRUE, 0); - InvalidateRect(dat->hwnd_list, NULL, TRUE); + InvalidateRect(dat->hwnd_list, nullptr, TRUE); dat->selection = selection; SendMessage(dat->hwnd_list, LB_SETCURSEL, dat->selection, 0); diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp index e4d223dc9f..f5e130c5e7 100644 --- a/plugins/Clist_modern/src/cluiframes.cpp +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -68,7 +68,7 @@ static int _iNextFrameId = 100; static HFONT _hTitleBarFont = nullptr; // menus -static FrameMenuHandles cont = { nullptr }; +static FrameMenuHandles cont = {}; static LIST g_frameMenus(10); // others @@ -163,7 +163,7 @@ int CLUIFrames_RepaintSubContainers() { for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) + if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) RedrawWindow(F.hWnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME); } @@ -174,7 +174,7 @@ int CLUIFrames_ActivateSubContainers(BOOL active) { for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (active && !F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { + if (active && !F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { if (db_get_b(0, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { SetWindowPos(F.OwnerWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SetWindowPos(F.OwnerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -191,7 +191,7 @@ int CLUIFrames_SetParentForContainers(HWND parent) for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { + if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2 && F.visible && !F.needhide) { HWND hwnd = F.OwnerWindow; SetParent(hwnd, parent); } @@ -204,7 +204,7 @@ int CLUIFrames_OnShowHide(int mode) int prevFrameCount; for (int i = 0; i < g_nFramesCount; i++) { FRAMEWND &F = g_pfwFrames[i]; - if (!F.floating && F.OwnerWindow != (HWND)0 && F.OwnerWindow != (HWND)-2) { + if (!F.floating && F.OwnerWindow != (HWND)nullptr && F.OwnerWindow != (HWND)-2) { // Try to avoid crash on exit due to unlock. HWND owner = F.OwnerWindow; HWND Frmhwnd = F.hWnd; @@ -289,7 +289,7 @@ int QueueAllFramesUpdating(bool queue) if (F.UpdateRgn) { DeleteObject(F.UpdateRgn); } - F.UpdateRgn = 0; + F.UpdateRgn = nullptr; } } return queue; @@ -846,7 +846,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.name.a = LPGEN("&Down"); mi.pszService = CLUIFRAMESMOVEDOWN; addFrameMenuItem(&mi, frameid, bMain); - return 0; + return nullptr; } static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) @@ -1029,7 +1029,7 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); + SetWindowPos(fw.TitleBar.hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); return 0; case FO_NAME: @@ -1348,7 +1348,7 @@ static int _us_DoSetFrameBorder(WPARAM wParam, LPARAM lParam) GetWindowRect(hw, &rc); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); + SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); return 0; } @@ -1494,7 +1494,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_SYSTEM | CMIF_UNICODE; mi.position = separator++; mi.name.w = F.TitleBar.tbname ? F.TitleBar.tbname : F.name; - mi.pszService = 0; + mi.pszService = nullptr; g_frameMenus.insert(F.MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi)); CLUIFramesCreateMenuForFrame(F.id, F.MenuHandles.MainMenuItem, separator, true); CLUIFramesModifyMainMenuItems(F.id, 0); @@ -1526,7 +1526,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) //char * CustomName = nullptr; CLISTFrame *clfrm = (CLISTFrame *)wParam; - if (pcli->hwndContactList == 0) return -1; + if (pcli->hwndContactList == nullptr) return -1; if (_fCluiFramesModuleNotStarted) return -1; if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; if (!(_hTitleBarFont)) _hTitleBarFont = CLUILoadTitleBarFont(); @@ -1544,7 +1544,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM) if (clfrm->Flags & F_NO_SUBCONTAINER || !g_CluiData.fLayered) F.OwnerWindow = (HWND)-2; else - F.OwnerWindow = 0; + F.OwnerWindow = nullptr; if (db_get_b(0, CLUIFrameModule, "RemoveAllBorders", 0) == 1) clfrm->Flags |= F_NOBORDER; @@ -1694,7 +1694,7 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) { - if (Frame->TitleBar.hwnd != 0) + if (Frame->TitleBar.hwnd != nullptr) RedrawWindow(Frame->TitleBar.hwnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); //UpdateWindow(Frame->TitleBar.hwnd); return 0; @@ -1702,12 +1702,12 @@ static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame) static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) { - if (Frame->hWnd != 0) { + if (Frame->hWnd != nullptr) { RedrawWindow(Frame->hWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); UpdateWindow(Frame->hWnd); } - if (Frame->floating && Frame->ContainerWnd != 0) + if (Frame->floating && Frame->ContainerWnd != nullptr) RedrawWindow(Frame->ContainerWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } @@ -2055,7 +2055,7 @@ int CLUIFrames_ApplyNewSizes(int mode) }; } if (IsWindowVisible(pcli->hwndContactList)) { - ske_DrawNonFramedObjects(1, 0); + ske_DrawNonFramedObjects(1, nullptr); CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); } g_CluiData.mutexPreventDockMoving = 1; @@ -2288,8 +2288,8 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick; - if (pcli->hwndContactList != 0) cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE); - if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); + if (pcli->hwndContactList != nullptr) cliInvalidateRect(pcli->hwndContactList, nullptr, TRUE); + if (pcli->hwndContactList != nullptr) UpdateWindow(pcli->hwndContactList); if (lParam == 2) RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); @@ -2328,7 +2328,7 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) sttBackgroundBmpUse = db_get_w(0, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } - cliInvalidateRect(pcli->hwndContactList, 0, 0); + cliInvalidateRect(pcli->hwndContactList, nullptr, 0); RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); return 0; @@ -2340,7 +2340,7 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo RECT clRect, *rcPaint; int yScroll = 0; - PAINTSTRUCT paintst = { 0 }; + PAINTSTRUCT paintst = {}; HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); @@ -2559,7 +2559,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam return 1; case WM_ENABLE: - if (hwnd != 0) + if (hwnd != nullptr) cliInvalidateRect(hwnd, nullptr, FALSE); return 0; @@ -2615,7 +2615,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam AppendMenu(hmenu, g_pfwFrames[framepos].floating ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_floating, TranslateT("Floating")); } - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr); DestroyMenu(hmenu); } break; @@ -2927,7 +2927,7 @@ static int CLUIFrameResizeFloatingFrame(int framepos) RECT rect; if (!g_pfwFrames[framepos].floating) { return 0; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; + if (g_pfwFrames[framepos].ContainerWnd == nullptr) { return 0; }; GetClientRect(g_pfwFrames[framepos].ContainerWnd, &rect); int width = rect.right - rect.left; @@ -2951,7 +2951,7 @@ static int CLUIFrameResizeFloatingFrame(int framepos) SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); }; - if (g_pfwFrames[framepos].ContainerWnd != 0) UpdateWindow(g_pfwFrames[framepos].ContainerWnd); + if (g_pfwFrames[framepos].ContainerWnd != nullptr) UpdateWindow(g_pfwFrames[framepos].ContainerWnd); GetWindowRect(g_pfwFrames[framepos].hWnd, &g_pfwFrames[framepos].wndSize); return 0; }; @@ -2971,7 +2971,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP if (g_bTransparentFlag) { BYTE alpha; if ((wParam != WA_INACTIVE || ((HWND)lParam == hwnd) || GetParent((HWND)lParam) == hwnd)) { - HWND hw = lParam ? GetParent((HWND)lParam) : 0; + HWND hw = lParam ? GetParent((HWND)lParam) : nullptr; alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT); if (hw) SetWindowPos(hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); CLUI_SmoothAlphaTransition(hwnd, alpha, 1); @@ -3017,7 +3017,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height) { - HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, 0, g_hInst, 0); + HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, nullptr, g_hInst, nullptr); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER)); if (g_CluiData.fOnDesktop) { HWND hProgMan = FindWindow(L"Progman", nullptr); @@ -3045,7 +3045,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); if (framepos < 0 || framepos >= g_nFramesCount) { break; }; if (!g_pfwFrames[framepos].minmaxenabled) { break; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { break; }; + if (g_pfwFrames[framepos].ContainerWnd == nullptr) { break; }; if (g_pfwFrames[framepos].Locked) { RECT rct; @@ -3078,7 +3078,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); if (framepos < 0 || framepos >= g_nFramesCount) break; - if (g_pfwFrames[framepos].ContainerWnd == 0) + if (g_pfwFrames[framepos].ContainerWnd == nullptr) return 0; GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); @@ -3138,7 +3138,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); if (framepos < 0 || framepos >= g_nFramesCount) { break; }; - if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; }; + if (g_pfwFrames[framepos].ContainerWnd == nullptr) { return 0; }; CLUIFrameResizeFloatingFrame(framepos); GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect); @@ -3170,7 +3170,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height) { - return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0); + return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr); } static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) @@ -3183,7 +3183,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) if (g_pfwFrames[pos].floating || (lParam & 2)) { if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) { - if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); + if (g_pfwFrames[pos].OwnerWindow == nullptr) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10); CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE); SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow); SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); @@ -3191,7 +3191,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) g_pfwFrames[pos].floating = FALSE; if (!(lParam & 2)) { DestroyWindow(g_pfwFrames[pos].ContainerWnd); - g_pfwFrames[pos].ContainerWnd = 0; + g_pfwFrames[pos].ContainerWnd = nullptr; } } else { @@ -3199,7 +3199,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList); g_pfwFrames[pos].floating = FALSE; if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd); - g_pfwFrames[pos].ContainerWnd = 0; + g_pfwFrames[pos].ContainerWnd = nullptr; } } else { @@ -3222,9 +3222,9 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam) SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd); SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd); - if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) { + if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != nullptr) { DestroyWindow(g_pfwFrames[pos].OwnerWindow); - g_pfwFrames[pos].OwnerWindow = 0; + g_pfwFrames[pos].OwnerWindow = nullptr; } GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border); @@ -3368,7 +3368,7 @@ int LoadCLUIFramesModule(void) CreateCluiFramesServices(); - hWndExplorerToolBar = FindWindowEx(0, 0, L"Shell_TrayWnd", nullptr); + hWndExplorerToolBar = FindWindowEx(nullptr, nullptr, L"Shell_TrayWnd", nullptr); OnFrameTitleBarBackgroundChange(0, 0); _fCluiFramesModuleNotStarted = FALSE; return 0; diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 381136d9d7..1143005d11 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -32,10 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CHECKRES(sub) if (sub != S_OK) return S_FALSE; -HINSTANCE g_hInst = 0, g_hMirApp = 0; +HINSTANCE g_hInst = nullptr, g_hMirApp = nullptr; CLIST_INTERFACE *pcli = nullptr; CLIST_INTERFACE corecli = { 0 }; -CLUIDATA g_CluiData = { 0 }; +CLUIDATA g_CluiData = {}; int hLangpack; static HRESULT SubclassClistInterface(); diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 8e374b19eb..1cc510b4b5 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -179,7 +179,7 @@ static void _AniAva_AnimationTreadProc(void*) Netlib_Logf(nullptr, "AnimationTreadProc thread start"); // wait forever till hExitEvent signalled - HANDLE hThread = 0; + HANDLE hThread = nullptr; s_AnimationThreadID = GetCurrentThreadId(); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hThread, 0, FALSE, DUPLICATE_SAME_ACCESS); s_AnimationThreadHandle = hThread; @@ -235,7 +235,7 @@ static INT_PTR _AniAva_CreateAvatarWindowSync_Worker(WPARAM tszName, LPARAM) static HWND _AniAva_CreateAvatarWindowSync(wchar_t *szFileName) { - if (s_AnimationThreadHandle == 0 || s_AnimationThreadID == 0) + if (s_AnimationThreadHandle == nullptr || s_AnimationThreadID == 0) return nullptr; ANIAVA_SYNCCALLITEM item = { 0 }; diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 7ece765d67..3bb07bcdda 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -90,7 +90,7 @@ static void amThreadProc(void *) ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); - HANDLE ACK = 0; + HANDLE ACK = nullptr; if (pdnce->ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol) ACK = (HANDLE)ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0); if (!ACK) { @@ -152,7 +152,7 @@ void amRequestAwayMsg(MCONTACT hContact) void InitAwayMsgModule() { hamProcessEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - g_hAwayMsgThread = mir_forkthread(amThreadProc, 0); + g_hAwayMsgThread = mir_forkthread(amThreadProc, nullptr); } void UninitAwayMsgModule() diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 102aed2c9b..3e785d8f18 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -52,7 +52,7 @@ void Cache_GetTimezone(ClcData *dat, MCONTACT hContact) if (dat && dat->hWnd == pcli->hwndContactTree) { DWORD flags = dat->contact_time_show_only_if_different ? TZF_DIFONLY : 0; - pdnce->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags); + pdnce->hTimeZone = TimeZone_CreateByContact(hContact, nullptr, flags); } } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 14aa6ef3be..53e6712c9e 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1198,9 +1198,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); if (i != -1 && group->groupId != destgroup->groupId) { - wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, 0)); + wchar_t *groupName = mir_wstrdup(Clist_GroupGetName(contact->groupId, nullptr)); wchar_t *shortGroup = nullptr; - wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, 0)); + wchar_t *sourceGrName = mir_wstrdup(Clist_GroupGetName(destgroup->groupId, nullptr)); if (groupName) { int len = (int)mir_wstrlen(groupName); do { len--; } while (len >= 0 && groupName[len] != '\\'); @@ -1553,7 +1553,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) wchar_t szMyPath[MAX_PATH]; GetModuleFileName(g_hInst, szMyPath, _countof(szMyPath)); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.defaultFile.w = szMyPath; sid.flags = SIDF_PATH_UNICODE; diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index dde2266bc4..d071c407f0 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -87,7 +87,7 @@ ClcContact* cliFindItem(DWORD dwItem, ClcContact *cc) if (cc->subcontacts[i].hContact == dwItem) return &cc->subcontacts[i]; - return 0; + return nullptr; } int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup) diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 1537729272..48ace78fcf 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -254,7 +254,7 @@ tPaintCallbackProc CLCPaint::PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint ClcData *dat = (ClcData*)GetWindowLongPtr(hWnd, 0); if (dat) cliPaintClc(hWnd, dat, hDC, rcPaint); - return 0; + return nullptr; } void CLCPaint::_FillQuickHash() @@ -530,7 +530,7 @@ void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWOR MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat) { if (Drawing == nullptr) - return 0; + return nullptr; char buf[BUF2SIZE] = { 0 }; MODERNMASK *mpModernMask = (MODERNMASK*)mir_calloc(sizeof(MODERNMASK)); @@ -1697,7 +1697,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, mpRequest = _GetCLCContactRowBackModernMask(group, Drawing, indent, line_num, selected, hottrack, dat); RECT mrc = row_rc; - if (group->parent == 0 + if (group->parent == nullptr && group->scanIndex != 0 && group->scanIndex < group->cl.getCount() && group->cl[group->scanIndex]->type == CLCIT_GROUP) { diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index d7f95d0bfa..382590e0fd 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -103,7 +103,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) { if (GetMenuItemInfo(g_CluiData.hMenuNotify, j, TRUE, &mii) != 0) { NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData; - if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex) + if (nmi != nullptr && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex) return p; } } @@ -322,7 +322,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC) HICON hIcon = (HICON)LoadImage(g_hMirApp, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0); wchar_t *ptszEvents = TranslateT("No events"); ske_DrawText(hDC, ptszEvents, (int)mir_wstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE); - ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT); + ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT); DestroyIcon(hIcon); } diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index c3197d3810..4725dac959 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -220,7 +220,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) int wx = 0; BYTE *ptr = nullptr; HRGN rgn = nullptr; - HBITMAP WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : 0; + HBITMAP WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : nullptr; if (WindowImage && g_CluiData.fLayered) { BITMAP bmp; GetObject(WindowImage, sizeof(BITMAP), &bmp); @@ -275,7 +275,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) po = (a > 16); } - if (po || (!rgn && ptr == 0)) { + if (po || (!rgn && ptr == nullptr)) { BOOL hWndFound = FALSE; HWND hAuxOld = nullptr; HWND hAux = WindowFromPoint(pt); diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 53c1edb5b4..fcb72f86dd 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -368,7 +368,7 @@ int cliTrayIconInit(HWND hwnd) case TRAY_ICON_MODE_CYCLE: pcli->pfnTrayIconAdd(hwnd, nullptr, nullptr, CListTray_GetGlobalStatus(0, 0)); pcli->cycleStep = 0; - cliTrayCycleTimerProc(0, 0, 0, 0); // force icon update + cliTrayCycleTimerProc(nullptr, 0, 0, 0); // force icon update // Íå ñîõðàíÿåì ID òàéìåðà â pcli, ÷òîáû fnTrayIconUpdateBase íå óáèâàëà åãî. TimerID = CLUI_SafeSetTimer(nullptr, 0, db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cliTrayCycleTimerProc); break; diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index d9ea40e650..521f49d15d 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -58,7 +58,7 @@ BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND hwnd, UINT msg, WPARAM wParam, LP /* Global variables */ UINT g_dwMainThreadID = 0; -HANDLE g_hAwayMsgThread = 0, g_hGetTextAsyncThread = 0, g_hSmoothAnimationThread = 0; +HANDLE g_hAwayMsgThread = nullptr, g_hGetTextAsyncThread = nullptr, g_hSmoothAnimationThread = nullptr; HMENU g_hMenuMain; BOOL g_bTransparentFlag = FALSE; @@ -157,7 +157,7 @@ void CLUI::cliOnCreateClc(void) int CLUI::OnEvent_ModulesLoaded(WPARAM, LPARAM) { - cliCluiProtocolStatusChanged(0, 0); + cliCluiProtocolStatusChanged(0, nullptr); SleepEx(0, TRUE); g_flag_bOnModulesLoadedCalled = TRUE; @@ -174,7 +174,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) g_CluiData.dwKeyColor = db_get_dw(0, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); - cliInvalidateRect(pcli->hwndContactList, 0, 0); + cliInvalidateRect(pcli->hwndContactList, nullptr, 0); return 0; } @@ -580,7 +580,7 @@ void CLUI_UpdateAeroGlass() if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass)) { if (g_CluiData.hAeroGlassRgn) { DeleteObject(g_CluiData.hAeroGlassRgn); - g_CluiData.hAeroGlassRgn = 0; + g_CluiData.hAeroGlassRgn = nullptr; } DWM_BLURBEHIND bb = { 0 }; @@ -974,7 +974,7 @@ static bool StartTicksTimer(PROTOTICKS *pt) DestroyIcon(ic); } } - CLUI_SafeSetTimer(pcli->hwndContactList, TM_STATUSBARUPDATE + pt->nIndex, nAnimatedIconStep, 0); + CLUI_SafeSetTimer(pcli->hwndContactList, TM_STATUSBARUPDATE + pt->nIndex, nAnimatedIconStep, nullptr); pt->bTimerCreated = 1; pt->nCycleStartTick = GetTickCount(); return true; @@ -1009,7 +1009,7 @@ static BOOL CALLBACK BroadcastEnumChildProc(HWND hwndChild, LPARAM lParam) static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LPARAM lParam) { - MSG msg = { 0 }; + MSG msg = {}; msg.hwnd = hwnd; msg.lParam = lParam; msg.wParam = wParam; @@ -1498,7 +1498,7 @@ HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDesc wchar_t fileFull[MAX_PATH] = { 0 }; - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.section.a = szSectionName; sid.pszName = szIcoID; sid.flags |= SIDF_PATH_UNICODE; @@ -1805,7 +1805,7 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) if (!g_CluiData.fLayered && IsWindowVisible(m_hWnd)) { RECT w = { 0 }; RECT w2 = { 0 }; - PAINTSTRUCT ps = { 0 }; + PAINTSTRUCT ps = {}; GetClientRect(m_hWnd, &w); if (!(w.right > 0 && w.bottom > 0)) @@ -1841,7 +1841,7 @@ LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) else { RECT w = { 0 }; RECT w2 = { 0 }; - PAINTSTRUCT ps = { 0 }; + PAINTSTRUCT ps = {}; GetWindowRect(m_hWnd, &w); OffsetRect(&w, -w.left, -w.top); BeginPaint(m_hWnd, &ps); @@ -1862,7 +1862,7 @@ LRESULT CLUI::OnCreate(UINT, WPARAM, LPARAM) { TranslateMenu(GetMenu(m_hWnd)); DrawMenuBar(m_hWnd); - cliCluiProtocolStatusChanged(0, 0); + cliCluiProtocolStatusChanged(0, nullptr); MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); @@ -2270,7 +2270,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) rcWindow = rcSizingRect; else GetWindowRect(m_hWnd, &rcWindow); - if (!g_CluiData.fAutoSize || pcli->hwndContactTree == 0 || Clist_IsDocked()) + if (!g_CluiData.fAutoSize || pcli->hwndContactTree == nullptr || Clist_IsDocked()) return FALSE; maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", SETTING_MAXSIZEHEIGHT_DEFAULT); @@ -2325,7 +2325,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) } else bNeedFixSizingRect = 0; - SetWindowPos(m_hWnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(m_hWnd, nullptr, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE); nRequiredHeight = 0; diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index df8ef4b4a4..2661747e72 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -213,7 +213,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_AdjustPosition(msg->hwnd, &rcMonitor, &rcWindow); *((LRESULT*)lParam) = TRUE; g_CluiData.mutexPreventDockMoving = 0; - SetWindowPos(msg->hwnd, 0, rcWindow.left, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING); + SetWindowPos(msg->hwnd, nullptr, rcWindow.left, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING); Sync(CLUIFrames_OnMoving, msg->hwnd, &rcWindow); ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr);// -= -= -= g_CluiData.mutexPreventDockMoving = 1; @@ -293,7 +293,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.fDocked = 0; GetCursorPos(&pt); PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); - SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(0, "CList", "Width", 0), db_get_dw(0, "CList", "Height", 0), SWP_NOZORDER); + SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, db_get_dw(0, "CList", "Width", 0), db_get_dw(0, "CList", "Height", 0), SWP_NOZORDER); db_set_b(0, "CList", "Docked", (BYTE)g_CluiData.fDocked); // ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, nullptr); } diff --git a/plugins/Clist_modern/src/modern_global.cpp b/plugins/Clist_modern/src/modern_global.cpp index 073f4e948b..43bc2ff63f 100644 --- a/plugins/Clist_modern/src/modern_global.cpp +++ b/plugins/Clist_modern/src/modern_global.cpp @@ -31,4 +31,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //ClcProtoStatus *clcProto = nullptr; HIMAGELIST g_himlCListClc = nullptr; HICON g_hListeningToIcon = nullptr; -char* g_szMetaModuleName = 0; +char* g_szMetaModuleName = nullptr; diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index 191619fe4a..6d0d574b6f 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -167,7 +167,7 @@ BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara res3->pData = i++; TRACE("*********** Nodes DUMP 1 ***********\n"); TraceTreeLevel(RootNode); - if (RemoveNode(res1)) res1 = 0; + if (RemoveNode(res1)) res1 = nullptr; TRACE("*********** Nodes DUMP 2 ***********\n"); TraceTreeLevel(RootNode); //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(0,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index e69b80025a..3cecdbbdf5 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -27,7 +27,7 @@ Created by Pescuma, modified by Artem Shpynov #include "stdafx.h" #include "modern_clcpaint.h" -ROWCELL *gl_RowTabAccess[TC_ELEMENTSCOUNT + 1] = { 0 }; // Ìàññèâ, ÷åðåç êîòîðûé îñóùåñòâëÿåòñÿ äîñòóï ê ýëåìåíòàì êîíòàêòà. +ROWCELL *gl_RowTabAccess[TC_ELEMENTSCOUNT + 1] = {}; // Ìàññèâ, ÷åðåç êîòîðûé îñóùåñòâëÿåòñÿ äîñòóï ê ýëåìåíòàì êîíòàêòà. ROWCELL *gl_RowRoot; void FreeRowCell() diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 31c8dcfa01..b957d3f89b 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -75,7 +75,7 @@ int ModernSkinButtonLoadModule() wc.lpfnWndProc = ModernSkinButtonWndProc; wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(ModernSkinButtonCtrl*); - wc.hbrBackground = 0; + wc.hbrBackground = nullptr; wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); ModernSkinButtonModuleIsLoaded = TRUE; @@ -107,7 +107,7 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) if (!g_CluiData.fLayered) ske_BltBackImage(bct->hwnd, hdc, nullptr); { - MODERNMASK Request = { 0 }; + MODERNMASK Request = {}; // int res; //HBRUSH br = CreateSolidBrush(RGB(255,255,255)); char * Value = nullptr; @@ -322,12 +322,12 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : 0; + ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : nullptr; if (bct) { if (bct->HandleService && IsBadStringPtrA(bct->HandleService, 255)) bct->HandleService = nullptr; else if (bct->HandleService && ServiceExists(bct->HandleService)) { - HandleServiceParams MSG = { 0 }; + HandleServiceParams MSG = {}; MSG.hwnd = hwndDlg; MSG.msg = msg; MSG.wParam = wParam; @@ -389,7 +389,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w case WM_PAINT: if (IsWindowVisible(hwndDlg) && !g_CluiData.fLayered) { - PAINTSTRUCT ps = { 0 }; + PAINTSTRUCT ps = {}; BeginPaint(hwndDlg, &ps); ModernSkinButtonPaintWorker(hwndDlg, (HDC)ps.hdc); EndPaint(hwndDlg, &ps); @@ -400,7 +400,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (bct) { bct->hover = 0; bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } break; @@ -409,7 +409,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (!bct->hover) { SetCapture(bct->hwnd); bct->hover = 1; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } else { POINT t = UNPACK_POINT(lParam); @@ -424,7 +424,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (bct) { bct->down = 1; SetForegroundWindow(GetParent(bct->hwnd)); - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) bct->CommandService = nullptr; if (bct->fCallOnPress) { @@ -434,7 +434,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w } bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); } } return 0; @@ -444,7 +444,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w ReleaseCapture(); bct->hover = 0; bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + ModernSkinButtonPaintWorker(bct->hwnd, nullptr); if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) bct->CommandService = nullptr; if (bct->CommandService) @@ -460,7 +460,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w HWND SetToolTip(HWND hwnd, wchar_t * tip) { TOOLINFO ti; - if (!tip) return 0; + if (!tip) return nullptr; mir_cslock lck(csTips); if (!hwndToolTips) { hwndToolTips = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, @@ -625,7 +625,7 @@ int ModernSkinButtonRedrawAll() for (DWORD i = 0; i < ButtonsCount; i++) { if (pcli->hwndContactList && Buttons[i].hwnd == nullptr) Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, pcli->hwndContactList); - ModernSkinButtonPaintWorker(Buttons[i].hwnd, 0); + ModernSkinButtonPaintWorker(Buttons[i].hwnd, nullptr); } g_mutex_bLockUpdating--; return 0; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 109bd8abf7..eaf30819f7 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -985,7 +985,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) HDC memdc = nullptr, glyphdc = nullptr; int k = 0; //BITMAP bmp = {0}; - HBITMAP membmp = 0, oldbmp = 0, oldglyph = 0; + HBITMAP membmp = nullptr, oldbmp = nullptr, oldglyph = nullptr; BYTE Is32Bit = 0; RECT PRect; POINT mode2offset = { 0 }; @@ -2467,7 +2467,7 @@ BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT form HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i) { - IMAGEINFO imi = { 0 }; + IMAGEINFO imi = {}; BITMAP bm = { 0 }; if (i != -1) { ImageList_GetImageInfo(himl, i, &imi); @@ -2712,7 +2712,7 @@ int ske_PrepareImageButDontUpdateIt(RECT *r) int ske_RedrawCompleteWindow() { if (g_CluiData.fLayered) { - ske_DrawNonFramedObjects(TRUE, 0); + ske_DrawNonFramedObjects(TRUE, nullptr); CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); } else RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); @@ -2755,7 +2755,7 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) // else { if (frm->UpdateRgn) { DeleteObject(frm->UpdateRgn); - frm->UpdateRgn = 0; + frm->UpdateRgn = nullptr; } ske_ValidateSingleFrameImage(frm, 0); ske_UpdateWindowImage(); @@ -2810,7 +2810,7 @@ static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) if (!frm->UpdateRgn) { frm->UpdateRgn = CreateRectRgn(0, 0, 1, 1); - CombineRgn(frm->UpdateRgn, r2, 0, RGN_COPY); + CombineRgn(frm->UpdateRgn, r2, nullptr, RGN_COPY); } else CombineRgn(frm->UpdateRgn, frm->UpdateRgn, r2, RGN_OR); DeleteObject(r2); @@ -2919,7 +2919,7 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) DeleteObject(rgnUpdate); } DeleteObject(Frame->UpdateRgn); - Frame->UpdateRgn = 0; + Frame->UpdateRgn = nullptr; if (!IsRectEmpty(&ru)) { x1 = ru.left; @@ -3060,7 +3060,7 @@ int ske_DrawNonFramedObjects(BOOL Erase, RECT *r) RECT w, wnd; if (r) w = *r; else CLUI_SizingGetWindowRect(pcli->hwndContactList, &w); - if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, nullptr); if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&w); @@ -3173,7 +3173,7 @@ int ske_UpdateWindowImage() GetWindowRect(pcli->hwndContactList, &r); return ske_UpdateWindowImageRect(&r); } - else ske_ReCreateBackImage(FALSE, 0); + else ske_ReCreateBackImage(FALSE, nullptr); ske_ApplyTranslucency(); return 0; } @@ -3184,7 +3184,7 @@ int ske_UpdateWindowImageRect(RECT *r) // Up //else Update using current alpha RECT wnd = *r; - if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, nullptr); if (g_pCachedWindow == nullptr) return ske_ValidateFrameImageProc(&wnd); if (g_pCachedWindow->Width != wnd.right - wnd.left || g_pCachedWindow->Height != wnd.bottom - wnd.top) return ske_ValidateFrameImageProc(&wnd); if (g_flag_bFullRepaint) { diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 58b137f97e..386b268fa1 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -90,7 +90,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_BUTTON_INFO: { HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -126,7 +126,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_BUTTON_APPLY_SKIN: if (HIWORD(wParam) == BN_CLICKED) { HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -255,7 +255,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), nullptr, TRUE); else { // prepare text HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); - if (hti == 0) + if (hti == nullptr) return 0; TVITEM tvi = { 0 }; @@ -380,7 +380,7 @@ HTREEITEM AddSkinToList(HWND hwndDlg, wchar_t *path, wchar_t *file) wchar_t fullName[MAX_PATH], defskinname[MAX_PATH]; SkinListData *sd = (SkinListData*)mir_alloc(sizeof(SkinListData)); if (!sd) - return 0; + return nullptr; if (!file || wcschr(file, '%')) { mir_snwprintf(sd->File, L"%%Default Skin%%"); @@ -435,9 +435,9 @@ HTREEITEM AddItemToTree(HWND hTree, wchar_t *itemName, void *data) { HTREEITEM cItem = nullptr; // Insert item node - cItem = FindChild(hTree, 0, itemName, data); + cItem = FindChild(hTree, nullptr, itemName, data); if (!cItem) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_PARAM; tvis.item.pszText = itemName; diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 01b73ea92d..214faf17b9 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -313,7 +313,7 @@ static BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate) BOOL CompareStrWithModernMask(char *szValue, MODERNMASK *mmTemplate) { - MODERNMASK mmValue = { 0 }; + MODERNMASK mmValue = {}; if (!ParseToModernMask(&mmValue, szValue)) { BOOL res = CompareModernMask(&mmValue, mmTemplate); SkinSelector_DeleteMask(&mmValue); @@ -328,7 +328,7 @@ int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODE if (!szStr || !mmTemplateList) return -1; - MODERNMASK mm = { 0 }; + MODERNMASK mm = {}; if (ParseToModernMask(&mm, szStr)) return -1; @@ -356,7 +356,7 @@ SKINOBJECTDESCRIPTOR* skin_FindObjectByRequest(char *szValue, LISTMODERNMASK *mm if (!mmTemplateList) return nullptr; - MODERNMASK mm = { 0 }; + MODERNMASK mm = {}; ParseToModernMask(&mm, szValue); SKINOBJECTDESCRIPTOR *res = skin_FindObjectByMask(&mm, mmTemplateList); SkinSelector_DeleteMask(&mm); diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index ee88bafa9a..8308345840 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -689,7 +689,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa rc = ProtosData[i].protoRect; if (PtInRect(&rc, pt)) { NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip, (WPARAM)ProtosData[i].szAccountName, 0); - CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(0, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), 0); + CLUI_SafeSetTimer(hwnd, TM_STATUSBARHIDE, db_get_w(0, "CLUIFrames", "HideToolTipTime", SETTING_HIDETOOLTIPTIME_DEFAULT), nullptr); tooltipshoing = TRUE; ClientToScreen(hwnd, &pt); ptToolTipShow = pt; @@ -733,7 +733,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ReleaseCapture(); } KillTimer(hwnd, TM_STATUSBAR); - CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(0, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), 0); + CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(0, "CLC", "InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME), nullptr); } return CLUI_TestCursorOnBorders(); @@ -893,7 +893,7 @@ HWND StatusBar_Create(HWND parent) CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)Frame.hWnd, (LPARAM)NewStatusPaintCallbackProc); //$$$$$ register sub for frame LoadStatusBarData(); - cliCluiProtocolStatusChanged(0, 0); + cliCluiProtocolStatusChanged(0, nullptr); CallService(MS_CLIST_FRAMES_UPDATEFRAME, -1, 0); return hModernStatusBar; } diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index 76c8b73eb8..43c942c6af 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -38,7 +38,7 @@ typedef struct _StatusBarProtocolOptions int PaddingRight; } StatusBarProtocolOptions; -static StatusBarProtocolOptions _GlobalOptions = { 0 }; +static StatusBarProtocolOptions _GlobalOptions = {}; static void UpdateXStatusIconOptions(HWND hwndDlg, StatusBarProtocolOptions &dat) { @@ -442,7 +442,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); LoadStatusBarData(); - cliCluiProtocolStatusChanged(0, 0); + cliCluiProtocolStatusChanged(0, nullptr); return TRUE; } break; diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 6cc33a1ecd..35457afc55 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -58,7 +58,7 @@ static void SetButtonPressed(int i, int state) void Modern_InitButtons() { for (int i = 0; i < _countof(BTNS); i++) { - TTBButton tbb = { 0 }; + TTBButton tbb = {}; if (BTNS[i].pszButtonID) { tbb.name = LPGEN(BTNS[i].pszButtonName); diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 7252400df4..aed452623f 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -34,13 +34,13 @@ $Id: viewmodes.c 2998 2006-06-01 07:11:52Z nightwish2004 $ #define TIMERID_VIEWMODEEXPIRE 100 typedef int(__cdecl *pfnEnumCallback)(char *szName); -static HWND clvmHwnd = 0; +static HWND clvmHwnd = nullptr; static int clvm_curItem = 0; -HMENU hViewModeMenu = 0; +HMENU hViewModeMenu = nullptr; -static HWND hwndSelector = 0; -static HIMAGELIST himlViewModes = 0; -static HANDLE hInfoItem = 0; +static HWND hwndSelector = nullptr; +static HIMAGELIST himlViewModes = nullptr; +static HANDLE hInfoItem = nullptr; static int nullImage; static DWORD stickyStatusMask = 0; static char g_szModename[2048]; @@ -676,7 +676,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRACOLUMNS, ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE, 0); CLCINFOITEM cii = { sizeof(cii) }; - cii.hParentGroup = 0; + cii.hParentGroup = nullptr; cii.pszText = TranslateT("*** All contacts ***"); hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); @@ -745,7 +745,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_DELETEVIEWMODE: - if (MessageBox(0, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { + if (MessageBox(nullptr, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0); if (iLen) { wchar_t *szTempBuf = (wchar_t*)_alloca((iLen + 1)*sizeof(wchar_t)); @@ -773,7 +773,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP T2Utf szUTF8Buf(szBuf); if (db_get_dw(0, CLVM_MODULE, szUTF8Buf, -1) != -1) - MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK); + MessageBox(nullptr, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK); else { int iNewItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf); if (iNewItem != LB_ERR) { @@ -957,11 +957,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcCLVMFrame; HDWP PosBatch = BeginDeferWindowPos(3); GetClientRect(hwnd, &rcCLVMFrame); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), nullptr, rcCLVMFrame.right - 23, 1, 22, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), nullptr, rcCLVMFrame.right - 45, 1, 22, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), nullptr, 1, 1, rcCLVMFrame.right - 46, 18, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); EndDeferWindowPos(PosBatch); } @@ -1102,7 +1102,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_CONFIGUREMODES: clvm_config_command : if (!g_ViewModeOptDlg) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0); break; } @@ -1187,7 +1187,7 @@ void CreateViewModeFrame() wndclass.hInstance = g_hInst; wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); - wndclass.lpszMenuName = 0; + wndclass.lpszMenuName = nullptr; wndclass.lpszClassName = L"CLVMFrameWindow"; RegisterClass(&wndclass); @@ -1199,7 +1199,7 @@ void CreateViewModeFrame() frame.TBtname = TranslateT("View modes"); frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE; frame.align = alBottom; - frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, nullptr); + frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr); g_hwndViewModeFrame = frame.hWnd; hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS); diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 42ce47c46c..49bbfd86f9 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -26,19 +26,19 @@ HANDLE hToolbarFrame = (HANDLE)-1; struct CluiTopButton BTNS[] = { - { IDC_TBTOPMENU, "CLN_topmenu", NULL, LPGEN("Show menu"), 1, 1, 1 }, - { IDC_TBHIDEOFFLINE, "CLN_online", NULL, LPGEN("Show/Hide offline contacts"), 0, 1, 0 }, - { IDC_TBHIDEGROUPS, "CLN_groups", NULL, LPGEN("Use/Disable groups"), 0, 1, 0 }, - { IDC_TBFINDANDADD, "CLN_findadd", NULL, LPGEN("Find and add contacts"), 1, 1, 0 }, - { IDC_TBACCOUNTS, "CLN_accounts", NULL, LPGEN("Accounts"), 1, 1, 0 }, - { IDC_TBOPTIONS, "CLN_options", NULL, LPGEN("Open preferences"), 1, 1, 0 }, + { IDC_TBTOPMENU, "CLN_topmenu", nullptr, LPGEN("Show menu"), 1, 1, 1 }, + { IDC_TBHIDEOFFLINE, "CLN_online", nullptr, LPGEN("Show/Hide offline contacts"), 0, 1, 0 }, + { IDC_TBHIDEGROUPS, "CLN_groups", nullptr, LPGEN("Use/Disable groups"), 0, 1, 0 }, + { IDC_TBFINDANDADD, "CLN_findadd", nullptr, LPGEN("Find and add contacts"), 1, 1, 0 }, + { IDC_TBACCOUNTS, "CLN_accounts", nullptr, LPGEN("Accounts"), 1, 1, 0 }, + { IDC_TBOPTIONS, "CLN_options", nullptr, LPGEN("Open preferences"), 1, 1, 0 }, { IDC_TBSOUND, "CLN_sound", "CLN_soundsoff", LPGEN("Enable/Disable sounds"), 0, 1, 0 }, - { IDC_TBMINIMIZE, "CLN_minimize", NULL, LPGEN("Minimize contact list"), 1, 0, 0 }, - { IDC_TBTOPSTATUS, "CLN_topstatus", NULL, LPGEN("Status menu"), 1, 0, 1 }, + { IDC_TBMINIMIZE, "CLN_minimize", nullptr, LPGEN("Minimize contact list"), 1, 0, 0 }, + { IDC_TBTOPSTATUS, "CLN_topstatus", nullptr, LPGEN("Status menu"), 1, 0, 1 }, - { IDC_TBSELECTVIEWMODE, "CLN_CLVM_select", NULL, LPGEN("Select view mode"), 1, 0, 1 }, - { IDC_TBCONFIGUREVIEWMODE, "CLN_CLVM_options", NULL, LPGEN("Setup view modes"), 1, 0, 0 }, - { IDC_TBCLEARVIEWMODE, "CLN_CLVM_reset", NULL, LPGEN("Clear view mode"), 1, 0, 0 } + { IDC_TBSELECTVIEWMODE, "CLN_CLVM_select", nullptr, LPGEN("Select view mode"), 1, 0, 1 }, + { IDC_TBCONFIGUREVIEWMODE, "CLN_CLVM_options", nullptr, LPGEN("Setup view modes"), 1, 0, 0 }, + { IDC_TBCLEARVIEWMODE, "CLN_CLVM_reset", nullptr, LPGEN("Clear view mode"), 1, 0, 0 } }; static int g_index = -1; @@ -46,7 +46,7 @@ static int g_index = -1; static void InitDefaultButtons() { for (int i = 0; i < _countof(BTNS); i++) { - TTBButton tbb = { 0 }; + TTBButton tbb = {}; g_index = i; if (BTNS[i].pszButtonID) { @@ -85,7 +85,7 @@ HWND ClcGetButtonWindow(int ctrlid) if (BTNS[i].ctrlid == ctrlid) return BTNS[i].hwndButton; - return NULL; + return nullptr; } int ClcGetButtonId(HWND hwnd) @@ -137,9 +137,9 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (hdcPaint) { HDC hdcMem; HBITMAP hbmMem; - HBITMAP hbmOld = 0; + HBITMAP hbmOld = nullptr; RECT rcClient; - HFONT hOldFont = 0; + HFONT hOldFont = nullptr; int xOffset = 0; GetClientRect(ctl->hwnd, &rcClient); @@ -259,7 +259,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) DeleteObject(hbr); } } - if (!ctl->bIsSkinned && ctl->buttonItem == 0) { + if (!ctl->bIsSkinned && ctl->buttonItem == nullptr) { if (ctl->stateId == PBS_HOT || ctl->focus) { if (ctl->bIsPushed) DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); @@ -317,12 +317,12 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) { int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2); int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2); - HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; + HICON hIconNew = ctl->hIconPrivate != nullptr ? ctl->hIconPrivate : ctl->hIcon; if (ctl->szText[0] == 0) { if (ctl->iIcon) ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); else - DrawState(hdcMem, NULL, NULL, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); ctl->sLabel.cx = ctl->sLabel.cy = 0; } else { @@ -337,7 +337,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (ctl->iIcon) ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); else - DrawState(hdcMem, NULL, NULL, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); xOffset = ix + g_cxsmIcon + 4; } } @@ -352,7 +352,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ix++; iy++; } - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); } if (GetWindowTextLength(ctl->hwnd)) { // Draw the text and optinally the arrow @@ -364,8 +364,8 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (!ctl->bIsSkinned) SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); if (ctl->arrow) - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); } if (hOldFont) SelectObject(hdcMem, hOldFont); @@ -400,7 +400,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (!lParam) break; - bct->hIml = 0; + bct->hIml = nullptr; bct->iIcon = 0; if (wParam == IMAGE_ICON) { ICONINFO ii = { 0 }; @@ -408,7 +408,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct->hIconPrivate) { DestroyIcon(bct->hIconPrivate); - bct->hIconPrivate = 0; + bct->hIconPrivate = nullptr; } GetIconInfo((HICON)lParam, &ii); @@ -420,24 +420,24 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); ImageList_RemoveAll(hImageList); ImageList_Destroy(hImageList); - bct->hIcon = 0; + bct->hIcon = nullptr; } else { bct->hIcon = (HICON)lParam; - bct->hIconPrivate = 0; + bct->hIconPrivate = nullptr; } DeleteObject(ii.hbmMask); DeleteObject(ii.hbmColor); - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == IMAGE_BITMAP) { bct->hBitmap = (HBITMAP)lParam; if (bct->hIconPrivate) DestroyIcon(bct->hIconPrivate); - bct->hIcon = bct->hIconPrivate = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hIcon = bct->hIconPrivate = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } return 1; @@ -446,14 +446,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR DestroyIcon(bct->hIconPrivate); bct->hIml = (HIMAGELIST)wParam; bct->iIcon = (int)lParam; - bct->hIcon = bct->hIconPrivate = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hIcon = bct->hIconPrivate = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BUTTONSETSKINNED: bct->bIsSkinned = wParam != 0; bct->bIsThemed = bct->bIsSkinned ? FALSE : bct->bIsThemed; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BUTTONSETBTNITEM: @@ -462,7 +462,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case BUTTONSETTTBUTTON: bct->bIsTTButton = wParam != 0; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_NCHITTEST: @@ -501,7 +501,7 @@ static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SelectObject(cfg::dat.hdcToolbar, cfg::dat.hbmToolbarOld); DeleteObject(cfg::dat.hbmToolbar); DeleteDC(cfg::dat.hdcToolbar); - cfg::dat.hdcToolbar = NULL; + cfg::dat.hdcToolbar = nullptr; } cfg::dat.hdcToolbar = CreateCompatibleDC(hdc); cfg::dat.hbmToolbar = CreateCompatibleBitmap(hdc, rcClient.right, rcClient.bottom); @@ -546,7 +546,7 @@ static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SelectObject(cfg::dat.hdcToolbar, cfg::dat.hbmToolbarOld); DeleteObject(cfg::dat.hbmToolbar); DeleteDC(cfg::dat.hdcToolbar); - cfg::dat.hdcToolbar = NULL; + cfg::dat.hdcToolbar = nullptr; } break; } diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index b4f3f9c54b..e6732b348d 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -157,7 +157,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if ((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) { if (!(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { SendMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); - MessageBox(0, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."), + MessageBox(nullptr, TranslateT("The contact list cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."), TranslateT("Contact list docking"), MB_OK); return 0; } @@ -261,7 +261,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) docked = 0; GetCursorPos(&pt); PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); - SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER); + SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2, pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, cluiPos.right, cluiPos.bottom, SWP_NOZORDER); } } return 1; diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index ab74b3363c..63010edbd8 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -48,7 +48,7 @@ DWORD __forceinline argb_from_cola(COLORREF col, UINT32 alpha) void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) { - HPEN hPenOld = 0; + HPEN hPenOld = nullptr; POINT pt; switch (BORDERSTYLE) { @@ -81,7 +81,7 @@ void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) } void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *imageItem) { - if (rc == NULL) + if (rc == nullptr) return; int ulBitmapWidth, ulBitmapHeight; @@ -215,8 +215,8 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor bmi.bmiHeader.biSizeImage = ulBitmapWidth * ulBitmapHeight * 4; void *pvBits; - HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - if (hbitmap == NULL || pvBits == NULL) { + HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); + if (hbitmap == nullptr || pvBits == nullptr) { DeleteDC(hdc); return; } @@ -290,9 +290,9 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor } // TL+BL CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); - if (hbitmap == 0 || pvBits == NULL) { + if (hbitmap == nullptr || pvBits == nullptr) { DeleteObject(BrMask); DeleteDC(hdc); return; @@ -330,7 +330,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor DeleteObject(hbitmap); // TR+BR CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); //SelectObject(hdc, BrMask); // already BrMask? holdbitmap = reinterpret_cast(SelectObject(hdc, hbitmap)); diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index a939ab948f..756e7ba60d 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -40,7 +40,7 @@ extern int during_sizing; HIMAGELIST hCListImages; -HANDLE hSvc_GetContactStatusMsg = 0; +HANDLE hSvc_GetContactStatusMsg = nullptr; static HRESULT(WINAPI *MyCloseThemeData)(HANDLE); @@ -67,7 +67,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) { DWORD new_freq = 0; - cfg::dat.t_now = time(NULL); + cfg::dat.t_now = time(nullptr); if (hContact && lParam) { DBEVENTINFO dbei = {}; @@ -80,7 +80,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) db_set_dw(hContact, "CList", "mf_freq", new_freq); db_set_dw(hContact, "CList", "mf_count", count); - TExtraCache *p = cfg::getCache(hContact, NULL); + TExtraCache *p = cfg::getCache(hContact, nullptr); if (p) { p->dwLastMsgTime = dbei.timestamp; if (new_freq) @@ -103,7 +103,7 @@ static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM) static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { - char *szProto = NULL; + char *szProto = nullptr; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; if (hContact) { @@ -117,15 +117,15 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); } - else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) { + else if (hContact != 0 && (szProto = GetContactProto(hContact)) != nullptr) { if (!__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam); if (cws->value.type == DBVT_DELETED) - szProto_s = NULL; + szProto_s = nullptr; else szProto_s = cws->value.pszVal; - pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, NULL)); + pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, nullptr)); } // something is being written to a protocol module if (!__strcmp(szProto, cws->szModule)) { @@ -167,7 +167,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) { SetButtonToSkinned(); } - else if (szProto == NULL) { + else if (szProto == nullptr) { if (!__strcmp(cws->szSetting, "XStatusId")) CluiProtocolStatusChanged(0, cws->szModule); } @@ -248,7 +248,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->bHideSubcontacts = true; cfg::clcdat = dat; if (cfg::dat.bShowLocalTime) - SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL); + SetTimer(hwnd, TIMERID_REFRESH, 65000, nullptr); } else dat->bisEmbedded = TRUE; @@ -275,16 +275,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); flags = contact->flags; } pcli->pfnDeleteItemFromTree(hwnd, wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, NULL, dat)) { + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, nullptr, dat)) { pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1); - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -310,10 +310,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L WORD status = ID_STATUS_OFFLINE; int contactRemoved = 0; MCONTACT hSelItem = NULL; - ClcContact *selcontact = NULL; + ClcContact *selcontact = nullptr; char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) status = ID_STATUS_OFFLINE; else status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); @@ -322,13 +322,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!Clist_FindItem(hwnd, dat, hContact, &contact, &group, NULL)) { + if (!Clist_FindItem(hwnd, dat, hContact, &contact, &group, nullptr)) { if (shouldShow && db_is_contact(wParam)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1) hSelItem = Clist_ContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); recalcScrollBar = 1; - Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL); + Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr); if (contact) { contact->iImage = (WORD)lParam; pcli->pfnNotifyNewContact(hwnd, hContact); @@ -341,7 +341,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (contact->iImage == (WORD)lParam) break; if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1) hSelItem = Clist_ContactToHItem(selcontact); pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); contactRemoved = TRUE; @@ -357,7 +357,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } if (hSelItem) { ClcGroup *selgroup; - if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr)) dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact)); else dat->selection = -1; @@ -371,7 +371,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_METACHANGED: - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) break; if (contact->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { @@ -381,7 +381,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (contact->pExtra) { TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto); ClcContact *subContact; - if (!Clist_FindItem(hwnd, dat, contact->hSubContact, &subContact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, contact->hSubContact, &subContact, nullptr, nullptr)) break; contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto); @@ -395,14 +395,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_METACHANGEDEVENT: - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) break; if (lParam == 0) pcli->pfnInitAutoRebuild(hwnd); return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_NAMECHANGED: - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) break; mir_wstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText)); @@ -413,7 +413,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_CODEPAGECHANGED: - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) break; contact->codePage = db_get_dw(wParam, "Tab_SRMsg", "ANSIcodepage", db_get_dw(wParam, "UserInfo", "ANSIcodepage", CP_ACP)); @@ -421,23 +421,23 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_AVATARCHANGED: - contact = NULL; + contact = nullptr; { AVATARCACHEENTRY *cEntry = (struct AVATARCACHEENTRY *)lParam; if (wParam == 0) { //RemoveFromImgCache(0, cEntry); cfg::dat.bForceRefetchOnPaint = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); cfg::dat.bForceRefetchOnPaint = FALSE; return DefWindowProc(hwnd, msg, wParam, lParam); } - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) return 0; contact->ace = cEntry; - if (cEntry == NULL) + if (cEntry == nullptr) contact->cFlags &= ~ECF_AVATAR; else { DWORD dwFlags; @@ -458,10 +458,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_STATUSMSGCHANGED: { TExtraCache *p; - char *szProto = NULL; + char *szProto = nullptr; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) - p = cfg::getCache(wParam, NULL); + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) + p = cfg::getCache(wParam, nullptr); else { p = contact->pExtra; szProto = contact->proto; @@ -472,11 +472,11 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_STATUSCHANGED: - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { WORD wStatus = db_get_w(wParam, contact->proto, "Status", ID_STATUS_OFFLINE); if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) { contact->wStatus = wStatus; - if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL) + if (cfg::dat.bAvatarServiceAvail && contact->ace == nullptr) LoadAvatarForContact(contact); } contact->wStatus = wStatus; @@ -485,7 +485,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L break; case INTM_PROTOCHANGED: - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) break; contact->proto = GetContactProto(wParam); @@ -501,7 +501,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_INVALIDATE: if (!dat->bNeedPaint) { KillTimer(hwnd, TIMERID_PAINT); - SetTimer(hwnd, TIMERID_PAINT, 100, NULL); + SetTimer(hwnd, TIMERID_PAINT, 100, nullptr); dat->bNeedPaint = true; } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -520,10 +520,10 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_IDLECHANGED: - if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { + if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = (char*)cws->szModule; - if (szProto == NULL) + if (szProto == nullptr) break; contact->flags &= ~CONTACTF_IDLE; @@ -542,7 +542,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MCONTACT hContact = wParam; TExtraCache *p; - if (!Clist_FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) { + if (!Clist_FindItem(hwnd, dat, hContact, &contact, nullptr, nullptr)) { p = cfg::getCache(hContact, szProto); if (!dat->bisEmbedded && szProto) { // may be a subcontact, forward the xstatus MCONTACT hMasterContact = db_mc_tryMeta(hContact); @@ -556,7 +556,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L p = contact->pExtra; } - if (szProto == NULL) + if (szProto == nullptr) break; if (contact) { @@ -582,7 +582,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->lastRepaint = GetTickCount(); } EndPaint(hwnd, &ps); - if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != NULL) { + if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != nullptr) { SetDBButtonStates(0); dat->oldSelection = dat->selection; } @@ -596,12 +596,12 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_TIMER: if (wParam == TIMERID_PAINT) { KillTimer(hwnd, TIMERID_PAINT); - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); } if (wParam == TIMERID_REFRESH) { - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return DefWindowProc(hwnd, msg, wParam, lParam); } break; @@ -614,11 +614,11 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd, TIMERID_INFOTIP); DWORD hitFlags; - dat->selection = HitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags); + dat->selection = HitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags); if (hitFlags & CLCHT_ONITEMEXTRA) break; - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); if (dat->selection != -1) pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); if (hitFlags & CLCHT_ONAVATAR && cfg::dat.bDblClkAvatars) { @@ -643,7 +643,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (pt.x == -1 && pt.y == -1) { - dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL); + dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, nullptr); if (dat->selection != -1) pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); pt.x = dat->iconXSpace + 15; @@ -652,19 +652,19 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } else { ScreenToClient(hwnd, &pt); - dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, NULL, &hitFlags); + dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, nullptr, &hitFlags); } - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); if (dat->selection != -1) pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); UpdateWindow(hwnd); - HMENU hMenu = NULL; + HMENU hMenu = nullptr; if (dat->selection != -1 && hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMCHECK | CLCHT_ONITEMLABEL)) { if (contact->type == CLCIT_GROUP) { hMenu = Menu_BuildSubGroupMenu(contact->group); ClientToScreen(hwnd, &pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED); DestroyMenu(hMenu); return 0; @@ -679,7 +679,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } if (hMenu != nullptr) { ClientToScreen(hwnd, &pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); DestroyMenu(hMenu); } } diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 2a39378da1..18859042a4 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -38,7 +38,7 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) DWORD flags = 0; if (cfg::dat.bShowLocalTimeSelective) flags |= TZF_DIFONLY; - c->hTimeZone = TimeZone_CreateByContact(hContact, 0, flags); + c->hTimeZone = TimeZone_CreateByContact(hContact, nullptr, flags); } //routines for managing adding/removal of items in the list, including sorting @@ -46,7 +46,7 @@ static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) ClcContact* CreateClcContact(void) { ClcContact* p = (ClcContact*)mir_calloc(sizeof(ClcContact)); - if (p != NULL) + if (p != nullptr) p->avatarLeft = p->extraIconRightBegin = p->xStatusIcon = -1; return p; @@ -82,15 +82,15 @@ void LoadAvatarForContact(ClcContact *p) else p->cFlags = (dwFlags & ECF_FORCEAVATAR ? p->cFlags | ECF_AVATAR : p->cFlags & ~ECF_AVATAR); - p->ace = NULL; + p->ace = nullptr; if (cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) { p->ace = (struct AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)p->hContact, 0); - if (p->ace != NULL && p->ace->cbSize != sizeof(struct AVATARCACHEENTRY)) - p->ace = NULL; - if (p->ace != NULL) + if (p->ace != nullptr && p->ace->cbSize != sizeof(struct AVATARCACHEENTRY)) + p->ace = nullptr; + if (p->ace != nullptr) p->ace->t_lastAccess = cfg::dat.t_now; } - if (p->ace == NULL) + if (p->ace == nullptr) p->cFlags &= ~ECF_AVATAR; } @@ -112,14 +112,14 @@ ClcContact* AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hCo } else { p->iImage = pcli->pfnGetContactIcon(hContact); - p->metaProto = NULL; + p->metaProto = nullptr; } p->codePage = db_get_dw(hContact, "Tab_SRMsg", "ANSIcodepage", db_get_dw(hContact, "UserInfo", "ANSIcodepage", CP_ACP)); p->bSecondLine = db_get_b(hContact, "CList", "CLN_2ndline", cfg::dat.dualRowMode); if (dat->bisEmbedded) - p->pExtra = 0; + p->pExtra = nullptr; else { p->pExtra = cfg::getCache(p->hContact, p->proto); GetExtendedInfo(p, dat); @@ -156,7 +156,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) { - if (p == NULL) + if (p == nullptr) return 0; p->bStatusMsgValid = STATUSMSG_NOTFOUND; @@ -241,7 +241,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) } } - if (p->hTimeZone == NULL) + if (p->hTimeZone == nullptr) TZ_LoadTimeZone(hContact, p); return p->bStatusMsgValid; } @@ -249,10 +249,10 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) void ReloadExtraInfo(MCONTACT hContact) { if (hContact && pcli->hwndContactTree) { - TExtraCache *p = cfg::getCache(hContact, NULL); + TExtraCache *p = cfg::getCache(hContact, nullptr); if (p) { TZ_LoadTimeZone(hContact, p); - InvalidateRect(pcli->hwndContactTree, NULL, FALSE); + InvalidateRect(pcli->hwndContactTree, nullptr, FALSE); } } } @@ -270,9 +270,9 @@ void RTL_DetectAndSet(ClcContact *contact, MCONTACT hContact) memset(infoTypeC2, 0, sizeof(infoTypeC2)); - if (contact == NULL) { + if (contact == nullptr) { szText = pcli->pfnGetContactDisplayName(hContact, 0); - p = cfg::getCache(hContact, NULL); + p = cfg::getCache(hContact, nullptr); } else { szText = contact->szText; @@ -316,14 +316,14 @@ void RTL_DetectGroupName(ClcContact *group) void GetExtendedInfo(ClcContact *contact, ClcData *dat) { - if (dat->bisEmbedded || contact == NULL) + if (dat->bisEmbedded || contact == nullptr) return; - if (contact->proto == NULL || contact->hContact == 0) + if (contact->proto == nullptr || contact->hContact == 0) return; TExtraCache *p = contact->pExtra; - if (p == NULL) + if (p == nullptr) return; p->msgFrequency = db_get_dw(contact->hContact, "CList", "mf_freq", 0x7fffffff); @@ -339,7 +339,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry) MCONTACT hContact = cEntry->hContact; if (db_get_b(hContact, "EXTBK", "VALID", 0)) { - if (cEntry->status_item == NULL) + if (cEntry->status_item == nullptr) cEntry->status_item = reinterpret_cast(malloc(sizeof(StatusItems_t))); memset(cEntry->status_item, 0, sizeof(StatusItems_t)); mir_strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item @@ -363,7 +363,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry) } else if (cEntry->status_item) { free(cEntry->status_item); - cEntry->status_item = NULL; + cEntry->status_item = nullptr; } } @@ -378,13 +378,13 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, struct ClcData int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. // always hide subcontacts (but show them on embedded contact lists) - if (dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) + if (dat != nullptr && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) return 1; if (!cfg::dat.bFilterEffective) return dbHidden; - if (szProto == NULL) + if (szProto == nullptr) szProto = GetContactProto(hContact); // check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set). if (cfg::dat.bFilterEffective & CLVM_STICKY_CONTACTS) { diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 3250d07ef1..d7f776e607 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -33,7 +33,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM { ClcContact *contact; ClcGroup *group; - if (wParam == 0 || !Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL)) + if (wParam == 0 || !Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr)) return 0; if (lParam) @@ -45,8 +45,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG: if (wParam) { - ClcContact *contact = NULL; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + ClcContact *contact = nullptr; + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) return 0; if (contact->type != CLCIT_CONTACT) @@ -64,8 +64,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT: if (wParam) { - ClcContact *contact = NULL; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + ClcContact *contact = nullptr; + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -77,8 +77,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT: if (wParam) { - ClcContact *contact = NULL; - if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) + ClcContact *contact = nullptr; + if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -96,7 +96,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM RowHeight::getMaxRowHeight(dat, hwnd); if (LOWORD(lParam)) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return 0; case CLM_ISMULTISELECT: diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 6a9b10a5b8..199026fc71 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -83,7 +83,7 @@ static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *value TVINSERTSTRUCT tvis; int i; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (i = 0; i < nValues; i++) { @@ -457,7 +457,7 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam KillTimer(pcli->hwndContactTree, TIMERID_REFRESH); if (cfg::dat.bShowLocalTime) - SetTimer(pcli->hwndContactTree, TIMERID_REFRESH, 65000, NULL); + SetTimer(pcli->hwndContactTree, TIMERID_REFRESH, 65000, nullptr); cfg::dat.dualRowMode = (BYTE)SendDlgItemMessage(hwndDlg, IDC_DUALROWMODE, CB_GETCURSEL, 0, 0); if (cfg::dat.dualRowMode == CB_ERR) @@ -750,7 +750,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 78d4f341fa..28c0c73405 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -225,7 +225,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) else { HICON hIcon = reinterpret_cast(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0)); DrawText(hDC, TranslateT("No events..."), -1, rc, DT_VCENTER | DT_SINGLELINE); - DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT); + DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT); DestroyIcon(hIcon); } } @@ -251,7 +251,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int LONG bmWidth, bmHeight; float dAspect; HBITMAP hbm, hbmOldAV; - HRGN rgn = 0; + HRGN rgn = nullptr; int avatar_size = cfg::dat.avatarSize; DWORD av_saved_left; StatusItems_t *item = contact->wStatus == ID_STATUS_OFFLINE ? arStatusItems[ID_EXTBKAVATARFRAMEOFFLINE - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKAVATARFRAME - ID_STATUS_OFFLINE]; @@ -262,7 +262,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int if (!cfg::dat.bAvatarServiceAvail || dat->bisEmbedded) return 0; - if (contact->ace != NULL && contact->ace->cbSize == sizeof(struct AVATARCACHEENTRY)) { + if (contact->ace != nullptr && contact->ace->cbSize == sizeof(struct AVATARCACHEENTRY)) { if (contact->ace->dwFlags & AVS_HIDEONCLIST) return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0; @@ -277,7 +277,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int } else return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0; - if (bmHeight == 0 || bmWidth == 0 || hbm == 0) + if (bmHeight == 0 || bmWidth == 0 || hbm == nullptr) return 0; g_maxAV_X = max(bmWidth, g_maxAV_X); @@ -344,15 +344,15 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int fOverlay = (dwFlags & ECF_FORCEOVERLAY) ? 1 : 0; if (fOverlay && cstatus && (int)newHeight >= g_cysmIcon) - DrawIconEx(hdcMem, rc->left + (int)newWidth - 15, y + topoffset + (int)newHeight - 15, overlayicons[cstatus - ID_STATUS_OFFLINE], g_cxsmIcon, g_cysmIcon, 0, 0, DI_NORMAL | DI_COMPAT); + DrawIconEx(hdcMem, rc->left + (int)newWidth - 15, y + topoffset + (int)newHeight - 15, overlayicons[cstatus - ID_STATUS_OFFLINE], g_cxsmIcon, g_cysmIcon, 0, nullptr, DI_NORMAL | DI_COMPAT); - SelectClipRgn(hdcMem, NULL); + SelectClipRgn(hdcMem, nullptr); DeleteObject(rgn); if (!item->IGNORED) { RECT rcFrame; BOOL inClCPaint_save = g_inCLCpaint; - HDC hdcTemp = 0; + HDC hdcTemp = nullptr; HBITMAP hbmOld, hbmTemp; g_inCLCpaint = FALSE; @@ -412,7 +412,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in DWORD leftOffset = 0, rightOffset = 0; int iconXSpace = dat->iconXSpace; //BOOL xStatusValid = 0; - HFONT hPreviousFont = 0; + HFONT hPreviousFont = nullptr; COLORREF oldGroupColor = -1; DWORD qLeft = 0; int leftX = dat->leftMargin + indent * dat->groupIndent; @@ -426,7 +426,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in rowHeight -= cfg::dat.bRowSpacing; savedCORNER = -1; - if (group == NULL || contact == NULL) + if (group == nullptr || contact == nullptr) return; g_RTL = FALSE; @@ -499,7 +499,7 @@ set_bg_l: else ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); - wchar_t *szCounts = NULL; + wchar_t *szCounts = nullptr; if (type == CLCIT_GROUP) { GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_wstrlen(contact->szText), &textSize); int width = textSize.cx; @@ -589,7 +589,7 @@ set_bg_l: // check for special cases (first item, single item, last item) // this will only change the shape for this status. Color will be blended over with ALPHA value - if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.getCount() == 1 && group->parent != NULL) { + if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.getCount() == 1 && group->parent != nullptr) { rc.left = ssingleitem->MARGIN_LEFT + bg_indent_l; rc.top = y + ssingleitem->MARGIN_TOP; rc.right = clRect->right - ssingleitem->MARGIN_RIGHT - bg_indent_r; @@ -613,7 +613,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, ssingleitem->COLOR, ssingleitem->ALPHA, ssingleitem->COLOR2, ssingleitem->COLOR2_TRANSPARENT, ssingleitem->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, ssingleitem->imageItem); } - else if (scanIndex == 0 && group->cl.getCount() > 1 && !sfirstitem->IGNORED && group->parent != NULL) { + else if (scanIndex == 0 && group->cl.getCount() > 1 && !sfirstitem->IGNORED && group->parent != nullptr) { rc.left = sfirstitem->MARGIN_LEFT + bg_indent_l; rc.top = y + sfirstitem->MARGIN_TOP; rc.right = clRect->right - sfirstitem->MARGIN_RIGHT - bg_indent_r; @@ -637,7 +637,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, sfirstitem->COLOR, sfirstitem->ALPHA, sfirstitem->COLOR2, sfirstitem->COLOR2_TRANSPARENT, sfirstitem->GRADIENT, sfirstitem->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem); } - else if (scanIndex == group->cl.getCount() - 1 && !slastitem->IGNORED && group->parent != NULL) { + else if (scanIndex == group->cl.getCount() - 1 && !slastitem->IGNORED && group->parent != nullptr) { // last item of group rc.left = slastitem->MARGIN_LEFT + bg_indent_l; rc.top = y + slastitem->MARGIN_TOP; @@ -663,7 +663,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, slastitem->COLOR, slastitem->ALPHA, slastitem->COLOR2, slastitem->COLOR2_TRANSPARENT, slastitem->GRADIENT, slastitem->CORNER, slastitem->BORDERSTYLE, slastitem->imageItem); } // --- Non-grouped items --- - else if (type != CLCIT_GROUP && group->parent == NULL && !sfirstitem_NG->IGNORED && scanIndex != group->cl.getCount() - 1 && !(*bFirstNGdrawn)) { + else if (type != CLCIT_GROUP && group->parent == nullptr && !sfirstitem_NG->IGNORED && scanIndex != group->cl.getCount() - 1 && !(*bFirstNGdrawn)) { // first NON-grouped *bFirstNGdrawn = TRUE; rc.left = sfirstitem_NG->MARGIN_LEFT + bg_indent_l; @@ -689,7 +689,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, sfirstitem_NG->COLOR, sfirstitem_NG->ALPHA, sfirstitem_NG->COLOR2, sfirstitem_NG->COLOR2_TRANSPARENT, sfirstitem_NG->GRADIENT, sfirstitem_NG->CORNER, sfirstitem->BORDERSTYLE, sfirstitem->imageItem); } - else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && scanIndex == group->cl.getCount() - 1 && (*bFirstNGdrawn)) { + else if (type != CLCIT_GROUP && group->parent == nullptr && !slastitem_NG->IGNORED && scanIndex == group->cl.getCount() - 1 && (*bFirstNGdrawn)) { // last item of list (NON-group) // last NON-grouped rc.left = slastitem_NG->MARGIN_LEFT + bg_indent_l; @@ -715,7 +715,7 @@ set_bg_l: if (check_selected) DrawAlpha(hdcMem, &rc, slastitem_NG->COLOR, slastitem_NG->ALPHA, slastitem_NG->COLOR2, slastitem_NG->COLOR2_TRANSPARENT, slastitem_NG->GRADIENT, slastitem_NG->CORNER, slastitem->BORDERSTYLE, slastitem->imageItem); } - else if (type != CLCIT_GROUP && group->parent == NULL && !slastitem_NG->IGNORED && !(*bFirstNGdrawn)) { + else if (type != CLCIT_GROUP && group->parent == nullptr && !slastitem_NG->IGNORED && !(*bFirstNGdrawn)) { // single item of NON-group // single NON-grouped rc.left = ssingleitem_NG->MARGIN_LEFT + bg_indent_l; @@ -848,11 +848,11 @@ bgskipped: rcContent.right = clRect->right - dat->rightMargin; twoRows = ((dat->fontInfo[FONTID_STATUS].fontHeight + fontHeight <= rowHeight + 1) && (contact->bSecondLine != MULTIROW_NEVER)) && !dat->bisEmbedded; - pi_avatar = !dat->bisEmbedded && type == CLCIT_CONTACT && (contact->cFlags & ECF_AVATAR) && contact->ace != 0 && !(contact->ace->dwFlags & AVS_HIDEONCLIST); + pi_avatar = !dat->bisEmbedded && type == CLCIT_CONTACT && (contact->cFlags & ECF_AVATAR) && contact->ace != nullptr && !(contact->ace->dwFlags & AVS_HIDEONCLIST); //checkboxes if (checkboxWidth) { - HANDLE hTheme = 0; + HANDLE hTheme = nullptr; if (IS_THEMED) hTheme = OpenThemeData(hwnd, L"BUTTON"); @@ -864,7 +864,7 @@ bgskipped: if (hTheme) { DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc2, &rc2); CloseThemeData(hTheme); - hTheme = 0; + hTheme = nullptr; } else DrawFrameControl(hdcMem, &rc2, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); @@ -1136,7 +1136,7 @@ bgskipped: rc2.left = rcContent.right - szTime.cx - 2; } DrawText(hdcMem, szResult, -1, &rc2, DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE); - ChangeToFont(hdcMem, dat, idOldFont, 0); + ChangeToFont(hdcMem, dat, idOldFont, nullptr); SetTextColor(hdcMem, oldColor); verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); @@ -1278,11 +1278,11 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) hbmTempAV = CreateCompatibleBitmap(g_HDC, g_maxAV_X, g_maxAV_Y); hbmTempOldAV = reinterpret_cast(SelectObject(hdcTempAV, hbmTempAV)); - cfg::dat.t_now = time(NULL); + cfg::dat.t_now = time(nullptr); GetSystemTime(&cfg::dat.st); SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft); - cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != 0); + cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != nullptr); av_left = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSLEFT); av_right = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSRIGHT); @@ -1300,7 +1300,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS) grey = 1; GetClientRect(hwnd, &clRect); - if (rcPaint == NULL) + if (rcPaint == nullptr) rcPaint = &clRect; if (IsRectEmpty(rcPaint)) { SelectObject(hdcTempAV, hbmTempOldAV); @@ -1313,7 +1313,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) int y = -dat->yScroll; HDC hdcMem = CreateCompatibleDC(hdc); - HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr); HBITMAP hOldBitmap = reinterpret_cast(SelectObject(hdcMem, hBmpOsb)); @@ -1414,7 +1414,7 @@ bgdone: ClcGroup *group = &dat->list; group->scanIndex = 0; - if (dat->row_heights == NULL) + if (dat->row_heights == nullptr) RowHeight::calcRowHeights(dat, hwnd); group = &dat->list; @@ -1423,7 +1423,7 @@ bgdone: g_list_avatars = 0; while (true) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -1448,7 +1448,7 @@ bgdone: int indent = 0; for (int index = 0; y < rcPaint->bottom;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; indent--; diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 81b1839869..c898aec8c3 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -115,7 +115,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac right = clRect.right; // avatar check - if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) + if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != nullptr && hitcontact->avatarLeft != -1) if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize) if (flags) *flags |= CLCHT_ONAVATAR; @@ -196,8 +196,8 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontac int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags) { - ClcContact *hitcontact = NULL; - ClcGroup *hitgroup = NULL; + ClcContact *hitcontact = nullptr; + ClcGroup *hitgroup = nullptr; int indent, width, i; int checkboxWidth; SIZE textSize; @@ -256,7 +256,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c } // avatar check - if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { + if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != nullptr && hitcontact->avatarLeft != -1) { if (testx > hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) { if (flags) *flags |= CLCHT_ONAVATAR; @@ -366,10 +366,10 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) if (nowTick >= startTick + dat->scrollTime) break; dat->yScroll = oldy + (desty - oldy) * (int)(nowTick - startTick) / dat->scrollTime; - if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) - ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); + if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr) + ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE); else - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); previousy = dat->yScroll; if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); @@ -379,14 +379,14 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) } } dat->yScroll = desty; - if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) { + if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr) { if (!noSmooth) - ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); + ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE); else - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); } else - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); @@ -453,7 +453,7 @@ void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newStat return; group->expanded = newState != 0; } - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); contentCount = pcli->pfnGetGroupContentsCount(group, 1); groupy = pcli->pfnGetRowsPriorTo(&dat->list, group, -1); @@ -536,7 +536,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) if (h < dat->fontInfo[i].fontHeight + 2) h = dat->fontInfo[i].fontHeight + 2; } - dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, NULL, g_hInst, NULL); + dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, nullptr, g_hInst, nullptr); { if ((contact->type == CLCIT_CONTACT && contact->pExtra->dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) { PARAFORMAT2 pf2; @@ -599,8 +599,8 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) if (cfg::dat.hdcPic) { SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); DeleteDC(cfg::dat.hdcPic); - cfg::dat.hdcPic = 0; - cfg::dat.hbmPicOld = 0; + cfg::dat.hdcPic = nullptr; + cfg::dat.hbmPicOld = nullptr; } } @@ -618,14 +618,14 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) char wpbuf[MAX_PATH]; if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); - dat->hBmpBackground = NULL; + dat->hBmpBackground = nullptr; } SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, wpbuf, 0); // we have a wallpaper string if (wpbuf[0] != 0) - dat->hBmpBackground = reinterpret_cast(LoadImageA(NULL, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); + dat->hBmpBackground = reinterpret_cast(LoadImageA(nullptr, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); cfg::dat.bmpBackground = dat->hBmpBackground; if (cfg::dat.bmpBackground) { diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index e2cd2825d2..c56e691fa1 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -25,14 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "cluiframes.h" -static HWND hwndEventFrame = 0; +static HWND hwndEventFrame = nullptr; HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); extern FRAMEWND *wndFrameEventArea; extern HPEN g_hPenCLUIFrames; -HWND g_hwndEventArea = 0; +HWND g_hwndEventArea = nullptr; struct CListImlIcon { @@ -71,7 +71,7 @@ static CLISTEVENT* MyGetEvent(int iSelection) if (p.menuId == iSelection) return &p; } - return NULL; + return nullptr; } LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -110,7 +110,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (dis->hwndItem == (HWND)cfg::dat.hMenuNotify) { MENUITEMINFOA mii = { 0 }; - struct NotifyMenuItemExData *nmi = 0; + struct NotifyMenuItemExData *nmi = nullptr; int iIcon; HICON hIcon; @@ -136,7 +136,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_COMMAND: if (LOWORD(wParam) == IDC_NOTIFYBUTTON) { int iSelection; - struct NotifyMenuItemExData *nmi = 0; + struct NotifyMenuItemExData *nmi = nullptr; int iCount = GetMenuItemCount(cfg::dat.hMenuNotify); POINT pt; @@ -146,7 +146,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; if (iCount > 1) - iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + iSelection = TrackPopupMenu(cfg::dat.hMenuNotify, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); else iSelection = GetMenuItemID(cfg::dat.hMenuNotify, 0); @@ -156,12 +156,12 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (nmi) { CLISTEVENT *cle = MyGetEvent(iSelection); if (cle) { - CLISTEVENT *cle1 = NULL; + CLISTEVENT *cle1 = nullptr; CallService(cle->pszService, (WPARAM)NULL, (LPARAM)cle); // re-obtain the pointer, it may already be invalid/point to another event if the // event we're interested in was removed by the service (nasty one...) cle1 = MyGetEvent(iSelection); - if (cle1 != NULL) + if (cle1 != nullptr) pcli->pfnRemoveEvent(cle->hContact, cle->hDbEvent); } } @@ -186,7 +186,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa HBITMAP hbmold = reinterpret_cast(SelectObject(hdcMem, hbm)); SetBkMode(hdcMem, TRANSPARENT); - HFONT hFontOld = 0; + HFONT hFontOld = nullptr; if (cfg::clcdat) { int height; hFontOld = ChangeToFont(hdcMem, cfg::clcdat, FONTID_EVENTAREA, &height); @@ -247,7 +247,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) for (int j = 0; j < GetMenuItemCount(cfg::dat.hMenuNotify); j++) { if (GetMenuItemInfo(cfg::dat.hMenuNotify, j, TRUE, &mii) != 0) { NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)mii.dwItemData; - if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex) + if (nmi != nullptr && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex) return p; } } @@ -304,7 +304,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) HideShowNotifyFrame(); } } - InvalidateRect(hwndEventFrame, NULL, FALSE); + InvalidateRect(hwndEventFrame, nullptr, FALSE); return p; } @@ -363,7 +363,7 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) cfg::dat.hUpdateContact = 0; if (cfg::dat.notifyActive) - InvalidateRect(hwndEventFrame, NULL, FALSE); + InvalidateRect(hwndEventFrame, nullptr, FALSE); return res; } diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 7f33b59866..0aef011081 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -45,7 +45,7 @@ INT_PTR CloseAction(WPARAM, LPARAM) return 0; } -static MWindowList hWindowListIGN = 0; +static MWindowList hWindowListIGN = nullptr; // dialog procedure for handling the contact ignore dialog (available from the contact menu static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -56,7 +56,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_INITDIALOG: { DWORD dwMask; - ClcContact *contact = NULL; + ClcContact *contact = nullptr; int pCaps; HWND hwndAdd; @@ -91,7 +91,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message")); if (cfg::clcdat) { - Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); + Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr); if (contact && contact->type != CLCIT_CONTACT) { DestroyWindow(hWnd); return FALSE; @@ -192,7 +192,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case IDOK: { DWORD newMask = 0; - ClcContact *contact = NULL; + ClcContact *contact = nullptr; SendMessage(hWnd, WM_USER + 110, 0, (LPARAM)&newMask); db_set_dw(hContact, "Ignore", "Mask1", newMask); @@ -203,7 +203,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA DWORD dwFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0), dwXMask = 0; LRESULT checked = 0; - Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); + Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr); if (iSel != CB_ERR) { dwFlags &= ~(ECF_FORCEAVATAR | ECF_HIDEAVATAR); @@ -249,7 +249,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA contact->pExtra->dwDFlags = dwFlags; } else { - TExtraCache *p = cfg::getCache(hContact, NULL); + TExtraCache *p = cfg::getCache(hContact, nullptr); if (p) p->dwDFlags = dwFlags; } @@ -289,8 +289,8 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 120: // set visibility status { - ClcContact *contact = NULL; - if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + ClcContact *contact = nullptr; + if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr)) { if (contact) { WORD wApparentMode = db_get_w(contact->hContact, contact->proto, "ApparentMode", 0); @@ -303,9 +303,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 130: // update apparent mode { - ClcContact *contact = NULL; + ClcContact *contact = nullptr; - if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + if (Clist_FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, nullptr, nullptr)) { if (contact) { WORD wApparentMode = 0; @@ -343,15 +343,15 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM) { - HWND hWnd = 0; + HWND hWnd = nullptr; - if (hWindowListIGN == 0) + if (hWindowListIGN == nullptr) hWindowListIGN = WindowList_Create(); hWnd = WindowList_Find(hWindowListIGN, wParam); if (wParam) { - if (hWnd == 0) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), 0, IgnoreDialogProc, (LPARAM)wParam); + if (hWnd == nullptr) + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), nullptr, IgnoreDialogProc, (LPARAM)wParam); else if (IsWindow(hWnd)) SetFocus(hWnd); } diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index f064fe4a3a..782ada2086 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -40,13 +40,13 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON *phIcon) { - if (phIcon != NULL) - *phIcon = NULL; + if (phIcon != nullptr) + *phIcon = nullptr; char *szFinalProto; int finalStatus; - if (szProto != NULL && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { + if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { MCONTACT hSubContact = db_mc_getMostOnline(hContact); szFinalProto = GetContactProto(hSubContact); finalStatus = (status == 0) ? (WORD)db_get_w(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; @@ -57,7 +57,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON finalStatus = status; } - if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) { + if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != nullptr) { if (szProto) { char szBuf[128]; mir_snprintf(szBuf, "%s_conn", szProto); @@ -100,9 +100,9 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) POINT pt = { 0 }; register int i = 0, j = 0, width = 0, height = 0, iCountedDots = 0, iNotCoveredDots = 0; BOOL bPartiallyCovered = FALSE; - HWND hAux = 0; + HWND hAux = nullptr; - if (hWnd == NULL) { + if (hWnd == nullptr) { SetLastError(0x00000006); //Wrong handle return -1; } @@ -111,7 +111,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (IsIconic(hWnd) || !IsWindowVisible(hWnd)) return GWVS_HIDDEN; - HRGN rgn = 0; + HRGN rgn = nullptr; POINT ptOrig; RECT rcClient; int clip = (int)cfg::dat.bClipBorder; @@ -153,7 +153,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) for (j = rc.left + clip; j < rc.right; j += (width / iStepX)) { pt.x = j; hAux = WindowFromPoint(pt); - while (GetParent(hAux) != NULL) + while (GetParent(hAux) != nullptr) hAux = GetParent(hAux); if (hAux != hWnd && hAux) //There's another window! bPartiallyCovered = TRUE; diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index ce0708eb27..c2aa4a74d8 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { MCONTACT hContact = wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam; - if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) + if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr && strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED); } break; diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 7196bb68e4..7669cfc678 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -44,31 +44,31 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); return pcli->pfnTrayIconSetBaseInfo(hIcon, szChangedProto); } - if (pcli->trayIcon == NULL || pcli->trayIcon[0].szProto == NULL) { - iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon); + if (pcli->trayIcon == nullptr || pcli->trayIcon[0].szProto == nullptr) { + iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); + return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr); } pcli->pfnTrayIconDestroy(hwnd); pcli->pfnTrayIconInit(hwnd); } else { - iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon); + iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); + return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr); } } else { switch (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT)) { case SETTING_TRAYICON_CYCLE: iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon); - pcli->cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc); + pcli->cycleTimerId = SetTimer(nullptr, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); + return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr); case SETTING_TRAYICON_MULTI: if (!pcli->trayIcon) - pcli->pfnTrayIconRemove(NULL, NULL); + pcli->pfnTrayIconRemove(nullptr, nullptr); else if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) { iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); @@ -82,14 +82,14 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus")); iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); + return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr); } } } else { - iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon); + iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL); + return pcli->pfnTrayIconSetBaseInfo(hIcon, nullptr); } return -1; diff --git a/plugins/Clist_nicer/src/clnplus.cpp b/plugins/Clist_nicer/src/clnplus.cpp index b150537963..789f599d34 100644 --- a/plugins/Clist_nicer/src/clnplus.cpp +++ b/plugins/Clist_nicer/src/clnplus.cpp @@ -11,7 +11,7 @@ void RemoveFromTaskBar(HWND hWnd) { CComPtr pTaskbarList; - if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER))) + if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER))) if (SUCCEEDED(pTaskbarList->HrInit())) pTaskbarList->DeleteTab(hWnd); } @@ -19,7 +19,7 @@ void RemoveFromTaskBar(HWND hWnd) void AddToTaskBar(HWND hWnd) { CComPtr pTaskbarList; - if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER))) + if (SUCCEEDED(pTaskbarList.CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER))) if (SUCCEEDED(pTaskbarList->HrInit())) pTaskbarList->AddTab(hWnd); } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 85bd05e0a4..9bdcd016e6 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -79,8 +79,8 @@ POINT g_oldPos = { 0 }; int during_sizing = 0; extern int dock_prevent_moving; -static HDC hdcLockedPoint = 0; -static HBITMAP hbmLockedPoint = 0, hbmOldLockedPoint = 0; +static HDC hdcLockedPoint = nullptr; +static HBITMAP hbmLockedPoint = nullptr, hbmOldLockedPoint = nullptr; HICON overlayicons[10]; @@ -118,7 +118,7 @@ static void LayoutButtons(HWND hwnd, RECT *rc) BYTE delta = left_offset + right_offset; ButtonItem *btnItems = g_ButtonItems; - if (rc == NULL) + if (rc == nullptr) GetClientRect(hwnd, &rect); else rect = *rc; @@ -130,15 +130,15 @@ static void LayoutButtons(HWND hwnd, RECT *rc) LONG x = (btnItems->xOff >= 0) ? rect.left + btnItems->xOff : rect.right - abs(btnItems->xOff); LONG y = (btnItems->yOff >= 0) ? rect.top + btnItems->yOff : rect.bottom - cfg::dat.statusBarHeight; - SetWindowPos(btnItems->hWnd, 0, x, y, btnItems->width, btnItems->height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); + SetWindowPos(btnItems->hWnd, nullptr, x, y, btnItems->width, btnItems->height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); btnItems = btnItems->nextItem; } } - SetWindowPos(hTbMenu, 0, 2 + left_offset, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, + SetWindowPos(hTbMenu, nullptr, 2 + left_offset, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, 21 * 3, 21 + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); - SetWindowPos(hTbGlobalStatus, 0, left_offset + (3 * 21) + 3, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, + SetWindowPos(hTbGlobalStatus, nullptr, left_offset + (3 * 21) + 3, rect.bottom - cfg::dat.statusBarHeight - 21 - 1, rect.right - delta - (3 * 21 + 5), 21 + 1, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOREDRAW); } @@ -152,7 +152,7 @@ static int FS_FontsChanged(WPARAM, LPARAM) g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, clr_cluiframes); pcli->pfnClcOptionsChanged(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -166,7 +166,7 @@ static HWND PreCreateCLC(HWND parent) | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) | (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0) | CLS_MULTICOLUMN, - 0, 0, 0, 0, parent, NULL, g_hInst, (LPVOID)0xff00ff00); + 0, 0, 0, 0, parent, nullptr, g_hInst, (LPVOID)0xff00ff00); cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); return pcli->hwndContactTree; @@ -187,7 +187,7 @@ static int CreateCLC() frame.height = 20; frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE; frame.align = alBottom; - frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL); + frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr); g_hwndEventArea = frame.hWnd; hNotifyFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hNotifyFrame, FU_FMPOS); @@ -224,15 +224,15 @@ static int CluiModulesLoaded(WPARAM, LPARAM) return 0; } -static HICON hIconSaved = 0; +static HICON hIconSaved = nullptr; void ClearIcons(int mode) { for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) { - if (overlayicons[i - IDI_OVL_OFFLINE] != 0) { + if (overlayicons[i - IDI_OVL_OFFLINE] != nullptr) { if (mode) DestroyIcon(overlayicons[i - IDI_OVL_OFFLINE]); - overlayicons[i - IDI_OVL_OFFLINE] = 0; + overlayicons[i - IDI_OVL_OFFLINE] = nullptr; } } } @@ -259,7 +259,7 @@ static void InitIcoLib() Icon_RegisterT(g_hInst, LPGENW("Contact list") L"/" LPGENW("Overlay icons"), &icon, 1); } - PROTOACCOUNT **accs = NULL; + PROTOACCOUNT **accs = nullptr; int p_count = 0; Proto_EnumAccounts(&p_count, &accs); for (int k = 0; k < p_count; k++) { @@ -281,14 +281,14 @@ static int IcoLibChanged(WPARAM, LPARAM) void CreateButtonBar(HWND hWnd) { - hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_hInst, NULL); + hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_hInst, nullptr); CustomizeButton(hTbMenu, false, false, false); SetWindowText(hTbMenu, TranslateT("Menu")); SendMessage(hTbMenu, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MAINMENU)); SendMessage(hTbMenu, BUTTONSETSENDONDOWN, TRUE, 0); SendMessage(hTbMenu, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Open main menu"), 0); - hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_hInst, NULL); + hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_hInst, nullptr); CustomizeButton(hTbGlobalStatus, false, false, false); SetWindowText(hTbGlobalStatus, TranslateT("Offline")); SendMessage(hTbGlobalStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_STATUS_OFFLINE)); @@ -379,10 +379,10 @@ void SetDBButtonStates(MCONTACT hPassedContact) ButtonItem *buttonItem = g_ButtonItems; MCONTACT hContact = 0, hFinalContact = 0; char *szModule, *szSetting; - ClcContact *contact = 0; + ClcContact *contact = nullptr; if (cfg::clcdat && hPassedContact == 0) { - pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, NULL); + pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, nullptr); if (contact && contact->type == CLCIT_CONTACT) { hContact = contact->hContact; } @@ -475,7 +475,7 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) BITMAP *bmp = &cfg::dat.bminfoBg; LONG clip = cfg::dat.bClipBorder; - if (dat == 0) + if (dat == nullptr) return; SetStretchBltMode(hdc, HALFTONE); @@ -545,7 +545,7 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) for (x = rc->left; x < maxx; x += destw) StretchBlt(hdc, x, y, destw, desth, cfg::dat.hdcPic, bitx, bity, bmp->bmWidth, bmp->bmHeight, SRCCOPY); } - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); DeleteObject(my_rgn); } @@ -586,7 +586,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (Docking_IsDocked(0, 0)) return; - if (hFrameContactTree == 0) + if (hFrameContactTree == nullptr) return; maxHeight = db_get_b(NULL, "CLUI", "MaxSizeHeight", 75); @@ -632,14 +632,14 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) return; } KillTimer(hwnd, TIMERID_AUTOSIZE); - SetTimer(hwnd, TIMERID_AUTOSIZE, 100, 0); + SetTimer(hwnd, TIMERID_AUTOSIZE, 100, nullptr); } int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) { switch (nmcsbcd->hdr.code) { case NM_COOLSB_CUSTOMDRAW: - static HDC hdcScroll = 0; + static HDC hdcScroll = nullptr; static HBITMAP hbmScroll, hbmScrollOld; static LONG scrollLeft, scrollRight, scrollHeight, scrollYmin, scrollYmax; @@ -654,9 +654,9 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) case CDDS_ITEMPREPAINT: HDC hdc = nmcsbcd->hdc; - StatusItems_t *item = 0, *arrowItem = 0; + StatusItems_t *item = nullptr, *arrowItem = nullptr; UINT uItemID = ID_EXTBKSCROLLBACK; - HRGN rgn = 0; + HRGN rgn = nullptr; RECT rc; GetWindowRect(pcli->hwndContactTree, &rc); @@ -709,7 +709,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags); if (rgn) { - SelectClipRgn(hdcScroll, NULL); + SelectClipRgn(hdcScroll, nullptr); DeleteObject(rgn); } } @@ -738,7 +738,7 @@ static void ShowCLUI(HWND hwnd) SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); if (!db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) - SetMenu(pcli->hwndContactList, NULL); + SetMenu(pcli->hwndContactList, nullptr); if (state == SETTING_STATE_NORMAL) { SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); ShowWindow(pcli->hwndContactList, SW_SHOWNORMAL); @@ -782,7 +782,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int flags = WS_CHILD | CCS_BOTTOM; flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; - pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, hwnd, NULL, g_hInst, NULL); + pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr); if (flags & WS_VISIBLE) { ShowWindow(pcli->hwndStatus, SW_SHOW); SendMessage(pcli->hwndStatus, WM_SIZE, 0, 0); @@ -798,7 +798,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!cfg::dat.bFirstRun) ConfigureEventArea(); ConfigureCLUIGeometry(0); - CluiProtocolStatusChanged(0, 0); + CluiProtocolStatusChanged(0, nullptr); for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) statusNames[i - ID_STATUS_OFFLINE] = pcli->pfnGetStatusModeDescription(i, 0); @@ -853,7 +853,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, style); ApplyCLUIBorderStyle(); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); } if (cfg::dat.bSkinnedButtonMode) @@ -906,7 +906,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l PAINTSTRUCT ps; RECT rcFrame, rcClient; HDC hdc; - HRGN rgn = 0; + HRGN rgn = nullptr; HDC hdcReal = BeginPaint(hwnd, &ps); if (during_sizing) @@ -948,7 +948,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l CopyRect(&rcFrame, &rcClient); if (g_CLUISkinnedBkColor) { if (cfg::dat.fOnDesktop) { - HDC dc = GetDC(0); + HDC dc = GetDC(nullptr); RECT rcWin; GetWindowRect(hwnd, &rcWin); @@ -990,7 +990,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l rcFrame.top += (cfg::dat.topOffset - 1); if (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN) { - if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { + if (cfg::dat.bWallpaperMode && cfg::clcdat != nullptr) { InflateRect(&rcFrame, -1, -1); if (cfg::dat.bmpBackground) BlitWallpaper(hdc, &rcFrame, cfg::clcdat); @@ -1002,7 +1002,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l rcFrame.bottom -= (cfg::dat.bottomOffset); DrawEdge(hdc, &rcFrame, BDR_SUNKENOUTER, BF_RECT); } - else if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { + else if (cfg::dat.bWallpaperMode && cfg::clcdat != nullptr) { if (cfg::dat.bmpBackground) BlitWallpaper(hdc, &rcFrame, cfg::clcdat); cfg::dat.ptW.x = cfg::dat.ptW.y = 0; @@ -1011,7 +1011,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l skipbg: BitBlt(hdcReal, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdc, 0, 0, SRCCOPY); if (rgn) { - SelectClipRgn(hdc, NULL); + SelectClipRgn(hdc, nullptr); DeleteObject(rgn); } EndPaint(hwnd, &ps); @@ -1049,12 +1049,12 @@ skipbg: break; case WM_WINDOWPOSCHANGING: - if (pcli->hwndContactList != NULL) { + if (pcli->hwndContactList != nullptr) { WINDOWPOS *wp = (WINDOWPOS *)lParam; if (!wp || (wp->flags & SWP_NOSIZE)) return FALSE; - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); during_sizing = true; new_window_rect.left = 0; @@ -1064,12 +1064,12 @@ skipbg: if (cfg::dat.dwFlags & CLUI_FRAME_SBARSHOW) { RECT rcStatus; - SetWindowPos(pcli->hwndStatus, 0, 0, new_window_rect.bottom - 20, new_window_rect.right, 20, SWP_NOZORDER); + SetWindowPos(pcli->hwndStatus, nullptr, 0, new_window_rect.bottom - 20, new_window_rect.right, 20, SWP_NOZORDER); GetWindowRect(pcli->hwndStatus, &rcStatus); cfg::dat.statusBarHeight = (rcStatus.bottom - rcStatus.top); if (wp->cx != g_oldSize.cx) SendMessage(hwnd, CLUIINTM_STATUSBARUPDATE, 0, 0); - RedrawWindow(pcli->hwndStatus, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(pcli->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } else cfg::dat.statusBarHeight = 0; @@ -1093,10 +1093,10 @@ skipbg: if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_SHOWNORMAL); - if (pcli->hwndContactList != 0) { + if (pcli->hwndContactList != nullptr) { SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0); GetWindowRect(hwnd, &rc); - WINDOWPOS wp = { 0 }; + WINDOWPOS wp = {}; wp.cx = rc.right - rc.left; wp.cy = rc.bottom - rc.top; wp.x = rc.left; @@ -1151,7 +1151,7 @@ skipbg: if ((HWND)wParam != hwnd) if (cfg::dat.isTransparent) if (transparentFocus) - SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr); } else { if (cfg::dat.isTransparent) { @@ -1169,7 +1169,7 @@ skipbg: if (!transparentFocus && GetForegroundWindow() != hwnd) { SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; - SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr); } } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -1239,7 +1239,7 @@ skipbg: } else if (wParam == TIMERID_AUTOSIZE) { KillTimer(hwnd, wParam); - SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetWindowPos(hwnd, nullptr, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); PostMessage(hwnd, WM_SIZE, 0, 0); PostMessage(hwnd, CLUIINTM_REDRAW, 0, 0); } @@ -1273,7 +1273,7 @@ skipbg: SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? (COLORREF)cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)sourceAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); noRecurse = 1; ShowWindow(hwnd, SW_SHOW); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); noRecurse = 0; } else { @@ -1335,11 +1335,11 @@ skipbg: WPARAM wwParam = 0; LPARAM llParam = 0; MCONTACT hContact = 0; - ClcContact *contact = 0; + ClcContact *contact = nullptr; int serviceFailure = FALSE; if (cfg::clcdat) { - pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, NULL); + pcli->pfnGetRowByIndex(cfg::clcdat, cfg::clcdat->selection, &contact, nullptr); if (contact && contact->type == CLCIT_CONTACT) hContact = contact->hContact; } @@ -1413,11 +1413,11 @@ skipbg: SendMessage(item->hWnd, BM_SETCHECK, 0, 0); } if (!contactOK) - MessageBox(0, TranslateT("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat."), TranslateT("Parameter mismatch"), MB_OK); + MessageBox(nullptr, TranslateT("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat."), TranslateT("Parameter mismatch"), MB_OK); if (serviceFailure) { wchar_t szError[512]; mir_snwprintf(szError, TranslateT("The service %S specified by the %S button definition was not found. You may need to install additional plugins."), item->szService, item->szName); - MessageBox(NULL, szError, TranslateT("Service failure"), MB_OK); + MessageBox(nullptr, szError, TranslateT("Service failure"), MB_OK); } break; } @@ -1431,14 +1431,14 @@ skipbg: case IDC_TBTOPMENU: case IDC_STBTOPMENU: GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, nullptr); return 0; case IDC_TBTOPSTATUS: case IDC_STBTOPSTATUS: case IDC_TBGLOBALSTATUS: GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, nullptr); return 0; case IDC_TBSOUND: @@ -1493,7 +1493,7 @@ buttons_done: case POPUP_NEWGROUP: SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0); SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0); - Clist_GroupCreate(NULL, NULL); + Clist_GroupCreate(NULL, nullptr); break; case POPUP_HIDEOFFLINE: case IDC_TBHIDEOFFLINE: @@ -1530,7 +1530,7 @@ buttons_done: break; } if (dwOldFlags != cfg::dat.dwFlags) { - InvalidateRect(pcli->hwndContactTree, NULL, FALSE); + InvalidateRect(pcli->hwndContactTree, nullptr, FALSE); db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags); if ((dwOldFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN)) != (cfg::dat.dwFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN))) { ConfigureFrame(); @@ -1598,7 +1598,7 @@ buttons_done: } if (PtInRect(&rc, pt)) { HMENU hMenu = Menu_BuildGroupMenu(); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); Menu_DestroyNestedMenu(hMenu); return 0; } @@ -1609,7 +1609,7 @@ buttons_done: hMenu = Menu_GetMainMenu(); else hMenu = Menu_GetStatusMenu(); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); return 0; } } @@ -1627,7 +1627,7 @@ buttons_done: { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (hbmLockedPoint == 0) { + if (hbmLockedPoint == nullptr) { hdcLockedPoint = CreateCompatibleDC(dis->hDC); hbmLockedPoint = CreateCompatibleBitmap(dis->hDC, 5, 5); hbmOldLockedPoint = reinterpret_cast(SelectObject(hdcLockedPoint, hbmLockedPoint)); @@ -1674,14 +1674,14 @@ buttons_done: x += (cfg::dat.bEqualSections ? (cfg::dat.bCLeft / 2) : cfg::dat.bCLeft); else if (pd->protopos == nParts - 1) x -= (cfg::dat.bCRight / 2); - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); if (db_get_b(NULL, "CLUI", "sbar_showlocked", 1)) { if (db_get_b(NULL, szProto, "LockMainStatus", 0)) { hIcon = Skin_LoadIcon(SKINICON_OTHER_STATUS_LOCKED); - if (hIcon != NULL) { - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, NULL, DI_NORMAL); + if (hIcon != nullptr) { + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); } } @@ -1739,11 +1739,11 @@ buttons_done: show_on_first_autosize = FALSE; ShowCLUI(hwnd); } - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; case CLUIINTM_STATUSBARUPDATE: - CluiProtocolStatusChanged(0, 0); + CluiProtocolStatusChanged(0, nullptr); return 0; case WM_THEMECHANGED: @@ -1755,13 +1755,13 @@ buttons_done: SelectObject(cfg::dat.hdcBg, cfg::dat.hbmBgOld); DeleteObject(cfg::dat.hbmBg); DeleteDC(cfg::dat.hdcBg); - cfg::dat.hdcBg = NULL; + cfg::dat.hdcBg = nullptr; } if (cfg::dat.bmpBackground) { SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); DeleteDC(cfg::dat.hdcPic); DeleteObject(cfg::dat.bmpBackground); - cfg::dat.bmpBackground = NULL; + cfg::dat.bmpBackground = nullptr; } FreeProtocolData(); if (hdcLockedPoint) { @@ -1795,7 +1795,7 @@ static INT_PTR CLN_ShowMainMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -1803,7 +1803,7 @@ static INT_PTR CLN_ShowStatusMenu(WPARAM, LPARAM) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetStatusMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, nullptr); return 0; } @@ -1820,10 +1820,10 @@ void LoadCLUIModule(void) wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInst; - wndclass.hIcon = 0; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hIcon = nullptr; + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)COLOR_3DFACE; - wndclass.lpszMenuName = 0; + wndclass.lpszMenuName = nullptr; wndclass.lpszClassName = L"EventAreaClass"; RegisterClass(&wndclass); @@ -1840,7 +1840,7 @@ void LoadCLUIModule(void) CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, CLN_ShowStatusMenu); if (db_get_b(NULL, "CLUI", "FloaterMode", 0)) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("You need the FloatingContacts plugin, cause the embedded floating contacts were removed."), TranslateT("Warning"), MB_OK | MB_ICONWARNING); db_unset(NULL, "CLUI", "FloaterMode"); @@ -1887,7 +1887,7 @@ void FS_RegisterFonts() strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); for (int i = 0; i < _countof(clistFontDescr); i++) { LOGFONT lf; pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour); @@ -1909,7 +1909,7 @@ void FS_RegisterFonts() fid.order = i; Font_RegisterW(&fid); } - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); // and colours ColourIDW colourid = { 0 }; diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp index b79eb720a5..0a2a2d1499 100644 --- a/plugins/Clist_nicer/src/cluiframes.cpp +++ b/plugins/Clist_nicer/src/cluiframes.cpp @@ -34,7 +34,7 @@ extern HANDLE hThreadMFUpdate; void MF_UpdateThread(LPVOID); HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent; -HANDLE g_hEventThread = 0; +HANDLE g_hEventThread = nullptr; LOGFONT TitleBarLogFont = { 0 }; @@ -59,11 +59,11 @@ int CLUIFrameResizeFloatingFrame(int framepos); static int CLUIFramesReSort(); boolean FramesSysNotStarted = TRUE; -HPEN g_hPenCLUIFrames = 0; +HPEN g_hPenCLUIFrames = nullptr; static SortData g_sd[MAX_FRAMES]; -static HHOOK g_hFrameHook = 0; +static HHOOK g_hFrameHook = nullptr; static int sortfunc(const void *a, const void *b) { @@ -77,9 +77,9 @@ static int sortfunc(const void *a, const void *b) return 0; } -static FRAMEWND *Frames = NULL; +static FRAMEWND *Frames = nullptr; -FRAMEWND *wndFrameCLC = NULL, *wndFrameEventArea = NULL, *wndFrameViewMode = NULL; +FRAMEWND *wndFrameCLC = nullptr, *wndFrameEventArea = nullptr, *wndFrameViewMode = nullptr; static int nFramescount = 0; static int alclientFrame = -1;//for fast access to frame with alclient properties @@ -133,8 +133,8 @@ int __forceinline btoint(bool b) static FRAMEWND* FindFrameByWnd(HWND hwnd) { - if (hwnd == NULL) - return NULL; + if (hwnd == nullptr) + return nullptr; for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; @@ -142,12 +142,12 @@ static FRAMEWND* FindFrameByWnd(HWND hwnd) return &F; } - return NULL; + return nullptr; } static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL) { - if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { + if ((pThumbRight->dockOpt.hwndLeft == nullptr) && (pThumbLeft->dockOpt.hwndRight == nullptr)) { pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; pThumbLeft->dockOpt.hwndRight = pThumbRight->ContainerWnd; } @@ -155,20 +155,20 @@ static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL) static void UndockThumbs(FRAMEWND *pThumb1, FRAMEWND *pThumb2) { - if ((pThumb1 == NULL) || (pThumb2 == NULL)) + if ((pThumb1 == nullptr) || (pThumb2 == nullptr)) return; if (pThumb1->dockOpt.hwndRight == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndRight = NULL; + pThumb1->dockOpt.hwndRight = nullptr; if (pThumb1->dockOpt.hwndLeft == pThumb2->ContainerWnd) - pThumb1->dockOpt.hwndLeft = NULL; + pThumb1->dockOpt.hwndLeft = nullptr; if (pThumb2->dockOpt.hwndRight == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndRight = NULL; + pThumb2->dockOpt.hwndRight = nullptr; if (pThumb2->dockOpt.hwndLeft == pThumb1->ContainerWnd) - pThumb2->dockOpt.hwndLeft = NULL; + pThumb2->dockOpt.hwndLeft = nullptr; } BOOLEAN bMoveTogether; @@ -191,7 +191,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) RECT rcBottom; int frmidx = 0; - if (pThumb == NULL) + if (pThumb == nullptr) return; sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN); @@ -208,7 +208,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) int nNewY = nY < nOffs ? 0 : nY; nNewY = nNewY >(sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - bool bLeading = pThumb->dockOpt.hwndRight != NULL; + bool bLeading = pThumb->dockOpt.hwndRight != nullptr; if (bMoveTogether) { UndockThumbs(pThumb, FindFrameByWnd(pThumb->dockOpt.hwndLeft)); @@ -223,7 +223,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) fakeTaskBarWindow.ContainerWnd = hWndExplorerToolBar; fakeTaskBarWindow.floating = TRUE; - while (pCurThumb != NULL) { + while (pCurThumb != nullptr) { if (pCurThumb->floating) { if (pCurThumb != pThumb) { @@ -359,7 +359,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY) nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX; nNewY = nNewY < nOffs ? 0 : nNewY; nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY; - SetWindowPos(pThumb->ContainerWnd, 0, nNewX, nNewY, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(pThumb->ContainerWnd, nullptr, nNewX, nNewY, 0, 0, SWP_NOSIZE | SWP_NOZORDER); // OK, move all docked thumbs if (bMoveTogether) { @@ -397,7 +397,7 @@ void GetBorderSize(HWND hwnd, RECT *rect) //append string char __forceinline *AS(char *str, const char *setting, char *addstr) { - if (str != NULL) { + if (str != nullptr) { mir_strcpy(str, setting); mir_strcat(str, addstr); } @@ -467,7 +467,7 @@ int DBStoreFrameSettingsAtPos(int pos, int Frameid) int LocateStorePosition(int Frameid, int maxstored) { - if (Frames[Frameid].name == NULL) return -1; + if (Frames[Frameid].name == nullptr) return -1; for (int i = 0; i < maxstored; i++) { char settingname[255]; @@ -572,7 +572,7 @@ int CLUIFramesGetalClientFrame(void) static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) { HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi); - if (pmi->pszService != NULL) + if (pmi->pszService != nullptr) Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid); return res; } @@ -580,7 +580,7 @@ static HGENMENU addFrameMenuItem(TMO_MenuItem *pmi, int frameid, bool bMain) HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain) { if (FramesSysNotStarted) - return NULL; + return nullptr; int framepos = id2pos(frameid); FrameMenuHandles &fmh = (frameid == -1) ? cont : Frames[framepos].MenuHandles; @@ -595,7 +595,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo popuppos += 100000; - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.position = popuppos++; mi.name.a = LPGEN("&Visible"); mi.flags = CMIF_SYSTEM | CMIF_CHECKED; @@ -648,7 +648,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.position = popuppos++; mi.name.a = LPGEN("&Align"); mi.flags = CMIF_SYSTEM; - mi.pszService = NULL; + mi.pszService = nullptr; fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain); // align top @@ -674,7 +674,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.root = root; mi.position = popuppos++; mi.name.a = LPGEN("&Position"); - mi.pszService = NULL; + mi.pszService = nullptr; mi.root = addFrameMenuItem(&mi, frameid, bMain); mi.position = popuppos++; @@ -686,7 +686,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, boo mi.name.a = LPGEN("&Down"); mi.pszService = CLUIFRAMESMOVEDOWN; addFrameMenuItem(&mi, frameid, bMain); - return 0; + return nullptr; } static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) @@ -858,7 +858,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) lck.unlock(); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - SetWindowPos(Frames[pos].TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(Frames[pos].TitleBar.hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } return 0; @@ -878,7 +878,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) Frames[pos].TitleBar.tbname = (wParam & FO_UNICODETEXT) ? mir_wstrdup((LPWSTR)lParam) : mir_a2u((LPSTR)lParam); lck.unlock(); - if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != NULL)) + if (Frames[pos].floating && (Frames[pos].TitleBar.tbname != nullptr)) SetWindowText(Frames[pos].ContainerWnd, Frames[pos].TitleBar.tbname); return 0; @@ -922,7 +922,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) if (Frames[pos].height != oldHeight) { CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); if (Frames[pos].Skinned) - RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME | RDW_UPDATENOW | RDW_INVALIDATE); + RedrawWindow(Frames[pos].hWnd, nullptr, nullptr, RDW_FRAME | RDW_UPDATENOW | RDW_INVALIDATE); } } else { @@ -983,10 +983,10 @@ INT_PTR CLUIFramesShowAllTitleBars(WPARAM, LPARAM) for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; F.TitleBar.ShowTitleBar = TRUE; - SetWindowPos(F.hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(F.hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -998,10 +998,10 @@ INT_PTR CLUIFramesHideAllTitleBars(WPARAM, LPARAM) for (int i = 0; i < nFramescount; i++) { FRAMEWND &F = Frames[i]; F.TitleBar.ShowTitleBar = FALSE; - SetWindowPos(F.hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(F.hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1026,7 +1026,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM frameId, LPARAM) if (!Frames[pos].floating) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1040,12 +1040,12 @@ INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM frameId, LPARAM) int pos = id2pos(frameId); if (pos >= 0 && (int)pos < nFramescount) { Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar; - SetWindowPos(Frames[pos].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(Frames[pos].hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1120,7 +1120,7 @@ INT_PTR CLUIFramesSetAlign(WPARAM frameId, LPARAM lParam) CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, frameId), lParam); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1184,7 +1184,7 @@ INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM) } CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); return 0; } @@ -1212,7 +1212,7 @@ INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM) } CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, wParam), oldflags); - SetWindowPos(hw, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); + SetWindowPos(hw, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER); return 0; } @@ -1254,11 +1254,11 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) Frames[FrameId].collapsed = TRUE; } - SetWindowPos(pcli->hwndContactList, NULL, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, rc.right - rc.left, rc.bottom, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); CLUIFramesStoreAllFrames(); lck.unlock(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } @@ -1325,7 +1325,7 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) contwnd.top -= (oldHeight - Frames[FrameId].height);//newheight SetWindowPos(Frames[FrameId].ContainerWnd, HWND_TOP, 0, 0, contwnd.left, contwnd.top, SWP_SHOWWINDOW | SWP_NOMOVE); } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); CLUIFramesStoreAllFrames(); return 0; } @@ -1349,7 +1349,7 @@ static int CLUIFramesLoadMainMenu() mi.hIcolibItem = F.TitleBar.hicon; mi.position = separator; mi.name.w = F.TitleBar.tbname ? F.TitleBar.tbname : F.name; - mi.pszService = 0; + mi.pszService = nullptr; g_frameMenus.insert(F.MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi)); CLUIFramesCreateMenuForFrame(F.id, F.MenuHandles.MainMenuItem, separator, true); CLUIFramesModifyMainMenuItems(F.id, 0); @@ -1390,7 +1390,7 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO HWND hwndParent = GetParent(hwnd); LRESULT result = 0; - if (pcli == NULL) + if (pcli == nullptr) return 0; if (hwndParent != pcli->hwndContactList || !cfg::dat.bSkinnedScrollbar) result = CallWindowProc(oldWndProc, hwnd, WM_NCPAINT, wParam, lParam); @@ -1398,8 +1398,8 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO return result; if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SKINNEDFRAME) { - StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; - if (item == 0) + StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : nullptr; + if (item == nullptr) return 0; GetWindowRect(hwnd, &rcWindow); @@ -1452,12 +1452,12 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) { - StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0; + StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : nullptr; LRESULT orig = oldWndProc ? CallWindowProc(oldWndProc, hwnd, WM_NCCALCSIZE, wParam, lParam) : 0; NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - if (item == 0 || pcli == NULL) + if (item == nullptr || pcli == nullptr) return orig; if (item->IGNORED || !(dwStyle & CLS_SKINNEDFRAME) || GetParent(hwnd) != pcli->hwndContactList) @@ -1474,7 +1474,7 @@ static LRESULT CALLBACK FramesSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, L { int i; - WNDPROC oldWndProc = 0; + WNDPROC oldWndProc = nullptr; BOOL hasTitleBar = FALSE; for (i = 0; i < nFramescount; i++) { @@ -1550,7 +1550,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) int style; CLISTFrame *clfrm = (CLISTFrame *)wParam; - if (pcli->hwndContactList == 0) return -1; + if (pcli->hwndContactList == nullptr) return -1; if (FramesSysNotStarted) return -1; if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; @@ -1558,7 +1558,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) if (nFramescount >= MAX_FRAMES) return -1; - if (Frames == NULL) { + if (Frames == nullptr) { Frames = (FRAMEWND*)malloc(sizeof(FRAMEWND) * (MAX_FRAMES + 2)); memset(Frames, 0, (sizeof(FRAMEWND) * (MAX_FRAMES + 2))); } @@ -1580,7 +1580,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) SetClassLong(clfrm->hWnd, GCL_STYLE, GetClassLong(clfrm->hWnd, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW)); SetWindowLongPtr(clfrm->hWnd, GWL_STYLE, GetWindowLongPtr(clfrm->hWnd, GWL_STYLE) | WS_CLIPCHILDREN); - if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, NULL)) { + if (GetCurrentThreadId() == GetWindowThreadProcessId(clfrm->hWnd, nullptr)) { if (clfrm->hWnd != pcli->hwndContactTree && clfrm->hWnd != g_hwndViewModeFrame && clfrm->hWnd != g_hwndEventArea) { Frames[nFramescount].wndProc = (WNDPROC)GetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC); SetWindowLongPtr(clfrm->hWnd, GWLP_WNDPROC, (LONG_PTR)FramesSubClassProc); @@ -1596,14 +1596,14 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) Frames[nFramescount].dwFlags = clfrm->Flags; - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { + if (clfrm->name == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { wchar_t ptszClassName[256]; GetClassName(Frames[nFramescount].hWnd, ptszClassName, _countof(ptszClassName)); Frames[nFramescount].name = mir_wstrdup(ptszClassName); } else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_wstrdup(clfrm->wname) : mir_a2u(clfrm->name); - if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL + if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == nullptr || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) Frames[nFramescount].TitleBar.tbname = mir_wstrdup(Frames[nFramescount].name); else @@ -1624,13 +1624,13 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name, (db_get_b(NULL, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) | WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | - WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL); + WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_hInst, nullptr); SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id); - Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - pcli->hwndContactList, NULL, g_hInst, NULL); + pcli->hwndContactList, nullptr, g_hInst, nullptr); SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); { @@ -1674,7 +1674,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) Frames[nFramescount - 1].floating = FALSE; CLUIFrameSetFloat(retval, 1);//lparam=1 use stored width and height } - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return retval; } @@ -1691,11 +1691,11 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM) FRAMEWND* F = &Frames[pos]; if (F->hWnd == g_hwndEventArea) - wndFrameEventArea = NULL; + wndFrameEventArea = nullptr; else if (F->hWnd == pcli->hwndContactTree) - wndFrameCLC = NULL; + wndFrameCLC = nullptr; else if (F->hWnd == g_hwndViewModeFrame) - wndFrameViewMode = NULL; + wndFrameViewMode = nullptr; mir_free(F->name); mir_free(F->TitleBar.tbname); @@ -1713,27 +1713,27 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM) } if (!cfg::shutDown) { - InvalidateRect(pcli->hwndContactList, NULL, TRUE); + InvalidateRect(pcli->hwndContactList, nullptr, TRUE); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); } return 0; } INT_PTR CLUIFramesForceUpdateTB(const FRAMEWND *Frame) { - if (Frame->TitleBar.hwnd != 0) - RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + if (Frame->TitleBar.hwnd != nullptr) + RedrawWindow(Frame->TitleBar.hwnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } INT_PTR CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) { - if (Frame->hWnd != 0) - RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); + if (Frame->hWnd != nullptr) + RedrawWindow(Frame->hWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE); if (Frame->floating) - if (Frame->ContainerWnd != 0) RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); + if (Frame->ContainerWnd != nullptr) RedrawWindow(Frame->ContainerWnd, nullptr, nullptr, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME); return 0; } @@ -1751,11 +1751,11 @@ int CLUIFrameMoveResize(const FRAMEWND *Frame) return 0; } - SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, + SetWindowPos(Frame->hWnd, nullptr, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset, (Frame->wndSize.right - Frame->wndSize.left), (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW); if (Frame->TitleBar.ShowTitleBar) { - SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(Frame->TitleBar.hwnd, nullptr, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH, (Frame->wndSize.right - Frame->wndSize.left), TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER); } @@ -1788,7 +1788,7 @@ bool CLUIFramesFitInSize(void) int CLUIFramesGetMinHeight() { - if (pcli->hwndContactList == NULL) + if (pcli->hwndContactList == nullptr) return 0; int i, tbh, clientfrm, sumheight = 0; @@ -2039,25 +2039,25 @@ int SizeFramesByWindowRect(RECT *r) FRAMEWND &F = Frames[i]; if (!F.floating) { if (F.OwnerWindow && F.OwnerWindow != (HWND)-2) { - SetWindowPos(F.hWnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, + SetWindowPos(F.hWnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, (F.wndSize.right - F.wndSize.left), (F.wndSize.bottom - F.wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, (F.wndSize.right - F.wndSize.left), TitleBarH + (F.UseBorder ? (!F.collapsed ? (F.align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); } } else { // set frame position - SetWindowPos(F.hWnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, + SetWindowPos(F.hWnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset, (F.wndSize.right - F.wndSize.left), (F.wndSize.bottom - F.wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW); // set titlebar position if (F.TitleBar.ShowTitleBar) { - SetWindowPos(F.TitleBar.hwnd, NULL, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, + SetWindowPos(F.TitleBar.hwnd, nullptr, F.wndSize.left + cfg::dat.bCLeft, F.wndSize.top + cfg::dat.topOffset - TitleBarH, (F.wndSize.right - F.wndSize.left), TitleBarH + (F.UseBorder ? (!F.collapsed ? (F.align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); } @@ -2123,9 +2123,9 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick; - if (pcli->hwndContactList != 0) - InvalidateRect(pcli->hwndContactList, NULL, TRUE); - if (pcli->hwndContactList != 0) + if (pcli->hwndContactList != nullptr) + InvalidateRect(pcli->hwndContactList, nullptr, TRUE); + if (pcli->hwndContactList != nullptr) UpdateWindow(pcli->hwndContactList); Sleep(0); @@ -2150,7 +2150,7 @@ int OnFrameTitleBarBackgroundChange() if (hBmpBackground) { DeleteObject(hBmpBackground); - hBmpBackground = NULL; + hBmpBackground = nullptr; } if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { ptrW tszBitmapName(db_get_wsa(NULL, "FrameTitleBar", "BkBitmap")); @@ -2222,8 +2222,8 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) } if (!AlignCOLLIconToLeft) { - if (Frames[pos].TitleBar.hicon != NULL) { - DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); + if (Frames[pos].TitleBar.hicon != nullptr) { + DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, nullptr, DI_NORMAL); TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); } else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); @@ -2231,9 +2231,9 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_wstrlen(Frames[pos].TitleBar.tbname)); if (!AlignCOLLIconToLeft) - DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, nullptr, DI_NORMAL); else - DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN) : Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, nullptr, DI_NORMAL); SelectObject(hdcMem, oFont); } } @@ -2272,7 +2272,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return Menu_DrawItem(lParam); case WM_ENABLE: - if (hwnd != 0) InvalidateRect(hwnd, NULL, FALSE); + if (hwnd != nullptr) InvalidateRect(hwnd, nullptr, FALSE); return 0; case WM_SIZE: return 0; @@ -2347,7 +2347,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0); + TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr); DestroyMenu(hmenu); } break; @@ -2371,7 +2371,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA lbypos = -1; oldframeheight = -1; ReleaseCapture(); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); break; case WM_LBUTTONDOWN: @@ -2536,7 +2536,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (!(wParam & MK_CONTROL)) PositionThumb(&Frames[pos], nLeft, nTop); else - SetWindowPos(Frames[pos].ContainerWnd, 0, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(Frames[pos].ContainerWnd, nullptr, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER); ptOld = ptNew; @@ -2648,7 +2648,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) { if (!Frames[framepos].floating) return 0; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; RECT rect; @@ -2667,7 +2667,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) ShowWindow(Frames[framepos].TitleBar.hwnd, SW_SHOWNOACTIVATE); Frames[framepos].height = height - floatingHeight; SetWindowPos(Frames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, floatingHeight, SWP_SHOWWINDOW | SWP_DRAWFRAME | SWP_NOACTIVATE); - InvalidateRect(Frames[framepos].TitleBar.hwnd, NULL, FALSE); + InvalidateRect(Frames[framepos].TitleBar.hwnd, nullptr, FALSE); SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, floatingHeight, width, height - floatingHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE); } @@ -2677,14 +2677,14 @@ int CLUIFrameResizeFloatingFrame(int framepos) SetWindowPos(Frames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE); } - if (Frames[framepos].ContainerWnd != 0) + if (Frames[framepos].ContainerWnd != nullptr) UpdateWindow(Frames[framepos].ContainerWnd); GetWindowRect(Frames[framepos].hWnd, &Frames[framepos].wndSize); if (Frames[framepos].TitleBar.ShowTitleBar) - RedrawWindow(Frames[framepos].TitleBar.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(Frames[framepos].TitleBar.hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); - RedrawWindow(Frames[framepos].hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(Frames[framepos].hWnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); return 0; } @@ -2719,7 +2719,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (!Frames[framepos].minmaxenabled) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) break; if (Frames[framepos].Locked) { @@ -2754,7 +2754,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (framepos < 0 || framepos >= nFramescount) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; GetWindowRect(Frames[framepos].ContainerWnd, &rect); @@ -2773,7 +2773,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (framepos < 0 || framepos >= nFramescount) break; - if (Frames[framepos].ContainerWnd == 0) + if (Frames[framepos].ContainerWnd == nullptr) return 0; CLUIFrameResizeFloatingFrame(framepos); @@ -2800,7 +2800,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height) { - return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0)); + return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr)); } INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) @@ -2815,7 +2815,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) SetParent(Frames[wParam].TitleBar.hwnd, pcli->hwndContactList); Frames[wParam].floating = FALSE; DestroyWindow(Frames[wParam].ContainerWnd); - Frames[wParam].ContainerWnd = 0; + Frames[wParam].ContainerWnd = nullptr; } else { RECT recttb, rectw, border; @@ -2897,11 +2897,11 @@ wchar_t g_ptszEventName[100]; static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { mir_snwprintf(g_ptszEventName, L"mf_update_evt_%d", GetCurrentThreadId()); - g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); - hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL); + g_hEventThread = CreateEvent(nullptr, TRUE, FALSE, g_ptszEventName); + hThreadMFUpdate = mir_forkthread(MF_UpdateThread, nullptr); SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false); + CLUIFramesCreateMenuForFrame(-1, nullptr, 000010000, false); return 0; } @@ -2943,7 +2943,7 @@ int LoadCLUIFramesModule(void) wndclass.style = CS_DBLCLKS; wndclass.lpfnWndProc = CLUIFrameTitleBarProc; wndclass.hInstance = g_hInst; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.lpszClassName = CLUIFrameTitleBarClassName; RegisterClass(&wndclass); @@ -2951,7 +2951,7 @@ int LoadCLUIFramesModule(void) cntclass.style = CS_DBLCLKS | CS_DROPSHADOW; cntclass.lpfnWndProc = CLUIFrameContainerWndProc; cntclass.hInstance = g_hInst; - cntclass.hCursor = LoadCursor(NULL, IDC_ARROW); + cntclass.hCursor = LoadCursor(nullptr, IDC_ARROW); cntclass.lpszClassName = L"FramesContainer"; RegisterClass(&cntclass); @@ -2961,7 +2961,7 @@ int LoadCLUIFramesModule(void) mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); mi.position = 3000090000; mi.name.a = LPGEN("Frames"); - mi.pszService = 0; + mi.pszService = nullptr; cont.MainMenuItem = Menu_AddMainMenuItem(&mi); UNSET_UID(mi); @@ -3023,7 +3023,7 @@ int LoadCLUIFramesModule(void) CreateServiceFunction(CLUIFRAMESSETALIGNALBOTTOM, CLUIFramesSetAlignalBottom); CreateServiceFunction("Set_Floating", CLUIFrameSetFloat); - hWndExplorerToolBar = FindWindowExA(0, 0, "Shell_TrayWnd", NULL); + hWndExplorerToolBar = FindWindowExA(nullptr, nullptr, "Shell_TrayWnd", nullptr); OnFrameTitleBarBackgroundChange(); FramesSysNotStarted = FALSE; @@ -3055,13 +3055,13 @@ int UnLoadCLUIFramesModule(void) F.ContainerWnd = (HWND)-1; DestroyMenu(F.TitleBar.hmenu); - if (F.name != NULL) + if (F.name != nullptr) mir_free(F.name); - if (F.TitleBar.tbname != NULL) + if (F.TitleBar.tbname != nullptr) mir_free(F.TitleBar.tbname); } free(Frames); - Frames = NULL; + Frames = nullptr; nFramescount = 0; UnregisterClass(CLUIFrameTitleBarClassName, g_hInst); return 0; diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 6e3dacbd9f..f8636fdb21 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ApplyCLUIBorderStyle(); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) - SetMenu(pcli->hwndContactList, NULL); + SetMenu(pcli->hwndContactList, nullptr); else SetMenu(pcli->hwndContactList, pcli->hMenuMain); @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); } - db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); + db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE)); db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); @@ -292,8 +292,8 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ConfigureCLUIGeometry(1); ShowWindow(pcli->hwndContactList, SW_SHOW); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); cfg::dat.fadeinout = oldFading; opt_clui_changed = 0; @@ -387,7 +387,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; - pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL); + pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr); mir_subclassWindow(pcli->hwndStatus, NewStatusBarWndProc); } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) { @@ -402,7 +402,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags); ConfigureCLUIGeometry(1); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); - CluiProtocolStatusChanged(0, 0); + CluiProtocolStatusChanged(0, nullptr); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); opt_sbar_changed = 0; return TRUE; diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 7e8b5c8c56..f97d264643 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -33,7 +33,7 @@ void FreeProtocolData(void) int nParts = SendMessage(pcli->hwndStatus, SB_GETPARTS, 0, 0); for (int nPanel = 0; nPanel < nParts; nPanel++) { ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus, SB_GETTEXT, nPanel, 0); - if (PD != NULL && !IsBadCodePtr((FARPROC)PD)) { + if (PD != nullptr && !IsBadCodePtr((FARPROC)PD)) { SendMessage(pcli->hwndStatus, SB_SETTEXT, (WPARAM)nPanel | SBT_OWNERDRAW, 0); if (PD->RealName) mir_free(PD->RealName); if (PD) mir_free(PD); @@ -50,11 +50,11 @@ void CluiProtocolStatusChanged(int, const char*) WORD maxStatus = ID_STATUS_OFFLINE; DBVARIANT dbv = { 0 }; int iIcon = 0; - HICON hIcon = 0; + HICON hIcon = nullptr; int rdelta = cfg::dat.bCLeft + cfg::dat.bCRight; BYTE windowStyle; - if (pcli->hwndStatus == 0 || cfg::shutDown) + if (pcli->hwndStatus == nullptr || cfg::shutDown) return; int protoCount; @@ -101,7 +101,7 @@ void CluiProtocolStatusChanged(int, const char*) BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1); wchar_t szName[32]; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HFONT hofont = reinterpret_cast(SelectObject(hdc, (HFONT)SendMessage(pcli->hwndStatus, WM_GETFONT, 0, 0))); // count down since built in ones tend to go at the end @@ -135,7 +135,7 @@ void CluiProtocolStatusChanged(int, const char*) partCount++; } SelectObject(hdc, hofont); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); } if (partCount == 0) { SendMessage(pcli->hwndStatus, SB_SIMPLE, TRUE, 0); @@ -149,7 +149,7 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths); // count down since built in ones tend to go at the end - char *szMaxProto = NULL; + char *szMaxProto = nullptr; partCount = 0; for (int i = 0; i < protoCount; i++) { int idx = pcli->pfnGetAccountIndexByPos(i); @@ -195,7 +195,7 @@ void CluiProtocolStatusChanged(int, const char*) } else { wStatus = maxStatus; - iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int)wStatus, 0, &hIcon); + iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : nullptr, (int)wStatus, 0, &hIcon); g_maxStatus = (int)wStatus; if (szMaxProto) strncpy_s(g_maxProto, _countof(g_maxProto), szMaxProto, _TRUNCATE); @@ -221,18 +221,18 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); else SendMessage(hwndClistBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - InvalidateRect(hwndClistBtn, NULL, TRUE); + InvalidateRect(hwndClistBtn, nullptr, TRUE); } HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); if (IsWindow(hwndTtbStatus)) { - if (g_ButtonItems == NULL) { + if (g_ButtonItems == nullptr) { if (!hIcon) SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); else SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); } - InvalidateRect(hwndTtbStatus, NULL, TRUE); + InvalidateRect(hwndTtbStatus, nullptr, TRUE); } } } diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 577d813333..18d2844705 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" TCluiData cfg::dat = { 0 }; -ClcData* cfg::clcdat = 0; +ClcData* cfg::clcdat = nullptr; static mir_cs cachecs; LIST cfg::arCache(100, NumericKeySortT); @@ -35,8 +35,8 @@ bool cfg::shutDown = false; TSysConfig API::sysConfig = { 0 }; TSysState API::sysState = { 0 }; -pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = 0; -pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = 0; +pfnDwmExtendFrameIntoClientArea_t API::pfnDwmExtendFrameIntoClientArea = nullptr; +pfnDwmIsCompositionEnabled_t API::pfnDwmIsCompositionEnabled = nullptr; EXCEPTION_RECORD API::exRecord = { 0 }; CONTEXT API::exCtx = { 0 }; @@ -45,7 +45,7 @@ char API::exSzFile[MAX_PATH] = ""; wchar_t API::exReason[256] = L""; int API::exLine = 0; bool API::exAllowContinue = false; -HMODULE API::hDwm = 0; +HMODULE API::hDwm = nullptr; TExtraCache* cfg::getCache(const MCONTACT hContact, const char *szProto) { @@ -82,10 +82,10 @@ void CSH_Destroy() StatusItems_t *item = p->status_item; free(p->status_item); - p->status_item = 0; + p->status_item = nullptr; for (int j = i; j < cfg::arCache.getCount(); j++) // avoid duplicate free()'ing status item pointers (there are references from sub to master contacts, so compare the pointers... if (cfg::arCache[j]->status_item == item) - cfg::arCache[j]->status_item = 0; + cfg::arCache[j]->status_item = nullptr; } free(p); } @@ -204,7 +204,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wch mir_snprintf(exSzFile, "%s%s", szName, szExt); mir_snwprintf(exReason, L"An application error has occured: %s", szReason); exLine = line; - exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0); + exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), nullptr, Ex_DlgProc, 0); exAllowContinue = fAllowContinue; if (IDCANCEL == exLastResult) ExitProcess(1); @@ -233,7 +233,7 @@ void TSAPI Utils::showDlgControl(const HWND hwnd, UINT id, int showCmd) HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle) { wchar_t sysPathName[MAX_PATH + 2]; - HMODULE _h = 0; + HMODULE _h = nullptr; try { if (0 == ::GetSystemDirectory(sysPathName, MAX_PATH)) @@ -248,12 +248,12 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename, bool useGetHandle) _h = ::GetModuleHandle(sysPathName); else _h = LoadLibrary(sysPathName); - if (0 == _h) + if (nullptr == _h) throw(CRTException("Error while loading system library", szFilename)); } catch (CRTException& ex) { ex.display(); - return 0; + return nullptr; } return (_h); } @@ -269,6 +269,6 @@ void CRTException::display() const wchar_t tszBoxMsg[500]; mir_snwprintf(tszBoxMsg, L"%s\n\n(%s)", tszMsg, m_szParam); - ::MessageBox(0, tszBoxMsg, L"Clist_nicer runtime error", MB_OK | MB_ICONERROR); + ::MessageBox(nullptr, tszBoxMsg, L"Clist_nicer runtime error", MB_OK | MB_ICONERROR); mir_free(tszMsg); } diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index ed7ddefb5b..49d78b9ab3 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -47,7 +47,7 @@ static int GetContactStatus(MCONTACT hContact) char *szProto; szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return ID_STATUS_OFFLINE; return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } @@ -62,11 +62,11 @@ int __forceinline GetStatusModeOrdering(int statusMode) } int mf_updatethread_running = TRUE; -HANDLE hThreadMFUpdate = 0; +HANDLE hThreadMFUpdate = nullptr; static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep) { - DWORD curTime = time(NULL); + DWORD curTime = time(nullptr); DWORD frequency, eventCount; MEVENT hEvent = db_event_last(hContact); @@ -153,7 +153,7 @@ int __forceinline GetProtoIndex(char * szName) return -1; PROTOACCOUNT *pa = Proto_GetAccount(szName); - return (pa == NULL) ? -1 : pa->iOrder; + return (pa == nullptr) ? -1 : pa->iOrder; } int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact* c2, UINT bywhat) @@ -163,7 +163,7 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact char *szProto1, *szProto2; int rc; - if (c1 == 0 || c2 == 0) + if (c1 == nullptr || c2 == nullptr) return 0; szProto1 = c1->proto; @@ -227,7 +227,7 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact rc = GetProtoIndex(szProto1) - GetProtoIndex(szProto2); - if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) + if (rc != 0 && (szProto1 != nullptr && szProto2 != nullptr)) return rc; } return 0; diff --git a/plugins/Clist_nicer/src/coolsblib.cpp b/plugins/Clist_nicer/src/coolsblib.cpp index 61da1b3567..f669a400a9 100644 --- a/plugins/Clist_nicer/src/coolsblib.cpp +++ b/plugins/Clist_nicer/src/coolsblib.cpp @@ -44,13 +44,13 @@ SCROLLBAR* GetScrollBarFromHwnd(HWND hwnd, UINT nBar) { SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); if (!sw) - return 0; + return nullptr; if (nBar == SB_HORZ) return &sw->sbarHorz; if (nBar == SB_VERT) return &sw->sbarVert; - return 0; + return nullptr; } BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) @@ -74,7 +74,7 @@ BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); typedef BOOL(WINAPI *WPROC)(HWND, UINT, UINT); -static WPROC pEnableScrollBar = 0; +static WPROC pEnableScrollBar = nullptr; void WINAPI CoolSB_SetESBProc(WPROC proc) { @@ -106,7 +106,7 @@ static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) SendMessage(hwnd, WM_NCPAINT, 1, 0); } else { - SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_DRAWFRAME); } } @@ -135,7 +135,7 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) { SCROLLBAR *sb = GetScrollBarFromHwnd(hwnd, fnBar); - if (sb == 0) + if (sb == nullptr) return FALSE; if (fnBar == SB_HORZ) { @@ -145,7 +145,7 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) return &sb->scrollInfo; } else - return NULL; + return nullptr; } // // Initialize the cool scrollbars for a window by subclassing it @@ -161,14 +161,14 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) DWORD dwCurStyle; //BOOL fDisabled; - if (pEnableScrollBar == 0) + if (pEnableScrollBar == nullptr) pEnableScrollBar = EnableScrollBar; GetClientRect(hwnd, &rect); //if we have already initialized Cool Scrollbars for this window, //then stop the user from doing it again - if (GetScrollWndFromHwnd(hwnd) != 0) { + if (GetScrollWndFromHwnd(hwnd) != nullptr) { return FALSE; } @@ -254,7 +254,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) UNREFERENCED_PARAMETER(ice); UNREFERENCED_PARAMETER(ti); - sw->hwndToolTip = 0; + sw->hwndToolTip = nullptr; #endif @@ -385,7 +385,7 @@ int WINAPI CoolSB_SetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fR } SCROLLBAR *sbar = GetScrollBarFromHwnd(hwnd, fnBar); - if (sbar == NULL) + if (sbar == nullptr) return 0; if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) { @@ -497,7 +497,7 @@ BOOL WINAPI CoolSB_ShowScrollBar(HWND hwnd, int wBar, BOOL fShow) //if (s //SetWindowLongPtr(hwnd, GWL_STYLE, style); - SetWindowPos(hwnd, 0, 0, 0, 0, 0, + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); diff --git a/plugins/Clist_nicer/src/coolscroll.cpp b/plugins/Clist_nicer/src/coolscroll.cpp index 1e8f5b98ff..cd9f0750e7 100644 --- a/plugins/Clist_nicer/src/coolscroll.cpp +++ b/plugins/Clist_nicer/src/coolscroll.cpp @@ -85,7 +85,7 @@ static RECT MouseOverRect; static UINT uScrollTimerMsg = 0; static UINT uScrollTimerPortion = HTSCROLL_NONE; static UINT_PTR uScrollTimerId = 0; -static HWND hwndCurCoolSB = 0; +static HWND hwndCurCoolSB = nullptr; extern int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd); @@ -105,7 +105,7 @@ BOOL WINAPI CoolSB_IsThumbTracking(HWND hwnd) { SCROLLWND *sw; - if ((sw = GetScrollWndFromHwnd(hwnd)) == NULL) + if ((sw = GetScrollWndFromHwnd(hwnd)) == nullptr) return FALSE; else return sw->fThumbTracking; @@ -194,7 +194,7 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO //MONOCHROME bitmap to convert the arrow to black/white mask hdcmem1 = CreateCompatibleDC(hdc); - hbm1 = CreateBitmap(width, height, 1, 1, NULL); + hbm1 = CreateBitmap(width, height, 1, 1, nullptr); UnrealizeObject(hbm1); oldbm1 = reinterpret_cast(SelectObject(hdcmem1, hbm1)); @@ -347,7 +347,7 @@ static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) hbr = CreatePatternBrush(hbmp); UnrealizeObject(hbr); - SetBrushOrgEx(hdc, rect->left, rect->top, 0); + SetBrushOrgEx(hdc, rect->left, rect->top, nullptr); hbrold = (HBRUSH)SelectObject(hdc, hbr); @@ -373,7 +373,7 @@ static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) static void PaintRect(HDC hdc, RECT *rect, COLORREF color) { COLORREF oldcol = SetBkColor(hdc, color); - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, NULL); + ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, nullptr); SetBkColor(hdc, oldcol); } @@ -1373,7 +1373,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) SCROLLBAR *sb; HDC hdc; RECT winrect, rect; - HRGN clip = 0; + HRGN clip = nullptr; BOOL fCustomDraw = FALSE; LRESULT ret; DWORD dwStyle; @@ -1481,7 +1481,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) HWND hwndParent = GetParent(hwnd); GetClientRect(hwndParent, &parent); - MapWindowPoints(hwndParent, 0, (POINT *)&parent, 2); + MapWindowPoints(hwndParent, nullptr, (POINT *)&parent, 2); CopyRect(&rect2, &rect); OffsetRect(&rect2, winrect.left, winrect.top); @@ -1969,7 +1969,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //set a timer going on the first click. //if this one expires, then we can start off a more regular timer //to generate the auto-scroll behaviour - uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, 0); + uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID1, COOLSB_TIMERINTERVAL1, nullptr); break; default: return mir_callNextSubclass(hwnd, CoolSBWndProc, WM_NCLBUTTONDOWN, wParam, lParam); @@ -2634,7 +2634,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa uHitTestPortion = HTSCROLL_NONE; GetScrollRect(sw, SB_HORZ, hwnd, &MouseOverRect); uMouseOverScrollbar = SB_HORZ; - uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); + uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, nullptr); NCPaint(sw, hwnd, 1, 0); } @@ -2647,7 +2647,7 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa uHitTestPortion = HTSCROLL_NONE; GetScrollRect(sw, SB_VERT, hwnd, &MouseOverRect); uMouseOverScrollbar = SB_VERT; - uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, 0); + uMouseOverId = SetTimer(hwnd, COOLSB_TIMERID3, COOLSB_TIMERINTERVAL3, nullptr); NCPaint(sw, hwnd, 1, 0); } @@ -2731,7 +2731,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM if (wTimerId == COOLSB_TIMERID1) { KillTimer(hwnd, uScrollTimerId); - uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, 0); + uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, nullptr); return 0; } //send the scrollbar message repeatedly diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 8fcf49c63e..b575696943 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -31,10 +31,10 @@ extern HWND g_hwndViewModeFrame; extern struct CluiTopButton BTNS[]; LIST arStatusItems(10); -ImageItem *g_ImageItems = NULL, *g_glyphItem = NULL; -ButtonItem *g_ButtonItems = NULL; -ImageItem *g_CLUIImageItem = NULL; -HBRUSH g_CLUISkinnedBkColor = 0; +ImageItem *g_ImageItems = nullptr, *g_glyphItem = nullptr; +ButtonItem *g_ButtonItems = nullptr; +ImageItem *g_CLUIImageItem = nullptr; +HBRUSH g_CLUISkinnedBkColor = nullptr; COLORREF g_CLUISkinnedBkColorRGB = 0; int ID_EXTBK_LAST = ID_EXTBK_LAST_D; @@ -257,15 +257,15 @@ BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem) StatusItems_t *GetProtocolStatusItem(const char *szProto) { - if (szProto == NULL) - return NULL; + if (szProto == nullptr) + return nullptr; for (int i = _countof(_StatusItems); i < arStatusItems.getCount(); i++) { StatusItems_t *p = arStatusItems[i]; if (!mir_strcmp(p->szName[0] == '{' ? p->szName+3 : p->szName, szProto)) return p; } - return NULL; + return nullptr; } // fills the struct with the settings in the database @@ -301,7 +301,7 @@ void LoadExtBkSettingsFromDB() if (p->statusID == ID_EXTBKSEPARATOR) continue; - p->imageItem = 0; + p->imageItem = nullptr; char buffer[255], *pszEnd = buffer + mir_snprintf(buffer, "%s_", p->szDBname); mir_strcpy(pszEnd, "IGNORE"); p->IGNORED = (BYTE)db_get_b(NULL, "CLCExt", buffer, p->IGNORED); mir_strcpy(pszEnd, "GRADIENT"); p->GRADIENT = (BYTE)db_get_dw(NULL, "CLCExt", buffer, p->GRADIENT); @@ -374,9 +374,9 @@ void SetButtonToSkinned() bool bFlat = bSkinned || (db_get_b(NULL, "TopToolBar", "UseFlatButton", 0) != 0); for (int i = 0;; i++) { - if (BTNS[i].pszButtonID == NULL) + if (BTNS[i].pszButtonID == nullptr) break; - if (BTNS[i].hwndButton != 0 && BTNS[i].ctrlid != IDC_TBGLOBALSTATUS && BTNS[i].ctrlid != IDC_TBMENU) + if (BTNS[i].hwndButton != nullptr && BTNS[i].ctrlid != IDC_TBGLOBALSTATUS && BTNS[i].ctrlid != IDC_TBMENU) CustomizeButton(BTNS[i].hwndButton, bSkinned, !bSkinned, bFlat, true); } @@ -450,7 +450,7 @@ struct { char *szModule; char *szSetting; unsigned int size; int defaultval; } _ "WorldTime", "BgColour", 4, 0, "WorldTime", "FontCol", 4, 0, - NULL, NULL, 0, 0 + nullptr, nullptr, 0, 0 }; void extbk_export(char *file) @@ -520,7 +520,7 @@ void extbk_export(char *file) } i = 0; - while (_tagSettings[i].szModule != NULL) { + while (_tagSettings[i].szModule != nullptr) { data = 0; switch (_tagSettings[i].size) { case 1: @@ -569,7 +569,7 @@ static void PreMultiply(HBITMAP hBitmap, int mode) int height = bmp.bmHeight; DWORD dwLen = width * height * 4; BYTE *p = (BYTE *)malloc(dwLen); - if (p == NULL) + if (p == nullptr) return; GetBitmapBits(hBitmap, dwLen, p); @@ -600,7 +600,7 @@ static void CorrectBitmap32Alpha(HBITMAP hBitmap) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); BYTE *p = (BYTE*)calloc(1, dwLen); - if (p == NULL) + if (p == nullptr) return; GetBitmapBits(hBitmap, dwLen, p); @@ -627,7 +627,7 @@ static void CorrectBitmap32Alpha(HBITMAP hBitmap) static HBITMAP LoadPNG(const char *szFilename) { HBITMAP hBitmap = Bitmap_Load(_A2T(szFilename)); - if (hBitmap != 0) + if (hBitmap != nullptr) CorrectBitmap32Alpha(hBitmap); return hBitmap; @@ -657,7 +657,7 @@ static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) item->dwFlags |= IMAGE_FLAG_DIVIDED; if (item->inner_height <= 0 || item->inner_width <= 0) { DeleteObject(hbm); - item->hbm = 0; + item->hbm = nullptr; return; } } @@ -749,7 +749,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) void IMG_ReadItem(const char *itemname, const char *szFileName) { - ImageItem tmpItem, *newItem = NULL; + ImageItem tmpItem, *newItem = nullptr; char buffer[512], szItemNr[30]; char szFinalName[MAX_PATH]; HDC hdc = GetDC(pcli->hwndContactList); @@ -776,7 +776,7 @@ done_with_glyph: strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName)); tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0; - _splitpath(szFileName, szDrive, szPath, NULL, NULL); + _splitpath(szFileName, szDrive, szPath, nullptr, nullptr); mir_snprintf(szFinalName, "%s\\%s\\%s", szDrive, szPath, buffer); tmpItem.alpha = GetPrivateProfileIntA(itemname, "Alpha", 100, szFileName); tmpItem.alpha = min(tmpItem.alpha, 100); @@ -811,7 +811,7 @@ done_with_glyph: tmpItem.dwFlags |= IMAGE_FILLSOLID; } else - tmpItem.fillBrush = 0; + tmpItem.fillBrush = nullptr; GetPrivateProfileStringA(itemname, "Stretch", "None", buffer, 500, szFileName); if (buffer[0] == 'B' || buffer[0] == 'b') @@ -820,7 +820,7 @@ done_with_glyph: tmpItem.bStretch = IMAGE_STRETCH_V; else if (buffer[0] == 'w' || buffer[0] == 'W') tmpItem.bStretch = IMAGE_STRETCH_H; - tmpItem.hbm = 0; + tmpItem.hbm = nullptr; if (!_stricmp(itemname, "$glyphs")) { IMG_CreateItem(&tmpItem, szFinalName, hdc); @@ -840,12 +840,12 @@ done_with_glyph: memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; - if (g_ImageItems == NULL) + if (g_ImageItems == nullptr) g_ImageItems = newItem; else { ImageItem *pItem = g_ImageItems; - while (pItem->nextItem != 0) + while (pItem->nextItem != nullptr) pItem = pItem->nextItem; pItem->nextItem = newItem; } @@ -893,19 +893,19 @@ done_with_glyph: memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; p->imageItem = newItem; - if (g_ImageItems == NULL) + if (g_ImageItems == nullptr) g_ImageItems = newItem; else { ImageItem *pItem = g_ImageItems; - while (pItem->nextItem != 0) + while (pItem->nextItem != nullptr) pItem = pItem->nextItem; pItem->nextItem = newItem; } alloced = TRUE; } } - else if (newItem != NULL) + else if (newItem != nullptr) p->imageItem = newItem; } } @@ -928,29 +928,29 @@ void IMG_DeleteItems() free(pItem); pItem = pNextItem; } - g_ImageItems = NULL; + g_ImageItems = nullptr; while (pbItem) { DestroyWindow(pbItem->hWnd); pbNextItem = pbItem->nextItem; free(pbItem); pbItem = pbNextItem; } - g_ButtonItems = NULL; + g_ButtonItems = nullptr; if (g_CLUIImageItem) { IMG_DeleteItem(g_CLUIImageItem); free(g_CLUIImageItem); } - g_CLUIImageItem = NULL; + g_CLUIImageItem = nullptr; if (g_glyphItem) { IMG_DeleteItem(g_glyphItem); free(g_glyphItem); } - g_glyphItem = NULL; + g_glyphItem = nullptr; for (i = 0; i < arStatusItems.getCount(); i++) - arStatusItems[i]->imageItem = NULL; + arStatusItems[i]->imageItem = nullptr; } static UINT nextButtonID = IDC_TBFIRSTUID; @@ -1139,20 +1139,20 @@ static void BTN_ReadItem(char *itemName, char *file) newItem = (ButtonItem *)malloc(sizeof(ButtonItem)); memset(newItem, 0, sizeof(ButtonItem)); - if (g_ButtonItems == NULL) { + if (g_ButtonItems == nullptr) { g_ButtonItems = newItem; *newItem = tmpItem; - newItem->nextItem = 0; + newItem->nextItem = nullptr; } else { ButtonItem *curItem = g_ButtonItems; while (curItem->nextItem) curItem = curItem->nextItem; *newItem = tmpItem; - newItem->nextItem = 0; + newItem->nextItem = nullptr; curItem->nextItem = newItem; } - newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_hInst, NULL); + newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_hInst, nullptr); CustomizeButton(newItem->hWnd, false, false, true); SendMessage(newItem->hWnd, BUTTONSETBTNITEM, 0, (LPARAM)newItem); if (newItem->dwFlags & BUTTON_ISTOGGLE) @@ -1174,7 +1174,7 @@ void IMG_LoadItems() // TODO: rewrite the skin loading in wchar_t manner char szFileName[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, 0, 0); + WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, nullptr, nullptr); db_free(&dbv); @@ -1227,11 +1227,11 @@ void LoadPerContactSkins(wchar_t *tszFileName) ptrA szSections(LPSTR(calloc(3002, 1))); char *p = szSections; - StatusItems_t *items = NULL, *this_item; + StatusItems_t *items = nullptr, *this_item; int i = 1; char file[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, file, MAX_PATH, 0, 0); + WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, file, MAX_PATH, nullptr, nullptr); file[MAX_PATH - 1] = 0; ReadItem(&default_item, "%Default", file); @@ -1262,11 +1262,11 @@ void LoadPerContactSkins(wchar_t *tszFileName) if (items) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) continue; char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != NULL) { + if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != nullptr) { DBVARIANT dbv = { 0 }; if (db_get(hContact, szProto, uid, &dbv)) break; @@ -1405,7 +1405,7 @@ void extbk_import(char *file, HWND hwndDlg) char szString[MAX_PATH]; szString[0] = 0; - while (_tagSettings[i].szModule != NULL) { + while (_tagSettings[i].szModule != nullptr) { data = 0; GetPrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file); switch (_tagSettings[i].size) { @@ -1435,7 +1435,7 @@ void extbk_import(char *file, HWND hwndDlg) pcli->pfnClcOptionsChanged(); ConfigureCLUIGeometry(1); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); } static void ApplyCLUISkin() @@ -1446,18 +1446,18 @@ static void ApplyCLUISkin() if (!db_get_ws(NULL, "CLC", "AdvancedSkin", &dbv)) { MY_pathToAbsolute(dbv.ptszVal, tszFinalName); - WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, 0, 0); + WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, nullptr, nullptr); if (db_get_b(NULL, "CLUI", "skin_changed", 0)) { - extbk_import(szFinalName, 0); + extbk_import(szFinalName, nullptr); SaveCompleteStructToDB(); db_set_b(NULL, "CLUI", "skin_changed", 0); } IMG_LoadItems(); ShowWindow(pcli->hwndContactList, SW_SHOWNORMAL); - SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); - RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE); + RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE); db_free(&dbv); } } @@ -1528,7 +1528,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = L"*.clist\0"; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST | OFN_DONTADDTORECENT; @@ -1600,7 +1600,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int iInit = TRUE; - static HWND hwndSkinEdit = 0; + static HWND hwndSkinEdit = nullptr; switch (msg) { case WM_INITDIALOG: @@ -1662,7 +1662,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = "*.clist"; ofn.lpstrFile = str; ofn.Flags = OFN_HIDEREADONLY; @@ -1680,7 +1680,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = "*.clist"; ofn.lpstrFile = str; ofn.Flags = OFN_FILEMUSTEXIST; @@ -1733,7 +1733,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } break; case WM_DESTROY: - hwndSkinEdit = 0; + hwndSkinEdit = nullptr; break; } return FALSE; diff --git a/plugins/Clist_nicer/src/groupmenu.cpp b/plugins/Clist_nicer/src/groupmenu.cpp index 9ba48eac12..62b955c8c7 100644 --- a/plugins/Clist_nicer/src/groupmenu.cpp +++ b/plugins/Clist_nicer/src/groupmenu.cpp @@ -51,7 +51,7 @@ static HMENU hMenuOldContext; static INT_PTR GroupMenu_OnAddService(WPARAM wParam, LPARAM lParam) { MENUITEMINFO *mii = (MENUITEMINFO*)wParam; - if (mii == NULL) + if (mii == nullptr) return 0; if (hGroupMainMenuItemProxy == (HANDLE)lParam) { @@ -133,7 +133,7 @@ void InitGroupMenus(void) mi.root = Menu_AddGroupMenuItem(&mi); UNSET_UID(mi); - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.pszService = "CLISTMENUSGroup/CommandHelper"; CreateServiceFunction(mi.pszService, CommandHelper); for (int i = 0; i < _countof(hAppearanceItems); i++) { @@ -145,7 +145,7 @@ void InitGroupMenus(void) } SET_UID(mi, 0xc2895531, 0x98e9, 0x40bc, 0x9b, 0x8e, 0xfb, 0x33, 0xe8, 0xab, 0xcc, 0xef); - mi.root = NULL; + mi.root = nullptr; mi.position = 400000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); mi.pszService = "Options/OptionsCommand"; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 503d67591b..7bd7c4077b 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma comment(lib, "shlwapi.lib") -HINSTANCE g_hInst = 0; +HINSTANCE g_hInst = nullptr; CLIST_INTERFACE *pcli, coreCli; int hLangpack; @@ -115,7 +115,7 @@ static int systemModulesLoaded(WPARAM, LPARAM) static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact) { - return IconFromStatusMode(szProto, status, hContact, NULL); + return IconFromStatusMode(szProto, status, hContact, nullptr); } extern "C" int __declspec(dllexport) CListInitialise() diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 95f1907c5d..e916ac3b74 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -30,16 +30,16 @@ BOOL RowHeight::Init(ClcData *dat) dat->rowHeight = 0; dat->row_heights_size = 0; dat->row_heights_allocated = 0; - dat->row_heights = NULL; + dat->row_heights = nullptr; return TRUE; } void RowHeight::Free(ClcData *dat) { - if (dat->row_heights != NULL) { + if (dat->row_heights != nullptr) { free(dat->row_heights); - dat->row_heights = NULL; + dat->row_heights = nullptr; } dat->row_heights_allocated = 0; @@ -60,10 +60,10 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) size_grow += 100 - (size_grow % 100); - if (dat->row_heights != NULL) { + if (dat->row_heights != nullptr) { int *tmp = (int *)realloc((void *)dat->row_heights, sizeof(int) * size_grow); - if (tmp == NULL) { + if (tmp == nullptr) { Free(dat); return FALSE; } @@ -73,7 +73,7 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) else { dat->row_heights = (int *)malloc(sizeof(int) * size_grow); - if (dat->row_heights == NULL) { + if (dat->row_heights == nullptr) { Free(dat); return FALSE; } @@ -141,7 +141,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) while (true) { if (group->scanIndex == group->cl.getCount()) { group = group->parent; - if (group == NULL) break; // Finished list + if (group == nullptr) break; // Finished list group->scanIndex++; continue; } @@ -216,7 +216,7 @@ int RowHeight::hitTest(ClcData *dat, int pos_y) int RowHeight::getHeight(ClcData *dat, int item) { - if (dat->row_heights == 0) + if (dat->row_heights == nullptr) return 0; return dat->row_heights[item]; diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index c63cb5fb27..e69c39732e 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -53,7 +53,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM tooltip_active = FALSE; } KillTimer(hwnd, TIMERID_HOVER); - SetTimer(hwnd, TIMERID_HOVER, 750, 0); + SetTimer(hwnd, TIMERID_HOVER, 750, nullptr); break; case WM_NCHITTEST: @@ -150,7 +150,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc); if (PtInRect(&rc, pt)) { ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0); - if (PD == NULL) + if (PD == nullptr) continue; if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 9e444712e7..7032fb95b6 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -31,14 +31,14 @@ extern HPEN g_hPenCLUIFrames; extern FRAMEWND *wndFrameViewMode; typedef int(__cdecl *pfnEnumCallback)(char *szName); -static HWND sttClvmHwnd = 0; +static HWND sttClvmHwnd = nullptr; static int sttClvm_curItem = 0; -HMENU hViewModeMenu = 0; +HMENU hViewModeMenu = nullptr; static int nullImage; -static HWND hwndSelector = 0; -static HANDLE hInfoItem = 0; -static HIMAGELIST himlViewModes = 0; +static HWND hwndSelector = nullptr; +static HANDLE hInfoItem = nullptr; +static HIMAGELIST himlViewModes = nullptr; static DWORD sttStickyStatusMask = 0; static char sttModeName[2048]; @@ -60,7 +60,7 @@ static UINT _page2Controls[] = { IDC_CLIST, IDC_STATIC9, IDC_STATIC8, IDC_CLEARA int CLVM_EnumProc(const char *szSetting, LPARAM lParam) { pfnEnumCallback EnumCallback = (pfnEnumCallback)lParam; - if (szSetting != NULL) + if (szSetting != nullptr) EnumCallback((char *)szSetting); return 0; } @@ -109,7 +109,7 @@ static void ShowPage(HWND hwnd, int page) } if (pageChange) { SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE); } } @@ -161,7 +161,7 @@ static int FillDialog(HWND hwnd) HWND hwndList = GetDlgItem(hwnd, IDC_PROTOCOLS); LVITEM item = { 0 }; int protoCount = 0, i; - PROTOACCOUNT **accs = 0; + PROTOACCOUNT **accs = nullptr; CLVM_EnumModes(FillModes); ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES); @@ -195,7 +195,7 @@ static int FillDialog(HWND hwnd) SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); wchar_t *grpName; - for (i = 1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++) { + for (i = 1; (grpName = Clist_GroupGetName(i, nullptr)) != nullptr; i++) { item.pszText = grpName; SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } @@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP himlViewModes = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 12, 0); for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) - ImageList_AddIcon(himlViewModes, Skin_LoadProtoIcon(NULL, i)); + ImageList_AddIcon(himlViewModes, Skin_LoadProtoIcon(nullptr, i)); { HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0); nullImage = ImageList_AddIcon(himlViewModes, hIcon); @@ -581,7 +581,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP { CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); - cii.hParentGroup = 0; + cii.hParentGroup = nullptr; cii.pszText = LPGENW("*** All contacts ***"); hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); } @@ -629,7 +629,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE); break; case IDC_DELETEVIEWMODE: - if (MessageBox(0, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { + if (MessageBox(nullptr, TranslateT("Really delete this view mode? This cannot be undone"), TranslateT("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { char szSetting[256]; int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0); if (iLen) { @@ -677,7 +677,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (mir_strlen(szBuf) > 2) { if (db_get_dw(NULL, CLVM_MODULE, szBuf, -1) != -1) - MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK); + MessageBox(nullptr, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK); else { int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf); if (iNewItem != LB_ERR) { @@ -742,7 +742,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP DWORD hitFlags; HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); - if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA)) + if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA)) break; int iImage = SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0)); @@ -798,7 +798,7 @@ void BuildViewModeMenu() CLVM_EnumModes(FillMenuCallback); if (GetMenuItemCount(hViewModeMenu) > 0) - AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hViewModeMenu, MF_STRING, 10001, TranslateT("Setup view modes...")); AppendMenu(hViewModeMenu, MF_STRING, 10002, TranslateT("Clear current view mode")); @@ -821,18 +821,18 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_CREATE: hwndSelector = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_SELECTMODE, g_hInst, NULL); + hwnd, (HMENU)IDC_SELECTMODE, g_hInst, nullptr); CustomizeButton(hwndSelector, false, false, false); SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE); SendMessage(hwndSelector, BUTTONSETSENDONDOWN, TRUE, 0); { HWND hwndButton = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, NULL); + hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, nullptr); CustomizeButton(hwndButton, false, false, false); SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Setup view modes"), BATF_UNICODE); hwndButton = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, - hwnd, (HMENU)IDC_RESETMODES, g_hInst, NULL); + hwnd, (HMENU)IDC_RESETMODES, g_hInst, nullptr); CustomizeButton(hwndButton, false, false, false); SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Clear view mode and return to default display"), BATF_UNICODE); } @@ -856,11 +856,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { HDWP PosBatch = BeginDeferWindowPos(3); GetClientRect(hwnd, &rcCLVMFrame); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_RESETMODES), nullptr, rcCLVMFrame.right - 24, 1, 22, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_CONFIGUREMODES), nullptr, rcCLVMFrame.right - 47, 1, 22, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); - PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), 0, + PosBatch = DeferWindowPos(PosBatch, GetDlgItem(hwnd, IDC_SELECTMODE), nullptr, 2, 1, rcCLVMFrame.right - 50, 20, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS); EndDeferWindowPos(PosBatch); } @@ -942,7 +942,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM POINT pt; pt.x = rc.left; pt.y = rc.bottom; - int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr); if (selection) { if (selection == 10001) goto clvm_config_command; @@ -977,7 +977,7 @@ clvm_reset_command: case IDC_CONFIGUREMODES: clvm_config_command: if (!g_ViewModeOptDlg) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0); break; } break; @@ -1001,10 +1001,10 @@ void CreateViewModeFrame() wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInst; - wndclass.hIcon = 0; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hIcon = nullptr; + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE); - wndclass.lpszMenuName = 0; + wndclass.lpszMenuName = nullptr; wndclass.lpszClassName = L"CLVMFrameWindow"; RegisterClass(&wndclass); @@ -1016,7 +1016,7 @@ void CreateViewModeFrame() frame.height = 22; frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE; frame.align = alBottom; - frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", L"CLVM", WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL); + frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", L"CLVM", WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr); g_hwndViewModeFrame = frame.hWnd; hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0); CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS); @@ -1063,7 +1063,7 @@ void ApplyViewMode(const char *name) timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0)); strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256); cfg::dat.old_viewmode[255] = 0; - SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL); + SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, nullptr); } strncpy_s(cfg::dat.current_viewmode, name, _TRUNCATE); diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp index a532871ec1..b0a2734abb 100644 --- a/plugins/Cln_skinedit/src/main.cpp +++ b/plugins/Cln_skinedit/src/main.cpp @@ -40,7 +40,7 @@ PLUGININFOEX pluginInfo = { {0x21948c89, 0xb549, 0x4c9d, {0x8b, 0x4f, 0x3f, 0x37, 0x26, 0xec, 0x6b, 0x4b}} }; -HINSTANCE g_hInst = 0; +HINSTANCE g_hInst = nullptr; int hLangpack; StatusItems_t **StatusItems; @@ -542,7 +542,7 @@ static UINT _controls_to_refresh[] = { static void RefreshControls(HWND hwnd) { for(int i = 0; _controls_to_refresh[i]; i++) - InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), NULL, FALSE); + InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), nullptr, FALSE); } // wenn die listbox geändert wurde @@ -604,7 +604,7 @@ static void OnListItemsChange(HWND hwndDlg) } else ChangeControlItems(hwndDlg, 1, 0); FillOptionDialogByStatusItem(hwndDlg, &DialogSettingForMultiSel); - InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), nullptr, FALSE); } SendMessage(hwndDlg, WM_SETREDRAW, TRUE, 0); RefreshControls(hwndDlg); @@ -640,7 +640,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) { case WM_INITDIALOG: psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION)); - if (psd == NULL) + if (psd == nullptr) return FALSE; memset(psd, 0, sizeof(SKINDESCRIPTION)); memcpy(psd, (void *)lParam, sizeof(SKINDESCRIPTION)); @@ -656,13 +656,13 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa psd->hMenuItems = CreatePopupMenu(); AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, LPGENW("Copy from")); - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, nullptr); { for (int i = ID_EXTBK_FIRST; i < ID_EXTBK_LAST; i++) { int iOff = StatusItems[i - ID_EXTBK_FIRST]->szName[0] == '{' ? 3 : 0; if (iOff) - AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL); + AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, nullptr); AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST]->szName[iOff]); } } @@ -689,7 +689,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; int iItem = dis->itemData; - StatusItems_t *item = 0; + StatusItems_t *item = nullptr; SetBkMode(dis->hDC, TRANSPARENT); FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW)); @@ -738,7 +738,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa GetWindowRect(hwndList, &rc); if (PtInRect(&rc, pt)) { - int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSelection >= ID_EXTBK_FIRST && iSelection < ID_EXTBK_LAST) { iSelection -= ID_EXTBK_FIRST; diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index 2bdb577c19..f1157a52b2 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -53,7 +53,7 @@ unsigned CDropboxService::RequestAccessTokenThread(void *owner, void *param) DropboxAPI::GetAccessTokenRequest request(requestToken); NLHR_PTR response(request.Send(service->hConnection)); - if (response == NULL || response->resultCode != HTTP_CODE_OK) { + if (response == nullptr || response->resultCode != HTTP_CODE_OK) { Netlib_Logf(service->hConnection, "%s: %s", service->GetModule(), service->HttpStatusToError()); //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR); return 0; @@ -171,7 +171,7 @@ void CDropboxService::CreateSharedLink(const char *path, char *url) DropboxAPI::CreateSharedLinkRequest shareRequest(token, path); NLHR_PTR response(shareRequest.Send(hConnection)); - if (response == NULL) + if (response == nullptr) throw Exception(HttpStatusToError()); if (!HTTP_CODE_SUCCESS(response->resultCode) && diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp index 0f5e2c793d..5c5b7703d4 100644 --- a/plugins/CloudFile/src/Services/google_service.cpp +++ b/plugins/CloudFile/src/Services/google_service.cpp @@ -26,7 +26,7 @@ bool CGDriveService::IsLoggedIn() ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret")); if (!token || token[0] == 0) return false; - time_t now = time(NULL); + time_t now = time(nullptr); time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn"); return now < expiresIn; } @@ -45,7 +45,7 @@ void CGDriveService::Login() db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn); return; @@ -74,7 +74,7 @@ unsigned CGDriveService::RequestAccessTokenThread(void *owner, void *param) GDriveAPI::GetAccessTokenRequest request(requestToken); NLHR_PTR response(request.Send(service->hConnection)); - if (response == NULL || response->resultCode != HTTP_CODE_OK) { + if (response == nullptr || response->resultCode != HTTP_CODE_OK) { const char *error = response->dataLength ? response->pData : service->HttpStatusToError(response->resultCode); @@ -103,7 +103,7 @@ unsigned CGDriveService::RequestAccessTokenThread(void *owner, void *param) db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn); node = root.at("refresh_token"); diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index 9f0cb30c7b..38519e6d55 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -26,7 +26,7 @@ bool COneDriveService::IsLoggedIn() ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret")); if (!token || token[0] == 0) return false; - time_t now = time(NULL); + time_t now = time(nullptr); time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn"); return now < expiresIn; } @@ -45,7 +45,7 @@ void COneDriveService::Login() db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn); return; @@ -76,7 +76,7 @@ unsigned COneDriveService::RequestAccessTokenThread(void *owner, void *param) OneDriveAPI::GetAccessTokenRequest request(requestToken); NLHR_PTR response(request.Send(service->hConnection)); - if (response == NULL || response->resultCode != HTTP_CODE_OK) { + if (response == nullptr || response->resultCode != HTTP_CODE_OK) { const char *error = response->dataLength ? response->pData : service->HttpStatusToError(response->resultCode); @@ -105,7 +105,7 @@ unsigned COneDriveService::RequestAccessTokenThread(void *owner, void *param) db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn); node = root.at("refresh_token"); diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index d012dd3cc8..1e4d5749cb 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -26,7 +26,7 @@ bool CYandexService::IsLoggedIn() ptrA token(db_get_sa(NULL, GetModule(), "TokenSecret")); if (!token || token[0] == 0) return false; - time_t now = time(NULL); + time_t now = time(nullptr); time_t expiresIn = db_get_dw(NULL, GetModule(), "ExpiresIn"); return now < expiresIn; } @@ -45,7 +45,7 @@ void CYandexService::Login() db_set_s(NULL, GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, GetModule(), "ExpiresIn", expiresIn); node = root.at("refresh_token"); @@ -77,7 +77,7 @@ unsigned CYandexService::RequestAccessTokenThread(void *owner, void *param) YandexAPI::GetAccessTokenRequest request(requestToken); NLHR_PTR response(request.Send(service->hConnection)); - if (response == NULL || response->resultCode != HTTP_CODE_OK) { + if (response == nullptr || response->resultCode != HTTP_CODE_OK) { const char *error = response->dataLength ? response->pData : service->HttpStatusToError(response->resultCode); @@ -106,7 +106,7 @@ unsigned CYandexService::RequestAccessTokenThread(void *owner, void *param) db_set_s(NULL, service->GetModule(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); - time_t expiresIn = time(NULL) + node.as_int(); + time_t expiresIn = time(nullptr) + node.as_int(); db_set_dw(NULL, service->GetModule(), "ExpiresIn", expiresIn); node = root.at("refresh_token"); diff --git a/plugins/CloudFile/src/cloud_service.cpp b/plugins/CloudFile/src/cloud_service.cpp index 3ad83d1e2f..90b84c0590 100644 --- a/plugins/CloudFile/src/cloud_service.cpp +++ b/plugins/CloudFile/src/cloud_service.cpp @@ -84,7 +84,7 @@ void CCloudService::Report(MCONTACT hContact, const wchar_t *data) char* CCloudService::PreparePath(const char *oldPath, char *newPath) { - if (oldPath == NULL) + if (oldPath == nullptr) mir_strcpy(newPath, ""); else if (*oldPath != '/') { @@ -136,7 +136,7 @@ void CCloudService::HttpResponseToError(NETLIBHTTPREQUEST *response) void CCloudService::HandleHttpError(NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) throw Exception(HttpStatusToError()); if (!HTTP_CODE_SUCCESS(response->resultCode)) diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp index e22e35e0fa..ae89626884 100644 --- a/plugins/CloudFile/src/icons.cpp +++ b/plugins/CloudFile/src/icons.cpp @@ -20,7 +20,7 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId) return iconList[i].hIcolib; - return NULL; + return nullptr; } HANDLE GetIconHandle(const char *name) @@ -29,7 +29,7 @@ HANDLE GetIconHandle(const char *name) if (mir_strcmpi(iconList[i].szName, name) == 0) return iconList[i].hIcolib; - return NULL; + return nullptr; } HICON LoadIconEx(int iconId, bool big) @@ -38,5 +38,5 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId) return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); - return NULL; + return nullptr; } \ No newline at end of file diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp index 58d8ef9708..036ee58601 100644 --- a/plugins/CloudFile/src/srmm.cpp +++ b/plugins/CloudFile/src/srmm.cpp @@ -64,7 +64,7 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam) //SetMenuItemBitmaps(hMenu, i, MF_BITMAP, hBitmap, hBitmap); } - int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, NULL); + int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, nullptr); if (pos > 0) { CCloudService *service = Services[pos - 1]; diff --git a/plugins/CloudFile/src/utils.cpp b/plugins/CloudFile/src/utils.cpp index e4846baf31..44a3149a25 100644 --- a/plugins/CloudFile/src/utils.cpp +++ b/plugins/CloudFile/src/utils.cpp @@ -19,7 +19,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, return; } - MessageBox(NULL, message, caption, MB_OK | flags); + MessageBox(nullptr, message, caption, MB_OK | flags); } void ShowNotification(const wchar_t *message, int flags, MCONTACT hContact) @@ -31,7 +31,7 @@ MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD cbBlob, PBY { DBEVENTINFO dbei = {}; dbei.szModule = MODULE; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.eventType = type; dbei.cbBlob = cbBlob; dbei.pBlob = pBlob; @@ -84,7 +84,7 @@ void PasteToInputArea(MCONTACT hContact, const wchar_t *data) void PasteToClipboard(const wchar_t *data) { - if (OpenClipboard(NULL)) { + if (OpenClipboard(nullptr)) { EmptyClipboard(); size_t size = sizeof(wchar_t) * (mir_wstrlen(data) + 1); diff --git a/plugins/CmdLine/src/CmdLine.cpp b/plugins/CmdLine/src/CmdLine.cpp index f73288f91b..b28fe18a7d 100644 --- a/plugins/CmdLine/src/CmdLine.cpp +++ b/plugins/CmdLine/src/CmdLine.cpp @@ -50,7 +50,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface(); if (InitServer()) - MessageBox(0, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK); + MessageBox(nullptr, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK); HookEvents(); return 0; diff --git a/plugins/CmdLine/src/hooked_events.cpp b/plugins/CmdLine/src/hooked_events.cpp index 1d7c336e03..663a7fe3b0 100644 --- a/plugins/CmdLine/src/hooked_events.cpp +++ b/plugins/CmdLine/src/hooked_events.cpp @@ -76,7 +76,7 @@ ACKDATA* GetAck(HANDLE hProcess) } } - return NULL; + return nullptr; } int OnProtoAck(WPARAM, LPARAM lParam) diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index d50af580e2..d8f7f39c5e 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -70,7 +70,7 @@ int Get2StateValue(char *state) int AccountName2Protocol(const char *accountName, OUT char *uniqueProtocolName, size_t length) { int count; - PROTOACCOUNT **accounts = NULL; + PROTOACCOUNT **accounts = nullptr; Proto_EnumAccounts(&count, &accounts); strncpy_s(uniqueProtocolName, length, accountName, _TRUNCATE); @@ -213,7 +213,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep CMStringA perAccountStatus; int count; - PROTOACCOUNT **accounts = NULL; + PROTOACCOUNT **accounts = nullptr; Proto_EnumAccounts(&count, &accounts); char pn[128]; @@ -243,7 +243,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep INT_PTR old = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); char po[128]; if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) { - announce_status_change(NULL, status, NULL); + announce_status_change(nullptr, status, nullptr); } PrettyStatusMode(old, po, sizeof(po)); @@ -272,7 +272,7 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep INT_PTR old = CallProtoService(protocol, PS_GETSTATUS, 0, 0); char po[128]; if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE)) { - announce_status_change(protocol, status, NULL); + announce_status_change(protocol, status, nullptr); } PrettyStatusMode(old, po, sizeof(po)); @@ -316,7 +316,7 @@ void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply re { char *awayMsg = argv[2]; int count = 0; - PROTOACCOUNT **accounts = NULL; + PROTOACCOUNT **accounts = nullptr; Proto_EnumAccounts(&count, &accounts); CMStringA szReply; @@ -704,8 +704,8 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl { char *service = argv[2]; if (ServiceExists(service)) { - void *wParam = NULL; - void *lParam = NULL; + void *wParam = nullptr; + void *lParam = nullptr; INT_PTR res1 = ParseValueParam(argv[3], wParam); INT_PTR res2 = ParseValueParam(argv[4], lParam); if ((res1 != 0) && (res2 != 0)) { @@ -757,8 +757,8 @@ MCONTACT ParseContactParam(char *contact) char account[128]; char protocol[128]; char *p = strrchr(contact, ':'); - if (p == 0) - return GetContactFromID(contact, (char*)NULL); + if (p == nullptr) + return GetContactFromID(contact, (char*)nullptr); *p = 0; strncpy_s(name, contact, _TRUNCATE); @@ -775,7 +775,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re ParseMessage(message, argv[argc - 1]); //get the message CMStringA szReply; - ACKDATA *ack = NULL; + ACKDATA *ack = nullptr; for (int i = 2; i < argc - 1; i++) { char *contact = argv[i]; MCONTACT hContact = ParseContactParam(contact); @@ -788,7 +788,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re HANDLE hProcess = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message); const int MAX_COUNT = 60; int counter = 0; - while (((ack = GetAck(hProcess)) == NULL) && (counter < MAX_COUNT)) { + while (((ack = GetAck(hProcess)) == nullptr) && (counter < MAX_COUNT)) { SleepEx(250, TRUE); counter++; } @@ -799,7 +799,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re if (ack->szModule) { szReply.AppendFormat(Translate("Message sent to '%s'."), contact); - DBEVENTINFO e = { 0 }; + DBEVENTINFO e = {}; char module[128]; e.eventType = EVENTTYPE_MESSAGE; e.flags = DBEF_SENT; @@ -809,7 +809,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re strncpy_s(module, ack->szModule, sizeof(module)); e.szModule = module; - e.timestamp = (DWORD)time(NULL); + e.timestamp = (DWORD)time(nullptr); db_event_add(ack->hContact, &e); } @@ -903,8 +903,8 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r char *module = argv[3]; char *key = argv[4]; - void *value = NULL; - char *wrote = NULL; + void *value = nullptr; + char *wrote = nullptr; int type = ParseValueParam(argv[5], value); switch (type) { @@ -1130,7 +1130,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe int type = ParseProxyType(argv[4]); char *host = argv[5]; long port; - char *stop = NULL; + char *stop = nullptr; port = strtol(argv[6], &stop, 10); if ((*stop == 0) && (type > 0)) { @@ -1181,7 +1181,7 @@ void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply repl AccountName2Protocol(account, protocol, sizeof(protocol)); int count = 0; - PROTOACCOUNT **accounts = NULL; + PROTOACCOUNT **accounts = nullptr; Proto_EnumAccounts(&count, &accounts); int i; @@ -1243,7 +1243,7 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account pos = strstr(lwrKeyword, "account:"); if (pos) { pos += 8; - if (strstr(lwrAccount, pos) == NULL) { + if (strstr(lwrAccount, pos) == nullptr) { matches = 0; break; @@ -1267,12 +1267,12 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account pos = strstr(lwrKeyword, "id:"); if (pos) { pos += 3; - if (strstr(lwrID, pos) == NULL) { + if (strstr(lwrID, pos) == nullptr) { matches = 0; break; } } - else if ((strstr(lwrName, lwrKeyword) == NULL)) { + else if ((strstr(lwrName, lwrKeyword) == nullptr)) { matches = 0; break; } @@ -1483,8 +1483,8 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re MCONTACT hContact = ParseContactParam(contact); if (hContact) { if (_stricmp(cmd, "show") == 0) { - char *stop1 = NULL; - char *stop2 = NULL; + char *stop1 = nullptr; + char *stop2 = nullptr; long start = strtol(argv[4], &stop1, 10); long stop = strtol(argv[5], &stop2, 10); if (!(*stop1) && !(*stop2)) { @@ -1619,7 +1619,7 @@ void HandleLuaCommand(PCommand command, TArgument *argv, int argc, PReply reply) if (_stricmp(argv[2], "call") == 0) { wchar_t *result = argc == 4 - ? lua_call(NULL, _A2T(argv[3])) + ? lua_call(nullptr, _A2T(argv[3])) : lua_call(_A2T(argv[3]), _A2T(argv[4])); mir_strcpy(reply->message, _T2A(result)); mir_free(result); diff --git a/plugins/CmdLine/src/mimcmd_ipc.cpp b/plugins/CmdLine/src/mimcmd_ipc.cpp index f61b70eb82..d9cf61a21a 100644 --- a/plugins/CmdLine/src/mimcmd_ipc.cpp +++ b/plugins/CmdLine/src/mimcmd_ipc.cpp @@ -20,14 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -HANDLE hsmCmdLine = NULL; -HANDLE hmClient = NULL; -HANDLE heServerExec = NULL; -HANDLE heServerDone = NULL; -HANDLE heServerClose = NULL; -HANDLE heServerBufferFull = NULL; +HANDLE hsmCmdLine = nullptr; +HANDLE hmClient = nullptr; +HANDLE heServerExec = nullptr; +HANDLE heServerDone = nullptr; +HANDLE heServerClose = nullptr; +HANDLE heServerBufferFull = nullptr; -PSharedData sdCmdLine = NULL; +PSharedData sdCmdLine = nullptr; int InitClient() @@ -60,26 +60,26 @@ int DestroyServer() int CreateSystemEvents() { - heServerExec = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_EXEC); - heServerDone = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_DONE); - heServerClose = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_CLOSE); - heServerBufferFull = CreateEventA(NULL, FALSE, FALSE, EVENT_SERVER_BUFFERFULL); + heServerExec = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_EXEC); + heServerDone = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_DONE); + heServerClose = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_CLOSE); + heServerBufferFull = CreateEventA(nullptr, FALSE, FALSE, EVENT_SERVER_BUFFERFULL); - return (heServerExec == NULL) || (heServerDone == NULL) || (heServerClose == NULL) || (heServerBufferFull == NULL); + return (heServerExec == nullptr) || (heServerDone == nullptr) || (heServerClose == nullptr) || (heServerBufferFull == nullptr); } int CreateMutexes() { - hmClient = CreateMutexA(NULL, FALSE, MUTEX_CLIENT_NAME); - return (hmClient == NULL); + hmClient = CreateMutexA(nullptr, FALSE, MUTEX_CLIENT_NAME); + return (hmClient == nullptr); } int CreateSharedMem() { - hsmCmdLine = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME); + hsmCmdLine = CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, sizeof(TSharedData), SHAREDMEM_NAME); sdCmdLine = (PSharedData) MapViewOfFile(hsmCmdLine, FILE_MAP_WRITE, 0, 0, sizeof(TSharedData)); - return (hsmCmdLine == NULL) || (sdCmdLine == NULL); + return (hsmCmdLine == nullptr) || (sdCmdLine == nullptr); } int DestroySystemEvents() diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp index ae146cd8ef..5faff619b9 100644 --- a/plugins/CmdLine/src/services.cpp +++ b/plugins/CmdLine/src/services.cpp @@ -72,11 +72,11 @@ int StartServer() { if (sdCmdLine->instances == 0) { - HANDLE server = mir_forkthread(ServerWorkerThread, 0); + HANDLE server = mir_forkthread(ServerWorkerThread, nullptr); if (server) { char path[MIMFOLDER_SIZE]; - GetModuleFileNameA(GetModuleHandle(NULL), path, sizeof(path)); + GetModuleFileNameA(GetModuleHandle(nullptr), path, sizeof(path)); char *p = strrchr(path, '\\'); if (p) { *p = 0; } strncpy_s(sdCmdLine->mimFolder, path, _TRUNCATE); @@ -86,7 +86,7 @@ int StartServer() } else PUShowMessageT(TranslateT("Could not create CommandLine listening server!"), SM_WARNING); } - else MessageBox(NULL, TranslateT("You can only run one instance of CmdLine plugin."), TranslateT("Error"), MB_ICONERROR | MB_OK); + else MessageBox(nullptr, TranslateT("You can only run one instance of CmdLine plugin."), TranslateT("Error"), MB_ICONERROR | MB_OK); } return failure; diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index df4f62e31d..3e10c68950 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -32,7 +32,7 @@ int Info(char *title, char *format, ...) str[tBytes] = 0; } va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); + return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } int MyPUShowMessage(char *lpzText, BYTE kind) @@ -41,14 +41,14 @@ int MyPUShowMessage(char *lpzText, BYTE kind) return PUShowMessage(lpzText, kind); char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); - return MessageBoxA(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); + return MessageBoxA(nullptr, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); } #define HEX_SIZE 8 char *BinToHex(int size, PBYTE data) { - char *szresult = NULL; + char *szresult = nullptr; int maxSize = size * 2 + HEX_SIZE + 1; szresult = (char *) new char[ maxSize ]; mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size); @@ -153,14 +153,14 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, char* GetContactName(MCONTACT hContact, char *szProto) { ptrW name(Contact_GetInfo(CNF_DISPLAY, hContact, szProto)); - return (name == NULL) ? NULL : strdup(_T2A(name)); + return (name == NULL) ? nullptr : strdup(_T2A(name)); } #pragma warning (default: 4312) #pragma warning (disable: 4312) void GetContactProto(MCONTACT hContact, char *szProto, size_t size) { - GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); + GetStringFromDatabase(hContact, "Protocol", "p", nullptr, szProto, size); } #pragma warning (default: 4312) @@ -176,7 +176,7 @@ char* GetContactID(MCONTACT hContact) char* GetContactID(MCONTACT hContact, char *szProto) { ptrW name(Contact_GetInfo(CNF_UNIQUEID, hContact, szProto)); - return (name == NULL) ? NULL : strdup(_T2A(name)); + return (name == NULL) ? nullptr : strdup(_T2A(name)); } #pragma warning (default: 4312) @@ -194,7 +194,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) wchar_t *tmp = pcli->pfnGetContactDisplayName(hContact, 0); strncpy_s(dispName, _T2A(tmp), _TRUNCATE); - if ((szHandle) && ((mir_strcmpi(szHandle, szID) == 0) || (mir_strcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) + if ((szHandle) && ((mir_strcmpi(szHandle, szID) == 0) || (mir_strcmpi(dispName, szID) == 0)) && ((szProto == nullptr) || (_stricmp(szProto, cProtocol) == 0))) found = 1; free(szHandle); @@ -203,7 +203,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) return hContact; } - return NULL; + return 0; } #pragma warning (default: 4312) @@ -211,7 +211,7 @@ MCONTACT GetContactFromID(char *szID, char *szProto) MCONTACT GetContactFromID(char *szID, wchar_t *szProto) { char protocol[1024]; - WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), nullptr, nullptr); return GetContactFromID(szID, protocol); } #pragma warning (default: 4312) diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index fe7a0d9aa1..a989e81651 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -4,18 +4,18 @@ HINSTANCE hInst; CLIST_INTERFACE *pcli; //PLUGINLINK *pluginLink=NULL; -HANDLE hOptInit = NULL; -static HWND hTimerWnd = (HWND)NULL; +HANDLE hOptInit = nullptr; +static HWND hTimerWnd = (HWND)nullptr; static UINT TID = (UINT)12021; //HANDLE hHookModulesLoaded=NULL; -HANDLE hCheckEvent = NULL; -HANDLE hCheckHook = NULL; -HANDLE hHookModulesLoaded = NULL; -HANDLE hHookPreShutdown = NULL; -HANDLE hConnectionCheckThread = NULL; -HANDLE hFilterOptionsThread = NULL; -HANDLE killCheckThreadEvent = NULL; -HANDLE hExceptionsMutex = NULL; +HANDLE hCheckEvent = nullptr; +HANDLE hCheckHook = nullptr; +HANDLE hHookModulesLoaded = nullptr; +HANDLE hHookPreShutdown = nullptr; +HANDLE hConnectionCheckThread = nullptr; +HANDLE hFilterOptionsThread = nullptr; +HANDLE killCheckThreadEvent = nullptr; +HANDLE hExceptionsMutex = nullptr; //HANDLE hCurrentEditMutex=NULL; int hLangpack = 0; @@ -32,11 +32,11 @@ int settingFiltersCount = 0; BOOL settingDefaultAction = TRUE; WORD settingStatusMask = 0; -struct CONNECTION *first = NULL; -struct CONNECTION *connExceptions = NULL; +struct CONNECTION *first = nullptr; +struct CONNECTION *connExceptions = nullptr; struct CONNECTION *connCurrentEdit; -struct CONNECTION *connExceptionsTmp = NULL; -struct CONNECTION *connCurrentEditModal = NULL; +struct CONNECTION *connExceptionsTmp = nullptr; +struct CONNECTION *connCurrentEditModal = nullptr; int currentStatus = ID_STATUS_OFFLINE, diffstat = 0; BOOL bOptionsOpen = FALSE; wchar_t *tcpStates[] = { L"CLOSED", L"LISTEN", L"SYN_SENT", L"SYN_RCVD", L"ESTAB", L"FIN_WAIT1", L"FIN_WAIT2", L"CLOSE_WAIT", L"CLOSING", L"LAST_ACK", L"TIME_WAIT", L"DELETE_TCB" }; @@ -94,7 +94,7 @@ void saveSettingsConnections(struct CONNECTION *connHead) char buff[128]; int i = 0; struct CONNECTION *tmp = connHead; - while (tmp != NULL) { + while (tmp != nullptr) { mir_snprintf(buff, "%dFilterIntIp", i); db_set_ws(NULL, PLUGINNAME, buff, tmp->strIntIp); @@ -119,7 +119,7 @@ void saveSettingsConnections(struct CONNECTION *connHead) //load filters from db struct CONNECTION* LoadSettingsConnections() { - struct CONNECTION *connHead = NULL; + struct CONNECTION *connHead = nullptr; DBVARIANT dbv; char buff[128]; int i = 0; @@ -251,12 +251,12 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L if (tmpPort[0] == '*') connCurrentEditModal->intIntPort = -1; else - connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); + connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, nullptr, FALSE); GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, _countof(tmpPort)); if (tmpPort[0] == '*') connCurrentEditModal->intExtPort = -1; else - connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); + connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, nullptr, FALSE); GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, _countof(connCurrentEditModal->strIntIp)); GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, _countof(connCurrentEditModal->strExtIp)); @@ -264,12 +264,12 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L connCurrentEditModal->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); - connCurrentEditModal = NULL; + connCurrentEditModal = nullptr; EndDialog(hWnd, IDOK); return TRUE; } case ID_CANCEL: - connCurrentEditModal = NULL; + connCurrentEditModal = nullptr; EndDialog(hWnd, IDCANCEL); return TRUE; } @@ -277,7 +277,7 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L break; case WM_CLOSE: { - connCurrentEditModal = NULL; + connCurrentEditModal = nullptr; EndDialog(hWnd, IDCANCEL); break; } @@ -374,8 +374,8 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case WM_COMMAND://user changed something, so get changes to variables PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); switch (LOWORD(wParam)) { - case IDC_INTERVAL: settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break; - case IDC_INTERVAL1: settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break; + case IDC_INTERVAL: settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, nullptr, FALSE); break; + case IDC_INTERVAL1: settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, nullptr, TRUE); break; case IDC_RESOLVEIP: settingResolveIp = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RESOLVEIP); break; case ID_CHK_DEFAULTACTION: settingDefaultAction = (BYTE)IsDlgButtonChecked(hwndDlg, ID_CHK_DEFAULTACTION); break; case ID_ADD: @@ -391,7 +391,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) { mir_free(cur); - cur = NULL; + cur = nullptr; } else { cur->next = connExceptionsTmp; @@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_DELETE: { int pos, pos1; - struct CONNECTION *cur = connExceptionsTmp, *pre = NULL; + struct CONNECTION *cur = connExceptionsTmp, *pre = nullptr; pos = (int)ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), -1, LVNI_FOCUSED); if (pos == -1)break; @@ -416,7 +416,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur; cur = cur->next; } - if (pre == NULL) + if (pre == nullptr) connExceptionsTmp = connExceptionsTmp->next; else (pre)->next = cur->next; @@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_UP: { int pos, pos1; - struct CONNECTION *cur = NULL, *pre = NULL, *prepre = NULL; + struct CONNECTION *cur = nullptr, *pre = nullptr, *prepre = nullptr; cur = connExceptionsTmp; @@ -441,12 +441,12 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur; cur = cur->next; } - if (prepre != NULL) { + if (prepre != nullptr) { pre->next = cur->next; cur->next = pre; prepre->next = cur; } - else if (pre != NULL) { + else if (pre != nullptr) { pre->next = cur->next; cur->next = pre; connExceptionsTmp = cur; @@ -459,7 +459,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case ID_DOWN: { int pos, pos1; - struct CONNECTION *cur = NULL, *pre = NULL; + struct CONNECTION *cur = nullptr, *pre = nullptr; cur = connExceptionsTmp; @@ -470,12 +470,12 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar pre = cur; cur = cur->next; } - if (cur == connExceptionsTmp&&cur->next != NULL) { + if (cur == connExceptionsTmp&&cur->next != nullptr) { connExceptionsTmp = cur->next; cur->next = cur->next->next; connExceptionsTmp->next = cur; } - else if (cur->next != NULL) { + else if (cur->next != nullptr) { struct CONNECTION *tmp = cur->next->next; pre->next = cur->next; cur->next->next = cur; @@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case NM_DBLCLK: { int pos, pos1; - struct CONNECTION *cur = NULL; + struct CONNECTION *cur = nullptr; cur = connExceptionsTmp; @@ -576,7 +576,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar case WM_DESTROY: bOptionsOpen = FALSE; deleteConnectionsTable(connExceptionsTmp); - connExceptionsTmp = NULL; + connExceptionsTmp = nullptr; return TRUE; } return 0; @@ -585,7 +585,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar //options page on miranda called int ConnectionNotifyOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG); odp.szTitle.w = _A2W(PLUGINNAME); @@ -644,7 +644,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) diffstat = 0; ResetEvent(killCheckThreadEvent); if (!hConnectionCheckThread) - hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, 0, (unsigned int*)&ConnectionCheckThreadId); + hConnectionCheckThread = (HANDLE)mir_forkthreadex(checkthread, nullptr, (unsigned int*)&ConnectionCheckThreadId); } else { int retv = 0; @@ -684,19 +684,19 @@ static unsigned __stdcall checkthread(void *) _OutputDebugString(L"check thread started"); #endif while (1) { - struct CONNECTION* conn = NULL, *connOld = first, *cur = NULL; + struct CONNECTION* conn = nullptr, *connOld = first, *cur = nullptr; #ifdef _DEBUG _OutputDebugString(L"checking connections table..."); #endif if (WAIT_OBJECT_0 == WaitForSingleObject(killCheckThreadEvent, 100)) { - hConnectionCheckThread = NULL; + hConnectionCheckThread = nullptr; return 0; } conn = GetConnectionsTable(); cur = conn; - while (cur != NULL) { - if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == NULL && (settingStatusMask & (1 << (cur->state - 1)))) { + while (cur != nullptr) { + if (searchConnection(first, cur->strIntIp, cur->strExtIp, cur->intIntPort, cur->intExtPort, cur->state) == nullptr && (settingStatusMask & (1 << (cur->state - 1)))) { #ifdef _DEBUG wchar_t msg[1024]; @@ -719,7 +719,7 @@ static unsigned __stdcall checkthread(void *) deleteConnectionsTable(connOld); Sleep(settingInterval); } - hConnectionCheckThread = NULL; + hConnectionCheckThread = nullptr; return 1; } @@ -821,7 +821,7 @@ static int modulesloaded(WPARAM, LPARAM) //#ifdef _DEBUG // _OutputDebugString("started check thread %d",hConnectionCheckThread); //#endif - killCheckThreadEvent = CreateEvent(NULL, FALSE, FALSE, L"killCheckThreadEvent"); + killCheckThreadEvent = CreateEvent(nullptr, FALSE, FALSE, L"killCheckThreadEvent"); hFilterOptionsThread = startFilterThread(); //updaterRegister(); @@ -855,7 +855,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); - hExceptionsMutex = CreateMutex(NULL, FALSE, L"ExceptionsMutex"); + hExceptionsMutex = CreateMutex(nullptr, FALSE, L"ExceptionsMutex"); LoadSettings(); connExceptions = LoadSettingsConnections(); diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index db9b205e0f..5d3d778517 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -HWND filterAddDlg = NULL; +HWND filterAddDlg = nullptr; extern HINSTANCE hInst; extern struct CONNECTION *connExceptions; extern HANDLE hFilterOptionsThread; @@ -14,7 +14,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM HANDLE startFilterThread() { - return (HANDLE)mir_forkthreadex(filterQueue, 0, (unsigned int*)&FilterOptionsThreadId); + return (HANDLE)mir_forkthreadex(filterQueue, nullptr, (unsigned int*)&FilterOptionsThreadId); } static unsigned __stdcall filterQueue(void *) @@ -22,21 +22,21 @@ static unsigned __stdcall filterQueue(void *) BOOL bRet; MSG msg; //while(1) - while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) + while ((bRet = GetMessage(&msg, nullptr, 0, 0)) != 0) { if (msg.message == WM_ADD_FILTER) { struct CONNECTION *conn = (struct CONNECTION *)msg.lParam; - filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), NULL, ConnectionFilterEditProc, (LPARAM)conn); + filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn); ShowWindow(filterAddDlg, SW_SHOW); } - if (NULL == filterAddDlg || !IsDialogMessage(filterAddDlg, &msg)) { /* Wine fix. */ + if (nullptr == filterAddDlg || !IsDialogMessage(filterAddDlg, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } } - hFilterOptionsThread = NULL; + hFilterOptionsThread = nullptr; return TRUE; } @@ -62,7 +62,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM } case WM_ACTIVATE: if (0 == wParam) // becoming inactive - filterAddDlg = NULL; + filterAddDlg = nullptr; else // becoming active filterAddDlg = hWnd; return FALSE; @@ -79,7 +79,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM } if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100)) { - if (connCurrentEdit == NULL) + if (connCurrentEdit == nullptr) { connCurrentEdit = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); connCurrentEdit->next = connExceptions; @@ -89,19 +89,19 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM if (tmpPort[0] == '*') connCurrentEdit->intIntPort = -1; else - connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE); + connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, nullptr, FALSE); GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, _countof(tmpPort)); if (tmpPort[0] == '*') connCurrentEdit->intExtPort = -1; else - connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE); + connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, nullptr, FALSE); GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, _countof(connCurrentEdit->strIntIp)); GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, _countof(connCurrentEdit->strExtIp)); GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, _countof(connCurrentEdit->PName)); connCurrentEdit->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0); - connCurrentEdit = NULL; + connCurrentEdit = nullptr; saveSettingsConnections(connExceptions); ReleaseMutex(hExceptionsMutex); } @@ -110,7 +110,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM return TRUE; } case ID_CANCEL: - connCurrentEdit = NULL; + connCurrentEdit = nullptr; DestroyWindow(hWnd); //EndDialog(hWnd,IDCANCEL); return TRUE; @@ -121,8 +121,8 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM case WM_CLOSE: DestroyWindow(hWnd); case WM_DESTROY: - filterAddDlg = NULL; - connCurrentEdit = NULL; + filterAddDlg = nullptr; + connCurrentEdit = nullptr; //DestroyWindow(hWnd); //PostQuitMessage(0); break; @@ -132,7 +132,7 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM BOOL checkFilter(struct CONNECTION *head, struct CONNECTION *conn) { - for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) + for (struct CONNECTION *cur = head; cur != nullptr; cur = cur->next) if (wildcmpw(conn->PName, cur->PName) && wildcmpw(conn->strIntIp, cur->strIntIp) && wildcmpw(conn->strExtIp, cur->strExtIp) && (cur->intIntPort == -1 || cur->intIntPort == conn->intIntPort) && (cur->intExtPort == -1 || cur->intExtPort == conn->intExtPort)) return cur->Pid; diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index 663e22a16e..93d906cc4f 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -4,9 +4,9 @@ struct CONNECTION *GetConnectionsTable() { // Declare and initialize variables MIB_TCPTABLE_OWNER_PID *pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(sizeof(MIB_TCPTABLE_OWNER_PID)); - if (pTcpTable == NULL) { + if (pTcpTable == nullptr) { //printf("Error allocating memory!\n"); - return NULL; + return nullptr; } DWORD dwSize = sizeof(MIB_TCPTABLE_OWNER_PID); @@ -16,9 +16,9 @@ struct CONNECTION *GetConnectionsTable() if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) { FREE(pTcpTable); pTcpTable = (MIB_TCPTABLE_OWNER_PID *)MALLOC(dwSize); - if (pTcpTable == NULL) { + if (pTcpTable == nullptr) { //printf("Error allocating memory\n"); - return NULL; + return nullptr; } } @@ -27,12 +27,12 @@ struct CONNECTION *GetConnectionsTable() if ((dwRetVal = GetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0)) != NO_ERROR) { //printf("\tGetTcpTable() failed with return value %d\n", dwRetVal); FREE(pTcpTable); - return NULL; + return nullptr; } //printf("\tLocal Addr\tLocal Port\tRemote Addr\tRemote Port\n"); //printf("Number of entries: %d\n", (int) pTcpTable->dwNumEntries); struct in_addr IpAddr; - struct CONNECTION *connHead = NULL; + struct CONNECTION *connHead = nullptr; for (DWORD i = 0; i < pTcpTable->dwNumEntries; i++) { struct CONNECTION *newConn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); memset(newConn, 0, sizeof(struct CONNECTION)); @@ -114,18 +114,18 @@ void deleteConnectionsTable(struct CONNECTION *head) { struct CONNECTION *cur = head, *del; - while (cur != NULL) { + while (cur != nullptr) { del = cur; cur = cur->next; mir_free(del); head = cur; } - head = NULL; + head = nullptr; } struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wchar_t *extIp, int intPort, int extPort, int state) { - for (struct CONNECTION *cur = head; cur != NULL; cur = cur->next) { + for (struct CONNECTION *cur = head; cur != nullptr; cur = cur->next) { if (mir_wstrcmp(cur->strIntIp, intIp) == 0 && mir_wstrcmp(cur->strExtIp, extIp) == 0 && cur->intExtPort == extPort && @@ -133,7 +133,7 @@ struct CONNECTION *searchConnection(struct CONNECTION *head, wchar_t *intIp, wch cur->state == state) return cur; } - return NULL; + return nullptr; } void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len) @@ -144,5 +144,5 @@ void getDnsName(wchar_t *strIp, wchar_t *strHostName, size_t len) iaHost.s_addr = inet_addr(szStrIP); mir_free(szStrIP); hostent *h = gethostbyaddr((char *)&iaHost, sizeof(struct in_addr), AF_INET); - wcsncpy_s(strHostName, len, (h == NULL) ? strIp : _A2T(h->h_name), _TRUNCATE); + wcsncpy_s(strHostName, len, (h == nullptr) ? strIp : _A2T(h->h_name), _TRUNCATE); } diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index f11c0b807b..43c85aea52 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -81,16 +81,16 @@ typedef struct { -static SortedList lModules = { 0 }; +static SortedList lModules = {}; -static LOGWIN *pActive = NULL; +static LOGWIN *pActive = nullptr; static int tabCount = 0; static RECT rcTabs = { 0 }; -static HWND hTabs = NULL; -static HWND hwndConsole = NULL; +static HWND hTabs = nullptr; +static HWND hwndConsole = nullptr; -static HIMAGELIST gImg = NULL; -static HFONT hfLogFont = NULL; +static HIMAGELIST gImg = nullptr; +static HFONT hfLogFont = nullptr; static COLORREF colLogFont; static COLORREF colBackground; @@ -105,8 +105,8 @@ static DWORD gWrapLen = DEFAULT_WRAPLEN; static DWORD OutMsgs = 0; static DWORD InMsgs = 0; -static HICON hIcons[15] = { 0 }; -static HGENMENU hMenu = NULL; +static HICON hIcons[15] = {}; +static HGENMENU hMenu = nullptr; static void LoadSettings(); static void ShowConsole(int show); @@ -115,13 +115,13 @@ static int Openfile(wchar_t *outputFile, int selection); //////////////////////////////////////////////////////////////////////////////// -static HANDLE hTTBButt = 0; +static HANDLE hTTBButt = nullptr; static int OnTTBLoaded(WPARAM, LPARAM) { int state = IsWindowVisible(hwndConsole); - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.hIconHandleUp = LoadIcon(IDI_BTN_UP); ttb.hIconHandleDn = LoadIcon(IDI_BTN_DN); ttb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; @@ -144,7 +144,7 @@ void ScrollDown(LOGWIN *dat) { static void ShowConsole(int show) { - HWND hwnd = NULL; + HWND hwnd = nullptr; if (!hwndConsole || !pActive) return; @@ -162,7 +162,7 @@ static void ShowConsole(int show) SetForegroundWindow(hwnd); if (show) - RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE); + RedrawWindow(pActive->hList, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE); if (hMenu) Menu_ModifyItem(hMenu, show ? LPGENW("Hide Console") : LPGENW("Show Console")); @@ -238,7 +238,7 @@ static LRESULT CALLBACK SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } if (wParam == VK_LEFT && ctrl) { - NMHDR nmhdr = { 0 }; + NMHDR nmhdr = {}; int tab = TabCtrl_GetCurSel(hTabs); if (tab == 0) @@ -253,7 +253,7 @@ static LRESULT CALLBACK SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } if (wParam == VK_RIGHT && ctrl) { - NMHDR nmhdr = { 0 }; + NMHDR nmhdr = {}; int tab = TabCtrl_GetCurSel(hTabs); int count = TabCtrl_GetItemCount(hTabs); tab = (tab + 1) % count; @@ -381,7 +381,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP str = wcstok(str, L"\n"); - if (gIcons && str != NULL) { + if (gIcons && str != nullptr) { lvi.mask = LVIF_TEXT | LVIF_IMAGE; if (wcsstr(str, L"Data received")) { @@ -402,7 +402,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP } else lvi.mask = LVIF_TEXT; - while (str != NULL) { + while (str != nullptr) { lvi.pszText = &str[0]; tmplen = len = (DWORD)mir_wstrlen(lvi.pszText); @@ -423,7 +423,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP last = ListView_InsertItem(dat->hList, &lvi); - str = wcstok(NULL, L"\n"); + str = wcstok(nullptr, L"\n"); if (str) dat->newline = 1; lvi.iImage = IMG_EMPTY; @@ -635,7 +635,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam // lParam = DUMPMSG int idx; LOGWIN *lw; - LOGWIN lw2 = { 0 }; + LOGWIN lw2 = {}; DUMPMSG *dumpMsg = (DUMPMSG *)lParam; if (!pActive) { @@ -745,7 +745,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam SetFocus(pActive->hList); } else - pActive = NULL; + pActive = nullptr; } } @@ -796,7 +796,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam case HM_RESTART: { if (pActive) { - pActive = NULL; + pActive = nullptr; PostMessage(hwndDlg, HM_RESTART, 0, 0); return TRUE; } @@ -881,7 +881,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam DestroyWindow(hwndDlg); break; case WM_DESTROY: - pActive = NULL; + pActive = nullptr; if (hfLogFont) DeleteObject(hfLogFont); PostQuitMessage(0); break; @@ -899,25 +899,25 @@ void __cdecl ConsoleThread(void*) MSG msg; HWND hwnd; - hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONSOLE), NULL, ConsoleDlgProc); + hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONSOLE), nullptr, ConsoleDlgProc); if (!hwnd) return; - while (GetMessage(&msg, NULL, 0, 0) > 0) { + while (GetMessage(&msg, nullptr, 0, 0) > 0) { switch (msg.message) { case HM_DUMP: OutMsgs++; break; } - if (hwnd != NULL && IsDialogMessage(hwnd, &msg)) /* Wine fix. */ + if (hwnd != nullptr && IsDialogMessage(hwnd, &msg)) /* Wine fix. */ continue; TranslateMessage(&msg); DispatchMessage(&msg); } - hwndConsole = NULL; + hwndConsole = nullptr; } /////////////////////////////////////////////////////////////////////////////// @@ -972,7 +972,7 @@ static void LoadSettings() static void SaveSettings(HWND hwndDlg) { - int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE); + int len = GetDlgItemInt(hwndDlg, IDC_WRAP, nullptr, FALSE); if (len < MIN_WRAPLEN) len = MIN_WRAPLEN; else if (len > MAX_WRAPLEN) @@ -982,7 +982,7 @@ static void SaveSettings(HWND hwndDlg) SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); db_set_b(NULL, "Console", "Wrap", (BYTE)len); - len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE); + len = GetDlgItemInt(hwndDlg, IDC_LIMIT, nullptr, FALSE); if (len < MIN_LIMIT) len = MIN_LIMIT; else if (len > MAX_LIMIT) @@ -1082,7 +1082,7 @@ static int OnColourChange(WPARAM, LPARAM) static int OnFontChange(WPARAM, LPARAM) { if (hwndConsole) { - HFONT hf = NULL; + HFONT hf = nullptr; LOGFONT LogFont = { 0 }; colLogFont = Font_GetW(L"Console", L"Text", &LogFont); @@ -1183,7 +1183,7 @@ static int stringCompare(LOGWIN *lw1, LOGWIN *lw2) static UINT logicons[] = { IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO }; -static HANDLE hConsoleThread = NULL; +static HANDLE hConsoleThread = nullptr; void InitConsole() { @@ -1215,7 +1215,7 @@ void InitConsole() LoadSettings(); - hConsoleThread = mir_forkthread(ConsoleThread, 0); + hConsoleThread = mir_forkthread(ConsoleThread, nullptr); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole); HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); diff --git a/plugins/Console/src/init.cpp b/plugins/Console/src/init.cpp index d1aa172b1f..634b6722f9 100644 --- a/plugins/Console/src/init.cpp +++ b/plugins/Console/src/init.cpp @@ -64,7 +64,7 @@ HANDLE LoadIcon(int iIconID) for (int i = 0; i < _countof(iconList); i++) if (iconList[i].defIconID == iIconID) return iconList[i].hIcolib; - return NULL; + return nullptr; } extern "C" __declspec(dllexport) int Load(void) diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 5e3289a06a..66b604553d 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -130,7 +130,7 @@ static int HookPreBuildContactMenu(WPARAM hContact, LPARAM) static int HookModulesLoaded(WPARAM, LPARAM) { - char* modules[2] = { 0 }; + char* modules[2] = {}; modules[0] = MODULENAME; CallService("DBEditorpp/RegisterModule", (WPARAM)modules, 1); @@ -179,7 +179,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM) //find window for hContact HWND hWnd = WindowList_Find(g_hSendWindowList, wParam); if (!hWnd) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), NULL, SendDlgProc, wParam); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), nullptr, SendDlgProc, wParam); else { SetForegroundWindow(hWnd); SetFocus(hWnd); @@ -189,7 +189,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM) static INT_PTR ServiceReceiveCommand(WPARAM, LPARAM lParam) { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), NULL, RecvDlgProc, lParam); + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), nullptr, RecvDlgProc, lParam); return 0; } diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 511b4c0972..75a07be4fe 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -28,10 +28,10 @@ TRecvContactsData::TRecvContactsData(MCONTACT contact) { mhContact = contact; - hHook = NULL; + hHook = nullptr; cbReceived = 0; - maReceived = NULL; - haUin = NULL; + maReceived = nullptr; + haUin = nullptr; } TRecvContactsData::~TRecvContactsData() @@ -103,12 +103,12 @@ static void EnableGroupCombo(HWND hwndDlg) static void RebuildGroupCombo(HWND hwndDlg) { - int bHasGroups = Clist_GroupGetName(0, NULL) != 0; + int bHasGroups = Clist_GroupGetName(0, nullptr) != nullptr; HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS); if (bHasGroups) { int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0); - wchar_t *curst = NULL; + wchar_t *curst = nullptr; EnableDlgItem(hwndDlg, IDC_ENABLEGROUPS, TRUE); EnableGroupCombo(hwndDlg); @@ -120,7 +120,7 @@ static void RebuildGroupCombo(HWND hwndDlg) SendMessage(hGroupsCombo, CB_RESETCONTENT, 0, 0); wchar_t *szGroup; - for (int i=1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) { + for (int i=1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) { int nIndex = SendMessage(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup); SendMessage(hGroupsCombo, CB_SETITEMDATA, nIndex, i); } @@ -299,7 +299,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS); HWND hGroupsCheck = GetDlgItem(hwndDlg, IDC_ENABLEGROUPS); int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0); - wchar_t* caGroup = NULL; + wchar_t* caGroup = nullptr; int nGroupId = -1; if (curs != CB_ERR && IsWindowEnabled(hGroupsCheck) && SendMessage(hGroupsCheck, BM_GETCHECK, 0, 0)) { //got groups, get the one selected in combo @@ -375,7 +375,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara RECT rc; GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU), &rc); HMENU hMenu = Menu_BuildContactMenu(wndData->mhContact); - TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr); DestroyMenu(hMenu); } break; @@ -413,7 +413,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int ci = ListView_HitTest(hLV, &lvh); if (ci==-1) break; // mouse is not over any item wndData->iPopupItem = ci; - TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, NULL); + TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, nullptr); } break; diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 1016a386dc..6ddd675442 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -29,7 +29,7 @@ TSendProcessList::TSendProcessList() { Count = 0; - Items = NULL; + Items = nullptr; } TSendProcessList::~TSendProcessList() @@ -61,9 +61,9 @@ void TSendProcessList::Remove(HANDLE hProcc) TSendContactsData::TSendContactsData(MCONTACT contact) : uacklist() { hContact = contact; - hHook = NULL; - hError = NULL; - aContacts = NULL; + hHook = nullptr; + hError = nullptr; + aContacts = nullptr; nContacts = 0; } @@ -84,7 +84,7 @@ void TSendContactsData::UnhookProtoAck() { if (hHook) { UnhookEvent(hHook); - hHook = NULL; + hHook = nullptr; } } @@ -197,7 +197,7 @@ static void SetAllContactChecks(HWND hwndList, MCONTACT hReceiver) // doubtful n binListEvent = TRUE; char *szProto = GetContactProto(hReceiver); - if (szProto == NULL) + if (szProto == nullptr) return; if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT)) @@ -266,7 +266,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case DM_ERRORDECIDED: EnableWindow(hwndDlg, TRUE); - wndData->hError = NULL; + wndData->hError = nullptr; switch (wParam) { case MSGERROR_CANCEL: wndData->UnhookProtoAck(); @@ -275,7 +275,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara delete g_aAckData.Remove(wndData->uacklist.Items[i]); // remove our ackdata & release structure mir_free(wndData->uacklist.Items); - wndData->uacklist.Items = NULL; + wndData->uacklist.Items = nullptr; wndData->uacklist.Count = 0; } EnableDlgItem(hwndDlg, IDOK, TRUE); @@ -333,7 +333,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (!wndData->SendContacts(hwndDlg)) break; - SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), NULL); + SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), nullptr); } break; @@ -358,7 +358,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara RECT rc; GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc); HMENU hMenu = Menu_BuildContactMenu(wndData->hContact); - TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr); DestroyMenu(hMenu); } break; @@ -384,7 +384,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; TAckData *ackData = g_aAckData.Get(ack->hProcess); - if (ackData == NULL) + if (ackData == nullptr) break; // on unknown hprocc go away if (ackData->hContact != ack->hContact) @@ -402,7 +402,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara dbei.szModule = GetContactProto(ackData->hContact); dbei.eventType = EVENTTYPE_CONTACTS; dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); //make blob TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend)); memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend))); @@ -484,7 +484,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT rc, rcParent; GetWindowRect(hwndDlg, &rc); GetWindowRect(GetParent(hwndDlg), &rcParent); - SetWindowPos(hwndDlg, 0, + SetWindowPos(hwndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 257cdb555f..9ea296f915 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -52,19 +52,19 @@ char* __fastcall null_strdup(const char *string) if (string) return strdup(string); - return NULL; + return nullptr; } wchar_t* GetContactUID(MCONTACT hContact) { char *szProto = GetContactProto(hContact); char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == 0) - return NULL; + if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == nullptr) + return nullptr; DBVARIANT vrUid; if (db_get_s(hContact, szProto, uid, &vrUid, 0)) - return NULL; + return nullptr; if (vrUid.type == DBVT_DWORD) { wchar_t tmp[100]; @@ -84,7 +84,7 @@ wchar_t* GetContactUID(MCONTACT hContact) return res; } - return NULL; + return nullptr; } void DialogAddContactExecute(HWND hwndDlg, MCONTACT hNewContact) @@ -105,7 +105,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact) HICON hIcon = LoadContactProtoIcon(hContact); if (hIcon) { - DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL); DestroyIcon(hIcon); } } @@ -162,7 +162,7 @@ HICON LoadContactProtoIcon(MCONTACT hContact) char *szProto = GetContactProto(hContact); if (szProto) return (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); - return NULL; + return nullptr; } @@ -187,5 +187,5 @@ wchar_t* __fastcall strdupT(const wchar_t *string) { if (string) return (wchar_t*)wcsdup((wchar_t*)string); - return NULL; + return nullptr; } diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp index 966af46b11..e0d145dfe7 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -91,9 +91,9 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber) // only operates on color icons, which isn't a problem here static HICON __fastcall ResizeIconCentered(HICON hIcon,int cx,int cy) { - HICON hResIcon = NULL; - HDC hdc = CreateCompatibleDC(NULL); - if (hdc != NULL) { + HICON hResIcon = nullptr; + HDC hdc = CreateCompatibleDC(nullptr); + if (hdc != nullptr) { ICONINFO icoi; if ( GetIconInfo(hIcon,&icoi)) { BITMAP bm; @@ -102,22 +102,22 @@ static HICON __fastcall ResizeIconCentered(HICON hIcon,int cx,int cy) pt.x = (cx-bm.bmWidth)/2; pt.y = (cy-bm.bmHeight)/2; HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor); - if (hbmPrev != NULL) { /* error on select? */ + if (hbmPrev != nullptr) { /* error on select? */ HBITMAP hbm = icoi.hbmColor; icoi.hbmColor = CreateCompatibleBitmap(hdc,cx,cy); - if (icoi.hbmColor != NULL) - if (SelectObject(hdc,icoi.hbmColor) != NULL) { /* error on select? */ + if (icoi.hbmColor != nullptr) + if (SelectObject(hdc,icoi.hbmColor) != nullptr) { /* error on select? */ DeleteObject(hbm); /* delete prev color (XOR) */ - if (BitBlt(hdc,0,0,cx,cy,NULL,0,0,BLACKNESS)) /* transparency: AND=0, XOR=1 */ - if (DrawIconEx(hdc,pt.x,pt.y,hIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_IMAGE|DI_NOMIRROR)) { - if (SelectObject(hdc,icoi.hbmMask) != NULL) { /* error on select? */ + if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,BLACKNESS)) /* transparency: AND=0, XOR=1 */ + if (DrawIconEx(hdc,pt.x,pt.y,hIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_IMAGE|DI_NOMIRROR)) { + if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */ hbm = icoi.hbmMask; - icoi.hbmMask = CreateBitmap(cx,cy,1,1,NULL); /* mono */ - if (icoi.hbmMask != NULL) - if (SelectObject(hdc,icoi.hbmMask) != NULL) { /* error on select? */ + icoi.hbmMask = CreateBitmap(cx,cy,1,1,nullptr); /* mono */ + if (icoi.hbmMask != nullptr) + if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */ DeleteObject(hbm); /* delete prev mask (AND) */ - if (BitBlt(hdc,0,0,cx,cy,NULL,0,0,WHITENESS)) /* transparency: AND=0, XOR=1 */ - if (DrawIconEx(hdc,pt.x,pt.y,hIcon,0,0,0,NULL,DI_MASK|DI_NOMIRROR)) { + if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,WHITENESS)) /* transparency: AND=0, XOR=1 */ + if (DrawIconEx(hdc,pt.x,pt.y,hIcon,0,0,0,nullptr,DI_MASK|DI_NOMIRROR)) { SelectObject(hdc,hbmPrev); hResIcon = CreateIconIndirect(&icoi); /* bitmaps must not be selected */ } @@ -142,7 +142,7 @@ HICON __fastcall LoadFlagIcon(int countryNumber) { /* create identifier */ char *szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber, 0); - if (szCountry == NULL) + if (szCountry == nullptr) szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber = 0xFFFF, 0); char szId[20]; @@ -168,7 +168,7 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) { /* return handle */ if ((BOOL)lParam) { - if (phIconHandles == NULL) + if (phIconHandles == nullptr) return 0; return (INT_PTR)phIconHandles[CountryNumberToIndex((int)wParam)]; @@ -179,10 +179,10 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) { - HICON hIcon=NULL; + HICON hIcon = nullptr; /* load both icons */ HICON hLowerIcon = (HICON)ServiceLoadFlagIcon((WPARAM)lParam,0); - if (hLowerIcon == NULL) + if (hLowerIcon == nullptr) return 0; HICON hUpperIcon = (HICON)ServiceLoadFlagIcon(wParam,0); @@ -191,21 +191,21 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) ICONINFO icoi; if (GetIconInfo(hLowerIcon, &icoi)) { BITMAP bm; - if (hUpperIcon != NULL && GetObject(icoi.hbmColor, sizeof(bm), &bm)) { - HDC hdc = CreateCompatibleDC(NULL); - if (hdc != NULL) { + if (hUpperIcon != nullptr && GetObject(icoi.hbmColor, sizeof(bm), &bm)) { + HDC hdc = CreateCompatibleDC(nullptr); + if (hdc != nullptr) { POINT aptTriangle[3] = { 0 }; aptTriangle[1].y = bm.bmHeight-1; aptTriangle[2].x = bm.bmWidth-1; HRGN hrgn = CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING); - if (hrgn != NULL) { + if (hrgn != nullptr) { SelectClipRgn(hdc,hrgn); DeleteObject(hrgn); HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor); - if (hbmPrev != NULL) { /* error on select? */ - if ( DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) - if ( SelectObject(hdc,icoi.hbmMask) != NULL) /* error on select? */ - DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_MASK); + if (hbmPrev != nullptr) { /* error on select? */ + if ( DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_IMAGE)) + if ( SelectObject(hdc,icoi.hbmMask) != nullptr) /* error on select? */ + DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_MASK); SelectObject(hdc,hbmPrev); } } @@ -227,7 +227,7 @@ void InitIcons(void) char szId[20]; /* register icons */ - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.pszName = szId; sid.cx = GetSystemMetrics(SM_CXSMICON); sid.cy = GetSystemMetrics(SM_CYSMICON); @@ -237,9 +237,9 @@ void InitIcons(void) /* all those flag icons do not need any transparency mask (flags are always opaque), * storing them in a large bitmap to reduce file size */ HIMAGELIST himl = ImageList_LoadImage(hInst,MAKEINTRESOURCE(IDB_FLAGS),sid.cx,0,CLR_NONE,IMAGE_BITMAP,LR_CREATEDIBSECTION); - if (himl != NULL) { + if (himl != nullptr) { phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE)); - if (phIconHandles != NULL) { + if (phIconHandles != nullptr) { for (int i=0; i < nCountriesCount; ++i) { sid.description.a = (char*)countries[i].szName; @@ -252,10 +252,10 @@ void InitIcons(void) sid.hDefaultIcon = ResizeIconCentered(hIcon,sid.cx,sid.cy); DestroyIcon(hIcon); } - else sid.hDefaultIcon = NULL; + else sid.hDefaultIcon = nullptr; index = CountryNumberToIndex(countries[i].id); phIconHandles[index] = IcoLib_AddIcon(&sid); - if (sid.hDefaultIcon != NULL) + if (sid.hDefaultIcon != nullptr) DestroyIcon(sid.hDefaultIcon); } } diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp index 1612d05c6d..d51373e7d2 100644 --- a/plugins/CountryFlags/src/ip2country.cpp +++ b/plugins/CountryFlags/src/ip2country.cpp @@ -34,7 +34,7 @@ static BYTE* GetDataHeader(BYTE *data,DWORD cbDataSize,DWORD *pnDataRecordCount) /* uncompressed size stored in first DWORD */ *pnDataRecordCount=(*(DWORD*)data)/DATARECORD_SIZE; recordData=(BYTE*)mir_alloc(*(DWORD*)data); - if (recordData != NULL) + if (recordData != nullptr) Huffman_Uncompress(data+sizeof(DWORD),recordData,cbDataSize-sizeof(DWORD),*(DWORD*)data); return recordData; } @@ -44,7 +44,7 @@ static int GetDataRecord(BYTE *data,DWORD index,DWORD *pdwFrom,DWORD *pdwTo) data+=index*DATARECORD_SIZE; *pdwFrom=*(DWORD*)data; data+=sizeof(DWORD); - if (pdwTo != NULL) *pdwTo=*(DWORD*)data; + if (pdwTo != nullptr) *pdwTo=*(DWORD*)data; data+=sizeof(DWORD); return (int)*(WORD*)data; } @@ -61,7 +61,7 @@ static void CALLBACK UnloadRecordCache(LPARAM) { mir_cslock lck(csRecordCache); mir_free(dataRecords); - dataRecords=NULL; + dataRecords=nullptr; } // function assumes it has got the csRecordCache mutex @@ -70,16 +70,16 @@ static BOOL EnsureRecordCacheLoaded(BYTE **pdata,DWORD *pcount) HRSRC hrsrc; DWORD cb; mir_cslock lck(csRecordCache); - if (dataRecords == NULL) { + if (dataRecords == nullptr) { /* load record data list from resources */ hrsrc=FindResource(hInst,MAKEINTRESOURCE(IDR_IPTOCOUNTRY),L"BIN"); cb=SizeofResource(hInst,hrsrc); dataRecords=(BYTE*)LockResource(LoadResource(hInst,hrsrc)); - if (cb<=sizeof(DWORD) || dataRecords == NULL) + if (cb<=sizeof(DWORD) || dataRecords == nullptr) return FALSE; /* uncompress record data */ dataRecords=GetDataHeader(dataRecords,cb,&nDataRecordsCount); - if (dataRecords == NULL || !nDataRecordsCount) + if (dataRecords == nullptr || !nDataRecordsCount) return FALSE; } *pdata=dataRecords; @@ -104,7 +104,7 @@ INT_PTR ServiceIpToCountry(WPARAM wParam, LPARAM) int id; if (EnsureRecordCacheLoaded(&data,&high)) { /* binary search in record data */ - GetDataRecord(data,low,&dwFrom,NULL); + GetDataRecord(data,low,&dwFrom,nullptr); --high; if (wParam>=dwFrom) /* only search if wParam valid */ while (low<=high) { @@ -301,7 +301,7 @@ static void BinConvThread(void *unused) void InitIpToCountry(void) { nDataRecordsCount=0; - dataRecords=NULL; + dataRecords=nullptr; /* Services */ CreateServiceFunction(MS_FLAGS_IPTOCOUNTRY,ServiceIpToCountry); #ifdef BINCONV diff --git a/plugins/CountryFlags/src/utils.cpp b/plugins/CountryFlags/src/utils.cpp index 082f8f256e..96721a2eca 100644 --- a/plugins/CountryFlags/src/utils.cpp +++ b/plugins/CountryFlags/src/utils.cpp @@ -65,11 +65,11 @@ static void CALLBACK BufferedProcTimer(HWND hwnd, UINT, UINT_PTR idTimer, DWORD --i; /* reiterate current */ if (nCallListCount) { buf = (struct BufferedCallData*)mir_realloc(callList, nCallListCount*sizeof(struct BufferedCallData)); - if (buf != NULL) callList = buf; + if (buf != nullptr) callList = buf; } else { mir_free(callList); - callList = NULL; + callList = nullptr; } #ifdef _DEBUG mir_snprintf(szDbgLine, "buffered call: %s(0x%X)\n", pszProcName, lParam); /* all ascii */ @@ -106,7 +106,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, const char *pszProcName, LP void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumulateSameParam, UINT uElapse) #endif { - struct BufferedCallData *data = NULL; + struct BufferedCallData *data = nullptr; int i; /* find existing */ @@ -117,10 +117,10 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumu break; } /* append new */ - if (data == NULL) { + if (data == nullptr) { /* resize storage array */ data = (struct BufferedCallData*)mir_realloc(callList, (nCallListCount + 1)*sizeof(struct BufferedCallData)); - if (data == NULL) return; + if (data == nullptr) return; callList = data; data = &callList[nCallListCount]; ++nCallListCount; @@ -144,7 +144,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumu #endif /* set next timer */ if (idBufferedTimer) uElapse = USER_TIMER_MINIMUM; /* will get recalculated */ - idBufferedTimer = SetTimer(NULL, idBufferedTimer, uElapse, BufferedProcTimer); + idBufferedTimer = SetTimer(nullptr, idBufferedTimer, uElapse, BufferedProcTimer); } // assumes to be called in context of main thread @@ -152,13 +152,13 @@ void PrepareBufferedFunctions(void) { idBufferedTimer = 0; nCallListCount = 0; - callList = NULL; + callList = nullptr; } // assumes to be called in context of main thread void KillBufferedFunctions(void) { - if (idBufferedTimer) KillTimer(NULL, idBufferedTimer); + if (idBufferedTimer) KillTimer(nullptr, idBufferedTimer); nCallListCount = 0; mir_free(callList); /* does NULL check */ } diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 30ff267f06..f31de55e7c 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -70,7 +70,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) wchar_t path[MAX_PATH]; mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder); - HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hDumpFile != INVALID_HANDLE_VALUE) { CMStringW buffer; PrintVersionInfo(buffer, (unsigned int)lParam | VI_FLAG_PRNVAR); @@ -120,7 +120,7 @@ INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM) } else { DWORD dwFlags = wParam ? (VI_FLAG_PRNVAR | VI_FLAG_PRNDLL) : VI_FLAG_PRNVAR; - hViewWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), NULL, DlgProcView, dwFlags); + hViewWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), nullptr, DlgProcView, dwFlags); } return 0; @@ -144,7 +144,7 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) { switch (wParam) { case 0: - ShellExecute(NULL, TEXT("explore"), CrashLogFolder, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, TEXT("explore"), CrashLogFolder, nullptr, nullptr, SW_SHOW); break; case 1: @@ -166,10 +166,10 @@ INT_PTR CopyLinkToClipboard(WPARAM, LPARAM) LPSTR buf = (LPSTR)GlobalLock(hData); memcpy(buf, buffer, bufLen); - OpenClipboard(NULL); + OpenClipboard(nullptr); EmptyClipboard(); - if (SetClipboardData(CF_UNICODETEXT, hData) == NULL) + if (SetClipboardData(CF_UNICODETEXT, hData) == nullptr) GlobalFree(hData); CloseClipboard(); } @@ -213,7 +213,7 @@ int OptionsInit(WPARAM wParam, LPARAM) static int ToolbarModulesLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszService = MS_CRASHDUMPER_STORETOCLIP; ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To Clipboard"); ttb.hIconHandleUp = GetIconHandle(IDI_VITOCLIP); @@ -355,7 +355,7 @@ static int PreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { hMsftedit = LoadLibrary(L"Msftedit.dll"); - if (hMsftedit == NULL) + if (hMsftedit == nullptr) return 1; clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0; diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index d3ccc95dff..cbefe71020 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -39,7 +39,7 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId) return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); - return NULL; + return nullptr; } HANDLE GetIconHandle(int iconId) @@ -48,5 +48,5 @@ HANDLE GetIconHandle(int iconId) if (iconList[i].defIconID == iconId) return iconList[i].hIcolib; - return NULL; + return nullptr; } diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 2b07c9766c..a96fba0025 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -30,7 +30,7 @@ void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr) exceptionInfo.ClientPointers = false; MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), - hDumpFile, MiniDumpNormal, &exceptionInfo, NULL, NULL); + hDumpFile, MiniDumpNormal, &exceptionInfo, nullptr, nullptr); } @@ -48,8 +48,8 @@ void WriteUtfFile(HANDLE hDumpFile, char* bufu) DWORD bytes; static const unsigned char bytemark[] = { 0xEF, 0xBB, 0xBF }; - WriteFile(hDumpFile, bytemark, 3, &bytes, NULL); - WriteFile(hDumpFile, bufu, (DWORD)mir_strlen(bufu), &bytes, NULL); + WriteFile(hDumpFile, bytemark, 3, &bytes, nullptr); + WriteFile(hDumpFile, bufu, (DWORD)mir_strlen(bufu), &bytes, nullptr); } @@ -102,11 +102,11 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) { - HANDLE hDllFile = CreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hDllFile = CreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hDllFile == INVALID_HANDLE_VALUE) return; - HANDLE hDllMapping = CreateFileMapping(hDllFile, NULL, PAGE_READONLY, 0, 0, NULL); + HANDLE hDllMapping = CreateFileMapping(hDllFile, nullptr, PAGE_READONLY, 0, 0, nullptr); if (hDllMapping == INVALID_HANDLE_VALUE) { CloseHandle(hDllFile); return; @@ -124,8 +124,8 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) IMAGE_DIRECTORY_ENTRY_IMPORT, &tableSize); if (importData) { while (importData->Name) { - char *szImportModule = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, NULL); - if (!SearchPathA(NULL, szImportModule, NULL, NULL, 0, NULL)) + char *szImportModule = (char*)ImageRvaToVa(nthdrs, dllAddr, importData->Name, nullptr); + if (!SearchPathA(nullptr, szImportModule, nullptr, NULL, nullptr, nullptr)) buffer.AppendFormat(format, szImportModule); importData++; //go to next record @@ -136,9 +136,9 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) PIMAGE_EXPORT_DIRECTORY exportData = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(dllAddr, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &tableSize); if (exportData) { - ULONG* funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, NULL); + ULONG* funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, nullptr); for (unsigned i = 0; i < exportData->NumberOfNames; ++i) { - char* funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], NULL); + char* funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], nullptr); if (mir_strcmp(funcName, "DatabasePluginInfo") == 0) { buffer.Append(TEXT(" This dll is a Miranda database plugin, another database is active right now\r\n")); found = true; @@ -163,7 +163,7 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) struct ListItem { - ListItem() : str(), next(NULL) {} + ListItem() : str(), next(nullptr) {} CMStringW str; ListItem *next; @@ -174,10 +174,10 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) buffer.AppendFormat(TEXT("Service Mode: %s\r\n"), servicemode ? TEXT("Yes") : TEXT("No")); wchar_t path[MAX_PATH]; - GetModuleFileName(NULL, path, MAX_PATH); + GetModuleFileName(nullptr, path, MAX_PATH); LPTSTR fname = wcsrchr(path, TEXT('\\')); - if (fname == NULL) fname = path; + if (fname == nullptr) fname = path; mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\*.dll")); WIN32_FIND_DATA FindFileData; @@ -187,7 +187,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) size_t count = 0, ucount = 0; CMStringW ubuffer; - ListItem* dlllist = NULL; + ListItem* dlllist = nullptr; static const wchar_t format[] = TEXT("\xa4 %s v.%s%d.%d.%d.%d%s [%s] - %S %s\r\n"); @@ -195,11 +195,11 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) bool loaded = false; mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\%s"), FindFileData.cFileName); HMODULE hModule = GetModuleHandle(path); - if (hModule == NULL && servicemode) { + if (hModule == nullptr && servicemode) { hModule = LoadLibrary(path); loaded = true; } - if (hModule == NULL) { + if (hModule == nullptr) { if ((flags & VI_FLAG_PRNVAR) && IsPluginEnabled(FindFileData.cFileName)) { wchar_t timebuf[30] = TEXT(""); GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30); @@ -219,7 +219,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) } PLUGININFOEX* pi = GetMirInfo(hModule); - if (pi != NULL) { + if (pi != nullptr) { wchar_t timebuf[30] = TEXT(""); GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30); @@ -251,15 +251,15 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) timebuf, pi->shortName ? pi->shortName : "", unica); ListItem* lsttmp = dlllist; - ListItem* lsttmppv = NULL; - while (lsttmp != NULL) { + ListItem* lsttmppv = nullptr; + while (lsttmp != nullptr) { if (lsttmp->str.CompareNoCase(lst->str) > 0) break; lsttmppv = lsttmp; lsttmp = lsttmp->next; } lst->next = lsttmp; - if (lsttmppv == NULL) + if (lsttmppv == nullptr) dlllist = lst; else lsttmppv->next = lst; @@ -277,7 +277,7 @@ static void GetPluginsString(CMStringW& buffer, unsigned& flags) (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), count, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); ListItem* lsttmp = dlllist; - while (lsttmp != NULL) { + while (lsttmp != nullptr) { buffer.Append(lsttmp->str); ListItem* lsttmp1 = lsttmp->next; delete lsttmp; @@ -353,10 +353,10 @@ static void GetProtocolStrings(CMStringW& buffer) static void GetWeatherStrings(CMStringW& buffer, unsigned flags) { wchar_t path[MAX_PATH]; - GetModuleFileName(NULL, path, MAX_PATH); + GetModuleFileName(nullptr, path, MAX_PATH); LPTSTR fname = wcsrchr(path, TEXT('\\')); - if (fname == NULL) fname = path; + if (fname == nullptr) fname = path; mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\*.ini")); WIN32_FIND_DATA FindFileData; @@ -367,34 +367,34 @@ static void GetWeatherStrings(CMStringW& buffer, unsigned flags) if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName); - HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hDumpFile != INVALID_HANDLE_VALUE) { char buf[8192]; DWORD bytes = 0; - ReadFile(hDumpFile, buf, 8190, &bytes, NULL); + ReadFile(hDumpFile, buf, 8190, &bytes, nullptr); buf[bytes] = 0; char* ver = strstr(buf, "Version="); - if (ver != NULL) { + if (ver != nullptr) { char *endid = strchr(ver, '\r'); - if (endid != NULL) *endid = 0; + if (endid != nullptr) *endid = 0; else { endid = strchr(ver, '\n'); - if (endid != NULL) *endid = 0; + if (endid != nullptr) *endid = 0; } ver += 8; } char *id = strstr(buf, "Name="); - if (id != NULL) { + if (id != nullptr) { char *endid = strchr(id, '\r'); - if (endid != NULL) *endid = 0; + if (endid != nullptr) *endid = 0; else { endid = strchr(id, '\n'); - if (endid != NULL) *endid = 0; + if (endid != nullptr) *endid = 0; } id += 5; } @@ -420,10 +420,10 @@ static void GetWeatherStrings(CMStringW& buffer, unsigned flags) static void GetIconStrings(CMStringW& buffer) { wchar_t path[MAX_PATH]; - GetModuleFileName(NULL, path, MAX_PATH); + GetModuleFileName(nullptr, path, MAX_PATH); LPTSTR fname = wcsrchr(path, TEXT('\\')); - if (fname == NULL) fname = path; + if (fname == nullptr) fname = path; mir_snwprintf(fname, MAX_PATH - (fname - path), TEXT("\\Icons\\*.*")); WIN32_FIND_DATA FindFileData; @@ -475,7 +475,7 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) buffer.Append(L"\r\n"); wchar_t path[MAX_PATH], mirtime[30]; - GetModuleFileName(NULL, path, MAX_PATH); + GetModuleFileName(nullptr, path, MAX_PATH); GetLastWriteTime(path, mirtime, 30); buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime); @@ -543,7 +543,7 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wchar_t* msg) { - if (exc_ptr->ContextRecord == NULL || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0) + if (exc_ptr->ContextRecord == nullptr || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0) return; CONTEXT context = *exc_ptr->ContextRecord; @@ -574,7 +574,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha const PLUGININFOEX *pluginInfoEx = GetPluginInfoEx(); wchar_t curtime[30]; - GetISO8061Time(NULL, curtime, 30); + GetISO8061Time(nullptr, curtime, 30); CMStringW buffer; buffer.AppendFormat(TEXT("Miranda Crash Report from %s. Crash Dumper v.%d.%d.%d.%d\r\n"), @@ -591,7 +591,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (&SymSetOptions) SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES); - SymInitialize(hProcess, NULL, TRUE); + SymInitialize(hProcess, nullptr, TRUE); buffer.Append(TEXT("\r\nStack Trace:\r\n---------------------------------------------------------------\r\n")); @@ -614,7 +614,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha DWORD offsetFromLine = 0; if (!StackWalk64(IMAGE_FILE_MACHINE, hProcess, GetCurrentThread(), &frame, &context, - NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL)) break; + nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr)) break; if (frame.AddrPC.Offset == frame.AddrReturn.Offset) break; @@ -650,7 +650,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (crashpos != 0) { HMODULE hModule = (HMODULE)Module.BaseOfImage; PLUGININFOEX *pi = GetMirInfo(hModule); - if (pi != NULL) { + if (pi != nullptr) { static const wchar_t formatc[] = TEXT("\r\nLikely cause of the crash plugin: %S\r\n\r\n"); if (pi->shortName) { @@ -673,15 +673,15 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha PrintVersionInfo(buffer, VI_FLAG_PRNDLL); - int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, NULL, 0, NULL, NULL); + int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, nullptr, 0, nullptr, nullptr); char* dst = (char*)(len > 8192 ? malloc(len) : alloca(len)); - WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, nullptr, nullptr); WriteUtfFile(hDumpFile, dst); if (len > 8192) free(dst); - if (db_get_b(0, PluginName, "ShowCrashMessageBox", 1) && msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) + if (db_get_b(0, PluginName, "ShowCrashMessageBox", 1) && msg && MessageBox(nullptr, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) StoreStringToClip(buffer); } diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 92219a5128..14cc07f3b0 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -18,8 +18,8 @@ void RemoveExceptionHandler(void) if (exchndlrv) RemoveVectoredExceptionHandler(exchndlrv); SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exchndlr); - exchndlr = NULL; - exchndlrv = NULL; + exchndlr = nullptr; + exchndlrv = nullptr; } int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) @@ -37,7 +37,7 @@ int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) else mir_snprintf(str + off, _countof(str) - off, "Ordinal: %x ", dlld->dlp.dwOrdinal); - MessageBoxA(NULL, str, "Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); + MessageBoxA(nullptr, str, "Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); } return EXCEPTION_EXECUTE_HANDLER; @@ -48,7 +48,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) { wchar_t path[MAX_PATH]; SYSTEMTIME st; - HANDLE hDumpFile = NULL; + HANDLE hDumpFile = nullptr; GetLocalTime(&st); CreateDirectoryTreeW(CrashLogFolder); @@ -56,7 +56,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try { if (dtsubfldr) { mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay); - CreateDirectory(path, NULL); + CreateDirectory(path, nullptr); mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder, st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); } @@ -64,11 +64,11 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder, st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); if (hDumpFile != INVALID_HANDLE_VALUE) CreateMiniDump(hDumpFile, exc_ptr); else if (GetLastError() != ERROR_ALREADY_EXISTS) - MessageBox(NULL, TranslateT("Crash Report write location is not available"), + MessageBox(nullptr, TranslateT("Crash Report write location is not available"), TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); } @@ -76,14 +76,14 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) { } - bool empty = GetFileSize(hDumpFile, NULL) == 0; + bool empty = GetFileSize(hDumpFile, nullptr) == 0; CloseHandle(hDumpFile); if (empty) DeleteFile(path); __try { if (dtsubfldr) { mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay); - CreateDirectory(path, NULL); + CreateDirectory(path, nullptr); mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder, st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); } @@ -91,16 +91,16 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) mir_snwprintf(path, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder, st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); mir_snwprintf(path, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder); if (hDumpFile != INVALID_HANDLE_VALUE) - CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL); + CreateCrashReport(hDumpFile, exc_ptr, notify ? path : nullptr); } __except (myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {} - bool empty1 = GetFileSize(hDumpFile, NULL) == 0; + bool empty1 = GetFileSize(hDumpFile, nullptr) == 0; CloseHandle(hDumpFile); if (empty1) DeleteFile(path); } diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 91fa5f9578..65fa95377b 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -23,7 +23,7 @@ extern HINSTANCE hInst; HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffset, int nVerticalOffset, int nWidthOffset, int nHeightOffset) { - if (NULL == hwndDlg) /* Wine fix. */ + if (nullptr == hwndDlg) /* Wine fix. */ return hDwp; // get current bounding rectangle RECT rcinit; @@ -35,7 +35,7 @@ HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffse pt.y = rcinit.top; ScreenToClient(hwndDlg, &pt); - return DeferWindowPos(hDwp, hwndCtrl, NULL, + return DeferWindowPos(hDwp, hwndCtrl, nullptr, pt.x + nHorizontalOffset, pt.y + nVerticalOffset, rcinit.right - rcinit.left + nWidthOffset, @@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (sel.cpMin == sel.cpMax) EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr)) { case IDM_COPY: SendMessage(hView, WM_COPY, 0, 0); break; @@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_DESTROY: - hViewWnd = NULL; + hViewWnd = nullptr; Window_FreeIcon_IcoLib(hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_"); if (servicemode) @@ -175,9 +175,9 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara void DestroyAllWindows(void) { - if (hViewWnd != NULL) { + if (hViewWnd != nullptr) { DestroyWindow(hViewWnd); - hViewWnd = NULL; + hViewWnd = nullptr; } } @@ -280,7 +280,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case 3: wchar_t path[MAX_PATH]; mir_snwprintf(path, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder); - ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, TEXT("open"), path, nullptr, nullptr, SW_SHOW); break; } @@ -313,5 +313,5 @@ void ShowMessage(int type, const wchar_t* format, ...) PUAddPopupT(&pi); } - else MessageBox(NULL, pi.lptzText, TEXT(PluginName), MB_OK | MB_ICONINFORMATION); + else MessageBox(nullptr, pi.lptzText, TEXT(PluginName), MB_OK | MB_ICONINFORMATION); } diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 49dac93b0e..9b3b501b89 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -90,7 +90,7 @@ void CreateAuthString(char* auth) bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) { int result = 0xBADBAD; - char* szRedirUrl = NULL; + char* szRedirUrl = nullptr; NETLIBHTTPREQUEST nlhr = { 0 }; // initialize the netlib request @@ -164,7 +164,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) const char* szPref = strstr(szUrl, "://"); szPref = szPref ? szPref + 3 : szUrl; szPath = strchr(szPref, '/'); - rlen = szPath != NULL ? szPath - szUrl : mir_strlen(szUrl); + rlen = szPath != nullptr ? szPath - szUrl : mir_strlen(szUrl); } szRedirUrl = (char*)mir_realloc(szRedirUrl, diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 2fd7e8f815..d46bf807ea 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -45,7 +45,7 @@ int GetTZOffset(void) void GetISO8061Time(SYSTEMTIME *stLocal, LPTSTR lpszString, DWORD dwSize) { SYSTEMTIME loctime; - if (stLocal == NULL) { + if (stLocal == nullptr) { stLocal = &loctime; GetLocalTime(stLocal); } @@ -94,8 +94,8 @@ typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_Info) (DWORD mirandaVersion); PLUGININFOEX* GetMirInfo(HMODULE hModule) { Miranda_Plugin_Info bpi = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfoEx"); - if (bpi == NULL) - return NULL; + if (bpi == nullptr) + return nullptr; return bpi(mirandaVersion); } @@ -111,15 +111,15 @@ void GetInternetExplorerVersion(CMStringW &buffer) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey)) { size = _countof(ieBuild); - if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Build"), nullptr, nullptr, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS) ieBuild[0] = 0; size = _countof(ieVersion); - if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Version"), nullptr, nullptr, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS) ieVersion[0] = 0; size = _countof(iVer); - if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE)iVer, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("IVer"), nullptr, nullptr, (LPBYTE)iVer, &size) != ERROR_SUCCESS) iVer[0] = 0; RegCloseKey(hKey); @@ -174,12 +174,12 @@ void GetProcessorString(CMStringW &buffer) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey)) { size = _countof(cpuName); - if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)cpuName, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), nullptr, nullptr, (LPBYTE)cpuName, &size) != ERROR_SUCCESS) mir_wstrcpy(cpuName, TEXT("Unknown")); size = _countof(cpuIdent); - if (RegQueryValueEx(hKey, TEXT("Identifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) - if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Identifier"), nullptr, nullptr, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), nullptr, nullptr, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) mir_wstrcpy(cpuIdent, TEXT("Unknown")); RegCloseKey(hKey); @@ -327,7 +327,7 @@ void GetAdminString(CMStringW &buffer) b = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup); if (b) { - if (!CheckTokenMembership(NULL, AdministratorsGroup, &b)) + if (!CheckTokenMembership(nullptr, AdministratorsGroup, &b)) b = FALSE; FreeSid(AdministratorsGroup); } @@ -385,11 +385,11 @@ void GetWow64String(CMStringW &buffer) void GetVersionInfo(HMODULE hLib, CMStringW& buffer) { HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); - if (hVersion != NULL) { + if (hVersion != nullptr) { HGLOBAL hGlobal = LoadResource(hLib, hVersion); - if (hGlobal != NULL) { + if (hGlobal != nullptr) { LPVOID versionInfo = LockResource(hGlobal); - if (versionInfo != NULL) { + if (versionInfo != nullptr) { int vl = *(unsigned short*)versionInfo; unsigned *res = (unsigned*)versionInfo; while (*res != 0xfeef04bd && ((char*)res - (char*)versionInfo) < vl) ++res; @@ -416,7 +416,7 @@ void StoreStringToClip(CMStringW& buffer) GlobalUnlock(hData); - if(OpenClipboard(NULL)) { + if(OpenClipboard(nullptr)) { EmptyClipboard(); diff --git a/plugins/CryptoPP/src/base16.cpp b/plugins/CryptoPP/src/base16.cpp index 689d54c88a..e716b4be4f 100644 --- a/plugins/CryptoPP/src/base16.cpp +++ b/plugins/CryptoPP/src/base16.cpp @@ -40,7 +40,7 @@ char *base16decode(const char *inBuffer, unsigned int *count) if ((c0 | c1) == BERR) { free(outBuffer); *count = 0; - return(NULL); + return(nullptr); } *outBufferPtr++ = (c0 << 4) | c1; *count -= 2; diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp index 327890f4ea..9628477124 100644 --- a/plugins/CryptoPP/src/cpp_cntx.cpp +++ b/plugins/CryptoPP/src/cpp_cntx.cpp @@ -12,7 +12,7 @@ pCNTX get_context_on_id(HANDLE context) Sent_NetLog("get_context_on_id: corrupted context %08X", cntx); #endif } - return NULL; + return nullptr; } // create context, return context id @@ -71,7 +71,7 @@ PBYTE cpp_alloc_pdata(pCNTX ptr) void cpp_free_keys(pCNTX ptr) { mir_free(ptr->tmp); - ptr->tmp = 0; + ptr->tmp = nullptr; cpp_alloc_pdata(ptr); if (ptr->mode & MODE_PGP) { pPGPDATA p = (pPGPDATA)ptr->pdata; diff --git a/plugins/CryptoPP/src/cpp_gpgw.cpp b/plugins/CryptoPP/src/cpp_gpgw.cpp index a86d2219cd..bda82d6e6f 100644 --- a/plugins/CryptoPP/src/cpp_gpgw.cpp +++ b/plugins/CryptoPP/src/cpp_gpgw.cpp @@ -30,7 +30,7 @@ int __cdecl gpg_done() int r = 0; if (hgpg) { r = _gpg_done(); - hgpg = 0; + hgpg = nullptr; } return r; } @@ -68,7 +68,7 @@ LPSTR __cdecl gpg_encrypt(pCNTX ptr, LPCSTR szPlainMsg) LPSTR szEncMsg = _gpg_encrypt(szPlainMsg, (LPCSTR)p->gpgKeyID); mir_free(ptr->tmp); if (!szEncMsg) { - return ptr->tmp = 0; + return ptr->tmp = nullptr; } else { ptr->tmp = mir_strdup(szEncMsg); @@ -93,11 +93,11 @@ LPSTR __cdecl gpg_encode(HANDLE context, LPCSTR szPlainMsg) { pCNTX ptr = get_context_on_id(context); if (!ptr) - return NULL; + return nullptr; pGPGDATA p = (pGPGDATA)cpp_alloc_pdata(ptr); if (!p->gpgKeyID) { ptr->error = ERROR_NO_GPG_KEY; - return NULL; + return nullptr; } // utf8 message: encrypt. @@ -106,7 +106,7 @@ LPSTR __cdecl gpg_encode(HANDLE context, LPCSTR szPlainMsg) LPWSTR wszMsg = utf8decode(szPlainMsg); int wlen = (int)wcslen(wszMsg) + 1; szUtfMsg = (LPSTR)alloca(wlen); - WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szUtfMsg, wlen, 0, 0); + WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szUtfMsg, wlen, nullptr, nullptr); } else { szUtfMsg = (LPSTR)szPlainMsg; @@ -119,9 +119,9 @@ LPSTR __cdecl gpg_decode(HANDLE context, LPCSTR szEncMsg) { pCNTX ptr = get_context_on_id(context); if (!ptr) - return NULL; + return nullptr; - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = gpg_decrypt(ptr, szEncMsg); if (szOldMsg) { diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp index 37a197d70f..8cfea1c040 100644 --- a/plugins/CryptoPP/src/cpp_keys.cpp +++ b/plugins/CryptoPP/src/cpp_keys.cpp @@ -5,7 +5,7 @@ const unsigned char IV[] = "PSKhell@MIRANDA!"; // generate KeyA pair, return public key as ASCII LPSTR __cdecl cpp_init_keya(HANDLE context, int features) { - pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL; + pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr; pSIMDATA p = (pSIMDATA)cpp_alloc_pdata(ptr); int send_features = FEATURES; @@ -156,7 +156,7 @@ int __cdecl cpp_calc_keyx(HANDLE context) // not needed anymore SAFE_FREE(p->PubA); SAFE_FREE(p->KeyA); - mir_free(p->KeyB); p->KeyB = 0; + mir_free(p->KeyB); p->KeyB = nullptr; BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash memset(buffer, 0, sizeof(buffer)); diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp index 6f9ca08ab4..bdd3f2a645 100644 --- a/plugins/CryptoPP/src/cpp_misc.cpp +++ b/plugins/CryptoPP/src/cpp_misc.cpp @@ -54,7 +54,7 @@ void __cdecl cpp_set_keyx(HANDLE context, BYTE *key) return; SAFE_FREE(p->PubA); SAFE_FREE(p->KeyA); - mir_free(p->KeyB); p->KeyB = 0; + mir_free(p->KeyB); p->KeyB = nullptr; SAFE_FREE(p->KeyX); p->KeyX = (PBYTE)malloc(Tiger::DIGESTSIZE + 2); memcpy(p->KeyX, key, Tiger::DIGESTSIZE); @@ -92,7 +92,7 @@ int __cdecl cpp_keya(HANDLE context) pSIMDATA p; if (!cpp_get_simdata(context, &ptr, &p)) return 0; - return p->KeyA != NULL; + return p->KeyA != nullptr; } int __cdecl cpp_keyb(HANDLE context) @@ -101,7 +101,7 @@ int __cdecl cpp_keyb(HANDLE context) pSIMDATA p; if (!cpp_get_simdata(context, &ptr, &p)) return 0; - return p->KeyB != NULL; + return p->KeyB != nullptr; } int __cdecl cpp_keyx(HANDLE context) @@ -110,7 +110,7 @@ int __cdecl cpp_keyx(HANDLE context) pSIMDATA p; if (!cpp_get_simdata(context, &ptr, &p)) return 0; - return p->KeyX != NULL; + return p->KeyX != nullptr; } int __cdecl cpp_keyp(HANDLE context) @@ -119,5 +119,5 @@ int __cdecl cpp_keyp(HANDLE context) pSIMDATA p; if (!cpp_get_simdata(context, &ptr, &p)) return 0; - return p->KeyP != NULL; + return p->KeyP != nullptr; } diff --git a/plugins/CryptoPP/src/cpp_pgpw.cpp b/plugins/CryptoPP/src/cpp_pgpw.cpp index 366a3776de..d574c2f236 100644 --- a/plugins/CryptoPP/src/cpp_pgpw.cpp +++ b/plugins/CryptoPP/src/cpp_pgpw.cpp @@ -107,7 +107,7 @@ int __cdecl pgp_done() pgpVer = 0; if (hpgpsdk) { r = p_pgp_done(); - hpgpsdk = 0; + hpgpsdk = nullptr; } return r; } @@ -140,7 +140,7 @@ LPSTR __cdecl pgp_encrypt(pCNTX ptr, LPCSTR szPlainMsg) LPSTR szEncMsg = (p->pgpKey ? p_pgp_encrypt_key(szPlainMsg, (LPCSTR)p->pgpKey) : p_pgp_encrypt_keydb(szPlainMsg, p->pgpKeyID)); if (!szEncMsg) { - return ptr->tmp = 0; + return ptr->tmp = nullptr; } else { ptr->tmp = mir_strdup(szEncMsg); @@ -154,7 +154,7 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) { ptr->error = ERROR_NONE; mir_free(ptr->tmp); - ptr->tmp = NULL; + ptr->tmp = nullptr; LPSTR szPlainMsg = p_pgp_decrypt_keydb(szEncMsg); if (!szPlainMsg) { @@ -165,7 +165,7 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) szPlainMsg = p_pgp_decrypt_key(szEncMsg, (LPCSTR)p->pgpKey); } if (!szPlainMsg) { - return NULL; + return nullptr; } } @@ -176,11 +176,11 @@ LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg) LPSTR __cdecl pgp_encode(HANDLE context, LPCSTR szPlainMsg) { - pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL; + pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr; pPGPDATA p = (pPGPDATA)cpp_alloc_pdata(ptr); if (!p->pgpKeyID && !p->pgpKey) { ptr->error = ERROR_NO_PGP_KEY; - return NULL; + return nullptr; } // utf8 message: encrypt. @@ -191,10 +191,10 @@ LPSTR __cdecl pgp_decode(HANDLE context, LPCSTR szEncMsg) { pCNTX ptr = get_context_on_id(context); if (!ptr) - return NULL; + return nullptr; mir_free(ptr->tmp); - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = pgp_decrypt(ptr, szEncMsg); if (szOldMsg) { diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp index ebf0564bc6..c2eddf6cc8 100644 --- a/plugins/CryptoPP/src/cpp_rsam.cpp +++ b/plugins/CryptoPP/src/cpp_rsam.cpp @@ -72,9 +72,9 @@ int __cdecl rsa_done(void) pCNTX tmp = (pCNTX)hRSA4096; pRSAPRIV p = (pRSAPRIV)tmp->pdata; delete p; - tmp->pdata = 0; + tmp->pdata = nullptr; cpp_delete_context(hRSA4096); - hRSA4096 = NULL; + hRSA4096 = nullptr; } return 1; @@ -86,18 +86,18 @@ int __cdecl rsa_done(void) pRSAPRIV rsa_gen_keys(HANDLE context) { - if (context != hRSA4096) return 0; + if (context != hRSA4096) return nullptr; #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("rsa_gen_keys: %d", context); #endif - pCNTX ptr = get_context_on_id(context); if (!ptr) return 0; + pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr; pRSAPRIV r = (pRSAPRIV)ptr->pdata; string priv, pub; GenerateRSAKey(4096, priv, pub); - StringSource privsrc(priv, true, NULL); + StringSource privsrc(priv, true, nullptr); RSAES_PKCS1v15_Decryptor Decryptor(privsrc); priv = tlv(1, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModulus())) + @@ -116,7 +116,7 @@ pRSAPRIV rsa_gen_keys(HANDLE context) pRSAPRIV rsa_get_priv(pCNTX ptr) { - pCNTX p = get_context_on_id(hRSA4096); if (!p) return 0; + pCNTX p = get_context_on_id(hRSA4096); if (!p) return nullptr; pRSAPRIV r = (pRSAPRIV)p->pdata; return r; } @@ -316,18 +316,18 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("rsa_recv: %s", msg); #endif - pCNTX ptr = get_context_on_id(context); if (!ptr) return 0; + pCNTX ptr = get_context_on_id(context); if (!ptr) return nullptr; pRSADATA p = (pRSADATA)cpp_alloc_pdata(ptr); pRSAPRIV r = rsa_get_priv(ptr); rtrim(msg); string buf = base64decode(msg); - if (!buf.length()) return 0; + if (!buf.length()) return nullptr; string data; int type; un_tlv(buf, type, data); - if (type == -1) return 0; + if (type == -1) return nullptr; #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("rsa_recv: %02x %d", type, p->state); @@ -338,7 +338,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) p->state = 0; p->time = 0; rsa_free(ptr); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé null_msg(context, 0x00, -1); // ñåññèÿ ðàçîðâàíà ïî îøèáêå, íåâåðíûé òèï ñîîáùåíèÿ - return 0; + return nullptr; } switch (type) { @@ -346,7 +346,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) case 0x00: // ïðåðûâàíèå ñåññèè ïî îøèáêå äðóãîé ñòîðîíîé { // åñëè ñîåäèíåíèå óñòàíîâëåíî - íè÷åãî íå äåëàåì - if (p->state == 0 || p->state == 7) return 0; + if (p->state == 0 || p->state == 7) return nullptr; // èíà÷å ñáðàñûâàåì òåêóùåå ñîñòîÿíèå p->state = 0; p->time = 0; imp->rsa_notify(context, -2); // ñåññèÿ ðàçîðâàíà ïî îøèáêå äðóãîé ñòîðîíîé @@ -365,9 +365,9 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) case 0x0D: // çàïðîñ ïàáëèêà case 0xD0: // îòâåò ïàáëèêîì if (!p->event) { - p->event = CreateEvent(NULL, FALSE, FALSE, NULL); + p->event = CreateEvent(nullptr, FALSE, FALSE, nullptr); unsigned int tID; - p->thread = (HANDLE)_beginthreadex(NULL, 0, sttConnectThread, (PVOID)context, 0, &tID); + p->thread = (HANDLE)_beginthreadex(nullptr, 0, sttConnectThread, (PVOID)context, 0, &tID); #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("rsa_recv: _beginthreadex(sttConnectThread)"); #endif @@ -383,7 +383,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (!decode_msg(p, data).length()) { p->state = 0; p->time = 0; null_msg(context, 0x00, -type); // ñåññèÿ ðàçîðâàíà ïî îøèáêå - return 0; + return nullptr; } { PBYTE buffer = (PBYTE)alloca(RAND_SIZE); @@ -399,7 +399,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (!decode_msg(p, data).length()) { p->state = 0; p->time = 0; null_msg(context, 0x00, -type); // ñåññèÿ ðàçîðâàíà ïî îøèáêå - return 0; + return nullptr; } p->state = 7; p->time = 0; rsa_free_thread(p); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé @@ -414,7 +414,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) return ptr->tmp = mir_strdup(msg.c_str()); else { imp->rsa_notify(context, -5); // îøèáêà äåêîäèðîâàíèÿ AES ñîîáùåíèÿ - return ptr->tmp = NULL; + return ptr->tmp = nullptr; } } @@ -426,15 +426,15 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) return ptr->tmp = mir_strdup(msg.c_str()); else { imp->rsa_notify(context, -6); // îøèáêà äåêîäèðîâàíèÿ RSA ñîîáùåíèÿ - return ptr->tmp = NULL; + return ptr->tmp = nullptr; } } case 0xF0: // ðàçðûâ ñîåäèíåíèÿ âðó÷íóþ { - if (p->state != 7) return 0; + if (p->state != 7) return nullptr; string msg = decode_msg(p, data); - if (!msg.length()) return 0; + if (!msg.length()) return nullptr; p->state = 0; rsa_free(ptr); // óäàëèì òðýä è î÷åðåäü ñîîáùåíèé imp->rsa_notify(context, -4); // ñîåäèíåíèå ðàçîðâàíî âðó÷íóþ äðóãîé ñòîðîíîé @@ -451,7 +451,7 @@ LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) if (p->state != 0 && p->state != 7) p->time = gettime() + timeout; - return 0; + return nullptr; } int __cdecl rsa_send(HANDLE context, LPCSTR msg) @@ -846,7 +846,7 @@ void rsa_alloc(pCNTX ptr) pRSADATA p = new RSADATA; p->state = 0; p->time = 0; - p->thread = p->event = NULL; + p->thread = p->event = nullptr; p->thread_exit = 0; p->queue = new STRINGQUEUE; ptr->pdata = (PBYTE)p; @@ -855,7 +855,7 @@ void rsa_alloc(pCNTX ptr) int rsa_free(pCNTX ptr) { pRSADATA p = (pRSADATA)ptr->pdata; - if (p == NULL) + if (p == nullptr) return true; if (p->event) { @@ -866,7 +866,7 @@ int rsa_free(pCNTX ptr) delete p->queue; delete p; - ptr->pdata = NULL; + ptr->pdata = nullptr; return true; } @@ -879,7 +879,7 @@ void rsa_free_thread(pRSADATA p) WaitForSingleObject(p->thread, INFINITE); CloseHandle(p->thread); CloseHandle(p->event); - p->thread = p->event = NULL; + p->thread = p->event = nullptr; p->thread_exit = 0; } p->time = 0; diff --git a/plugins/CryptoPP/src/cpp_rsau.cpp b/plugins/CryptoPP/src/cpp_rsau.cpp index b2bc42d302..d476c4fb1c 100644 --- a/plugins/CryptoPP/src/cpp_rsau.cpp +++ b/plugins/CryptoPP/src/cpp_rsau.cpp @@ -157,7 +157,7 @@ string hash256(PBYTE b, size_t l) Integer BinaryToInteger(const string& data) { - StringSource ss(data, true, NULL); + StringSource ss(data, true, nullptr); SecByteBlock result(ss.MaxRetrievable()); ss.Get(result, result.size()); return Integer(result, result.size()); diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp index ed5af8bdbb..089d535a8f 100644 --- a/plugins/CryptoPP/src/cpp_svcs.cpp +++ b/plugins/CryptoPP/src/cpp_svcs.cpp @@ -93,7 +93,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) Sent_NetLog("cpp_decrypt: error bad_len"); #endif ptr->error = ERROR_BAD_LEN; - return NULL; + return nullptr; } BYTE crc32[CRC32::DIGESTSIZE]; @@ -106,7 +106,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) Sent_NetLog("cpp_decrypt: error bad_crc"); #endif ptr->error = ERROR_BAD_CRC; - return NULL; + return nullptr; } bciphered += CRC32::DIGESTSIZE; // cut CRC32 digest clen = len; @@ -138,8 +138,8 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) #if defined(_DEBUG) || defined(NETLIB_LOG) Sent_NetLog("cpp_decrypt: error seh"); #endif - mir_free(ptr->tmp); ptr->tmp = 0; - return NULL; + mir_free(ptr->tmp); ptr->tmp = nullptr; + return nullptr; } } @@ -148,11 +148,11 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg) LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg) { pCNTX ptr = get_context_on_id(context); - if (!ptr) return NULL; + if (!ptr) return nullptr; cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata; - if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; } + if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; } - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = (LPSTR)msg; if (ptr->features & FEATURES_UTF8) { @@ -176,11 +176,11 @@ LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg) LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg) { pCNTX ptr = get_context_on_id(context); - if (!ptr) return NULL; + if (!ptr) return nullptr; cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata; - if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; } + if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; } - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = (LPSTR)msg; if (ptr->features & FEATURES_UTF8) { @@ -192,7 +192,7 @@ LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg) LPWSTR wstring = utf8decode(szOldMsg); int wlen = (int)wcslen(wstring) + 1; LPSTR astring = (LPSTR)alloca(wlen); - WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0); + WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, nullptr, nullptr); szNewMsg = cpp_encrypt(ptr, astring); } @@ -203,11 +203,11 @@ LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg) LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg) { pCNTX ptr = get_context_on_id(context); - if (!ptr) return NULL; + if (!ptr) return nullptr; cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata; - if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; } + if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; } - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = (LPSTR)msg; if (ptr->features & FEATURES_UTF8) { @@ -218,7 +218,7 @@ LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg) // unicode message: convert to ansi and encrypt. int wlen = (int)wcslen((LPWSTR)szOldMsg) + 1; LPSTR astring = (LPSTR)alloca(wlen); - WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0); + WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, nullptr, nullptr); szNewMsg = cpp_encrypt(ptr, astring); } @@ -230,11 +230,11 @@ LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg) LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg) { pCNTX ptr = get_context_on_id(context); - if (!ptr) return NULL; + if (!ptr) return nullptr; cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata; - if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; } + if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; } - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg); if (szOldMsg) { @@ -243,7 +243,7 @@ LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg) LPWSTR wstring = utf8decode(szOldMsg); int wlen = (int)wcslen(wstring) + 1; szNewMsg = (LPSTR)mir_alloc(wlen*(sizeof(WCHAR)+2)); // work.zy@gmail.com - WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, 0, 0); + WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, nullptr, nullptr); memcpy(szNewMsg + strlen(szNewMsg) + 1, wstring, wlen*sizeof(WCHAR)); // work.zy@gmail.com } else { @@ -265,12 +265,12 @@ LPSTR __cdecl cpp_decodeU(HANDLE context, LPCSTR szEncMsg) { pCNTX ptr = get_context_on_id(context); if (!ptr) - return NULL; + return nullptr; mir_free(ptr->tmp); cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA)ptr->pdata; - if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; } + if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return nullptr; } - LPSTR szNewMsg = NULL; + LPSTR szNewMsg = nullptr; LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg); if (szOldMsg) { diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index dc5e3c67e9..9adee52785 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -5,8 +5,8 @@ LPCSTR szModuleName = MODULENAME; LPCSTR szVersionStr = MODULENAME" DLL (" __VERSION_STRING_DOTS ")"; HINSTANCE g_hInst; -HANDLE hPGPPRIV = NULL; -HANDLE hRSA4096 = NULL; +HANDLE hPGPPRIV = nullptr; +HANDLE hRSA4096 = nullptr; mir_cs localQueueMutex; mir_cs localContextMutex; @@ -72,15 +72,15 @@ extern "C" __declspec(dllexport) int Unload() BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size) { HRSRC RH = FindResource(g_hInst, MAKEINTRESOURCE(ResId), MAKEINTRESOURCE(ResType)); - if (RH == NULL) + if (RH == nullptr) return FALSE; PBYTE RP = (PBYTE)LoadResource(g_hInst, RH); - if (RP == NULL) + if (RP == nullptr) return FALSE; DWORD x, s = SizeofResource(g_hInst, RH); - if (!WriteFile(FH, RP, s, &x, NULL)) return FALSE; + if (!WriteFile(FH, RP, s, &x, nullptr)) return FALSE; if (x != s) return FALSE; if (Size) *Size = s; return TRUE; @@ -88,12 +88,12 @@ BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size) void ExtractFile(char *FileName, int ResType, int ResId) { - HANDLE FH = CreateFile(FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + HANDLE FH = CreateFile(FileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr); if (FH == INVALID_HANDLE_VALUE) return; - if (!ExtractFileFromResource(FH, ResType, ResId, NULL)) - MessageBoxA(0, "Can't extract", "!!!", MB_OK); + if (!ExtractFileFromResource(FH, ResType, ResId, nullptr)) + MessageBoxA(nullptr, "Can't extract", "!!!", MB_OK); CloseHandle(FH); } diff --git a/plugins/CryptoPP/src/mmi.cpp b/plugins/CryptoPP/src/mmi.cpp index 321dc1d871..5eb6f4af3e 100644 --- a/plugins/CryptoPP/src/mmi.cpp +++ b/plugins/CryptoPP/src/mmi.cpp @@ -4,7 +4,7 @@ void __fastcall safe_free(void** p) { if (*p) { free(*p); - *p = NULL; + *p = nullptr; } } @@ -13,6 +13,6 @@ void __fastcall safe_delete(void** p) { if (*p) { delete(*p); - *p = NULL; + *p = nullptr; } } diff --git a/plugins/CryptoPP/src/utf8.cpp b/plugins/CryptoPP/src/utf8.cpp index 77c13fa3bc..83d4e4a97a 100644 --- a/plugins/CryptoPP/src/utf8.cpp +++ b/plugins/CryptoPP/src/utf8.cpp @@ -1,15 +1,15 @@ #include "commonheaders.h" -LPSTR szOut = NULL; -LPWSTR wszOut = NULL; +LPSTR szOut = nullptr; +LPWSTR wszOut = nullptr; LPSTR __cdecl utf8encode(LPCWSTR str) { LPWSTR wszTemp, w; int len, i; - if (str == NULL) - return NULL; + if (str == nullptr) + return nullptr; wszTemp = (LPWSTR)str; @@ -21,8 +21,8 @@ LPSTR __cdecl utf8encode(LPCWSTR str) } SAFE_FREE(szOut); - if ((szOut = (LPSTR)malloc(len + 1)) == NULL) - return NULL; + if ((szOut = (LPSTR)malloc(len + 1)) == nullptr) + return nullptr; i = 0; for (w = wszTemp; *w; w++) { @@ -49,13 +49,13 @@ LPWSTR __cdecl utf8decode(LPCSTR str) LPSTR p; // LPWSTR wszOut; - if (str == NULL) return NULL; + if (str == nullptr) return nullptr; size_t len = strlen(str) + 1; SAFE_FREE(wszOut); - if ((wszOut = (LPWSTR)malloc(len*sizeof(WCHAR))) == NULL) - return NULL; + if ((wszOut = (LPWSTR)malloc(len*sizeof(WCHAR))) == nullptr) + return nullptr; p = (LPSTR)str; i = 0; while (*p) { diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 7eedca1ce1..173696bcbf 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -31,7 +31,7 @@ char *MirandaContact::MENU_ITEM_TEXT = LPGEN("&Transliterate"); char *MirandaContact::MENU_COMMAND_CALLBACK_SERVICE = "CyrTranslit/ContactMenuCmd"; -HGENMENU MirandaContact::hTransliterateCmdMenuItem = 0; +HGENMENU MirandaContact::hTransliterateCmdMenuItem = nullptr; //------------------------------------------------------------------------------ @@ -91,7 +91,7 @@ int MirandaContact::onPreBuildContactMenu(WPARAM wParam, LPARAM) MCONTACT hContact = MCONTACT(wParam); if (!db_is_contact(wParam)) return 0; - Menu_ModifyItem(hTransliterateCmdMenuItem, NULL, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0); + Menu_ModifyItem(hTransliterateCmdMenuItem, nullptr, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0); return 0; } diff --git a/plugins/CyrTranslit/src/TransliterationMap.cpp b/plugins/CyrTranslit/src/TransliterationMap.cpp index f9ac320f44..f8f2169770 100644 --- a/plugins/CyrTranslit/src/TransliterationMap.cpp +++ b/plugins/CyrTranslit/src/TransliterationMap.cpp @@ -23,7 +23,7 @@ namespace CyrTranslit { TransliterationMap::Guard TransliterationMap::guard; -const TransliterationMap *TransliterationMap::pInstance = 0; +const TransliterationMap *TransliterationMap::pInstance = nullptr; //------------------------------------------------------------------------------ diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp index d96086a42a..27b86c38af 100644 --- a/plugins/Db3x_mmap/src/database.cpp +++ b/plugins/Db3x_mmap/src/database.cpp @@ -87,9 +87,9 @@ void __cdecl dbpanic(void *) wchar_t err[256]; mir_snwprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr); - MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK); + MessageBox(nullptr, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK); } - else MessageBox(0, TranslateW(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK); + else MessageBox(nullptr, TranslateW(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK); TerminateProcess(GetCurrentProcess(), 255); } diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 66559fff3a..03c6da8385 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -396,7 +396,7 @@ void CDb3Mmap::ToggleEventsEncryption(MCONTACT contactID) size_t len; DWORD ofsDest; mir_ptr pBlob; - BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), 0); + BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), nullptr); if (!m_bEncrypted) { // we need more space if ((pBlob = m_crypto->encodeBuffer(pSource, evt.cbBlob, &len)) == nullptr) return; diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index aacb29f2da..8fd9a1dde3 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -362,18 +362,18 @@ STDMETHODIMP_(BOOL) CDb3Mmap::GetContactSettingStatic(MCONTACT contactID, LPCSTR STDMETHODIMP_(BOOL) CDb3Mmap::FreeVariant(DBVARIANT *dbv) { - if (dbv == 0) return 1; + if (dbv == nullptr) return 1; switch (dbv->type) { case DBVT_ASCIIZ: case DBVT_UTF8: case DBVT_WCHAR: if (dbv->pszVal) mir_free(dbv->pszVal); - dbv->pszVal = 0; + dbv->pszVal = nullptr; break; case DBVT_BLOB: if (dbv->pbVal) mir_free(dbv->pbVal); - dbv->pbVal = 0; + dbv->pbVal = nullptr; break; } dbv->type = 0; @@ -801,7 +801,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz } // notify - DBCONTACTWRITESETTING dbcws = { 0 }; + DBCONTACTWRITESETTING dbcws = {}; dbcws.szModule = szModule; dbcws.szSetting = szSetting; dbcws.value.type = DBVT_DELETED; diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index d73f95966a..2e088b95d8 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -140,7 +140,7 @@ bool CDb3Mmap::EnterPassword(const BYTE *pKey, const size_t keyLen) CredFree(pCred); } else { - if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), 0, sttEnterPassword, (LPARAM)¶m)) + if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), nullptr, sttEnterPassword, (LPARAM)¶m)) return false; m_crypto->setPassword(T2Utf(param.newPass)); } @@ -258,7 +258,7 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM) { CDb3Mmap *db = (CDb3Mmap*)obj; DlgChangePassParam param = { db }; - DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), 0, sttChangePassword, (LPARAM)¶m); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)¶m); return 0; } diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index b4123abe50..1f9ed55889 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -64,7 +64,7 @@ static INT_PTR ServiceMode(WPARAM, LPARAM) { bLaunchMiranda = bShortMode = bAutoExit = false; bServiceMode = true; - DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc); + DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); return (bLaunchMiranda) ? SERVICE_CONTINUE : SERVICE_FAILED; } @@ -75,7 +75,7 @@ static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam) bAutoExit = lParam == 2; bServiceMode = false; wcsncpy(opts.filename, (wchar_t*)wParam, _countof(opts.filename)); - return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc); + return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc); } extern "C" __declspec(dllexport) int Load(void) diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp index a5ea7c99a6..3c98c1e8b2 100644 --- a/plugins/DbChecker/src/openerror.cpp +++ b/plugins/DbChecker/src/openerror.cpp @@ -29,7 +29,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WM_INITDIALOG: { wchar_t szError[256]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, opts.error, 0, szError, _countof(szError), NULL); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, opts.error, 0, szError, _countof(szError), nullptr); SetDlgItemText(hdlg, IDC_ERRORTEXT, szError); } if (opts.error == ERROR_SHARING_VIOLATION) ShowWindow(GetDlgItem(hdlg, IDC_INUSE), SW_SHOW); diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index ffac34c610..5949c9e89c 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void __cdecl WorkerThread(void *unused); static HWND hwndStatus, hdlgProgress, hwndBar; static bool bShortModeDone; -HANDLE hEventRun = NULL, hEventAbort = NULL; +HANDLE hEventRun = nullptr, hEventAbort = nullptr; int errorCount; LRESULT wizardResult; @@ -39,7 +39,7 @@ void AddToStatus(int flags, const wchar_t* fmt, ...) int i = SendMessage(hwndStatus, LB_ADDSTRING, 0, (LPARAM)str); SendMessage(hwndStatus, LB_SETITEMDATA, i, flags); - InvalidateRect(hwndStatus, NULL, FALSE); + InvalidateRect(hwndStatus, nullptr, FALSE); SendMessage(hwndStatus, LB_SETTOPINDEX, i, 0); #ifdef _DEBUG @@ -68,7 +68,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM { static int fontHeight, listWidth; static int manualAbort; - static HFONT hBoldFont = NULL; + static HFONT hBoldFont = nullptr; INT_PTR bReturn; if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn)) @@ -87,12 +87,12 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM HDC hdc; HFONT hFont, hoFont; SIZE s; - hdc = GetDC(NULL); + hdc = GetDC(nullptr); hFont = (HFONT)SendMessage(hdlg, WM_GETFONT, 0, 0); hoFont = (HFONT)SelectObject(hdc, hFont); GetTextExtentPoint32(hdc, L"x", 1, &s); SelectObject(hdc, hoFont); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); fontHeight = s.cy; RECT rc; @@ -105,10 +105,10 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM hBoldFont = CreateFontIndirect(&lf); } manualAbort = 0; - hEventRun = CreateEvent(NULL, TRUE, TRUE, NULL); - hEventAbort = CreateEvent(NULL, TRUE, FALSE, NULL); + hEventRun = CreateEvent(nullptr, TRUE, TRUE, nullptr); + hEventAbort = CreateEvent(nullptr, TRUE, FALSE, nullptr); TranslateDialogDefault(hdlg); - _beginthread(WorkerThread, 0, NULL); + _beginthread(WorkerThread, 0, nullptr); return TRUE; case WM_MEASUREITEM: @@ -124,7 +124,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; int bold = 0; - HFONT hoFont = NULL; + HFONT hoFont = nullptr; if ((int)dis->itemID == -1) break; SendMessage(dis->hwndItem, LB_GETTEXT, dis->itemID, (LPARAM)str); switch (dis->itemData & STATUS_CLASSMASK) { @@ -147,7 +147,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break; } if (bold) hoFont = (HFONT)SelectObject(dis->hDC, hBoldFont); - ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_wstrlen(str), NULL); + ExtTextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, str, (UINT)mir_wstrlen(str), nullptr); if (bold) SelectObject(dis->hDC, hoFont); } return TRUE; @@ -175,7 +175,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM else { PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc); CloseHandle(opts.hOutFile); - opts.hOutFile = NULL; + opts.hOutFile = nullptr; } break; } @@ -231,15 +231,15 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WM_DESTROY: if (hEventAbort) { CloseHandle(hEventAbort); - hEventAbort = NULL; + hEventAbort = nullptr; } if (hEventRun) { CloseHandle(hEventRun); - hEventRun = NULL; + hEventRun = nullptr; } if (hBoldFont) { DeleteObject(hBoldFont); - hBoldFont = NULL; + hBoldFont = nullptr; } break; } diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 5fe836c21d..559dc5d7fd 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static bool CheckBroken(const wchar_t *ptszFullPath) { DATABASELINK *dblink = FindDatabasePlugin(ptszFullPath); - if (dblink == NULL || dblink->CheckDB == NULL) + if (dblink == nullptr || dblink->CheckDB == nullptr) return true; return dblink->grokHeader(ptszFullPath) != EGROKPRF_NOERROR; @@ -33,9 +33,9 @@ int OpenDatabase(HWND hdlg, INT iNextPage) wchar_t tszMsg[1024]; int error = 0; - if (opts.dbChecker == NULL) { + if (opts.dbChecker == nullptr) { DATABASELINK* dblink = FindDatabasePlugin(opts.filename); - if (dblink == NULL) { + if (dblink == nullptr) { mir_snwprintf(tszMsg, TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."), opts.filename); @@ -44,7 +44,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) return false; } - if (dblink->CheckDB == NULL) { + if (dblink->CheckDB == nullptr) { mir_snwprintf(tszMsg, TranslateT("Database driver '%s' doesn't support checking."), TranslateW(dblink->szFullName)); @@ -52,7 +52,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage) } opts.dbChecker = dblink->CheckDB(opts.filename, &error); - if (opts.dbChecker == NULL) { + if (opts.dbChecker == nullptr) { if ((opts.error = GetLastError()) == 0) opts.error = error; PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc); @@ -108,7 +108,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di bool isBroken = CheckBroken(filename); const wchar_t *pName = wcsrchr(filename, '\\'); - if (pName == NULL) + if (pName == nullptr) pName = (LPTSTR)filename; else pName++; @@ -117,7 +117,7 @@ static int AddDatabaseToList(HWND hwndList, const wchar_t* filename, wchar_t* di mir_snwprintf(szName, L"%s%s", dir, pName); wchar_t *pDot = wcsrchr(szName, '.'); - if (pDot != NULL && !mir_wstrcmpi(pDot, L".dat")) + if (pDot != nullptr && !mir_wstrcmpi(pDot, L".dat")) *pDot = 0; lvi.iItem = 0; @@ -192,9 +192,9 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM ListView_InsertColumn(GetDlgItem(hdlg, IDC_DBLIST), 1, &lvc); wchar_t szMirandaPath[MAX_PATH]; - GetModuleFileName(NULL, szMirandaPath, _countof(szMirandaPath)); + GetModuleFileName(nullptr, szMirandaPath, _countof(szMirandaPath)); wchar_t *str2 = wcsrchr(szMirandaPath, '\\'); - if (str2 != NULL) + if (str2 != nullptr) *str2 = 0; int i = 0; @@ -217,7 +217,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM // search in profile dir (using registry path + ini file) if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\miranda32.exe", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { - if (RegQueryValueEx(hKey, L"Path", NULL, NULL, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) { + if (RegQueryValueEx(hKey, L"Path", nullptr, nullptr, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) { if (mir_wstrcmp(szProfileDir, szMirandaPath)) { GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir)); FindAdd(hdlg, szProfileDir, L"[reg]\\"); @@ -233,9 +233,9 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM ListView_SetItemState(GetDlgItem(hdlg, IDC_DBLIST), i, LVIS_SELECTED, LVIS_SELECTED); } - if (opts.dbChecker != NULL) { + if (opts.dbChecker != nullptr) { opts.dbChecker->Destroy(); - opts.dbChecker = NULL; + opts.dbChecker = nullptr; } if (bShortMode) @@ -275,7 +275,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM GetDlgItemText(hdlg, IDC_FILE, str, _countof(str)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hdlg; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; ofn.lpstrDefExt = L"dat"; ofn.lpstrFile = str; diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp index 321eba23a8..5f9f74b4c5 100644 --- a/plugins/DbChecker/src/welcome.cpp +++ b/plugins/DbChecker/src/welcome.cpp @@ -44,11 +44,11 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l TitleLogFont.lfWeight = FW_BOLD; mir_wstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold")); - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); INT FontSize = 12; TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72; hTitleFont = CreateFontIndirect(&TitleLogFont); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); } SendDlgItemMessage(hdlg, IDC_TITLE, WM_SETFONT, (WPARAM)hTitleFont, 0); EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE); diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp index 62f30e1c42..86a038ae20 100644 --- a/plugins/DbChecker/src/wizard.cpp +++ b/plugins/DbChecker/src/wizard.cpp @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static HFONT hBoldFont = NULL; -static HENHMETAFILE hEmfHeaderLogo = NULL; +static HFONT hBoldFont = nullptr; +static HENHMETAFILE hEmfHeaderLogo = nullptr; static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) { @@ -41,7 +41,7 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) makeBold = 1; } if (makeBold) { - if (hBoldFont == NULL) { + if (hBoldFont == nullptr) { LOGFONT lf; hBoldFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); GetObject(hBoldFont, sizeof(lf), &lf); @@ -50,7 +50,7 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) } SendMessage(hwnd, WM_SETFONT, (WPARAM)hBoldFont, 0); SetWindowLongPtr(hwnd, GWL_EXSTYLE, exstyle&~WS_EX_CLIENTEDGE); - SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); } return TRUE; } @@ -60,7 +60,7 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, switch (message) { case WM_INITDIALOG: EnumChildWindows(hdlg, MyControlsEnumChildren, 0); - if (hEmfHeaderLogo == NULL) { + if (hEmfHeaderLogo == nullptr) { HRSRC hRsrc = FindResourceA(hInst, MAKEINTRESOURCEA(IDE_HDRLOGO), "EMF"); HGLOBAL hGlob = LoadResource(hInst, hRsrc); hEmfHeaderLogo = SetEnhMetaFileBits(SizeofResource(hInst, hRsrc), (PBYTE)LockResource(hGlob)); @@ -97,7 +97,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP switch (message) { case WM_INITDIALOG: SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_DBTOOL))); - hdlgPage = NULL; + hdlgPage = nullptr; if (bShortMode) SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); else @@ -106,14 +106,14 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP return TRUE; case WZM_GOTOPAGE: - if (hdlgPage != NULL) DestroyWindow(hdlgPage); + if (hdlgPage != nullptr) DestroyWindow(hdlgPage); EnableWindow(GetDlgItem(hdlg, IDC_BACK), TRUE); EnableWindow(GetDlgItem(hdlg, IDOK), TRUE); EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE); SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel")); hdlgPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam); TranslateDialogDefault(hdlgPage); - SetWindowPos(hdlgPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(hdlgPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); ShowWindow(hdlgPage, SW_SHOW); break; @@ -136,20 +136,20 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP case WM_DESTROY: if (opts.dbChecker) { opts.dbChecker->Destroy(); - opts.dbChecker = NULL; + opts.dbChecker = nullptr; } if (opts.hOutFile) CloseHandle(opts.hOutFile); DestroyWindow(hdlgPage); - if (hBoldFont != NULL) { + if (hBoldFont != nullptr) { DeleteObject(hBoldFont); - hBoldFont = NULL; + hBoldFont = nullptr; } - if (hEmfHeaderLogo != NULL) { + if (hEmfHeaderLogo != nullptr) { DeleteEnhMetaFile(hEmfHeaderLogo); - hEmfHeaderLogo = NULL; + hEmfHeaderLogo = nullptr; } break; } diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index ab97b54b33..7ae4bdc0b2 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -24,27 +24,27 @@ void ProcessingDone(void); static void Finalize(time_t& ts) { opts.dbChecker->Destroy(); - opts.dbChecker = NULL; + opts.dbChecker = nullptr; if (opts.hOutFile) { CloseHandle(opts.hOutFile); - opts.hOutFile = NULL; + opts.hOutFile = nullptr; } if (errorCount && !opts.bBackup && !opts.bCheckOnly) { - time_t dlg_ts = time(NULL); - if (IDYES == MessageBox(NULL, + time_t dlg_ts = time(nullptr); + if (IDYES == MessageBox(nullptr, TranslateT("Errors were encountered, however you selected not to backup the original database. It is strongly recommended that you do so in case important data was omitted. Do you wish to keep a backup of the original database?"), TranslateT("Miranda Database Tool"), MB_YESNO)) opts.bBackup = 1; - ts += time(NULL) - dlg_ts; + ts += time(nullptr) - dlg_ts; } if (opts.bBackup) { wchar_t dbPath[MAX_PATH], dbFile[MAX_PATH]; mir_wstrcpy(dbPath, opts.filename); wchar_t* str2 = wcsrchr(dbPath, '\\'); - if (str2 != NULL) { + if (str2 != nullptr) { mir_wstrcpy(dbFile, str2 + 1); *str2 = 0; } @@ -75,7 +75,7 @@ static void Finalize(time_t& ts) void __cdecl WorkerThread(void *) { int task, firstTime; - time_t ts = time(NULL); + time_t ts = time(nullptr); AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated")); @@ -89,7 +89,7 @@ void __cdecl WorkerThread(void *) mir_wstrcpy(opts.outputFilename, opts.filename); *wcsrchr(opts.outputFilename, '.') = 0; mir_wstrcat(opts.outputFilename, TranslateT(" (Output).dat")); - opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); if (opts.hOutFile == INVALID_HANDLE_VALUE) { AddToStatus(STATUS_FATAL, TranslateT("Can't create output file (%u)"), GetLastError()); ProcessingDone(); @@ -129,7 +129,7 @@ void __cdecl WorkerThread(void *) firstTime = 0; if (ret == ERROR_OUT_OF_PAPER) { Finalize(ts); - AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(NULL) - ts); + AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(nullptr) - ts); if (errorCount) AddToStatus(STATUS_SUCCESS, TranslateT("All tasks completed but with errors (%d)"), errorCount); else diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index ae2430bb68..95a27b2f68 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -36,13 +36,13 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar if (ApplyProtoFilter(hContact)) continue; - GetContactName(hContact, NULL, name, _countof(name)); + GetContactName(hContact, nullptr, name, _countof(name)); int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name); SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact); } - GetContactName(NULL, NULL, name, _countof(name)); + GetContactName(NULL, nullptr, name, _countof(name)); int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name); SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0); SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0); @@ -61,11 +61,11 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar copyModule(mac->module, mac->hContact, hContact); } else { - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) copyModule(mac->module, mac->hContact, hContact); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } refreshTree(1); // fall through diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 8ea862845e..62e63426fd 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" volatile BOOL working; -static HWND hwnd2Delete = NULL; +static HWND hwnd2Delete = nullptr; int deleteModule(MCONTACT hContact, const char *module, int confirm) { @@ -93,13 +93,13 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) { char module[FLD_SIZE]; GetDlgItemTextA(hwnd, IDC_CONTACTS, module, _countof(module)); - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) deleteModule(hContact, module, 0); // do the null deleteModule(NULL, module, 0); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); refreshTree(1); } // fall through @@ -113,7 +113,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) break; case WM_DESTROY: - hwnd2Delete = NULL; + hwnd2Delete = nullptr; break; } return 0; diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 6f33002d52..e9c6efe468 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -150,20 +150,20 @@ void exportDB(MCONTACT hContact, const char *module) wchar_t fileName[MAX_PATH]; - if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? NULL : module, MAX_PATH)) { + if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? nullptr : module, MAX_PATH)) { FILE *file = _wfopen(fileName, L"wt"); if (!file) { msg(TranslateT("Couldn't open file for writing")); return; } - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // exporting entire db if (hContact == INVALID_CONTACT_ID) { hContact = NULL; - if (module == NULL) { + if (module == nullptr) { fprintf(file, "SETTINGS:\n"); mod = modlist.first; while (mod) { @@ -179,7 +179,7 @@ void exportDB(MCONTACT hContact, const char *module) } else { if (*module == 0) - module = NULL; // reset module for all contacts export + module = nullptr; // reset module for all contacts export } hContact = db_find_first(); @@ -195,7 +195,7 @@ void exportDB(MCONTACT hContact, const char *module) fprintf(file, "CONTACT: %s\n", NickFromHContact(hContact)); - if (module == NULL) // export all modules + if (module == nullptr) // export all modules { mod = modlist.first; while (mod) { @@ -247,7 +247,7 @@ void exportDB(MCONTACT hContact, const char *module) } fclose(file); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } FreeModuleSettingLL(&modlist); @@ -276,18 +276,18 @@ void importSettings(MCONTACT hContact, char *utf8) importstring = strtok(importstring, "\n"); - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); - while (importstring != NULL) { + while (importstring != nullptr) { i = 0; rtrim(importstring); if (importstring[i] == '\0') { - importstring = strtok(NULL, "\n"); + importstring = strtok(nullptr, "\n"); continue; } if (!strncmp(&importstring[i], "SETTINGS:", mir_strlen("SETTINGS:"))) { - importstring = strtok(NULL, "\n"); + importstring = strtok(nullptr, "\n"); continue; } @@ -414,9 +414,9 @@ void importSettings(MCONTACT hContact, char *utf8) } } } - importstring = strtok(NULL, "\n"); + importstring = strtok(nullptr, "\n"); } - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -429,7 +429,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara wchar_t name[NAME_SIZE], msg[MSG_SIZE]; - GetContactName((MCONTACT)lParam, NULL, name, _countof(name)); + GetContactName((MCONTACT)lParam, nullptr, name, _countof(name)); mir_snwprintf(msg, TranslateT("Import to \"%s\""), name); SetWindowText(hwnd, msg); @@ -515,10 +515,10 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) mir_wstrcat(szFile, &szFileNames[index]); index += (int)mir_wstrlen(&szFileNames[index]) + 1; - HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile != INVALID_HANDLE_VALUE) { - if (GetFileSize(hFile, NULL) > 0) { - HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (GetFileSize(hFile, nullptr) > 0) { + HANDLE hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr); if (hMap) { char *pFile = (char*)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0, 0); if (pFile) { diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index b97dd4ab0d..ccfc80060a 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -49,7 +49,7 @@ ColumnsSettings csResultList[] = { { LPGENW("Module"), 2, "Search2width", 100 }, { LPGENW("Setting"), 3, "Search3width", 100 }, { LPGENW("Value"), 4, "Search4width", 150 }, - {0} + {nullptr} }; @@ -237,7 +237,7 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set else mode = TranslateT("Found"); - GetContactName(hContact, NULL, name, _countof(name)); + GetContactName(hContact, nullptr, name, _countof(name)); LVITEM lvi = {0}; lvi.mask = LVIF_PARAM; @@ -376,13 +376,13 @@ void __cdecl FindSettings(LPVOID param) if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) { char val[16]; - numsearch = strtoul(search, NULL, 10); + numsearch = strtoul(search, nullptr, 10); _ultoa(numsearch, val, 10); if (!mir_strcmp(search, val)) { fi->options |= F_NUMSRCH; // replace numeric values only entirely if (replace && (fi->options & F_ENTIRE)) { - numreplace = strtoul(replace, NULL, 10); + numreplace = strtoul(replace, nullptr, 10); _ultoa(numreplace, val, 10); if (!replace[0] || !mir_strcmp(replace, val)) fi->options |= F_NUMREPL; @@ -429,7 +429,7 @@ void __cdecl FindSettings(LPVOID param) // check in settings value if (fi->options & F_SETVAL) { - wchar_t *value = NULL; + wchar_t *value = nullptr; switch(dbv.type) { @@ -527,7 +527,7 @@ void __cdecl FindSettings(LPVOID param) } } - ItemFound(fi->hwnd, hContact, module->name, newSetting, NULL, flag); + ItemFound(fi->hwnd, hContact, module->name, newSetting, nullptr, flag); } db_free(&dbv); @@ -549,19 +549,19 @@ void __cdecl FindSettings(LPVOID param) if (!newModule[0]) { deleteModule(hContact, module->name, 0); - replaceTreeItem(hContact, module->name, NULL); + replaceTreeItem(hContact, module->name, nullptr); flag |= F_DELETED; newModule = module->name; deleteCount++; } else if (renameModule(hContact, module->name, newModule)) { - replaceTreeItem(hContact, module->name, NULL); + replaceTreeItem(hContact, module->name, nullptr); flag |= F_REPLACED; replaceCount++; } } - ItemFound(fi->hwnd, hContact, newModule, 0, 0, flag); + ItemFound(fi->hwnd, hContact, newModule, nullptr, nullptr, flag); } } // for(module) diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 3e388b7244..683b90fbe7 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -67,13 +67,13 @@ HIMAGELIST LoadIcons() HICON hIcon; HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5); if (!hil) - return NULL; + return nullptr; for(int i = 0; i < _countof(dbeIcons); i++) ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i])); int protoCount = 0; - PROTOACCOUNT **protocols = NULL; + PROTOACCOUNT **protocols = nullptr; Proto_EnumAccounts(&protoCount, &protocols); for (int i = 0; i < protoCount; i++) { @@ -92,7 +92,7 @@ int GetProtoIconIndex(const char *szProto) { if (szProto && szProto[0]) { int protoCount = 0; - PROTOACCOUNT **protocols = NULL; + PROTOACCOUNT **protocols = nullptr; Proto_EnumAccounts(&protoCount, &protocols); for (int i = 0; i < protoCount; i++) diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index fe31957c25..e3c6084450 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" -HINSTANCE hInst = NULL; +HINSTANCE hInst = nullptr; MIDatabase *g_db; -HANDLE hTTBButt = NULL; +HANDLE hTTBButt = nullptr; bool g_bServiceMode = false; bool g_bUsePopups; @@ -97,7 +97,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM) static int OnTTBLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = "DBEditorpp/MenuCommand"; ttb.name = LPGEN("Database Editor++"); @@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM) Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x2fed8613, 0xac43, 0x4148, 0xbd, 0x5c, 0x44, 0x88, 0xaf, 0x68, 0x69, 0x10); - mi.root = NULL; + mi.root = nullptr; mi.hIcolibItem = GetIcoLibHandle(ICO_REGUSER); mi.name.a = LPGEN("Open user tree in DBE++"); mi.pszService = "DBEditorpp/MenuCommand"; @@ -184,7 +184,7 @@ extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); - hwnd2mainWindow = NULL; + hwnd2mainWindow = nullptr; hRestore = NULL; g_db = db_get_current(); @@ -313,7 +313,7 @@ int setNumericValue(MCONTACT hContact, const char *module, const char *setting, int IsRealUnicode(wchar_t *value) { BOOL nonascii = 0; - WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, NULL, 0, NULL, &nonascii); + WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, nullptr, 0, nullptr, &nonascii); return nonascii; } diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 6868493943..318a1fc8e1 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -2,7 +2,7 @@ HWND hwnd2mainWindow; -static HIMAGELIST hImg = 0; +static HIMAGELIST hImg = nullptr; int g_Hex; int g_Mode; @@ -63,7 +63,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, { RECT rc; GetClientRect(hwnd, &rc); - SetCursor(rc.right > rc.bottom ? LoadCursor(NULL, IDC_SIZENS) : LoadCursor(NULL, IDC_SIZEWE)); + SetCursor(rc.right > rc.bottom ? LoadCursor(nullptr, IDC_SIZENS) : LoadCursor(nullptr, IDC_SIZEWE)); } return TRUE; @@ -369,13 +369,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) freeTree(0); - hwnd2mainWindow = NULL; - hwnd2Tree = NULL; - hwnd2List = NULL; + hwnd2mainWindow = nullptr; + hwnd2Tree = nullptr; + hwnd2List = nullptr; if (hImg) { ImageList_Destroy(hImg); - hImg = NULL; + hImg = nullptr; } FreeResidentSettings(); @@ -416,16 +416,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) freeAllWatches(); break; case MENU_EXPORTDB: // all db - exportDB(INVALID_CONTACT_ID, 0); + exportDB(INVALID_CONTACT_ID, nullptr); break; case MENU_EXPORTCONTACT: // all contacts exportDB(INVALID_CONTACT_ID, ""); break; case MENU_EXPORTMODULE: // all settings - exportDB(NULL, 0); + exportDB(NULL, nullptr); break; case MENU_IMPORTFROMFILE: - ImportSettingsFromFileMenuItem(NULL, NULL); + ImportSettingsFromFileMenuItem(NULL, nullptr); break; case MENU_IMPORTFROMTEXT: ImportSettingsMenuItem(NULL); @@ -539,5 +539,5 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openMainWindow() { - CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc); + CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc); } diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index e1e7de6e33..551fc3a171 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -3,7 +3,7 @@ void FreeModuleSettingLL(ModuleSettingLL *msll) { - if (msll == NULL) + if (msll == nullptr) return; ModSetLinkLinkItem *item = msll->first; @@ -16,8 +16,8 @@ void FreeModuleSettingLL(ModuleSettingLL *msll) mir_free(temp); } - msll->first = 0; - msll->last = 0; + msll->first = nullptr; + msll->last = nullptr; } @@ -30,7 +30,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) return 1; msll->first->name = mir_strdup(setting); - msll->first->next = 0; + msll->first->next = nullptr; msll->last = msll->first; } else { @@ -41,7 +41,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) msll->last->next = item; msll->last = item; item->name = mir_strdup(setting); - item->next = 0; + item->next = nullptr; } return 0; } @@ -49,8 +49,8 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam) int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail { - msll->first = 0; - msll->last = 0; + msll->first = nullptr; + msll->last = nullptr; if (db_enum_modules(enumModulesSettingsProc, msll)) { msg(TranslateT("Error loading module list")); return 0; @@ -68,8 +68,8 @@ int enumSettingsProc(const char *setting, LPARAM lParam) int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll) { // enum all setting the contact has for the module - msll->first = 0; - msll->last = 0; + msll->first = nullptr; + msll->last = nullptr; if (db_enum_settings(hContact, enumSettingsProc, module, msll)) { msg(TranslateT("Error loading setting list")); return 0; @@ -118,7 +118,7 @@ int enumResidentProc(const char *setting, DWORD, LPARAM) int LoadResidentSettings() { if (g_db) - return !g_db->EnumResidentSettings(enumResidentProc, 0); + return !g_db->EnumResidentSettings(enumResidentProc, nullptr); return 0; } @@ -154,8 +154,8 @@ int IsResidentSetting(const char *module, const char *setting) int EnumResidentSettings(const char *module, ModuleSettingLL *msll) { - msll->first = 0; - msll->last = 0; + msll->first = nullptr; + msll->last = nullptr; if (!module) return 0; if (!m_lResidentSettings.getCount()) return 0; @@ -179,8 +179,8 @@ int EnumResidentSettings(const char *module, ModuleSettingLL *msll) int EnumResidentModules(ModuleSettingLL *msll) { - msll->first = 0; - msll->last = 0; + msll->first = nullptr; + msll->last = nullptr; if (!m_lResidentModules.getCount()) return 0; diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 34c43fb7e8..6abd34c7ec 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -HWND hwnd2Tree = 0; +HWND hwnd2Tree = nullptr; volatile BOOL populating = 0; volatile int Select = 0; @@ -38,7 +38,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec ModuleTreeInfoStruct *lParam; int itemscount = 0; int icon = 0; - HTREEITEM hItem = 0; + HTREEITEM hItem = nullptr; SetWindowText(hwnd2mainWindow, TranslateT("Loading contacts...")); @@ -155,7 +155,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) wchar_t text[FLD_SIZE]; if (!TreeView_GetCount(hwnd2Tree)) - return 0; + return nullptr; _A2T szModule(module); @@ -182,7 +182,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module) } while (item.hItem); - return 0; + return nullptr; } // the following code to go through the whole tree is nicked from codeguru.. @@ -296,7 +296,7 @@ void replaceTreeItem(MCONTACT hContact, const char* module, const char* newModul return; if (hParent) { - replaceTreeItem(hContact, newModule, NULL); + replaceTreeItem(hContact, newModule, nullptr); insertItem(hContact, newModule, hParent); } } @@ -374,7 +374,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) /// contact root item contacts_mtis.type = CONTACT_ROOT_ITEM; tvi.item.lParam = (LPARAM)&contacts_mtis; - tvi.hParent = NULL; + tvi.hParent = nullptr; tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_STATE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.item.state = TVIS_BOLD; tvi.item.stateMask = TVIS_BOLD; @@ -391,7 +391,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) tvi.item.lParam = (LPARAM)&settings_mtis; tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.item.cChildren = 1; - tvi.hParent = NULL; + tvi.hParent = nullptr; tvi.hInsertAfter = TVI_FIRST; tvi.item.pszText = TranslateT("Settings"); tvi.item.iImage = IMAGE_SETTINGS; @@ -665,11 +665,11 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t case 5: // contact module { // check if the setting is being watched and if it is then check the menu item - int watchIdx = WatchedArrayIndex(hContact, module, NULL, 1); + int watchIdx = WatchedArrayIndex(hContact, module, nullptr, 1); if (watchIdx >= 0) CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) { case MENU_RENAME_MOD: TreeView_EditLabel(hwnd2Tree, tvi.hItem); break; @@ -688,7 +688,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ////////////////////////////////////////////////////////////////////// divider case MENU_WATCH_ITEM: if (watchIdx < 0) - addSettingToWatchList(hContact, module, 0); + addSettingToWatchList(hContact, module, nullptr); else freeWatchListItem(watchIdx); PopulateWatchedWindow(); @@ -710,7 +710,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break; case 2: // contact - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) { case MENU_CLONE_CONTACT: if (CloneContact(hContact)) refreshTree(1); @@ -730,13 +730,13 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ////////////////////////////////////////////////////////////////////// divider case MENU_EXPORTCONTACT: - exportDB(hContact, 0); + exportDB(hContact, nullptr); break; case MENU_IMPORTFROMTEXT: ImportSettingsMenuItem(hContact); break; case MENU_IMPORTFROMFILE: - ImportSettingsFromFileMenuItem(hContact, NULL); + ImportSettingsFromFileMenuItem(hContact, nullptr); break; ////////////////////////////////////////////////////////////////////// divider @@ -752,18 +752,18 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break; case 3: // NULL contact - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) { case MENU_ADD_MODULE: addModuleDlg(hContact); break; case MENU_EXPORTCONTACT: - exportDB(NULL, 0); + exportDB(NULL, nullptr); break; case MENU_IMPORTFROMTEXT: ImportSettingsMenuItem(NULL); break; case MENU_IMPORTFROMFILE: - ImportSettingsFromFileMenuItem(NULL, NULL); + ImportSettingsFromFileMenuItem(NULL, nullptr); break; case MENU_REFRESH: refreshTree(1); @@ -772,7 +772,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break; case 4: // Contacts root - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) { case MENU_EXPORTCONTACT: exportDB(INVALID_CONTACT_ID, ""); break; @@ -780,7 +780,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ImportSettingsMenuItem(NULL); break; case MENU_IMPORTFROMFILE: - ImportSettingsFromFileMenuItem(NULL, NULL); + ImportSettingsFromFileMenuItem(NULL, nullptr); break; case MENU_REFRESH: refreshTree(1); diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index c6c59a83ad..3e2ca49646 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) db_set_b(NULL, modname, "WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL)); g_bUsePopups = IsDlgButtonChecked(hwnd, IDC_POPUPS) != 0; db_set_b(NULL, modname, "UsePopUps", (BYTE)g_bUsePopups); - db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, NULL, 0)); + db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0)); db_set_dw(NULL, modname, "PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0)); } return TRUE; diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 1844907aba..3f87c49644 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwnd); wchar_t msg[MSG_SIZE], name[NAME_SIZE]; - GetContactName((MCONTACT)lParam, NULL, name, _countof(name)); + GetContactName((MCONTACT)lParam, nullptr, name, _countof(name)); mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name); SetWindowText(hwnd, msg); diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 501aa0e75e..8718da8bec 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -2,7 +2,7 @@ SettingListInfo info = {0}; -HWND hwnd2List = 0; +HWND hwnd2List = nullptr; static int lastColumn = -1; @@ -14,7 +14,7 @@ struct ColumnsSettings csSettingList[] = { LPGENW("Type"), 2, "Column2width", 60 }, { LPGENW("Size"), 3, "Column3width", 80 }, { LPGENW("#"), 4, "Column4width", 30 }, - { 0 } + { nullptr } }; int ListView_GetItemTextA(HWND hwndLV, int i, int iSubItem, char *pszText, int cchTextMax) @@ -74,7 +74,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i value = mir_a2u(dbv.pszVal); if (mir_wstrlen(value) < 11) - val = wcstoul(value, NULL, NULL); + val = wcstoul(value, nullptr, NULL); } switch (toType) { @@ -108,7 +108,7 @@ void EditFinish(int selected) { if (info.hwnd2Edit) { SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0); - info.hwnd2Edit = NULL; + info.hwnd2Edit = nullptr; } info.selectedItem = selected; } @@ -157,7 +157,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s } if (ListView_GetItemCount(hwnd2List) == 0) - replaceTreeItem(hContact, module, 0); + replaceTreeItem(hContact, module, nullptr); } @@ -301,7 +301,7 @@ void addListHandle(MCONTACT hContact) lvi.lParam = hContact; lvi.iImage = IMAGE_HANDLE; - GetContactName(hContact, NULL, name, _countof(name)); + GetContactName(hContact, nullptr, name, _countof(name)); lvi.pszText = name; int index = ListView_InsertItem(hwnd2List, &lvi); @@ -408,7 +408,7 @@ void settingChanged(MCONTACT hContact, const char *module, const char *setting, if (dbv->type != DBVT_DELETED) { HTREEITEM hItem = findItemInTree(hContact, module); if (!hItem) { - HTREEITEM hParent = findItemInTree(hContact, NULL); + HTREEITEM hParent = findItemInTree(hContact, nullptr); if (hParent) insertItem(hContact, module, hParent); } @@ -510,7 +510,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM switch (value[0]) { case 'b': case 'B': - val = wcstoul(&value[1], NULL, 0); + val = wcstoul(&value[1], nullptr, 0); if (!val || value[1] == '0') { res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val); } @@ -519,7 +519,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM break; case 'w': case 'W': - val = wcstoul(&value[1], NULL, 0); + val = wcstoul(&value[1], nullptr, 0); if (!val || value[1] == '0') res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val); else @@ -527,7 +527,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM break; case 'd': case 'D': - val = wcstoul(&value[1], NULL, 0); + val = wcstoul(&value[1], nullptr, 0); if (!val || value[1] == '0') res = !db_set_dw(info.hContact, info.module, info.setting, val); else @@ -550,9 +550,9 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM case 'x': case 'X': if (value[i] == 'x' || value[i] == 'X') - val = wcstoul(&value[i + 1], NULL, 16); + val = wcstoul(&value[i + 1], nullptr, 16); else - val = wcstoul(value, NULL, 10); + val = wcstoul(value, nullptr, 10); switch (dbv.type) { case DBVT_BYTE: @@ -608,7 +608,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM return DLGC_WANTALLKEYS; case WM_DESTROY: - info.hwnd2Edit = NULL; + info.hwnd2Edit = nullptr; break; } return mir_callNextSubclass(hwnd, SettingLabelEditSubClassProc, msg, wParam, lParam); @@ -622,7 +622,7 @@ void EditLabel(int item, int subitem) if (info.hwnd2Edit) { SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); // ignore the new value of the last edit - info.hwnd2Edit = NULL; + info.hwnd2Edit = nullptr; } if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, _countof(setting))) return; @@ -636,9 +636,9 @@ void EditLabel(int item, int subitem) info.subitem = subitem; if (!subitem) - info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0); + info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr); else { - wchar_t *str = NULL, value[16] = { 0 }; + wchar_t *str = nullptr, value[16] = { 0 }; switch (dbv.type) { case DBVT_ASCIIZ: @@ -670,11 +670,11 @@ void EditLabel(int item, int subitem) GetClientRect(hwnd2List, &rclist); if (rc.top + height > rclist.bottom && rclist.bottom - rclist.top > height) rc.top = rc.bottom - height; - info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, 0, hInst, 0); + info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, nullptr, hInst, nullptr); mir_free(str); } else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) - info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0); + info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr); } db_free(&dbv); @@ -735,7 +735,7 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) case LVN_COLUMNCLICK: LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam; - ColumnsSortParams params = { 0 }; + ColumnsSortParams params = {}; params.hList = hwnd2List; params.column = lv->iSubItem; params.last = lastColumn; @@ -766,7 +766,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to RemoveMenu(hSubMenu, 0, MF_BYPOSITION); // separator } - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) { case MENU_ADD_BYTE: newSetting(info.hContact, info.module, DBVT_BYTE); return; @@ -869,7 +869,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to if (watchIdx >= 0) CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) { case MENU_EDIT_SET: editSetting(info.hContact, info.module, setting); break; diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index bddbc89b0d..0690d65b62 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -235,7 +235,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case DBVT_BYTE: case DBVT_WORD: case DBVT_DWORD: - res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, NULL, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type); + res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, nullptr, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type); break; case DBVT_ASCIIZ: case DBVT_UTF8: @@ -328,6 +328,6 @@ void newSetting(MCONTACT hContact, const char *module, int type) dbsetting->dbv.type = type; dbsetting->hContact = hContact; dbsetting->module = mir_strdup(module); - dbsetting->setting = NULL; + dbsetting->setting = nullptr; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting); } diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index e4a175d1ff..f438f3dba6 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -HWND hwnd2watchedVarsWindow = NULL; +HWND hwnd2watchedVarsWindow = nullptr; -static WatchListArrayStruct WatchListArray = {0}; +static WatchListArrayStruct WatchListArray = {}; static int lastColumn = -1; @@ -12,7 +12,7 @@ ColumnsSettings csWatchList[] = { { LPGENW("Setting"), 2, "Watch2width", 100 }, { LPGENW("Value"), 3, "Watch3width", 200 }, { LPGENW("Type"), 4, "Watch4width", 75 }, - {0} + {nullptr} }; @@ -47,7 +47,7 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set if (setting) WatchListArray.item[WatchListArray.count].setting = mir_strdup(setting); else - WatchListArray.item[WatchListArray.count].setting = 0; + WatchListArray.item[WatchListArray.count].setting = nullptr; WatchListArray.count++; return 1; @@ -61,12 +61,12 @@ void freeWatchListItem(int item) if (WatchListArray.item[item].module) mir_free(WatchListArray.item[item].module); - WatchListArray.item[item].module = 0; + WatchListArray.item[item].module = nullptr; if (WatchListArray.item[item].setting) mir_free(WatchListArray.item[item].setting); - WatchListArray.item[item].setting = 0; + WatchListArray.item[item].setting = nullptr; db_free(&(WatchListArray.item[item].dbv)); WatchListArray.item[item].hContact = 0; } @@ -111,7 +111,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) wchar_t data[32], tmp[16], name[NAME_SIZE]; - GetContactName(lParam->hContact, NULL, name, _countof(name)); + GetContactName(lParam->hContact, nullptr, name, _countof(name)); lvItem.pszText = name; int index = ListView_InsertItem(hwnd, &lvItem); @@ -197,7 +197,7 @@ void freeAllWatches() freeWatchListItem(i); } mir_free(WatchListArray.item); - WatchListArray.item = 0; + WatchListArray.item = nullptr; WatchListArray.count = 0; } @@ -274,7 +274,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case MENU_EXIT: case IDCANCEL: - hwnd2watchedVarsWindow = NULL; + hwnd2watchedVarsWindow = nullptr; DestroyWindow(hwnd); break; case MENU_REFRESH: @@ -331,7 +331,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS)); saveListSettings(GetDlgItem(hwnd, IDC_VARS), csWatchList); Utils_SaveWindowPosition(hwnd, NULL, modname, "Watch_"); - hwnd2watchedVarsWindow = NULL; + hwnd2watchedVarsWindow = nullptr; break; } return 0; @@ -340,7 +340,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openWatchedVarWindow() { if (!hwnd2watchedVarsWindow) - CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), NULL, WatchDlgProc); + CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), nullptr, WatchDlgProc); else SetForegroundWindow(hwnd2watchedVarsWindow); } @@ -353,7 +353,7 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) int timeout = db_get_b(NULL, modname, "PopupDelay", 3); wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE]; - GetContactName(hContact, NULL, name, _countof(name)); + GetContactName(hContact, nullptr, name, _countof(name)); // 2nd line int type = GetValue(hContact, module, setting, value, _countof(value)); diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 3438427ad8..7ae405fd26 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -10,8 +10,8 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: { wchar_t* ptszPath = (wchar_t*)PUGetPluginData(hWnd); - if (ptszPath != 0) - ShellExecute(0, L"open", ptszPath, NULL, NULL, SW_SHOW); + if (ptszPath != nullptr) + ShellExecute(nullptr, L"open", ptszPath, nullptr, nullptr, SW_SHOW); PUDeletePopup(hWnd); break; @@ -31,7 +31,7 @@ void ShowPopup(wchar_t* ptszText, wchar_t* ptszHeader, wchar_t* ptszPath) wcsncpy_s(ppd.lptzText, ptszText, _TRUNCATE); wcsncpy_s(ppd.lptzContactName, ptszHeader, _TRUNCATE); - if (ptszPath != NULL) + if (ptszPath != nullptr) ppd.PluginData = (void*)mir_wstrdup(ptszPath); ppd.PluginWindowProc = DlgProcPopup; ppd.lchIcon = IcoLib_GetIcon(iconList[0].szName); @@ -62,8 +62,8 @@ wchar_t* DoubleSlash(wchar_t *sorce) wchar_t *ret, *r, *s; ret = (wchar_t*)mir_alloc((MAX_PATH * sizeof(wchar_t))); - if (ret == NULL) - return NULL; + if (ret == nullptr) + return nullptr; for (s = sorce, r = ret; *s && (r - ret) < (MAX_PATH - 1); s++, r++) { if (*s != '\\') *r = *s; @@ -142,7 +142,7 @@ int Comp(const void *i, const void *j) int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) { - backupFile *bf = NULL, *bftmp; + backupFile *bf = nullptr, *bftmp; HANDLE hFind; wchar_t backupfolderTmp[MAX_PATH]; WIN32_FIND_DATA FindFileData; @@ -159,7 +159,7 @@ int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; bftmp = (backupFile*)mir_realloc(bf, ((i + 1) * sizeof(backupFile))); - if (bftmp == NULL) + if (bftmp == nullptr) goto err_out; bf = bftmp; wcsncpy_s(bf[i].Name, FindFileData.cFileName, _TRUNCATE); @@ -183,12 +183,12 @@ int Backup(wchar_t *backup_filename) { bool bZip = false; wchar_t dbname[MAX_PATH], source_file[MAX_PATH] = { 0 }, dest_file[MAX_PATH]; - HWND progress_dialog = NULL; + HWND progress_dialog = nullptr; SYSTEMTIME st; Profile_GetNameW(_countof(dbname), dbname); - if (backup_filename == NULL) { + if (backup_filename == nullptr) { int err; wchar_t *backupfolder, buffer[MAX_COMPUTERNAME_LENGTH + 1]; DWORD size = _countof(buffer); @@ -214,10 +214,10 @@ int Backup(wchar_t *backup_filename) bZip = true; } if (!options.disable_popups) - ShowPopup(dbname, TranslateT("Backup in progress"), NULL); + ShowPopup(dbname, TranslateT("Backup in progress"), nullptr); if (!options.disable_progress) - progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress); + progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file...")); @@ -235,15 +235,15 @@ int Backup(wchar_t *backup_filename) if (res) { if (!bZip) { // Set the backup file to the current time for rotator's correct work FILETIME ft; - HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); - SetFileTime(hFile, NULL, NULL, &ft); + SetFileTime(hFile, nullptr, nullptr, &ft); CloseHandle(hFile); } SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0); UpdateWindow(progress_dialog); - db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0)); + db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(nullptr)); if (options.use_dropbox) { @@ -294,15 +294,15 @@ void BackupThread(void *backup_filename) void BackupStart(wchar_t *backup_filename) { - wchar_t *tm = NULL; + wchar_t *tm = nullptr; LONG cur_state; cur_state = InterlockedCompareExchange(&m_state, 1, 0); if (cur_state != 0) { /* Backup allready in process. */ - ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), NULL); /* Show error message :) */ + ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), nullptr); /* Show error message :) */ return; } - if (backup_filename != NULL) + if (backup_filename != nullptr) tm = mir_wstrdup(backup_filename); if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) { InterlockedExchange(&m_state, 0); /* Backup done. */ @@ -312,19 +312,19 @@ void BackupStart(wchar_t *backup_filename) VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { - time_t t = time(NULL); + time_t t = time(nullptr); time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", 0); if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24))))) - BackupStart(NULL); + BackupStart(nullptr); } int SetBackupTimer(void) { if (timer_id != 0) { - KillTimer(0, timer_id); + KillTimer(nullptr, timer_id); timer_id = 0; } if (options.backup_types & BT_PERIODIC) - timer_id = SetTimer(0, 0, (1000 * 60), TimerProc); + timer_id = SetTimer(nullptr, 0, (1000 * 60), TimerProc); return 0; } diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index aad3eef30a..a0a2e37751 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -28,7 +28,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) static INT_PTR ABService(WPARAM, LPARAM) { - BackupStart(NULL); + BackupStart(nullptr); return 0; } @@ -90,7 +90,7 @@ static int ModulesLoad(WPARAM, LPARAM) options.use_dropbox = (BOOL)(db_get_b(0, "AutoBackups", "UseDropbox", 0) && ServiceExists(MS_DROPBOX_UPLOAD)); if (options.backup_types & BT_START) - BackupStart(NULL); + BackupStart(nullptr); return 0; } @@ -100,7 +100,7 @@ static int PreShutdown(WPARAM, LPARAM) { if (options.backup_types & BT_EXIT) { options.disable_popups = 1; // Don't try to show popups on exit - BackupStart(NULL); + BackupStart(nullptr); } return 0; } diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 575f39ab4b..068c2c5f89 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -8,11 +8,11 @@ Options options; HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) { HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, - TOOLTIPS_CLASS, NULL, + TOOLTIPS_CLASS, nullptr, (WS_POPUP | TTS_NOPREFIX), CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwndParent, NULL, g_hInstance, NULL); + hwndParent, nullptr, g_hInstance, nullptr); SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE)); @@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } if (hPathTip) - SetTimer(hwndDlg, 0, 3000, NULL); + SetTimer(hwndDlg, 0, 3000, nullptr); return TRUE; case WM_COMMAND: @@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { BROWSEINFO bi; bi.hwndOwner = hwndDlg; - bi.pidlRoot = 0; + bi.pidlRoot = nullptr; bi.pszDisplayName = folder_buff; bi.lpszTitle = TranslateT("Select backup folder"); bi.ulFlags = BIF_NEWDIALOGSTYLE; @@ -286,7 +286,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP bi.iImage = 0; LPCITEMIDLIST pidl = SHBrowseForFolder(&bi); - if (pidl != 0) { + if (pidl != nullptr) { SHGetPathFromIDList(pidl, folder_buff); SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff); @@ -298,7 +298,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; } case IDC_BUT_NOW: - BackupStart(NULL); + BackupStart(nullptr); break; case IDC_CHK_NOPROG: new_options.disable_progress = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPROG); @@ -362,8 +362,8 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int err = CreateDirectoryTreeW(backupfolder); if (err != ERROR_ALREADY_EXISTS && err != 0) { wchar_t msg_buff[512]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0); - MessageBox(0, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, 0, msg_buff, 512, nullptr); + MessageBox(nullptr, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR); folder_ok = FALSE; } @@ -386,7 +386,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (hPathTip) { KillTimer(hwndDlg, 0); DestroyWindow(hPathTip); - hPathTip = 0; + hPathTip = nullptr; } return FALSE; } diff --git a/plugins/Db_autobackups/src/zip.cpp b/plugins/Db_autobackups/src/zip.cpp index f3f37e187f..c4a2b145f1 100644 --- a/plugins/Db_autobackups/src/zip.cpp +++ b/plugins/Db_autobackups/src/zip.cpp @@ -3,7 +3,7 @@ int CreateZipFile(const char *szDestPath, OBJLIST &lstFiles, const std::function &fnCallback) { - zipFile hZip = zipOpen2_64(_A2T(szDestPath), APPEND_STATUS_CREATE, NULL, NULL); + zipFile hZip = zipOpen2_64(_A2T(szDestPath), APPEND_STATUS_CREATE, nullptr, nullptr); if (!hZip) return 1; zip_fileinfo fi = { 0 }; @@ -13,10 +13,10 @@ int CreateZipFile(const char *szDestPath, OBJLIST &lstFiles, const std: { ZipFile &zf = lstFiles[i]; - HANDLE hSrcFile = CreateFileA(zf.sPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hSrcFile = CreateFileA(zf.sPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hSrcFile != INVALID_HANDLE_VALUE) { - int iOpenRes = zipOpenNewFileInZip(hZip, zf.sZipPath.c_str(), &fi, NULL, 0, NULL, 0, "", Z_DEFLATED, Z_BEST_COMPRESSION); + int iOpenRes = zipOpenNewFileInZip(hZip, zf.sZipPath.c_str(), &fi, nullptr, 0, nullptr, 0, "", Z_DEFLATED, Z_BEST_COMPRESSION); if (iOpenRes == ZIP_OK) { diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 9bb8612e97..e19cd22b9c 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -160,7 +160,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param) GetAccessTokenRequest request(requestToken); NLHR_PTR response(request.Send(instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) { + if (response == nullptr || response->resultCode != HTTP_STATUS_OK) { Netlib_Logf(instance->hNetlibConnection, "%s: %s", MODULE, HttpStatusToText(HTTP_STATUS_ERROR)); if (hwndDlg) SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("server does not respond")); diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp index 4388374458..0d6c5e4391 100644 --- a/plugins/Dropbox/src/dropbox_commands.cpp +++ b/plugins/Dropbox/src/dropbox_commands.cpp @@ -35,7 +35,7 @@ void CDropbox::CommandList(void *arg) ListFolderRequest request(token, path); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) { + if (response == nullptr || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } @@ -81,7 +81,7 @@ void CDropbox::CommandShare(void *arg) GetTemporaryLinkRequest request(token, path); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) { + if (response == nullptr || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } @@ -102,7 +102,7 @@ void CDropbox::CommandSearch(void *arg) CommandParam *param = (CommandParam*)arg; char *query = (char*)param->data; - if (query == NULL) { + if (query == nullptr) { CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/search"); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); ProtoChainSend(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer()); @@ -114,7 +114,7 @@ void CDropbox::CommandSearch(void *arg) SearchRequest request(token, query); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) { + if (response == nullptr || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp index b4b8574344..33cc167117 100644 --- a/plugins/Dropbox/src/dropbox_icons.cpp +++ b/plugins/Dropbox/src/dropbox_icons.cpp @@ -17,7 +17,7 @@ HANDLE GetIconHandleByName(const char *name) if (mir_strcmpi(iconList[i].szName, name) == 0) return iconList[i].hIcolib; - return NULL; + return nullptr; } HICON LoadIconEx(int iconId, bool big) @@ -26,5 +26,5 @@ HICON LoadIconEx(int iconId, bool big) if (iconList[i].defIconID == iconId) return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); - return NULL; + return nullptr; } diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index c4949ee421..1a96848edd 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -35,7 +35,7 @@ int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool bShow = false; char *proto = GetContactProto(hContact); - if (proto != NULL) { + if (proto != nullptr) { bool bHasIM = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) != 0; if (bHasIM && HasAccessToken() && hContact != GetDefaultContact() && !IsAccountIntercepted(proto)) { bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE; diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp index a4fe771dad..65722da497 100644 --- a/plugins/Dropbox/src/dropbox_options.cpp +++ b/plugins/Dropbox/src/dropbox_options.cpp @@ -47,7 +47,7 @@ void CDropboxOptionsMain::RequestCode_OnChange(CCtrlBase*) void CDropboxOptionsMain::Authorize_OnClick(CCtrlBase*) { - mir_forkthreadowner(CDropbox::RequestAccessTokenAsync, m_instance, m_hwnd, 0); + mir_forkthreadowner(CDropbox::RequestAccessTokenAsync, m_instance, m_hwnd, nullptr); } ///////////////////////////////////////////////////////////////////////////////// @@ -71,7 +71,7 @@ void CDropboxOptionsInterception::OnInitDialog() PROTOACCOUNT** accounts; Proto_EnumAccounts(&count, &accounts); const char *interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedAccounts"); - if (interceptedAccounts == NULL) + if (interceptedAccounts == nullptr) interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedProtos"); for (int i = 0; i < count; i++) { PROTOACCOUNT *acc = accounts[i]; diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index d15c691cc2..5457883d60 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -39,7 +39,7 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM, LPARAM lParam) CCSDATA *pccsd = (CCSDATA*)lParam; if (!HasAccessToken()) { - ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send files when you are not authorized."); + ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send files when you are not authorized."); return 0; } @@ -59,7 +59,7 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM, LPARAM lParam) transfers.insert(ftp); - mir_forkthreadowner(CDropbox::UploadAndReportProgress, this, ftp, 0); + mir_forkthreadowner(CDropbox::UploadAndReportProgress, this, ftp, nullptr); return ftp->GetId(); } @@ -89,7 +89,7 @@ INT_PTR CDropbox::ProtoCancelFile(WPARAM, LPARAM lParam) HANDLE hTransfer = (HANDLE)pccsd->wParam; FileTransferParam *ftp = transfers.find((FileTransferParam*)&hTransfer); - if (ftp == NULL) + if (ftp == nullptr) return 0; ftp->Terminate(); @@ -102,7 +102,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam) CCSDATA *pccsd = (CCSDATA*)lParam; if (!HasAccessToken()) { - ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send messages when you are not authorized."); + ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send messages when you are not authorized."); return 0; } @@ -144,7 +144,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam) } } - ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, 0, 0); + ProtoBroadcastAck(MODULE, pccsd->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, nullptr, 0); char help[1024]; mir_snprintf(help, Translate("\"%s\" is not valid.\nUse \"/help\" for more info."), szMessage); ProtoChainSend(GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help); @@ -160,7 +160,7 @@ INT_PTR CDropbox::ProtoReceiveMessage(WPARAM, LPARAM lParam) DBEVENTINFO dbei = {}; dbei.flags = DBEF_UTF; dbei.szModule = MODULE; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (int)mir_strlen(message); dbei.pBlob = (PBYTE)mir_strdup(message); @@ -221,7 +221,7 @@ INT_PTR CDropbox::UploadToDropboxAsync(WPARAM, LPARAM lParam) else ftp->AddFile(uploadInfo->localPath); - mir_forkthreadowner(CDropbox::UploadAndRaiseEvent, this, ftp, 0); + mir_forkthreadowner(CDropbox::UploadAndRaiseEvent, this, ftp, nullptr); return ftp->GetId(); } \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index 6278f2e5fb..177d5768bb 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -203,7 +203,7 @@ UINT CDropbox::UploadAndRaiseEvent(void *owner, void *arg) int res = UploadToDropbox(owner, arg); - DropboxUploadResult ur = { 0 }; + DropboxUploadResult ur = {}; ur.hProcess = (HANDLE)ftp->GetId(); ur.status = res; ur.data = T2Utf(ftp->GetData()); diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index 39b76a9f2e..a4e5d51747 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -2,7 +2,7 @@ char* CDropbox::PreparePath(const char *oldPath, char *newPath) { - if (oldPath == NULL) + if (oldPath == nullptr) mir_strcpy(newPath, ""); else if (*oldPath != '/') { @@ -24,7 +24,7 @@ char* CDropbox::PreparePath(const wchar_t *oldPath, char *newPath) bool CDropbox::IsAccountIntercepted(const char *module) { const char *interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedAccounts"); - if (interceptedAccounts == NULL) + if (interceptedAccounts == nullptr) interceptedAccounts = db_get_sa(NULL, MODULE, "InterceptedProtos"); return interceptedAccounts && strstr(interceptedAccounts, module); } @@ -59,7 +59,7 @@ char* CDropbox::HttpStatusToText(HTTP_STATUS status) void CDropbox::HandleHttpResponse(NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) throw DropboxException(HttpStatusToText(HTTP_STATUS_ERROR)); } @@ -91,7 +91,7 @@ MEVENT CDropbox::AddEventToDb(MCONTACT hContact, WORD type, DWORD flags, DWORD c { DBEVENTINFO dbei = {}; dbei.szModule = MODULE; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.eventType = type; dbei.cbBlob = cbBlob; dbei.pBlob = pBlob; @@ -126,7 +126,7 @@ void CDropbox::PasteToInputArea(MCONTACT hContact, const wchar_t *data) void CDropbox::PasteToClipboard(const wchar_t *data) { - if (OpenClipboard(NULL)) { + if (OpenClipboard(nullptr)) { EmptyClipboard(); size_t size = sizeof(wchar_t) * (mir_wstrlen(data) + 1); diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index a60992410f..acf53d85cf 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -46,9 +46,9 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code HRESULT hr = NOERROR; HRESULT hrT = NOERROR; SCODE sc = 0; - LPMAPITABLE lpTable = NULL; - LPSRowSet lpRows = NULL; - LPENTRYID lpeid = NULL; + LPMAPITABLE lpTable = nullptr; + LPSRowSet lpRows = nullptr; + LPENTRYID lpeid = nullptr; ULONG cbeid = 0; ULONG cRows = 0; ULONG i = 0; @@ -68,12 +68,12 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code if (FAILED(hrT)) goto err_out; // Go to the beginning of the recipient table for the envelope - hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, NULL); + hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, nullptr); if (FAILED(hrT)) goto err_out; // Read all the rows of the table hrT = MAPICALL(lpTable)->QueryRows( cRows, 0, &lpRows); - if (SUCCEEDED(hrT) && lpRows != NULL && lpRows->cRows == 0) { + if (SUCCEEDED(hrT) && lpRows != nullptr && lpRows->cRows == 0) { hrT = MAPI_E_NOT_FOUND; goto err_out; } @@ -87,7 +87,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code sc = MAPIAllocateBuffer(cbeid, (void **)&lpeid); if (FAILED(sc)) { cbeid = 0; - lpeid = NULL; + lpeid = nullptr; } else { // Copy entry ID of message store memcpy(lpeid, lpRows->aRow[i].lpProps[1].Value.bin.lpb, cbeid); @@ -96,7 +96,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code } err_out: - if (lpRows != NULL) + if (lpRows != nullptr) FreeProws(lpRows); UlRelease(lpTable); *lpcbeid = cbeid; @@ -108,28 +108,28 @@ err_out: CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) { - m_szSender = NULL ; - m_szSubject = NULL ; - m_szEntryID = NULL ; + m_szSender = nullptr ; + m_szSubject = nullptr ; + m_szEntryID = nullptr ; m_nSizeSender = 0 ; m_nSizeSubject = 0 ; m_nSizeEntryID = 0 ; - if (NULL != szSender) { + if (nullptr != szSender) { m_nSizeSender = (UINT)mir_wstrlen(szSender)+1; m_szSender = new wchar_t[ m_nSizeSender ]; memset(m_szSender, 0, m_nSizeSender * sizeof(wchar_t)); mir_wstrcpy(m_szSender, szSender); } - if (NULL != szSubject) { + if (nullptr != szSubject) { m_nSizeSubject = (UINT)mir_wstrlen(szSubject) +1; m_szSubject = new wchar_t[m_nSizeSubject]; memset(m_szSubject, 0, m_nSizeSubject * sizeof(wchar_t)); mir_wstrcpy(m_szSubject, szSubject); } - if (NULL != szEntryID) { + if (nullptr != szEntryID) { m_nSizeEntryID = (UINT)mir_strlen( szEntryID ) +1; m_szEntryID = new char[m_nSizeEntryID]; memset(m_szEntryID, 0, m_nSizeEntryID * sizeof(char)); @@ -139,36 +139,36 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) CKeeper::~CKeeper() { - if ( m_nSizeSender>0 && NULL != m_szSender ) + if ( m_nSizeSender>0 && nullptr != m_szSender ) { m_nSizeSender =0; delete[] m_szSender; - m_szSender = NULL; + m_szSender = nullptr; } - if ( m_nSizeSubject>0 && NULL != m_szSubject ) + if ( m_nSizeSubject>0 && nullptr != m_szSubject ) { m_nSizeSubject =0; delete[] m_szSubject; - m_szSubject = NULL; + m_szSubject = nullptr; } - if ( m_nSizeEntryID>0 && NULL != m_szEntryID ) + if ( m_nSizeEntryID>0 && nullptr != m_szEntryID ) { m_nSizeEntryID = 0; delete[] m_szEntryID; - m_szEntryID = NULL; + m_szEntryID = nullptr; } } CMirandaExchange::CMirandaExchange() { - m_szUsername = NULL ; - m_szPassword = NULL ; - m_szExchangeServer = NULL ; - m_lpMAPISession = NULL ; - m_lpInbox = NULL ; - m_lpMDB = NULL; + m_szUsername = nullptr ; + m_szPassword = nullptr ; + m_szExchangeServer = nullptr ; + m_lpMAPISession = nullptr ; + m_lpInbox = nullptr ; + m_lpMDB = nullptr; m_bLoginOK = false ; m_bFolderInboxOK = false ; m_nNumberOfHeaders = 0 ; @@ -176,51 +176,51 @@ CMirandaExchange::CMirandaExchange() CMirandaExchange::~CMirandaExchange() { - if ( NULL != m_szUsername ) + if ( nullptr != m_szUsername ) { delete[] m_szUsername; - m_szUsername = NULL; + m_szUsername = nullptr; } - if ( NULL != m_szPassword ) + if ( nullptr != m_szPassword ) { delete[] m_szPassword; - m_szPassword = NULL; + m_szPassword = nullptr; } - if ( NULL != m_szExchangeServer ) + if ( nullptr != m_szExchangeServer ) { delete[] m_szExchangeServer; - m_szExchangeServer = NULL; + m_szExchangeServer = nullptr; } - if ( NULL != m_lpInbox ) + if ( nullptr != m_lpInbox ) { UlRelease(m_lpInbox); - m_lpInbox = NULL; + m_lpInbox = nullptr; } - if ( NULL != m_lpMDB ) + if ( nullptr != m_lpMDB ) { UlRelease(m_lpMDB ); - m_lpMDB = NULL; + m_lpMDB = nullptr; } - if ( NULL!= m_lpMAPISession ) + if ( nullptr!= m_lpMAPISession ) { m_lpMAPISession->Logoff(NULL,NULL,NULL); UlRelease(m_lpMAPISession ); - m_lpMAPISession = NULL; + m_lpMAPISession = nullptr; } if ( m_nNumberOfHeaders>0) { for( UINT i=0; iOpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulFlags, &ulObjType, &lpUnk); @@ -261,11 +261,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, { hRes = S_OK; if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; (lpMDB->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulNoCacheFlags, &ulObjType, &lpUnk)); @@ -273,7 +273,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes)) { if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; } } if (lpAB && !lpUnk) @@ -283,7 +283,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpAB->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulFlags, &ulObjType, &lpUnk)); @@ -291,11 +291,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, { hRes = S_OK; if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; (lpAB->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulNoCacheFlags, &ulObjType, &lpUnk)); @@ -303,7 +303,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes)) { if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; } } @@ -314,7 +314,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpContainer->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulFlags, &ulObjType, &lpUnk)); @@ -322,11 +322,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, { hRes = S_OK; if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; (lpContainer->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulNoCacheFlags, &ulObjType, &lpUnk)); @@ -334,7 +334,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes)) { if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; } } @@ -345,7 +345,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpMAPISession->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulFlags, &ulObjType, &lpUnk)); @@ -353,11 +353,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, { hRes = S_OK; if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; (lpMAPISession->OpenEntry( cbEntryID, lpEntryID, - NULL,//no interface + nullptr,//no interface ulNoCacheFlags, &ulObjType, &lpUnk)); @@ -365,7 +365,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes)) { if (lpUnk) (lpUnk)->Release(); - lpUnk = NULL; + lpUnk = nullptr; } } @@ -382,7 +382,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, LPSBinary lpSBinary, ULONG ulFlags, ULONG* ulObjTypeRet, LPUNKNOWN* lppUnk) { return CallOpenEntry( lpMDB, lpAB, lpContainer, lpMAPISession, lpSBinary?lpSBinary->cb:0, - (LPENTRYID)(lpSBinary?lpSBinary->lpb:0), ulFlags, ulObjTypeRet, lppUnk); + (LPENTRYID)(lpSBinary?lpSBinary->lpb:nullptr), ulFlags, ulObjTypeRet, lppUnk); } HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPassword, LPCTSTR szExchangeServer ) @@ -391,7 +391,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass UINT nSize = 0; short nSizeOfTCHAR = sizeof( wchar_t ); - if (m_szUsername == NULL && NULL != szUsername) { + if (m_szUsername == nullptr && nullptr != szUsername) { nSize = (UINT)mir_wstrlen(szUsername); if (nSize > 0) { nSize++; @@ -401,7 +401,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass } } - if (m_szPassword == NULL && NULL != szPassword) { + if (m_szPassword == nullptr && nullptr != szPassword) { nSize = (UINT)mir_wstrlen(szPassword); if (nSize > 0) { nSize++; @@ -411,7 +411,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass } } - if (m_szExchangeServer == NULL && NULL != szExchangeServer) { + if (m_szExchangeServer == nullptr && nullptr != szExchangeServer) { nSize = (UINT)mir_wstrlen(szExchangeServer); if (nSize > 0) { nSize++; @@ -421,7 +421,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass } } - if (!m_bLoginOK || m_lpInbox || NULL == m_lpMAPISession) { + if (!m_bLoginOK || m_lpInbox || nullptr == m_lpMAPISession) { HRESULT hr = S_OK; MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION , MAPI_MULTITHREAD_NOTIFICATIONS }; @@ -453,10 +453,10 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr; } - LPPROFADMIN pProfAdmin = NULL; + LPPROFADMIN pProfAdmin = nullptr; hr = MAPIAdminProfiles( 0, &pProfAdmin ); - if ((FAILED(hr)) || (NULL == pProfAdmin)) + if ((FAILED(hr)) || (nullptr == pProfAdmin)) { //Log("Admin profile interface creation failed: 0x%08X", hr); } @@ -479,21 +479,21 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr; // Open default message store - LPMDB pDefMsgStore = NULL; - hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, NULL, + LPMDB pDefMsgStore = nullptr; + hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, nullptr, MAPI_BEST_ACCESS, &pDefMsgStore); HRESULT hRes = S_OK; ULONG cbInboxEID = NULL; CMAPIBuffer< LPENTRYID> lpInboxEID = NULL; - if (NULL == pDefMsgStore ) + if (nullptr == pDefMsgStore ) return hr; - hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, NULL); + hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, nullptr); m_lpMDB = pDefMsgStore; if (cbInboxEID && lpInboxEID) { - hRes = CallOpenEntry( pDefMsgStore, NULL, NULL, NULL, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&m_lpInbox); + hRes = CallOpenEntry( pDefMsgStore, nullptr, nullptr, nullptr, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&m_lpInbox); if ( m_lpInbox && hRes == S_OK) m_bFolderInboxOK = true; @@ -510,7 +510,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) CMAPIInterface pProfAdmin = NULL; CMAPIInterface pMsgSvcAdmin = NULL; CMAPIInterface pMsgSvcTable = NULL; - LPSRowSet pRows = NULL; + LPSRowSet pRows = nullptr; ULONG ulFlags = 0; SRestriction sres; SIZE_T nSize; @@ -525,24 +525,24 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) }; ulFlags &= ~MAPI_UNICODE; hr = MAPIAdminProfiles(ulFlags, &pProfAdmin); - if (FAILED(hr) || pProfAdmin == NULL) + if (FAILED(hr) || pProfAdmin == nullptr) return hr; - hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags); + hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags); if (FAILED(hr)) { pProfAdmin->DeleteProfile((LPTSTR)mir_u2a(szProfileName), ulFlags); return hr; } - hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags, &pMsgSvcAdmin); + hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags, &pMsgSvcAdmin); - if (FAILED(hr) || pMsgSvcAdmin == NULL) + if (FAILED(hr) || pMsgSvcAdmin == nullptr) return hr; hr = pMsgSvcAdmin->CreateMsgService((LPTSTR)("MSEMS"), (LPTSTR)("")/*"Microsoft Exchange Server"*/, NULL, 0); if (FAILED(hr)) return hr; hr = pMsgSvcAdmin->GetMsgServiceTable(0, &pMsgSvcTable); - if (FAILED(hr) || pMsgSvcTable == NULL) + if (FAILED(hr) || pMsgSvcTable == nullptr) return hr; sres.rt = RES_CONTENT; @@ -556,7 +556,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) hr = HrQueryAllRows(pMsgSvcTable, (LPSPropTagArray) &sptCols, &sres, - NULL, + nullptr, 0, &pRows); @@ -564,7 +564,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) return hr; nSize = mir_wstrlen(m_szUsername); szUniqName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (nSize + 4)); - if (szUniqName != NULL) { + if (szUniqName != nullptr) { memcpy(szUniqName, L"=", sizeof(wchar_t)); memcpy((szUniqName + 1), m_szUsername, (sizeof(wchar_t) * (nSize + 1))); // Set values for PR_PROFILE_UNRESOLVED_NAME and PR_PROFILE_UNRESOLVED_SERVER @@ -593,14 +593,14 @@ HRESULT CMirandaExchange::isMapiSessionOK( LPMAPISESSION ) HRESULT CMirandaExchange::CheckForNewMails( int &nNewMails) { - if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper ) + if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper ) { for( UINT i=0; iLogoff( NULL, NULL, NULL ); m_lpMAPISession->Release(); - m_lpMAPISession = NULL; + m_lpMAPISession = nullptr; } - if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper ) + if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper ) { for( UINT i=0; iSetReadFlag( 0 ); lpMessage->SaveChanges(FORCE_SAVE); lpMessage->Release(); - lpMessage = NULL; + lpMessage = nullptr; } return 0; @@ -713,14 +713,14 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) { HRESULT hr = NOERROR; CMAPIInterface lpTable = NULL; - LPSRowSet lpRow = NULL; - LPSPropValue lpRowProp = NULL; + LPSRowSet lpRow = nullptr; + LPSPropValue lpRowProp = nullptr; ULONG i = 0L; - wchar_t* szSenderName = NULL; - wchar_t* szSubject = NULL; - LPSTR szEntryID = NULL; + wchar_t* szSenderName = nullptr; + wchar_t* szSubject = nullptr; + LPSTR szEntryID = nullptr; - if ( lpFolder == NULL || !m_bFolderInboxOK ) + if ( lpFolder == nullptr || !m_bFolderInboxOK ) return hr; SizedSPropTagArray(5,sptaDETAILS) = @@ -743,7 +743,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) return -1; } - LPSRowSet lpRowsR = NULL; + LPSRowSet lpRowsR = nullptr; ////////////////////////////////////////////////////////////////////////// SRestriction srRoot; @@ -771,7 +771,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) szSenderName = lpRowsR->aRow[i].lpProps[2].Value.lpszW; } - if ( NULL == szSenderName) + if ( nullptr == szSenderName) { if ( !FAILED(lpRowsR->aRow[i].lpProps[3].Value.err)) { @@ -791,9 +791,9 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) delete[] szEntryID; - szEntryID = NULL; - szSubject = NULL; - szSenderName = NULL; + szEntryID = nullptr; + szSubject = nullptr; + szSenderName = nullptr; } } FreeProws(lpRowsR); @@ -815,12 +815,12 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) hr = MAPICALL( lpFolder)->GetHierarchyTable( MAPI_DEFERRED_ERRORS, &lpTable); if (!FAILED(hr)) { - hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, NULL, NULL, 0L, &lpRow); + hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, nullptr, nullptr, 0L, &lpRow); if (!FAILED(hr)) { for(i = 0; i < lpRow->cRows; i ++) { lpRowProp = lpRow->aRow[i].lpProps; CMAPIInterface lpSubFolder = NULL; - hr = CallOpenEntry( m_lpMDB, NULL, NULL, NULL, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpSubFolder ); + hr = CallOpenEntry( m_lpMDB, nullptr, nullptr, nullptr, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&lpSubFolder ); if ( !FAILED(hr) ) { hr = CheckInFolder( lpSubFolder ); @@ -828,7 +828,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) } } FreeProws(lpRow); - lpRow = NULL; + lpRow = nullptr; } } } @@ -853,7 +853,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) &hTheKey) == ERROR_SUCCESS ) { - LONG lResult = RegQueryValueEx( hTheKey, NULL, NULL, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength); + LONG lResult = RegQueryValueEx( hTheKey, nullptr, nullptr, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength); RegCloseKey( hTheKey ); if ( lResult != ERROR_SUCCESS ) @@ -865,7 +865,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) wchar_t* szTheEnd = wcsstr( szRegValue,L".EXE" ); - if ( NULL != szTheEnd ) + if ( nullptr != szTheEnd ) { szRegValue[ mir_wstrlen(szRegValue) - mir_wstrlen(szTheEnd) +5 ] = '\0'; mir_wstrcat( szRegValue, L" /recycle" ); @@ -878,14 +878,14 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOWNORMAL; - if ( CreateProcess ( NULL, + if ( CreateProcess ( nullptr, szRegValue, - NULL, - NULL, + nullptr, + nullptr, 0, NORMAL_PRIORITY_CLASS, - NULL, - NULL, + nullptr, + nullptr, &si, &pi )) diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 6a4d7cc15e..5bb8fab5e5 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -121,17 +121,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara db_set_ws(NULL, ModuleName, "Server", buffer); GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer)); - db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, NULL, FALSE)); + db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE)); - db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, NULL, FALSE)); - db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, NULL, FALSE)); + db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE)); + db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE)); db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT)); db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS)); db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK)); - db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, NULL, FALSE)); + db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE)); exchangeServer.Reconnect(); //login info may be changed UpdateTimers(); //interval might get changed @@ -148,7 +148,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors) { - if (NULL == window) /* Wine fix. */ + if (nullptr == window) /* Wine fix. */ return; RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors); hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER); @@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam return TRUE; case WM_DESTROY: - hEmailsDlg = NULL; + hEmailsDlg = nullptr; break; case WM_CLOSE: diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 51fdb00455..840885e687 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -134,7 +134,7 @@ void InitSocketAddr(sockaddr_in *addrServer, char *szServer) hostent *hp; hp = gethostbyname(szServer); addrServer->sin_family = AF_INET; - if (hp == NULL) + if (hp == nullptr) addrServer->sin_addr.s_addr = inet_addr(szServer); else memcpy(&(addrServer->sin_addr), hp->h_addr, hp->h_length); @@ -204,14 +204,14 @@ int CExchangeServer::GetEmailHeader(int iUnreadEmail, TEmailHeader *emailInfo) #ifndef NO_EXCHANGE_TEST - if (NULL != m_HeadersKeeper[iUnreadEmail]) { + if (nullptr != m_HeadersKeeper[iUnreadEmail]) { wchar_t* szSender = m_HeadersKeeper[iUnreadEmail]->m_szSender; wchar_t* szSubject = m_HeadersKeeper[iUnreadEmail]->m_szSubject; - if (NULL == szSender) + if (nullptr == szSender) szSender = L""; - if (NULL == szSubject) + if (nullptr == szSubject) szSubject = L""; emailInfo->szSender = szSender; @@ -317,7 +317,7 @@ int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails) int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails) { - if (MessageBox(0, message, title, MB_YESNO) == IDYES) + if (MessageBox(nullptr, message, title, MB_YESNO) == IDYES) ShowEmailsWindow(cUnreadEmails); return 0; } @@ -326,7 +326,7 @@ int ShowEmailsWindow(int cUnreadEmails) { if (cUnreadEmails > 0) { //show window only if there are unread emails if (!hEmailsDlg) - hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); + hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), nullptr, DlgProcEmails); SetWindowLongPtr(hEmailsDlg, GWLP_USERDATA, cUnreadEmails); if (IsWindowVisible(hEmailsDlg)) diff --git a/plugins/Exchange/src/exchange.cpp b/plugins/Exchange/src/exchange.cpp index d2597ae298..8805bf42e5 100644 --- a/plugins/Exchange/src/exchange.cpp +++ b/plugins/Exchange/src/exchange.cpp @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "ExchangeNotify"; HINSTANCE hInstance; -HICON hiMailIcon = NULL; -HWND hEmailsDlg = NULL; +HICON hiMailIcon = nullptr; +HWND hEmailsDlg = nullptr; int hLangpack=0; CExchangeServer exchangeServer; diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 5f1b31b62a..fdb239a046 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -69,7 +69,7 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.name.w = LPGENW("Check exchange mailbox"); Menu_AddMainMenuItem(&mi); - hEmailsDlg = NULL; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window + hEmailsDlg = nullptr; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window FirstTimeCheck(); // CheckEmail(); return 0; @@ -104,7 +104,7 @@ int OnSystemPreShutdown(WPARAM, LPARAM) void FirstTimeCheck() { - hFirstCheckTimer = SetTimer(NULL, 0, 5 * 1000, OnFirstCheckTimer); + hFirstCheckTimer = SetTimer(nullptr, 0, 5 * 1000, OnFirstCheckTimer); } int UpdateTimers() @@ -113,14 +113,14 @@ int UpdateTimers() int interval; interval = db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL); interval *= 1000; //go from miliseconds to seconds - hCheckTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnCheckTimer); + hCheckTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnCheckTimer); int bReconnect = db_get_b(NULL, ModuleName, "Reconnect", 0); if (bReconnect) //user wants to forcefully reconnect every x minutes { interval = db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL); interval *= 1000 * 60; //go from miliseconds to seconds to minutes - hReconnectTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnReconnectTimer); + hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer); } return 0; @@ -130,12 +130,12 @@ int KillTimers() { if (hCheckTimer) { - KillTimer(NULL, hCheckTimer); + KillTimer(nullptr, hCheckTimer); hCheckTimer = NULL; } if (hReconnectTimer) { - KillTimer(NULL, hReconnectTimer); + KillTimer(nullptr, hReconnectTimer); hReconnectTimer = NULL; } return 0; @@ -168,7 +168,7 @@ VOID CALLBACK OnReconnectTimer(HWND, UINT, UINT_PTR, DWORD) VOID CALLBACK OnFirstCheckTimer(HWND hWnd, UINT msg, UINT_PTR idEvent, DWORD dwTime) { - KillTimer(NULL, hFirstCheckTimer); + KillTimer(nullptr, hFirstCheckTimer); OnCheckTimer(hWnd, msg, idEvent, dwTime); hFirstCheckTimer = NULL; diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 97fc4cca13..6f9fd24ae9 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -77,14 +77,14 @@ int Info(char *title, char *format, ...) str[tBytes] = 0; va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); + return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } #define HEX_SIZE 8 char *BinToHex(int size, PBYTE data) { - char *szresult = NULL; + char *szresult = nullptr; int maxSize = size * 2 + HEX_SIZE + 1; szresult = (char *) new char[maxSize]; mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size); diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index 625f0a023a..d592c7c450 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -59,7 +59,7 @@ DBEntry *DBEntry::getNext(DBEntry *entry) } delete entry; - return NULL; + return nullptr; } void DBEntry::cleanupDB() @@ -67,7 +67,7 @@ void DBEntry::cleanupDB() int count = 0; DBEntry *entry = getFirst(); - while (entry != NULL) { + while (entry != nullptr) { DB::setByteF(0, MODULE_FILES, "Ftp%d", count, entry->m_iFtpNum); DB::setAStringF(0, MODULE_FILES, "Filename%d", count, entry->m_szFileName); if (entry->m_deleteTS != 0) @@ -96,7 +96,7 @@ DBEntry* DBEntry::get(int fileID) } } - return NULL; + return nullptr; } void DBEntry::remove(int fileID) @@ -111,7 +111,7 @@ bool DBEntry::entryExists(GenericJob *job) mir_cslock lock(mutexDB); DBEntry *entry = getFirst(); - while (entry != NULL) { + while (entry != nullptr) { if (entry->m_iFtpNum == job->m_iFtpNum && !strcmp(entry->m_szFileName, job->m_szSafeFileName)) return true; @@ -132,7 +132,7 @@ void DBEntry::add(GenericJob *job) DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName); if (job->m_tab->m_iOptAutoDelete != -1) { - time_t deleteTS = time(NULL); + time_t deleteTS = time(nullptr); deleteTS += (job->m_tab->m_iOptAutoDelete * 60); DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS); } @@ -144,7 +144,7 @@ void DBEntry::add(GenericJob *job) void DBEntry::setDeleteTS(GenericJob *job) { if (job->m_tab->m_iOptAutoDelete != -1) { - time_t deleteTS = time(NULL); + time_t deleteTS = time(nullptr); deleteTS += (job->m_tab->m_iOptAutoDelete * 60); DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS); } diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp index 624d483553..fe642e8a83 100644 --- a/plugins/FTPFileYM/src/deletetimer.cpp +++ b/plugins/FTPFileYM/src/deletetimer.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . #include "stdafx.h" -DeleteTimer *DeleteTimer::instance = NULL; +DeleteTimer *DeleteTimer::instance = nullptr; DeleteTimer &deleteTimer = DeleteTimer::getInstance(); extern Options &opt; @@ -39,13 +39,13 @@ void DeleteTimer::deinit() void DeleteTimer::start() { if (!timerId) - timerId = SetTimer(NULL, 0, 1000 * 60 * 5, (TIMERPROC)AutoDeleteTimerProc); + timerId = SetTimer(nullptr, 0, 1000 * 60 * 5, (TIMERPROC)AutoDeleteTimerProc); } void DeleteTimer::stop() { if (timerId) { - KillTimer(NULL, timerId); + KillTimer(nullptr, timerId); timerId = 0; } } @@ -55,9 +55,9 @@ void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_cslock lock(DBEntry::mutexDB); DBEntry *entry = DBEntry::getFirst(); - while (entry != NULL) { - if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(NULL)) { - DeleteJob *job = new DeleteJob(new DBEntry(entry), NULL); + while (entry != nullptr) { + if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(nullptr)) { + DeleteJob *job = new DeleteJob(new DBEntry(entry), nullptr); job->start(); } diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 9fbc7b8b57..2096f0bb60 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -18,8 +18,8 @@ along with this program. If not, see . #include "stdafx.h" -UploadDialog *UploadDialog::instance = NULL; -UploadDialog *uDlg = NULL; +UploadDialog *UploadDialog::instance = nullptr; +UploadDialog *uDlg = nullptr; mir_cs UploadDialog::mutexTabs; @@ -27,7 +27,7 @@ extern Options &opt; UploadDialog::UploadDialog() { - m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_UPLOAD), 0, UploadDlgProc); + m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_UPLOAD), nullptr, UploadDlgProc); m_hwndTabs = GetDlgItem(m_hwnd, IDC_TAB); EnableThemeDialogTexture(m_hwnd, ETDT_ENABLETAB); @@ -40,7 +40,7 @@ UploadDialog::UploadDialog() GetWindowRect(m_hwnd, &rc); rc.left = mi.rcWork.left + ((mi.rcWork.right - mi.rcWork.left) - (rc.right - rc.left)) / 2; rc.top = mi.rcWork.top + ((mi.rcWork.bottom - mi.rcWork.top) - (rc.bottom - rc.top)) / 2; - SetWindowPos(m_hwnd, 0, rc.left, rc.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(m_hwnd, nullptr, rc.left, rc.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE); } UploadDialog::~UploadDialog() @@ -50,8 +50,8 @@ UploadDialog::~UploadDialog() SendMessage(m_hwnd, WMU_DESTROY, 0, 0); } - instance = NULL; - uDlg = NULL; + instance = nullptr; + uDlg = nullptr; } void UploadDialog::selectTab(int index) @@ -125,7 +125,7 @@ void UploadDialog::Tab::select() uDlg->m_activeTab = index(); } m_job->refreshTab(true); - InvalidateRect(uDlg->m_hwnd, NULL, TRUE); + InvalidateRect(uDlg->m_hwnd, nullptr, TRUE); } void UploadDialog::Tab::labelCompleted() @@ -239,7 +239,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar RECT rc; GetWindowRect((HWND)lParam, &rc); HMENU hMenu = Menu_BuildContactMenu(hContact); - TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr); DestroyMenu(hMenu); } break; @@ -255,7 +255,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_BTN_DOWNLOAD: job = (UploadJob*)uDlg->m_tabs[uDlg->m_activeTab]->m_job; - ShellExecuteA(NULL, "open", job->m_szFileLink, NULL, NULL, SW_SHOWNORMAL); + ShellExecuteA(nullptr, "open", job->m_szFileLink, nullptr, nullptr, SW_SHOWNORMAL); return TRUE; case IDC_BTN_FILEMANAGER: @@ -290,7 +290,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar for (int i = 0; i < _countof(times); i++) { if (i == 3 || i == 7) - AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0); + AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr); if (i < 3) mir_snwprintf(buff, TranslateT("%d minutes"), times[i]); @@ -315,11 +315,11 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break; } - AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0); + AppendMenu(hTimeMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hTimeMenu, MF_STRING | bChecked ? MF_UNCHECKED : MF_CHECKED, IDM_CUSTOM, buff); } - int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, NULL); + int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, uDlg->m_hwndTabs, nullptr); switch (command) { case IDM_CLOSEDLG: tab->m_bOptCloseDlg = !tab->m_bOptCloseDlg; break; diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 9c42b738db..bc4d4dc996 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -113,7 +113,7 @@ void InitMenuItems() if (DB::getStringF(0, MODULE, "Name%d", i, stzName)) mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1); - mi.root = (opt.bUseSubmenu) ? hMenu : 0; + mi.root = (opt.bUseSubmenu) ? hMenu : nullptr; mi.hIcolibItem = iconList[i].hIcolib; hSubMenu[i] = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hSubMenu[i], MCI_OPT_EXECPARAM, i + 1000); @@ -248,7 +248,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) RECT rc; GetWindowRect(hwndBtn, &rc); SetForegroundWindow(cbc->hwndFrom); - int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0); + int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, nullptr); if (selected != 0) { int ftpNum = selected & (1 | 2 | 4); int mode = selected & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); @@ -280,7 +280,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode, void ** job = new PackerJob(hContact, m_iFtpNum, mode); int result; - if (objects != NULL) + if (objects != nullptr) result = job->getFiles(objects, objCount, flags); else result = job->getFiles(); @@ -306,7 +306,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode, void ** int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode) { - return UploadFile(hContact, m_iFtpNum, mode, NULL, 0, 0); + return UploadFile(hContact, m_iFtpNum, mode, nullptr, 0, 0); } //------------ MIRANDA SERVICES ------------// @@ -314,7 +314,7 @@ int UploadFile(MCONTACT hContact, int m_iFtpNum, GenericJob::EMode mode) INT_PTR UploadService(WPARAM, LPARAM lParam) { FTPUPLOAD *ftpu = (FTPUPLOAD *)lParam; - if (ftpu == NULL || ftpu->cbSize != sizeof(FTPUPLOAD)) + if (ftpu == nullptr || ftpu->cbSize != sizeof(FTPUPLOAD)) return 1; int ftpNum = (ftpu->ftpNum == FNUM_DEFAULT) ? opt.defaultFTP : ftpu->ftpNum - 1; @@ -389,7 +389,7 @@ extern "C" int __declspec(dllexport) Load(void) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - CoInitialize(NULL); + CoInitialize(nullptr); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp index 3a3238d7cc..0a39dd7ab1 100644 --- a/plugins/FTPFileYM/src/job_delete.cpp +++ b/plugins/FTPFileYM/src/job_delete.cpp @@ -76,19 +76,19 @@ void DeleteJob::run() CURL *hCurl = curl_easy_init(); if (hCurl) { - struct curl_slist *headerList = NULL; + struct curl_slist *headerList = nullptr; headerList = curl_slist_append(headerList, getDelFileString()); Utils::curlSetOpt(hCurl, m_ftp, getDelUrlString(), headerList, szError); int result = curl_easy_perform(hCurl); if (result == CURLE_OK) { - if (manDlg != NULL && m_treeItem) + if (manDlg != nullptr && m_treeItem) m_treeItem->remove(); else DBEntry::remove(m_entry->m_fileID); } - else if (manDlg != NULL && m_treeItem) { + else if (manDlg != nullptr && m_treeItem) { wchar_t *error = mir_a2u(szError); mir_wstrcpy(m_treeItem->m_tszToolTip, error); m_treeItem->setState(Manager::TreeItem::_ERROR()); diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index ddeb5ee282..719da74d3f 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -58,7 +58,7 @@ int GenericJob::openFileDialog() mir_snwprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)")); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = 0; + ofn.hwndOwner = nullptr; ofn.lpstrFilter = temp; ofn.nFilterIndex = 1; ofn.lpstrFile = m_tszFilePath; @@ -70,11 +70,11 @@ int GenericJob::openFileDialog() int GenericJob::openFolderDialog() { - BROWSEINFO bi = { 0 }; + BROWSEINFO bi = {}; bi.lpszTitle = TranslateT("FTP File - Select a folder"); bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON | BIF_DONTGOBELOWDOMAIN; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); - if (pidl != 0) { + if (pidl != nullptr) { SHGetPathFromIDList(pidl, m_tszFilePath); CoTaskMemFree(pidl); return 1; diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 47c2df2906..8428faf58c 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -114,7 +114,7 @@ void PackerJob::pack() } setStatus(STATUS_PACKING); - m_startTS = time(NULL); + m_startTS = time(nullptr); int res = createZipFile(); if (res == ZIP_OK) { @@ -136,9 +136,9 @@ int PackerJob::createZipFile() { int result = ZIP_ERRNO; - zipFile zf = zipOpen2_64(m_tszFilePath, 0, NULL, NULL); + zipFile zf = zipOpen2_64(m_tszFilePath, 0, nullptr, nullptr); - if (zf != NULL) { + if (zf != nullptr) { result = ZIP_OK; int size_buf = 65536; @@ -157,7 +157,7 @@ int PackerJob::createZipFile() getFileTime(m_files[i], &zi.tmz_date, &zi.dosDate); char *file = mir_u2a(Utils::getFileNameFromPath(m_files[i])); - int err = zipOpenNewFileInZip(zf, file, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, opt.iCompressionLevel); + int err = zipOpenNewFileInZip(zf, file, &zi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, opt.iCompressionLevel); FREE(file); if (err == ZIP_OK) { @@ -202,7 +202,7 @@ int PackerJob::createZipFile() } Cleanup: - zipClose(zf, NULL); + zipClose(zf, nullptr); FREE(buff); } @@ -229,10 +229,10 @@ uLong PackerJob::getFileTime(wchar_t *file, tm_zip*, uLong *dt) void PackerJob::updateStats() { DWORD dwNewTick = GetTickCount(); - if (m_uiReaded && (time(NULL) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) { + if (m_uiReaded && (time(nullptr) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) { m_lastUpdateTick = dwNewTick; - double speed = ((double)m_uiReaded / 1024) / (time(NULL) - m_startTS); + double speed = ((double)m_uiReaded / 1024) / (time(nullptr) - m_startTS); mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed); double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0; diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index a519e897c4..a083225d57 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -27,14 +27,14 @@ extern ServerList &ftpList; UploadJob::UploadJob(MCONTACT _hContact, int _iFtpNum, EMode _mode) : GenericJob(_hContact, _iFtpNum, _mode), - m_fp(NULL) + m_fp(nullptr) { m_szFileLink[0] = 0; } UploadJob::UploadJob(UploadJob *job) : GenericJob(job), - m_fp(NULL), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0) + m_fp(nullptr), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0) { mir_strcpy(m_szFileLink, job->m_szFileLink); for (int i = 0; i < _countof(m_lastSpeed); i++) @@ -42,7 +42,7 @@ UploadJob::UploadJob(UploadJob *job) : } UploadJob::UploadJob(PackerJob *job) : - GenericJob(job), m_fp(NULL), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0) + GenericJob(job), m_fp(nullptr), m_uiSent(0), m_uiTotalSent(0), m_uiFileSize(0) { for (int i = 0; i < _countof(m_lastSpeed); i++) m_lastSpeed[i] = 0; @@ -82,14 +82,14 @@ void UploadJob::autoSend() return; char *szProto = GetContactProto(m_hContact); - if (szProto == NULL) + if (szProto == nullptr) return; DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = szProto; - dbei.timestamp = (DWORD)time(NULL); + dbei.timestamp = (DWORD)time(nullptr); dbei.cbBlob = (DWORD)mir_strlen(m_szFileLink) + 1; dbei.pBlob = (PBYTE)m_szFileLink; db_event_add(m_hContact, &dbei); @@ -131,7 +131,7 @@ void UploadJob::pauseHandler() void UploadJob::resume() { m_uiSent = 0; - m_startTS = time(NULL); + m_startTS = time(nullptr); if (!isCompleted()) { curl_easy_pause(m_hCurl, CURLPAUSE_CONT); setStatus(STATUS_UPLOADING); @@ -223,7 +223,7 @@ CURL *UploadJob::curlInit(char *szUrl, struct curl_slist *headerList) { m_hCurl = curl_easy_init(); if (!m_hCurl) - return NULL; + return nullptr; Utils::curlSetOpt(m_hCurl, m_ftp, szUrl, headerList, m_szError); @@ -267,12 +267,12 @@ void UploadJob::upload() refreshTab(true); m_fp = _wfopen(m_tszFilePath, L"rb"); - if (m_fp == NULL) { + if (m_fp == nullptr) { Utils::msgBox(TranslateT("Error occurred when opening local file.\nAborting file upload..."), MB_OK | MB_ICONERROR); return; } - curl_slist *headerList = NULL; + curl_slist *headerList = nullptr; if (m_ftp->m_szChmod[0]) headerList = curl_slist_append(headerList, getChmodString()); @@ -288,7 +288,7 @@ void UploadJob::upload() bool uploadFile = true; if (fileExistsOnServer()) { - int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FILEEXISTS), 0, DlgProcFileExists, (LPARAM)m_szSafeFileName); + int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FILEEXISTS), nullptr, DlgProcFileExists, (LPARAM)m_szSafeFileName); if (res == IDC_RENAME) { if (Utils::setFileNameDlgA(m_szSafeFileName) == true) curl_easy_setopt(hCurl, CURLOPT_URL, getUrlString()); @@ -306,7 +306,7 @@ void UploadJob::upload() if (uploadFile) { curl_easy_setopt(m_hCurl, CURLOPT_UPLOAD, 1L); setStatus(STATUS_CONNECTING); - m_startTS = time(NULL); + m_startTS = time(nullptr); int result = curl_easy_perform(hCurl); curl_slist_free_all(headerList); @@ -379,8 +379,8 @@ size_t UploadJob::ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg) void UploadJob::updateStats() { - if (m_uiSent && (time(NULL) > m_startTS)) { - double speed = ((double)m_uiSent / 1024) / (time(NULL) - m_startTS); + if (m_uiSent && (time(nullptr) > m_startTS)) { + double speed = ((double)m_uiSent / 1024) / (time(nullptr) - m_startTS); m_avgSpeed = speed; for (int i = 0; i < _countof(m_lastSpeed); i++) { m_avgSpeed += (m_lastSpeed[i] == 0 ? speed : m_lastSpeed[i]); diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index c77cd62fc2..7d793f5959 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -23,8 +23,8 @@ along with this program. If not, see . #include "options.h" #include "utils.h" -Manager *manDlg = NULL; -Manager *Manager::instance = NULL; +Manager *manDlg = nullptr; +Manager *Manager::instance = nullptr; extern Options &opt; extern ServerList &ftpList; @@ -44,15 +44,15 @@ Manager::~Manager() ImageList_Destroy(m_himlStates); DBEntry::cleanupDB(); - instance = NULL; - manDlg = NULL; + instance = nullptr; + manDlg = nullptr; } void Manager::init() { ServerList::FTP *ftp = ftpList.getSelected(); if (ftp->m_bEnabled) { - m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_MANAGER), NULL, Manager::ManagerDlgProc); + m_hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_MANAGER), nullptr, Manager::ManagerDlgProc); m_hwndFileTree = GetDlgItem(m_hwnd, IDC_FILELIST); initImageList(); fillTree(); @@ -91,7 +91,7 @@ void Manager::initImageList() void Manager::initRootItems() { - TVINSERTSTRUCT tvi = { 0 }; + TVINSERTSTRUCT tvi = {}; tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_STATE; tvi.item.stateMask = TVIS_STATEIMAGEMASK | TVIS_EXPANDED | TVIS_BOLD; @@ -110,7 +110,7 @@ void Manager::fillTree() { initRootItems(); - TVINSERTSTRUCT tvi = { 0 }; + TVINSERTSTRUCT tvi = {}; tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_STATE; tvi.item.stateMask = TVIS_STATEIMAGEMASK; @@ -119,7 +119,7 @@ void Manager::fillTree() mir_cslock lock(DBEntry::mutexDB); DBEntry *entry = DBEntry::getFirst(); - while (entry != NULL) { + while (entry != nullptr) { if ((UINT)entry->m_iFtpNum < m_rootItems.size()) { tvi.item.pszText = mir_a2u(entry->m_szFileName); tvi.hParent = m_rootItems[entry->m_iFtpNum]->m_handle; @@ -154,7 +154,7 @@ Manager::TreeItem *Manager::getItem(HTREEITEM handle) return m_items[i]; } - return NULL; + return nullptr; } Manager::TreeItem::TreeItem(HTREEITEM _handle, HTREEITEM _parent, int _id) : @@ -214,7 +214,7 @@ void Manager::TreeItem::remove() bool Manager::TreeItem::isRoot() { - return (m_parent != NULL) ? false : true; + return (m_parent != nullptr) ? false : true; } @@ -338,7 +338,7 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (hMenu) { HMENU hPopupMenu = GetSubMenu(hMenu, 0); TranslateMenu(hPopupMenu); - int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int command = TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); switch (command) { case IDM_DELETEFROMLIST: item->remove(); @@ -361,7 +361,7 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (command == IDM_COPYLINK) Utils::copyToClipboard(buff); else - ShellExecuteA(NULL, "open", buff, NULL, NULL, SW_SHOWNORMAL); + ShellExecuteA(nullptr, "open", buff, nullptr, nullptr, SW_SHOWNORMAL); } break; } diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index 00edede2ee..6008f80bab 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . #include "stdafx.h" -Options *Options::instance = NULL; +Options *Options::instance = nullptr; Options &opt = Options::getInstance(); extern DeleteTimer &deleteTimer; @@ -162,7 +162,7 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->m_szChmod, _countof(ftp->m_szChmod)); ftp->m_ftpProto = (ServerList::FTP::EProtoType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST)); - ftp->m_iPort = GetDlgItemInt(hwndDlg, IDC_PORT, 0, 0); + ftp->m_iPort = GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, 0); ftp->m_bPassive = IsDlgButtonChecked(hwndDlg, IDC_PASSIVE) ? true : false; ftp->m_bEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLED) ? true : false; @@ -227,9 +227,9 @@ INT_PTR CALLBACK Options::DlgProcOptsAdvanced(HWND hwndDlg, UINT msg, WPARAM wPa opt.bHideInactive = IsDlgButtonChecked(hwndDlg, IDC_HIDEINACTIVE) ? true : false; opt.bCloseDlg = IsDlgButtonChecked(hwndDlg, IDC_CLOSEDLG) ? true : false; opt.bAutoDelete = IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE) ? true : false; - opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, 0, FALSE); + opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, nullptr, FALSE); opt.bSetZipName = IsDlgButtonChecked(hwndDlg, IDC_SETZIPNAME) ? true : false; - opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, 0, FALSE); + opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, nullptr, FALSE); opt.timeRange = (Options::ETimeRange)SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_GETCURSEL, 0, 0); opt.saveOptions(); diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b4a854b3d1..fbbd700fac 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . #include "stdafx.h" -ServerList *ServerList::instance = NULL; +ServerList *ServerList::instance = nullptr; ServerList &ftpList = ServerList::getInstance(); extern Options &opt; @@ -97,5 +97,5 @@ char* ServerList::FTP::getProtoString() const case FT_SSH: return "sftp://"; } - return NULL; + return nullptr; } diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index eb2c8a2dc1..70ed92deaf 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -34,13 +34,13 @@ int Utils::getDeleteTimeMin() int Utils::msgBox(wchar_t *stzMsg, UINT uType) { - HWND hwnd = (uDlg != NULL) ? uDlg->m_hwnd : 0; + HWND hwnd = (uDlg != nullptr) ? uDlg->m_hwnd : nullptr; return MessageBox(hwnd, stzMsg, TranslateT("FTP File"), uType); } int Utils::msgBoxA(char *szMsg, UINT uType) { - HWND hwnd = (uDlg != NULL) ? uDlg->m_hwnd : 0; + HWND hwnd = (uDlg != nullptr) ? uDlg->m_hwnd : nullptr; return MessageBoxA(hwnd, szMsg, Translate("FTP File"), uType); } @@ -80,7 +80,7 @@ wchar_t* Utils::getTextFragment(wchar_t *stzText, size_t length, wchar_t *buff) void Utils::copyToClipboard(char *szText) { if (szText) { - if (OpenClipboard(NULL)) { + if (OpenClipboard(nullptr)) { EmptyClipboard(); HGLOBAL hClipboardData = GlobalAlloc(GMEM_DDESHARE, 1024); char *pchData = (char *)GlobalLock(hClipboardData); @@ -191,7 +191,7 @@ INT_PTR CALLBACK Utils::DlgProcSetFileName(HWND hwndDlg, UINT msg, WPARAM wParam bool Utils::setFileNameDlg(wchar_t *nameBuff) { - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_NAME), 0, DlgProcSetFileName, (LPARAM)nameBuff) == IDOK) + if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_NAME), nullptr, DlgProcSetFileName, (LPARAM)nameBuff) == IDOK) return true; else return false; diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 9c6b49543e..d6039f3782 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -30,13 +30,13 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) if (dbei.eventType != EVENTTYPE_MESSAGE) return 0; - float weight = GetEventWeight(time(NULL) - dbei.timestamp); - float q = GetTimeWeight(time(NULL) - m_lastUpdate); - m_lastUpdate = time(NULL); + float weight = GetEventWeight(time(nullptr) - dbei.timestamp); + float q = GetTimeWeight(time(nullptr) - m_lastUpdate); + m_lastUpdate = time(nullptr); if (!weight) return 0; - TContactInfo *pFound = NULL; + TContactInfo *pFound = nullptr; mir_cslock lck(m_cs); for (int i = m_cache.getCount()-1; i >= 0; i--) { TContactInfo *p = m_cache[i]; @@ -77,8 +77,8 @@ float CContactCache::GetTimeWeight(unsigned long age) void CContactCache::Rebuild() { - unsigned long timestamp = time(NULL); - m_lastUpdate = time(NULL); + unsigned long timestamp = time(nullptr); + m_lastUpdate = time(nullptr); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { TContactInfo *info = new TContactInfo; @@ -150,7 +150,7 @@ void CContactCache::TContactInfo::LoadInfo() wchar_t *nb_stristr(wchar_t *str, wchar_t *substr) { if (!substr || !*substr) return str; - if (!str || !*str) return NULL; + if (!str || !*str) return nullptr; wchar_t *str_up = NEWWSTR_ALLOCA(str); wchar_t *substr_up = NEWWSTR_ALLOCA(substr); @@ -159,7 +159,7 @@ wchar_t *nb_stristr(wchar_t *str, wchar_t *substr) CharUpperBuff(substr_up, (DWORD)mir_wstrlen(substr_up)); wchar_t *p = wcsstr(str_up, substr_up); - return p ? (str + (p - str_up)) : NULL; + return p ? (str + (p - str_up)) : nullptr; } bool CContactCache::filter(int rate, wchar_t *str) diff --git a/plugins/FavContacts/src/cserver.cpp b/plugins/FavContacts/src/cserver.cpp index 18739f8e34..42f35cd687 100644 --- a/plugins/FavContacts/src/cserver.cpp +++ b/plugins/FavContacts/src/cserver.cpp @@ -37,7 +37,7 @@ void CServer::Stop() DWORD CServer::ConnectionAcceptThread() { while (1) { - SOCKET s = accept(m_socket, NULL, NULL); + SOCKET s = accept(m_socket, nullptr, nullptr); if (s == INVALID_SOCKET) break; mir_forkthread(GlobalConnectionProcessThread, new GlobalConnectionProcessThreadArgs(this, s)); diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 22fa356b6c..04d429a82b 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -48,7 +48,7 @@ IconItem iconList[] = { LPGEN("Regular Contact"), "favcontacts_regular", IDI_REGULAR }, }; -CContactCache *g_contactCache = NULL; +CContactCache *g_contactCache = nullptr; Options g_Options = { 0 }; diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 176f645120..f0c8e1072e 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -25,7 +25,7 @@ float g_widthMultiplier = 0; wchar_t g_filter[1024] = { 0 }; -HWND g_hwndMenuHost = NULL; +HWND g_hwndMenuHost = nullptr; static wchar_t* sttGetGroupName(int id) { @@ -35,7 +35,7 @@ static wchar_t* sttGetGroupName(int id) return TranslateT("Favorite Contacts"); } - return Clist_GroupGetName(id - 1, NULL); + return Clist_GroupGetName(id - 1, nullptr); } static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options) @@ -72,7 +72,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) if (options->bSecondLine) { bool bFree = false; wchar_t *title = db_get_wsa(hContact, "CList", "StatusMsg"); - if (title == NULL) { + if (title == nullptr) { char *proto = GetContactProto(hContact); int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE); title = pcli->pfnGetStatusModeDescription(status, 0); @@ -137,7 +137,7 @@ BOOL MenuMeasureItem(LPMEASUREITEMSTRUCT lpmis, Options *options) return FALSE; } -static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) +static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = nullptr) { lpdis->rcItem.top++; lpdis->rcItem.bottom--; @@ -183,7 +183,7 @@ void ImageList_DrawDimmed(HIMAGELIST himl, int i, HDC hdc, int left, int top, UI DeleteDC(dcMem); } -static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) +static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = nullptr) { MCONTACT hContact = (MCONTACT)lpdis->itemData; @@ -259,7 +259,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (options->wMaxRecent && db_get_b(hContact, "FavContacts", "IsFavourite", 0)) { DrawIconEx(hdcTemp, lpdis->rcItem.right - 18, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, - IcoLib_GetIconByHandle(iconList[0].hIcolib), 16, 16, 0, NULL, DI_NORMAL); + IcoLib_GetIconByHandle(iconList[0].hIcolib), 16, 16, 0, nullptr, DI_NORMAL); lpdis->rcItem.right -= 20; } @@ -316,7 +316,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (options->bSecondLine) { bool bFree = false; wchar_t *title = db_get_wsa(hContact, "CList", "StatusMsg"); - if (title == NULL) { + if (title == nullptr) { int status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE); title = pcli->pfnGetStatusModeDescription(status, 0); } @@ -428,7 +428,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, GetCursorPos(&pt); HWND hwndSave = GetForegroundWindow(); SetForegroundWindow(g_hwndMenuHost); - int res = TrackPopupMenu(hMenu, TPM_RECURSE | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, NULL); + int res = TrackPopupMenu(hMenu, TPM_RECURSE | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, nullptr); SetForegroundWindow(hwndSave); DestroyMenu(hMenu); @@ -444,7 +444,7 @@ int ShowMenu(bool centered) HMENU hMenu = CreatePopupMenu(); SIZE szMenu = { 0 }; SIZE szColumn = { 0 }; - wchar_t *prevGroup = NULL; + wchar_t *prevGroup = nullptr; int idItem = 100; MCONTACT hContact; @@ -457,7 +457,7 @@ int ShowMenu(bool centered) if (g_Options.bUseColumns) g_maxItemWidth /= favList.groupCount(); - prevGroup = NULL; + prevGroup = nullptr; for (int i = 0; i < favList.getCount(); ++i) { hContact = favList[i]->getHandle(); @@ -517,7 +517,7 @@ int ShowMenu(bool centered) hContact = NULL; g_filter[0] = 0; - if (int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, NULL)) { + if (int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, g_hwndMenuHost, nullptr)) { MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; @@ -538,13 +538,13 @@ void InitMenu() WNDCLASSEX wcl = { sizeof(wcl) }; wcl.lpfnWndProc = MenuHostWndProc; wcl.hInstance = g_hInst; - wcl.hCursor = LoadCursor(NULL, IDC_ARROW); + wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszClassName = L"FavContactsMenuHostWnd"; RegisterClassEx(&wcl); - g_hwndMenuHost = CreateWindow(L"FavContactsMenuHostWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInst, NULL); - SetWindowPos(g_hwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); + g_hwndMenuHost = CreateWindow(L"FavContactsMenuHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr); + SetWindowPos(g_hwndMenuHost, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); } void UninitMenu() diff --git a/plugins/FavContacts/src/options.cpp b/plugins/FavContacts/src/options.cpp index e479ee58ce..5a5ce392b7 100644 --- a/plugins/FavContacts/src/options.cpp +++ b/plugins/FavContacts/src/options.cpp @@ -133,8 +133,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA options.bCenterHotkey = IsDlgButtonChecked(hwnd, IDC_CHK_CENTERHOTKEY); options.bRightAvatars = IsDlgButtonChecked(hwnd, IDC_CHK_RIGHTAVATARS); options.bDimIdle = IsDlgButtonChecked(hwnd, IDC_CHK_DIMIDLE); - options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, NULL, FALSE); - options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, NULL, FALSE); + options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, nullptr, FALSE); + options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, nullptr, FALSE); mis.CtlID = 0; mis.CtlType = ODT_MENU; @@ -168,7 +168,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case IDC_CHK_GROUPCOLUMS: case IDC_CHK_RIGHTAVATARS: SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE); PostMessage(hwnd, WM_APP, 0, 0); break; @@ -178,7 +178,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case IDC_TXT_RADIUS: if ((HIWORD(wParam) == EN_CHANGE) && bInitialized) { - RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; @@ -202,8 +202,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA g_Options.bUseColumns = IsDlgButtonChecked(hwnd, IDC_CHK_GROUPCOLUMS); g_Options.bRightAvatars = IsDlgButtonChecked(hwnd, IDC_CHK_RIGHTAVATARS); g_Options.bDimIdle = IsDlgButtonChecked(hwnd, IDC_CHK_DIMIDLE); - g_Options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, NULL, FALSE); - g_Options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, NULL, FALSE); + g_Options.wAvatarRadius = GetDlgItemInt(hwnd, IDC_TXT_RADIUS, nullptr, FALSE); + g_Options.wMaxRecent = GetDlgItemInt(hwnd, IDC_TXT_MAXRECENT, nullptr, FALSE); sttSaveOptions(); @@ -239,7 +239,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0) == iSelection) { hSelectedContact = hContact; - RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), nullptr, nullptr, RDW_INVALIDATE); } } SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index d562f5e187..c348de82ce 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -62,11 +62,11 @@ int ProcessSrmmEvent(WPARAM, LPARAM lParam) while (HWND hwndParent = GetParent(hwndRoot)) hwndRoot = hwndParent; - AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), TRUE); + AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), nullptr), GetCurrentThreadId(), TRUE); SetForegroundWindow(hwndRoot); SetActiveWindow(hwndRoot); SetFocus(hwndRoot); - AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), FALSE); + AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), nullptr), GetCurrentThreadId(), FALSE); } hContactToActivate = NULL; @@ -112,7 +112,7 @@ static __forceinline COLORREF sttShadeColor(COLORREF clLine1, COLORREF clBack) int ProcessTBLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszTooltipUp = ttb.name = LPGEN("Favorite Contacts"); ttb.pszService = MS_FAVCONTACTS_SHOWMENU; ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE; diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index dfb4a1c644..36fbd38780 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -147,7 +147,7 @@ FILEECHO::FILEECHO(MCONTACT Contact) chunkMaxLen = db_get_dw(NULL, SERVICE_NAME, "ChunkSize", 5000); chunkCount = 0; - filename = NULL; + filename = nullptr; rgbRecv = db_get_dw(NULL, SERVICE_NAME, "colorRecv", RGB(64, 255, 64)); rgbSent = db_get_dw(NULL, SERVICE_NAME, "colorSent", RGB(255, 255, 64)); @@ -260,38 +260,38 @@ int FILEECHO::createTransfer() { uint LastError; hFile = INVALID_HANDLE_VALUE; - hMapping = NULL; - lpData = NULL; + hMapping = nullptr; + lpData = nullptr; #ifdef DEBUG overhead = 0; #endif BYTE bAuto = db_get_b(NULL, "SRFile", "AutoAccept", 0); - hFile = CreateFile(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, NULL, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, nullptr, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE && !inSend && GetLastError() == ERROR_FILE_EXISTS) { if (MessageBox(hDlg, Translate("File already exists. Overwrite?"), Translate(SERVICE_TITLE), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES) return 0; hFile = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } if (hFile == INVALID_HANDLE_VALUE) goto createTransfer_FAILED; if (!inSend) { - SetFilePointer(hFile, fileSize, NULL, FILE_BEGIN); + SetFilePointer(hFile, fileSize, nullptr, FILE_BEGIN); SetEndOfFile(hFile); } else - fileSize = GetFileSize(hFile, NULL); - hMapping = CreateFileMapping(hFile, NULL, inSend ? PAGE_READONLY : PAGE_READWRITE, - 0, fileSize, NULL); + fileSize = GetFileSize(hFile, nullptr); + hMapping = CreateFileMapping(hFile, nullptr, inSend ? PAGE_READONLY : PAGE_READWRITE, + 0, fileSize, nullptr); LastError = GetLastError(); - if (hMapping == NULL) goto createTransfer_FAILED; + if (hMapping == nullptr) goto createTransfer_FAILED; lpData = (uchar*)MapViewOfFile(hMapping, inSend ? FILE_MAP_READ : FILE_MAP_WRITE, 0, 0, 0); LastError = GetLastError(); - if (lpData == NULL) goto createTransfer_FAILED; + if (lpData == nullptr) goto createTransfer_FAILED; if (inSend) // @@ -374,8 +374,8 @@ int FILEECHO::createTransfer() return 1; createTransfer_FAILED: - if (lpData != NULL) UnmapViewOfFile(lpData); - if (hMapping != NULL) CloseHandle(hMapping); + if (lpData != nullptr) UnmapViewOfFile(lpData); + if (hMapping != nullptr) CloseHandle(hMapping); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); return 0; } @@ -388,8 +388,8 @@ void FILEECHO::destroyTransfer() if (inSend) free(chunkPos); free(chunkAck); - if (lpData != NULL) UnmapViewOfFile(lpData); - if (hMapping != NULL) CloseHandle(hMapping); + if (lpData != nullptr) UnmapViewOfFile(lpData); + if (hMapping != nullptr) CloseHandle(hMapping); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); } //setState(STATE_IDLE); @@ -427,7 +427,7 @@ void FILEECHO::incomeRequest(char *param) char buf[MAX_PATH]; // param == &filename char *p = strchr(param, '?'); - if (p == NULL) return; *p++ = 0; + if (p == nullptr) return; *p++ = 0; CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf); mir_strncat(buf, param, _countof(buf) - mir_strlen(buf)); free(filename); @@ -438,7 +438,7 @@ void FILEECHO::incomeRequest(char *param) // p == &COUNT if (*p == 0) return; param = strchr(p, ':'); // param == &SIZE - if (param == NULL) return; *param++ = 0; + if (param == nullptr) return; *param++ = 0; if (*param == 0) return; chunkCountx = atoi(p); fileSize = atoi(param); @@ -483,12 +483,12 @@ void FILEECHO::cmdACCEPT() lastTimestamp = GetTickCount(); //PostMessage(hDlg, WM_TIMER, 0,0); //onSendTimer(); - SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0); + SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr); } void FILEECHO::updateProgress() { - InvalidateRect(GetDlgItem(hDlg, IDC_PROGRESS), NULL, TRUE); + InvalidateRect(GetDlgItem(hDlg, IDC_PROGRESS), nullptr, TRUE); updateTitle(); } // @@ -576,7 +576,7 @@ void FILEECHO::onSendTimer() { SetDlgItemText(hDlg, IDC_STATUS, Translate("Requesting of missing chunks")); setState(STATE_OPERATE); - sendCmd(0, CMD_END, "", NULL); + sendCmd(0, CMD_END, "", nullptr); chunkIndx = chunkCount + 1; return; } @@ -634,7 +634,7 @@ void FILEECHO::onSendTimer() SetDlgItemText(hDlg, IDC_STATUS, Translate("Sending...")); updateProgress(); } - SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0); + SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr); } void FILEECHO::cmdDATA(char *param) { @@ -703,7 +703,7 @@ cmdDATA_corrupted: } void FILEECHO::cmdEND() { - SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0); + SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr); } void FILEECHO::cmdDACK(char *param) { @@ -761,7 +761,7 @@ void FILEECHO::cmdDACK(char *param) // retransfer some parts // chunkIndx = 0; - SetTimer(hDlg, TIMER_SEND, dwSendInterval, 0); + SetTimer(hDlg, TIMER_SEND, dwSendInterval, nullptr); } void FILEECHO::perform(char *str) @@ -845,11 +845,11 @@ void FILEECHO::perform(char *str) int FILEECHO::sendCmd(int, int cmd, char *szParam, char *szPrefix) { int buflen = (int)mir_strlen(szServicePrefix) + (int)mir_strlen(szParam) + 2; - if (szPrefix != NULL) + if (szPrefix != nullptr) buflen += (int)mir_strlen(szPrefix); char *buf = (char*)malloc(buflen); - if (szPrefix == NULL) + if (szPrefix == nullptr) mir_snprintf(buf, buflen, "%s%c%s", szServicePrefix, cCmdList[cmd], szParam); else mir_snprintf(buf, buflen, "%s%c%s%s", szServicePrefix, cCmdList[cmd], szPrefix, szParam); @@ -870,13 +870,13 @@ void CreateDirectoryTree(char *szDir) if ((dwAttributes = GetFileAttributes(szTestDir)) != 0xffffffff && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return; pszLastBackslash = strrchr(szTestDir, '\\'); - if (pszLastBackslash == NULL) { + if (pszLastBackslash == nullptr) { GetCurrentDirectory(MAX_PATH, szDir); return; } *pszLastBackslash = 0; CreateDirectoryTree(szTestDir); - CreateDirectory(szTestDir, NULL); + CreateDirectory(szTestDir, nullptr); } LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -898,12 +898,12 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa //if(dat == NULL) // return CallSubclassed(hwnd, uMsg, wParam, lParam); GetClientRect(hwnd, &rc); - if (dat == NULL || dat->chunkCount == 0) + if (dat == nullptr || dat->chunkCount == 0) { COLORREF colour; HBRUSH hbr; - if (dat == NULL || dat->iState != STATE_FINISHED) + if (dat == nullptr || dat->iState != STATE_FINISHED) { hbr = (HBRUSH)(COLOR_3DFACE + 1); } @@ -980,7 +980,7 @@ LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { struct FILEECHO *dat = (struct FILEECHO*)GetWindowLongPtr(hDlg, GWLP_USERDATA); - HWND hwndStatus = NULL; + HWND hwndStatus = nullptr; switch (uMsg) { case WM_INITDIALOG: @@ -1171,7 +1171,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (dat->iState == STATE_PRERECV) { SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user")); - dat->sendCmd(0, CMD_CANCEL, "", NULL); + dat->sendCmd(0, CMD_CANCEL, "", nullptr); dat->setState(STATE_CANCELLED); } if (dat->chunkCount) @@ -1181,7 +1181,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { SetDlgItemText(hDlg, IDC_STATUS, Translate("Canceled by user")); dat->setState(STATE_CANCELLED); - dat->sendCmd(0, CMD_CANCEL, "", NULL); + dat->sendCmd(0, CMD_CANCEL, "", nullptr); dat->destroyTransfer(); if (wParam == IDCANCEL) DestroyWindow(hDlg); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 15c53a7c35..594e95e395 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -102,11 +102,11 @@ INT_PTR OnSendFile(WPARAM wParam, LPARAM) } else { - if (hwnd != 0) WindowList_Remove(hFileList, hwnd); + if (hwnd != nullptr) WindowList_Remove(hFileList, hwnd); FILEECHO *fe = new FILEECHO(wParam); fe->inSend = TRUE; - hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe); - if (hwnd == NULL) + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, DialogProc, (LPARAM)fe); + if (hwnd == nullptr) { delete fe; return 0; @@ -128,11 +128,11 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) HWND hwnd = WindowList_Find(hFileList, ccs->hContact); if (!IsWindow(hwnd)) { - if (hwnd != 0) WindowList_Remove(hFileList, hwnd); + if (hwnd != nullptr) WindowList_Remove(hFileList, hwnd); FILEECHO *fe = new FILEECHO(ccs->hContact); fe->inSend = FALSE; - hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe); - if (hwnd == NULL) + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, DialogProc, (LPARAM)fe); + if (hwnd == nullptr) { delete fe; return 0; @@ -212,7 +212,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_OPT_INITIALISE, OnOptInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); hHookDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged); - hHookSkinIconsChanged = NULL; + hHookSkinIconsChanged = nullptr; return 0; } @@ -224,7 +224,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { WindowList_Destroy(hFileList); - if (hHookSkinIconsChanged != NULL) + if (hHookSkinIconsChanged != nullptr) UnhookEvent(hHookSkinIconsChanged); UnhookEvent(hHookDbSettingChange); UnhookEvent(hHookContactAdded); diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 1858cde76c..ea594073de 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static UINT g_LPCodePage; static wchar_t g_szSkinLib[MAX_PATH]; -static HANDLE hExtraIcon = NULL; -static HANDLE hFolderChanged = NULL, hIconFolder = NULL; +static HANDLE hExtraIcon = nullptr; +static HANDLE hFolderChanged = nullptr, hIconFolder = nullptr; -static FOUNDINFO* fiList = NULL; +static FOUNDINFO* fiList = nullptr; static int nFICount = 0; static LIST arMonitoredWindows(3, PtrKeySortT); @@ -43,16 +43,16 @@ static wchar_t* getSectionName(int flag) { #include "finger_groups.h" } - return NULL; + return nullptr; } void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) { - mask->szMaskUpper = NULL; + mask->szMaskUpper = nullptr; if (mask->hIcolibItem) IcoLib_RemoveIcon(mask->szIconName); - mask->hIcolibItem = NULL; + mask->hIcolibItem = nullptr; if (!mask->szMask || !bEnable) return; @@ -75,10 +75,10 @@ void __fastcall Prepare(KN_FP_MASK* mask, bool bEnable) } LPTSTR SectName = getSectionName(mask->iSectionFlag); - if (SectName == NULL) + if (SectName == nullptr) return; - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE; sid.section.w = SectName; sid.pszName = mask->szIconName; @@ -204,7 +204,7 @@ int OnExtraIconClick(WPARAM wParam, LPARAM, LPARAM) */ BOOL __fastcall WildCompareW(LPWSTR wszName, LPWSTR wszMask) { - if (wszMask == NULL) + if (wszMask == nullptr) return NULL; if (*wszMask != L'|') @@ -243,7 +243,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (i = 0; i < DEFAULT_KN_FP_MASK_COUNT; i++) { KN_FP_MASK& p = def_kn_fp_mask[i]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (!WildCompareW(szMirVer, p.szMaskUpper)) @@ -265,7 +265,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov else if (!def_kn_fp_mask[i].fNotUseOverlay && i < DEFAULT_KN_FP_MASK_COUNT) { for (j = 0; j < DEFAULT_KN_FP_OVERLAYS_COUNT; j++) { KN_FP_MASK& p = def_kn_fp_overlays_mask[j]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (!WildCompare(szMirVer, p.szMaskUpper)) @@ -278,7 +278,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (k = 0; k < DEFAULT_KN_FP_OVERLAYS2_COUNT; k++) { KN_FP_MASK& p = def_kn_fp_overlays2_mask[k]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -287,7 +287,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (n = 0; n < DEFAULT_KN_FP_OVERLAYS3_COUNT; n++) { KN_FP_MASK& p = def_kn_fp_overlays3_mask[n]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -296,7 +296,7 @@ static void MatchMasks(wchar_t* szMirVer, short *base, short *overlay, short *ov for (m = 0; m < DEFAULT_KN_FP_OVERLAYS4_COUNT; m++) { KN_FP_MASK& p = def_kn_fp_overlays4_mask[m]; - if (p.hIcolibItem == NULL) + if (p.hIcolibItem == nullptr) continue; if (WildCompareW(szMirVer, p.szMaskUpper)) @@ -360,26 +360,26 @@ void __fastcall GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay, HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2, short overlay3, short overlay4) { - HICON hIcon = NULL; // returned HICON - HICON hTmp = NULL; - HICON icMain = NULL; - HICON icOverlay = NULL; - HICON icOverlay2 = NULL; - HICON icOverlay3 = NULL; - HICON icOverlay4 = NULL; + HICON hIcon = nullptr; // returned HICON + HICON hTmp = nullptr; + HICON icMain = nullptr; + HICON icOverlay = nullptr; + HICON icOverlay2 = nullptr; + HICON icOverlay3 = nullptr; + HICON icOverlay4 = nullptr; KN_FP_MASK* mainMask = &(def_kn_fp_mask[base]); icMain = IcoLib_GetIconByHandle(mainMask->hIcolibItem); if (icMain) { - KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : NULL; - KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : NULL; - KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : NULL; - KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : NULL; - icOverlay = (overlayMask == NULL) ? NULL : IcoLib_GetIconByHandle(overlayMask->hIcolibItem); - icOverlay2 = (overlay2Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem); - icOverlay3 = (overlay3Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem); - icOverlay4 = (overlay4Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem); + KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : nullptr; + KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : nullptr; + KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : nullptr; + KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : nullptr; + icOverlay = (overlayMask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlayMask->hIcolibItem); + icOverlay2 = (overlay2Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem); + icOverlay3 = (overlay3Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem); + icOverlay4 = (overlay4Mask == nullptr) ? nullptr : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem); hIcon = icMain; @@ -425,7 +425,7 @@ HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2 HBITMAP __inline CreateBitmap32(int cx, int cy) { - return CreateBitmap32Point(cx, cy, NULL); + return CreateBitmap32Point(cx, cy, nullptr); } /* @@ -434,9 +434,9 @@ HBITMAP __inline CreateBitmap32(int cx, int cy) */ HBITMAP __fastcall CreateBitmap32Point(int cx, int cy, LPVOID* bits) { - LPVOID ptPixels = NULL; + LPVOID ptPixels = nullptr; - if (cx < 0 || cy < 0) return NULL; + if (cx < 0 || cy < 0) return nullptr; BITMAPINFO bmpi = { 0 }; bmpi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -444,11 +444,11 @@ HBITMAP __fastcall CreateBitmap32Point(int cx, int cy, LPVOID* bits) bmpi.bmiHeader.biHeight = cy; bmpi.bmiHeader.biPlanes = 1; bmpi.bmiHeader.biBitCount = 32; - HBITMAP DirectBitmap = CreateDIBSection(NULL, &bmpi, DIB_RGB_COLORS, &ptPixels, NULL, 0); + HBITMAP DirectBitmap = CreateDIBSection(nullptr, &bmpi, DIB_RGB_COLORS, &ptPixels, nullptr, 0); GdiFlush(); if (ptPixels) memset(ptPixels, 0, cx * cy * 4); - if (bits != NULL) *bits = ptPixels; + if (bits != nullptr) *bits = ptPixels; return DirectBitmap; } @@ -530,14 +530,14 @@ HICON __fastcall CreateJoinedIcon(HICON hBottom, HICON hTop) { BOOL drawn = FALSE; HDC tempDC, tempDC2, tempDC3; - HICON res = NULL; + HICON res = nullptr; HBITMAP oImage, nImage; HBITMAP nMask, hbm, obmp, obmp2; - LPBYTE ptPixels = NULL; + LPBYTE ptPixels = nullptr; ICONINFO iNew = { 0 }; BYTE p[32] = { 0 }; - tempDC = CreateCompatibleDC(NULL); + tempDC = CreateCompatibleDC(nullptr); nImage = CreateBitmap32Point(16, 16, (LPVOID*)&ptPixels); oImage = (HBITMAP)SelectObject(tempDC, nImage); @@ -658,18 +658,18 @@ HICON __fastcall CreateJoinedIcon(HICON hBottom, HICON hTop) DeleteObject(iciTop.hbmMask); if (!drawn) { - DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, NULL, DI_NORMAL); - DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, nullptr, DI_NORMAL); + DrawIconEx(tempDC, 0, 0, hTop, 16, 16, 0, nullptr, DI_NORMAL); } nMask = CreateBitmap(16, 16, 1, 1, p); - tempDC2 = CreateCompatibleDC(NULL); - tempDC3 = CreateCompatibleDC(NULL); + tempDC2 = CreateCompatibleDC(nullptr); + tempDC3 = CreateCompatibleDC(nullptr); hbm = CreateCompatibleBitmap(tempDC3, 16, 16); obmp = (HBITMAP)SelectObject(tempDC2, nMask); obmp2 = (HBITMAP)SelectObject(tempDC3, hbm); - DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, NULL, DI_MASK); - DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, NULL, DI_MASK); + DrawIconEx(tempDC2, 0, 0, hBottom, 16, 16, 0, nullptr, DI_MASK); + DrawIconEx(tempDC3, 0, 0, hTop, 16, 16, 0, nullptr, DI_MASK); BitBlt(tempDC2, 0, 0, 16, 16, tempDC3, 0, 0, SRCAND); GdiFlush(); @@ -721,7 +721,7 @@ HANDLE __fastcall GetIconIndexFromFI(LPTSTR szMirVer) fiList = (FOUNDINFO*)mir_realloc(fiList, sizeof(FOUNDINFO) * (nFICount + 1)); fiList[nFICount].dwArray = val; - if (hIcon != NULL) { + if (hIcon != nullptr) { hFoundImage = ExtraIcon_AddIcon(hIcon); fiList[nFICount].hRegisteredImage = hFoundImage; DestroyIcon(hIcon); @@ -736,9 +736,9 @@ HANDLE __fastcall GetIconIndexFromFI(LPTSTR szMirVer) VOID ClearFI() { - if (fiList != NULL) + if (fiList != nullptr) mir_free(fiList); - fiList = NULL; + fiList = nullptr; nFICount = 0; } @@ -753,13 +753,13 @@ VOID ClearFI() static INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM) { LPWSTR wszMirVer = (LPWSTR)wParam; // MirVer value to get client for. - if (wszMirVer == NULL) + if (wszMirVer == nullptr) return 0; short base, overlay, overlay2, overlay3, overlay4; GetIconsIndexesW(wszMirVer, &base, &overlay, &overlay2, &overlay3, &overlay4); - HICON hIcon = NULL; // returned HICON + HICON hIcon = nullptr; // returned HICON if (base != -1) hIcon = CreateIconFromIndexes(base, overlay, overlay2, overlay3, overlay4); @@ -777,7 +777,7 @@ static INT_PTR ServiceGetClientIconW(WPARAM wParam, LPARAM) static INT_PTR ServiceGetClientDescrW(WPARAM wParam, LPARAM) { LPWSTR wszMirVer = (LPWSTR)wParam; // MirVer value to get client for. - if (wszMirVer == NULL) + if (wszMirVer == nullptr) return 0; LPWSTR wszMirVerUp = NEWWSTR_ALLOCA(wszMirVer); _wcsupr(wszMirVerUp); @@ -842,7 +842,7 @@ int OnExtraImageApply(WPARAM hContact, LPARAM) ptrW tszMirver; char *szProto = GetContactProto(hContact); - if (szProto != NULL) + if (szProto != nullptr) tszMirver = db_get_wsa(hContact, szProto, "MirVer"); ApplyFingerprintImage(hContact, tszMirver); @@ -872,7 +872,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) ApplyFingerprintImage(hContact, cws->value.pwszVal); break; default: - ApplyFingerprintImage(hContact, NULL); + ApplyFingerprintImage(hContact, nullptr); } } return 0; @@ -889,13 +889,13 @@ static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) return 0; MessageWindowEventData *event = (MessageWindowEventData *)lParam; - if (event == NULL) + if (event == nullptr) return 0; if (event->uType == MSG_WINDOW_EVT_OPEN) { ptrW ptszMirVer; char *szProto = GetContactProto(event->hContact); - if (szProto != NULL) + if (szProto != nullptr) ptszMirVer = db_get_wsa(event->hContact, szProto, "MirVer"); SetSrmmIcon(event->hContact, ptszMirVer); arMonitoredWindows.insert((HANDLE)event->hContact); diff --git a/plugins/FingerprintNG/src/main.cpp b/plugins/FingerprintNG/src/main.cpp index 51e0ad163f..a60f815de1 100644 --- a/plugins/FingerprintNG/src/main.cpp +++ b/plugins/FingerprintNG/src/main.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE g_hInst; int hLangpack; -HANDLE hHeap = NULL; +HANDLE hHeap = nullptr; //End of header diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index 577bd7ecc7..f49cc3d69c 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -36,30 +36,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. MyBitmap::MyBitmap() { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; } MyBitmap::MyBitmap(int w, int h) { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; allocate(w, h); } MyBitmap::MyBitmap(const char *fn, const char *fnAlpha) { - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; - bitsSave = 0; + bitsSave = nullptr; loadFromFile(fn, fnAlpha); } @@ -174,7 +174,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) } delete[] bitsSave; - bitsSave = 0; + bitsSave = nullptr; } void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h) @@ -686,7 +686,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) } else { this->saveAlpha(x, y, w, h); - DrawIconEx(this->getDC(), x, y, hic, w, h, 0, NULL, DI_NORMAL); + DrawIconEx(this->getDC(), x, y, hic, w, h, 0, nullptr, DI_NORMAL); this->restoreAlpha(x, y, w, h); } @@ -726,7 +726,7 @@ void MyBitmap::DrawText(wchar_t *str, int x, int y, int blur, int strength) RECT rc; SetRect(&rc, 0, 0, sz.cx, sz.cy); SetTextColor(tmp.getDC(), RGB(255, 255, 255)); SetBkColor(tmp.getDC(), RGB(0, 0, 0)); - ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, NULL); + ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, nullptr); ::DrawText(tmp.getDC(), str, -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); SelectObject(tmp.getDC(), hfnTmp); @@ -872,7 +872,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) } - HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData); + HRGN hRgn = ExtCreateRegion(nullptr, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData); delete[] pRgnData; return hRgn; } @@ -940,9 +940,9 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha) return false; BITMAP bm; GetObject(hBmpLoaded, sizeof(bm), &bm); - SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, NULL); + SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr); - HDC dcTmp = CreateCompatibleDC(0); + HDC dcTmp = CreateCompatibleDC(nullptr); GetBitmapDimensionEx(hBmpLoaded, &sz); HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded); @@ -997,8 +997,8 @@ void MyBitmap::allocate(int w, int h) DeleteDC(dcBmp); } - hBmp = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void **)&bits, 0, 0); - dcBmp = CreateCompatibleDC(0); + hBmp = (HBITMAP)CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, (void **)&bits, nullptr, 0); + dcBmp = CreateCompatibleDC(nullptr); hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmp); GdiFlush(); @@ -1011,9 +1011,9 @@ void MyBitmap::free() DeleteObject(SelectObject(dcBmp, hBmpSave)); DeleteDC(dcBmp); - dcBmp = 0; - hBmp = 0; - bits = 0; + dcBmp = nullptr; + hBmp = nullptr; + bits = nullptr; width = height = 0; } diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 2b3fffc4a6..e9f3c97618 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -12,7 +12,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid, LPVOID *ppvOb return S_OK; } - *ppvObj = NULL; + *ppvObj = nullptr; return (E_NOINTERFACE); } @@ -33,7 +33,7 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) { *pdwEffect = 0; - if (hwndCurDrag == NULL) { + if (hwndCurDrag == nullptr) { *pdwEffect = DROPEFFECT_NONE; } else { @@ -44,8 +44,8 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD, POINTL, DWORD *pdwEffect) HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect) { - FORMATETC feFile = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; - FORMATETC feText = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC feFile = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC feText = { CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; if (S_OK == pData->QueryGetData(&feFile) || S_OK == pData->QueryGetData(&feText)) { @@ -70,11 +70,11 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() { ThumbInfo *pThumb = thumbList.FindThumb(hwndCurDrag); - if (NULL != pThumb) { + if (nullptr != pThumb) { pThumb->ThumbDeselect(TRUE); } - hwndCurDrag = NULL; + hwndCurDrag = nullptr; return S_OK; } @@ -82,15 +82,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave() HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, DWORD *pdwEffect) { - FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC fe = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; *pdwEffect = DROPEFFECT_NONE; - if (hwndCurDrag == NULL) + if (hwndCurDrag == nullptr) return S_OK; ThumbInfo *pThumb = (ThumbInfo*)GetWindowLongPtr(hwndCurDrag, GWLP_USERDATA); - if (pThumb == NULL) + if (pThumb == nullptr) return S_OK; STGMEDIUM stg; @@ -108,19 +108,19 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D if (!bFormatText) { HDROP hDrop = (HDROP)stg.hGlobal; - if (hDrop != NULL) { + if (hDrop != nullptr) { OnDropFiles(hDrop, pThumb); } } else { wchar_t *pText = (wchar_t*)GlobalLock(stg.hGlobal); - if (pText != NULL) { + if (pText != nullptr) { SendMsgDialog(hwndCurDrag, pText); GlobalUnlock(stg.hGlobal); } } - if (stg.pUnkForRelease != NULL) { + if (stg.pUnkForRelease != nullptr) { stg.pUnkForRelease->Release(); } else { @@ -137,15 +137,15 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD, POINTL, D BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) { - UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); + UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); char **ppDroppedItems = (char**)malloc(sizeof(char*)*(nDroppedItemsCount + 1)); - if (ppDroppedItems == NULL) { + if (ppDroppedItems == nullptr) { return FALSE; } - ppDroppedItems[nDroppedItemsCount] = NULL; + ppDroppedItems[nDroppedItemsCount] = nullptr; char szFilename[MAX_PATH]; for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) { @@ -158,8 +158,8 @@ BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb) char **ppFiles = (char**)malloc(sizeof(char *)* (nFilesCount + 1)); BOOL bSuccess = FALSE; - if (ppFiles != NULL) { - ppFiles[nFilesCount] = NULL; + if (ppFiles != nullptr) { + ppFiles[nFilesCount] = nullptr; ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles); @@ -198,7 +198,7 @@ static int CountFiles(char *szItem) char szDirName[MAX_PATH]; strncpy(szDirName, szItem, MAX_PATH - 1); - if (NULL != strstr(szItem, "*.*")) { + if (nullptr != strstr(szItem, "*.*")) { size_t offset = mir_strlen(szDirName) - 3; mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); } @@ -233,7 +233,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) char szDirName[MAX_PATH]; strncpy(szDirName, szItem, MAX_PATH - 1); - if (NULL != strstr(szItem, "*.*")) { + if (nullptr != strstr(szItem, "*.*")) { size_t offset = mir_strlen(szDirName) - 3; mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName); } @@ -252,7 +252,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount) strncpy(szFile, szItem, nSize - 1); - if (NULL != strstr(szFile, "*.*")) { + if (nullptr != strstr(szFile, "*.*")) { szFile[mir_strlen(szFile) - 3] = '\0'; mir_strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile)); } diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 9ac311a663..d840c61e62 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -161,7 +161,7 @@ static int OnContactDrag(WPARAM hContact, LPARAM) GetCursorPos(&pt); ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); - if (pThumb == NULL) { + if (pThumb == nullptr) { int idStatus = GetContactStatus(hContact); if (!fcOpt.bHideAll && !HideOnFullScreen() && (!fcOpt.bHideOffline || IsStatusVisible(idStatus)) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) { @@ -186,7 +186,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); - if (hNewContact == hContact && pThumb != NULL) { + if (hNewContact == hContact && pThumb != nullptr) { hNewContact = NULL; GetWindowRect(hwndMiranda, &rcMiranda); @@ -200,7 +200,7 @@ static int OnContactDrop(WPARAM hContact, LPARAM) static int OnContactDragStop(WPARAM hContact, LPARAM) { ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); - if (pThumb != NULL && hNewContact == hContact) { + if (pThumb != nullptr && hNewContact == hContact) { thumbList.RemoveThumb(pThumb); hNewContact = NULL; } @@ -236,7 +236,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0; } - if (pThumb == NULL) + if (pThumb == nullptr) return 0; // Only on these 2 events we need to refresh @@ -278,7 +278,7 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM) { ThumbInfo *pThumb = thumbList.FindThumbByContact(wParam); - Menu_ShowItem(hMenuItemRemove, pThumb != NULL); + Menu_ShowItem(hMenuItemRemove, pThumb != nullptr); Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll); return 0; } @@ -313,19 +313,19 @@ static void LoadDBSettings() void SendMsgDialog(HWND hwnd, wchar_t *pText) { ThumbInfo *pThumb = thumbList.FindThumb(hwnd); - if (pThumb != NULL) + if (pThumb != nullptr) CallService(MS_MSG_SENDMESSAGEW, (WPARAM)pThumb->hContact, (LPARAM)pText); } static void ShowContactMenu(HWND hwnd, POINT pt) { ThumbInfo *pThumb = thumbList.FindThumb(hwnd); - if (pThumb != NULL) { + if (pThumb != nullptr) { hContactMenu = Menu_BuildContactMenu(pThumb->hContact); - if (hContactMenu == NULL) + if (hContactMenu == nullptr) return; - int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); Clist_MenuProcessCommand(idCommand, MPCF_CONTACTMENU, pThumb->hContact); } } @@ -358,7 +358,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM BitBlt(hdc, 0, 0, pThumb->bmpContent.getWidth(), pThumb->bmpContent.getHeight(), pThumb->bmpContent.getDC(), 0, 0, SRCCOPY); //RepaintWindow( hwnd, hdc ); ReleaseDC(hwnd, hdc); - ValidateRect(hwnd, NULL); + ValidateRect(hwnd, nullptr); return 0; } @@ -463,15 +463,15 @@ void ApplyOptionsChanges() CreateBackgroundBrush(); if (!fcOpt.bToTop && ToTopTimerID) { - KillTimer(NULL, ToTopTimerID); + KillTimer(nullptr, ToTopTimerID); ToTopTimerID = 0; } if (fcOpt.bToTop) { - if (ToTopTimerID) KillTimer(NULL, ToTopTimerID); + if (ToTopTimerID) KillTimer(nullptr, ToTopTimerID); fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime; fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime; - ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc); + ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc); } OnStatusChanged(); @@ -503,12 +503,12 @@ static void UnregisterWindowClass() static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY) { ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); - if (pThumb != NULL) + if (pThumb != nullptr) return; // Prepare for window creation - HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, NULL, NULL, hInst, NULL); - if (hwnd == NULL) + HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, WND_CLASS, ptszName, WS_POPUP, nX, nY, 50, 20, nullptr, nullptr, hInst, nullptr); + if (hwnd == nullptr) return; pThumb = thumbList.AddThumb(hwnd, ptszName, hContact); @@ -526,9 +526,9 @@ static void CreateThumbWnd(wchar_t *ptszName, MCONTACT hContact, int nX, int nY) static void CreateThumbsFont() { for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++) { - if (NULL != hFont[nFontId]) { + if (nullptr != hFont[nFontId]) { DeleteObject(hFont[nFontId]); - hFont[nFontId] = NULL; + hFont[nFontId] = nullptr; } LOGFONT lf; @@ -541,25 +541,25 @@ static void CreateBackgroundBrush() { bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR); - if (NULL != hLTEdgesPen) { + if (nullptr != hLTEdgesPen) { DeleteObject(hLTEdgesPen); - hLTEdgesPen = NULL; + hLTEdgesPen = nullptr; } - if (NULL != hRBEdgesPen) { + if (nullptr != hRBEdgesPen) { DeleteObject(hRBEdgesPen); - hRBEdgesPen = NULL; + hRBEdgesPen = nullptr; } - if (NULL != hBmpBackground) { + if (nullptr != hBmpBackground) { DeleteObject(hBmpBackground); - hBmpBackground = NULL; + hBmpBackground = nullptr; } - if (NULL != hBkBrush) { + if (nullptr != hBkBrush) { SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL); DeleteObject(hBkBrush); - hBkBrush = NULL; + hBkBrush = nullptr; } if (db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) { @@ -591,7 +591,7 @@ static int GetContactStatus(MCONTACT hContact) } char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return ID_STATUS_OFFLINE; return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); @@ -765,7 +765,7 @@ static void LoadContact(MCONTACT hContact) DWORD dwPos = db_get_dw(hContact, MODULE, "ThumbsPos", (DWORD)-1); if (dwPos != -1) { wchar_t *ptName = pcli->pfnGetContactDisplayName(hContact, 0); - if (ptName != NULL) { + if (ptName != nullptr) { int nX = DB_POS_GETX(dwPos); int nY = DB_POS_GETY(dwPos); @@ -778,7 +778,7 @@ static void LoadContact(MCONTACT hContact) BOOL HideOnFullScreen() { BOOL bFullscreen = FALSE; - HWND hWnd = 0; + HWND hWnd = nullptr; if (fcOpt.bHideWhenFullscreen) { int w = GetSystemMetrics(SM_CXSCREEN); @@ -893,7 +893,7 @@ static int OnModulesLoded(WPARAM, LPARAM) if (fcOpt.bToTop) { fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime; fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime; - ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc); + ToTopTimerID = SetTimer(nullptr, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc); } return 0; } @@ -924,7 +924,7 @@ extern "C" int __declspec(dllexport) Load() char szId[20]; mir_snprintf(szId, "Font%d", i); - FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], NULL, NULL, i + 1, false, &lf, defColor); + FontService_RegisterFont(MODULE, szId, LPGENW("Floating contacts"), s_fonts[i], nullptr, nullptr, i + 1, false, &lf, defColor); } HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded); @@ -945,11 +945,11 @@ extern "C" int __declspec(dllexport) Unload() if (hBkBrush) { SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL); DeleteObject(hBkBrush); - hBkBrush = NULL; + hBkBrush = nullptr; } for (int nFontId = 0; nFontId < FLT_FONTIDS; nFontId++) - if (NULL != hFont[nFontId]) + if (nullptr != hFont[nFontId]) DeleteObject(hFont[nFontId]); UnregisterWindowClass(); diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index b9338223b4..c27c29b242 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -202,8 +202,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP mir_snprintf(szPercent, "%d%%", btOpacity); SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent); - EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != nullptr); + EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != nullptr); } return TRUE; diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index f1d3447e74..27f953a689 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -12,15 +12,15 @@ static BOOL bMouseMoved = FALSE; static int nLeft = 0; static int nTop = 0; static int nOffs = 5; -static ThumbInfo *pThumbMouseIn = NULL; +static ThumbInfo *pThumbMouseIn = nullptr; static void SnapToScreen(RECT rcThumb, int nX, int nY, int *pX, int *pY) { int nWidth; int nHeight; - assert(NULL != pX); - assert(NULL != pY); + assert(nullptr != pX); + assert(nullptr != pY); nWidth = rcThumb.right - rcThumb.left; nHeight = rcThumb.bottom - rcThumb.top; @@ -41,7 +41,7 @@ ThumbInfo::ThumbInfo() ThumbInfo::~ThumbInfo() { if (pThumbMouseIn == this) { - pThumbMouseIn = NULL; + pThumbMouseIn = nullptr; KillTimer(hwnd, TIMERID_LEAVE_T); } dropTarget->Release(); @@ -64,13 +64,13 @@ void ThumbInfo::PositionThumb(int nX, int nY) ThumbInfo *pThumb = this; while (pThumb) { pThumb->PositionThumbWorker(pos.x, pos.y, &pos); - if (NULL != pThumb->hwnd) /* Wine fix. */ + if (nullptr != pThumb->hwnd) /* Wine fix. */ hdwp = DeferWindowPos(hdwp, pThumb->hwnd, HWND_TOPMOST, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); pThumb->ptPos = pos; pos.x += pThumb->szSize.cx; - pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : NULL; + pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : nullptr; } EndDeferWindowPos(hdwp); @@ -102,7 +102,7 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos) // Docking and screen boundaries check SnapToScreen(rcThumb, nX, nY, &nNewX, &nNewY); - bLeading = dockOpt.hwndRight != NULL; + bLeading = dockOpt.hwndRight != nullptr; if (fcOpt.bMoveTogether) UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft)); @@ -238,7 +238,7 @@ void ThumbInfo::ResizeThumb() int index = FLT_FONTID_NOTONLIST; himlMiranda = Clist_GetImageList(); - if (himlMiranda == NULL) + if (himlMiranda == nullptr) return; SIZEL sizeIcon; @@ -247,7 +247,7 @@ void ThumbInfo::ResizeThumb() HDC hdc = GetWindowDC(hwnd); if (!db_get_b(hContact, "CList", "NotOnList", 0)) { char *szProto = GetContactProto(hContact); - if (NULL != szProto) { + if (nullptr != szProto) { int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0); int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0); @@ -352,7 +352,7 @@ void ThumbInfo::OnLButtonUp() if (bMouseDown) { bMouseDown = FALSE; - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // Check whether we shoud remove the window GetWindowRect(hwndMiranda, &rcMiranda); @@ -390,11 +390,11 @@ void ThumbInfo::OnMouseMove(int nX, int nY) ptOld = ptNew; } - else SetCursor(LoadCursor(NULL, IDC_ARROW)); + else SetCursor(LoadCursor(nullptr, IDC_ARROW)); // Update selection status if (!pThumbMouseIn) { - SetTimer(hwnd, TIMERID_LEAVE_T, 10, NULL); + SetTimer(hwnd, TIMERID_LEAVE_T, 10, nullptr); pThumbMouseIn = this; ThumbSelect(TRUE); @@ -423,7 +423,7 @@ void ThumbInfo::OnMouseMove(int nX, int nY) return; tmpTimeIn = (fcOpt.TimeIn > 0) ? fcOpt.TimeIn : CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0); - SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, 0); + SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, nullptr); fTipTimerActive = TRUE; } } @@ -483,10 +483,10 @@ void ThumbInfo::UpdateContent() HDC hdcDraw = bmpContent.getDC(); SetRect(&rc, 0, 0, szSize.cx, szSize.cy); - if (NULL != hBmpBackground) { + if (nullptr != hBmpBackground) { RECT rcBkgnd; SetRect(&rcBkgnd, 0, 0, szSize.cx, szSize.cy); - if (NULL != hLTEdgesPen) + if (nullptr != hLTEdgesPen) InflateRect(&rcBkgnd, -1, -1); int width = rcBkgnd.right - rcBkgnd.left; int height = rcBkgnd.bottom - rcBkgnd.top; @@ -549,19 +549,19 @@ void ThumbInfo::UpdateContent() } else FillRect(hdcDraw, &rc, hBkBrush); - if (NULL != hLTEdgesPen) { + if (nullptr != hLTEdgesPen) { HPEN hOldPen = (HPEN)SelectObject(hdcDraw, hLTEdgesPen); - MoveToEx(hdcDraw, 0, 0, NULL); + MoveToEx(hdcDraw, 0, 0, nullptr); LineTo(hdcDraw, szSize.cx, 0); - MoveToEx(hdcDraw, 0, 0, NULL); + MoveToEx(hdcDraw, 0, 0, nullptr); LineTo(hdcDraw, 0, szSize.cy); SelectObject(hdcDraw, hRBEdgesPen); - MoveToEx(hdcDraw, 0, szSize.cy - 1, NULL); + MoveToEx(hdcDraw, 0, szSize.cy - 1, nullptr); LineTo(hdcDraw, szSize.cx - 1, szSize.cy - 1); - MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, NULL); + MoveToEx(hdcDraw, szSize.cx - 1, szSize.cy - 1, nullptr); LineTo(hdcDraw, szSize.cx - 1, 0); SelectObject(hdcDraw, hOldPen); @@ -575,7 +575,7 @@ void ThumbInfo::UpdateContent() if (!db_get_b(hContact, "CList", "NotOnList", 0)) { char *szProto = GetContactProto(hContact); - if (NULL != szProto) { + if (nullptr != szProto) { int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0); int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0); @@ -656,7 +656,7 @@ void ThumbInfo::UpdateContent() blend.SourceConstantAlpha = 255; blend.AlphaFormat = AC_SRC_ALPHA; - UpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA); + UpdateLayeredWindow(hwnd, nullptr, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA); } void ThumbInfo::PopupMessageDialog() @@ -678,7 +678,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) GetThumbRect(&rc); if (!PtInRect(&rc, pt)) { KillTimer(hwnd, TIMERID_LEAVE_T); - pThumbMouseIn = NULL; + pThumbMouseIn = nullptr; ThumbDeselect(TRUE); } } @@ -704,7 +704,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight) { - if (pThumbRight->dockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL) { + if (pThumbRight->dockOpt.hwndLeft == nullptr && pThumbLeft->dockOpt.hwndRight == nullptr) { pThumbRight->dockOpt.hwndLeft = pThumbLeft->hwnd; pThumbLeft->dockOpt.hwndRight = pThumbRight->hwnd; } @@ -713,20 +713,20 @@ void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight) void UndockThumbs(ThumbInfo *pThumb1, ThumbInfo *pThumb2) { - if (pThumb1 == NULL || pThumb2 == NULL) + if (pThumb1 == nullptr || pThumb2 == nullptr) return; if (pThumb1->dockOpt.hwndRight == pThumb2->hwnd) - pThumb1->dockOpt.hwndRight = NULL; + pThumb1->dockOpt.hwndRight = nullptr; if (pThumb1->dockOpt.hwndLeft == pThumb2->hwnd) - pThumb1->dockOpt.hwndLeft = NULL; + pThumb1->dockOpt.hwndLeft = nullptr; if (pThumb2->dockOpt.hwndRight == pThumb1->hwnd) - pThumb2->dockOpt.hwndRight = NULL; + pThumb2->dockOpt.hwndRight = nullptr; if (pThumb2->dockOpt.hwndLeft == pThumb1->hwnd) - pThumb2->dockOpt.hwndLeft = NULL; + pThumb2->dockOpt.hwndLeft = nullptr; } ///////////////////////////////////////////////////////////////////////////// @@ -740,16 +740,16 @@ ThumbList::~ThumbList() ThumbInfo *ThumbList::AddThumb(HWND hwnd, wchar_t *ptszName, MCONTACT hContact) { - if (ptszName == NULL || hContact == NULL || hwnd == NULL) - return NULL; + if (ptszName == nullptr || hContact == NULL || hwnd == nullptr) + return nullptr; ThumbInfo *pThumb = new ThumbInfo; wcsncpy_s(pThumb->ptszName, ptszName, _TRUNCATE); pThumb->hContact = hContact; pThumb->hwnd = hwnd; - pThumb->dockOpt.hwndLeft = NULL; - pThumb->dockOpt.hwndRight = NULL; + pThumb->dockOpt.hwndLeft = nullptr; + pThumb->dockOpt.hwndRight = nullptr; pThumb->fTipActive = FALSE; RegHotkey(hContact, hwnd); @@ -774,22 +774,22 @@ void ThumbList::RemoveThumb(ThumbInfo *pThumb) ThumbInfo* ThumbList::FindThumb(HWND hwnd) { - if (!hwnd) return NULL; + if (!hwnd) return nullptr; for (int i = 0; i < getCount(); ++i) if (items[i]->hwnd == hwnd) return items[i]; - return NULL; + return nullptr; } ThumbInfo *ThumbList::FindThumbByContact(MCONTACT hContact) { - if (!hContact) return NULL; + if (!hContact) return nullptr; for (int i = 0; i < getCount(); ++i) if (items[i]->hContact == hContact) return items[i]; - return NULL; + return nullptr; } diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 8f26cd0e7e..806b0972c7 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -PFolderItem lastItem = NULL; +PFolderItem lastItem = nullptr; static int bInitializing = 0; @@ -8,7 +8,7 @@ static PFolderItem GetSelectedItem(HWND hWnd) { int index = SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETCURSEL, 0, 0); if (index == LB_ERR) - return NULL; + return nullptr; return (PFolderItem)SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETITEMDATA, index, 0); } @@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) { case WM_INITDIALOG: - lastItem = NULL; + lastItem = nullptr; TranslateDialogDefault(hWnd); bInitializing = 1; LoadRegisteredFolderSections(hWnd); @@ -204,7 +204,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case LBN_SELCHANGE: CheckForChanges(hWnd); LoadRegisteredFolderItems(hWnd); - lastItem = NULL; + lastItem = nullptr; SetEditText(hWnd, L""); RefreshPreview(hWnd); } @@ -214,7 +214,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (HIWORD(wParam)) { case LBN_SELCHANGE: item = GetSelectedItem(hWnd); - if (item != NULL) { + if (item != nullptr) { CheckForChanges(hWnd); LoadItem(hWnd, item); } diff --git a/plugins/Folders/src/events.cpp b/plugins/Folders/src/events.cpp index db9bd46c1d..ae9616333c 100644 --- a/plugins/Folders/src/events.cpp +++ b/plugins/Folders/src/events.cpp @@ -31,7 +31,7 @@ int InitEvents() int DestroyEvents() { DestroyHookableEvent(hPathChanged); - hPathChanged = 0; + hPathChanged = nullptr; return 0; } diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index f277a27ec3..0b86c2c357 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -28,8 +28,8 @@ CFolderItem::CFolderItem(const char *sectionName, const char *name, const wchar_ m_tszUserName = mir_wstrdup(userName); else m_tszUserName = mir_a2u(name); - m_tszFormat = NULL; - m_tszOldFormat = NULL; + m_tszFormat = nullptr; + m_tszOldFormat = nullptr; GetDataFromDatabase(format); FolderCreateDirectory(); } @@ -84,13 +84,13 @@ void CFolderItem::Save() int CFolderItem::FolderCreateDirectory(int showFolder) { - if (m_tszFormat == NULL) + if (m_tszFormat == nullptr) return FOLDER_SUCCESS; CMStringW buffer(ExpandPath(m_tszFormat)); CreateDirectoryTreeW(buffer); if (showFolder) - ShellExecute(NULL, L"explore", buffer, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"explore", buffer, nullptr, nullptr, SW_SHOW); return (DirectoryExists(buffer)) ? FOLDER_SUCCESS : FOLDER_FAILURE; } @@ -107,7 +107,7 @@ int CFolderItem::FolderDeleteOldDirectory(int showFolder) RemoveDirectories(buffer); int res = (DirectoryExists(buffer)) ? FOLDER_FAILURE : FOLDER_SUCCESS; if ((res == FOLDER_FAILURE) && (showFolder)) - ShellExecute(NULL, L"explore", buffer, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"explore", buffer, nullptr, nullptr, SW_SHOW); return res; } diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 7dab3adde6..cba24efd33 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -30,7 +30,7 @@ wchar_t szUserDataPath[MAX_FOLDERS_PATH]; INT_PTR RegisterPathService(WPARAM, LPARAM lParam) { FOLDERSDATA *data = (FOLDERSDATA*)lParam; - if (data == NULL) + if (data == nullptr) return NULL; if (data->cbSize != sizeof(FOLDERSDATA)) diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index fbcdc83e57..e2d5af213a 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -7,7 +7,7 @@ void CheckMailInbox(Account *curAcc) { // internet connection handle // internet request handle - HINTERNET hHTTPConnection = 0, hHTTPRequest = 0; + HINTERNET hHTTPConnection = nullptr, hHTTPRequest = nullptr; DBVARIANT dbv; static char *contentType = "Content-Type: application/x-www-form-urlencoded"; @@ -49,8 +49,8 @@ void CheckMailInbox(Account *curAcc) hHTTPConnection = InternetConnectA(hHTTPOpen, "www.google.com", INTERNET_DEFAULT_HTTPS_PORT, - NULL, - NULL, + nullptr, + nullptr, INTERNET_SERVICE_HTTP, 0, 0); @@ -62,7 +62,7 @@ void CheckMailInbox(Account *curAcc) mir_strcpy(str, "/a/"); mir_strcat(str, curAcc->hosted); mir_strcat(str, "/LoginAction"); - hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0); + hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, nullptr, nullptr, INTERNET_FLAG_SECURE, 0); mir_strcat(requestBuffer, curAcc->hosted); mir_strcat(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName="); mir_strcat(requestBuffer, curAcc->name); @@ -77,10 +77,10 @@ void CheckMailInbox(Account *curAcc) InternetCloseHandle(hHTTPConnection); InternetCloseHandle(hHTTPRequest); - hHTTPRequest = 0; + hHTTPRequest = nullptr; } - hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, nullptr, nullptr, INTERNET_SERVICE_HTTP, 0, 0); if (!hHTTPConnection) { mir_strcat(curAcc->results.content, Translate("Can't reach server!")); goto error_handle; @@ -92,10 +92,10 @@ void CheckMailInbox(Account *curAcc) } else mir_strcpy(str, "/mail/feed/atom"); - hHTTPRequest = HttpOpenRequest(hHTTPConnection, L"GET", _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0); + hHTTPRequest = HttpOpenRequest(hHTTPConnection, L"GET", _A2T(str), nullptr, nullptr, nullptr, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0); InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)mir_strlen(curAcc->name) + 1); InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)mir_strlen(curAcc->pass) + 1); - if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) { + if (!HttpSendRequest(hHTTPRequest, nullptr, 0, nullptr, 0)) { mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!")); goto error_handle; } @@ -154,7 +154,7 @@ int ParsePage(char *page, resultLink *prst) int num = 0; wchar_t str[64]; - prst->next = NULL; + prst->next = nullptr; if (strstr(page, "Unauthorized")) return -1; if (!(str_head = strstr(page, ""))) @@ -180,9 +180,9 @@ int ParsePage(char *page, resultLink *prst) mir_strcpy(prst->content, name); mir_strcat(prst->content, title); MultiByteToWideChar(CP_UTF8, 0, prst->content, -1, str, 64); - WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, nullptr, nullptr); num++; } - prst->next = NULL; + prst->next = nullptr; return num; } diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index d2912d2082..451c125205 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -130,7 +130,7 @@ extern "C" int __declspec(dllexport) Load() for (int i = 0; i < acc_num; i++) db_set_dw(acc[i].hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); - hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc); + hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc); hMirandaStarted = HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart); hOptionsInitial = HookEvent(ME_OPT_INITIALISE, OptInit); @@ -154,7 +154,7 @@ extern "C" int __declspec(dllexport) Load() extern "C" int __declspec(dllexport) Unload(void) { if (hTimer) - KillTimer(NULL, hTimer); + KillTimer(nullptr, hTimer); for (int i = 0; i < acc_num; i++) DeleteResults(acc[i].results.next); free(acc); diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index 7e90749477..e49421dc5d 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -14,7 +14,7 @@ int OpenBrowser(WPARAM hContact, LPARAM) db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); curAcc->oldResults_num = 0; DeleteResults(curAcc->results.next); - curAcc->results.next = NULL; + curAcc->results.next = nullptr; } mir_forkthread(Login_ThreadFunc, curAcc); } @@ -44,7 +44,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case WM_CONTEXTMENU: PUDeletePopup(hWnd); - curAcc->popUpHwnd = NULL; + curAcc->popUpHwnd = nullptr; pcli->pfnRemoveEvent(hContact, 1); } return DefWindowProc(hWnd, message, wParam, lParam); @@ -76,7 +76,7 @@ void NotifyUser(Account *curAcc) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_READ; dbei.szModule = MODULE_NAME; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); resultLink *prst = curAcc->results.next; for (int i = 0; i < newMails; i++) { @@ -114,7 +114,7 @@ void NotifyUser(Account *curAcc) ppd.colorBack = opt.popupBgColor; ppd.colorText = opt.popupTxtColor; ppd.PluginWindowProc = PopupDlgProc; - ppd.PluginData = NULL; + ppd.PluginData = nullptr; ppd.iSeconds = opt.popupDuration; PUDeletePopup(curAcc->popUpHwnd); PUAddPopup(&ppd); @@ -124,13 +124,13 @@ void NotifyUser(Account *curAcc) } curAcc->oldResults_num = curAcc->results_num; DeleteResults(curAcc->results.next); - curAcc->results.next = NULL; + curAcc->results.next = nullptr; } void DeleteResults(resultLink *prst) { - if (prst != NULL) { - if (prst->next != NULL) + if (prst != nullptr) { + if (prst->next != nullptr) DeleteResults(prst->next); free(prst); } @@ -138,7 +138,7 @@ void DeleteResults(resultLink *prst) void __cdecl Login_ThreadFunc(void *lpParam) { - if (lpParam == NULL) + if (lpParam == nullptr) return; HANDLE hTempFile; @@ -165,7 +165,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) GetTempPathA(dwBufSize, buffer); GetTempFileNameA(buffer, "gmail", 0, szTempName); - hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); mir_strcpy(buffer, FORMDATA1); mir_strcat(buffer, curAcc->hosted); mir_strcat(buffer, FORMDATA2); @@ -173,12 +173,12 @@ void __cdecl Login_ThreadFunc(void *lpParam) mir_strcat(buffer, FORMDATA3); mir_strcat(buffer, ""); - WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, NULL); + WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, nullptr); CloseHandle(hTempFile); mir_strcat(lpPathBuffer, szTempName); } @@ -199,7 +199,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) PROCESS_INFORMATION procInfo; suInfo.cb = sizeof(suInfo); suInfo.wShowWindow = SW_MAXIMIZE; - if (CreateProcessA(NULL, lpPathBuffer, NULL, NULL, FALSE, 0, NULL, NULL, &suInfo, &procInfo)) + if (CreateProcessA(nullptr, lpPathBuffer, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &suInfo, &procInfo)) CloseHandle(procInfo.hProcess); if (curAcc->hosted[0]) { diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index aa5be0f448..4978d80214 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -163,7 +163,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA acc_num--; SendMessage(hwndCombo, CB_DELETESTRING, curIndex, 0); DeleteResults(acc[curIndex].results.next); - acc[curIndex].results.next = NULL; + acc[curIndex].results.next = nullptr; db_delete_contact(acc[curIndex].hContact); for (int i = curIndex; i < acc_num; i++) acc[i] = acc[i + 1]; @@ -198,10 +198,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: SaveButton(hwndDlg,hwndCombo, curIndex); - opt.circleTime = GetDlgItemInt(hwndDlg, IDC_CIRCLE, NULL, FALSE); + opt.circleTime = GetDlgItemInt(hwndDlg, IDC_CIRCLE, nullptr, FALSE); if (opt.circleTime > 0) { - KillTimer(NULL, hTimer); - hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc); + KillTimer(nullptr, hTimer); + hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc); db_set_dw(NULL, MODULE_NAME, "circleTime", opt.circleTime); } opt.notifierOnTray = IsDlgButtonChecked(hwndDlg, IDC_OPTTRAY); @@ -209,7 +209,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA db_set_dw(NULL, MODULE_NAME, "notifierOnTray", opt.notifierOnTray); db_set_dw(NULL, MODULE_NAME, "notifierOnPop", opt.notifierOnPop); - opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, NULL, TRUE); + opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, nullptr, TRUE); db_set_dw(NULL, MODULE_NAME, "popupDuration", opt.popupDuration); opt.popupBgColor = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor); diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 9aa00d8e79..eb243b8f57 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -32,7 +32,7 @@ void BuildList(void) BOOL GetBrowser(char *str) { - HKEY hKey = NULL; + HKEY hKey = nullptr; char *strKey; char strIE[] = "Applications\\iexplore.exe\\shell\\open\\command"; char strDefault[] = "https\\shell\\open\\command"; @@ -56,11 +56,11 @@ BOOL GetBrowser(char *str) // Data size DWORD cbData = 0; // Get the default value - if (RegQueryValueExA(hKey, NULL, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS && cbData > 0) { - if (RegQueryValueExA(hKey, NULL, NULL, NULL, (LPBYTE)str, &cbData) == ERROR_SUCCESS) { - if ((strKey = strstr(str, "%1")) != NULL) + if (RegQueryValueExA(hKey, nullptr, nullptr, nullptr, nullptr, &cbData) == ERROR_SUCCESS && cbData > 0) { + if (RegQueryValueExA(hKey, nullptr, nullptr, nullptr, (LPBYTE)str, &cbData) == ERROR_SUCCESS) { + if ((strKey = strstr(str, "%1")) != nullptr) *(strKey--) = '\0'; - if ((strKey = strstr(str, "-")) != NULL) + if ((strKey = strstr(str, "-")) != nullptr) *(strKey--) = '\0'; RegCloseKey(hKey); return TRUE; @@ -76,5 +76,5 @@ Account* GetAccountByContact(MCONTACT hContact) if (acc[i].hContact == hContact) return &acc[i]; - return NULL; + return nullptr; } \ No newline at end of file diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index a23f0c6fe4..939c46f364 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -18,7 +18,7 @@ #include "Glob.h" -CLFileShareNode * pclFirstNode = NULL; +CLFileShareNode * pclFirstNode = nullptr; mir_cs csFileShareListAccess; @@ -40,7 +40,7 @@ CLShareUser::CLShareUser(HNETLIBCONN hCon, in_addr stAdd) { hConnection = hCon; stAddr = stAdd; - pclNext = NULL; + pclNext = nullptr; dwTotalSize = 0; dwCurrentDL = 0; dwSpeed = 0; @@ -132,8 +132,8 @@ CLFileShareNode::CLFileShareNode(char * pszSrvPath, char * pszRealPath) { memset(&st, 0, sizeof(STFileShareInfo)); st.lStructSize = sizeof(STFileShareInfo); - pclNext = NULL; - pclCurrentUsers = NULL; + pclNext = nullptr; + pclCurrentUsers = nullptr; bSetPaths(pszSrvPath, pszRealPath); } @@ -155,8 +155,8 @@ CLFileShareNode::CLFileShareNode(STFileShareInfo * pstInfo) { memset(&st, 0, sizeof(STFileShareInfo)); st.lStructSize = sizeof(STFileShareInfo); - pclNext = NULL; - pclCurrentUsers = NULL; + pclNext = nullptr; + pclCurrentUsers = nullptr; bSetInfo(pstInfo); } diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 3335b489a2..5e1134b2c9 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -22,15 +22,15 @@ #define WM_RELOAD_STATISTICS (WM_USER+10) -static HANDLE hShareNewFileService = 0; -static HANDLE hShowStatisticsViewService = 0; +static HANDLE hShareNewFileService = nullptr; +static HANDLE hShowStatisticsViewService = nullptr; -static HANDLE hShareNewFileMenuItem = 0; -static HANDLE hShowStatisticsViewMenuItem = 0; +static HANDLE hShareNewFileMenuItem = nullptr; +static HANDLE hShowStatisticsViewMenuItem = nullptr; -static HANDLE hEventOptionsInitialize = 0; +static HANDLE hEventOptionsInitialize = nullptr; -HWND hwndStatsticView = 0; +HWND hwndStatsticView = nullptr; bool bLastAutoRefress = false; HANDLE hMainThread; @@ -99,7 +99,7 @@ string DBGetString(MCONTACT hContact, const char *szModule, const char *szSettin DBVARIANT dbv = { 0 }; if (!db_get(hContact, szModule, szSetting, &dbv)) { if (dbv.type != DBVT_ASCIIZ) { - MessageBox(NULL, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK); ret = pszError; } else ret = dbv.pszVal; @@ -146,7 +146,7 @@ void UpdateStatisticsView() unsigned long GetExternIP(const char *szURL, const char *szPattern) { - HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(0, IDC_WAIT)); + HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(nullptr, IDC_WAIT)); NETLIBHTTPREQUEST nlhr; memset(&nlhr, 0, sizeof(nlhr)); @@ -163,7 +163,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) { nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated char * pszIp = strstr(nlreply->pData, szPattern); - if (pszIp == NULL) + if (pszIp == nullptr) pszIp = nlreply->pData; else pszIp += mir_strlen(szPattern); @@ -319,7 +319,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( } pszTmp = strchr(szSelection, ':'); - if (pszTmp != NULL) + if (pszTmp != nullptr) *pszTmp = '\0'; memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1); @@ -472,7 +472,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) if (dwError) { char szTemp[200]; mir_snprintf(szTemp, "Failed to create File Open dialog the error returned was %d", dwError); - MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK); } return false; } @@ -505,7 +505,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0'; if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) { - MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } pszFileNamePos++; @@ -516,7 +516,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) } else { if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) { - MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } } @@ -636,7 +636,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) if (bLastAutoRefress != bAutoRefress) { if (bAutoRefress) - SetTimer(hwndDlg, 0, 1000, NULL); + SetTimer(hwndDlg, 0, 1000, nullptr); else KillTimer(hwndDlg, 0); bLastAutoRefress = bAutoRefress; @@ -664,14 +664,14 @@ void SetWindowsCtrls(HWND hwndDlg) const int nSpacing = 8; int nCtrlHight = (rNewSize.bottom - (nSpacing * 3)) / 3 - 20; - SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), 0, + SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), nullptr, nSpacing, 35, rNewSize.right - (nSpacing * 2), nCtrlHight * 2, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), 0, + SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), nullptr, nSpacing, (nSpacing * 2) + nCtrlHight * 2 + 25, rNewSize.right - (nSpacing * 2), @@ -778,7 +778,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE; case WM_DESTROY: - hwndStatsticView = NULL; + hwndStatsticView = nullptr; return 0; case WM_DROPFILES: @@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara char szDropedFile[MAX_PATH]; char szServPath[MAX_PATH] = { 0 }; - int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); + int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0); for (int i = 0; i < nLen; i++) { DragQueryFile(hDrop, i, szDropedFile, sizeof(szDropedFile)); @@ -805,7 +805,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2); if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) { - MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK); return false; } } @@ -852,7 +852,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara TranslateMenu(hMenu); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, - pt.x, pt.y, 0, hwndDlg, NULL); + pt.x, pt.y, 0, hwndDlg, nullptr); DestroyMenu(hMainMenu); } @@ -1077,7 +1077,7 @@ static INT_PTR nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) BringWindowToTop(hwndStatsticView); return 0; } - hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), NULL, DlgProcStatsticView, (LPARAM)NULL); + hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), nullptr, DlgProcStatsticView, (LPARAM)NULL); ShowWindow(hwndStatsticView, SW_SHOWNORMAL); return 0; } @@ -1492,7 +1492,7 @@ void InitGuiElements() hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); if (!hEventOptionsInitialize) - MessageBox(NULL, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK); bShowPopups = db_get_b(NULL, MODULE, "ShowPopups", bShowPopups) != 0; } diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index 3ceb656f77..db86533b7f 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -442,7 +442,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) * pszTmp = '\\'; hFile = CreateFile(pszRealPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { if (pszSrvPath[mir_strlen(pszSrvPath) - 1] != '/') { @@ -454,14 +454,14 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) strmcat(szRealPath, "index.htm", MAX_PATH); hFile = CreateFile(pszRealPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr); if (hFile == INVALID_HANDLE_VALUE) { // a directory with index.html strmcat(szRealPath, "l", MAX_PATH); hFile = CreateFile(pszRealPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr); if (hFile == INVALID_HANDLE_VALUE) { // generate directory index in temporary file @@ -486,7 +486,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) (indexCreationMode == INDEX_CREATION_DETECT && BrowserSupportsXML)) && bCreateIndexXML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) { hFile = CreateFile(szTempfile, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); mir_strcpy(szRealPath, "a.xml"); // restore .xml for mime type } @@ -494,7 +494,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) indexCreationMode == INDEX_CREATION_DETECT) && bCreateIndexHTML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) { hFile = CreateFile(szTempfile, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); mir_strcpy(szRealPath, "a.html"); // restore .html for mime type } @@ -518,7 +518,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) } else { hFile = CreateFile(pszRealPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { SendError(404, "Not Found", "HTTP server failed to open local file"); @@ -528,11 +528,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) mir_strcpy(this->szCurrentDLSrvPath, pszSrvPath); - DWORD nDataSize = GetFileSize(hFile, NULL); + DWORD nDataSize = GetFileSize(hFile, nullptr); dwTotalSize = nDataSize; FILETIME stFileTime; - GetFileTime(hFile, NULL, NULL, &stFileTime); + GetFileTime(hFile, nullptr, nullptr, &stFileTime); char szCurTime[100]; time_t ltime; @@ -557,7 +557,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) } if (*(ULONG*)(&stAddr) != 0x0100007F && // do not show popup of 127.0.0.1 - strstr(pszRealPath, "\\@") == NULL) { // and of shares which start with an @ + strstr(pszRealPath, "\\@") == nullptr) { // and of shares which start with an @ ShowPopupWindow(inet_ntoa(stAddr), pszSrvPath); } @@ -623,7 +623,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) char szBuf[1460 * 4]; if (dwFileStart > 0 || dwDataToSend != nDataSize) { - if (SetFilePointer(hFile, dwFileStart, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) { + if (SetFilePointer(hFile, dwFileStart, nullptr, FILE_BEGIN) == INVALID_SET_FILE_POINTER) { SendError(416, "Requested Range Not Satisfiable"); return true; } @@ -700,7 +700,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) if (bSpeedLimit) dwCurOpr = min(nMaxBytesToSend, sizeof(szBuf)); - if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, NULL)) + if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, nullptr)) break; if (dwBytesToWrite <= 0) diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index cd7687330c..c32f782f81 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -19,7 +19,7 @@ eIndexCreationMode indexCreationMode; -static char* szIndexHTMLTemplate = NULL; +static char* szIndexHTMLTemplate = nullptr; static const int MAX_PARAM_LENGTH = 5; // signs below 32 are not used anyway @@ -55,7 +55,7 @@ enum Symbol bool LoadIndexHTMLTemplate() { - if (szIndexHTMLTemplate != NULL) + if (szIndexHTMLTemplate != nullptr) return true; char szBuf[10000]; @@ -67,14 +67,14 @@ bool LoadIndexHTMLTemplate() mir_snprintf(szBuf, "%s%s", szPluginPath, szIndexHTMLTemplateFile); HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK); return false; } DWORD dwBytesRead = 0; - if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, NULL) || dwBytesRead <= 0) { + if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, nullptr) || dwBytesRead <= 0) { while (dwBytesRead > (DWORD)(pszBuf - szBuf)) { if (*pszBuf == '[') { char* pszKeywordBegin = pszBuf + 1; @@ -259,9 +259,9 @@ bool LoadIndexHTMLTemplate() void FreeIndexHTMLTemplate() { - if (szIndexHTMLTemplate != NULL) { + if (szIndexHTMLTemplate != nullptr) { delete[] szIndexHTMLTemplate; - szIndexHTMLTemplate = NULL; + szIndexHTMLTemplate = nullptr; } } @@ -283,7 +283,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, { #define RelativeJump(begin) { pszPos += *((WORD*)(begin+1)) & 0x7FFF; } - if (szIndexHTMLTemplate == NULL) + if (szIndexHTMLTemplate == nullptr) return false; // check if directory exists @@ -297,10 +297,10 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, return FALSE; FindClose(hFind); - hFind = 0; + hFind = nullptr; HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL); + nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr); if (hFile == INVALID_HANDLE_VALUE) return FALSE; @@ -339,12 +339,12 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, switch (*pszPos) { case SY_FOR_FILES: case SY_FOR_DIRS: - if (hFind == 0) { + if (hFind == nullptr) { pszLevelBegin[iLevel++] = pszPos; iCurrentAction = *pszPos; hFind = FindFirstFile(szMask, &fdFindFileData); - if (hFind == 0) { + if (hFind == nullptr) { iCurrentAction = 0; RelativeJump(pszLevelBegin[iLevel - 1]); break; @@ -353,7 +353,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, else { if (!FindNextFile(hFind, &fdFindFileData)) { FindClose(hFind); - hFind = 0; + hFind = nullptr; iCurrentAction = 0; RelativeJump(pszLevelBegin[iLevel - 1]); break; @@ -366,7 +366,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, ((*pszPos == 19) == ((fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0))) { if (!FindNextFile(hFind, &fdFindFileData)) { FindClose(hFind); - hFind = 0; + hFind = nullptr; iCurrentAction = 0; RelativeJump(pszLevelBegin[iLevel - 1]); break; @@ -503,14 +503,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, // flush the buffer from time to time if (*pszPos == '\0' || pszBuffer - szBuffer > 8000) { - if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) + if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr)) break; pszBuffer = szBuffer; } } while (*pszPos != '\0'); - if (hFind != 0) + if (hFind != nullptr) FindClose(hFind); SetEndOfFile(hFile); diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index c258832321..ea94a2cadc 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -73,8 +73,8 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const if (hFind == INVALID_HANDLE_VALUE) return FALSE; - HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, - OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL); + HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, + OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr); if (hFile == INVALID_HANDLE_VALUE) { FindClose(hFind); @@ -99,14 +99,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncpy(szFileName, pszTemp + 1, MAX_PATH); // Write Header - WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL); + WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, nullptr); // check if a index.xsl exists in the same directory otherwise use the global mir_snprintf(szMask, "%s%s", pszRealPath, "index.xsl"); HANDLE hFileExists = CreateFile(szMask, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, nullptr); if (hFileExists == INVALID_HANDLE_VALUE) { strncpy(szBuffer, "/index.xsl", BUFFER_SIZE); @@ -116,15 +116,15 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncpy(szBuffer, "index.xsl", BUFFER_SIZE); } - WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL); + WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, nullptr); - WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL); + WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, nullptr); // Write dirname ReplaceSign(szFileName, MAX_PATH, '&', "&"); pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " %s\r\n", szFileName); - WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL); + WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr); // Find files and directories do { @@ -143,14 +143,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const else { pszExt = strrchr(szFileName, '.'); - if (pszExt != NULL) { + if (pszExt != nullptr) { *pszExt = '\0'; pszExt++; } pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n"); } - if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) + if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr)) break; } } while (FindNextFile(hFind, &fdFindFileData)); - if (hFind != 0) + if (hFind != nullptr) FindClose(hFind); // Add other shared files & directories @@ -195,7 +195,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n", szFileName); - if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) + if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr)) break; } } @@ -204,7 +204,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const strncmp(pszRealPath, pclCur->st.pszRealPath, mir_strlen(pszRealPath))) { // no duplicates pszExt = strrchr(szFileName, '.'); - if (pszExt != NULL) { + if (pszExt != nullptr) { *pszExt = '\0'; pszExt++; } @@ -214,16 +214,16 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const FILETIME ftFileAccessTime; FILETIME ftFileModifyTime; HANDLE hFileS = CreateFile(pclCur->st.pszRealPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFileS != INVALID_HANDLE_VALUE) { - dwFileSize = GetFileSize(hFileS, NULL); + dwFileSize = GetFileSize(hFileS, nullptr); GetFileTime(hFileS, &ftFileCreateTime, &ftFileAccessTime, &ftFileModifyTime); CloseHandle(hFileS); } pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n"); - if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL)) + if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr)) break; } } } } - WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, NULL); + WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, nullptr); SetEndOfFile(hFile); CloseHandle(hFile); diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 78f8c3c91c..56ec7a320f 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -1,7 +1,7 @@ #include "Glob.h" /* MIME type/ext map */ -ContentTypeDB MIME = NULL; +ContentTypeDB MIME = nullptr; /* Default Mime type when recognition fails */ char DefaultMime[] = "application/octet-stream"; @@ -9,18 +9,18 @@ int bInitMimeHandling() { FILE *mimeDB; char line[LINE_MAX_SIZE]; - char *tok = NULL; - ContentType *pDBCell = NULL; - ContentTypeDB pDB = NULL; - ExtensionList extListCur = NULL; - ExtensionListCell *pExtCell = NULL; + char *tok = nullptr; + ContentType *pDBCell = nullptr; + ContentTypeDB pDB = nullptr; + ExtensionList extListCur = nullptr; + ExtensionListCell *pExtCell = nullptr; char szBuf[10000]; mir_strcpy(szBuf, szPluginPath); mir_strcat(szBuf, szMimeTypeConfigFile); mimeDB = fopen(szBuf, "r"); - if (mimeDB != NULL) { + if (mimeDB != nullptr) { while (fgets(line, LINE_MAX_SIZE, mimeDB)) { /*filter junk lines assuming Mime type start with letter (convention ?) */ @@ -28,7 +28,7 @@ int bInitMimeHandling() || (line[0] <= 'Z' && line[0] >= 'A')) { /*remove comments trailing comments*/ tok = strrchr(line, '#'); - if (tok != NULL) { + if (tok != nullptr) { *tok = '\0'; } /* remove trailing \n */ @@ -42,29 +42,29 @@ int bInitMimeHandling() pDBCell = (ContentType*)malloc(sizeof(ContentType)); pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1); mir_strcpy(pDBCell->mimeType, tok); - pDBCell->extList = NULL; - pDBCell->next = NULL; + pDBCell->extList = nullptr; + pDBCell->next = nullptr; /* looking for extensions */ - tok = (char*)strtok(NULL, " \t"); - while (tok != NULL) { + tok = (char*)strtok(nullptr, " \t"); + while (tok != nullptr) { /*create and fill a cell*/ pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell)); pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1); mir_strcpy(pExtCell->ext, tok); - pExtCell->next = NULL; + pExtCell->next = nullptr; /*link*/ - if (pDBCell->extList == NULL) { + if (pDBCell->extList == nullptr) { pDBCell->extList = pExtCell; } else { extListCur->next = pExtCell; } extListCur = pExtCell; - tok = (char*)strtok(NULL, " \t"); + tok = (char*)strtok(nullptr, " \t"); } /* link */ - if (pDBCell->extList != NULL) { /*extension(s) found*/ - if (MIME == NULL) { + if (pDBCell->extList != nullptr) { /*extension(s) found*/ + if (MIME == nullptr) { MIME = pDBCell; } else { @@ -81,7 +81,7 @@ int bInitMimeHandling() fclose(mimeDB); } - if (MIME == NULL) { + if (MIME == nullptr) { return 0; } return 1; @@ -95,7 +95,7 @@ const char* pszGetMimeType(const char * pszFileName) ext = strrchr(pszFileName, '.'); - if (ext != NULL) { + if (ext != nullptr) { if (ext[1] == '\0') { /*empty extension */ return DefaultMime; @@ -106,9 +106,9 @@ const char* pszGetMimeType(const char * pszFileName) } courMIME = MIME; - while (courMIME != NULL) { + while (courMIME != nullptr) { courEXT = courMIME->extList; - while (courEXT != NULL) { + while (courEXT != nullptr) { if (!_stricmp(courEXT->ext, ext)) { return courMIME->mimeType; } diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index a6126e8f51..fb821023f6 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -39,7 +39,7 @@ const char* pszDefaultShares[] = { "htdocs\\@settings\\index.xsl", "/index.xsl", "htdocs\\@settings\\theme\\", "/theme/", "htdocs\\", "/", - 0, 0 + nullptr, nullptr }; void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP); @@ -48,21 +48,21 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/); HNETLIBUSER hNetlibUser; HANDLE hDirectBoundPort; -HINSTANCE hInstance = NULL; +HINSTANCE hInstance = nullptr; CLIST_INTERFACE *pcli; string sLogFilePath; // static so they can not be used from other modules ( sourcefiles ) -static HANDLE hEventSystemInit = 0; -static HANDLE hPreShutdown = 0; +static HANDLE hEventSystemInit = nullptr; +static HANDLE hPreShutdown = nullptr; -static HANDLE hHttpAcceptConnectionsService = 0; -static HANDLE hHttpAddChangeRemoveService = 0; -static HANDLE hHttpGetShareService = 0; -static HANDLE hHttpGetAllShares = 0; +static HANDLE hHttpAcceptConnectionsService = nullptr; +static HANDLE hHttpAddChangeRemoveService = nullptr; +static HANDLE hHttpGetShareService = nullptr; +static HANDLE hHttpGetAllShares = nullptr; -static HGENMENU hAcceptConnectionsMenuItem = 0; +static HGENMENU hAcceptConnectionsMenuItem = nullptr; char szPluginPath[MAX_PATH] = { 0 }; int nPluginPathLen = 0; @@ -77,7 +77,7 @@ int nMaxConnectionsPerUser = -1; int nDefaultDownloadLimit = -1; bool bIsOnline = true; -static HANDLE hEventProtoAck = 0; +static HANDLE hEventProtoAck = nullptr; bool bLimitOnlyWhenOnline = true; @@ -121,7 +121,7 @@ bool bOpenLogFile() SHELLEXECUTEINFO st = { 0 }; st.cbSize = sizeof(st); st.fMask = SEE_MASK_INVOKEIDLIST; - st.hwnd = NULL; + st.hwnd = nullptr; st.lpFile = sLogFilePath.c_str(); st.nShow = SW_SHOWDEFAULT; ShellExecuteEx(&st); @@ -134,7 +134,7 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) if (nLen < 0) nLen = (int)mir_strlen(pszSrc); DWORD dwBytesWritten; - return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen); + return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (DWORD)nLen); } @@ -154,13 +154,13 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) void LogEvent(const char * pszTitle, const char * pszLog) { - HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK); return; } - if (SetFilePointer(hFile, 0, 0, FILE_END) == INVALID_SET_FILE_POINTER) { - MessageBox(NULL, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK); + if (SetFilePointer(hFile, 0, nullptr, FILE_END) == INVALID_SET_FILE_POINTER) { + MessageBox(nullptr, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK); CloseHandle(hFile); return; } @@ -179,7 +179,7 @@ void LogEvent(const char * pszTitle, const char * pszLog) !bWriteToFile(hFile, " : ") || !bWriteToFile(hFile, pszLog, nLogLen) || !bWriteToFile(hFile, "\r\n")) { - MessageBox(NULL, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK); } CloseHandle(hFile); } @@ -232,13 +232,13 @@ bool bReadConfigurationFile() { CLFileShareListAccess clCritSection; - CLFileShareNode * pclLastNode = NULL; + CLFileShareNode * pclLastNode = nullptr; char szBuf[1000]; mir_strcpy(szBuf, szPluginPath); mir_strcat(szBuf, szConfigFile); HANDLE hFile = CreateFile(szBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) return false; @@ -257,14 +257,14 @@ bool bReadConfigurationFile() // append data to buffer DWORD dwBytesRead = 0; bEof = !ReadFile(hFile, &szBuf[dwBytesInBuffer], sizeof(szBuf) - dwBytesInBuffer, - &dwBytesRead, NULL) || dwBytesRead <= 0; + &dwBytesRead, nullptr) || dwBytesRead <= 0; pszCurPos = szBuf; if (pszCurPos) { - while (pszCurPos && (pszCurPos = strstr(pszCurPos, "")) != NULL) { + while (pszCurPos && (pszCurPos = strstr(pszCurPos, "")) != nullptr) { pszCurPos += 7; - char * pszColData[5] = { NULL }; + char * pszColData[5] = {}; for (int n = 0; n < 5; n++) { pszColData[n] = strstr(pszCurPos, ">"); if (!pszColData[n]) @@ -339,17 +339,17 @@ bool bWriteConfigurationFile() char szBuf[1000], temp[200]; mir_strcpy(szBuf, szPluginPath); mir_strcat(szBuf, szConfigFile); - HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { mir_snprintf(temp, "%s%s", Translate("Failed to open or create file "), szConfigFile); - MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK); return false; } DWORD dwBytesWriten = 0; - if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, NULL)) { + if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, nullptr)) { mir_snprintf(temp, "%s%s", TranslateT("Failed to write xml header to file "), szConfigFile); - MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK); } else { CLFileShareNode *pclCur = pclFirstNode; @@ -361,17 +361,17 @@ bool bWriteConfigurationFile() SplitIpAddress(pclCur->st.dwAllowedIP), SplitIpAddress(pclCur->st.dwAllowedMask)); - if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, NULL)) { + if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, nullptr)) { mir_snprintf(temp, "%s%s", Translate("Failed to write xml data to file "), szConfigFile); - MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK); break; } pclCur = pclCur->pclNext; } - if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, NULL)) { + if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, nullptr)) { mir_snprintf(temp, "%s%s", Translate("Failed to write xml tail to file "), szConfigFile); - MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK); } } SetEndOfFile(hFile); @@ -650,7 +650,7 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) char szTemp[200]; mir_snprintf(szTemp, Translate("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"), nlb.wPort == 80 ? "80" : nus.szIncomingPorts); - MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK); return 1001; } dwLocalPortUsed = nlb.wPort; @@ -660,13 +660,13 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) } else if (hDirectBoundPort && wparam == 0) { Netlib_CloseHandle(hDirectBoundPort); - hDirectBoundPort = 0; + hDirectBoundPort = nullptr; Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE))); } else return 0; // no changes; if (!bShutdownInProgress) - db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != 0); + db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != nullptr); return 0; } @@ -744,7 +744,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) nlu.szDescriptiveName.a = Translate("HTTP Server"); hNetlibUser = Netlib_RegisterUser(& nlu); if (!hNetlibUser) { - MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK); return 0; } @@ -810,7 +810,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) pclFirstNode = pclFirstNode->pclNext; delete pclCur; } - pclFirstNode = NULL; + pclFirstNode = nullptr; UnInitGuiElements(); @@ -858,49 +858,49 @@ extern "C" __declspec(dllexport) int Load() hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections); if (!hHttpAcceptConnectionsService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK); return 1; } hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare); if (!hHttpAddChangeRemoveService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK); return 1; } hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare); if (!hHttpGetShareService) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK); return 1; } hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares); if (!hHttpGetAllShares) { - MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK); return 1; } hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); if (!hEventSystemInit) { - MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK); return 1; } hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); if (!hPreShutdown) { - MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK); return 1; } if (Profile_GetPathA(MAX_PATH, szPluginPath)) { - MessageBox(NULL, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK); return 1; } mir_strncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_strlen(szPluginPath)); int err = CreateDirectoryTree(szPluginPath); if ((err != 0) && (err != ERROR_ALREADY_EXISTS)) { - MessageBox(NULL, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK); return 1; } @@ -910,7 +910,7 @@ extern "C" __declspec(dllexport) int Load() sLogFilePath += "HTTPServer.log"; if (!bInitMimeHandling()) - MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); + MessageBox(nullptr, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK); nMaxUploadSpeed = db_get_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed); nMaxConnectionsTotal = db_get_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal); diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index b64547ed7c..3c8a94d11a 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -67,12 +67,12 @@ extern "C" __declspec(dllexport) int Load(void) wndclass.lpfnWndProc = ProgressBarDlg; wndclass.hInstance = hInst; wndclass.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)); - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wndclass.lpszClassName = L"Progressbar"; RegisterClass(&wndclass); - splitCursor = LoadCursor(NULL, IDC_SIZENS); + splitCursor = LoadCursor(nullptr, IDC_SIZENS); HookEvent(ME_OPT_INITIALISE, InitOptionsDlg); HookEvent(ME_DB_EVENT_ADDED, DBUpdate); @@ -108,7 +108,7 @@ int InitOptionsDlg(WPARAM wParam, LPARAM) static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) { HWND hWnd = WindowList_Find(hWindowList, hContact); - if (hWnd != NULL) { + if (hWnd != nullptr) { SetForegroundWindow(hWnd); SetFocus(hWnd); int len = GetWindowTextLength(GetDlgItem(hWnd, IDC_MAIN)); @@ -118,7 +118,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) MEVENT hEvent = db_event_first(hContact); if (hEvent == NULL) { - MessageBox(NULL, TXT_EMPTYHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION)); + MessageBox(nullptr, TXT_EMPTYHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION)); return 0; } @@ -132,10 +132,10 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) RECT DesktopRect; GetWindowRect(GetDesktopWindow(), &DesktopRect); - HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL); - if (hWndProgress == NULL) { + HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr); + if (hWndProgress == nullptr) { mir_free(dbe.pBlob); - MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION ); + MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION ); return -1; } SetWindowPos(hWndProgress, HWND_TOP, (int)((DesktopRect.right / 2) - 175), (int)((DesktopRect.bottom / 2) - 22), 0, 0, SWP_NOSIZE); @@ -151,7 +151,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) if (ExtractURI(&dbe, hEvent, listStart) < 0) { mir_free(dbe.pBlob); RemoveList(listStart); - MessageBox(NULL, TranslateT("Could not allocate memory!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION); + MessageBox(nullptr, TranslateT("Could not allocate memory!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION); return -1; } } @@ -172,7 +172,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) SendMessage(hWndProgress, WM_CLOSE, 0, 0); if (ListCount(listStart) <= 0) { RemoveList(listStart); - MessageBox(NULL, TXT_NOLINKINHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION)); + MessageBox(nullptr, TXT_NOLINKINHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION)); return 0; } @@ -183,11 +183,11 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) DlgParam->chrg.cpMax = -1; DlgParam->chrg.cpMin = -1; - HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), NULL, MainDlgProc, (LPARAM)DlgParam); - if (hWndMain == NULL) { + HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), nullptr, MainDlgProc, (LPARAM)DlgParam); + if (hWndMain == nullptr) { mir_free(DlgParam); RemoveList(listStart); - MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), (MB_OK | MB_ICONEXCLAMATION)); + MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), (MB_OK | MB_ICONEXCLAMATION)); return -1; } diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index 563f2bc406..e039b792c8 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -88,7 +88,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) // This is used in srmm... and I think he knew what he did... :) SendDlgItemMessage(hDlg, IDC_MAIN, EM_LIMITTEXT, (WPARAM)-1, 0); - WriteLinkList(hDlg, WLL_ALL, (LISTELEMENT*)DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, WLL_ALL, (LISTELEMENT*)DlgParam->listStart, nullptr, 0); return TRUE; // open browser an load url if link is pressed @@ -114,12 +114,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_LBUTTONUP: link = (LPTSTR)mir_alloc((pENLink->chrg.cpMax - pENLink->chrg.cpMin + 2) * sizeof(wchar_t)); - if (link == NULL) + if (link == nullptr) break; SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&pENLink->chrg); SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETSELTEXT, 0, (LPARAM)link); - if (wcsstr(link, L"mailto:") != NULL) - ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); + if (wcsstr(link, L"mailto:") != nullptr) + ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL); else { bool openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF) != 0xFF; Utils_OpenUrlW(link, openNewWindow); @@ -138,7 +138,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) EnableMenuItem(hSubMenu, IDM_SHOWMESSAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); TranslateMenu(hSubMenu); link = (LPTSTR)mir_alloc((pENLink->chrg.cpMax - pENLink->chrg.cpMin + 4) * sizeof(wchar_t)); - if (link == NULL) + if (link == nullptr) break; SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&pENLink->chrg); SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETSELTEXT, 0, (LPARAM)link); @@ -147,17 +147,17 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) pt.y = (short)HIWORD(pENLink->lParam); ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr)) { case IDM_LINK_OPEN: - if (wcsstr(link, L"mailto:") != NULL) - ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); + if (wcsstr(link, L"mailto:") != nullptr) + ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL); else Utils_OpenUrlW(link, false); break; case IDM_LINK_OPENNEW: - if (wcsstr(link, L"mailto:") != NULL) - ShellExecute(HWND_TOP, NULL, link, NULL, NULL, SW_SHOWNORMAL); + if (wcsstr(link, L"mailto:") != nullptr) + ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL); else Utils_OpenUrlW(link); break; @@ -191,7 +191,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) listMenu = GetMenu(hDlg); switch (wParam) { case IDM_SEARCH: // open Search Box - if (DlgParam != 0) { + if (DlgParam != nullptr) { HWND hWndSearchDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCH_DLG), hDlg, SearchDlgProc, (LPARAM)DlgParam); EnableMenuItem(listMenu, IDM_SEARCH, (MF_BYCOMMAND | MF_DISABLED | MF_GRAYED)); ShowWindow(hWndSearchDlg, SW_SHOW); @@ -203,7 +203,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetFilterText(listMenu, filter, _countof(filter)); SetDlgItemText(hDlg, IDC_STATUS, filter); SetDlgItemText(hDlg, IDC_MAIN, L""); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); break; case IDM_SAVE: // save button @@ -224,12 +224,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L""); if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED) { CheckMenuItem(listMenu, IDM_DIR_IN, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } else { CheckMenuItem(listMenu, IDM_DIR_IN, MF_CHECKED); CheckMenuItem(listMenu, IDM_DIR_OUT, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } GetFilterText(GetMenu(hDlg), filter, _countof(filter)); SetDlgItemText(hDlg, IDC_STATUS, filter); @@ -243,12 +243,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L""); if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED) { CheckMenuItem(listMenu, IDM_DIR_OUT, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } else { CheckMenuItem(listMenu, IDM_DIR_OUT, MF_CHECKED); CheckMenuItem(listMenu, IDM_DIR_IN, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } GetFilterText(listMenu, filter, _countof(filter)); SetDlgItemText(hDlg, IDC_STATUS, filter); @@ -263,12 +263,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L""); if (GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_CHECKED) { CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } else { CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_CHECKED); CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } GetFilterText(listMenu, filter, _countof(filter)); SetDlgItemText(hDlg, IDC_STATUS, filter); @@ -280,12 +280,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_MAIN, L""); if (GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_CHECKED) { CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } else { CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_CHECKED); CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_UNCHECKED); - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0); } GetFilterText(listMenu, filter, _countof(filter)); SetDlgItemText(hDlg, IDC_STATUS, filter); @@ -311,8 +311,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: Utils_ResizeDialog(hDlg, hInst, MAKEINTRESOURCEA(IDD_MAIN_DLG), LinklistResizer, (LPARAM)DlgParam); // To get some scrollbars if needed... - RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), NULL, NULL, RDW_INVALIDATE); - RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), nullptr, nullptr, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), nullptr, nullptr, RDW_INVALIDATE); break; case DM_LINKSPLITTER: @@ -341,7 +341,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_DESTROY: - if (DlgParam != NULL) { + if (DlgParam != nullptr) { hContact = ((db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact); Utils_SaveWindowPosition(hDlg, hContact, LINKLIST_MODULE, "Linklist"); db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew); @@ -386,7 +386,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam wchar_t filter[FILTERTEXT]; HWND hListDlg = WindowList_Find(hWindowList, DlgParam->hContact); - if (hListDlg == NULL) + if (hListDlg == nullptr) break; SetDlgItemText(hListDlg, IDC_MAIN, L""); @@ -587,7 +587,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l else { int mCol = GetMirandaColour(&colourSet); if (mCol == 1) { - MessageBox(NULL, TXT_NOSETTING, TXT_ERROR, MB_OK | MB_ICONEXCLAMATION); + MessageBox(nullptr, TXT_NOSETTING, TXT_ERROR, MB_OK | MB_ICONEXCLAMATION); CheckDlgButton(hDlg, IDC_CHECK1, BST_UNCHECKED); break; } @@ -733,7 +733,7 @@ LRESULT CALLBACK ProgressBarDlg(HWND hwnd, UINT message, WPARAM wParam, LPARAM l switch (message) { case WM_CREATE: - hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, NULL, hInst, NULL); + hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, nullptr, hInst, nullptr); SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); return 0; diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 977b934ccd..21ad54c0a2 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -51,7 +51,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wchar_t templink[LINK_MAX + 1]; wchar_t dbdate[DATE_SIZE + TIME_SIZE]; - if (listStart == NULL) + if (listStart == nullptr) return -1; link[0] = 0; @@ -59,7 +59,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) time[0] = 0; msg = DbEvent_GetTextW(dbei, CP_ACP); - if (msg == NULL) + if (msg == nullptr) return 0; for (i = 0; msg[i]; ) { @@ -104,7 +104,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wordlen = (i - wordStart + 1); word = (LPTSTR)mir_alloc(wordlen * sizeof(wchar_t)); wordsearch = (LPTSTR)mir_alloc(wordlen * sizeof(wchar_t)); - if (word == NULL || wordsearch == NULL) { + if (word == nullptr || wordsearch == nullptr) { mir_free(word); mir_free(wordsearch); linkFound = -1; @@ -138,7 +138,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) } if (isLink && wordlen <= LINK_MAX) { - if (wcsstr(wordsearch, L"www.") != NULL && wcsstr(wordsearch, L"http://") == NULL && wcsstr(wordsearch, L"https://") == NULL) { + if (wcsstr(wordsearch, L"www.") != nullptr && wcsstr(wordsearch, L"http://") == nullptr && wcsstr(wordsearch, L"https://") == nullptr) { wcsncpy_s(link, L"http://", LINK_MAX); wcsncat_s(link, word, LINK_MAX); } else { @@ -147,7 +147,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) TimeZone_ToStringT(dbei->timestamp, L"d-t", dbdate, _countof(dbdate)); date_ptr = wcstok_s(dbdate, L"-", &tok_ctx); - time_ptr = wcstok_s(NULL, L"-", &tok_ctx); + time_ptr = wcstok_s(nullptr, L"-", &tok_ctx); wcsncpy_s(date, date_ptr, _TRUNCATE); wcsncpy_s(time, time_ptr, _TRUNCATE); @@ -156,7 +156,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) else direction = DIRECTION_IN; - if (type == LINK_MAIL && wcsstr(link, L"mailto:") == NULL) { + if (type == LINK_MAIL && wcsstr(link, L"mailto:") == nullptr) { wcsncpy_s(templink, link, _TRUNCATE); wcsncpy_s(link, L"mailto:", _TRUNCATE); wcsncpy_s((link + _mstrlen(L"mailto:")), (_countof(link) - _mstrlen(L"mailto:")), templink, _TRUNCATE); @@ -164,7 +164,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) // Add new Element to list: newElement = (LISTELEMENT*)mir_alloc(sizeof(LISTELEMENT)); - if (newElement == NULL) { + if (newElement == nullptr) { linkFound = -1; break; } @@ -177,7 +177,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) newElement->hEvent = hEvent; actualElement = listStart; - while (actualElement->nextElement != NULL) { + while (actualElement->nextElement != nullptr) { actualElement = actualElement->nextElement; } @@ -200,11 +200,11 @@ int RemoveList(LISTELEMENT *listStart) { LISTELEMENT *actualElement, *tempElement; - if ( listStart == NULL ) + if ( listStart == nullptr ) return -1; actualElement = listStart->nextElement; - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { tempElement = actualElement->nextElement; mir_free(actualElement); @@ -223,11 +223,11 @@ int ListCount(LISTELEMENT *listStart) LISTELEMENT *actualElement; int count = 0; - if ( listStart == NULL ) + if ( listStart == nullptr ) return -1; actualElement = listStart->nextElement; - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { count++; actualElement = actualElement->nextElement; @@ -245,7 +245,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc { CHARFORMAT2 cf; PARAFORMAT2 pf; - HWND hwndProgress = NULL; + HWND hwndProgress = nullptr; RECT DesktopRect; MYCOLOURSET colourSet; wchar_t textLine[LINK_MAX + DIR_SIZE + TIME_SIZE + TYPE_SIZE + 6]; @@ -295,7 +295,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc pf.wAlignment = PFA_LEFT; SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETPARAFORMAT, FALSE, (LPARAM) &pf); - if ( searchString != NULL ) + if ( searchString != nullptr ) { memset(&cf, 0, sizeof(cf)); cf.cbSize = sizeof(cf); @@ -342,17 +342,17 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc { // Create Progressbar GetWindowRect(GetDesktopWindow(), &DesktopRect); - hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL); + hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr); SetWindowPos(hwndProgress,HWND_TOP,(int)(DesktopRect.right*0.5)-175,(int)(DesktopRect.bottom*0.5)-22,0,0,SWP_NOSIZE); - if ( hwndProgress != NULL ) + if ( hwndProgress != nullptr ) { ShowWindow(hwndProgress, SW_SHOW); SetForegroundWindow(hwndProgress); } } - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { filter1 = 0; filter2 = 0; @@ -371,7 +371,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc filter2 = 1; - if ( searchString != NULL ) + if ( searchString != nullptr ) { if ( params & SLL_DEEP ) { @@ -478,7 +478,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc if ((actCount < listCount) && (append == 0) && (options.showLine != 0)) DrawLine(hDlg, lineLen); } - else if ( searchString == NULL ) + else if ( searchString == nullptr ) { memset(&cf, 0, sizeof(cf)); cf.cbSize = sizeof(cf); @@ -519,7 +519,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETEVENTMASK, 0, (LPARAM)ENM_LINK); SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_AUTOURLDETECT, TRUE, 0); SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETBKGNDCOLOR, FALSE, BGColourSel); - SetDlgItemText(hDlg, IDC_OPTIONS_RE, NULL); + SetDlgItemText(hDlg, IDC_OPTIONS_RE, nullptr); memset(&cf, 0, sizeof(cf)); cf.cbSize = sizeof(cf); @@ -608,7 +608,7 @@ Write Message to window void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) { LISTELEMENT *actualElement = listStart->nextElement; - while (actualElement != NULL) { + while (actualElement != nullptr) { if (actualElement->linePos == actLinePos) { MEVENT hEvent = actualElement->hEvent; if (hEvent != NULL ) { @@ -618,7 +618,7 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) db_event_get(hEvent, &dbe); dbe.pBlob[dbe.cbBlob] = 0; LPCTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP); - SetDlgItemText(hDlg, IDC_MESSAGE, NULL); + SetDlgItemText(hDlg, IDC_MESSAGE, nullptr); SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg); mir_free((void*)msg); mir_free(dbe.pBlob); @@ -744,7 +744,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz *realElementCount = 0; actualElement = listStart->nextElement; - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { (*realElementCount)++; @@ -762,7 +762,7 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz else if ( (params & WLL_URL) && (actualElement->type == LINK_URL)) filter2 = 1; - if ( searchString != NULL ) + if ( searchString != nullptr ) { if ( params & SLL_DEEP ) { @@ -906,11 +906,11 @@ void ClearLinePos(LISTELEMENT *listStart) { LISTELEMENT *actualElement; - if ( listStart == NULL ) + if ( listStart == nullptr ) return; actualElement = listStart->nextElement; - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { actualElement->linePos = -1; actualElement = actualElement->nextElement; @@ -922,11 +922,11 @@ int GetLastLinePos(LISTELEMENT *listStart) LISTELEMENT *actualElement; int maxPos = -1; - if ( listStart == NULL ) + if ( listStart == nullptr ) return -1; actualElement = listStart->nextElement; - while ( actualElement != NULL ) + while ( actualElement != nullptr ) { if ( actualElement->linePos > maxPos ) maxPos = actualElement->linePos; @@ -1187,7 +1187,7 @@ int DBUpdate(WPARAM wParam, LPARAM hEvent) // Call function to find URIs linkNum = ExtractURI(&dbe, hEvent, DlgParam->listStart); if ( linkNum > 0 ) - WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, linkNum); + WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, linkNum); } mir_free(dbe.pBlob); } @@ -1256,8 +1256,8 @@ BOOL SaveEditAsStream( HWND hDlg ) if ( ! GetSaveFileName( &ofn )) return FALSE; // Create the specified file - hFile = CreateFile( szFilename, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); + hFile = CreateFile( szFilename, GENERIC_WRITE, 0, nullptr, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr ); // Quit if file creation fails if ( hFile == INVALID_HANDLE_VALUE ) return FALSE; @@ -1281,7 +1281,7 @@ DWORD CALLBACK RTFSaveStreamCallback(DWORD_PTR dwCookie, LPBYTE lpBuffer, LONG l // Initialize "amount read" variable for WriteFile() *plRead = 0; // dwCookie is the file handle - WriteFile( (HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, NULL ); + WriteFile( (HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, nullptr ); // Continue, if needed return 0; } diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp index 0bd72c9e5a..4ecbe3932d 100644 --- a/plugins/HistoryStats/src/bandctrlimpl.cpp +++ b/plugins/HistoryStats/src/bandctrlimpl.cpp @@ -37,12 +37,12 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_KILLFOCUS: if (pCtrl->m_nCurFocused != -1) { pCtrl->m_nCurFocused = -1; - InvalidateRect(pCtrl->m_hWnd, NULL, TRUE); + InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE); } return 0; case WM_ENABLE: - InvalidateRect(pCtrl->m_hWnd, NULL, TRUE); + InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE); return 0; case WM_GETFONT: @@ -54,7 +54,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_WINDOWPOSCHANGED: pCtrl->recalcButtonRects(); - InvalidateRect(pCtrl->m_hWnd, NULL, TRUE); + InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE); return 0; case WM_KEYDOWN: @@ -139,7 +139,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, assert(static_cast(wParam) >= 0); pCtrl->m_nLayout = wParam; pCtrl->recalcButtonRects(); - InvalidateRect(pCtrl->m_hWnd, NULL, TRUE); + InvalidateRect(pCtrl->m_hWnd, nullptr, TRUE); return 0; case BCM_GETBUTTONRECT: @@ -167,12 +167,12 @@ bool BandCtrlImpl::registerClass() 0, // cbClsExtra sizeof(BandCtrlImpl*), // cbWndExtra g_hInst, // hInstance - NULL, // hIcon - NULL, // hCursor - NULL, // hbrBackground - NULL, // lpszMenuName + nullptr, // hIcon + nullptr, // hCursor + nullptr, // hbrBackground + nullptr, // lpszMenuName m_ClassName, // lpszClassName - NULL // hIconSm + nullptr // hIconSm }; if (!RegisterClassEx(&wcx)) @@ -187,10 +187,10 @@ void BandCtrlImpl::unregisterClass() } BandCtrlImpl::BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId) : - m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(NULL), - m_hTheme(NULL), m_hImageList(NULL), m_hImageListD(NULL), m_hTooltip(NULL), + m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(nullptr), + m_hTheme(nullptr), m_hImageList(nullptr), m_hImageListD(nullptr), m_hTooltip(nullptr), m_nCurHot(-1), m_nCurFocused(-1), m_nCurPressed(-1), m_bCurPressedDD(false), - m_nLayout(0), m_nDDWidth(12), m_hDDIcon(NULL) + m_nLayout(0), m_nDDWidth(12), m_hDDIcon(nullptr) { m_IconSize.cx = m_IconSize.cy; m_hDDIcon = reinterpret_cast(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0)); @@ -202,22 +202,22 @@ BandCtrlImpl::~BandCtrlImpl() { if (m_hTooltip) { DestroyWindow(m_hTooltip); - m_hTooltip = NULL; + m_hTooltip = nullptr; } if (m_hImageList) { ImageList_Destroy(m_hImageList); - m_hImageList = NULL; + m_hImageList = nullptr; } if (m_hImageListD) { ImageList_Destroy(m_hImageListD); - m_hImageListD = NULL; + m_hImageListD = nullptr; } if (m_hTheme) { CloseThemeData(m_hTheme); - m_hTheme = NULL; + m_hTheme = nullptr; } if (m_hDDIcon) { @@ -231,7 +231,7 @@ void BandCtrlImpl::onWMPaint() // start painting PAINTSTRUCT ps; HDC hRealDC = BeginPaint(m_hWnd, &ps); - if (hRealDC == NULL) + if (hRealDC == nullptr) return; // get rect for painting @@ -242,23 +242,23 @@ void BandCtrlImpl::onWMPaint() HDC hDC = CreateCompatibleDC(hRealDC); HBITMAP hMemBitmap = CreateCompatibleBitmap(hRealDC, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top); HBITMAP hOldBitmap = reinterpret_cast(SelectObject(hDC, hMemBitmap)); - SetWindowOrgEx(hDC, ps.rcPaint.left, ps.rcPaint.top, NULL); + SetWindowOrgEx(hDC, ps.rcPaint.left, ps.rcPaint.top, nullptr); // fill background bool bBandEnabled = bool_(IsWindowEnabled(m_hWnd)); SetBkColor(hDC, GetSysColor(bBandEnabled ? COLOR_WINDOW : COLOR_BTNFACE)); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rOut, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rOut, nullptr, 0, nullptr); // draw top and bottom line if (bBandEnabled) { RECT rLine = { rOut.left, rOut.top, rOut.right, rOut.top + 1 }; SetBkColor(hDC, GetSysColor(COLOR_3DSHADOW)); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, nullptr, 0, nullptr); rLine.top = (rLine.bottom = rOut.bottom) - 1; - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rLine, nullptr, 0, nullptr); } // draw items @@ -315,7 +315,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab if (bEnabled) state = bPressed ? (m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL)); - DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, NULL); + DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, nullptr); } else { --rDropDown.left; @@ -331,7 +331,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab int x = rDropDown.left + (rDropDown.right - rDropDown.left - OS::smIconCX()) / 2; int y = rDropDown.top + (rDropDown.bottom - rDropDown.top - OS::smIconCY()) / 2; - DrawState(hDC, NULL, NULL, reinterpret_cast(m_hDDIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | (bEnabled ? 0 : DSS_DISABLED)); + DrawState(hDC, nullptr, nullptr, reinterpret_cast(m_hDDIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | (bEnabled ? 0 : DSS_DISABLED)); } } @@ -342,7 +342,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab if (bEnabled) state = bPressed ? (!m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL)); - DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, NULL); + DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, nullptr); } else { UINT state = 0; @@ -379,7 +379,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab ImageList_Draw(m_hImageListD, item.nIconD, hDC, x, y, ILD_NORMAL); else { HICON hIcon = ImageList_GetIcon(m_hImageList, item.nIcon, 0); - DrawState(hDC, NULL, NULL, reinterpret_cast(hIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | DSS_DISABLED); + DrawState(hDC, nullptr, nullptr, reinterpret_cast(hIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | DSS_DISABLED); DestroyIcon(hIcon); } } @@ -396,12 +396,12 @@ void BandCtrlImpl::reloadTheme() { if (m_hTheme) { CloseThemeData(m_hTheme); - m_hTheme = NULL; + m_hTheme = nullptr; } m_nDDWidth = 12; - m_hTheme = OpenThemeData(0, L"TOOLBAR"); + m_hTheme = OpenThemeData(nullptr, L"TOOLBAR"); recalcButtonRects(); } @@ -411,11 +411,11 @@ HICON BandCtrlImpl::convertToGray(HICON hIcon) // preserves transparency // works only for 32bit icons - HICON hIconDisabled = NULL; + HICON hIconDisabled = nullptr; ICONINFO ii; if (!GetIconInfo(hIcon, &ii)) - return NULL; + return nullptr; BITMAP bmp; if (GetObject(ii.hbmColor, sizeof(bmp), &bmp) && bmp.bmBitsPixel == 32) { @@ -536,7 +536,7 @@ void BandCtrlImpl::onBCMShowButton(int nItem, bool bShow) if (bShow != id.bVisible) { id.bVisible = bShow; recalcButtonRects(); - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); } } @@ -556,7 +556,7 @@ void BandCtrlImpl::onBCMEnableButton(int nItem, bool bEnable) if (bEnable != id.bEnabled) { id.bEnabled = bEnable; - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); } } @@ -603,7 +603,7 @@ void BandCtrlImpl::recalcButtonRects() m_hWnd, // hwnd m_Items[i].uTTId, // uId m_Items[i].rItem, // rect - NULL, // hInstance + nullptr, // hInstance const_cast(m_Items[i].tooltip.c_str()), // lpszText }; @@ -622,9 +622,9 @@ void BandCtrlImpl::recalcButtonRects() else if (m_Items[i].uTTId == -1 && m_Items[i].bVisible && !m_Items[i].tooltip.empty()) { // add a tooltip, if we don't have a tooltip but are now visible if (!m_hTooltip) - m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL); + m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr); - TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, NULL, + TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, nullptr, const_cast(m_Items[i].tooltip.c_str()), // lpszText }; @@ -740,7 +740,7 @@ void BandCtrlImpl::onWMKeyDown(int nVirtKey) if (nNext != -1 && nNext != m_nCurFocused) { m_nCurFocused = nNext; - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); } } else if (nVirtKey == VK_LEFT) { @@ -748,7 +748,7 @@ void BandCtrlImpl::onWMKeyDown(int nVirtKey) if (nPrev != -1 && nPrev != m_nCurFocused) { m_nCurFocused = nPrev; - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); } } else if (nVirtKey == VK_SPACE) { @@ -821,7 +821,7 @@ void BandCtrlImpl::onWMMouseMove(POINTS pts) } if (m_nCurHot != -1) { - SetTimer(m_hWnd, m_PollId, m_PollDelay, NULL); + SetTimer(m_hWnd, m_PollId, m_PollDelay, nullptr); } } diff --git a/plugins/HistoryStats/src/canvas.cpp b/plugins/HistoryStats/src/canvas.cpp index 945b22351b..215f631104 100644 --- a/plugins/HistoryStats/src/canvas.cpp +++ b/plugins/HistoryStats/src/canvas.cpp @@ -31,8 +31,8 @@ void Canvas::updateTrans(BYTE* pData) Canvas::Canvas(int nWidth, int nHeight) : m_nChannels(4), m_nWidth(nWidth), m_nHeight(nHeight), m_nLineLength((m_nChannels * m_nWidth + 3) & ~0x3), - m_bTransColor(false), m_TransColor(0), m_pBMIH(NULL), m_hDC(0), - m_hBmp(0), m_hOldBmp(0) + m_bTransColor(false), m_TransColor(0), m_pBMIH(nullptr), m_hDC(nullptr), + m_hBmp(nullptr), m_hOldBmp(nullptr) {} Canvas::~Canvas() @@ -65,7 +65,7 @@ void Canvas::fillBackground(COLORREF bkColor) RECT rAll = { 0, 0, m_nWidth, m_nHeight }; SetBkColor(hDC, bkColor); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rAll, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rAll, nullptr, 0, nullptr); endDraw(); } @@ -87,10 +87,10 @@ HDC Canvas::beginDraw() m_pBMIH->biClrUsed = 0; m_pBMIH->biClrImportant = 0; - BYTE* pData = 0; + BYTE* pData = nullptr; - m_hDC = CreateCompatibleDC(NULL); - m_hBmp = CreateDIBSection(m_hDC, reinterpret_cast(m_pBMIH), DIB_RGB_COLORS, reinterpret_cast(&pData), NULL, 0); + m_hDC = CreateCompatibleDC(nullptr); + m_hBmp = CreateDIBSection(m_hDC, reinterpret_cast(m_pBMIH), DIB_RGB_COLORS, reinterpret_cast(&pData), nullptr, 0); } m_hOldBmp = SelectObject(m_hDC, m_hBmp); @@ -101,7 +101,7 @@ HDC Canvas::beginDraw() void Canvas::endDraw() { SelectObject(m_hDC, m_hOldBmp); - m_hOldBmp = NULL; + m_hOldBmp = nullptr; } bool Canvas::getDigest(Digest& digest) diff --git a/plugins/HistoryStats/src/colbase_words.cpp b/plugins/HistoryStats/src/colbase_words.cpp index 9f80ba1f92..e45c77e019 100644 --- a/plugins/HistoryStats/src/colbase_words.cpp +++ b/plugins/HistoryStats/src/colbase_words.cpp @@ -164,7 +164,7 @@ void ColBaseWords::parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgo } ColBaseWords::ColBaseWords() : m_nSource(2), m_nMinLength(1), m_nMaxLength(0), m_bFilterLinks(true), - m_hSource(NULL), m_hMinLength(NULL), m_hMaxLength(NULL), m_hFilterLinks(NULL), + m_hSource(nullptr), m_hMinLength(nullptr), m_hMaxLength(nullptr), m_hFilterLinks(nullptr), m_bFilterMessages(false), m_bFilterWords(false) { } @@ -221,7 +221,7 @@ void ColBaseWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp; hTemp = Opt.insertGroup (hGroup, TranslateT("Extract words from")); - m_hSource = Opt.insertRadio (hTemp, NULL, TranslateT("Incoming messages")); + m_hSource = Opt.insertRadio (hTemp, nullptr, TranslateT("Incoming messages")); Opt.insertRadio (hTemp, m_hSource, TranslateT("Outgoing messages")); Opt.insertRadio (hTemp, m_hSource, TranslateT("All messages")); m_hMinLength = Opt.insertEdit(hGroup, TranslateT("Ignore words shorter than (chars)"), L"", OptionsCtrl::OCF_NUMBER); @@ -308,7 +308,7 @@ void ColBaseWords::impl_contactDataFree(Contact& contact) const WordMap* pData = reinterpret_cast(contact.getSlot(contactDataSlotGet())); if (pData) { delete pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } diff --git a/plugins/HistoryStats/src/column.cpp b/plugins/HistoryStats/src/column.cpp index 1a0d85f2fb..51d9967873 100644 --- a/plugins/HistoryStats/src/column.cpp +++ b/plugins/HistoryStats/src/column.cpp @@ -85,7 +85,7 @@ Column* Column::fromUID(const ext::string& guid) return getColInfo(i).m_pFactory->makeInstance(); } - return NULL; + return nullptr; } void Column::registerUID(FactoryBase* pFactory) @@ -147,7 +147,7 @@ Column* Column::clone() const void Column::outputBegin() { - int restrictions = configGetRestrictions(NULL); + int restrictions = configGetRestrictions(nullptr); m_bUsePNG = m_pSettings->isPNGOutputActiveAndAvailable() && // do we want PNG output? diff --git a/plugins/HistoryStats/src/column_chatduration.cpp b/plugins/HistoryStats/src/column_chatduration.cpp index 96af1bc4aa..fba75dbfc4 100644 --- a/plugins/HistoryStats/src/column_chatduration.cpp +++ b/plugins/HistoryStats/src/column_chatduration.cpp @@ -5,7 +5,7 @@ * ColChatDuration */ ColChatDuration::ColChatDuration() : m_nVisMode(3), m_bGraph(true), m_bDetail(true), - m_hVisMode(NULL), m_hGraph(NULL), m_hDetail(NULL), m_nMaxForGraph(0) + m_hVisMode(nullptr), m_hGraph(nullptr), m_hDetail(nullptr), m_nMaxForGraph(0) { } @@ -37,7 +37,7 @@ void ColChatDuration::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup OptionsCtrl::Item hTemp; hTemp = Opt.insertGroup(hGroup, TranslateT("Chat duration type")); - m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Minimum")); + m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Minimum")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Average")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Maximum")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Total (sum of all chats)")); @@ -217,7 +217,7 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con HDC hDC = canvas.beginDraw(); SetBkColor(hDC, con::ColorBar); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, barW, 15), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, barW, 15), nullptr, 0, nullptr); canvas.endDraw(); diff --git a/plugins/HistoryStats/src/column_events.cpp b/plugins/HistoryStats/src/column_events.cpp index bdee38136a..016558f0ca 100644 --- a/plugins/HistoryStats/src/column_events.cpp +++ b/plugins/HistoryStats/src/column_events.cpp @@ -6,7 +6,7 @@ */ ColEvents::ColEvents() - : m_nSource(5), m_hSource(NULL) + : m_nSource(5), m_hSource(nullptr) { } diff --git a/plugins/HistoryStats/src/column_inout.cpp b/plugins/HistoryStats/src/column_inout.cpp index d305783e91..4a7ab6aec8 100644 --- a/plugins/HistoryStats/src/column_inout.cpp +++ b/plugins/HistoryStats/src/column_inout.cpp @@ -7,7 +7,7 @@ ColInOut::ColInOut() : m_nSource(2), m_bAbsolute(false), m_nAbsTime(1), - m_hSource(NULL), m_hAbsolute(NULL), m_hAbsTime(NULL) + m_hSource(nullptr), m_hAbsolute(nullptr), m_hAbsTime(nullptr) { } @@ -40,9 +40,9 @@ void ColInOut::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source")); hTemp = Opt.insertGroup(hGroup, TranslateT("Display as")); - m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute")); + m_hAbsolute = Opt.insertRadio(hTemp, nullptr, TranslateT("Absolute")); m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); - m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day")); + m_hAbsTime = Opt.insertRadio(m_hAbsolute, nullptr, TranslateT("Units per day")); Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week")); Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)")); diff --git a/plugins/HistoryStats/src/column_inoutgraph.cpp b/plugins/HistoryStats/src/column_inoutgraph.cpp index e448e40b73..f5f10559fd 100644 --- a/plugins/HistoryStats/src/column_inoutgraph.cpp +++ b/plugins/HistoryStats/src/column_inoutgraph.cpp @@ -8,8 +8,8 @@ ColInOutGraph::ColInOutGraph() : m_nSource(0), m_bAbsolute(false), m_nAbsTime(1), m_bShowSum(true), m_bDetail(true), m_bDetailPercent(false), m_bDetailInvert(false), m_bGraphPercent(true), - m_hSource(NULL), m_hAbsolute(NULL), m_hAbsTime(NULL), m_hShowSum(NULL), - m_hDetail(NULL), m_hDetailPercent(NULL), m_hDetailInvert(NULL), m_hGraphPercent(NULL) + m_hSource(nullptr), m_hAbsolute(nullptr), m_hAbsTime(nullptr), m_hShowSum(nullptr), + m_hDetail(nullptr), m_hDetailPercent(nullptr), m_hDetailInvert(nullptr), m_hGraphPercent(nullptr) { } @@ -56,13 +56,13 @@ void ColInOutGraph::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp; hTemp = Opt.insertGroup(hGroup, TranslateT("Data source")); - m_hSource = Opt.insertRadio(hTemp, NULL, TranslateT("Characters")); + m_hSource = Opt.insertRadio(hTemp, nullptr, TranslateT("Characters")); Opt.insertRadio(hTemp, m_hSource, TranslateT("Messages")); Opt.insertRadio(hTemp, m_hSource, TranslateT("Chats")); hTemp = Opt.insertGroup(hGroup, TranslateT("Display as")); - m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute")); + m_hAbsolute = Opt.insertRadio(hTemp, nullptr, TranslateT("Absolute")); m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); - m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day")); + m_hAbsTime = Opt.insertRadio(m_hAbsolute, nullptr, TranslateT("Units per day")); Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week")); Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)")); m_hShowSum = Opt.insertCheck(hGroup, TranslateT("Show sum of incoming and outgoing")); @@ -272,10 +272,10 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta HDC hDC = canvas.beginDraw(); SetBkColor(hDC, con::ColorOut); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, outW, 15), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 0, outW, 15), nullptr, 0, nullptr); SetBkColor(hDC, con::ColorIn); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(100 - inW, 0, 100, 15), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(100 - inW, 0, 100, 15), nullptr, 0, nullptr); if (m_bGraphPercent) { diff --git a/plugins/HistoryStats/src/column_nick.cpp b/plugins/HistoryStats/src/column_nick.cpp index 4ab72104ec..948656d5d1 100644 --- a/plugins/HistoryStats/src/column_nick.cpp +++ b/plugins/HistoryStats/src/column_nick.cpp @@ -8,8 +8,8 @@ ColNick::ColNick() : m_bDetail(true) , m_bContactCount(true) - , m_hDetail(NULL) - , m_hContactCount(NULL) + , m_hDetail(nullptr) + , m_hContactCount(nullptr) { } diff --git a/plugins/HistoryStats/src/column_split.cpp b/plugins/HistoryStats/src/column_split.cpp index 512875a3c0..7b6c7b8b6b 100644 --- a/plugins/HistoryStats/src/column_split.cpp +++ b/plugins/HistoryStats/src/column_split.cpp @@ -9,9 +9,9 @@ ColSplit::ColSplit() : m_nSource(0), m_nSourceType(2), m_nVisMode(0), m_nBlockUnit(0), m_nUnitsPerBlock(6), m_nBlocks(28), m_nGraphAlign(1), m_bDetail(true), - m_hSource(NULL), m_hVisMode(NULL), - m_hBlockUnit(NULL), m_hUnitsPerBlock(NULL), m_hBlocks(NULL), m_hGraphAlign(NULL), - m_hDetail(NULL), + m_hSource(nullptr), m_hVisMode(nullptr), + m_hBlockUnit(nullptr), m_hUnitsPerBlock(nullptr), m_hBlocks(nullptr), m_hGraphAlign(nullptr), + m_hDetail(nullptr), m_nTimeDiv(3600), m_nTimeMod(24), m_nTimeOffset(0) { } @@ -61,7 +61,7 @@ void ColSplit::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source")); hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type")); - m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day")); + m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Hours of day")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week")); hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Custom (for experts only)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); hTemp = Opt.insertGroup(hTempRadio, TranslateT("Column setup")); @@ -69,7 +69,7 @@ void ColSplit::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per bar"), L"", OptionsCtrl::OCF_NUMBER); m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Bars per graph"), L"", OptionsCtrl::OCF_NUMBER); hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment")); - m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary")); + m_hGraphAlign = Opt.insertRadio(hTemp, nullptr, TranslateT("Align on day boundary")); Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary")); m_hDetail = Opt.insertCheck(hGroup, TranslateT("Details for every bar (tooltip)")); @@ -188,7 +188,7 @@ void ColSplit::impl_contactDataFree(Contact& contact) const if (pData) { delete[] pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } @@ -389,7 +389,7 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D { int bar_len = (50 * part_top + top - 1) / top; - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(j * 5, 50 - bar_len, j * 5 + 4, 50), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(j * 5, 50 - bar_len, j * 5 + 4, 50), nullptr, 0, nullptr); } } diff --git a/plugins/HistoryStats/src/column_splittimeline.cpp b/plugins/HistoryStats/src/column_splittimeline.cpp index a5b75c0918..ad1a6b5915 100644 --- a/plugins/HistoryStats/src/column_splittimeline.cpp +++ b/plugins/HistoryStats/src/column_splittimeline.cpp @@ -9,9 +9,9 @@ ColSplitTimeline::ColSplitTimeline() : m_nSource(0), m_nSourceType(2), m_nIgnoreOld(0), m_nVisMode(0), m_nHODGroup(1), m_nDOWGroup(1), m_nBlockUnit(0), m_nUnitsPerBlock(6), m_nBlocks(28), m_nGraphAlign(1), m_nCustomGroup(1), m_bTopPerColumn(true), - m_hSource(NULL), m_hIgnoreOld(NULL), m_hVisMode(NULL), - m_hHODGroup(NULL), m_hDOWGroup(NULL), m_hBlockUnit(NULL), m_hUnitsPerBlock(NULL), - m_hBlocks(NULL), m_hGraphAlign(NULL), m_hCustomGroup(NULL),m_hTopPerColumn(NULL), + m_hSource(nullptr), m_hIgnoreOld(nullptr), m_hVisMode(nullptr), + m_hHODGroup(nullptr), m_hDOWGroup(nullptr), m_hBlockUnit(nullptr), m_hUnitsPerBlock(nullptr), + m_hBlocks(nullptr), m_hGraphAlign(nullptr), m_hCustomGroup(nullptr),m_hTopPerColumn(nullptr), m_nTimeDiv(3600), m_nTimeOffset(0), m_nTimelineWidth(0), m_nBlockOffset(0), m_nNumBlocks(0) { @@ -75,7 +75,7 @@ void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGrou m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source")); m_hIgnoreOld = Opt.insertEdit(hGroup, TranslateT("Drop everything older than (days, 0=no limit)"), L"", OptionsCtrl::OCF_NUMBER); hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type")); - m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); + m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hHODGroup = Opt.insertEdit (m_hVisMode, TranslateT("Number of days to group"), L"", OptionsCtrl::OCF_NUMBER); hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hDOWGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of weeks to group"), L"", OptionsCtrl::OCF_NUMBER); @@ -85,7 +85,7 @@ void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGrou m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per block"), L"", OptionsCtrl::OCF_NUMBER); m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Blocks per column"), L"", OptionsCtrl::OCF_NUMBER); hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment")); - m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary")); + m_hGraphAlign = Opt.insertRadio(hTemp, nullptr, TranslateT("Align on day boundary")); Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary")); m_hCustomGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of columns to group"), L"", OptionsCtrl::OCF_NUMBER); m_hTopPerColumn = Opt.insertCheck(hGroup, TranslateT("Calculate maximum per column (not per graph)")); @@ -201,7 +201,7 @@ void ColSplitTimeline::impl_contactDataFree(Contact& contact) const if (pData) { delete pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } @@ -536,7 +536,7 @@ void ColSplitTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& co int color = 255 * part_top / top; SetBkColor(hDC, colorTab[color]); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, nullptr, 0, nullptr); } } } @@ -619,7 +619,7 @@ void ColSplitTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& co } SetBkColor(hDC, color); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &r, nullptr, 0, nullptr); } } } diff --git a/plugins/HistoryStats/src/column_timeline.cpp b/plugins/HistoryStats/src/column_timeline.cpp index 9c82240562..1c4b5ce657 100644 --- a/plugins/HistoryStats/src/column_timeline.cpp +++ b/plugins/HistoryStats/src/column_timeline.cpp @@ -6,7 +6,7 @@ */ ColTimeline::ColTimeline() : m_nSource(0), m_nSourceType(2), m_nIgnoreOld(0), m_bDetail(true), - m_nDays(7), m_hSource(NULL), m_hIgnoreOld(NULL), m_hDetail(NULL), m_hDays(NULL), + m_nDays(7), m_hSource(nullptr), m_hIgnoreOld(nullptr), m_hDetail(nullptr), m_hDays(nullptr), m_nTimelineWidth(0), m_nFirstDay(0), m_nLastDay(0) { } @@ -113,7 +113,7 @@ void ColTimeline::impl_contactDataFree(Contact& contact) const if (pData) { delete pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } @@ -298,11 +298,11 @@ void ColTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& contact int from_left = 3 * ((curDay - m_nFirstDay) / m_nDays); if (bar_len != 0) - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24 - bar_len, from_left + 3, 25 + bar_len), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24 - bar_len, from_left + 3, 25 + bar_len), nullptr, 0, nullptr); } SetBkColor(hDC, con::ColorBarLine); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), nullptr, 0, nullptr); canvas.endDraw(); @@ -399,7 +399,7 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact HDC hDC = canvas.beginDraw(); SetBkColor(hDC, con::ColorIOLine); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(0, 24, m_nTimelineWidth, 25), nullptr, 0, nullptr); for (curDay = m_nFirstDay; curDay <= m_nLastDay; curDay += m_nDays) { @@ -430,12 +430,12 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact if (bar_len < 0) { SetBkColor(hDC, con::ColorIn); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24, from_left + 3, 24 - bar_len), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 24, from_left + 3, 24 - bar_len), nullptr, 0, nullptr); } else if (bar_len > 0) { SetBkColor(hDC, con::ColorOut); - ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 25 - bar_len, from_left + 3, 25), NULL, 0, NULL); + ExtTextOut(hDC, 0, 0, ETO_OPAQUE, utils::rect(from_left, 25 - bar_len, from_left + 3, 25), nullptr, 0, nullptr); } } diff --git a/plugins/HistoryStats/src/column_wordcount.cpp b/plugins/HistoryStats/src/column_wordcount.cpp index 65d59fe21d..e764e378de 100644 --- a/plugins/HistoryStats/src/column_wordcount.cpp +++ b/plugins/HistoryStats/src/column_wordcount.cpp @@ -9,7 +9,7 @@ ColWordCount::ColWordCount() : m_nVisMode(0), m_bDetail(true), - m_hVisMode(NULL), m_hDetail(NULL) + m_hVisMode(nullptr), m_hDetail(nullptr) { } @@ -46,7 +46,7 @@ void ColWordCount::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp; hTemp = Opt.insertGroup(hGroup, TranslateT("Word count type")); - m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Total words")); + m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Total words")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Distinct words")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Ratio total/distinct words")); m_hDetail = Opt.insertCheck(hGroup, TranslateT("Additional info in tooltip (depends on type)")); @@ -72,7 +72,7 @@ void ColWordCount::impl_contactDataFree(Contact& contact) const if (pTrData) { delete pTrData; - contact.setSlot(contactDataTransformSlotGet(), NULL); + contact.setSlot(contactDataTransformSlotGet(), nullptr); } } @@ -104,7 +104,7 @@ void ColWordCount::impl_contactDataTransformCleanup(Contact& contact) const pData->clear(); delete[] pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } diff --git a/plugins/HistoryStats/src/column_words.cpp b/plugins/HistoryStats/src/column_words.cpp index b19b363913..47028ffccf 100644 --- a/plugins/HistoryStats/src/column_words.cpp +++ b/plugins/HistoryStats/src/column_words.cpp @@ -79,12 +79,12 @@ ColWords::ColWords() , m_bDetail(true) , m_bDetailInOut(false) , m_bInOutColor(false) - , m_hVisMode(NULL) - , m_hNum(NULL) - , m_hOffset(NULL) - , m_hDetail(NULL) - , m_hDetailInOut(NULL) - , m_hInOutColor(NULL) + , m_hVisMode(nullptr) + , m_hNum(nullptr) + , m_hOffset(nullptr) + , m_hDetail(nullptr) + , m_hDetailInOut(nullptr) + , m_hInOutColor(nullptr) { } @@ -133,7 +133,7 @@ void ColWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup) OptionsCtrl::Group hTemp; hTemp = Opt.insertGroup(hGroup, TranslateT("Words type")); - m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Most common words")); + m_hVisMode = Opt.insertRadio(hTemp, nullptr, TranslateT("Most common words")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Least common words")); Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Longest words")); m_hNum = Opt.insertEdit (hGroup, TranslateT("Number of words"), L"", OptionsCtrl::OCF_NUMBER); @@ -174,7 +174,7 @@ void ColWords::impl_contactDataFree(Contact& contact) const if (pTrData) { delete pTrData; - contact.setSlot(contactDataTransformSlotGet(), NULL); + contact.setSlot(contactDataTransformSlotGet(), nullptr); } } @@ -197,7 +197,7 @@ void ColWords::impl_contactDataTransformCleanup(Contact& contact) const pData->clear(); delete pData; - contact.setSlot(contactDataSlotGet(), NULL); + contact.setSlot(contactDataSlotGet(), nullptr); } } diff --git a/plugins/HistoryStats/src/contact.cpp b/plugins/HistoryStats/src/contact.cpp index ed7e35c91d..8a03c1b746 100644 --- a/plugins/HistoryStats/src/contact.cpp +++ b/plugins/HistoryStats/src/contact.cpp @@ -86,7 +86,7 @@ void Contact::addChat(bool bOutgoing, DWORD, DWORD duration) void Contact::addEvent(WORD eventType, bool bOutgoing) { - InOut* pIO = NULL; + InOut* pIO = nullptr; switch (eventType) { case EVENTTYPE_URL: diff --git a/plugins/HistoryStats/src/dlgconfigure.cpp b/plugins/HistoryStats/src/dlgconfigure.cpp index 63e21d6c3c..6aaa746b35 100644 --- a/plugins/HistoryStats/src/dlgconfigure.cpp +++ b/plugins/HistoryStats/src/dlgconfigure.cpp @@ -10,7 +10,7 @@ * DlgConfigure */ -HWND DlgConfigure::m_hCfgWnd = NULL; +HWND DlgConfigure::m_hCfgWnd = nullptr; bool DlgConfigure::m_bHookedEvent = false; INT_PTR CALLBACK DlgConfigure::staticConfigureProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -88,7 +88,7 @@ int DlgConfigure::staticEventPreShutdown(WPARAM, LPARAM) void DlgConfigure::showModal() { if (g_bConfigureLock) { - MessageBox(0, + MessageBox(nullptr, TranslateT("You can't access the stand-alone configuration dialog of HistoryStats as long as the options dialog of Miranda NG is open. Please close the options dialog and try again.\r\n\r\nNote that the options offered by both dialogs are the same."), TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK); @@ -99,7 +99,7 @@ void DlgConfigure::showModal() if (IsWindow(m_hCfgWnd)) SetForegroundWindow(m_hCfgWnd); else - CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CONFIGURE), NULL, staticConfigureProc); + CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CONFIGURE), nullptr, staticConfigureProc); } void DlgConfigure::onWMInitDialog() @@ -184,11 +184,11 @@ void DlgConfigure::rearrangeControls() utils::moveWindow(m_hOptWnd, rPage); - InvalidateRect(m_hWnd, NULL, TRUE); + InvalidateRect(m_hWnd, nullptr, TRUE); } DlgConfigure::DlgConfigure(HWND hWnd) : - m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(NULL), + m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(nullptr), m_nPadY(-1), m_nOKPadX(0), m_nCancelPadX(0), m_nApplyPadX(0) { if (!m_hCfgWnd) { @@ -206,5 +206,5 @@ DlgConfigure::~DlgConfigure() DestroyWindow(m_hOptWnd); if (m_hWnd == m_hCfgWnd) - m_hCfgWnd = NULL; + m_hCfgWnd = nullptr; } diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp index 92b3143b84..aea8892a06 100644 --- a/plugins/HistoryStats/src/dlgfilterwords.cpp +++ b/plugins/HistoryStats/src/dlgfilterwords.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgFilterWords::staticDlgProc(HWND hDlg, UINT msg, WPARAM wPara case WM_DESTROY: pDlg->onWMDestroy(); - pDlg->m_hWnd = NULL; + pDlg->m_hWnd = nullptr; SetWindowLongPtr(hDlg, DWLP_USER, 0); return TRUE; @@ -102,7 +102,7 @@ void DlgFilterWords::onWMInitDialog() { const Filter* pFilter = *i; - HANDLE hCheck = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); + HANDLE hCheck = m_Sets.insertCheck(nullptr, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); if (m_bColProvided && m_ColFilters.find(pFilter->getID()) != m_ColFilters.end()) m_Sets.checkItem(hCheck, true); @@ -127,7 +127,7 @@ void DlgFilterWords::onWMInitDialog() SendDlgItemMessage(m_hWnd, IDC_MODE, CB_SETCURSEL, 0, 0); - onSetSelChanged(NULL, 0); + onSetSelChanged(nullptr, 0); } void DlgFilterWords::onWMDestroy() @@ -155,7 +155,7 @@ void DlgFilterWords::onSetAdd() m_Filters.push_back(pFilter); - HANDLE hAdded = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); + HANDLE hAdded = m_Sets.insertCheck(nullptr, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); m_Sets.selectItem(hAdded); } @@ -297,7 +297,7 @@ void DlgFilterWords::clearFilters() m_Filters.clear(); } -DlgFilterWords::DlgFilterWords() : m_hWnd(NULL), m_bColProvided(false) +DlgFilterWords::DlgFilterWords() : m_hWnd(nullptr), m_bColProvided(false) { } diff --git a/plugins/HistoryStats/src/dlgoption.cpp b/plugins/HistoryStats/src/dlgoption.cpp index 61a67c04f2..07c9e3ac47 100644 --- a/plugins/HistoryStats/src/dlgoption.cpp +++ b/plugins/HistoryStats/src/dlgoption.cpp @@ -205,7 +205,7 @@ void DlgOption::onBandDropDown(HANDLE hButton, INT_PTR dwData) if (dwData == opCreateWarn) { AppendMenu(hPopup, MF_STRING, 1, TranslateT("Show warnings...")); - AppendMenu(hPopup, MF_SEPARATOR, 0, NULL); + AppendMenu(hPopup, MF_SEPARATOR, 0, nullptr); } UINT iMenuFlags = g_pSettings->canShowStatistics() ? 0 : (MF_DISABLED | MF_GRAYED); @@ -219,7 +219,7 @@ void DlgOption::onBandDropDown(HANDLE hButton, INT_PTR dwData) ptMenu.y, 0, getHWnd(), - NULL); + nullptr); DestroyMenu(hPopup); @@ -321,7 +321,7 @@ int DlgOption::saveSettings() void DlgOption::updateProblemInfo() { - bool bShowProblemInfo = reinterpret_cast(m_pPage[opColumns])->configHasConflicts(NULL); + bool bShowProblemInfo = reinterpret_cast(m_pPage[opColumns])->configHasConflicts(nullptr); m_Band.showButton(m_hCreateButton, !bShowProblemInfo); m_Band.showButton(m_hCreateWarnButton, bShowProblemInfo); @@ -329,7 +329,7 @@ void DlgOption::updateProblemInfo() DlgOption::DlgOption(HWND hWnd) : m_hWnd(hWnd), m_bSettingsModified(false), m_nCurPage(-1), m_LocalS(*g_pSettings), - m_hCreateButton(NULL), m_hCreateWarnButton(NULL), m_bAcquiredLock(false) + m_hCreateButton(nullptr), m_hCreateWarnButton(nullptr), m_bAcquiredLock(false) {} DlgOption::~DlgOption() @@ -350,7 +350,7 @@ DlgOption::~DlgOption() m_pPage[i]->destroyWindow(); // MEMO: don't delete them, they will delete themselves in their WM_DESTROY messages - m_pPage[i] = NULL; + m_pPage[i] = nullptr; } } } \ No newline at end of file diff --git a/plugins/HistoryStats/src/dlgoption_subbase.cpp b/plugins/HistoryStats/src/dlgoption_subbase.cpp index 8c971434d4..fca95cf406 100644 --- a/plugins/HistoryStats/src/dlgoption_subbase.cpp +++ b/plugins/HistoryStats/src/dlgoption_subbase.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK DlgOption::SubBase::staticDlgProc(HWND hDlg, UINT msg, WPARAM w } DlgOption::SubBase::SubBase() : - m_pParent(NULL), m_hWnd(NULL) + m_pParent(nullptr), m_hWnd(nullptr) { } diff --git a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp index a2ff5e6ca8..54484d1877 100644 --- a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp +++ b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp @@ -67,7 +67,7 @@ INT_PTR CALLBACK DlgOption::SubColumns::staticAddProc(HWND hDlg, UINT msg, WPARA } DlgOption::SubColumns::SubColumns() : - m_hColTitle(NULL), + m_hColTitle(nullptr), m_bShowInfo(true), m_nInfoHeight(0) { @@ -213,11 +213,11 @@ void DlgOption::SubColumns::loadSettings() { // remeber currently selected item HANDLE hSelItem = m_Columns.getSelection(); - Column* pPrevCol = NULL; + Column* pPrevCol = nullptr; if (hSelItem) { pPrevCol = reinterpret_cast(m_Columns.getItemData(hSelItem)); - hSelItem = NULL; + hSelItem = nullptr; } // remember scroll bar position @@ -233,7 +233,7 @@ void DlgOption::SubColumns::loadSettings() { Column* pCol = localS.getCol(j); ext::string colTitle = pCol->getTitleForOptions(); - OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, colTitle.c_str(), 0, reinterpret_cast(pCol)); + OptionsCtrl::Check hColCheck = m_Columns.insertCheck(nullptr, colTitle.c_str(), 0, reinterpret_cast(pCol)); m_Columns.checkItem(hColCheck, pCol->isEnabled()); @@ -241,7 +241,7 @@ void DlgOption::SubColumns::loadSettings() hSelItem = hColCheck; } - m_Columns.ensureVisible(NULL); + m_Columns.ensureVisible(nullptr); m_Columns.setRedraw(true); // restore scroll bar position @@ -257,7 +257,7 @@ void DlgOption::SubColumns::saveSettings() if (hSelItem) { // deselect and select current item to save its options to localS - m_Columns.selectItem(NULL); + m_Columns.selectItem(nullptr); m_Columns.selectItem(hSelItem); } @@ -327,7 +327,7 @@ void DlgOption::SubColumns::addCol(int nCol) getParent()->getLocalSettings().addCol(pCol); - OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, TranslateW(pCol->getTitle()), 0, reinterpret_cast(pCol)); + OptionsCtrl::Check hColCheck = m_Columns.insertCheck(nullptr, TranslateW(pCol->getTitle()), 0, reinterpret_cast(pCol)); m_Columns.checkItem(hColCheck, pCol->isEnabled()); @@ -349,7 +349,7 @@ void DlgOption::SubColumns::onColSelChanging(HANDLE hItem, INT_PTR) m_Columns.setItemLabel(hItem, colTitle.c_str()); - m_hColTitle = NULL; + m_hColTitle = nullptr; } // column specific settings @@ -378,25 +378,25 @@ void DlgOption::SubColumns::onColSelChanged(HANDLE hItem, INT_PTR) Column* pCol = reinterpret_cast(m_Columns.getItemData(hItem)); // general column settings - OptionsCtrl::Group hGeneral = m_Options.insertGroup(NULL, TranslateT("General column settings"), OptionsCtrl::OCF_ROOTGROUP); + OptionsCtrl::Group hGeneral = m_Options.insertGroup(nullptr, TranslateT("General column settings"), OptionsCtrl::OCF_ROOTGROUP); m_hColTitle = m_Options.insertEdit(hGeneral, TranslateT("Title (default if empty)"), pCol->getCustomTitle().c_str()); // column specific settings if (pCol->getFeatures() & Column::cfHasConfig) { - OptionsCtrl::Group hSpecific = m_Options.insertGroup(NULL, TranslateT("Column specific settings"), OptionsCtrl::OCF_ROOTGROUP); + OptionsCtrl::Group hSpecific = m_Options.insertGroup(nullptr, TranslateT("Column specific settings"), OptionsCtrl::OCF_ROOTGROUP); pCol->configToUI(m_Options, hSpecific); } - m_Options.ensureVisible(NULL); + m_Options.ensureVisible(nullptr); // show output info for current column HWND hInfo = GetDlgItem(getHWnd(), IDC_INFO); TVINSERTSTRUCT tvi; bool bPNGOutput = getParent()->isPNGOutput(); int nPNGMode = getParent()->getPNGMode(); - int restrictions = pCol->configGetRestrictions(NULL); + int restrictions = pCol->configGetRestrictions(nullptr); SendMessage(hInfo, WM_SETREDRAW, FALSE, 0); TreeView_DeleteAllItems(hInfo); @@ -494,9 +494,9 @@ void DlgOption::SubColumns::onColItemDropped(HANDLE hItem, HANDLE hDropTarget, B // perform move Column* pItem = reinterpret_cast(m_Columns.getItemData(hItem)); - Column* pDropTaregt = hDropTarget ? reinterpret_cast(m_Columns.getItemData(hDropTarget)) : NULL; + Column* pDropTaregt = hDropTarget ? reinterpret_cast(m_Columns.getItemData(hDropTarget)) : nullptr; - m_Columns.selectItem(NULL); + m_Columns.selectItem(nullptr); getParent()->getLocalSettings().moveCol(pItem, pDropTaregt); m_Columns.moveItem(hItem, hDropTarget); @@ -551,7 +551,7 @@ void DlgOption::SubColumns::onBandDropDown(HANDLE hButton, INT_PTR dwData) ptMenu.y, 0, getHWnd(), - NULL); + nullptr); DestroyMenu(hPopup); @@ -595,9 +595,9 @@ void DlgOption::SubColumns::onMoveUp() hPrev2 = m_Columns.getPrevItem(hPrev2); Column* pSelCol = reinterpret_cast(m_Columns.getItemData(hSel)); - Column* pPrev2Col = hPrev2 ? reinterpret_cast(m_Columns.getItemData(hPrev2)) : NULL; + Column* pPrev2Col = hPrev2 ? reinterpret_cast(m_Columns.getItemData(hPrev2)) : nullptr; - m_Columns.selectItem(NULL); + m_Columns.selectItem(nullptr); getParent()->getLocalSettings().moveCol(pSelCol, pPrev2Col); m_Columns.moveItem(hSel, hPrev2); @@ -620,7 +620,7 @@ void DlgOption::SubColumns::onMoveDown() Column* pSelCol = reinterpret_cast(m_Columns.getItemData(hSel)); Column* pNextCol = reinterpret_cast(m_Columns.getItemData(hNext)); - m_Columns.selectItem(NULL); + m_Columns.selectItem(nullptr); getParent()->getLocalSettings().moveCol(pSelCol, pNextCol); m_Columns.moveItem(hSel, hNext); @@ -658,12 +658,12 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp) Column* pCol = reinterpret_cast(m_Columns.getItemData(hItem)); if (pCol) { - int restrictions = pCol->configGetRestrictions(pHelp ? &curDetails : NULL); + int restrictions = pCol->configGetRestrictions(pHelp ? &curDetails : nullptr); // sanity check: either HTML or PNG has to be fully supported if ((restrictions & Column::crHTMLMask) != Column::crHTMLFull && (restrictions & Column::crPNGMask) != Column::crPNGFull) { - MessageBox(NULL, + MessageBox(nullptr, TranslateT("An internal column configuration error occurred. Please contact the author of this plugin."), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK); } diff --git a/plugins/HistoryStats/src/dlgoption_subexclude.cpp b/plugins/HistoryStats/src/dlgoption_subexclude.cpp index d0748d71f8..c0bf6e97f9 100644 --- a/plugins/HistoryStats/src/dlgoption_subexclude.cpp +++ b/plugins/HistoryStats/src/dlgoption_subexclude.cpp @@ -9,7 +9,7 @@ */ DlgOption::SubExclude::SubExclude() : - m_hItemAll(NULL), m_bChanged(false) + m_hItemAll(nullptr), m_bChanged(false) { } @@ -281,6 +281,6 @@ void DlgOption::SubExclude::setAll(HWND hCList, HANDLE hFirstItem, int iImage, b if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hCList, CLM_SETEXTRAIMAGE, reinterpret_cast(hItem), MAKELPARAM(0, iImage)); - hItem = bIterate ? reinterpret_cast(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast(hItem))) : NULL; + hItem = bIterate ? reinterpret_cast(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast(hItem))) : nullptr; } } diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp index 4727738845..2ceed39e26 100644 --- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp +++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp @@ -74,7 +74,7 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA RECT rDetails; GetWindowRect(GetDlgItem(hDlg, IDC_DESCRIPTION), &rDetails); - SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), NULL, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), nullptr, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER); } } return TRUE; @@ -129,16 +129,16 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA } DlgOption::SubGlobal::SubGlobal() : - m_hOnStartup(NULL), - m_hShowMainMenu(NULL), - m_hShowMainMenuSub(NULL), - m_hShowContactMenu(NULL), - m_hShowContactMenuPseudo(NULL), - m_hGraphicsMode(NULL), - m_hGraphicsModePNG(NULL), - m_hPNGMode(NULL), - m_hThreadLowPriority(NULL), - m_hPathToBrowser(NULL), + m_hOnStartup(nullptr), + m_hShowMainMenu(nullptr), + m_hShowMainMenuSub(nullptr), + m_hShowContactMenu(nullptr), + m_hShowContactMenuPseudo(nullptr), + m_hGraphicsMode(nullptr), + m_hGraphicsModePNG(nullptr), + m_hPNGMode(nullptr), + m_hThreadLowPriority(nullptr), + m_hPathToBrowser(nullptr), m_bShowInfo(false), m_nInfoHeight(0) { @@ -219,20 +219,20 @@ void DlgOption::SubGlobal::onWMInitDialog() // settings OptionsCtrl::Item hTemp; - hTemp = m_Options.insertGroup(NULL, TranslateT("Integration"), OptionsCtrl::OCF_ROOTGROUP); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Integration"), OptionsCtrl::OCF_ROOTGROUP); m_hOnStartup = m_Options.insertCheck(hTemp, TranslateT("Create statistics on Miranda NG startup")); m_hShowMainMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to main menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hShowMainMenuSub = m_Options.insertCheck(m_hShowMainMenu, TranslateT("Put menu items into submenu")); m_hShowContactMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to contact menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hShowContactMenuPseudo = m_Options.insertCheck(m_hShowContactMenu, TranslateT("Don't hide menu items for pseudo protocols")); m_hProtocols = m_Options.insertGroup(m_hShowContactMenu, TranslateT("Hide menu items for protocol...")); - hTemp = m_Options.insertGroup(NULL, TranslateT("Graphics"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); - m_hGraphicsMode = m_Options.insertRadio(hTemp, NULL, TranslateT("Only use HTML to simulate graphics")); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Graphics"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); + m_hGraphicsMode = m_Options.insertRadio(hTemp, nullptr, TranslateT("Only use HTML to simulate graphics")); m_hGraphicsModePNG = m_Options.insertRadio(hTemp, m_hGraphicsMode, TranslateT("Generate PNG files to represent graphics"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); - m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, NULL, TranslateT("Fall back to HTML output if column options require HTML output")); + m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, nullptr, TranslateT("Fall back to HTML output if column options require HTML output")); m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Enforce PNG output, possibly ignoring some column options")); m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Prefer HTML output over PNG output if available")); - hTemp = m_Options.insertGroup(NULL, TranslateT("Miscellaneous"), OptionsCtrl::OCF_ROOTGROUP); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Miscellaneous"), OptionsCtrl::OCF_ROOTGROUP); m_hThreadLowPriority = m_Options.insertCheck(hTemp, TranslateT("Generate statistics in background thread with low priority")); m_hPathToBrowser = m_Options.insertEdit(hTemp, TranslateT("Path to browser (leave blank for system default)")); @@ -251,7 +251,7 @@ void DlgOption::SubGlobal::onWMInitDialog() reinterpret_cast(protoList[i]->szModuleName))); } - m_Options.ensureVisible(NULL); + m_Options.ensureVisible(nullptr); // init support info list initSupportInfo(); diff --git a/plugins/HistoryStats/src/dlgoption_subinput.cpp b/plugins/HistoryStats/src/dlgoption_subinput.cpp index e04765daa4..f87cf76cde 100644 --- a/plugins/HistoryStats/src/dlgoption_subinput.cpp +++ b/plugins/HistoryStats/src/dlgoption_subinput.cpp @@ -6,20 +6,20 @@ */ DlgOption::SubInput::SubInput() : - m_hChatSessionMinDur(NULL), - m_hChatSessionTimeout(NULL), - m_hAverageMinTime(NULL), - m_hWordDelimiters(NULL), - m_hMetaContactsMode(NULL), - m_hMergeContacts(NULL), - m_hMergeContactsGroups(NULL), - m_hMergeMode(NULL), - m_hProtocols(NULL), - m_hIgnoreOlder(NULL), - m_hIgnoreBefore(NULL), - m_hIgnoreAfter(NULL), - m_hFilterRawRTF(NULL), - m_hFilterBBCodes(NULL) + m_hChatSessionMinDur(nullptr), + m_hChatSessionTimeout(nullptr), + m_hAverageMinTime(nullptr), + m_hWordDelimiters(nullptr), + m_hMetaContactsMode(nullptr), + m_hMergeContacts(nullptr), + m_hMergeContactsGroups(nullptr), + m_hMergeMode(nullptr), + m_hProtocols(nullptr), + m_hIgnoreOlder(nullptr), + m_hIgnoreBefore(nullptr), + m_hIgnoreAfter(nullptr), + m_hFilterRawRTF(nullptr), + m_hFilterBBCodes(nullptr) { } @@ -68,16 +68,16 @@ void DlgOption::SubInput::onWMInitDialog() // settings OptionsCtrl::Item hTemp, hTemp2; - hTemp = m_Options.insertGroup(NULL, TranslateT("History interpretation"), OptionsCtrl::OCF_ROOTGROUP); + hTemp = m_Options.insertGroup(nullptr, TranslateT("History interpretation"), OptionsCtrl::OCF_ROOTGROUP); m_hChatSessionMinDur = m_Options.insertEdit(hTemp, TranslateT("Time a chat session must last to be counted (seconds)"), L"", OptionsCtrl::OCF_NUMBER); m_hChatSessionTimeout = m_Options.insertEdit(hTemp, TranslateT("Time between two chat sessions (seconds)"), L"", OptionsCtrl::OCF_NUMBER); m_hAverageMinTime = m_Options.insertEdit(hTemp, TranslateT("Minimum time to assume when calculating average (days)"), L"", OptionsCtrl::OCF_NUMBER); m_hWordDelimiters = m_Options.insertEdit(hTemp, TranslateT("Word delimiting characters")); - hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Contact filtering"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); m_hProtocols = m_Options.insertGroup(hTemp, TranslateT("Ignore all contacts with protocol...")); hTemp2 = m_Options.insertGroup(hTemp, TranslateT("History read mode for metacontacts"), 0); - m_hMetaContactsMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Use only metacontact's history")); + m_hMetaContactsMode = m_Options.insertRadio(hTemp2, nullptr, TranslateT("Use only metacontact's history")); m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use only subcontacts' histories (for one metacontact)")); m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Use metacontact's history and its subcontacts' histories")); m_Options.insertRadio(hTemp2, m_hMetaContactsMode, TranslateT("Treat metacontacts and subcontacts as normal contacts")); @@ -85,10 +85,10 @@ void DlgOption::SubInput::onWMInitDialog() m_hMergeContacts = m_Options.insertCheck(hTemp, TranslateT("Merge contacts with same name"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hMergeContactsGroups = m_Options.insertCheck(m_hMergeContacts, TranslateT("Only merge if contacts are in the same group")); hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Duplicate detection when reading merged contacts")); - m_hMergeMode = m_Options.insertRadio(hTemp2, NULL, TranslateT("Merge events (tolerant)")); + m_hMergeMode = m_Options.insertRadio(hTemp2, nullptr, TranslateT("Merge events (tolerant)")); m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Merge events (strict)")); m_Options.insertRadio(hTemp2, m_hMergeMode, TranslateT("Don't merge events")); - hTemp = m_Options.insertGroup(NULL, TranslateT("Message filtering"), OptionsCtrl::OCF_ROOTGROUP); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Message filtering"), OptionsCtrl::OCF_ROOTGROUP); hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Ignore messages...")); m_hIgnoreOlder = m_Options.insertEdit(hTemp2, TranslateT("...older than (days, 0=no limit)"), L"", OptionsCtrl::OCF_NUMBER); m_hIgnoreBefore = m_Options.insertDateTime(hTemp2, TranslateT("...before date (none=no limit)"), 0, L"%Y-%m-%d", OptionsCtrl::OCF_ALLOWNONE); @@ -115,7 +115,7 @@ void DlgOption::SubInput::onWMInitDialog() if (!RTFFilter::available()) m_Options.enableItem(m_hFilterRawRTF, false); - m_Options.ensureVisible(NULL); + m_Options.ensureVisible(nullptr); } void DlgOption::SubInput::loadSettings() diff --git a/plugins/HistoryStats/src/dlgoption_suboutput.cpp b/plugins/HistoryStats/src/dlgoption_suboutput.cpp index 97be76691a..bd20a1744e 100644 --- a/plugins/HistoryStats/src/dlgoption_suboutput.cpp +++ b/plugins/HistoryStats/src/dlgoption_suboutput.cpp @@ -6,46 +6,46 @@ */ DlgOption::SubOutput::SubOutput() : - m_hRemoveEmptyContacts(NULL), - m_hRemoveInChatsZero(NULL), - m_hRemoveInBytesZero(NULL), - m_hRemoveOutChatsZero(NULL), - m_hRemoveOutBytesZero(NULL), - m_hOmitContacts(NULL), - m_hOmitByValue(NULL), - m_hOmitByValueData(NULL), - m_hOmitByValueLimit(NULL), - m_hOmitByTime(NULL), - m_hOmitByTimeDays(NULL), - m_hOmitByRank(NULL), - m_hOmitNumOnTop(NULL), - m_hOmittedInTotals(NULL), - m_hOmittedInExtraRow(NULL), - m_hCalcTotals(NULL), - m_hTableHeader(NULL), - m_hTableHeaderRepeat(NULL), - m_hTableHeaderVerbose(NULL), - m_hHeaderTooltips(NULL), - m_hHeaderTooltipsIfCustom(NULL), - m_hSort(NULL), - m_hNick(NULL), - m_hOutputVariables(NULL), - m_hOutputFile(NULL), - m_hOutputExtraToFolder(NULL), - m_hOutputExtraFolder(NULL), - m_hOverwriteAlways(NULL), - m_hAutoOpenOptions(NULL), - m_hAutoOpenStartup(NULL), - m_hAutoOpenMenu(NULL) + m_hRemoveEmptyContacts(nullptr), + m_hRemoveInChatsZero(nullptr), + m_hRemoveInBytesZero(nullptr), + m_hRemoveOutChatsZero(nullptr), + m_hRemoveOutBytesZero(nullptr), + m_hOmitContacts(nullptr), + m_hOmitByValue(nullptr), + m_hOmitByValueData(nullptr), + m_hOmitByValueLimit(nullptr), + m_hOmitByTime(nullptr), + m_hOmitByTimeDays(nullptr), + m_hOmitByRank(nullptr), + m_hOmitNumOnTop(nullptr), + m_hOmittedInTotals(nullptr), + m_hOmittedInExtraRow(nullptr), + m_hCalcTotals(nullptr), + m_hTableHeader(nullptr), + m_hTableHeaderRepeat(nullptr), + m_hTableHeaderVerbose(nullptr), + m_hHeaderTooltips(nullptr), + m_hHeaderTooltipsIfCustom(nullptr), + m_hSort(nullptr), + m_hNick(nullptr), + m_hOutputVariables(nullptr), + m_hOutputFile(nullptr), + m_hOutputExtraToFolder(nullptr), + m_hOutputExtraFolder(nullptr), + m_hOverwriteAlways(nullptr), + m_hAutoOpenOptions(nullptr), + m_hAutoOpenStartup(nullptr), + m_hAutoOpenMenu(nullptr) { array_each_(i, m_hSortBy) { - m_hSortBy[i] = NULL; + m_hSortBy[i] = nullptr; } array_each_(i, m_hSortDir) { - m_hSortDir[i] = NULL; + m_hSortDir[i] = nullptr; } } @@ -98,7 +98,7 @@ void DlgOption::SubOutput::onWMInitDialog() OptionsCtrl::Item hTemp; OptionsCtrl::Item hTemp2; - hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); m_hRemoveEmptyContacts = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with empty history")); m_hRemoveOutChatsZero = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only incoming chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hRemoveOutBytesZero = m_Options.insertCheck(m_hRemoveOutChatsZero, TranslateT("Remove only if you never answered")); @@ -116,14 +116,14 @@ void DlgOption::SubOutput::onWMInitDialog() m_hOmittedInTotals = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include omitted contacts in totals")); m_hOmittedInExtraRow = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include totals of omitted contacts in additional row")); m_hCalcTotals = m_Options.insertCheck(hTemp, TranslateT("Include totals in statistics")); - hTemp = m_Options.insertGroup(NULL, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); + hTemp = m_Options.insertGroup(nullptr, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS); m_hTableHeader = m_Options.insertCheck(hTemp, TranslateT("Output header"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK | OptionsCtrl::OCF_DISABLED | OptionsCtrl::OCF_NODISABLECHILDS); m_hTableHeaderRepeat = m_Options.insertEdit(m_hTableHeader, TranslateT("Repeat header every n contacts (0=don't repeat)"), L"0", OptionsCtrl::OCF_NUMBER); m_hTableHeaderVerbose = m_Options.insertCheck(m_hTableHeader, TranslateT("Make column titles more verbose")); m_hHeaderTooltips = m_Options.insertCheck(m_hTableHeader, TranslateT("Show tooltips with detailed information in column titles"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK); m_hHeaderTooltipsIfCustom = m_Options.insertCheck(m_hHeaderTooltips, TranslateT("Only show if a custom title was entered or if titles are not verbose")); - m_hSort = m_Options.insertGroup(NULL, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP); - hTemp = m_Options.insertGroup(NULL, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP); + m_hSort = m_Options.insertGroup(nullptr, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP); + hTemp = m_Options.insertGroup(nullptr, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP); m_hNick = m_Options.insertEdit(hTemp, TranslateT("Own nick for statistics")); hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Output files and folders")); m_hOutputVariables = m_Options.insertCheck(hTemp2, TranslateT("Substitute variables in output file name and subfolder for additional files")); @@ -200,7 +200,7 @@ void DlgOption::SubOutput::onWMInitDialog() m_Options.addComboItem(m_hSortBy[i], TranslateW(sortKeys[j].desc)); } - m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], NULL, TranslateT("Ascending")); + m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], nullptr, TranslateT("Ascending")); m_Options.insertRadio(m_hSortBy[i], m_hSortDir[i], TranslateT("Descending")); } @@ -232,7 +232,7 @@ void DlgOption::SubOutput::onWMInitDialog() m_Options.addComboItem(m_hOmitByValueData, TranslateW(omitData[i])); } - m_Options.ensureVisible(NULL); + m_Options.ensureVisible(nullptr); } void DlgOption::SubOutput::loadSettings() diff --git a/plugins/HistoryStats/src/iconlib.cpp b/plugins/HistoryStats/src/iconlib.cpp index d8a6dc5417..0fa5d6a40e 100644 --- a/plugins/HistoryStats/src/iconlib.cpp +++ b/plugins/HistoryStats/src/iconlib.cpp @@ -5,15 +5,15 @@ #include "resource.h" bool IconLib::m_bIcoLibAvailable = false; -HANDLE IconLib::m_hHookSkin2IconsChanged = NULL; +HANDLE IconLib::m_hHookSkin2IconsChanged = nullptr; IconLib::IconInfo IconLib::m_IconInfo[] = { - { IDI_HISTORYSTATS , "main_menu" , NULL, LPGENW("Create statistics (main menu)") }, - { IDI_HISTORYSTATS , "menu_show" , NULL, LPGENW("Show statistics (main menu)") }, - { IDI_HISTORYSTATS , "menu_config" , NULL, LPGENW("Configure... (main menu)") }, - { IDI_HISTORYSTATS , "contact_menu" , NULL, LPGENW("Contact menu") }, - { IDI_EXCLUDE_NO , "exclude_no" , NULL, LPGENW("Unexcluded contacts") }, - { IDI_EXCLUDE_YES , "exclude_yes" , NULL, LPGENW("Excluded contacts") }, + { IDI_HISTORYSTATS , "main_menu" , nullptr, LPGENW("Create statistics (main menu)") }, + { IDI_HISTORYSTATS , "menu_show" , nullptr, LPGENW("Show statistics (main menu)") }, + { IDI_HISTORYSTATS , "menu_config" , nullptr, LPGENW("Configure... (main menu)") }, + { IDI_HISTORYSTATS , "contact_menu" , nullptr, LPGENW("Contact menu") }, + { IDI_EXCLUDE_NO , "exclude_no" , nullptr, LPGENW("Unexcluded contacts") }, + { IDI_EXCLUDE_YES , "exclude_yes" , nullptr, LPGENW("Excluded contacts") }, { IDI_TREE_CHECK1 , "tree_check1" , LPGENW("Options tree"), LPGENW("Checkbox") }, { IDI_TREE_CHECK2 , "tree_check2" , LPGENW("Options tree"), LPGENW("Checkbox (checked)") }, { IDI_TREE_CHECK3 , "tree_check3" , LPGENW("Options tree"), LPGENW("Checkbox (disabled)") }, @@ -52,7 +52,7 @@ void IconLib::init() { array_each_(i, m_IconInfo) { - m_IconInfo[i].hIcon = NULL; + m_IconInfo[i].hIcon = nullptr; } if (m_bIcoLibAvailable = mu::icolib::_available()) { @@ -124,7 +124,7 @@ void IconLib::uninit() { if (m_IconInfo[i].hIcon) { DestroyIcon(m_IconInfo[i].hIcon); - m_IconInfo[i].hIcon = NULL; + m_IconInfo[i].hIcon = nullptr; } } } diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 19f1a84612..202a6fcea0 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -31,17 +31,17 @@ PLUGININFOEX g_pluginInfoEx = { {0xf184f5a0, 0xc198, 0x4454, {0xa9, 0xb4, 0xf6, 0xe2, 0xfd, 0x53, 0x41, 0x33}}, }; -SettingsSerializer* g_pSettings = NULL; +SettingsSerializer* g_pSettings = nullptr; bool g_bMainMenuExists = false; bool g_bContactMenuExists = false; bool g_bExcludeLock = false; bool g_bConfigureLock = false; -static HGENMENU g_hMenuCreateStatistics = NULL; -static HGENMENU g_hMenuShowStatistics = NULL; -static HGENMENU g_hMenuConfigure = NULL; -static HGENMENU g_hMenuToggleExclude = NULL; +static HGENMENU g_hMenuCreateStatistics = nullptr; +static HGENMENU g_hMenuShowStatistics = nullptr; +static HGENMENU g_hMenuConfigure = nullptr; +static HGENMENU g_hMenuToggleExclude = nullptr; #if defined(HISTORYSTATS_HISTORYCOPY) static HGENMENU g_hMenuHistoryCopy = NULL; @@ -93,16 +93,16 @@ static INT_PTR SvcSetExclude(WPARAM hContact, LPARAM lParam) static void MenuIconsChanged(LPARAM) { if (g_hMenuCreateStatistics) - Menu_ModifyItem(g_hMenuCreateStatistics, NULL, IconLib::getIcon(IconLib::iiMenuCreateStatistics)); + Menu_ModifyItem(g_hMenuCreateStatistics, nullptr, IconLib::getIcon(IconLib::iiMenuCreateStatistics)); if (g_hMenuShowStatistics) - Menu_ModifyItem(g_hMenuShowStatistics, NULL, IconLib::getIcon(IconLib::iiMenuShowStatistics)); + Menu_ModifyItem(g_hMenuShowStatistics, nullptr, IconLib::getIcon(IconLib::iiMenuShowStatistics)); if (g_hMenuConfigure) - Menu_ModifyItem(g_hMenuConfigure, NULL, IconLib::getIcon(IconLib::iiMenuConfigure)); + Menu_ModifyItem(g_hMenuConfigure, nullptr, IconLib::getIcon(IconLib::iiMenuConfigure)); if (g_hMenuToggleExclude) - Menu_ModifyItem(g_hMenuToggleExclude, NULL, IconLib::getIcon(IconLib::iiContactMenu)); + Menu_ModifyItem(g_hMenuToggleExclude, nullptr, IconLib::getIcon(IconLib::iiContactMenu)); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -119,7 +119,7 @@ static INT_PTR MenuShowStatistics(WPARAM, LPARAM) if (g_pSettings->canShowStatistics()) g_pSettings->showStatistics(); else - MessageBox(NULL, + MessageBox(nullptr, TranslateT("The statistics can't be found. Either you never created them or the last created statistics were moved to a different location and can't be found anymore."), TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK); @@ -145,7 +145,7 @@ void AddMainMenu() CreateServiceFunction(con::SvcShowStatistics, MenuShowStatistics); CreateServiceFunction(con::SvcConfigure, MenuConfigure); - HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENW("Statistics"), 1910000000) : NULL; + HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENW("Statistics"), 1910000000) : nullptr; Menu_ConfigureItem(hRoot, MCI_OPT_UID, "7F116B24-9D84-4D04-B6AA-EED95051A184"); g_hMenuCreateStatistics = mu::clist::addMainMenuItem( @@ -339,7 +339,7 @@ static int EventOptInitialise(WPARAM wParam, LPARAM) wParam, TranslateT("History"), TranslateT("Statistics"), - NULL, + nullptr, DlgOption::staticDlgProc, MAKEINTRESOURCEA(IDD_OPTIONS), g_hInst); @@ -406,13 +406,13 @@ extern "C" __declspec(dllexport) int Load() pcli = Clist_GetInterface(); // init COM, needed for GUID generation - CoInitialize(NULL); + CoInitialize(nullptr); // register our own window classes if (!BandCtrlImpl::registerClass() || !OptionsCtrlImpl::registerClass()) { MessageBox( - 0, + nullptr, L"Failed to register a required window class. Can't continue loading plugin.", L"HistoryStats - Error", MB_OK | MB_ICONERROR); @@ -424,7 +424,7 @@ extern "C" __declspec(dllexport) int Load() if (!mu::load()) { MessageBox( - 0, + nullptr, L"This version of HistoryStats isn't compatible with your Miranda NG " L"version. Possibly, your Miranda NG is outdated or you are trying to " L"use the Unicode version with a non-Unicode Miranda NG.\r\n\r\n" diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp index f217bb5bb7..66de169919 100644 --- a/plugins/HistoryStats/src/mirandacontact.cpp +++ b/plugins/HistoryStats/src/mirandacontact.cpp @@ -46,7 +46,7 @@ void MirandaContact::stripMetaID(DBEVENTINFO& dbe) if (dbe.cbBlob >= 6 && !pTextBegin[dbe.cbBlob - 1]) { char* pIDEnd = pTextBegin + dbe.cbBlob - 1; char* pIDBegin = pIDEnd; - char* pIDSep = NULL; + char* pIDSep = nullptr; while (pIDBegin >= pTextBegin + 2 && *--pIDBegin) if (*pIDBegin == '*') @@ -104,7 +104,7 @@ void MirandaContact::beginRead() ci.hContact = m_Sources[j]; ci.hEvent = db_event_first(ci.hContact); - ci.ei.dbe.pBlob = NULL; + ci.ei.dbe.pBlob = nullptr; ci.ei.nAllocated = 0; fetchSlot(j); @@ -209,7 +209,7 @@ void MirandaContactTolerantMerge::fillQueue() m_SpareEIs.pop_front(); } else { - ci.ei.dbe.pBlob = NULL; + ci.ei.dbe.pBlob = nullptr; ci.ei.nAllocated = 0; } } @@ -273,7 +273,7 @@ void MirandaContactStrictMerge::fillQueue() m_SpareEIs.pop_front(); } else { - ci.ei.dbe.pBlob = NULL; + ci.ei.dbe.pBlob = nullptr; ci.ei.nAllocated = 0; } } @@ -310,7 +310,7 @@ void MirandaContactNoMerge::fillQueue() m_SpareEIs.pop_front(); } else { - ci.ei.dbe.pBlob = NULL; + ci.ei.dbe.pBlob = nullptr; ci.ei.nAllocated = 0; } @@ -335,6 +335,6 @@ MirandaContact* MirandaContactFactory::makeMirandaContact(int MergeMode, const e return new MirandaContactNoMerge(strNick, strProtocol, strGroup, sources); default: - return 0; + return nullptr; } } diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 62c9e21bb0..212485233a 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -56,7 +56,7 @@ namespace mu void addIcon(const wchar_t* szSection, const wchar_t* szDescription, const char* szIconName, const char* szDefaultFile, int iDefaultIndex) { - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.section.w = const_cast(szSection); sid.description.w = const_cast(szDescription); sid.pszName = const_cast(szIconName); @@ -148,14 +148,14 @@ namespace mu char* wideToAnsiDup(const WCHAR* pszWide, UINT uCP /* = CP_ACP */) { if (!pszWide) - return NULL; + return nullptr; - int len = WideCharToMultiByte(uCP, 0, pszWide, -1, NULL, 0, NULL, NULL); + int len = WideCharToMultiByte(uCP, 0, pszWide, -1, nullptr, 0, nullptr, nullptr); char* result = reinterpret_cast(malloc(sizeof(char)* len)); if (!result) - return NULL; + return nullptr; - WideCharToMultiByte(uCP, 0, pszWide, -1, result, len, NULL, NULL); + WideCharToMultiByte(uCP, 0, pszWide, -1, result, len, nullptr, nullptr); result[len - 1] = 0; return result; } @@ -163,12 +163,12 @@ namespace mu WCHAR* ansiToWideDup(const char* pszAnsi, UINT uCP /* = CP_ACP */) { if (!pszAnsi) - return NULL; + return nullptr; - int len = MultiByteToWideChar(uCP, 0, pszAnsi, -1, NULL, 0); + int len = MultiByteToWideChar(uCP, 0, pszAnsi, -1, nullptr, 0); WCHAR* result = reinterpret_cast(malloc(sizeof(WCHAR)* len)); if (!result) - return NULL; + return nullptr; MultiByteToWideChar(uCP, 0, pszAnsi, -1, result, len); result[len - 1] = 0; @@ -178,16 +178,16 @@ namespace mu char* wideToAnsi(const WCHAR* pszWide, char* pszRes, int maxLen, UINT uCP /* = CP_ACP */) { if (!pszWide) - return NULL; + return nullptr; - WideCharToMultiByte(uCP, 0, pszWide, -1, pszRes, maxLen, NULL, NULL); + WideCharToMultiByte(uCP, 0, pszWide, -1, pszRes, maxLen, nullptr, nullptr); return pszRes; } WCHAR* ansiToWide(const char* pszAnsi, WCHAR* pszRes, int maxLen, UINT uCP /* = CP_ACP */) { if (!pszAnsi) - return NULL; + return nullptr; MultiByteToWideChar(uCP, 0, pszAnsi, -1, pszRes, maxLen); return pszRes; diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp index 95c17cd380..9b4a1333e8 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp @@ -9,7 +9,7 @@ */ const wchar_t* OptionsCtrlImpl::m_ClassName = L"HistoryStatsOptions"; -HIMAGELIST OptionsCtrlImpl::m_hStateIcons = NULL; +HIMAGELIST OptionsCtrlImpl::m_hStateIcons = nullptr; int OptionsCtrlImpl::m_nStateIconsRef = 0; LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -56,7 +56,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar case WM_WINDOWPOSCHANGED: { WINDOWPOS* pWP = reinterpret_cast(lParam); - SetWindowPos(pCtrl->m_hTree, NULL, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(pCtrl->m_hTree, nullptr, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } return 0; @@ -346,7 +346,7 @@ void OptionsCtrlImpl::staticFreeStateImages() IconLib::unregisterCallback(staticUpdateStateImages, 0); ImageList_Destroy(m_hStateIcons); - m_hStateIcons = NULL; + m_hStateIcons = nullptr; } } @@ -390,12 +390,12 @@ bool OptionsCtrlImpl::registerClass() 0, // cbClsExtra sizeof(OptionsCtrlImpl*), // cbWndExtra g_hInst, // hInstance - NULL, // hIcon - NULL, // hCursor - NULL, // hbrBackground - NULL, // lpszMenuName + nullptr, // hIcon + nullptr, // hCursor + nullptr, // hbrBackground + nullptr, // lpszMenuName m_ClassName, // lpszClassName - NULL // hIconSm + nullptr // hIconSm }; if (!RegisterClassEx(&wcx)) @@ -416,7 +416,7 @@ void OptionsCtrlImpl::unregisterClass() } OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, UINT_PTR nOwnId) : - m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(NULL), m_pfnOldTreeProc(NULL), m_bModified(true), m_hDragItem(NULL) + m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(nullptr), m_pfnOldTreeProc(nullptr), m_bModified(true), m_hDragItem(nullptr) { } @@ -443,7 +443,7 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS) m_hWnd, reinterpret_cast(ccTree), g_hInst, - NULL); + nullptr); if (!m_hTree) return -1; @@ -468,11 +468,11 @@ void OptionsCtrlImpl::onWMDestroy() // undo subclassing of tree view SetWindowLongPtr(m_hTree, GWLP_WNDPROC, reinterpret_cast(m_pfnOldTreeProc)); - m_pfnOldTreeProc = NULL; + m_pfnOldTreeProc = nullptr; // destroy tree view before invalidating 'this' DestroyWindow(m_hTree); - m_hTree = NULL; + m_hTree = nullptr; } void OptionsCtrlImpl::onNMClick() @@ -547,7 +547,7 @@ void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView) nmoc.hdr.code = OCN_SELCHANGING; nmoc.hdr.hwndFrom = m_hWnd; nmoc.hdr.idFrom = m_nOwnId; - nmoc.hItem = 0; + nmoc.hItem = nullptr; nmoc.dwData = 0; SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast(&nmoc)); @@ -559,7 +559,7 @@ void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView) // do actual delete Item* pItem = getItem(pNMTreeView->itemOld.hItem); - setItem(pNMTreeView->itemOld.hItem, NULL); + setItem(pNMTreeView->itemOld.hItem, nullptr); pItem->onDeselect(); @@ -638,7 +638,7 @@ void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt) HTREEITEM hDragItem = m_hDragItem; TreeView_SetInsertMark(m_hTree, NULL, FALSE); - m_hDragItem = NULL; + m_hDragItem = nullptr; ReleaseCapture(); // check for drop target and handle @@ -773,7 +773,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertGroup(HTREEITEM hParent, OCGROUP* pGroup) assert(pGroup); assert(pGroup->szLabel); - return (new Group(this, hParent ? getItem(hParent) : NULL, pGroup->szLabel, pGroup->dwFlags, pGroup->dwData))->m_hItem; + return (new Group(this, hParent ? getItem(hParent) : nullptr, pGroup->szLabel, pGroup->dwFlags, pGroup->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertCheck(HTREEITEM hParent, OCCHECK* pCheck) @@ -781,7 +781,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertCheck(HTREEITEM hParent, OCCHECK* pCheck) assert(pCheck); assert(pCheck->szLabel); - return (new Check(this, hParent ? getItem(hParent) : NULL, pCheck->szLabel, pCheck->dwFlags, pCheck->dwData))->m_hItem; + return (new Check(this, hParent ? getItem(hParent) : nullptr, pCheck->szLabel, pCheck->dwFlags, pCheck->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertRadio(HTREEITEM hParent, OCRADIO* pRadio) @@ -789,11 +789,11 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertRadio(HTREEITEM hParent, OCRADIO* pRadio) assert(pRadio); assert(pRadio->szLabel); - Item* pSibling = pRadio->hSibling ? getItem(reinterpret_cast(pRadio->hSibling)) : NULL; + Item* pSibling = pRadio->hSibling ? getItem(reinterpret_cast(pRadio->hSibling)) : nullptr; assert(!pSibling || pSibling->m_ItemType == itRadio); - return (new Radio(this, hParent ? getItem(hParent) : NULL, reinterpret_cast(pSibling), pRadio->szLabel, pRadio->dwFlags, pRadio->dwData))->m_hItem; + return (new Radio(this, hParent ? getItem(hParent) : nullptr, reinterpret_cast(pSibling), pRadio->szLabel, pRadio->dwFlags, pRadio->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertEdit(HTREEITEM hParent, OCEDIT* pEdit) @@ -802,7 +802,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertEdit(HTREEITEM hParent, OCEDIT* pEdit) assert(pEdit->szLabel); assert(pEdit->szEdit); - return (new Edit(this, hParent ? getItem(hParent) : NULL, pEdit->szLabel, pEdit->szEdit, pEdit->dwFlags, pEdit->dwData))->m_hItem; + return (new Edit(this, hParent ? getItem(hParent) : nullptr, pEdit->szLabel, pEdit->szEdit, pEdit->dwFlags, pEdit->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertCombo(HTREEITEM hParent, OCCOMBO* pCombo) @@ -810,7 +810,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertCombo(HTREEITEM hParent, OCCOMBO* pCombo) assert(pCombo); assert(pCombo->szLabel); - return (new Combo(this, hParent ? getItem(hParent) : NULL, pCombo->szLabel, pCombo->dwFlags, pCombo->dwData))->m_hItem; + return (new Combo(this, hParent ? getItem(hParent) : nullptr, pCombo->szLabel, pCombo->dwFlags, pCombo->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertButton(HTREEITEM hParent, OCBUTTON* pButton) @@ -819,7 +819,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertButton(HTREEITEM hParent, OCBUTTON* pButto assert(pButton->szLabel); assert(pButton->szButton); - return (new Button(this, hParent ? getItem(hParent) : NULL, pButton->szLabel, pButton->szButton, pButton->dwFlags, pButton->dwData))->m_hItem; + return (new Button(this, hParent ? getItem(hParent) : nullptr, pButton->szLabel, pButton->szButton, pButton->dwFlags, pButton->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertDateTime(HTREEITEM hParent, OCDATETIME* pDateTime) @@ -828,7 +828,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertDateTime(HTREEITEM hParent, OCDATETIME* pD assert(pDateTime->szLabel); assert(pDateTime->szFormat); - return (new DateTime(this, hParent ? getItem(hParent) : NULL, pDateTime->szLabel, pDateTime->szFormat, pDateTime->dwDateTime, pDateTime->dwFlags, pDateTime->dwData))->m_hItem; + return (new DateTime(this, hParent ? getItem(hParent) : nullptr, pDateTime->szLabel, pDateTime->szFormat, pDateTime->dwDateTime, pDateTime->dwFlags, pDateTime->dwData))->m_hItem; } HTREEITEM OptionsCtrlImpl::onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor) @@ -836,7 +836,7 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor) assert(pColor); assert(pColor->szLabel); - return (new Color(this, hParent ? getItem(hParent) : NULL, pColor->szLabel, pColor->crColor, pColor->dwFlags, pColor->dwData))->m_hItem; + return (new Color(this, hParent ? getItem(hParent) : nullptr, pColor->szLabel, pColor->crColor, pColor->dwFlags, pColor->dwData))->m_hItem; } const wchar_t* OptionsCtrlImpl::onOCMGetItemLabel(HTREEITEM hItem) @@ -1015,7 +1015,7 @@ HTREEITEM OptionsCtrlImpl::onOCMGetItem(HTREEITEM hItem, DWORD dwFlag) return TreeView_GetPrevSibling(m_hTree, hItem); default: - return NULL; + return nullptr; } } @@ -1152,7 +1152,7 @@ bool OptionsCtrlImpl::isItemValid(HTREEITEM hItem) TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hItem; - Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast(tvi.lParam) : NULL; + Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast(tvi.lParam) : nullptr; return bool_(pItem); } @@ -1164,7 +1164,7 @@ OptionsCtrlImpl::Item* OptionsCtrlImpl::getItem(HTREEITEM hItem) TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hItem; - Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast(tvi.lParam) : NULL; + Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast(tvi.lParam) : nullptr; assert(pItem); diff --git a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp index 868fa46436..ebf47ae9ba 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp @@ -9,7 +9,7 @@ OptionsCtrlImpl::Button::Button(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szButton, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itButton, szLabel, dwFlags, dwData) - , m_hButtonWnd(NULL) + , m_hButtonWnd(nullptr) , m_strButton(szButton) { m_pCtrl->insertItem(pParent, this, m_strLabel.c_str(), dwFlags, m_bEnabled ? siButton : siButtonG); @@ -47,7 +47,7 @@ void OptionsCtrlImpl::Button::onSelect() if (hTempWnd = CreateWindowEx( 0, WC_BUTTON, m_strButton.c_str(), dwStyle, r.left, r.top, r.right - r.left, r.bottom - r.top, - m_pCtrl->m_hTree, reinterpret_cast(ccButton), g_hInst, NULL)) + m_pCtrl->m_hTree, reinterpret_cast(ccButton), g_hInst, nullptr)) { SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast(hTreeFront), MAKELPARAM(TRUE, 0)); @@ -74,9 +74,9 @@ void OptionsCtrlImpl::Button::onDeselect() m_pCtrl->setNodeText(m_hItem, m_strLabel.c_str()); DestroyWindow(m_hButtonWnd); - m_hButtonWnd = NULL; + m_hButtonWnd = nullptr; - InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE); + InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE); } } diff --git a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp index 3439d87832..b7ff993eed 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp @@ -14,7 +14,7 @@ COLORREF OptionsCtrlImpl::Color::getColorValue() OptionsCtrlImpl::Color::Color(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, COLORREF crColor, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itColor, szLabel, dwFlags, dwData) - , m_hColorWnd(NULL) + , m_hColorWnd(nullptr) , m_crColor(crColor) { m_pCtrl->insertItem(pParent, this, m_strLabel.c_str(), dwFlags, m_bEnabled ? siColor : siColorG); @@ -54,9 +54,9 @@ void OptionsCtrlImpl::Color::onSelect() DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP; if (hTempWnd = CreateWindowEx( - 0, _A2W(WNDCLASS_COLOURPICKER), NULL, dwStyle, + 0, _A2W(WNDCLASS_COLOURPICKER), nullptr, dwStyle, r.left, r.top, r.right - r.left, r.bottom - r.top, - m_pCtrl->m_hTree, reinterpret_cast(ccColor), g_hInst, NULL)) + m_pCtrl->m_hTree, reinterpret_cast(ccColor), g_hInst, nullptr)) { SendMessage(hTempWnd, CPM_SETCOLOUR, 0, m_crColor); @@ -83,9 +83,9 @@ void OptionsCtrlImpl::Color::onDeselect() m_pCtrl->setNodeText(m_hItem, m_strLabel.c_str()); DestroyWindow(m_hColorWnd); - m_hColorWnd = NULL; + m_hColorWnd = nullptr; - InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE); + InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE); } } diff --git a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp index db0837a97e..5e8aa5bad6 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp @@ -47,7 +47,7 @@ ext::string OptionsCtrlImpl::Combo::getCombinedText() } OptionsCtrlImpl::Combo::Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData) - : Item(pCtrl, itCombo, szLabel, dwFlags, dwData), m_hComboWnd(NULL), m_nSelected(-1) + : Item(pCtrl, itCombo, szLabel, dwFlags, dwData), m_hComboWnd(nullptr), m_nSelected(-1) { m_bDisableChildsOnIndex0 = bool_(dwFlags & OCF_DISABLECHILDSONINDEX0); @@ -88,7 +88,7 @@ void OptionsCtrlImpl::Combo::onSelect() if (hTempWnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_COMBOBOX, L"", dwStyle, r.left, r.top, r.right - r.left, (r.bottom - r.top) * 20, - m_pCtrl->m_hTree, reinterpret_cast(ccCombo), g_hInst, NULL)) + m_pCtrl->m_hTree, reinterpret_cast(ccCombo), g_hInst, nullptr)) { vector_each_(i, m_Items) { @@ -127,9 +127,9 @@ void OptionsCtrlImpl::Combo::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str()); DestroyWindow(m_hComboWnd); - m_hComboWnd = NULL; + m_hComboWnd = nullptr; - InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE); + InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE); // enable childs? enableChildsCombo(); diff --git a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp index 0a32c7a29c..9a089fc886 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp @@ -181,7 +181,7 @@ ext::string OptionsCtrlImpl::DateTime::getCombinedText() } OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szFormat, time_t timestamp, DWORD dwFlags, INT_PTR dwData) -: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(NULL), m_strFormat(szFormat), m_timestamp(timestamp) +: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(nullptr), m_strFormat(szFormat), m_timestamp(timestamp) { m_bDisableChildsOnNone = bool_(dwFlags & OCF_DISABLECHILDSONNONE); m_bAllowNone = bool_(dwFlags & OCF_ALLOWNONE); @@ -221,7 +221,7 @@ void OptionsCtrlImpl::DateTime::onSelect() if (hTempWnd = CreateWindowEx( WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, L"", dwStyle, r.left, r.top, r.right - r.left, r.bottom - r.top, - m_pCtrl->m_hTree, reinterpret_cast(ccDateTime), g_hInst, NULL)) { + m_pCtrl->m_hTree, reinterpret_cast(ccDateTime), g_hInst, nullptr)) { // restrict to dates a timestamp can hold (with 1 day less to avoid timezone issues) SYSTEMTIME stMinMax[2] = { toSystemTime(0x00000000 + 24 * 60 * 60), toSystemTime(0x7FFFFFFF - 24 * 60 * 60) }; @@ -266,9 +266,9 @@ void OptionsCtrlImpl::DateTime::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str()); DestroyWindow(m_hDateTimeWnd); - m_hDateTimeWnd = NULL; + m_hDateTimeWnd = nullptr; - InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE); + InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE); // enable childs? enableChildsDateTime(); diff --git a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp index c297fedd16..df4991990b 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp @@ -39,7 +39,7 @@ ext::string OptionsCtrlImpl::Edit::getCombinedText() } OptionsCtrlImpl::Edit::Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szEdit, DWORD dwFlags, INT_PTR dwData) - : Item(pCtrl, itEdit, szLabel, dwFlags, dwData), m_hEditWnd(NULL) + : Item(pCtrl, itEdit, szLabel, dwFlags, dwData), m_hEditWnd(nullptr) { m_strEdit = szEdit; m_bNumber = bool_(dwFlags & OCF_NUMBER); @@ -85,7 +85,7 @@ void OptionsCtrlImpl::Edit::onSelect() if (hTempWnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_EDIT, m_strEdit.c_str(), dwStyle, r.left, r.top, r.right - r.left, r.bottom - r.top, - m_pCtrl->m_hTree, reinterpret_cast(ccEdit), g_hInst, NULL)) + m_pCtrl->m_hTree, reinterpret_cast(ccEdit), g_hInst, nullptr)) { SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast(hTreeFront), MAKELPARAM(TRUE, 0)); @@ -114,9 +114,9 @@ void OptionsCtrlImpl::Edit::onDeselect() m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str()); DestroyWindow(m_hEditWnd); - m_hEditWnd = NULL; + m_hEditWnd = nullptr; - InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : NULL, TRUE); + InvalidateRect(m_pCtrl->m_hTree, bValidRect ? &rToInvalidate : nullptr, TRUE); } } diff --git a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp index 2900ce6a44..faf8ec18e0 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp @@ -6,7 +6,7 @@ */ OptionsCtrlImpl::Item::Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData) : - m_pCtrl(pCtrl), m_hItem(NULL), m_nRef(1), m_ItemType(ItemType), m_strLabel(szLabel), m_dwData(dwData) + m_pCtrl(pCtrl), m_hItem(nullptr), m_nRef(1), m_ItemType(ItemType), m_strLabel(szLabel), m_dwData(dwData) { m_bEnabled = !(dwFlags & OCF_DISABLED); m_bDisableChilds = !(dwFlags & OCF_NODISABLECHILDS); diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp index 9ed6692ff7..722e6e0c96 100644 --- a/plugins/HistoryStats/src/settings.cpp +++ b/plugins/HistoryStats/src/settings.cpp @@ -41,7 +41,7 @@ Settings::CharMapper::CharMapper(const Settings& settings) Settings::Filter::Filter(const ext::string& strID) : m_strID(strID), m_nMode(fwmWordsMatching), m_nRef(0) { - time_t curTime = time(NULL); + time_t curTime = time(nullptr); struct tm* curTM = localtime(&curTime); m_strName += utils::intToPadded(1900 + curTM->tm_year, 4); @@ -393,7 +393,7 @@ const Settings::Filter* Settings::getFilter(const ext::string& strID) const return &(*i); } - return NULL; + return nullptr; } Settings& Settings::operator =(const Settings& other) @@ -569,7 +569,7 @@ void Settings::ensureConstraints() void Settings::openURL(const wchar_t *szURL) { if (m_PathToBrowser.empty()) - ShellExecute(NULL, L"open", szURL, NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", szURL, nullptr, nullptr, SW_SHOWNORMAL); else - ShellExecute(NULL, L"open", m_PathToBrowser.c_str(), szURL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", m_PathToBrowser.c_str(), szURL, nullptr, SW_SHOWNORMAL); } diff --git a/plugins/HistoryStats/src/settingstree.cpp b/plugins/HistoryStats/src/settingstree.cpp index 21d6501cf8..ff3893777c 100644 --- a/plugins/HistoryStats/src/settingstree.cpp +++ b/plugins/HistoryStats/src/settingstree.cpp @@ -10,12 +10,12 @@ void SettingsTree::makeKeyValid() } SettingsTree::SettingsTree() : - m_pCurValues(NULL) + m_pCurValues(nullptr) { } SettingsTree::SettingsTree(const ext::string& config) : - m_pCurValues(NULL) + m_pCurValues(nullptr) { fromString(config); } @@ -122,7 +122,7 @@ void SettingsTree::setKey(const wchar_t* key) if (i != m_Keys.end()) m_pCurValues = &i->second; else - m_pCurValues = NULL; + m_pCurValues = nullptr; } bool SettingsTree::readBool(const wchar_t* setting, bool errorValue) const @@ -213,7 +213,7 @@ bool SettingsTree::delSetting(const wchar_t* setting) if (m_pCurValues->size() == 0) { m_Keys.erase(m_CurKey); - m_pCurValues = NULL; + m_pCurValues = nullptr; } return true; diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index 50cd82c8ad..842e24106e 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -31,7 +31,7 @@ void Statistic::prepareColumns() { Column *pCol = m_Settings.getCol(i); if (pCol->isEnabled()) { - int restrictions = pCol->configGetRestrictions(NULL); + int restrictions = pCol->configGetRestrictions(nullptr); // MEMO: checks for columns having no HTML-only support if (!bOutputPNG && !(restrictions & Column::crHTMLMask)) @@ -541,7 +541,7 @@ bool Statistic::stepSortContacts() ContactCompareBase** ppCmps = new ContactCompareBase*[cmpDepth]; - ContactCompareBase* pCmp = NULL; + ContactCompareBase* pCmp = nullptr; ContactCompareBase* pPrev = &cmpName; for (int i = cmpDepth - 1; i >= 0; --i) { @@ -658,7 +658,7 @@ bool Statistic::stepSortContacts() pCmp->setDir(m_Settings.m_Sort[i].asc); ppCmps[i] = pPrev = pCmp; - pCmp = NULL; + pCmp = nullptr; } std::sort(m_Contacts.begin(), m_Contacts.end(), ContactCompareOp(ppCmps[0])); @@ -707,25 +707,25 @@ bool Statistic::stepOmitContacts() double (Contact::*double_fn)() const; DWORD(Contact::*DWORD_fn)() const; } valueMap[] = { - { 0, 1.0, &Contact::getInBytes, 0, 0 }, - { 0, 1.0, &Contact::getOutBytes, 0, 0 }, - { 0, 1.0, &Contact::getTotalBytes, 0, 0 }, - { 1, 604800.0, 0, &Contact::getInBytesAvg, 0 }, - { 1, 604800.0, 0, &Contact::getOutBytesAvg, 0 }, - { 1, 604800.0, 0, &Contact::getTotalBytesAvg, 0 }, - { 0, 1.0, &Contact::getInMessages, 0, 0 }, - { 0, 1.0, &Contact::getOutMessages, 0, 0 }, - { 0, 1.0, &Contact::getTotalMessages, 0, 0 }, - { 1, 604800.0, 0, &Contact::getInMessagesAvg, 0 }, - { 1, 604800.0, 0, &Contact::getOutMessagesAvg, 0 }, - { 1, 604800.0, 0, &Contact::getTotalMessagesAvg, 0 }, - { 0, 1.0, &Contact::getInChats, 0, 0 }, - { 0, 1.0, &Contact::getOutChats, 0, 0 }, - { 0, 1.0, &Contact::getTotalChats, 0, 0 }, - { 1, 604800.0, 0, &Contact::getInChatsAvg, 0 }, - { 1, 604800.0, 0, &Contact::getOutChatsAvg, 0 }, - { 1, 604800.0, 0, &Contact::getTotalChatsAvg, 0 }, - { 2, 1 / 3600.0, 0, 0, &Contact::getChatDurSum }, + { 0, 1.0, &Contact::getInBytes, nullptr, nullptr }, + { 0, 1.0, &Contact::getOutBytes, nullptr, nullptr }, + { 0, 1.0, &Contact::getTotalBytes, nullptr, nullptr }, + { 1, 604800.0, nullptr, &Contact::getInBytesAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getOutBytesAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getTotalBytesAvg, nullptr }, + { 0, 1.0, &Contact::getInMessages, nullptr, nullptr }, + { 0, 1.0, &Contact::getOutMessages, nullptr, nullptr }, + { 0, 1.0, &Contact::getTotalMessages, nullptr, nullptr }, + { 1, 604800.0, nullptr, &Contact::getInMessagesAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getOutMessagesAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getTotalMessagesAvg, nullptr }, + { 0, 1.0, &Contact::getInChats, nullptr, nullptr }, + { 0, 1.0, &Contact::getOutChats, nullptr, nullptr }, + { 0, 1.0, &Contact::getTotalChats, nullptr, nullptr }, + { 1, 604800.0, nullptr, &Contact::getInChatsAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getOutChatsAvg, nullptr }, + { 1, 604800.0, nullptr, &Contact::getTotalChatsAvg, nullptr }, + { 2, 1 / 3600.0, nullptr, nullptr, &Contact::getChatDurSum }, }; int valueKey = m_Settings.m_OmitByValueData; @@ -1173,12 +1173,12 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN m_Settings(settings), m_CharMapper(m_Settings), m_hInst(hInst), - m_hWndProgress(NULL), - m_hThreadPushEvent(NULL), - m_hCancelEvent(NULL), + m_hWndProgress(nullptr), + m_hThreadPushEvent(nullptr), + m_hCancelEvent(nullptr), m_InvokedFrom(invokedFrom), - m_pTotals(NULL), - m_pOmitted(NULL), + m_pTotals(nullptr), + m_pOmitted(nullptr), m_bActuallyOmitted(false), m_nNextSlot(0), m_nLastFileNr(0), @@ -1188,7 +1188,7 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN m_nFirstTime(0), m_nLastTime(0) { - m_TimeStarted = TimeZone_ToLocal(time(NULL)); + m_TimeStarted = TimeZone_ToLocal(time(nullptr)); m_MSecStarted = GetTickCount(); m_AverageMinTime = settings.m_AverageMinTime * 24 * 60 * 60; // calculate seconds from days } @@ -1196,15 +1196,15 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN bool Statistic::createStatistics() { // Prepare event for cancel. - m_hCancelEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - if (m_hCancelEvent == NULL) + m_hCancelEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (m_hCancelEvent == nullptr) return false; - m_hWndProgress = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), 0, staticProgressProc); + m_hWndProgress = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), nullptr, staticProgressProc); - if (m_hWndProgress == NULL) { + if (m_hWndProgress == nullptr) { CloseHandle(m_hCancelEvent); - m_hCancelEvent = NULL; + m_hCancelEvent = nullptr; return false; } @@ -1220,13 +1220,13 @@ bool Statistic::createStatistics() MSG msg; while (!bDone) { - while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { bDone = true; break; } - if (msg.hwnd == NULL || !IsDialogMessage(msg.hwnd, &msg)) { /* Wine fix. */ + if (msg.hwnd == nullptr || !IsDialogMessage(msg.hwnd, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } @@ -1246,8 +1246,8 @@ bool Statistic::createStatistics() // Cleanup. CloseHandle(m_hCancelEvent); - m_hCancelEvent = NULL; - m_hWndProgress = NULL; + m_hCancelEvent = nullptr; + m_hWndProgress = nullptr; if (m_bResult) { // Save last successfully created statistics @@ -1316,7 +1316,7 @@ void __cdecl Statistic::threadProc(void *lpParameter) // check for errors if (!pStats->m_ErrorText.empty() && !Miranda_IsTerminated()) - MessageBox(0, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK); + MessageBox(nullptr, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK); // free statistics delete pStats; @@ -1402,7 +1402,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS { // check if running and make running if (m_bRunning) { - MessageBox(0, + MessageBox(nullptr, TranslateT("HistoryStats is already generating statistics. Please wait for the already running process to be finished or cancel it and try again."), TranslateT("HistoryStats"), MB_ICONINFORMATION | MB_OK); return; @@ -1410,9 +1410,9 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS m_bRunning = true; - HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + HANDLE hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); // create event for thread stack unwinding - if (hEvent == NULL) { + if (hEvent == nullptr) { m_bRunning = false; return; } @@ -1424,11 +1424,11 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS HANDLE hThread = mir_forkthread(threadProc, (void*)pStats); // wait for thread to place itself on thread unwind stack - if (hThread != NULL) + if (hThread != nullptr) WaitForSingleObject(pStats->m_hThreadPushEvent, INFINITE); else m_bRunning = false; CloseHandle(pStats->m_hThreadPushEvent); - pStats->m_hThreadPushEvent = NULL; + pStats->m_hThreadPushEvent = nullptr; } diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp index 9c58288dfe..4e0a78400b 100644 --- a/plugins/HistoryStats/src/utils.cpp +++ b/plugins/HistoryStats/src/utils.cpp @@ -411,7 +411,7 @@ ext::a::string utils::convertWToA(const WCHAR* str, size_t len) { char* buf = new char[len + 1]; - len = WideCharToMultiByte(CP_ACP, 0, str, len, buf, len, NULL, NULL); + len = WideCharToMultiByte(CP_ACP, 0, str, len, buf, len, nullptr, nullptr); buf[len] = '\0'; @@ -759,7 +759,7 @@ bool utils::createPath(const ext::string& path) curPath += curDir; - if (!CreateDirectory(curPath.c_str(), NULL)) { + if (!CreateDirectory(curPath.c_str(), nullptr)) { return false; } @@ -848,7 +848,7 @@ void utils::centerDialog(HWND hDlg, HWND hParent /* = NULL */) if (GetWindowRect(hParent, &rParent) && GetWindowRect(hDlg, &rDlg)) { SetWindowPos( hDlg, - 0, + nullptr, (rParent.right + rParent.left - rDlg.right + rDlg.left) / 2, (rParent.bottom + rParent.top - rDlg.bottom + rDlg.top) / 2, 0, @@ -858,7 +858,7 @@ void utils::centerDialog(HWND hDlg, HWND hParent /* = NULL */) else if (GetWindowRect(hDlg, &rDlg)) { SetWindowPos( hDlg, - 0, + nullptr, (GetSystemMetrics(SM_CXSCREEN) - rDlg.right + rDlg.left) / 2, (GetSystemMetrics(SM_CYSCREEN) - rDlg.bottom + rDlg.top) / 2, 0, @@ -971,7 +971,7 @@ Locale Locale::m_Data; /* * RTFFilter */ -RTFFilter::RTFFilter() : m_hRTFConv(NULL), m_RTFConvString(0) +RTFFilter::RTFFilter() : m_hRTFConv(nullptr), m_RTFConvString(nullptr) { } @@ -983,7 +983,7 @@ void RTFFilter::init() if (!(m_Data.m_RTFConvString = reinterpret_cast(GetProcAddress(m_Data.m_hRTFConv, "RtfconvString")))) { FreeLibrary(m_Data.m_hRTFConv); - m_Data.m_hRTFConv = NULL; + m_Data.m_hRTFConv = nullptr; } } @@ -993,8 +993,8 @@ void RTFFilter::uninit() if (m_Data.m_hRTFConv) { FreeLibrary(m_Data.m_hRTFConv); - m_Data.m_hRTFConv = NULL; - m_Data.m_RTFConvString = NULL; + m_Data.m_hRTFConv = nullptr; + m_Data.m_RTFConvString = nullptr; } } @@ -1011,7 +1011,7 @@ ext::t::string RTFFilter::filter(const ext::t::string& str) intptr_t len = m_Data.m_RTFConvString( strA.c_str(), - NULL, + nullptr, 0, CP_UNICODE, CONVMODE_USE_SYSTEM_TABLE | CONVMODE_NO_OUTPUT_BOM, diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 87e42974f6..ad73c5d46c 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -30,7 +30,7 @@ typedef struct // build criteria time_t BuildCriteria(int dwti) { - time_t tim = time(NULL); + time_t tim = time(nullptr); switch (dwti) { case 0: @@ -93,7 +93,7 @@ static int CompareBookmarks(const void* p1, const void* p2) static void GetBookmarks(MCONTACT hContact, BEventData** books, size_t* bookcnt) { - *books = NULL; + *books = nullptr; *bookcnt = 0; DBVARIANT dbv; @@ -143,7 +143,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke BEventData *books, *item, ev = { 0 }; size_t bookcnt, btshift; - SetCursor(LoadCursor(0, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // switch off SAFETYMODE if necessary if (unsafe) @@ -167,7 +167,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (bookcnt != 0) { // keep bookmarks ev.hDBEvent = hDBEvent; item = (BEventData*)bsearch(&ev, books, bookcnt, sizeof(BEventData), CompareBookmarks); - if (item != NULL && item->Timestamp == dbei.timestamp) { + if (item != nullptr && item->Timestamp == dbei.timestamp) { doDelete = FALSE; btshift = (--bookcnt - (item - books))*sizeof(BEventData); if (btshift) @@ -189,7 +189,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (unsafe) db_set_safety_mode(TRUE); - SetCursor(LoadCursor(0, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } // shutdown action @@ -237,7 +237,7 @@ void SetSrmmIcon(MCONTACT hContact) { int sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0); - StatusIconData sid = { 0 }; + StatusIconData sid = {}; sid.szModule = ModuleName; for (int i = 0; i < 4; i++) { diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index d2b68c7a12..b503a09580 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -72,7 +72,7 @@ HANDLE GetIconHandle(const char* name) if (mir_strcmp(iconList[i].szName, name) == 0) return hIconLibItem[i]; - return NULL; + return nullptr; } void ReleaseIconEx(const char* name) @@ -168,7 +168,7 @@ void SaveSettings(HWND hwndDlg) // set tooltips int st = db_get_b(NULL, ModuleName, "SweepHistory", 0); - StatusIconData sid = { 0 }; + StatusIconData sid = {}; sid.szModule = ModuleName; sid.dwId = 0; sid.hIcon = LoadIconEx("actG"); @@ -249,7 +249,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) // Find clicked item hItem = (HANDLE)SendMessage(nmc->hdr.hwndFrom, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y)); // Nothing was clicked - if (hItem == NULL || !(IsHContactContact(hItem) || IsHContactInfo(hItem))) + if (hItem == nullptr || !(IsHContactContact(hItem) || IsHContactInfo(hItem))) break; // It was not our extended icon diff --git a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp index 3f59ff7712..a732504763 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp @@ -99,7 +99,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; //case WM_NOTIFY case WM_DESTROY: - hDialogWnd = 0; // èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû (ïîêà îòêðûòû íàñòðîéêè), 0 (ïðè çàêðûòèè äèàëîãà) áëîêèðóåò ýòî + hDialogWnd = nullptr; // èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû (ïîêà îòêðûòû íàñòðîéêè), 0 (ïðè çàêðûòèè äèàëîãà) áëîêèðóåò ýòî break; } diff --git a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp index a138e21388..01ed11e26f 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA. HINSTANCE hInstance; int hLangpack; -HWND hDialogWnd = 0; // õýíäë îêíà íàñòðîåê, îí ãëîáàëüíî èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû èç õóêà +HWND hDialogWnd = nullptr; // õýíäë îêíà íàñòðîåê, îí ãëîáàëüíî èñïîëüçóåòñÿ äëÿ âûâîäà òóäà â ðåàëòàéìå ñêàíêîäîâ êëàâû èç õóêà HHOOK hHook; CLIST_INTERFACE *pcli; diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 2697d2309a..2096b2d701 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -25,10 +25,10 @@ int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_g char ModuleName[] = "IEHistory"; HICON hIcon; HINSTANCE hInstance; -MWindowList hOpenWindowsList = NULL; +MWindowList hOpenWindowsList = nullptr; -HMODULE hUxTheme = 0; -BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = NULL; +HMODULE hUxTheme = nullptr; +BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = nullptr; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -65,7 +65,7 @@ extern "C" int __declspec(dllexport) Load(void) InitCommonControlsEx(&icex); - if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0) + if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != nullptr) MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); /// all initialization here diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 3b15a902f1..1bb009e1b5 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -162,18 +162,18 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) int cLoad = LOAD_COUNT; int i; IEVIEWEVENTDATA ieData[LOAD_COUNT] = { 0 }; - PBYTE messages[LOAD_COUNT] = { 0 }; + PBYTE messages[LOAD_COUNT] = {}; MEVENT dbEvent = data->ieEvent.hDbEventFirst; for (i = 0; i < LOAD_COUNT; i++) { ieData[i].cbSize = sizeof(IEVIEWEVENTDATA); //set the cbsize here, no need to do it every time ieData[i].next = &ieData[i + 1]; //it's a vector, so v[i]'s next element is v[i + 1] } - ieData[LOAD_COUNT - 1].next = NULL; + ieData[LOAD_COUNT - 1].next = nullptr; IEVIEWEVENT ieEvent = data->ieEvent; ieEvent.iType = IEE_LOG_MEM_EVENTS; ieEvent.eventData = ieData; DBEVENTINFO dbInfo = {}; - PBYTE buffer = NULL; + PBYTE buffer = nullptr; int newSize, oldSize = 0; while (count < target) { cLoad = (count + LOAD_COUNT > target) ? target - count : LOAD_COUNT; @@ -195,7 +195,7 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) //FillIEViewEventData(&ieData[i], dbEvent); dbEvent = db_event_next(0, dbEvent); } - ieData[cLoad - 1].next = NULL; //cLoad < LOAD_COUNT will only happen once, at the end + ieData[cLoad - 1].next = nullptr; //cLoad < LOAD_COUNT will only happen once, at the end CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent); count += cLoad; } @@ -336,7 +336,7 @@ int ScrollToBottom(HWND hWnd) void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors) { - if (NULL == window) /* Wine fix. */ + if (nullptr == window) /* Wine fix. */ return; RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors); hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER); @@ -375,7 +375,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara hWnd, //parent (HMENU)IDC_STATUSBAR, //menu hInstance, //instance - NULL); //lpParam + nullptr); //lpParam int x; int widths[] = { x = 50, x += 50, x += 150, -1 }; int count = sizeof(widths) / sizeof(widths[0]); @@ -465,10 +465,10 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_SEARCH: HWND hSearch = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc); - if (hSearch == NULL) { + if (hSearch == nullptr) { char buffer[1024]; sprintf(buffer, "Error #%d", GetLastError()); - MessageBoxA(0, buffer, "Error", MB_OK); + MessageBoxA(nullptr, buffer, "Error", MB_OK); } SearchWindowData *searchData = (SearchWindowData *)malloc(sizeof(SearchWindowData)); searchData->contact = data->contact; @@ -663,7 +663,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam data->index += (direction == DIRECTION_BACK) ? -searchResult.index : searchResult.index; LoadPage(data->hHistoryWindow, searchResult.hEvent, data->index, histData->itemsPerPage / 2, histData->itemsPerPage, DIRECTION_BACK); } - else MessageBox(0, TranslateT("Search finished. No more entries..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION); + else MessageBox(nullptr, TranslateT("Search finished. No more entries..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION); data->hLastFoundEvent = searchResult.hEvent; break; diff --git a/plugins/IEHistory/src/services.cpp b/plugins/IEHistory/src/services.cpp index 7197f2a4d5..1556b08363 100644 --- a/plugins/IEHistory/src/services.cpp +++ b/plugins/IEHistory/src/services.cpp @@ -31,15 +31,15 @@ INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM) { Log("%s", "Entering function " __FUNCTION__); HWND historyDlg; - HWND parent = NULL; + HWND parent = nullptr; historyDlg = WindowList_Find(hOpenWindowsList, (MCONTACT)wParam); - if (historyDlg == NULL){ + if (historyDlg == nullptr){ int count = db_get_dw(NULL, ModuleName, "EventsToLoad", 0); int loadInBackground = db_get_b(NULL, ModuleName, "UseWorkerThread", 0); HistoryWindowData *data; data = (HistoryWindowData *)malloc(sizeof(HistoryWindowData)); data->contact = (MCONTACT)wParam; - data->hIEView = NULL; + data->hIEView = nullptr; data->itemsPerPage = count; data->index = 0; data->count = 0; diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index 125f861aba..ed3936781f 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -71,7 +71,7 @@ int Info(char *title, char *format, ...) str[tBytes] = 0; } va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); + return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } /* @@ -81,7 +81,7 @@ returns the name of a contact wchar_t* GetContactName(MCONTACT contact) { ptrW name(Contact_GetInfo(CNF_DISPLAY, contact)); - return (name) ? wcsdup(name) : NULL; + return (name) ? wcsdup(name) : nullptr; } /* @@ -182,7 +182,7 @@ void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst) SYSTEMTIME st; UnixTimeToFileTime(t, &ft); FileTimeToSystemTime(&ft, &st); - SystemTimeToTzSpecificLocalTime(NULL, &st, pst); + SystemTimeToTzSpecificLocalTime(nullptr, &st, pst); } MEVENT GetNeededEvent(MEVENT hEvent, int num, int direction) @@ -210,7 +210,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat } int index = 0; MEVENT hEvent = hFirstEvent; - void *buffer = NULL; + void *buffer = nullptr; wchar_t *search; bool found = false; int oldSize, newSize; diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 12c0308a3e..d3f5cf2847 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -41,7 +41,7 @@ static const char *classNames[] = { ChatHTMLBuilder::ChatHTMLBuilder() { setLastEventType(-1); - setLastEventTime(time(NULL)); + setLastEventTime(time(nullptr)); } void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) @@ -98,7 +98,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) COLORREF color; ProtocolSettings *protoSettings = getChatProtocolSettings(event->pszProto); - if (protoSettings == NULL) + if (protoSettings == nullptr) return; if (protoSettings->getChatMode() == Options::MODE_TEMPLATE) @@ -110,9 +110,9 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) str.AppendFormat("\n", externalCSS); } else { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); str.Append(""); str.Append("