summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AVS/src/acc.cpp2
-rw-r--r--plugins/AVS/src/cache.cpp2
-rw-r--r--plugins/AVS/src/main.cpp8
-rw-r--r--plugins/AVS/src/options.cpp6
-rw-r--r--plugins/AVS/src/services.cpp20
-rw-r--r--plugins/AVS/src/utils.cpp4
-rw-r--r--plugins/AddContactPlus/src/addcontact.cpp10
-rw-r--r--plugins/Alarms/src/icons.cpp2
-rw-r--r--plugins/Alarms/src/options.cpp8
-rw-r--r--plugins/AssocMgr/src/assoclist.cpp6
-rw-r--r--plugins/AssocMgr/src/dde.cpp4
-rw-r--r--plugins/AssocMgr/src/main.cpp4
-rw-r--r--plugins/AssocMgr/src/reg.cpp18
-rw-r--r--plugins/AssocMgr/src/test.cpp22
-rw-r--r--plugins/AssocMgr/src/utils.cpp2
-rw-r--r--plugins/AuthState/src/main.cpp2
-rw-r--r--plugins/AutoRun/src/main.cpp8
-rw-r--r--plugins/AutoShutdown/src/frame.cpp16
-rw-r--r--plugins/AutoShutdown/src/main.cpp2
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp6
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp2
-rw-r--r--plugins/AutoShutdown/src/utils.cpp10
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp18
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp10
-rw-r--r--plugins/AvatarHistory/src/icolib.cpp2
-rw-r--r--plugins/AvatarHistory/src/options.cpp10
-rw-r--r--plugins/AvatarHistory/src/popup.cpp6
-rw-r--r--plugins/AvatarHistory/src/utils.cpp10
-rw-r--r--plugins/BASS_interface/src/Main.cpp8
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp4
-rw-r--r--plugins/BasicHistory/src/EventList.cpp4
-rw-r--r--plugins/BasicHistory/src/ExportManager.cpp6
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp4
-rw-r--r--plugins/BasicHistory/src/Options.cpp36
-rw-r--r--plugins/BasicHistory/src/Scheduler.cpp22
-rw-r--r--plugins/BasicHistory/src/Searcher.cpp4
-rw-r--r--plugins/Boltun/src/boltun.cpp12
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp6
-rw-r--r--plugins/BossKeyPlus/src/Options.cpp6
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp10
-rw-r--r--plugins/BuddyExpectator/src/options.cpp2
-rw-r--r--plugins/BuddyPounce/src/dialog.cpp34
-rw-r--r--plugins/CSList/src/cslist.cpp50
-rw-r--r--plugins/ChangeKeyboardLayout/src/main.cpp2
-rw-r--r--plugins/Clist_blind/src/clcopts.cpp18
-rw-r--r--plugins/Clist_blind/src/clcpaint.cpp4
-rw-r--r--plugins/Clist_blind/src/cluiopts.cpp2
-rw-r--r--plugins/Clist_blind/src/init.cpp22
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp20
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp40
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clcopts.cpp80
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp24
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp12
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistopts.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_log.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_rowtemplateopt.cpp12
-rw-r--r--plugins/Clist_modern/src/modern_skinbutton.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp24
-rw-r--r--plugins/Clist_modern/src/modern_skinopt.cpp40
-rw-r--r--plugins/Clist_modern/src/modern_skinselector.cpp80
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp12
-rw-r--r--plugins/Clist_modern/src/modern_statusbar_options.cpp22
-rw-r--r--plugins/Clist_modern/src/modern_sync.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_tbbutton.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_toolbar.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp36
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp8
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp8
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp2
-rw-r--r--plugins/Clist_nicer/src/clc.cpp4
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp2
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp16
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp4
-rw-r--r--plugins/Clist_nicer/src/clistmod.cpp2
-rw-r--r--plugins/Clist_nicer/src/clui.cpp36
-rw-r--r--plugins/Clist_nicer/src/cluiopts.cpp2
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp8
-rw-r--r--plugins/Clist_nicer/src/config.cpp10
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp56
-rw-r--r--plugins/Clist_nicer/src/rowheight_funcs.cpp4
-rw-r--r--plugins/Clist_nicer/src/statusbar.cpp2
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp20
-rw-r--r--plugins/CmdLine/src/utils.cpp6
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp32
-rw-r--r--plugins/ConnectionNotify/src/debug.cpp6
-rw-r--r--plugins/ConnectionNotify/src/filter.cpp10
-rw-r--r--plugins/ConnectionNotify/src/netstat.cpp4
-rw-r--r--plugins/Console/src/Console.cpp48
-rw-r--r--plugins/Console/src/init.cpp4
-rw-r--r--plugins/ContactsPlus/src/main.cpp2
-rw-r--r--plugins/ContactsPlus/src/receive.cpp2
-rw-r--r--plugins/ContactsPlus/src/send.cpp2
-rw-r--r--plugins/ContactsPlus/src/utils.cpp6
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp2
-rw-r--r--plugins/CountryFlags/src/icons.cpp8
-rw-r--r--plugins/CountryFlags/src/ip2country.cpp6
-rw-r--r--plugins/CountryFlags/src/utils.cpp8
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp8
-rw-r--r--plugins/CrashDumper/src/crshdmp_icons.cpp6
-rw-r--r--plugins/CrashDumper/src/dumper.cpp6
-rw-r--r--plugins/CrashDumper/src/exhndlr.cpp20
-rw-r--r--plugins/CrashDumper/src/ui.cpp8
-rw-r--r--plugins/CrashDumper/src/utils.cpp10
-rw-r--r--plugins/CryptoPP/src/GPGw/passdialog.cpp2
-rw-r--r--plugins/Db3x_mmap/src/database.cpp12
-rw-r--r--plugins/Db3x_mmap/src/dbheaders.cpp2
-rw-r--r--plugins/Db3x_mmap/src/dbintf.cpp2
-rw-r--r--plugins/Db3x_mmap/src/dbtool/modulechain.cpp2
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp10
-rw-r--r--plugins/DbChecker/src/main.cpp2
-rw-r--r--plugins/DbChecker/src/openerror.cpp2
-rw-r--r--plugins/DbChecker/src/progress.cpp2
-rw-r--r--plugins/DbChecker/src/selectdb.cpp26
-rw-r--r--plugins/DbChecker/src/wizard.cpp2
-rw-r--r--plugins/DbChecker/src/worker.cpp4
-rw-r--r--plugins/DbEditorPP/src/copymodule.cpp4
-rw-r--r--plugins/DbEditorPP/src/deletemodule.cpp2
-rw-r--r--plugins/DbEditorPP/src/exportimport.cpp34
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp10
-rw-r--r--plugins/DbEditorPP/src/icons.cpp16
-rw-r--r--plugins/DbEditorPP/src/main.cpp34
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp10
-rw-r--r--plugins/DbEditorPP/src/modsettingenum.cpp10
-rw-r--r--plugins/DbEditorPP/src/moduletree.cpp22
-rw-r--r--plugins/DbEditorPP/src/renamemodule.cpp4
-rw-r--r--plugins/DbEditorPP/src/settinglist.cpp14
-rw-r--r--plugins/DbEditorPP/src/settingsdlg.cpp2
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp14
-rw-r--r--plugins/Db_autobackups/src/backup.cpp12
-rw-r--r--plugins/Db_autobackups/src/main.cpp10
-rw-r--r--plugins/Db_autobackups/src/options.cpp18
-rw-r--r--plugins/Dropbox/src/dropbox.cpp2
-rw-r--r--plugins/Dropbox/src/dropbox_icons.cpp6
-rw-r--r--plugins/Dropbox/src/dropbox_services.cpp4
-rw-r--r--plugins/Dropbox/src/http_request.h6
-rw-r--r--plugins/Exchange/src/MirandaExchange.cpp4
-rw-r--r--plugins/Exchange/src/dlg_handlers.cpp18
-rw-r--r--plugins/Exchange/src/emails.cpp4
-rw-r--r--plugins/ExternalAPI/m_variables.h4
-rw-r--r--plugins/FTPFileYM/src/dialog.cpp4
-rw-r--r--plugins/FTPFileYM/src/ftpfile.cpp4
-rw-r--r--plugins/FTPFileYM/src/job_generic.cpp6
-rw-r--r--plugins/FTPFileYM/src/job_packer.cpp12
-rw-r--r--plugins/FTPFileYM/src/job_upload.cpp20
-rw-r--r--plugins/FTPFileYM/src/options.cpp14
-rw-r--r--plugins/FTPFileYM/src/serverlist.cpp2
-rw-r--r--plugins/FavContacts/src/contact_cache.cpp8
-rw-r--r--plugins/FavContacts/src/main.cpp2
-rw-r--r--plugins/FavContacts/src/menu.cpp2
-rw-r--r--plugins/FileAsMessage/src/dialog.cpp22
-rw-r--r--plugins/FileAsMessage/src/main.cpp6
-rw-r--r--plugins/FileAsMessage/src/optionsdlg.cpp6
-rw-r--r--plugins/FingerprintNG/src/masks.cpp10
-rw-r--r--plugins/FingerprintNG/src/options.cpp6
-rw-r--r--plugins/FloatingContacts/src/filedrop.cpp4
-rw-r--r--plugins/FloatingContacts/src/main.cpp4
-rw-r--r--plugins/FloatingContacts/src/options.cpp12
-rw-r--r--plugins/Folders/src/dlg_handlers.cpp4
-rw-r--r--plugins/Folders/src/folderItem.cpp4
-rw-r--r--plugins/Folders/src/services.cpp8
-rw-r--r--plugins/GmailNotifier/src/options.cpp10
-rw-r--r--plugins/HTTPServer/src/GuiElements.cpp18
-rw-r--r--plugins/HTTPServer/src/HttpUser.cpp10
-rw-r--r--plugins/HTTPServer/src/IndexHTML.cpp4
-rw-r--r--plugins/HTTPServer/src/IndexXML.cpp2
-rw-r--r--plugins/HTTPServer/src/main.cpp4
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist.h2
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_dlg.cpp22
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_fct.cpp18
-rw-r--r--plugins/HistorySweeperLight/src/options.cpp14
-rw-r--r--plugins/IEHistory/src/dlgHandlers.cpp4
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/MUCCHTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/Options.cpp142
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp8
-rw-r--r--plugins/IEView/src/TabSRMMHTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/Template.cpp6
-rw-r--r--plugins/IEView/src/TemplateHTMLBuilder.cpp26
-rw-r--r--plugins/IgnoreState/src/main.cpp8
-rw-r--r--plugins/Import/src/import.cpp6
-rw-r--r--plugins/Import/src/miranda.cpp18
-rw-r--r--plugins/Import/src/utils.cpp6
-rw-r--r--plugins/KeyboardNotify/src/ignore.cpp10
-rw-r--r--plugins/KeyboardNotify/src/keyboard.cpp8
-rw-r--r--plugins/KeyboardNotify/src/main.cpp4
-rw-r--r--plugins/KeyboardNotify/src/options.cpp24
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp22
-rw-r--r--plugins/ListeningTo/src/options.cpp16
-rw-r--r--plugins/ListeningTo/src/players/foobar.cpp2
-rw-r--r--plugins/ListeningTo/src/players/generic.cpp2
-rw-r--r--plugins/ListeningTo/src/players/player.cpp2
-rw-r--r--plugins/ListeningTo/src/players/winamp.cpp2
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp76
-rw-r--r--plugins/MenuItemEx/src/main.cpp48
-rw-r--r--plugins/MenuItemEx/src/options.cpp6
-rw-r--r--plugins/MessageState/src/messagestate.cpp4
-rw-r--r--plugins/MirFox/src/MirandaOptions.cpp6
-rw-r--r--plugins/MirFox/src/MirandaUtils.cpp4
-rw-r--r--plugins/MirFox/src/MirfoxMiranda.cpp2
-rw-r--r--plugins/MirLua/src/m_icolib.cpp8
-rw-r--r--plugins/MirLua/src/mlua_loader.cpp4
-rw-r--r--plugins/MirLua/src/mlua_options.cpp6
-rw-r--r--plugins/MirOTR/src/dialogs.cpp14
-rw-r--r--plugins/MirOTR/src/icons.cpp2
-rw-r--r--plugins/MirOTR/src/mirotrmenu.cpp12
-rw-r--r--plugins/MirOTR/src/options.cpp22
-rw-r--r--plugins/MirOTR/src/otr.cpp30
-rw-r--r--plugins/MirOTR/src/svcs_menu.cpp2
-rw-r--r--plugins/MirOTR/src/utils.cpp8
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp2
-rw-r--r--plugins/MirandaG15/src/CConfig.cpp40
-rw-r--r--plugins/MobileState/src/main.cpp2
-rw-r--r--plugins/ModernOpt/src/modernopt.cpp2
-rw-r--r--plugins/ModernOpt/src/mopt_home.cpp4
-rw-r--r--plugins/ModernOpt/src/mopt_selector.cpp4
-rw-r--r--plugins/MsgPopup/src/main.cpp6
-rw-r--r--plugins/MsgPopup/src/options.cpp6
-rwxr-xr-xplugins/Msg_Export/src/FileViewer.cpp12
-rwxr-xr-xplugins/Msg_Export/src/options.cpp32
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp16
-rw-r--r--plugins/MyDetails/src/data.cpp34
-rw-r--r--plugins/MyDetails/src/frame.cpp34
-rw-r--r--plugins/MyDetails/src/mydetails.cpp2
-rw-r--r--plugins/MyDetails/src/options.cpp4
-rw-r--r--plugins/MyDetails/src/services.cpp10
-rw-r--r--plugins/NewAwaySysMod/src/AwayOpt.cpp46
-rw-r--r--plugins/NewAwaySysMod/src/AwaySys.cpp12
-rw-r--r--plugins/NewAwaySysMod/src/Client.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/Common.h6
-rw-r--r--plugins/NewAwaySysMod/src/GroupCheckbox.cpp6
-rw-r--r--plugins/NewAwaySysMod/src/MsgEventAdded.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/MsgTree.cpp12
-rw-r--r--plugins/NewAwaySysMod/src/Notification.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/Options.cpp4
-rw-r--r--plugins/NewAwaySysMod/src/Properties.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/Properties.h6
-rw-r--r--plugins/NewAwaySysMod/src/ReadAwayMsg.cpp8
-rw-r--r--plugins/NewAwaySysMod/src/SetAwayMsg.cpp10
-rw-r--r--plugins/NewEventNotify/src/popup.cpp24
-rw-r--r--plugins/NewXstatusNotify/src/indsnd.cpp18
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp40
-rw-r--r--plugins/NewXstatusNotify/src/options.cpp86
-rw-r--r--plugins/NewXstatusNotify/src/popup.cpp6
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp26
-rw-r--r--plugins/New_GPG/src/icons.cpp2
-rwxr-xr-xplugins/New_GPG/src/main.cpp46
-rwxr-xr-xplugins/New_GPG/src/messages.cpp2
-rwxr-xr-xplugins/New_GPG/src/options.cpp24
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp24
-rw-r--r--plugins/NewsAggregator/Src/Authentication.cpp12
-rw-r--r--plugins/NewsAggregator/Src/CheckFeed.cpp16
-rw-r--r--plugins/NewsAggregator/Src/ExportImport.cpp12
-rw-r--r--plugins/NewsAggregator/Src/Icons.cpp6
-rw-r--r--plugins/NewsAggregator/Src/Options.cpp72
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp2
-rw-r--r--plugins/NoHistory/src/icons.cpp2
-rw-r--r--plugins/Non-IM Contact/src/contactinfo.cpp50
-rw-r--r--plugins/Non-IM Contact/src/dialog.cpp16
-rw-r--r--plugins/Non-IM Contact/src/files.cpp38
-rw-r--r--plugins/Non-IM Contact/src/main.cpp6
-rw-r--r--plugins/Non-IM Contact/src/namereplacing.cpp24
-rw-r--r--plugins/Non-IM Contact/src/timer.cpp6
-rw-r--r--plugins/NotesAndReminders/src/main.cpp2
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp26
-rw-r--r--plugins/NotesAndReminders/src/options.cpp52
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp64
-rw-r--r--plugins/NotifyAnything/src/options.cpp6
-rw-r--r--plugins/Nudge/src/main.cpp12
-rw-r--r--plugins/Nudge/src/nudge.cpp64
-rw-r--r--plugins/Nudge/src/options.cpp10
-rw-r--r--plugins/OpenFolder/src/openFolder.cpp4
-rw-r--r--plugins/OpenSSL/src/ssl_openssl.cpp6
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp62
-rw-r--r--plugins/PackUpdater/Src/Options.cpp6
-rw-r--r--plugins/PackUpdater/Src/PackUpdater.cpp2
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp58
-rw-r--r--plugins/PasteIt/src/Options.cpp24
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp4
-rw-r--r--plugins/PasteIt/src/PasteToWeb.cpp8
-rw-r--r--plugins/PasteIt/src/PasteToWeb1.cpp6
-rw-r--r--plugins/PasteIt/src/PasteToWeb2.cpp2
-rw-r--r--plugins/Ping/src/icmp.cpp2
-rw-r--r--plugins/Ping/src/options.cpp16
-rw-r--r--plugins/Ping/src/ping.cpp2
-rw-r--r--plugins/Ping/src/pinggraph.cpp6
-rw-r--r--plugins/Ping/src/pinglist.cpp10
-rw-r--r--plugins/Ping/src/pingthread.cpp32
-rw-r--r--plugins/Ping/src/utils.cpp14
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp22
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp52
-rw-r--r--plugins/PluginUpdater/src/Events.cpp2
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp2
-rw-r--r--plugins/PluginUpdater/src/Options.cpp8
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp2
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp18
-rw-r--r--plugins/PluginUpdater/src/unzipfile.cpp8
-rw-r--r--plugins/Popup/src/actions.cpp6
-rw-r--r--plugins/Popup/src/font.cpp62
-rw-r--r--plugins/Popup/src/font.h2
-rw-r--r--plugins/Popup/src/notifications.cpp24
-rw-r--r--plugins/Popup/src/opt_adv.cpp8
-rw-r--r--plugins/Popup/src/opt_class.cpp26
-rw-r--r--plugins/Popup/src/opt_contacts.cpp8
-rw-r--r--plugins/Popup/src/opt_gen.cpp12
-rw-r--r--plugins/Popup/src/opt_skins.cpp8
-rw-r--r--plugins/Popup/src/opttree.cpp4
-rw-r--r--plugins/Popup/src/popup_thread.cpp2
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp18
-rw-r--r--plugins/Popup/src/services.cpp22
-rw-r--r--plugins/Popup/src/skin.cpp4
-rw-r--r--plugins/ProfileManager/src/pmanagerEx.cpp12
-rw-r--r--plugins/QuickContacts/src/options.cpp2
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp22
-rw-r--r--plugins/QuickMessages/src/Utils.cpp50
-rw-r--r--plugins/QuickMessages/src/options.cpp30
-rw-r--r--plugins/QuickReplies/src/events.cpp16
-rw-r--r--plugins/QuickReplies/src/options.cpp20
-rw-r--r--plugins/Quotes/src/CommonOptionDlg.cpp2
-rw-r--r--plugins/Quotes/src/IconLib.cpp6
-rw-r--r--plugins/Rate/src/main.cpp2
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp2
-rw-r--r--plugins/RecentContacts/src/options.cpp4
-rw-r--r--plugins/RemovePersonalSettings/src/rps.cpp6
-rw-r--r--plugins/SMS/src/SMS_svc.cpp4
-rw-r--r--plugins/SMS/src/functions.cpp30
-rw-r--r--plugins/SMS/src/main.cpp6
-rw-r--r--plugins/SMS/src/options.cpp10
-rw-r--r--plugins/SMS/src/receive.cpp10
-rw-r--r--plugins/SMS/src/recvdlg.cpp6
-rw-r--r--plugins/SMS/src/senddlg.cpp42
-rw-r--r--plugins/Scriver/src/chat/options.cpp22
-rw-r--r--plugins/Scriver/src/chat/tools.cpp4
-rw-r--r--plugins/Scriver/src/chat/window.cpp16
-rw-r--r--plugins/Scriver/src/globals.cpp6
-rw-r--r--plugins/Scriver/src/input.cpp4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp22
-rw-r--r--plugins/Scriver/src/msglog.cpp16
-rw-r--r--plugins/Scriver/src/msgoptions.cpp26
-rw-r--r--plugins/Scriver/src/msgs.cpp8
-rw-r--r--plugins/Scriver/src/msgwindow.cpp32
-rw-r--r--plugins/Scriver/src/utils.cpp16
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp2
-rw-r--r--plugins/SecureIM/src/loadicons.cpp6
-rw-r--r--plugins/SecureIM/src/main.cpp2
-rw-r--r--plugins/SecureIM/src/options.cpp32
-rw-r--r--plugins/SecureIM/src/popupOptions.cpp6
-rw-r--r--plugins/SecureIM/src/svcs_clist.cpp4
-rw-r--r--plugins/SeenPlugin/src/history.cpp2
-rw-r--r--plugins/SeenPlugin/src/missed.cpp4
-rw-r--r--plugins/SeenPlugin/src/options.cpp20
-rw-r--r--plugins/SeenPlugin/src/utils.cpp30
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/UAboutForm.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp18
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/dlg_msgbox.cpp10
-rw-r--r--plugins/Sessions/Src/Main.cpp20
-rw-r--r--plugins/Sessions/Src/Options.cpp2
-rw-r--r--plugins/Sessions/Src/Utils.cpp16
-rw-r--r--plugins/ShellExt/src/main.cpp6
-rw-r--r--plugins/ShellExt/src/options.cpp4
-rw-r--r--plugins/ShellExt/src/shlcom.cpp10
-rw-r--r--plugins/SimpleAR/src/Main.cpp6
-rw-r--r--plugins/SimpleAR/src/Options.cpp6
-rw-r--r--plugins/SimpleStatusMsg/src/awaymsg.cpp22
-rw-r--r--plugins/SimpleStatusMsg/src/main.cpp28
-rw-r--r--plugins/SimpleStatusMsg/src/msgbox.cpp68
-rw-r--r--plugins/SimpleStatusMsg/src/options.cpp6
-rw-r--r--plugins/SimpleStatusMsg/src/utils.cpp10
-rw-r--r--plugins/SkypeStatusChange/src/main.cpp8
-rw-r--r--plugins/SkypeStatusChange/src/options.cpp2
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp6
-rw-r--r--plugins/SmileyAdd/src/general.cpp2
-rw-r--r--plugins/SmileyAdd/src/options.cpp6
-rw-r--r--plugins/SmileyAdd/src/smileyroutines.cpp2
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp14
-rw-r--r--plugins/Spamotron/src/bayes.cpp16
-rw-r--r--plugins/Spamotron/src/options.cpp10
-rw-r--r--plugins/Spamotron/src/spamotron.cpp2
-rw-r--r--plugins/Spamotron/src/utils.cpp8
-rw-r--r--plugins/SpellChecker/src/ardialog.cpp8
-rw-r--r--plugins/SpellChecker/src/autoreplace.cpp4
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp80
-rw-r--r--plugins/SpellChecker/src/options.cpp16
-rw-r--r--plugins/SpellChecker/src/spellchecker.cpp12
-rw-r--r--plugins/SpellChecker/src/utils.cpp34
-rw-r--r--plugins/SplashScreen/src/debug.h2
-rw-r--r--plugins/SplashScreen/src/main.cpp16
-rw-r--r--plugins/SplashScreen/src/options.cpp16
-rw-r--r--plugins/SplashScreen/src/services.cpp2
-rw-r--r--plugins/SplashScreen/src/splash.cpp8
-rw-r--r--plugins/StartupSilence/src/main.cpp28
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp2
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/options.cpp4
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.cpp12
-rw-r--r--plugins/StatusPlugins/KeepStatus/options.cpp4
-rw-r--r--plugins/StatusPlugins/StartupStatus/options.cpp12
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp8
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp6
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp2
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp4
-rw-r--r--plugins/StatusPlugins/confirmdialog.cpp6
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp2
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp2
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp14
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp10
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp4
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp102
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp30
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp2
-rw-r--r--plugins/TabSRMM/src/container.cpp24
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp6
-rw-r--r--plugins/TabSRMM/src/controls.cpp10
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp18
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp34
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp12
-rw-r--r--plugins/TabSRMM/src/mim.cpp8
-rw-r--r--plugins/TabSRMM/src/modplus.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp16
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp26
-rw-r--r--plugins/TabSRMM/src/msglog.cpp12
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp18
-rw-r--r--plugins/TabSRMM/src/msgs.cpp28
-rw-r--r--plugins/TabSRMM/src/selectcontainer.cpp8
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp16
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp14
-rw-r--r--plugins/TabSRMM/src/srmm.cpp4
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp2
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp2
-rw-r--r--plugins/TabSRMM/src/templates.cpp4
-rw-r--r--plugins/TabSRMM/src/themeio.cpp14
-rw-r--r--plugins/TabSRMM/src/themes.cpp12
-rw-r--r--plugins/TabSRMM/src/themes.h2
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp4
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp10
-rw-r--r--plugins/TabSRMM/src/utils.cpp10
-rw-r--r--plugins/TipperYM/src/options.cpp38
-rw-r--r--plugins/TipperYM/src/popwin.cpp10
-rw-r--r--plugins/TipperYM/src/skin_parser.cpp4
-rw-r--r--plugins/TipperYM/src/tipper.cpp4
-rw-r--r--plugins/TipperYM/src/translations.cpp42
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp44
-rw-r--r--plugins/TopToolBar/src/InternalButtons.cpp2
-rw-r--r--plugins/TopToolBar/src/ttbopt.cpp10
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.cpp8
-rw-r--r--plugins/TrafficCounter/src/misc.cpp16
-rw-r--r--plugins/TrafficCounter/src/options.cpp6
-rw-r--r--plugins/TrafficCounter/src/opttree.cpp4
-rw-r--r--plugins/TrafficCounter/src/statistics.cpp2
-rw-r--r--plugins/TranslitSwitcher/src/Layoutproc.cpp14
-rw-r--r--plugins/TranslitSwitcher/src/TranslitSwitcher.cpp2
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp2
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp12
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp22
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp8
-rw-r--r--plugins/UserInfoEx/src/ctrl_annivedit.cpp6
-rw-r--r--plugins/UserInfoEx/src/ctrl_button.cpp6
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp46
-rw-r--r--plugins/UserInfoEx/src/ctrl_edit.cpp6
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp14
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp10
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp28
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp4
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp12
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp8
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp8
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp6
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp4
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp8
-rw-r--r--plugins/UserInfoEx/src/psp_anniversary.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_contact.cpp4
-rw-r--r--plugins/UserInfoEx/src/psp_general.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp24
-rw-r--r--plugins/UserInfoEx/src/psp_origin.cpp8
-rw-r--r--plugins/UserInfoEx/src/psp_profile.cpp22
-rw-r--r--plugins/UserInfoEx/src/svc_avatar.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_constants.cpp28
-rw-r--r--plugins/UserInfoEx/src/svc_contactinfo.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp6
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp32
-rw-r--r--plugins/UserInfoEx/src/svc_timezone_old.cpp2
-rw-r--r--plugins/Utils/mir_buffer.h2
-rw-r--r--plugins/Utils/mir_fonts.cpp18
-rw-r--r--plugins/Utils/mir_options.cpp14
-rw-r--r--plugins/Variables/src/contact.cpp2
-rw-r--r--plugins/Variables/src/dbhelpers.h18
-rw-r--r--plugins/Variables/src/parse_inet.cpp2
-rw-r--r--plugins/Variables/src/parse_math.cpp2
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp6
-rw-r--r--plugins/Variables/src/parse_miranda.cpp10
-rw-r--r--plugins/Variables/src/parse_system.cpp14
-rwxr-xr-xplugins/Watrack_MPD/src/options.cpp4
-rw-r--r--plugins/Weather/src/weather.cpp2
-rw-r--r--plugins/Weather/src/weather_addstn.cpp32
-rw-r--r--plugins/Weather/src/weather_contacts.cpp66
-rw-r--r--plugins/Weather/src/weather_conv.cpp22
-rw-r--r--plugins/Weather/src/weather_data.cpp72
-rw-r--r--plugins/Weather/src/weather_http.cpp2
-rw-r--r--plugins/Weather/src/weather_icons.cpp6
-rw-r--r--plugins/Weather/src/weather_info.cpp94
-rw-r--r--plugins/Weather/src/weather_ini.cpp16
-rw-r--r--plugins/Weather/src/weather_mwin.cpp2
-rw-r--r--plugins/Weather/src/weather_opt.cpp22
-rw-r--r--plugins/Weather/src/weather_popup.cpp24
-rw-r--r--plugins/Weather/src/weather_svcs.cpp6
-rw-r--r--plugins/Weather/src/weather_update.cpp34
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp2
-rw-r--r--plugins/WebView/src/main.cpp4
-rw-r--r--plugins/WebView/src/webview.cpp2
-rw-r--r--plugins/WebView/src/webview_alerts.cpp48
-rw-r--r--plugins/WebView/src/webview_cleanup.cpp2
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp18
-rw-r--r--plugins/WebView/src/webview_getdata.cpp28
-rw-r--r--plugins/WebView/src/webview_opts.cpp44
-rw-r--r--plugins/WebView/src/webview_services.cpp26
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp44
-rw-r--r--plugins/WhenWasIt/src/icons.cpp6
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp8
-rw-r--r--plugins/WhenWasIt/src/services.cpp16
-rw-r--r--plugins/WhenWasIt/src/utils.cpp6
-rw-r--r--plugins/WhoUsesMyFiles/src/list.cpp2
-rw-r--r--plugins/WhoUsesMyFiles/src/wumf.cpp2
-rw-r--r--plugins/WhoUsesMyFiles/src/wumfplug.cpp10
-rw-r--r--plugins/WinterSpeak/src/DialogConfigActive.cpp8
-rw-r--r--plugins/WinterSpeak/src/DialogConfigEngine.cpp2
-rw-r--r--plugins/XSoundNotify/src/Common.h2
-rw-r--r--plugins/XSoundNotify/src/dialog.cpp8
-rw-r--r--plugins/XSoundNotify/src/options.cpp6
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp8
-rw-r--r--plugins/YAMN/src/account.cpp30
-rw-r--r--plugins/YAMN/src/browser/badconnect.cpp2
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp44
-rw-r--r--plugins/YAMN/src/debug.cpp10
-rw-r--r--plugins/YAMN/src/mails/decode.cpp2
-rw-r--r--plugins/YAMN/src/mails/mime.cpp14
-rw-r--r--plugins/YAMN/src/main.cpp16
-rw-r--r--plugins/YAMN/src/proto/netlib.cpp2
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3.cpp18
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3comm.cpp6
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3opt.cpp36
-rw-r--r--plugins/YAPP/src/yapp_history_dlg.cpp8
-rw-r--r--plugins/YARelay/src/main.cpp2
-rw-r--r--plugins/YARelay/src/options.cpp2
-rw-r--r--plugins/YahooGroups/src/services.cpp2
-rw-r--r--plugins/YahooGroups/src/utils.cpp8
-rw-r--r--plugins/helpers/gen_helpers.cpp12
-rw-r--r--plugins/mTextControl/src/FormattedTextDraw.cpp8
-rw-r--r--plugins/mTextControl/src/richeditutils.cpp2
-rw-r--r--plugins/wbOSD/src/events.cpp8
564 files changed, 3740 insertions, 3740 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp
index b58e9922f0..14ce6c27f4 100644
--- a/plugins/AVS/src/acc.cpp
+++ b/plugins/AVS/src/acc.cpp
@@ -469,7 +469,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case AVATAR_SETNOAVATARTEXT:
- mir_tstrncpy(data->noAvatarText, TranslateTS((TCHAR*)lParam), SIZEOF(data->noAvatarText));
+ mir_tstrncpy(data->noAvatarText, TranslateTS((TCHAR*)lParam), _countof(data->noAvatarText));
Invalidate(hwnd);
return TRUE;
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index d14200ac06..f723c05f81 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -149,7 +149,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace)
// Default value
if (cacn.hash[0] == '\0')
- mir_sntprintf(cacn.hash, SIZEOF(cacn.hash), _T("AVS-HASH-%x"), GetFileHash(cacn.filename));
+ mir_sntprintf(cacn.hash, _countof(cacn.hash), _T("AVS-HASH-%x"), GetFileHash(cacn.filename));
NotifyEventHooks(hEventContactAvatarChanged, (WPARAM)cacn.hContact, (LPARAM)&cacn);
}
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index d551874527..6ed85901fd 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -142,10 +142,10 @@ static void LoadProtoInfo(PROTOCOLDESCRIPTOR *proto)
return;
char protoName[MAX_PATH];
- mir_snprintf(protoName, SIZEOF(protoName), "Global avatar for %s accounts", proto->szName);
+ mir_snprintf(protoName, _countof(protoName), "Global avatar for %s accounts", proto->szName);
TCHAR protoNameTmp[MAX_PATH];
- mir_sntprintf(protoNameTmp, SIZEOF(protoNameTmp), TranslateT("Global avatar for %s accounts"), _A2T(proto->szName));
+ mir_sntprintf(protoNameTmp, _countof(protoNameTmp), TranslateT("Global avatar for %s accounts"), _A2T(proto->szName));
protoPicCacheEntry *pce = new protoPicCacheEntry;
if (CreateAvatarInCache(0, pce, protoName) != 1)
db_unset(0, PPICT_MODULE, protoName);
@@ -323,7 +323,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm
static int ModulesLoaded(WPARAM, LPARAM)
{
TCHAR szEventName[100];
- mir_sntprintf(szEventName, SIZEOF(szEventName), _T("avs_loaderthread_%d"), GetCurrentThreadId());
+ mir_sntprintf(szEventName, _countof(szEventName), _T("avs_loaderthread_%d"), GetCurrentThreadId());
hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
SetThreadPriority(mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE);
@@ -381,7 +381,7 @@ static int LoadAvatarModule()
InitServices();
InitPolls();
- _tcsncpy_s(g_szDataPath, SIZEOF(g_szDataPath), VARST(_T("%miranda_userdata%\\")), _TRUNCATE);
+ _tcsncpy_s(g_szDataPath, _countof(g_szDataPath), VARST(_T("%miranda_userdata%\\")), _TRUNCATE);
_tcslwr(g_szDataPath);
return 0;
}
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp
index 0f7793b45f..3294089c99 100644
--- a/plugins/AVS/src/options.cpp
+++ b/plugins/AVS/src/options.cpp
@@ -100,7 +100,7 @@ static void RemoveProtoPic(const char *szProto)
static void SetProtoPic(char *szProto)
{
TCHAR FileName[MAX_PATH], filter[256];
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -388,7 +388,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar
if (!db_get_ts(NULL, PPICT_MODULE, g_selectedProto, &dbv)) {
if (!PathIsAbsoluteT(VARST(dbv.ptszVal))) {
TCHAR szFinalPath[MAX_PATH];
- mir_sntprintf(szFinalPath, SIZEOF(szFinalPath), _T("%%miranda_path%%\\%s"), dbv.ptszVal);
+ mir_sntprintf(szFinalPath, _countof(szFinalPath), _T("%%miranda_path%%\\%s"), dbv.ptszVal);
SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, szFinalPath);
}
else SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, dbv.ptszVal);
@@ -1081,7 +1081,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP
break;
char description[256];
- CallProtoService(proto, PS_GETNAME, SIZEOF(description), (LPARAM)description);
+ CallProtoService(proto, PS_GETNAME, _countof(description), (LPARAM)description);
TCHAR *descr = mir_a2t(description);
if (MessageBox(hwndDlg, TranslateT("Are you sure you want to remove your avatar?"), descr, MB_YESNO) == IDYES)
avSetMyAvatar(proto, _T(""));
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index 5162f283f6..33084606e9 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -128,7 +128,7 @@ static INT_PTR avSetAvatar(MCONTACT hContact, TCHAR *tszPath)
if (tszPath == NULL) {
TCHAR filter[256];
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -347,7 +347,7 @@ void SaveImage(SaveProtocolData &d, char *protocol, int format)
if (!Proto_IsAvatarFormatSupported(protocol, format))
return;
- mir_sntprintf(d.image_file_name, SIZEOF(d.image_file_name), _T("%s%s"), d.temp_file, ProtoGetAvatarExtension(format));
+ mir_sntprintf(d.image_file_name, _countof(d.image_file_name), _T("%s%s"), d.temp_file, ProtoGetAvatarExtension(format));
if (BmpFilterSaveBitmap(d.hBmpProto, d.image_file_name, format == PA_FORMAT_JPEG ? JPEG_QUALITYSUPERB : 0))
return;
@@ -549,14 +549,14 @@ static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHo
// Copy avatar file to store as global one
TCHAR globalFile[1024];
BOOL saved = TRUE;
- if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, SIZEOF(globalFile), _T(""))) {
- mir_sntprintf(globalFile, SIZEOF(globalFile), _T("%s%s"), g_szDataPath, _T("GlobalAvatar"));
+ if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), _T(""))) {
+ mir_sntprintf(globalFile, _countof(globalFile), _T("%s%s"), g_szDataPath, _T("GlobalAvatar"));
CreateDirectory(globalFile, NULL);
}
TCHAR *ext = _tcsrchr(szFinalName, _T('.')); // Can't be NULL here
if (format == PA_FORMAT_XML || format == PA_FORMAT_SWF) {
- mir_sntprintf(globalFile, SIZEOF(globalFile), _T("%s\\my_global_avatar%s"), globalFile, ext);
+ mir_sntprintf(globalFile, _countof(globalFile), _T("%s\\my_global_avatar%s"), globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
}
else {
@@ -574,12 +574,12 @@ static int InternalSetMyAvatar(char *protocol, TCHAR *szFinalName, SetMyAvatarHo
// Check if need to resize
if (hBmpTmp == hBmp || hBmpTmp == NULL) {
// Use original image
- mir_sntprintf(globalFile, SIZEOF(globalFile), _T("%s\\my_global_avatar%s"), globalFile, ext);
+ mir_sntprintf(globalFile, _countof(globalFile), _T("%s\\my_global_avatar%s"), globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
}
else {
// Save as PNG
- mir_sntprintf(globalFile, SIZEOF(globalFile), _T("%s\\my_global_avatar.png"), globalFile);
+ mir_sntprintf(globalFile, _countof(globalFile), _T("%s\\my_global_avatar.png"), globalFile);
if (BmpFilterSaveBitmap(hBmpTmp, globalFile, 0))
saved = FALSE;
@@ -665,7 +665,7 @@ INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath)
FilterGetStrings(filter, allAcceptXML, allAcceptSWF);
TCHAR inipath[1024];
- FoldersGetCustomPathT(hMyAvatarsFolder, inipath, SIZEOF(inipath), _T("."));
+ FoldersGetCustomPathT(hMyAvatarsFolder, inipath, _countof(inipath), _T("."));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -685,10 +685,10 @@ INT_PTR avSetMyAvatar(char* protocol, TCHAR* tszPath)
TCHAR title[256];
if (protocol == NULL)
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Avatar"));
+ mir_sntprintf(title, _countof(title), TranslateT("Set My Avatar"));
else {
TCHAR* prototmp = mir_a2t(protocol);
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Avatar for %s"), prototmp);
+ mir_sntprintf(title, _countof(title), TranslateT("Set My Avatar for %s"), prototmp);
mir_free(prototmp);
}
ofn.lpstrTitle = title;
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp
index 030696b7fc..c59c8a9499 100644
--- a/plugins/AVS/src/utils.cpp
+++ b/plugins/AVS/src/utils.cpp
@@ -103,7 +103,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
if (pdescr == NULL)
return -1;
char key[MAX_PATH];
- mir_snprintf(key, SIZEOF(key), "Global avatar for %s accounts", pdescr->szProtoName);
+ mir_snprintf(key, _countof(key), "Global avatar for %s accounts", pdescr->szProtoName);
if (tszValue = db_get_tsa(NULL, PPICT_MODULE, key))
MyPathToAbsolute(tszValue, tszFilename);
}
@@ -128,7 +128,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto)
if (CallProtoService(szProto, PS_GETMYAVATAR, (WPARAM)szFileName, (LPARAM)MAX_PATH))
tszFilename[0] = '\0';
else
- MultiByteToWideChar(CP_ACP, 0, szFileName, -1, tszFilename, SIZEOF(tszFilename));
+ MultiByteToWideChar(CP_ACP, 0, szFileName, -1, tszFilename, _countof(tszFilename));
}
else if (tszValue = db_get_tsa(NULL, szProto, "AvatarFile"))
MyPathToAbsolute(tszValue, tszFilename);
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp
index a318776dfe..98630c1daf 100644
--- a/plugins/AddContactPlus/src/addcontact.cpp
+++ b/plugins/AddContactPlus/src/addcontact.cpp
@@ -196,7 +196,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
case IDC_USERID:
if (HIWORD(wparam) == EN_CHANGE) {
TCHAR szUserId[256];
- if (GetDlgItemText(hdlg, IDC_USERID, szUserId, SIZEOF(szUserId))) {
+ if (GetDlgItemText(hdlg, IDC_USERID, szUserId, _countof(szUserId))) {
if (!IsWindowEnabled(GetDlgItem(hdlg, IDOK)))
EnableWindow(GetDlgItem(hdlg, IDOK), TRUE);
}
@@ -234,7 +234,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
case IDOK:
{
TCHAR szUserId[256];
- GetDlgItemText(hdlg, IDC_USERID, szUserId, SIZEOF(szUserId));
+ GetDlgItemText(hdlg, IDC_USERID, szUserId, _countof(szUserId));
if (*rtrimt(szUserId) == 0 ||
(strstr(acs->proto, "GG") && _tcstoul(szUserId, NULL, 10) > INT_MAX) || // Gadu-Gadu protocol
@@ -256,7 +256,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
}
psr = (PROTOSEARCHRESULT*)mir_calloc(sizeof(TLEN_SEARCH_RESULT));
psr->cbSize = sizeof(TLEN_SEARCH_RESULT);
- mir_snprintf(((TLEN_SEARCH_RESULT*)psr)->jid, SIZEOF(((TLEN_SEARCH_RESULT*)psr)->jid), "%S", szUserId);
+ mir_snprintf(((TLEN_SEARCH_RESULT*)psr)->jid, _countof(((TLEN_SEARCH_RESULT*)psr)->jid), "%S", szUserId);
}
else {
psr = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
@@ -276,7 +276,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
}
TCHAR szHandle[256];
- if (GetDlgItemText(hdlg, IDC_MYHANDLE, szHandle, SIZEOF(szHandle)))
+ if (GetDlgItemText(hdlg, IDC_MYHANDLE, szHandle, _countof(szHandle)))
db_set_ts(hContact, "CList", "MyHandle", szHandle);
int item = SendDlgItemMessage(hdlg, IDC_GROUP, CB_GETCURSEL, 0, 0);
@@ -297,7 +297,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM)
CallContactService(hContact, PSS_AUTHREQUEST, 0, 0);
else {
TCHAR tszReason[512];
- GetDlgItemText(hdlg, IDC_AUTHREQ, tszReason, SIZEOF(tszReason));
+ GetDlgItemText(hdlg, IDC_AUTHREQ, tszReason, _countof(tszReason));
CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)tszReason);
}
}
diff --git a/plugins/Alarms/src/icons.cpp b/plugins/Alarms/src/icons.cpp
index 8d2bdd51c3..3848213ad1 100644
--- a/plugins/Alarms/src/icons.cpp
+++ b/plugins/Alarms/src/icons.cpp
@@ -26,7 +26,7 @@ int ReloadIcons(WPARAM, LPARAM)
void InitIcons()
{
- Icon_Register(hInst, "Alarms", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Alarms", iconList, _countof(iconList));
if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
hIconMenuShowHide = IcoLib_GetIcon("alarms_menu_showhide");
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp
index 853c54b285..f5bcd72416 100644
--- a/plugins/Alarms/src/options.cpp
+++ b/plugins/Alarms/src/options.cpp
@@ -532,10 +532,10 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDOK:
{
TCHAR buff[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_TITLE, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_TITLE, buff, _countof(buff));
replaceStrT(add_edit_alarm->szTitle, buff);
- GetDlgItemText(hwndDlg, IDC_DESC, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_DESC, buff, _countof(buff));
replaceStrT(add_edit_alarm->szDesc, buff);
if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') {
@@ -562,9 +562,9 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP
add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_NOREMINDER) ? ALF_NOREMINDER: 0;
if (add_edit_alarm->action & AAF_COMMAND) {
- GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, _countof(buff));
replaceStrT(add_edit_alarm->szCommand, buff);
- GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, _countof(buff));
replaceStrT(add_edit_alarm->szCommandParams, buff);
}
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp
index a86a3542c1..5075e719ed 100644
--- a/plugins/AssocMgr/src/assoclist.cpp
+++ b/plugins/AssocMgr/src/assoclist.cpp
@@ -62,7 +62,7 @@ static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled)
db_set_b(NULL, "AssocMgr", szSetting, (BYTE)fEnabled);
/* dll name for uninstall */
if(assoc->hInstance!= NULL && assoc->hInstance!= hInst && assoc->hInstance!= GetModuleHandle(NULL))
- if( GetModuleFileName(assoc->hInstance, szBuf, SIZEOF(szBuf)))
+ if( GetModuleFileName(assoc->hInstance, szBuf, _countof(szBuf)))
if( PathToRelativeT(szBuf, szDLL)) {
mir_snprintf(szSetting, "module_%s", assoc->pszClassName);
db_set_ts(NULL, "AssocMgr", szSetting, szDLL);
@@ -266,9 +266,9 @@ static TCHAR* GetAssocTypeDesc(const ASSOCDATA *assoc)
{
static TCHAR szDesc[32];
if(assoc->pszFileExt == NULL)
- mir_sntprintf(szDesc, SIZEOF(szDesc), _T("%hs:"), assoc->pszClassName);
+ mir_sntprintf(szDesc, _countof(szDesc), _T("%hs:"), assoc->pszClassName);
else
- mir_sntprintf(szDesc, SIZEOF(szDesc), TranslateT("%hs files"), assoc->pszFileExt);
+ mir_sntprintf(szDesc, _countof(szDesc), TranslateT("%hs files"), assoc->pszFileExt);
return szDesc;
}
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp
index 5fb674b22a..17706ab018 100644
--- a/plugins/AssocMgr/src/dde.cpp
+++ b/plugins/AssocMgr/src/dde.cpp
@@ -169,7 +169,7 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath)
TCHAR *p,szPath[MAX_PATH];
/* we are inside RunDll32 here */
- if (!GetModuleFileName(hInst,szPath,SIZEOF(szPath))) return NULL;
+ if (!GetModuleFileName(hInst,szPath,_countof(szPath))) return NULL;
p=_tcsrchr(szPath,_T('\\'));
if(p!=NULL) { *p=0; p=_tcsrchr(szPath,_T('\\')); }
if(p==NULL) return NULL;
@@ -202,7 +202,7 @@ __declspec(dllexport) void CALLBACK WaitForDDE(HWND,HINSTANCE,TCHAR *pszCmdLine,
if(pHandles[1]!=NULL) {
dwTick=GetTickCount();
/* either process terminated or dde window created */
- if(WaitForMultipleObjects(SIZEOF(pHandles),pHandles,FALSE,DDEMESSAGETIMEOUT)==WAIT_OBJECT_0) {
+ if(WaitForMultipleObjects(_countof(pHandles),pHandles,FALSE,DDEMESSAGETIMEOUT)==WAIT_OBJECT_0) {
dwTick=GetTickCount()-dwTick;
if(dwTick<DDEMESSAGETIMEOUT)
WaitForInputIdle(pHandles[1],DDEMESSAGETIMEOUT-dwTick);
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp
index ea21bc1c59..51ac863238 100644
--- a/plugins/AssocMgr/src/main.cpp
+++ b/plugins/AssocMgr/src/main.cpp
@@ -48,7 +48,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
{
TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
- if (!GetModuleFileName(hInst, szFileFrom, SIZEOF(szFileFrom) - (int)mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(hInst, szFileFrom, _countof(szFileFrom) - (int)mir_tstrlen(pszFileName)))
return;
TCHAR *p = _tcsrchr(szFileFrom,_T('\\'));
@@ -61,7 +61,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
return;
CloseHandle(hFile);
- if (!GetModuleFileName(NULL, szFileTo, SIZEOF(szFileTo)-(int)mir_tstrlen(pszDestSubDir)-(int)mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(NULL, szFileTo, _countof(szFileTo)-(int)mir_tstrlen(pszDestSubDir)-(int)mir_tstrlen(pszFileName)))
return;
p = _tcsrchr(szFileTo,_T('\\'));
if (p)
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp
index 0917af9c93..13812e61d4 100644
--- a/plugins/AssocMgr/src/reg.cpp
+++ b/plugins/AssocMgr/src/reg.cpp
@@ -33,7 +33,7 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo,
char *pszErr;
pszErr = GetWinErrorDescription(res);
pszInfo2 = s2t(pszInfo, fInfoUnicode, FALSE); /* does NULL check */
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Access failed:\n%.64hs(%.128s)\n%.250hs(%u)\n%.256hs (%u)"), pszFunc, pszInfo2, pszFile, nLine, pszErr, res);
+ mir_sntprintf(szMsg, _countof(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);
mir_free(pszInfo2); /* does NULL check */
@@ -127,7 +127,7 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
{
TCHAR szDbFile[MAX_PATH], szExe[MAX_PATH], *pszFmt;
if (fFixedDbProfile) {
- if ( CallService(MS_DB_GETPROFILENAMET, SIZEOF(szDbFile), (LPARAM)szDbFile))
+ if ( CallService(MS_DB_GETPROFILENAMET, _countof(szDbFile), (LPARAM)szDbFile))
return NULL;
TCHAR *p = _tcsrchr(szDbFile, '.');
if (p)
@@ -135,7 +135,7 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
}
else mir_tstrcpy(szDbFile, _T("%1")); /* buffer safe */
- if ( !GetModuleFileName(fMirExe ? NULL : hInst, szExe, SIZEOF(szExe)))
+ if ( !GetModuleFileName(fMirExe ? NULL : hInst, szExe, _countof(szExe)))
return NULL;
if (fMirExe)
@@ -145,10 +145,10 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
/* run command for rundll32.exe calling WaitForDDE */
pszFmt = _T("rundll32.exe %s,WaitForDDE \"/profile:%s\"");
/* ensure the command line is not too long */
- GetShortPathName(szExe, szExe, SIZEOF(szExe));
+ GetShortPathName(szExe, szExe, _countof(szExe));
/* surround by quotes if failed */
size_t len = mir_tstrlen(szExe);
- if ( _tcschr(szExe,_T(' ')) != NULL && (len+2) < SIZEOF(szExe)) {
+ if ( _tcschr(szExe,_T(' ')) != NULL && (len+2) < _countof(szExe)) {
memmove(szExe, szExe+1, (len+1)*sizeof(TCHAR));
szExe[len+2] = szExe[0] = _T('\"');
szExe[len+3] = 0;
@@ -156,7 +156,7 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile)
}
TCHAR tszBuffer[1024];
- mir_sntprintf(tszBuffer, SIZEOF(tszBuffer), pszFmt, szExe, szDbFile);
+ mir_sntprintf(tszBuffer, _countof(tszBuffer), pszFmt, szExe, szDbFile);
return mir_tstrdup(tszBuffer);
}
@@ -176,7 +176,7 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd)
if (pargs!=NULL) *pargs=0;
pexe=buf;
}
- if (SearchPath(NULL,pexe,_T(".exe"),SIZEOF(szFullExe),szFullExe,&pszFilePart)) {
+ if (SearchPath(NULL,pexe,_T(".exe"),_countof(szFullExe),szFullExe,&pszFilePart)) {
if (pszFilePart!=NULL)
if (!mir_tstrcmpi(pszFilePart,_T("rundll32.exe")) || !mir_tstrcmpi(pszFilePart,_T("rundll.exe"))) {
/* split into dll path and arguments */
@@ -200,7 +200,7 @@ TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID)
{
TCHAR szModule[MAX_PATH],*pszIconLoc=NULL;
int cch;
- if ((cch=GetModuleFileName(hModule,szModule,SIZEOF(szModule))) != 0) {
+ if ((cch=GetModuleFileName(hModule,szModule,_countof(szModule))) != 0) {
pszIconLoc=(TCHAR*)mir_alloc((cch+=8)*sizeof(TCHAR));
if (pszIconLoc!=NULL)
mir_sntprintf(pszIconLoc, cch, _T("%s,%i"), szModule, -(int)nIconResID); /* id may be 0, buffer safe */
@@ -212,7 +212,7 @@ TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID)
TCHAR *MakeAppFileName(BOOL fMirExe)
{
TCHAR szExe[MAX_PATH],*psz;
- if (GetModuleFileName(fMirExe?NULL:hInst,szExe,SIZEOF(szExe))) {
+ if (GetModuleFileName(fMirExe?NULL:hInst,szExe,_countof(szExe))) {
psz=_tcsrchr(szExe,_T('\\'));
if (psz!=NULL) ++psz;
else psz=szExe;
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp
index 11f10513fe..cd4994331a 100644
--- a/plugins/AssocMgr/src/test.cpp
+++ b/plugins/AssocMgr/src/test.cpp
@@ -173,7 +173,7 @@ static int AimLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
char service_name[MAXMODULELABELLENGTH];
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- mir_snprintf(service_name,SIZEOF(service_name),"%s%s",AIM_PROTOCOL_NAME,"ParseAimLink");
+ mir_snprintf(service_name,_countof(service_name),"%s%s",AIM_PROTOCOL_NAME,"ParseAimLink");
/* or "AOL Instant Messenger Links" */
AssocMgr_AddNewUrlType("aim:",Translate("AIM link protocol"),conn.hInstance,IDI_AOL,service_name,0);
return 0;
@@ -183,7 +183,7 @@ void aim_links_init()
{
char service_name[MAXMODULELABELLENGTH];
//LOG(LOG_DEBUG,"Links: init");
- mir_snprintf(service_name,SIZEOF(service_name),"%s%s",AIM_PROTOCOL_NAME,"ParseAimLink");
+ mir_snprintf(service_name,_countof(service_name),"%s%s",AIM_PROTOCOL_NAME,"ParseAimLink");
hServiceParseLink=CreateServiceFunction(service_name,ServiceParseAimLink);
hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,AimLinksModulesLoaded);
}
@@ -479,7 +479,7 @@ static int YmsgrLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
char szService[MAXMODULELABELLENGTH];
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- mir_snprintf(szService,SIZEOF(szService),"%s%s",yahooProtocolName,"ParseYmsgrLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",yahooProtocolName,"ParseYmsgrLink");
AssocMgr_AddNewUrlType("ymsgr:",Translate("Yahoo link protocol"),hinstance,IDI_YAHOO,szService,0);
return 0;
}
@@ -487,7 +487,7 @@ static int YmsgrLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
void YmsgrLinksInit(void)
{
char szService[MAXMODULELABELLENGTH];
- mir_snprintf(szService,SIZEOF(szService),"%s%s",yahooProtocolName,"ParseYmsgrLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",yahooProtocolName,"ParseYmsgrLink");
hServiceParseYmsgrLink=CreateServiceFunction(szService,ServiceParseYmsgrLink);
hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,YmsgrLinksModulesLoaded);
}
@@ -586,7 +586,7 @@ static int MsnLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
char szService[MAXMODULELABELLENGTH];
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- mir_snprintf(szService,SIZEOF(szService),"%s%s",msnProtocolName,"ParseMsnimLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",msnProtocolName,"ParseMsnimLink");
AssocMgr_AddNewUrlType("msnim:",Translate("MSN link protocol"),hInst,IDI_MSN,szService,0);
return 0;
}
@@ -594,7 +594,7 @@ static int MsnLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
int LoadMsnLinks(void)
{
char szService[MAXMODULELABELLENGTH];
- mir_snprintf(szService,SIZEOF(szService),"%s%s",msnProtocolName,"ParseMsnimLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",msnProtocolName,"ParseMsnimLink");
hServiceParseMsnimLink=CreateServiceFunction(szService,ServiceParseMsnimLink);
hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,MsnLinksModulesLoaded);
return 0;
@@ -651,7 +651,7 @@ static int LinksModulesLoaded(WPARAM wParam,LPARAM lParam)
char szService[MAXMODULELABELLENGTH];
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- mir_snprintf(szService,SIZEOF(szService),"%s%s",GG_PROTO,"ParseMsnimLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",GG_PROTO,"ParseMsnimLink");
AssocMgr_AddNewUrlType("gg:",Translate("Gadu-Gadu link protocol"),hInstance,IDI_GG,szService,0);
return 0;
}
@@ -659,7 +659,7 @@ static int LinksModulesLoaded(WPARAM wParam,LPARAM lParam)
void gg_registerlinks(void)
{
char szService[MAXMODULELABELLENGTH];
- mir_snprintf(szService,SIZEOF(szService),"%s%s",GG_PROTO,"ParseLink");
+ mir_snprintf(szService,_countof(szService),"%s%s",GG_PROTO,"ParseLink");
hServiceParseLink=CreateServiceFunction(szService,ServiceParseLink);
hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,LinksModulesLoaded);
}
@@ -728,7 +728,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam)
if(ServiceExists(MS_MSG_SENDMESSAGE)) {
hContact=JabberDBCreateContact(jid,jid,TRUE,FALSE);
if(subj!=NULL && body!=NULL) {
- mir_snprintf(msg,SIZEOF(msg),"%.128s %s",subj,body);
+ mir_snprintf(msg,_countof(msg),"%.128s %s",subj,body);
body=msg;
} else if(body==NULL) body=subj;
if(hContact!=NULL)
@@ -777,7 +777,7 @@ static int JabberLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
char szService[MAXMODULELABELLENGTH];
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
- mir_snprintf(szService,SIZEOF(szService),"%s%s",jabberProtoName,"ParseXmppURI");
+ mir_snprintf(szService,_countof(szService),"%s%s",jabberProtoName,"ParseXmppURI");
AssocMgr_AddNewUrlType("xmpp:",Translate("Jabber link protocol"),hInst,IDI_JABBER,szService,0);
return 0;
}
@@ -785,7 +785,7 @@ static int JabberLinksModulesLoaded(WPARAM wParam,LPARAM lParam)
int JabberLinksInit()
{
char szService[MAXMODULELABELLENGTH];
- mir_snprintf(szService,SIZEOF(szService),"%s%s",jabberProtoName,"ParseXmppURI");
+ mir_snprintf(szService,_countof(szService),"%s%s",jabberProtoName,"ParseXmppURI");
hServiceParseXmppURI=CreateServiceFunction(szService,ServiceParseXmppURI);
hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,JabberLinksModulesLoaded);
return 0;
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp
index 0c76880e29..7f8ec8fbf2 100644
--- a/plugins/AssocMgr/src/utils.cpp
+++ b/plugins/AssocMgr/src/utils.cpp
@@ -143,7 +143,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
va_list va;
va_start(va,pszTextFmt);
- mir_vsnprintf(szText,SIZEOF(szText),pszTextFmt,va);
+ mir_vsnprintf(szText,_countof(szText),pszTextFmt,va);
va_end(va);
if(ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp
index db41184c24..8205f686af 100644
--- a/plugins/AuthState/src/main.cpp
+++ b/plugins/AuthState/src/main.cpp
@@ -209,7 +209,7 @@ extern "C" int __declspec(dllexport) Load(void)
}
// IcoLib support
- Icon_Register(g_hInst, "Auth State", iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, "Auth State", iconList, _countof(iconList));
// extra icons
hExtraIcon = ExtraIcon_Register("authstate", LPGEN("Auth State"), "authgrant_icon");
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp
index 6c2c6383af..6291410e60 100644
--- a/plugins/AutoRun/src/main.cpp
+++ b/plugins/AutoRun/src/main.cpp
@@ -27,8 +27,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
void GetProfilePath(TCHAR *res, size_t resLen)
{
TCHAR dbname[MAX_PATH], exename[MAX_PATH];
- CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)dbname);
- GetModuleFileName(NULL, exename, SIZEOF(exename));
+ CallService(MS_DB_GETPROFILENAMET, _countof(dbname), (LPARAM)dbname);
+ GetModuleFileName(NULL, exename, _countof(exename));
TCHAR *p = _tcsrchr(dbname, '.');
if (p) *p = 0;
@@ -44,7 +44,7 @@ static void SetAutorun(BOOL autorun)
case TRUE:
if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) {
TCHAR result[MAX_PATH];
- GetProfilePath(result, SIZEOF(result));
+ GetProfilePath(result, _countof(result));
RegSetValueEx(hKey, _T("MirandaNG"), 0, REG_SZ, (BYTE*)result, sizeof(TCHAR)*mir_tstrlen(result));
RegCloseKey(hKey);
}
@@ -69,7 +69,7 @@ static BOOL CmpCurrentAndRegistry()
if ( RegQueryValueEx(hKey, _T("MirandaNG"), NULL, NULL, (LPBYTE)dbpath, &dwBufLen) != ERROR_SUCCESS)
return FALSE;
- GetProfilePath(result, SIZEOF(result));
+ GetProfilePath(result, _countof(result));
return mir_tstrcmpi(result, dbpath) == 0;
}
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index c01bf11b54..e66b12998e 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -358,8 +358,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
else {
TCHAR szOutput[256];
if (dat->fTimeFlags&SDWTF_ST_TIME)
- GetFormatedDateTime(szOutput,SIZEOF(szOutput),dat->settingLastTime,TRUE);
- else GetFormatedCountdown(szOutput,SIZEOF(szOutput),dat->countdown);
+ GetFormatedDateTime(szOutput,_countof(szOutput),dat->settingLastTime,TRUE);
+ else GetFormatedCountdown(szOutput,_countof(szOutput),dat->countdown);
SetWindowText(dat->hwndTime,szOutput);
PostMessage(hwndFrame,M_CHECK_CLIPPED,0,0);
/* update tooltip text (if shown) */
@@ -443,7 +443,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
HFONT hFontPrev=NULL;
TCHAR szOutput[256];
dat->flags&=~FWPDF_TIMEISCLIPPED;
- if (GetWindowText(dat->hwndTime,szOutput,SIZEOF(szOutput)))
+ if (GetWindowText(dat->hwndTime,szOutput,_countof(szOutput)))
if (GetClientRect(dat->hwndTime,&rc)) {
hdc=GetDC(dat->hwndTime);
if (hdc != NULL) {
@@ -484,17 +484,17 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
case TTN_NEEDTEXT:
{ NMTTDISPINFO *ttdi=(NMTTDISPINFO*)lParam;
if (dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime) {
- if (GetWindowText(dat->hwndTime,ttdi->szText,SIZEOF(ttdi->szText)))
+ if (GetWindowText(dat->hwndTime,ttdi->szText,_countof(ttdi->szText)))
ttdi->lpszText=ttdi->szText;
}
else if ((HWND)wParam==dat->hwndIcon)
ttdi->lpszText=TranslateT("Automatic Shutdown");
else {
- TCHAR szTime[SIZEOF(ttdi->szText)];
+ TCHAR szTime[_countof(ttdi->szText)];
if (dat->fTimeFlags&SDWTF_ST_TIME)
- GetFormatedDateTime(szTime,SIZEOF(szTime),dat->settingLastTime,FALSE);
- else GetFormatedCountdown(szTime,SIZEOF(szTime),dat->countdown);
- mir_sntprintf(ttdi->szText,SIZEOF(ttdi->szText),_T("%s %s"),(dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"),szTime);
+ GetFormatedDateTime(szTime,_countof(szTime),dat->settingLastTime,FALSE);
+ else GetFormatedCountdown(szTime,_countof(szTime),dat->countdown);
+ mir_sntprintf(ttdi->szText,_countof(ttdi->szText),_T("%s %s"),(dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"),szTime);
ttdi->lpszText=ttdi->szText;
}
return 0;
diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp
index 7962e5fe6b..e7cdf5ac2d 100644
--- a/plugins/AutoShutdown/src/main.cpp
+++ b/plugins/AutoShutdown/src/main.cpp
@@ -76,7 +76,7 @@ extern "C" __declspec(dllexport) int Load(void)
if (InitFrame()) return 1; /* before icons */
/* shared */
- Icon_Register(hInst, "Automatic Shutdown", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Automatic Shutdown", iconList, _countof(iconList));
InitShutdownSvc();
InitWatcher(); /* before InitSettingsDlg() */
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 207cdbaad2..89cdb08aed 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -45,7 +45,7 @@ static BOOL CALLBACK DisplayCpuUsageProc(BYTE nCpuUsage,LPARAM lParam)
/* dialog closed? */
if (!IsWindow((HWND)lParam)) return FALSE; /* stop poll thread */
TCHAR str[64];
- mir_sntprintf(str,SIZEOF(str),TranslateT("(current: %u%%)"),nCpuUsage);
+ mir_sntprintf(str,_countof(str),TranslateT("(current: %u%%)"),nCpuUsage);
SetWindowText((HWND)lParam,str);
return TRUE;
}
@@ -116,8 +116,8 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
DWORD lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
- SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
- for(int i=0;i<SIZEOF(unitNames);++i) {
+ SendMessage(hwndCombo,CB_INITSTORAGE,_countof(unitNames),_countof(unitNames)*16); /* approx. */
+ for(int i=0;i<_countof(unitNames);++i) {
int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)unitValues[i]);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index 2a69f1b9cd..a19adbb2fa 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -379,7 +379,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case M_UPDATE_COUNTDOWN: /* lParam=(WORD)countdown */
{
TCHAR szText[256];
- mir_sntprintf(szText,SIZEOF(szText),TranslateTS(desc[shutdownType-1]),lParam);
+ mir_sntprintf(szText,_countof(szText),TranslateTS(desc[shutdownType-1]),lParam);
SetDlgItemText(hwndDlg,IDC_TEXT_HEADER,szText);
/* countdown finished */
if (!lParam)
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp
index 489605c69e..7fc7c6720a 100644
--- a/plugins/AutoShutdown/src/utils.cpp
+++ b/plugins/AutoShutdown/src/utils.cpp
@@ -49,7 +49,7 @@ void TrimString(TCHAR *pszStr)
{
int i;
TCHAR *psz,szChars[]=_T(" \r\n\t");
- for(i=0;i<SIZEOF(szChars);++i) {
+ for(i=0;i<_countof(szChars);++i) {
/* trim end */
psz=&pszStr[mir_tstrlen(pszStr)-1];
while(pszStr[0] && *psz==szChars[i]) {
@@ -80,7 +80,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
va_list va;
va_start(va,pszTextFmt);
- mir_vsnprintf(szText,SIZEOF(szText),pszTextFmt,va);
+ mir_vsnprintf(szText,_countof(szText),pszTextFmt,va);
va_end(va);
if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
@@ -193,9 +193,9 @@ BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDate
return GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,pszOut,nSize) != 0;
/* show both date and time */
{ TCHAR szDate[128],szTime[128];
- if (!GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,szTime,SIZEOF(szTime)))
+ if (!GetTimeFormat(locale,((st.wSecond==0)?TIME_NOSECONDS:0)|TIME_FORCE24HOURFORMAT,&st,NULL,szTime,_countof(szTime)))
return FALSE;
- if (!GetDateFormat(locale,DATE_SHORTDATE,&st,NULL,szDate,SIZEOF(szDate)))
+ if (!GetDateFormat(locale,DATE_SHORTDATE,&st,NULL,szDate,_countof(szDate)))
return FALSE;
mir_sntprintf(pszOut,nSize,_T("%s %s"),szTime,szDate);
return TRUE;
@@ -207,7 +207,7 @@ BOOL GetFormatedDateTime(TCHAR *pszOut,int nSize,time_t timestamp,BOOL fShowDate
HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDesc,HINSTANCE hInst,WORD idRes,BOOL fLarge)
{
TCHAR szFileName[MAX_PATH];
- GetModuleFileName(hInst,szFileName,SIZEOF(szFileName));
+ GetModuleFileName(hInst,szFileName,_countof(szFileName));
SKINICONDESC sid = { 0 };
sid.pszName = (char*)pszDbName;
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 3a791498cc..76184a0a7c 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -84,7 +84,7 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn)
}
else
{
- MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, SIZEOF(avdlg->fn));
+ MultiByteToWideChar(CP_ACP, 0, fn, -1, avdlg->fn, _countof(avdlg->fn));
}
CloseHandle(mir_forkthread(AvatarDialogThread, (void*)avdlg));
@@ -138,7 +138,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l
{
TCHAR title[MAX_PATH];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Avatar History for %s"), displayName);
+ mir_sntprintf(title, _countof(title), TranslateT("Avatar History for %s"), displayName);
SetWindowText(hwnd, title);
}
@@ -376,7 +376,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact)
WIN32_FIND_DATA finddata;
GetContactFolder(dir, hContact);
- mir_sntprintf(path, SIZEOF(path), _T("%s\\*.*"), dir);
+ mir_sntprintf(path, _countof(path), _T("%s\\*.*"), dir);
HANDLE hFind = FindFirstFile(path, &finddata);
if (hFind == INVALID_HANDLE_VALUE)
@@ -386,7 +386,7 @@ int FillAvatarListFromFiles(HWND list, MCONTACT hContact)
{
if (finddata.cFileName[0] != '.')
{
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), dir, finddata.cFileName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), dir, finddata.cFileName);
max_pos = AddFileToList(path,finddata.cFileName,finddata.cFileName,list);
}
}
@@ -403,7 +403,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact)
WIN32_FIND_DATA finddata;
GetContactFolder(dir, hContact);
- mir_sntprintf(path, SIZEOF(path), _T("%s\\*.lnk"), dir);
+ mir_sntprintf(path, _countof(path), _T("%s\\*.lnk"), dir);
HANDLE hFind = FindFirstFile(path, &finddata);
if (hFind == INVALID_HANDLE_VALUE)
@@ -414,7 +414,7 @@ int FillAvatarListFromFolder(HWND list, MCONTACT hContact)
if (finddata.cFileName[0] != '.')
{
TCHAR lnk[MAX_PATH];
- mir_sntprintf(lnk, SIZEOF(lnk), _T("%s\\%s"), dir, finddata.cFileName);
+ mir_sntprintf(lnk, _countof(lnk), _T("%s\\%s"), dir, finddata.cFileName);
if (ResolveShortcut(lnk, path))
max_pos = AddFileToList(path,lnk,finddata.cFileName,list);
}
@@ -438,7 +438,7 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact)
// Get time
TCHAR date[64];
- TimeZone_ToStringT(dbei.timestamp, _T("d s"), date, SIZEOF(date));
+ TimeZone_ToStringT(dbei.timestamp, _T("d s"), date, _countof(date));
// Get file in disk
TCHAR path[MAX_PATH];
@@ -534,7 +534,7 @@ static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam)
int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact)
{
TCHAR filter[MAX_PATH], file[MAX_PATH];
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -551,7 +551,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact)
TCHAR title[MAX_PATH];
if (displayName)
{
- mir_sntprintf(title, SIZEOF(title), TranslateT("Save Avatar for %s"), displayName);
+ mir_sntprintf(title, _countof(title), TranslateT("Save Avatar for %s"), displayName);
ofn.lpstrTitle = title;
}
else
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index ff105f96d1..04b88b5942 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -77,7 +77,7 @@ static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
TCHAR hash[128];
_tcsncpy_s(hash, (TCHAR*)lParam, _TRUNCATE);
- ConvertToFilename(hash, SIZEOF(hash));
+ ConvertToFilename(hash, _countof(hash));
return (INT_PTR)GetCachedAvatar((char*)wParam, hash);
}
@@ -172,12 +172,12 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
TCHAR hash[128];
_tcsncpy_s(hash, avatar->hash, _TRUNCATE);
- ConvertToFilename(hash, SIZEOF(hash));
+ ConvertToFilename(hash, _countof(hash));
TCHAR *file = GetCachedAvatar(proto, hash);
if (file != NULL) {
- mir_tstrncpy(history_filename, file, SIZEOF(history_filename));
+ mir_tstrncpy(history_filename, file, _countof(history_filename));
mir_free(file);
}
else {
@@ -186,7 +186,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
else
GetProtocolFolder(history_filename, proto);
- mir_sntprintf(history_filename, SIZEOF(history_filename),
+ mir_sntprintf(history_filename, _countof(history_filename),
_T("%s\\%s"), history_filename, hash);
if (CopyImageFile(avatar->filename, history_filename))
@@ -235,7 +235,7 @@ static int PreShutdown(WPARAM, LPARAM)
static int ModulesLoaded(WPARAM, LPARAM)
{
- mir_sntprintf(basedir, SIZEOF(basedir), _T("%s\\Avatars History"), profilePath);
+ mir_sntprintf(basedir, _countof(basedir), _T("%s\\Avatars History"), profilePath);
hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp
index 2db9d4b5a5..d20629af6f 100644
--- a/plugins/AvatarHistory/src/icolib.cpp
+++ b/plugins/AvatarHistory/src/icolib.cpp
@@ -40,7 +40,7 @@ int IcoLibIconsChanged(WPARAM, LPARAM)
void SetupIcoLib()
{
iconList[0].hIcolib = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
- Icon_Register(hInst, LPGEN("Avatar History"), iconList+1, SIZEOF(iconList)-1);
+ Icon_Register(hInst, LPGEN("Avatar History"), iconList+1, _countof(iconList)-1);
IcoLibUpdateMenus();
}
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp
index 1bf2536dae..5a30baeacf 100644
--- a/plugins/AvatarHistory/src/options.cpp
+++ b/plugins/AvatarHistory/src/options.cpp
@@ -50,7 +50,7 @@ static OptPageControl popupsControls[] = {
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- return SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
// Popup options dialog procedure /////////////////////////////////////////////////////////////////
@@ -100,7 +100,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history"));
// Needs to be called here in this case
- SaveOptsDlgProc(popupsControls, SIZEOF(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ SaveOptsDlgProc(popupsControls, _countof(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
PopupsEnableDisableCtrls(hwndDlg);
return TRUE;
@@ -139,7 +139,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
}
- return SaveOptsDlgProc(popupsControls, SIZEOF(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(popupsControls, _countof(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
// Functions //////////////////////////////////////////////////////////////////////////////////////
@@ -168,8 +168,8 @@ int OptInit(WPARAM wParam, LPARAM)
void LoadOptions()
{
- LoadOpts(optionsControls, SIZEOF(optionsControls), MODULE_NAME);
- LoadOpts(popupsControls, SIZEOF(popupsControls), MODULE_NAME);
+ LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME);
+ LoadOpts(popupsControls, _countof(popupsControls), MODULE_NAME);
opts.log_per_contact_folders = db_get_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);
opts.log_keep_same_folder = db_get_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp
index a43da24ef1..fc332ca8b7 100644
--- a/plugins/AvatarHistory/src/popup.cpp
+++ b/plugins/AvatarHistory/src/popup.cpp
@@ -105,13 +105,13 @@ void ShowPopupEx(MCONTACT hContact, const TCHAR *title, const TCHAR *description
((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon;
if (title != NULL)
- mir_tstrncpy(ppd.lptzContactName, title, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, title, _countof(ppd.lptzContactName));
else if (hContact != NULL)
mir_tstrncpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
- SIZEOF(ppd.lptzContactName));
+ _countof(ppd.lptzContactName));
if (description != NULL)
- mir_tstrncpy(ppd.lptzText, description, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzText, description, _countof(ppd.lptzText));
if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST)
{
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp
index 21ae8a38dc..88b00b3dfb 100644
--- a/plugins/AvatarHistory/src/utils.cpp
+++ b/plugins/AvatarHistory/src/utils.cpp
@@ -144,14 +144,14 @@ TCHAR* GetContactFolder(TCHAR *fn, MCONTACT hContact)
GetProtocolFolder(fn, proto);
TCHAR uin[MAX_PATH];
- GetUIDFromHContact(hContact, uin, SIZEOF(uin));
+ GetUIDFromHContact(hContact, uin, _countof(uin));
ConvertToFilename(uin, MAX_PATH); //added so that weather id's like "yw/CI0000" work
mir_sntprintf(fn, MAX_PATH, _T("%s\\%s"), fn, uin);
CreateDirectoryTreeT(fn);
#ifdef DBGPOPUPS
TCHAR log[1024];
- mir_sntprintf(log, SIZEOF(log), _T("Path: %s\nProto: %S\nUIN: %s"), fn, proto, uin);
+ mir_sntprintf(log, _countof(log), _T("Path: %s\nProto: %S\nUIN: %s"), fn, proto, uin);
ShowPopup(hContact, _T("AVH Debug: GetContactFolder"), log);
#endif
@@ -178,7 +178,7 @@ void CreateOldStyleShortcut(MCONTACT hContact, TCHAR *history_filename)
GetOldStyleAvatarName(shortcut, hContact);
- mir_sntprintf(shortcut, SIZEOF(shortcut), _T("%s.%s.lnk"), shortcut,
+ mir_sntprintf(shortcut, _countof(shortcut), _T("%s.%s.lnk"), shortcut,
GetExtension(history_filename));
if (!CreateShortcut(history_filename, shortcut))
@@ -208,7 +208,7 @@ TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
else
GetProtocolFolder(file, proto);
- mir_sntprintf(search, SIZEOF(search), _T("%s\\%s.*"), file, hash);
+ mir_sntprintf(search, _countof(search), _T("%s\\%s.*"), file, hash);
WIN32_FIND_DATA finddata;
HANDLE hFind = FindFirstFile(search, &finddata);
@@ -225,7 +225,7 @@ TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
|| !mir_tstrcmpi(&finddata.cFileName[len-4], _T(".jpg"))
|| !mir_tstrcmpi(&finddata.cFileName[len-5], _T(".jpeg"))))
{
- mir_sntprintf(file, SIZEOF(file), _T("%s\\%s"), file, finddata.cFileName);
+ mir_sntprintf(file, _countof(file), _T("%s\\%s"), file, finddata.cFileName);
ret = mir_tstrdup(file);
break;
}
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp
index d4c292b718..71c227194c 100644
--- a/plugins/BASS_interface/src/Main.cpp
+++ b/plugins/BASS_interface/src/Main.cpp
@@ -186,7 +186,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
else {
DBVARIANT dbv = { 0 }; BASS_DEVICEINFO info; DWORD bassver = BASS_GetVersion();
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("un4seen's bass version: %d.%d.%d.%d"), bassver >> 24, (bassver >> 16) & 0xff, (bassver >> 8) & 0xff, bassver & 0xff);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("un4seen's bass version: %d.%d.%d.%d"), bassver >> 24, (bassver >> 16) & 0xff, (bassver >> 8) & 0xff, bassver & 0xff);
SetDlgItemText(hwndDlg, IDC_BASSVERSION, tmp);
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_RESETCONTENT, 0, 0);
@@ -222,7 +222,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
if (hBass != NULL) {
SYSTEMTIME systime = { 0 };
- GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, _countof(tmp));
db_set_ts(NULL, ModuleName, OPT_OUTDEVICE, tmp);
Volume = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
@@ -558,7 +558,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
else {
DBVARIANT dbv;
if (db_get_ts(NULL, ModuleName, OPT_BASSPATH, &dbv)) {
- mir_tstrncpy(CurrBassPath, VARST(_T("Plugins\\Bass\\bass.dll")), SIZEOF(CurrBassPath));
+ mir_tstrncpy(CurrBassPath, VARST(_T("Plugins\\Bass\\bass.dll")), _countof(CurrBassPath));
db_set_ts(NULL, ModuleName, OPT_BASSPATH, CurrBassPath);
}
else {
@@ -614,7 +614,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
- Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, ModuleName, iconList, _countof(iconList));
return 0;
}
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp
index c3cd59d45b..1f103b66d0 100644
--- a/plugins/BasicHistory/src/BasicHistory.cpp
+++ b/plugins/BasicHistory/src/BasicHistory.cpp
@@ -186,7 +186,7 @@ void InitIcolib()
HICON LoadIconEx(int iconId, bool big)
{
- for (int i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < _countof(iconList); i++)
if ( iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
@@ -274,7 +274,7 @@ extern "C" int __declspec(dllexport) Load(void)
EventList::Init();
- Icon_Register(hInst, LPGEN("History"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("History"), iconList, _countof(iconList));
return 0;
}
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index 9bbd8ab243..947c2139d8 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -346,11 +346,11 @@ void EventList::InitNames()
TCHAR str[200];
if (hContact) {
_tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR ));
- mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"),contactName);
+ mir_sntprintf(str, _countof(str), TranslateT("History for %s"),contactName);
}
else {
_tcscpy_s(contactName, 256, TranslateT("System"));
- mir_sntprintf(str, SIZEOF(str), TranslateT("History"));
+ mir_sntprintf(str, _countof(str), TranslateT("History"));
}
if (isWnd)
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp
index a1049d87d7..e6fef029e1 100644
--- a/plugins/BasicHistory/src/ExportManager.cpp
+++ b/plugins/BasicHistory/src/ExportManager.cpp
@@ -41,9 +41,9 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open)
_tcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
- mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
+ mir_sntprintf(filter, _countof(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
size_t len = mir_tstrlen(filter) + 1;
- mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext);
+ mir_sntprintf(filter + len, _countof(filter) - len, _T("*.%s"), ext);
len += mir_tstrlen(filter + len);
filter[++len] = 0;
TCHAR stzFilePath[1024];
@@ -59,7 +59,7 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open)
ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = open ? TranslateT("Import") : TranslateT("Export");
- ofn.nMaxFile = SIZEOF(stzFilePath);
+ ofn.nMaxFile = _countof(stzFilePath);
ofn.lpstrDefExt = ext;
if (open) {
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 5fe89953f7..215aedd623 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -1180,7 +1180,7 @@ void HistoryWindow::Initialise()
{ 2, IDM_CONFIG, TBSTATE_ENABLED, BTNS_DROPDOWN, {0}, 0, (INT_PTR)TranslateT("Options")},
};
SendMessage(toolbarWindow, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
- SendMessage(toolbarWindow, TB_ADDBUTTONS, (WPARAM)SIZEOF(tbButtons), (LPARAM)&tbButtons);
+ SendMessage(toolbarWindow, TB_ADDBUTTONS, (WPARAM)_countof(tbButtons), (LPARAM)&tbButtons);
SendMessage(toolbarWindow, TB_SETBUTTONSIZE, 0, MAKELPARAM(16, 16));
SendMessage(toolbarWindow, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
SendMessage(toolbarWindow, TB_SETMAXTEXTROWS, 0, 0);
@@ -2061,7 +2061,7 @@ void HistoryWindow::Delete(int what)
return;
TCHAR message[256];
- mir_sntprintf(message, SIZEOF(message), TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
+ mir_sntprintf(message, _countof(message), TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return;
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 15656791ae..0e472145b7 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -223,11 +223,11 @@ static HotkeyOptionsList g_HotkeyOptionsList[] = {
{ "basichistory_hot_impdat", LPGENT("Import From Dat (mContacts)"), LPGENT("History"), 0, 0, HISTORY_HK_IMPDAT },
};
-const int g_fontsSize = SIZEOF(g_FontOptionsList);
+const int g_fontsSize = _countof(g_FontOptionsList);
-const int g_colorsSize = SIZEOF(g_ColorOptionsList);
+const int g_colorsSize = _countof(g_ColorOptionsList);
-const int g_hotkeysSize = SIZEOF(g_HotkeyOptionsList);
+const int g_hotkeysSize = _countof(g_HotkeyOptionsList);
void Options::Load(void)
{
@@ -247,7 +247,7 @@ void Options::Load(void)
fid.deffontsettings.colour = g_FontOptionsList[i].defColour;
fid.deffontsettings.style = g_FontOptionsList[i].defStyle;
fid.deffontsettings.charset = DEFAULT_CHARSET;
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "Font%d", i);
+ mir_snprintf(fid.prefix, _countof(fid.prefix), "Font%d", i);
_tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE);
_tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE);
fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags;
@@ -258,7 +258,7 @@ void Options::Load(void)
_tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE);
for (int i = 0; i < g_colorsSize; ++i) {
_tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, _TRUNCATE);
- mir_snprintf(cid.setting, SIZEOF(cid.setting), "Color%d", i);
+ mir_snprintf(cid.setting, _countof(cid.setting), "Color%d", i);
cid.order = i;
cid.defcolour = g_ColorOptionsList[i].def;
ColourRegisterT(&cid);
@@ -714,7 +714,7 @@ void InitTaskMenuItems();
void SetEventCB(HWND hwndCB, int eventId)
{
- int cpCount = SIZEOF(EventNames);
+ int cpCount = _countof(EventNames);
int selCpIdx = -1;
for (int i = 0; i < cpCount; ++i)
if (EventNames[i].id == eventId)
@@ -769,7 +769,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel)
ListBox_AddString(hwndLB, TranslateT("Outgoing events"));
for (std::vector<int>::const_iterator it = sel.events.begin(); it != sel.events.end(); ++it) {
- int cpCount = SIZEOF(EventNames);
+ int cpCount = _countof(EventNames);
int selCpIdx = -1;
for (int i = 0; i < cpCount; ++i)
if (EventNames[i].id == *it)
@@ -805,9 +805,9 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
TCHAR extUpper[32];
_tcscpy_s(extUpper, ext);
extUpper[0] = std::toupper(ext[0], loc);
- mir_sntprintf(filter, SIZEOF(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
+ mir_sntprintf(filter, _countof(filter), TranslateT("%s Files (*.%s)"), extUpper, ext);
size_t len = mir_tstrlen(filter) + 1;
- mir_sntprintf(filter + len, SIZEOF(filter) - len, _T("*.%s"), ext);
+ mir_sntprintf(filter + len, _countof(filter) - len, _T("*.%s"), ext);
len += mir_tstrlen(filter + len) + 1;
_tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)"));
len += mir_tstrlen(filter + len) + 1;
@@ -834,7 +834,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = title;
- ofn.nMaxFile = SIZEOF(stzFilePath);
+ ofn.nMaxFile = _countof(stzFilePath);
ofn.lpstrDefExt = ext;
if (open) {
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
@@ -871,7 +871,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
HWND ftpLog = GetDlgItem(hwndDlg, IDC_WINSCPLOG);
ComboBox_AddString(events, TranslateT("Incoming events"));
ComboBox_AddString(events, TranslateT("Outgoing events"));
- for (int i = 0 ; i < SIZEOF(EventNames); ++i)
+ for (int i = 0 ; i < _countof(EventNames); ++i)
ComboBox_AddString(events, TranslateTS(EventNames[i].name));
ComboBox_AddString(defFilter, TranslateT("Default history events"));
@@ -1702,7 +1702,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR sep = _T(':');
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0)
sep = timeFormat[0];
- mir_sntprintf(timeFormat, SIZEOF(timeFormat), _T("HH%cmm"), sep);
+ mir_sntprintf(timeFormat, _countof(timeFormat), _T("HH%cmm"), sep);
}
SYSTEMTIME st;
@@ -1749,7 +1749,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE);
if (!isOK) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1759,7 +1759,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.importType = (enum IImport::ImportType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_IMPORT_TYPE));
toCp.compress = Button_GetCheck(GetDlgItem(hwndDlg, IDC_COMPRESS)) != 0;
char bufC[100];
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, bufC, SIZEOF(bufC));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, bufC, _countof(bufC));
toCp.zipPassword = bufC;
HWND exportPath = GetDlgItem(hwndDlg, IDC_EXPORT_PATH);
int exLen = Edit_GetTextLength(exportPath);
@@ -1780,7 +1780,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!isOK) {
if (toCp.trigerType == TaskOptions::Monthly) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1790,7 +1790,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!isOK) {
if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) {
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
@@ -1807,9 +1807,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
if (err.empty())
_tcscpy_s(msg, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
break;
}
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index fa833a46c5..0875b05596 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -236,9 +236,9 @@ bool DoTask(TaskOptions& to)
if (err.empty())
_tcscpy_s(msg, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
DoError(to, msg);
return true;
@@ -395,7 +395,7 @@ bool DoTask(TaskOptions& to)
errorStr += L"\n";
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Incorrect file format: %s."), GetName(*it).c_str());
errorStr += msg;
}
else {
@@ -404,7 +404,7 @@ bool DoTask(TaskOptions& to)
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Unknown contact in file: %s."), GetName(*it).c_str());
errorStr += msg;
}
}
@@ -460,7 +460,7 @@ bool DoTask(TaskOptions& to)
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
errorStr += msg;
}
@@ -481,7 +481,7 @@ bool DoTask(TaskOptions& to)
errorStr += L"\n";
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str());
errorStr += msg;
break;
}
@@ -586,7 +586,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName,
TCHAR time[256];
SYSTEMTIME st;
GetLocalTime(&st);
- mir_sntprintf(time, SIZEOF(time), _T("%d-%02d-%02d %02d%02d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
+ mir_sntprintf(time, _countof(time), _T("%d-%02d-%02d %02d%02d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
std::wstring str1 = str.substr(0, pos);
str1 += time;
str1 += str.substr(pos + 6);
@@ -1124,7 +1124,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
CreateDirectory(GetDirectoryName(log).c_str(), NULL);
DeleteFile(log.c_str());
TCHAR cmdLine[MAX_PATH];
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
+ mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%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);
@@ -1213,7 +1213,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
CreateDirectory(GetDirectoryName(log).c_str(), NULL);
DeleteFile(log.c_str());
TCHAR cmdLine[MAX_PATH];
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
+ mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%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);
@@ -1243,7 +1243,7 @@ void CreatePath(const TCHAR *szDir)
DWORD dwAttributes;
TCHAR *pszLastBackslash, szTestDir[ MAX_PATH ];
- mir_tstrncpy( szTestDir, szDir, SIZEOF( szTestDir ));
+ mir_tstrncpy( szTestDir, szDir, _countof( szTestDir ));
if (( dwAttributes = GetFileAttributes( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
return;
@@ -1274,7 +1274,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM lParam)
void DoError(const TaskOptions& to, const std::wstring _error)
{
TCHAR msg[256];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
if (Options::instance->schedulerHistoryAlerts) {
std::wstring error = msg;
error += L"\n";
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp
index f8f46cdc39..13d7cfb645 100644
--- a/plugins/BasicHistory/src/Searcher.cpp
+++ b/plugins/BasicHistory/src/Searcher.cpp
@@ -102,7 +102,7 @@ void Searcher::Find()
return;
}
- GetWindowText(context->findWindow, str, SIZEOF(str));
+ GetWindowText(context->findWindow, str, _countof(str));
if (!str[0]) {
TCHAR buf[256];
mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
@@ -298,7 +298,7 @@ void Searcher::Find()
lastFindSelection = -1;
if (isStart) {
TCHAR buf[256];
- GetWindowText(context->findWindow, str, SIZEOF(str));
+ GetWindowText(context->findWindow, str, _countof(str));
mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 088fe3406c..0ab8b3476f 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -117,7 +117,7 @@ static bool LoadMind(const TCHAR* filename, int &line)
#ifdef DEBUG_LOAD_TIME
t = __rdtsc() - t;
char dest[101];
- mir_snprintf(dest, SIZEOF(dest), "%I64d ticks\n", t / 3200000);
+ mir_snprintf(dest, _countof(dest), "%I64d ticks\n", t / 3200000);
MessageBoxA(NULL, dest, NULL, 0);
//exit(0);
#endif
@@ -326,7 +326,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if (!bTranslated)
Config.AnswerThinkTime = 4;
TCHAR c[MAX_WARN_TEXT];
- bTranslated = GetDlgItemText(hwndDlg, IDC_WARNTXT, c, SIZEOF(c));
+ bTranslated = GetDlgItemText(hwndDlg, IDC_WARNTXT, c, _countof(c));
if (bTranslated)
Config.WarnText = c;
else
@@ -434,7 +434,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (!bTranslated)
{
TCHAR message[5000];
- mir_sntprintf(message, SIZEOF(message), TranslateTS(FAILED_TO_LOAD_BASE), line, c);
+ mir_sntprintf(message, _countof(message), TranslateTS(FAILED_TO_LOAD_BASE), line, c);
MessageBox(NULL, message, TranslateTS(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
break;
@@ -461,7 +461,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
Config.EngineUnderstandAlways = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_UNDERSTAND_ALWAYS) == BST_CHECKED ? TRUE : FALSE;
UpdateEngine();
TCHAR c[MAX_MIND_FILE];
- bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, SIZEOF(c));
+ bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, _countof(c));
if (bTranslated)
Config.MindFileName = c;
else
@@ -626,7 +626,7 @@ extern "C" int __declspec(dllexport) Load(void)
if (!blInit)
{
TCHAR path[2000];
- mir_sntprintf(path, SIZEOF(path), TranslateTS(FAILED_TO_LOAD_BASE), line, (const TCHAR*)Config.MindFileName);
+ mir_sntprintf(path, _countof(path), TranslateTS(FAILED_TO_LOAD_BASE), line, (const TCHAR*)Config.MindFileName);
MessageBox(NULL, path, TranslateTS(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
return 0;
@@ -646,7 +646,7 @@ extern "C" int __declspec(dllexport) Unload(void)
//So in case of saving error we will remain silent
#if 0
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), TranslateTS(FAILED_TO_SAVE_BASE), (const TCHAR*)Config.MindFileName);
+ mir_sntprintf(path, _countof(path), TranslateTS(FAILED_TO_SAVE_BASE), (const TCHAR*)Config.MindFileName);
TCHAR* err = TranslateTS(BOLTUN_ERROR);
MessageBox(NULL, path, err, MB_ICONERROR|MB_TASKMODAL|MB_OK);*/
#endif
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 61bafe3dc6..623685f7d6 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -118,7 +118,7 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
uid = LOWORD(wParam);
if (uid == IDOK){
char password[MAXPASSLEN + 1] = { 0 };
- int passlen = GetDlgItemTextA(hDlg, IDC_EDIT1, password, SIZEOF(password));
+ int passlen = GetDlgItemTextA(hDlg, IDC_EDIT1, password, _countof(password));
if (passlen == 0) {
SetDlgItemText(hDlg, IDC_HEADERBAR, TranslateT("Miranda NG is locked.\nEnter password to unlock it."));
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_NCPAINT, 0, 0);
@@ -491,7 +491,7 @@ static TCHAR *HokeyVkToName(WORD vkKey)
code |= (1UL << 24);
}
- GetKeyNameText(code, buf, SIZEOF(buf));
+ GetKeyNameText(code, buf, _countof(buf));
return buf;
}
@@ -713,7 +713,7 @@ extern "C" int __declspec(dllexport) Load(void)
db_set_b(NULL, "Popup", "ModuleIsEnabled", 0);
}
- Icon_Register(g_hInstance, "BossKey", iconList, SIZEOF(iconList));
+ Icon_Register(g_hInstance, "BossKey", iconList, _countof(iconList));
g_hHideService = CreateServiceFunction(MS_BOSSKEY_HIDE, BossKeyHideMiranda); // Create service
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp
index 74e44af6b3..fc37629d20 100644
--- a/plugins/BossKeyPlus/src/Options.cpp
+++ b/plugins/BossKeyPlus/src/Options.cpp
@@ -80,7 +80,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
// status msg, if needed
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_MAINOPT_STATMSG))) { // meaning we should save it
TCHAR tszMsg[1025];
- GetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, tszMsg, SIZEOF(tszMsg));
+ GetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, tszMsg, _countof(tszMsg));
if (tszMsg[0] != 0)
db_set_ts(NULL, MOD_NAME, "statmsg", tszMsg);
else // delete current setting
@@ -92,7 +92,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
// checkbox
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_REQPASS) == BST_CHECKED) {
char szPass[MAXPASSLEN + 1];
- GetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, szPass, SIZEOF(szPass));
+ GetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, szPass, _countof(szPass));
if (szPass[0] != 0){
db_set_s(NULL, MOD_NAME, "password", szPass);
wMask |= OPT_REQPASS;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
BossKeyMenuItemUnInit();
TCHAR szMinutes[4] = { 0 };
- GetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes, SIZEOF(szMinutes));
+ GetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes, _countof(szMinutes));
minutes = _ttoi(szMinutes);
if (minutes < 1) minutes = 1;
db_set_b(NULL, MOD_NAME, "time", minutes);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 4a492abff8..9a94559966 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -230,11 +230,11 @@ bool isContactGoneFor(MCONTACT hContact, int days)
ppd.lchContact = hContact;
ppd.lchIcon = IcoLib_GetIcon("enabled_icon");
- mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), TranslateT("Hiding %s (%S)"),
+ mir_sntprintf(ppd.lptzContactName, _countof(ppd.lptzContactName), TranslateT("Hiding %s (%S)"),
CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
GetContactProto(hContact));
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d days since last message"), daysSinceMessage);
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), TranslateT("%d days since last message"), daysSinceMessage);
if (!options.iUsePopupColors) {
ppd.colorBack = options.iPopupColorBack;
@@ -288,7 +288,7 @@ void ReturnNotify(MCONTACT hContact, TCHAR *message)
TCHAR* nick = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
TCHAR tmpMsg[512];
- mir_sntprintf(tmpMsg, SIZEOF(tmpMsg), _T("%s %s"), nick, message);
+ mir_sntprintf(tmpMsg, _countof(tmpMsg), _T("%s %s"), nick, message);
cle.ptszTooltip = tmpMsg;
CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
@@ -326,7 +326,7 @@ void GoneNotify(MCONTACT hContact, TCHAR *message)
TCHAR* nick = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
TCHAR tmpMsg[512];
- mir_sntprintf(tmpMsg, SIZEOF(tmpMsg), _T("%s %s"), nick, message);
+ mir_sntprintf(tmpMsg, _countof(tmpMsg), _T("%s %s"), nick, message);
cle.ptszTooltip = tmpMsg;
cle.flags = CLEF_TCHAR;
@@ -694,7 +694,7 @@ extern "C" int __declspec(dllexport) Load(void)
db_set_dw(hContact, MODULE_NAME, "CreationTime", current_time);
}
- Icon_Register(hInst, "BuddyExpectator", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "BuddyExpectator", iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp
index 6eed6cc9a9..27337be821 100644
--- a/plugins/BuddyExpectator/src/options.cpp
+++ b/plugins/BuddyExpectator/src/options.cpp
@@ -327,7 +327,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP
ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME);
TCHAR szPreviewText[250];
- mir_sntprintf(szPreviewText, SIZEOF(szPreviewText), TranslateT("has returned after being absent since %d days"), rand() % 30);
+ mir_sntprintf(szPreviewText, _countof(szPreviewText), TranslateT("has returned after being absent since %d days"), rand() % 30);
_tcsncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE);
// Get current popups colors options
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp
index cf75e3e48d..c3d7725e15 100644
--- a/plugins/BuddyPounce/src/dialog.cpp
+++ b/plugins/BuddyPounce/src/dialog.cpp
@@ -16,7 +16,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB)
char *szProto = GetContactProto(hContact);
if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) {
TCHAR name[300];
- mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), _A2T(szProto));
+ mir_sntprintf(name, _countof(name), _T("%s (%s)"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), _A2T(szProto));
int index = SendMessage(hwnd2CB, CB_ADDSTRING, 0, (LPARAM)name);
SendMessage(hwnd2CB, CB_SETITEMDATA, index, hContact);
if (BPhContact == hContact)
@@ -37,18 +37,18 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd)
case 6: // nothing to do...
break;
case 3: // Reuse Pounce
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
case 4: // Give Up delay
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
{
db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
}
break;
case 5: // confirm window
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number));
break;
}
@@ -89,7 +89,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case IDCANCEL:
windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
TCHAR type[32];
- GetDlgItemText(hwnd, IDC_CHECK1, type, SIZEOF(type));
+ GetDlgItemText(hwnd, IDC_CHECK1, type, _countof(type));
WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
|(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
@@ -202,7 +202,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP
getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
return FALSE;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP
int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -262,7 +262,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
@@ -278,7 +278,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
break;
@@ -322,7 +322,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
{
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
@@ -396,7 +396,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendDlgItemMessage(hwnd, IDC_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)1024, (short)0));
@@ -441,7 +441,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
int length;
TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, _countof(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -532,7 +532,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_TIMER:
{
TCHAR message[1024];
- mir_sntprintf(message, SIZEOF(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
+ mir_sntprintf(message, _countof(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
SetDlgItemText(hwnd, LBL_CONTACT, message);
}
spdps->timer--;
@@ -589,9 +589,9 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case IDOK:
{
TCHAR text[2048];
- GetDlgItemText(hwnd, IDOK, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDOK, text, _countof(text));
if (!mir_tstrcmp(text, TranslateT("Retry"))) {
- GetDlgItemText(hwnd, IDC_MESSAGE, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text));
SendPounce(text, hContact);
}
}
@@ -609,12 +609,12 @@ void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess)
HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, hContact);
TCHAR msg[256];
if (SentSuccess) {
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message successfully sent to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Message successfully sent to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
SetDlgItemText(hwnd, IDOK, TranslateT("OK"));
ShowWindow(GetDlgItem(hwnd, IDCANCEL), 0);
}
else {
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(msg, _countof(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
SetDlgItemText(hwnd, IDOK, TranslateT("Retry"));
}
SetDlgItemText(hwnd, LBL_CONTACT, msg);
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp
index 6d788ebe4c..cf16902329 100644
--- a/plugins/CSList/src/cslist.cpp
+++ b/plugins/CSList/src/cslist.cpp
@@ -133,9 +133,9 @@ extern "C" __declspec(dllexport) int Load()
sid.cx = sid.cy = 16;
sid.section.t = _T(MODULENAME);
- for (int i = 0; i < SIZEOF(forms); i++) {
+ for (int i = 0; i < _countof(forms); i++) {
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODNAME, forms[i].pszIconIcoLib);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODNAME, forms[i].pszIconIcoLib);
sid.pszName = szSettingName;
sid.description.t = forms[i].ptszDescr;
@@ -261,14 +261,14 @@ void importCustomStatuses(CSWindow* csw, int result)
StatusItem* si = new StatusItem();
si->m_iIcon = i - 1;
- mir_snprintf(bufTitle, SIZEOF(bufTitle), "XStatus%dName", i);
+ mir_snprintf(bufTitle, _countof(bufTitle), "XStatus%dName", i);
if (!db_get_ts(NULL, protoName, bufTitle, &dbv)) {
mir_tstrcpy(si->m_tszTitle, dbv.ptszVal);
db_free(&dbv);
}
else si->m_tszTitle[0] = 0;
- mir_snprintf(bufMessage, SIZEOF(bufMessage), "XStatus%dMsg", i);
+ mir_snprintf(bufMessage, _countof(bufMessage), "XStatus%dMsg", i);
if (!db_get_ts(NULL, protoName, bufMessage, &dbv)) {
mir_tstrcpy(si->m_tszMessage, dbv.ptszVal);
db_free(&dbv);
@@ -361,7 +361,7 @@ void CSWindow::deinitIcons()
void CSWindow::initButtons()
{
- for (int i = 0; i < SIZEOF(forms); i++) {
+ for (int i = 0; i < _countof(forms); i++) {
if (forms[i].idc < 0)
continue;
@@ -390,7 +390,7 @@ void CSWindow::toggleEmptyListMessage()
BOOL CSWindow::itemPassedFilter(ListItem< StatusItem >* li)
{
TCHAR filter[MAX_PATH];
- GetDlgItemText(m_handle, IDC_FILTER_FIELD, filter, SIZEOF(filter));
+ GetDlgItemText(m_handle, IDC_FILTER_FIELD, filter, _countof(filter));
if (mir_tstrlen(filter))
{
@@ -417,7 +417,7 @@ void CSWindow::toggleFilter()
else
{
TCHAR filterText[255];
- GetDlgItemText(m_handle, IDC_FILTER_FIELD, filterText, SIZEOF(filterText));
+ GetDlgItemText(m_handle, IDC_FILTER_FIELD, filterText, _countof(filterText));
if (filterText[0] != 0)
SetDlgItemText(m_handle, IDC_FILTER_FIELD, TEXT(""));
}
@@ -539,7 +539,7 @@ void CSAMWindow::checkFieldLimit(WORD action, WORD item)
EDITBALLOONTIP ebt = { 0 };
ebt.cbStruct = sizeof(ebt);
ebt.pszTitle = TranslateT("Warning");
- mir_sntprintf(tszPopupTip, SIZEOF(tszPopupTip), TranslateT("This field doesn't accept string longer than %d characters. The string will be truncated."), limit);
+ mir_sntprintf(tszPopupTip, _countof(tszPopupTip), TranslateT("This field doesn't accept string longer than %d characters. The string will be truncated."), limit);
ebt.pszText = tszPopupTip;
ebt.ttiIcon = TTI_WARNING;
SendDlgItemMessage(m_handle, item, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt);
@@ -565,7 +565,7 @@ void CSAMWindow::checkItemValidity()
TCHAR tszInputMessage[EXTRASTATUS_MESSAGE_LIMIT];
- GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, SIZEOF(tszInputMessage));
+ GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, _countof(tszInputMessage));
PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName);
if (pdescr == NULL)
@@ -579,7 +579,7 @@ void CSAMWindow::checkItemValidity()
cs.ptszName = tszTitle;
cs.wParam = &i;
if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
- mir_tstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), SIZEOF(m_item->m_tszTitle));
+ mir_tstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), _countof(m_item->m_tszTitle));
if (mir_tstrcmp(m_item->m_tszMessage, tszInputMessage))
mir_tstrcpy(m_item->m_tszMessage, tszInputMessage), m_bChanged = true;
@@ -738,30 +738,30 @@ int CSItemsList::compareItems(const StatusItem* p1, const StatusItem* p2)
void CSItemsList::loadItems(char *protoName)
{
char dbSetting[32];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_ItemsCount", protoName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_ItemsCount", protoName);
unsigned int itemsCount = getWord(dbSetting, DEFAULT_ITEMS_COUNT);
for (unsigned int i = 1; i <= itemsCount; i++) {
StatusItem* item = new StatusItem();
DBVARIANT dbv;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dIcon", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dIcon", protoName, i);
item->m_iIcon = getByte(dbSetting, DEFAULT_ITEM_ICON);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dTitle", protoName, i);
if (!getTString(dbSetting, &dbv)) {
mir_tstrcpy(item->m_tszTitle, dbv.ptszVal);
db_free(&dbv);
}
else item->m_tszTitle[0] = 0;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dMessage", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dMessage", protoName, i);
if (!getTString(dbSetting, &dbv)) {
mir_tstrcpy(item->m_tszMessage, dbv.ptszVal);
db_free(&dbv);
}
else item->m_tszMessage[0] = 0;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dFavourite", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dFavourite", protoName, i);
item->m_bFavourite = (BOOL)getByte(dbSetting, DEFAULT_ITEM_IS_FAVOURITE);
m_list->add(item);
@@ -773,34 +773,34 @@ void CSItemsList::saveItems(char *protoName)
{
unsigned int i;
char dbSetting[32];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_ItemsCount", protoName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_ItemsCount", protoName);
unsigned int oldItemsCount = getWord(dbSetting, DEFAULT_ITEMS_COUNT);
for (i = 1; i <= m_list->getCount(); i++)
{
StatusItem* item = m_list->get(i - 1);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dIcon", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dIcon", protoName, i);
setByte(dbSetting, item->m_iIcon);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dTitle", protoName, i);
setTString(dbSetting, item->m_tszTitle);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dMessage", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dMessage", protoName, i);
setTString(dbSetting, item->m_tszMessage);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dFavourite", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dFavourite", protoName, i);
setByte(dbSetting, item->m_bFavourite);
}
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_ItemsCount", protoName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_ItemsCount", protoName);
setWord(dbSetting, m_list->getCount());
for (; i <= oldItemsCount; i++)
{
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dIcon", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dIcon", protoName, i);
deleteSetting(dbSetting);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dTitle", protoName, i);
deleteSetting(dbSetting);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dMessage", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dMessage", protoName, i);
deleteSetting(dbSetting);
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dFavourite", protoName, i);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_Item%dFavourite", protoName, i);
deleteSetting(dbSetting);
}
}
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp
index 4f7c7d452a..d97174c591 100644
--- a/plugins/ChangeKeyboardLayout/src/main.cpp
+++ b/plugins/ChangeKeyboardLayout/src/main.cpp
@@ -61,7 +61,7 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
// IcoLib support
- Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, ModuleName, iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp
index e85a8c0631..f54710afd9 100644
--- a/plugins/Clist_blind/src/clcopts.cpp
+++ b/plugins/Clist_blind/src/clcopts.cpp
@@ -133,7 +133,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
{
int i;
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (i = 0; i < _countof(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id,
(exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED);
@@ -141,7 +141,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
{
UDACCEL accel[2] = { {0, 10} , {2, 50} };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM) & accel);
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM) & accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
@@ -156,9 +156,9 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues),
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues),
db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues),
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues),
db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
int i;
DWORD exStyle = 0;
- for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (i = 0; i < _countof(checkBoxToStyleEx); i++)
if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
@@ -235,13 +235,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
(BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
- GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateContact", tmp);
- GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateGroup", tmp);
- GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateDivider", tmp);
- GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateInfo", tmp);
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp
index 2289203589..d6eb06480b 100644
--- a/plugins/Clist_blind/src/clcpaint.cpp
+++ b/plugins/Clist_blind/src/clcpaint.cpp
@@ -503,7 +503,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
pts[6].y = pts[5].y;
pts[7].x = pts[0].x;
pts[7].y = pts[4].y;
- hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
FillRgn(hdcMem, hRgn, hBrush);
DeleteObject(hBrush);
@@ -532,7 +532,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
int greyGreen = GetGValue(greyColour) * 2;
int greyBlue = GetBValue(greyColour) * 2;
if (divide3[0] == 255) {
- for (int i = 0; i < SIZEOF(divide3); i++)
+ for (int i = 0; i < _countof(divide3); i++)
divide3[i] = (i + 1) / 3;
}
for (int i = 4 * clRect.right * clRect.bottom - 4; i >= 0; i -= 4) {
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp
index 42d4e19b2e..043b197b84 100644
--- a/plugins/Clist_blind/src/cluiopts.cpp
+++ b/plugins/Clist_blind/src/cluiopts.cpp
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
TCHAR title[256];
- GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
+ GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
db_set_ts(NULL, "CList", "TitleText", title);
SetWindowText(pcli->hwndContactList, title);
}
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp
index bf67a5b3d8..15cb50d671 100644
--- a/plugins/Clist_blind/src/init.cpp
+++ b/plugins/Clist_blind/src/init.cpp
@@ -428,13 +428,13 @@ TCHAR *GetStatusName(struct ClcContact *item)
return status_name;
// Get XStatusName
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, SIZEOF(status_name), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL);
if (status_name[0] != _T('\0'))
return status_name;
// Get status name
status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
- mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), SIZEOF(status_name));
+ mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), _countof(status_name));
return status_name;
}
@@ -448,12 +448,12 @@ TCHAR *GetStatusMessage(struct ClcContact *item)
return status_message;
// Get XStatusMsg
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, SIZEOF(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL);
if (status_message[0] != _T('\0'))
return status_message;
// Get status message
- MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, SIZEOF(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), NULL);
return status_message;
}
@@ -470,7 +470,7 @@ TCHAR *GetProtoName(struct ClcContact *item)
proto_name[0] = '\0';
if (item->hContact == NULL || item->proto == NULL)
{
- mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), SIZEOF(proto_name));
+ mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
@@ -480,14 +480,14 @@ TCHAR *GetProtoName(struct ClcContact *item)
{
#ifdef UNICODE
CallProtoService(item->proto, PS_GETNAME, sizeof(description),(LPARAM) description);
- mir_sntprintf(proto_name, SIZEOF(proto_name), L"%S", description);
+ mir_sntprintf(proto_name, _countof(proto_name), L"%S", description);
#else
CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name),(LPARAM) proto_name);
#endif
return proto_name;
}
- mir_tstrncpy(proto_name, acc->tszAccountName, SIZEOF(proto_name));
+ mir_tstrncpy(proto_name, acc->tszAccountName, _countof(proto_name));
return proto_name;
}
@@ -528,7 +528,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
group = &dat->list;
group->scanIndex = 0;
text = tmp;
- size = SIZEOF(tmp);
+ size = _countof(tmp);
while(1)
{
if (group->scanIndex == group->cl.count)
@@ -562,11 +562,11 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
TCHAR *txt;
if (szCounts[0] != '\0')
- mir_sntprintf(count, SIZEOF(count), _T("%s "), szCounts);
+ mir_sntprintf(count, _countof(count), _T("%s "), szCounts);
else
count[0] = _T('\0');
- txt = ParseText(template_group, t, SIZEOF(t), v, SIZEOF(v));
+ txt = ParseText(template_group, t, _countof(t), v, _countof(v));
if (txt != NULL)
mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
@@ -587,7 +587,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
GetStatusMessage(item)
};
- TCHAR *txt = ParseText(template_contact, t, SIZEOF(t), v, SIZEOF(v));
+ TCHAR *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
if (txt != NULL)
mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index b31d4e4a6c..6d854811f8 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -670,7 +670,7 @@ static int LocateStorePosition(int Frameid, int maxstored)
char settingname[255];
for (int i = 0; i < maxstored; i++) {
- mir_snprintf(settingname, SIZEOF(settingname), "Name%d", i);
+ mir_snprintf(settingname, _countof(settingname), "Name%d", i);
DBVARIANT dbv = { 0 };
if (db_get_ts(NULL, CLUIFrameModule, settingname, &dbv))
continue;
@@ -2902,7 +2902,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
int oldflags;
- mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ mir_snprintf(TBcapt, _countof(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
g_pfwFrames[pos].szName, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating,
g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y,
g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y,
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index f5128356ef..40dab74c2f 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -518,20 +518,20 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact)
if (dat->first_line_append_nick && (!dat->force_in_dialog)) {
DBVARIANT dbv = { 0 };
if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
- TCHAR nick[SIZEOF(contact->szText)];
- mir_tstrncpy(nick, dbv.ptszVal, SIZEOF(contact->szText));
+ TCHAR nick[_countof(contact->szText)];
+ mir_tstrncpy(nick, dbv.ptszVal, _countof(contact->szText));
db_free(&dbv);
// They are the same -> use the name to keep the case
if (mir_tstrcmpi(name, nick) == 0)
- mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, name, _countof(contact->szText));
else
// Append then
- mir_sntprintf(contact->szText, SIZEOF(contact->szText), _T("%s - %s"), name, nick);
+ mir_sntprintf(contact->szText, _countof(contact->szText), _T("%s - %s"), name, nick);
}
- else mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText));
+ else mir_tstrncpy(contact->szText, name, _countof(contact->szText));
}
- else mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText));
+ else mir_tstrncpy(contact->szText, name, _countof(contact->szText));
if (!dat->force_in_dialog) {
SHORTDATA data = { 0 };
@@ -550,11 +550,11 @@ void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce)
int type = TEXT_EMPTY;
if (dat->second_line_show)
- type = Cache_GetLineText(pdnce, dat->second_line_type, Text, SIZEOF(Text), dat->second_line_text,
+ type = Cache_GetLineText(pdnce, dat->second_line_type, Text, _countof(Text), dat->second_line_text,
dat->second_line_xstatus_has_priority, dat->second_line_show_status_if_no_away, dat->second_line_show_listening_if_no_away,
dat->second_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different);
- Text[SIZEOF(Text) - 1] = 0; //to be sure that it is null terminated string
+ Text[_countof(Text) - 1] = 0; //to be sure that it is null terminated string
replaceStrT(pdnce->szSecondLineText, (dat->second_line_show) ? Text : NULL);
@@ -574,11 +574,11 @@ void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce)
TCHAR Text[240 - EXTRA_ICON_COUNT] = { 0 };
int type = TEXT_EMPTY;
if (dat->third_line_show)
- type = Cache_GetLineText(pdnce, dat->third_line_type, Text, SIZEOF(Text), dat->third_line_text,
+ type = Cache_GetLineText(pdnce, dat->third_line_type, Text, _countof(Text), dat->third_line_text,
dat->third_line_xstatus_has_priority, dat->third_line_show_status_if_no_away, dat->third_line_show_listening_if_no_away,
dat->third_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different);
- Text[SIZEOF(Text) - 1] = 0; //to be sure that it is null terminated string
+ Text[_countof(Text) - 1] = 0; //to be sure that it is null terminated string
replaceStrT(pdnce->szThirdLineText, (dat->third_line_show) ? Text : NULL);
if (pdnce->szThirdLineText) {
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index d5e740ecac..3618cf2d9b 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -62,7 +62,7 @@ static int clcExitDragToScroll();
int ReloadSkinFolder(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hSkinFolder, SkinsFolder, SIZEOF(SkinsFolder), _T(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathT(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _T(DEFAULT_SKIN_FOLDER));
return 0;
}
@@ -83,16 +83,16 @@ static int clcHookIconsChanged(WPARAM, LPARAM)
{
int i;
if (MirandaExiting()) return 0;
- for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) {
+ for (i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
g_pAvatarOverlayIcons[i].listID = -1;
g_pStatusOverlayIcons[i].listID = -1;
}
if (hAvatarOverlays)
ImageList_Destroy(hAvatarOverlays);
- hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, SIZEOF(g_pAvatarOverlayIcons) * 2, 1);
+ hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, _countof(g_pAvatarOverlayIcons) * 2, 1);
- for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) {
+ for (i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
HICON hIcon = IcoLib_GetIcon(g_pAvatarOverlayIcons[i].name);
g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
IcoLib_Release(g_pAvatarOverlayIcons[i].name);
@@ -1145,7 +1145,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (mir_strcmp(contSour->proto, META_PROTO)) {
if (!contSour->isSubcontact) {
MCONTACT hDest = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
MCONTACT handle = CallService(MS_MC_CONVERTTOMETA, hDest, 0);
@@ -1158,7 +1158,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
else {
hcontact = contSour->hContact;
MCONTACT hdest = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hdest, 0);
@@ -1184,7 +1184,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (!contSour->isSubcontact) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Adding contact to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1194,7 +1194,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
}
else if (contSour->subcontacts == contDest) {
MCONTACT hsour = contSour->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1)
db_mc_setDefault(contDest->hContact, hsour, true);
@@ -1202,7 +1202,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
else {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1226,7 +1226,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (!contSour->isSubcontact) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1238,7 +1238,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
else if (contSour->subcontacts != contDest->subcontacts) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
+ mir_sntprintf(Wording, _countof(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
if (res == 1) {
if (!handle)
@@ -1276,9 +1276,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (shortGroup) {
NeedRename = TRUE;
if (sourceGrName)
- mir_sntprintf(newName, SIZEOF(newName), _T("%s\\%s"), sourceGrName, shortGroup);
+ mir_sntprintf(newName, _countof(newName), _T("%s\\%s"), sourceGrName, shortGroup);
else
- mir_tstrncpy(newName, shortGroup, SIZEOF(newName));
+ mir_tstrncpy(newName, shortGroup, _countof(newName));
}
mir_free(groupName);
mir_free(sourceGrName);
@@ -1507,7 +1507,7 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP
return ret;
if (contact) {
- mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
Cache_GetText(dat, contact, 1);
cliRecalcScrollBar(hwnd, dat);
}
@@ -1631,11 +1631,11 @@ static int clcHookModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);
hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER));
- FoldersGetCustomPathT(hSkinFolder, SkinsFolder, SIZEOF(SkinsFolder), _T(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathT(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _T(DEFAULT_SKIN_FOLDER));
// Get icons
TCHAR szMyPath[MAX_PATH];
- GetModuleFileName(g_hInst, szMyPath, SIZEOF(szMyPath));
+ GetModuleFileName(g_hInst, szMyPath, _countof(szMyPath));
SKINICONDESC sid = { 0 };
sid.cx = sid.cy = 16;
@@ -1649,7 +1649,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM)
IcoLib_AddIcon(&sid);
sid.section.a = LPGEN("Contact list") "/" LPGEN("Avatar overlay");
- for (int i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) {
+ for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
sid.description.a = g_pAvatarOverlayIcons[i].description;
sid.pszName = g_pAvatarOverlayIcons[i].name;
sid.iDefaultIndex = -g_pAvatarOverlayIcons[i].id;
@@ -1657,7 +1657,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM)
}
sid.section.a = LPGEN("Contact list") "/" LPGEN("Status overlay");
- for (int i = 0; i < SIZEOF(g_pStatusOverlayIcons); i++) {
+ for (int i = 0; i < _countof(g_pStatusOverlayIcons); i++) {
sid.description.a = g_pStatusOverlayIcons[i].description;
sid.pszName = g_pStatusOverlayIcons[i].name;
sid.iDefaultIndex = -g_pStatusOverlayIcons[i].id;
@@ -1781,7 +1781,7 @@ int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData)
pShortData->second_line_draw_smileys = pData->second_line_draw_smileys;
pShortData->second_line_type = pData->second_line_type;
- mir_tstrncpy(pShortData->second_line_text, pData->second_line_text, SIZEOF(pShortData->second_line_text));
+ mir_tstrncpy(pShortData->second_line_text, pData->second_line_text, _countof(pShortData->second_line_text));
pShortData->second_line_xstatus_has_priority = pData->second_line_xstatus_has_priority;
pShortData->second_line_show_status_if_no_away = pData->second_line_show_status_if_no_away;
@@ -1793,7 +1793,7 @@ int ClcGetShortData(ClcData* pData, SHORTDATA *pShortData)
pShortData->third_line_draw_smileys = pData->third_line_draw_smileys;
pShortData->third_line_type = pData->third_line_type;
- mir_tstrncpy(pShortData->third_line_text, pData->third_line_text, SIZEOF(pShortData->third_line_text));
+ mir_tstrncpy(pShortData->third_line_text, pData->third_line_text, _countof(pShortData->third_line_text));
pShortData->third_line_xstatus_has_priority = pData->third_line_xstatus_has_priority;
pShortData->third_line_show_status_if_no_away = pData->third_line_show_status_if_no_away;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index eb3442289b..4ebc0806bd 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -248,7 +248,7 @@ void* AddTempGroup(HWND hwnd, ClcData *dat, const TCHAR *szName)
_itoa_s(i - 1, buf, 10);
TCHAR b2[255];
- mir_sntprintf(b2, SIZEOF(b2), _T("#%s"), szName);
+ mir_sntprintf(b2, _countof(b2), _T("#%s"), szName);
b2[0] = 1 | GROUPF_EXPANDED;
db_set_ws(NULL, "CListGroups", buf, b2);
pcli->pfnGetGroupName(i, &groupFlags);
@@ -717,7 +717,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
}
if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
if (!db_get_ts(hContact, "CList", "Group", &dbv)) {
- mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[0]);
+ mir_sntprintf(szGroupMask, _countof(szGroupMask), _T("%s|"), &dbv.ptszVal[0]);
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
mir_free(dbv.ptszVal);
}
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp
index aaf414c3ad..6c2a3b15f6 100644
--- a/plugins/Clist_modern/src/modern_clcopts.cpp
+++ b/plugins/Clist_modern/src/modern_clcopts.cpp
@@ -135,33 +135,33 @@ void RegisterCLUIFonts(void)
int index = 0;
fontid.cbSize = sizeof(fontid);
- mir_strncpy(fontid.dbSettingsGroup, "CLC", SIZEOF(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, "CLC", _countof(fontid.dbSettingsGroup));
effectid.cbSize = sizeof(effectid);
- mir_strncpy(effectid.dbSettingsGroup, "CLC", SIZEOF(effectid.dbSettingsGroup));
+ mir_strncpy(effectid.dbSettingsGroup, "CLC", _countof(effectid.dbSettingsGroup));
- for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
+ for (int i = 0; i < _countof(fontOptionsList); i++, index++) {
fontid.flags = FIDF_DEFAULTVALID | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_ALLOWREREGISTER | FIDF_NOAS;
fontid.flags |= fontOptionsList[i].dwFlags;
- mir_tstrncpy(fontid.group, fontOptionsList[i].szGroup, SIZEOF(fontid.group));
- mir_tstrncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
+ mir_tstrncpy(fontid.group, fontOptionsList[i].szGroup, _countof(fontid.group));
+ mir_tstrncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name));
mir_snprintf(idstr, "Font%d", fontOptionsList[i].fontID);
- mir_strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, idstr, _countof(fontid.prefix));
fontid.order = i + 1;
fontid.deffontsettings.charset = fontOptionsList[i].defCharset;
fontid.deffontsettings.colour = fontOptionsList[i].defColour;
fontid.deffontsettings.size = fontOptionsList[i].defSize;
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
- mir_tstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace));
+ mir_tstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace));
FontRegisterT(&fontid);
- mir_tstrncpy(effectid.group, fontOptionsList[i].szGroup, SIZEOF(effectid.group));
- mir_tstrncpy(effectid.name, fontOptionsList[i].szDescr, SIZEOF(effectid.name));
+ mir_tstrncpy(effectid.group, fontOptionsList[i].szGroup, _countof(effectid.group));
+ mir_tstrncpy(effectid.name, fontOptionsList[i].szDescr, _countof(effectid.name));
mir_snprintf(idstr, "Font%d", fontOptionsList[i].fontID);
- mir_strncpy(effectid.setting, idstr, SIZEOF(effectid.setting));
+ mir_strncpy(effectid.setting, idstr, _countof(effectid.setting));
effectid.order = i + 1;
effectid.defeffect.effectIndex = fontOptionsList[i].defeffect.effectIndex;
@@ -174,11 +174,11 @@ void RegisterCLUIFonts(void)
ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(colourid);
- for (int i = 0; i < SIZEOF(colourOptionsList); i++) {
- mir_tstrncpy(colourid.group, colourOptionsList[i].szGroup, SIZEOF(colourid.group));
- mir_tstrncpy(colourid.name, colourOptionsList[i].szDescr, SIZEOF(colourid.group));
- mir_strncpy(colourid.setting, colourOptionsList[i].chName, SIZEOF(colourid.setting));
- mir_strncpy(colourid.dbSettingsGroup, colourOptionsList[i].chGroup, SIZEOF(colourid.dbSettingsGroup));
+ for (int i = 0; i < _countof(colourOptionsList); i++) {
+ mir_tstrncpy(colourid.group, colourOptionsList[i].szGroup, _countof(colourid.group));
+ mir_tstrncpy(colourid.name, colourOptionsList[i].szDescr, _countof(colourid.group));
+ mir_strncpy(colourid.setting, colourOptionsList[i].chName, _countof(colourid.setting));
+ mir_strncpy(colourid.dbSettingsGroup, colourOptionsList[i].chGroup, _countof(colourid.dbSettingsGroup));
colourid.defcolour = colourOptionsList[i].defColour;
colourid.order = i + 1;
ColourRegisterT(&colourid);
@@ -202,17 +202,17 @@ void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF
char idstr[32];
int index;
- for (index = 0; index < SIZEOF(fontOptionsList); index++)
+ for (index = 0; index < _countof(fontOptionsList); index++)
if (fontOptionsList[index].fontID == i)
break;
- if (index == SIZEOF(fontOptionsList))
+ if (index == _countof(fontOptionsList))
return;
FontIDT fontid = { 0 };
fontid.cbSize = sizeof(fontid);
- mir_tstrncpy(fontid.group, fontOptionsList[index].szGroup, SIZEOF(fontid.group));
- mir_tstrncpy(fontid.name, fontOptionsList[index].szDescr, SIZEOF(fontid.name));
+ mir_tstrncpy(fontid.group, fontOptionsList[index].szGroup, _countof(fontid.group));
+ mir_tstrncpy(fontid.name, fontOptionsList[index].szDescr, _countof(fontid.name));
COLORREF col = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)lf);
@@ -389,12 +389,12 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", GetDefaultExStyle());
- for (int i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle&checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].neg) ? BST_CHECKED : BST_UNCHECKED);
UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM)&accel);
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
@@ -405,8 +405,8 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues), db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues), db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues), db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues), db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", CLCDEFAULT_NOVSCROLL) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
@@ -449,7 +449,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
DWORD exStyle = 0;
- for (int i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].neg)
exStyle |= checkBoxToStyleEx[i].flag;
db_set_dw(NULL, "CLC", "ExStyle", exStyle);
@@ -512,7 +512,7 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
int i, item;
int s1, s2, s3;
- for (i = 0; i < SIZEOF(sortby); i++) {
+ for (i = 0; i < _countof(sortby); i++) {
item = SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_ADDSTRING, 0, (LPARAM)TranslateTS(sortby[i]));
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETITEMDATA, item, 0);
item = SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_ADDSTRING, 0, (LPARAM)TranslateTS(sortby[i]));
@@ -525,7 +525,7 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
s2 = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT);
s3 = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT);
- for (i = 0; i < SIZEOF(sortby); i++) {
+ for (i = 0; i < _countof(sortby); i++) {
if (s1 == sortbyValue[i])
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETCURSEL, i, 0);
if (s2 == sortbyValue[i])
@@ -804,7 +804,7 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
{
TCHAR *hidemode[] = { TranslateT("Hide to tray"), TranslateT("Behind left edge"), TranslateT("Behind right edge") };
- for (int i = 0; i < SIZEOF(hidemode); i++) {
+ for (int i = 0; i < _countof(hidemode); i++) {
int item = SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_ADDSTRING, 0, (LPARAM)hidemode[i]);
SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETITEMDATA, item, 0);
SendDlgItemMessage(hwndDlg, IDC_HIDEMETHOD, CB_SETCURSEL, db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT), 0);
@@ -1013,7 +1013,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)MIRANDANAME);
char szUin[20];
- mir_snprintf(szUin, SIZEOF(szUin), "%u", db_get_dw(NULL, "ICQ", "UIN", 0));
+ mir_snprintf(szUin, _countof(szUin), "%u", db_get_dw(NULL, "ICQ", "UIN", 0));
SendDlgItemMessage(hwndDlg, IDC_TITLETEXT, CB_ADDSTRING, 0, (LPARAM)szUin);
if (!db_get_s(NULL, "ICQ", "Nick", &dbv)) {
@@ -1149,7 +1149,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
db_set_b(NULL, "CList", "NoBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOBORDERWND));
{
TCHAR title[256];
- GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
+ GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
db_set_ws(NULL, "CList", "TitleText", title);
}
db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
@@ -1276,7 +1276,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!db_get_s(NULL, module, "BkBitmap", &dbv)) {
int retval = PathToAbsolute(dbv.pszVal, dat->item[indx].filename);
if (!retval || retval == CALLSERVICE_NOTFOUND)
- mir_strncpy(dat->item[indx].filename, dbv.pszVal, SIZEOF(dat->item[indx].filename));
+ mir_strncpy(dat->item[indx].filename, dbv.pszVal, _countof(dat->item[indx].filename));
mir_free(dbv.pszVal);
}
else *dat->item[indx].filename = 0;
@@ -1311,7 +1311,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
dat->item[indx].bkColor = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
dat->item[indx].selColor = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR, 0, 0);
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename, SIZEOF(dat->item[indx].filename));
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename, _countof(dat->item[indx].filename));
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH)) flags |= CLB_STRETCHH;
@@ -1361,7 +1361,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case M_BKGR_UPDATE:
{
int isChecked = IsDlgButtonChecked(hwndDlg, IDC_BITMAP);
- for (int indx = 0; indx < SIZEOF(bitmapRelatedControls); indx++)
+ for (int indx = 0; indx < _countof(bitmapRelatedControls); indx++)
EnableWindow(GetDlgItem(hwndDlg, bitmapRelatedControls[indx]), isChecked);
}
break;
@@ -1369,8 +1369,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_COMMAND:
if (LOWORD(wParam) == IDC_BROWSE) {
TCHAR str[MAX_PATH], filter[512];
- Bitmap_GetFilter(filter, SIZEOF(filter));
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ Bitmap_GetFilter(filter, _countof(filter));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -1378,7 +1378,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("bmp");
if (!GetOpenFileName(&ofn))
@@ -1642,7 +1642,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
bInit = true;
{
int i, item;
- for (i = 0; i < SIZEOF(opts); ++i)
+ for (i = 0; i < _countof(opts); ++i)
OptCheckBox_Load(hwndDlg, opts + i);
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -1664,7 +1664,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
- for (i = 0; i < SIZEOF(sortby); i++) {
+ for (i = 0; i < _countof(sortby); i++) {
item = SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_ADDSTRING, 0, (LPARAM)TranslateTS(sortby[i]));
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETITEMDATA, item, 0);
item = SendDlgItemMessage(hwndDlg, IDC_CLSORT2, CB_ADDSTRING, 0, (LPARAM)TranslateTS(sortby[i]));
@@ -1677,7 +1677,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
int s2 = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT);
int s3 = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT);
- for (i = 0; i < SIZEOF(sortby); i++) {
+ for (i = 0; i < _countof(sortby); i++) {
if (s1 == sortbyValue[i])
SendDlgItemMessage(hwndDlg, IDC_CLSORT1, CB_SETCURSEL, i, 0);
if (s2 == sortbyValue[i])
@@ -1730,7 +1730,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
case PSN_APPLY:
g_mutex_bChangingMode = TRUE;
- for (int i = 0; i < SIZEOF(opts); ++i)
+ for (int i = 0; i < _countof(opts); ++i)
OptCheckBox_Save(hwndDlg, opts + i);
SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -1826,7 +1826,7 @@ int ClcOptInit(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcClistListOpts;
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < SIZEOF(clist_opt_items); i++) {
+ for (int i = 0; i < _countof(clist_opt_items); i++) {
odp.pszTemplate = MAKEINTRESOURCEA(clist_opt_items[i].id);
odp.pszTab = clist_opt_items[i].name;
odp.pfnDlgProc = clist_opt_items[i].wnd_proc;
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index a621838d29..f8c845ac65 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -1108,7 +1108,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact
TCHAR buf[70] = _T("");
mir_free_and_nil(pdnce->szSecondLineText);
- TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
+ TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, _countof(buf), 0);
pdnce->szSecondLineText = mir_tstrdup(buf);
}
@@ -1136,7 +1136,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact
TCHAR buf[70] = _T("");
mir_free(pdnce->szThirdLineText);
- TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
+ TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, _countof(buf), 0);
pdnce->szThirdLineText = mir_tstrdup(buf);
}
@@ -1289,7 +1289,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact
//TODO fix overlays
// Draw overlay
if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
- && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) {
+ && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons)) {
p_rect.top = p_rect.bottom - ICON_HEIGHT;
p_rect.left = p_rect.right - ICON_HEIGHT;
@@ -1417,7 +1417,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact
case TC_TIME:
TCHAR szResult[80];
- if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
+ if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL);
ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0));
@@ -2015,7 +2015,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
text_left_pos = row_rc.right;
// Now let's check what we have to draw
for (item_iterator = 0; item_iterator < NUM_ITEM_TYPE && free_row_rc.left < free_row_rc.right; item_iterator++) {
- if (Drawing->ext_nItemsNum >= SIZEOF(Drawing->ext_mpItemsDesc)) break;
+ if (Drawing->ext_nItemsNum >= _countof(Drawing->ext_mpItemsDesc)) break;
if (left)
item = item_iterator;
else
@@ -2130,7 +2130,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
&& (!Drawing->image_is_special || !has_avatar ||
(dat->avatars_draw_overlay
&& dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
- && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)
+ && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons)
&& dat->avatars_overlay_type == SETTING_AVATAR_OVERLAY_TYPE_CONTACT))) {
// Don't have to draw and don't have to keep the empty space
break;
@@ -2163,7 +2163,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
if (Drawing->type == CLCIT_CONTACT && dat->contact_time_show && pdnce->hTimeZone) {
TCHAR szResult[80];
- if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
+ if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) {
SIZE text_size;
RECT rc;
@@ -2351,7 +2351,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
if (dat->second_line_type == TEXT_CONTACT_TIME && pdnce->hTimeZone) {
// Get contact time
TCHAR buf[70] = _T("");
- TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
+ TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, _countof(buf), 0);
mir_free(pdnce->szSecondLineText);
pdnce->szSecondLineText = mir_tstrdup(buf);
}
@@ -2385,7 +2385,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
if (dat->third_line_type == TEXT_CONTACT_TIME && pdnce->hTimeZone) {
// Get contact time
TCHAR buf[70] = _T("");
- TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
+ TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), buf, _countof(buf), 0);
mir_free(pdnce->szThirdLineText);
pdnce->szThirdLineText = mir_tstrdup(buf);
}
@@ -2612,7 +2612,7 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing,
int overlayIdx = -1;
int blendmode = 255;
if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
- && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) {
+ && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons)) {
switch (dat->avatars_overlay_type) {
case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
overlayIdx = g_pAvatarOverlayIcons[GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE].listID;
@@ -2676,7 +2676,7 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing,
DeleteObject(rgn);
// Draw overlays
if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
- && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons)) {
+ && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons)) {
POINT ptOverlay = { prcItem->right - ICON_HEIGHT, prcItem->bottom - ICON_HEIGHT };
if (dat->avatars_draw_border) {
ptOverlay.x--;
@@ -2818,7 +2818,7 @@ void CLCPaint::_DrawContactTime(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
if (!pdnce)
return;
- if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
+ if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL);
ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), prcItem, DT_NOPREFIX | DT_SINGLELINE);
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp
index c98a8645b5..9d16e85de7 100644
--- a/plugins/Clist_modern/src/modern_clcutils.cpp
+++ b/plugins/Clist_modern/src/modern_clcutils.cpp
@@ -531,7 +531,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
else {
int defItems[] = { ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS, };
for (int i = 0; i < NUM_ITEM_TYPE; i++)
- dat->row_items[i] = (i < SIZEOF(defItems)) ? defItems[i] : -1;
+ dat->row_items[i] = (i < _countof(defItems)) ? defItems[i] : -1;
}
// Avatar
@@ -611,7 +611,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
ptrT tszLineText(db_get_tsa(NULL, "CList", "SecondLineText"));
if (tszLineText)
- mir_tstrncpy(dat->second_line_text, tszLineText, SIZEOF(dat->second_line_text));
+ mir_tstrncpy(dat->second_line_text, tszLineText, _countof(dat->second_line_text));
else
dat->second_line_text[0] = _T('\0');
@@ -639,7 +639,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
ptrT tszLineText(db_get_tsa(NULL, "CList", "ThirdLineText"));
if (tszLineText)
- mir_tstrncpy(dat->third_line_text, tszLineText, SIZEOF(dat->third_line_text));
+ mir_tstrncpy(dat->third_line_text, tszLineText, _countof(dat->third_line_text));
else
dat->third_line_text[0] = _T('\0');
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 6ef62cc6ee..cabc2363da 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -108,8 +108,8 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
if (p->cle.pszService &&
- (!strncmp("SRMsg/ReadMessage", p->cle.pszService, SIZEOF("SRMsg/ReadMessage")) ||
- !strncmp("GChat/DblClickEvent", p->cle.pszService, SIZEOF("GChat/DblClickEvent"))))
+ (!strncmp("SRMsg/ReadMessage", p->cle.pszService, _countof("SRMsg/ReadMessage")) ||
+ !strncmp("GChat/DblClickEvent", p->cle.pszService, _countof("GChat/DblClickEvent"))))
{
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) {
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index 3f9bf7bc7c..41dce30d7c 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -94,8 +94,8 @@ static IconItem iconList[] =
static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
{
BYTE bContactRate = db_get_b(hContact, "CList", "Rate", 0);
- if (bContactRate > SIZEOF(rates) - 1)
- bContactRate = SIZEOF(rates) - 1;
+ if (bContactRate > _countof(rates) - 1)
+ bContactRate = _countof(rates) - 1;
BOOL bModifyMenu = FALSE;
@@ -130,12 +130,12 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
mi.hParentMenu = hFavoriteContactMenu;
if (!hFavoriteContactMenuItems) {
- hFavoriteContactMenuItems = (HGENMENU *)malloc(sizeof(HANDLE) * SIZEOF(rates));
- memset(hFavoriteContactMenuItems, 0, sizeof(HANDLE) * SIZEOF(rates));
+ hFavoriteContactMenuItems = (HGENMENU *)malloc(sizeof(HANDLE) * _countof(rates));
+ memset(hFavoriteContactMenuItems, 0, sizeof(HANDLE) * _countof(rates));
}
int i;
- for (i = 0; i < SIZEOF(rates); i++) {
+ for (i = 0; i < _countof(rates); i++) {
mi.icolibItem = iconList[i].hIcolib;
mi.ptszName = rates[i];
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0);
@@ -181,7 +181,7 @@ INT_PTR FAV_ToggleShowOffline(WPARAM hContact, LPARAM)
int LoadFavoriteContactMenu()
{
- Icon_Register(g_hInst, LPGEN("Contact list"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, LPGEN("Contact list"), iconList, _countof(iconList));
CreateServiceFunction(CLUI_FAVSETRATE, FAV_SetRate);
CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE, FAV_ToggleShowOffline);
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index 7015a99388..f4489c499d 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -299,7 +299,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY)
hAux = GetAncestor(hAux, GA_ROOTOWNER);
if (hAuxOld == hAux) {
TCHAR buf[255];
- GetClassName(hAux, buf, SIZEOF(buf));
+ GetClassName(hAux, buf, _countof(buf));
if (!mir_tstrcmp(buf, CLUIFrameSubContainerClassName)) {
hWndFound = TRUE;
break;
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp
index 20e6f19089..4173bb0751 100644
--- a/plugins/Clist_modern/src/modern_clistopts.cpp
+++ b/plugins/Clist_modern/src/modern_clistopts.cpp
@@ -720,7 +720,7 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
db_set_w(NULL, "CList", "SecondLineType", (WORD)radio);
TCHAR t[TEXT_TEXT_MAX_LENGTH];
- GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, SIZEOF(t));
+ GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, _countof(t));
t[TEXT_TEXT_MAX_LENGTH - 1] = '\0';
db_set_ts(NULL, "CList", "SecondLineText", t);
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
{
TCHAR t[TEXT_TEXT_MAX_LENGTH];
- GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, SIZEOF(t));
+ GetDlgItemText(hwndDlg, IDC_VARIABLE_TEXT, t, _countof(t));
t[TEXT_TEXT_MAX_LENGTH - 1] = '\0';
db_set_ws(NULL, "CList", "ThirdLineText", t);
@@ -940,7 +940,7 @@ int CListOptInit(WPARAM wParam, LPARAM)
odp.pszTitle = LPGEN("Row items");
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < SIZEOF(row_opt_items); i++) {
+ for (int i = 0; i < _countof(row_opt_items); i++) {
odp.pszTemplate = MAKEINTRESOURCEA(row_opt_items[i].id);
odp.pszTab = row_opt_items[i].name;
odp.pfnDlgProc = row_opt_items[i].wnd_proc;
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index a0430c6172..a90a5e69aa 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -649,7 +649,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int)
// if Tipper is missing or turned off for tray, use system tooltips
if (!ServiceExists("mToolTip/ShowTip") || !db_get_b(NULL, "Tipper", "TrayTip", 1))
- mir_tstrncpy(nid.szTip, pcli->szTip, SIZEOF(nid.szTip));
+ mir_tstrncpy(nid.szTip, pcli->szTip, _countof(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index 8c663dfcd0..bc79b2372a 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -191,7 +191,7 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM)
HWND hwndClist = GetFocus();
TCHAR cls[128];
- GetClassName(hwndClist, cls, SIZEOF(cls));
+ GetClassName(hwndClist, cls, _countof(cls));
if (mir_tstrcmp(_T(CLISTCONTROL_CLASS), cls))
hwndClist = pcli->hwndContactList;
@@ -334,7 +334,7 @@ static IconItemT iconItem[] = {
HRESULT CLUI::RegisterAvatarMenu()
{
- Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem));
+ Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem));
CLISTMENUITEM mi = { sizeof(mi) };
CreateServiceFunction("CList/ShowContactAvatar", CLUI::Service_Menu_ShowContactAvatar);
@@ -487,7 +487,7 @@ HICON GetMainStatusOverlay(int STATUS)
void UnloadAvatarOverlayIcon()
{
- for (int i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) {
+ for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
g_pAvatarOverlayIcons[i].listID = -1;
g_pStatusOverlayIcons[i].listID = -1;
}
@@ -679,9 +679,9 @@ void CLUI_ChangeWindowMode()
TCHAR titleText[255] = { 0 };
DBVARIANT dbv;
if (db_get_ts(NULL, "CList", "TitleText", &dbv))
- mir_tstrncpy(titleText, _T(MIRANDANAME), SIZEOF(titleText));
+ mir_tstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
else {
- mir_tstrncpy(titleText, dbv.ptszVal, SIZEOF(titleText));
+ mir_tstrncpy(titleText, dbv.ptszVal, _countof(titleText));
db_free(&dbv);
}
SetWindowText(pcli->hwndContactList, titleText);
@@ -905,7 +905,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName)
if (szAccoName) {
// first of all try to find by account name( or empty - global )
- mir_sntprintf(fileFull, SIZEOF(fileFull), _T("%s\\Icons\\proto_conn_%S.dll"), tszFolderPath, szAccoName);
+ mir_sntprintf(fileFull, _countof(fileFull), _T("%s\\Icons\\proto_conn_%S.dll"), tszFolderPath, szAccoName);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
@@ -913,7 +913,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName)
// second try to find by protocol name
PROTOACCOUNT *acc = Proto_GetAccount(szAccoName);
if (acc && !acc->bOldProto) {
- mir_sntprintf(fileFull, SIZEOF(fileFull), _T("%s\\Icons\\proto_conn_%S.dll"), tszFolderPath, acc->szProtoName);
+ mir_sntprintf(fileFull, _countof(fileFull), _T("%s\\Icons\\proto_conn_%S.dll"), tszFolderPath, acc->szProtoName);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
}
@@ -921,7 +921,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName)
}
// third try global
- mir_sntprintf(fileFull, SIZEOF(fileFull), _T("%s\\Icons\\proto_conn.dll"), tszFolderPath);
+ mir_sntprintf(fileFull, _countof(fileFull), _T("%s\\Icons\\proto_conn.dll"), tszFolderPath);
if (count = ExtractIconEx(fileFull, -1, NULL, NULL, 1))
return count;
@@ -947,7 +947,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx)
HICON hIcon;
if (szAccoName) {
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("proto_conn_%S.dll"), szAccoName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("proto_conn_%S.dll"), szAccoName);
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
@@ -955,7 +955,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx)
// second try to find by protocol name
PROTOACCOUNT *acc = Proto_GetAccount(szAccoName);
if (acc && !acc->bOldProto) {
- mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("proto_conn_%S.dll"), acc->szProtoName);
+ mir_sntprintf(szFullPath, _countof(szFullPath), _T("proto_conn_%S.dll"), acc->szProtoName);
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
}
@@ -963,7 +963,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx)
}
// third try global
- mir_tstrncpy(szFullPath, _T("proto_conn.dll"), SIZEOF(szFullPath));
+ mir_tstrncpy(szFullPath, _T("proto_conn.dll"), _countof(szFullPath));
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
@@ -1562,7 +1562,7 @@ HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDesc
if (fileFull[0] != _T('\0'))
sid.iDefaultIndex = -iDefaultIndex;
else {
- GetModuleFileName(hDefaultModuleInst, fileFull, SIZEOF(fileFull));
+ GetModuleFileName(hDefaultModuleInst, fileFull, _countof(fileFull));
sid.iDefaultIndex = -iDefaultResource;
}
@@ -1592,7 +1592,7 @@ LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bH
if (msg == uMsgGetProfile && wParam != 0) { // got IPC message
int rc = 0;
char szName[MAX_PATH];
- mir_snprintf(szName, SIZEOF(szName), "Miranda::%u", wParam); // caller will tell us the ID of the map
+ mir_snprintf(szName, _countof(szName), "Miranda::%u", wParam); // caller will tell us the ID of the map
HANDLE hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, szName);
if (hMap != NULL) {
void *hView = NULL;
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index 272daa123c..bfc6aab7fd 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -57,7 +57,7 @@ void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add)
static int GetStatusModeOrdering(int statusMode)
{
- for (int i = 0; i < SIZEOF(statusModeOrder); i++)
+ for (int i = 0; i < _countof(statusModeOrder); i++)
if (statusModeOrder[i].status == statusMode)
return statusModeOrder[i].order;
return 1000;
@@ -153,7 +153,7 @@ int CompareContacts2(const ClcContact *contact1, const ClcContact *contact2, int
int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2)
{
int i, r;
- for (i = 0; i < SIZEOF(g_CluiData.bSortByOrder); i++)
+ for (i = 0; i < _countof(g_CluiData.bSortByOrder); i++)
{
r = CompareContacts2(contact1, contact2, g_CluiData.bSortByOrder[i]);
if (r != 0)
diff --git a/plugins/Clist_modern/src/modern_log.cpp b/plugins/Clist_modern/src/modern_log.cpp
index f14ec4ca36..780177c2a1 100644
--- a/plugins/Clist_modern/src/modern_log.cpp
+++ b/plugins/Clist_modern/src/modern_log.cpp
@@ -21,7 +21,7 @@ void Log(const char *file, int line, const char *fmt, ...)
file_tmp++;
va_start(vararg, fmt);
- mir_vsnprintf(str, SIZEOF(str), fmt, vararg);
+ mir_vsnprintf(str, _countof(str), fmt, vararg);
va_end(vararg);
{
char * tmp = str;
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index 5766aa8e08..aa07ffd865 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -288,7 +288,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i
if (item == -1) {
TCHAR szResult[80];
- if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
+ if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) {
SIZE text_size = { 0 };
RECT rc = { 0 };
// Select font
@@ -397,7 +397,7 @@ int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd)
if (!dat->text_ignore_size_for_row_height) {
// Get contact font size
tmp = 0;
- for (i = 0; i < SIZEOF(contact_fonts); i++)
+ for (i = 0; i < _countof(contact_fonts); i++)
if (tmp < dat->fontModernInfo[contact_fonts[i]].fontHeight)
tmp = dat->fontModernInfo[contact_fonts[i]].fontHeight;
@@ -421,7 +421,7 @@ int RowHeights_GetMaxRowHeight(ClcData *dat, HWND hwnd)
}
// Get other font sizes
- for (i = 0; i < SIZEOF(other_fonts); i++)
+ for (i = 0; i < _countof(other_fonts); i++)
if (max_height < dat->fontModernInfo[other_fonts[i]].fontHeight)
max_height = dat->fontModernInfo[other_fonts[i]].fontHeight;
}
diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
index 92630786c4..fa5ec60d54 100644
--- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
+++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
@@ -317,16 +317,16 @@ void RefreshTree(HWND hwndDlg, HTREEITEM hti)
if (cell->type == 0)
mir_sntprintf(buf, TranslateT("Empty %s cell"), cell->cont == TC_COL ? TranslateT("column") : TranslateT("line"));
else
- mir_tstrncpy(buf, TranslateTS(types[cell->type]), SIZEOF(buf));
+ mir_tstrncpy(buf, TranslateTS(types[cell->type]), _countof(buf));
}
else
{
if (cell->type == 0)
- mir_tstrncpy(buf, (cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines")), SIZEOF(buf));
+ mir_tstrncpy(buf, (cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines")), _countof(buf));
else
mir_sntprintf(buf, TranslateT("%s, contain %s"), TranslateTS(types[cell->type]), cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines"));
}
- if (cell->layer) mir_tstrncat(buf, TranslateT(" layered"), SIZEOF(buf) - mir_tstrlen(buf));
+ if (cell->layer) mir_tstrncat(buf, TranslateT(" layered"), _countof(buf) - mir_tstrlen(buf));
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.pszText = buf;
TreeView_SetItem(htree, &tvi);
@@ -359,21 +359,21 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
int i, item;
- for (i = 0; i < SIZEOF(types); i++) {
+ for (i = 0; i < _countof(types); i++) {
item = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(types[i]));
SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETCURSEL, 0, 0);
TCHAR *h_alignment[] = { _T("left"), _T("hCenter"), _T("right") };
- for (i = 0; i < SIZEOF(h_alignment); i++) {
+ for (i = 0; i < _countof(h_alignment); i++) {
item = SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateTS(h_alignment[i]));
SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETITEMDATA, item, 0);
}
SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETCURSEL, 0, 0);
TCHAR *v_alignment[] = { _T("top"), _T("vCenter"), _T("bottom") };
- for (i = 0; i < SIZEOF(v_alignment); i++) {
+ for (i = 0; i < _countof(v_alignment); i++) {
item = SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateTS(v_alignment[i]));
SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETITEMDATA, item, 0);
}
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp
index 2e2d8ec652..4e78f1c789 100644
--- a/plugins/Clist_modern/src/modern_skinbutton.cpp
+++ b/plugins/Clist_modern/src/modern_skinbutton.cpp
@@ -142,15 +142,15 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc)
}
case 'd':
defval = db_get_dw(NULL, section, key, defval);
- Value = mir_strdup(_ltoa(defval, buf, SIZEOF(buf)));
+ Value = mir_strdup(_ltoa(defval, buf, _countof(buf)));
break;
case 'w':
defval = db_get_w(NULL, section, key, defval);
- Value = mir_strdup(_ltoa(defval, buf, SIZEOF(buf)));
+ Value = mir_strdup(_ltoa(defval, buf, _countof(buf)));
break;
case 'b':
defval = db_get_b(NULL, section, key, defval);
- Value = mir_strdup(_ltoa(defval, buf, SIZEOF(buf)));
+ Value = mir_strdup(_ltoa(defval, buf, _countof(buf)));
break;
}
mir_free(section);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index 551a079f6b..5e71a539dd 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -215,12 +215,12 @@ int IniParser::GetSkinFolder(IN const TCHAR * szFileName, OUT TCHAR * pszFolderN
TCHAR custom_folder[MAX_PATH], cus[MAX_PATH];
TCHAR *b3;
- mir_tstrncpy(custom_folder, pszFolderName, SIZEOF(custom_folder));
+ mir_tstrncpy(custom_folder, pszFolderName, _countof(custom_folder));
b3 = custom_folder + mir_tstrlen(custom_folder);
while (b3 > custom_folder && *b3 != _T('\\')) { b3--; }
*b3 = _T('\0');
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("SkinFolder"), _T(""), cus, SIZEOF(custom_folder), szFileName);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("SkinFolder"), _T(""), cus, _countof(custom_folder), szFileName);
if (cus[0] != 0)
mir_sntprintf(pszFolderName, MAX_PATH, _T("%s\\%s"), custom_folder, cus);
@@ -266,7 +266,7 @@ HRESULT IniParser::_DoParseFile()
{
char szLine[MAX_LINE_LEN];
_nLine = 0;
- while (fgets(szLine, SIZEOF(szLine), _hFile) != NULL) {
+ while (fgets(szLine, _countof(szLine), _hFile) != NULL) {
size_t len = 0;
char * pLine = (char*)_RemoveTailings(szLine, len);
if (len > 0) {
@@ -1483,9 +1483,9 @@ int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder, BOOL m
TCHAR b2[MAX_PATH];
if (file[0] != '\\' && file[1] != ':')
- mir_sntprintf(b2, SIZEOF(b2), _T("%s\\%s"), (skinfolder == NULL) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : _T(""), file);
+ mir_sntprintf(b2, _countof(b2), _T("%s\\%s"), (skinfolder == NULL) ? SkinPlace : ((INT_PTR)skinfolder != -1) ? skinfolder : _T(""), file);
else
- mir_tstrncpy(b2, file, SIZEOF(b2));
+ mir_tstrncpy(b2, file, _countof(b2));
if (madeAbsolute) {
if (b2[0] == '\\' && b2[1] != '\\')
@@ -2983,13 +2983,13 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting)
BitBlt(g_pCachedWindow->hImageDC, rLine.left, rLine.top, rLine.right - rLine.left, rLine.bottom - rLine.top, g_pCachedWindow->hBackDC, rLine.left, rLine.top, SRCCOPY);
char req[255];
- mir_snprintf(req, SIZEOF(req), "Main,ID=ScrollBar,Frame=%s,Part=Back", Frame->szName);
+ mir_snprintf(req, _countof(req), "Main,ID=ScrollBar,Frame=%s,Part=Back", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC, &rLine, &rLine, req);
- mir_snprintf(req, SIZEOF(req), "Main,ID=ScrollBar,Frame=%s,Part=Thumb", Frame->szName);
+ mir_snprintf(req, _countof(req), "Main,ID=ScrollBar,Frame=%s,Part=Thumb", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC, &rThumb, &rThumb, req);
- mir_snprintf(req, SIZEOF(req), "Main,ID=ScrollBar, Frame=%s,Part=UpLineButton", Frame->szName);
+ mir_snprintf(req, _countof(req), "Main,ID=ScrollBar, Frame=%s,Part=UpLineButton", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC, &rUpBtn, &rUpBtn, req);
- mir_snprintf(req, SIZEOF(req), "Main,ID=ScrollBar,Frame=%s,Part=DownLineButton", Frame->szName);
+ mir_snprintf(req, _countof(req), "Main,ID=ScrollBar,Frame=%s,Part=DownLineButton", Frame->szName);
SkinDrawGlyph(g_pCachedWindow->hImageDC, &rDnBtn, &rDnBtn, req);
}
@@ -3302,9 +3302,9 @@ static DWORD ske_HexToARGB(char * Hex)
char buf2[11] = { 0 };
mir_snprintf(buf, "%s\n", Hex);
if (buf[1] == 'x' || buf[1] == 'X')
- mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf + 2);
+ mir_snprintf(buf2, _countof(buf2), "0x%s\n", buf + 2);
else
- mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf);
+ mir_snprintf(buf2, _countof(buf2), "0x%s\n", buf);
buf2[10] = '\0';
char *st;
@@ -3450,7 +3450,7 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString)
logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
char buf[255];
- mir_strncpy(logfont.lfFaceName, GetParamN(szDefineString, buf, sizeof(buf), 0, ',', TRUE), SIZEOF(logfont.lfFaceName));
+ mir_strncpy(logfont.lfFaceName, GetParamN(szDefineString, buf, sizeof(buf), 0, ',', TRUE), _countof(logfont.lfFaceName));
logfont.lfHeight = atoi(GetParamN(szDefineString, buf, sizeof(buf), 1, ',', TRUE));
if (logfont.lfHeight < 0) {
HDC hdc = CreateCompatibleDC(NULL);
diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp
index 7fa5958ebb..d55aed2cd7 100644
--- a/plugins/Clist_modern/src/modern_skinopt.cpp
+++ b/plugins/Clist_modern/src/modern_skinopt.cpp
@@ -119,10 +119,10 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
}
if (!sd) return 0;
if (sd->File && !_tcschr(sd->File, _T('%'))) {
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, _countof(Author), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, _countof(URL), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, _countof(Contact), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, _countof(Description), sd->File);
mir_sntprintf(text, TranslateT("%s\n\n%s\n\nAuthor(s):\t %s\nContact:\t %s\nWeb:\t %s\n\nFile:\t %s"),
sd->Name, Description, Author, Contact, URL, sd->File);
}
@@ -250,9 +250,9 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
SetDlgItemText(hwndDlg, IDC_EDIT_SKIN_FILENAME, buf);
TCHAR prfn[MAX_PATH] = { 0 }, imfn[MAX_PATH] = { 0 }, skinfolder[MAX_PATH] = { 0 };
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF(imfn), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, _countof(imfn), sd->File);
IniParser::GetSkinFolder(sd->File, skinfolder);
- mir_sntprintf(prfn, SIZEOF(prfn), _T("%s\\%s"), skinfolder, imfn);
+ mir_sntprintf(prfn, _countof(prfn), _T("%s\\%s"), skinfolder, imfn);
PathToAbsoluteT(prfn, imfn);
hPreviewBitmap = ske_LoadGlyphImage(imfn);
@@ -275,10 +275,10 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
if (!sd) return 0;
if (sd->File && !_tcschr(sd->File, _T('%'))) {
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, SIZEOF(Author), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, SIZEOF(URL), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, SIZEOF(Contact), sd->File);
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, SIZEOF(Description), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, _countof(Author), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, _countof(URL), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, _countof(Contact), sd->File);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, _countof(Description), sd->File);
mir_sntprintf(text, TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"),
sd->Name, Description, Author, Contact, URL);
}
@@ -332,7 +332,7 @@ int SearchSkinFiles(HWND hwndDlg, TCHAR * Folder)
struct _tfinddata_t fd = { 0 };
TCHAR mask[MAX_PATH];
long hFile;
- mir_sntprintf(mask, SIZEOF(mask), _T("%s\\*.msf"), Folder);
+ mir_sntprintf(mask, _countof(mask), _T("%s\\*.msf"), Folder);
//fd.attrib = _A_SUBDIR;
hFile = _tfindfirst(mask, &fd);
if (hFile != -1)
@@ -342,14 +342,14 @@ int SearchSkinFiles(HWND hwndDlg, TCHAR * Folder)
} while (!_tfindnext(hFile, &fd));
_findclose(hFile);
}
- mir_sntprintf(mask, SIZEOF(mask), _T("%s\\*"), Folder);
+ mir_sntprintf(mask, _countof(mask), _T("%s\\*"), Folder);
hFile = _tfindfirst(mask, &fd);
{
do {
if (fd.attrib&_A_SUBDIR && !(mir_tstrcmpi(fd.name, _T(".")) == 0 || mir_tstrcmpi(fd.name, _T("..")) == 0))
{//Next level of subfolders
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), Folder, fd.name);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), Folder, fd.name);
SearchSkinFiles(hwndDlg, path);
}
} while (!_tfindnext(hFile, &fd));
@@ -384,7 +384,7 @@ HTREEITEM AddSkinToListFullName(HWND hwndDlg, TCHAR * fullName)
TCHAR path[MAX_PATH] = { 0 };
TCHAR file[MAX_PATH] = { 0 };
TCHAR *buf;
- mir_tstrncpy(path, fullName, SIZEOF(path));
+ mir_tstrncpy(path, fullName, _countof(path));
buf = path + mir_tstrlen(path);
while (buf > path)
{
@@ -396,7 +396,7 @@ HTREEITEM AddSkinToListFullName(HWND hwndDlg, TCHAR * fullName)
buf--;
}
buf++;
- mir_tstrncpy(file, buf, SIZEOF(file));
+ mir_tstrncpy(file, buf, _countof(file));
return AddSkinToList(hwndDlg, path, file);
}
@@ -414,10 +414,10 @@ HTREEITEM AddSkinToList(HWND hwndDlg, TCHAR * path, TCHAR* file)
_tcsncpy_s(fullName, TranslateT("Default Skin"), _TRUNCATE);
}
else {
- mir_sntprintf(fullName, SIZEOF(fullName), _T("%s\\%s"), path, file);
+ mir_sntprintf(fullName, _countof(fullName), _T("%s\\%s"), path, file);
_tcsncpy_s(defskinname, file, _TRUNCATE);
TCHAR *p = _tcsrchr(defskinname, '.'); if (p) *p = 0;
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Name"), defskinname, sd->Name, SIZEOF(sd->Name), fullName);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Name"), defskinname, sd->Name, _countof(sd->Name), fullName);
_tcsncpy_s(sd->File, fullName, _TRUNCATE);
}
return AddItemToTree(GetDlgItem(hwndDlg, IDC_TREE1), sd->Name, sd);
@@ -437,7 +437,7 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, TCHAR * Caption, void * data)
tvi.hItem = tmp;
tvi.mask = TVIF_TEXT | TVIF_HANDLE;
tvi.pszText = buf;
- tvi.cchTextMax = SIZEOF(buf);
+ tvi.cchTextMax = _countof(buf);
TreeView_GetItem(hTree, &tvi);
if (mir_tstrcmpi(Caption, tvi.pszText) == 0) {
if (!data)
@@ -520,9 +520,9 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam)
TCHAR prfn[MAX_PATH] = { 0 };
TCHAR imfn[MAX_PATH] = { 0 };
TCHAR skinfolder[MAX_PATH] = { 0 };
- GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF(imfn), (LPCTSTR)lParam);
+ GetPrivateProfileString(_T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, _countof(imfn), (LPCTSTR)lParam);
IniParser::GetSkinFolder((LPCTSTR)lParam, skinfolder);
- mir_sntprintf(prfn, SIZEOF(prfn), _T("%s\\%s"), skinfolder, imfn);
+ mir_sntprintf(prfn, _countof(prfn), _T("%s\\%s"), skinfolder, imfn);
PathToAbsoluteT(prfn, imfn);
hPreviewBitmap = ske_LoadGlyphImage(imfn);
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp
index 3563b12c7b..64c9aad075 100644
--- a/plugins/Clist_modern/src/modern_skinselector.cpp
+++ b/plugins/Clist_modern/src/modern_skinselector.cpp
@@ -502,7 +502,7 @@ int RegisterButtonByParce(char * ObjectName, char * Params)
{
char buf[255];
int res;
- GetParamN(Params, buf, SIZEOF(buf), 0, ',', 0);
+ GetParamN(Params, buf, _countof(buf), 0, ',', 0);
// if (boolstrcmpi("Push",buf)
{ //Push type
char buf2[20] = { 0 };
@@ -518,20 +518,20 @@ int RegisterButtonByParce(char * ObjectName, char * Params)
DWORD alingnto;
int a = ((int)!mir_strcmpi(buf, "Switch")) * 2;
- GetParamN(Params, pServiceName, SIZEOF(pServiceName), 1, ',', 0);
+ GetParamN(Params, pServiceName, _countof(pServiceName), 1, ',', 0);
// if (a) GetParamN(Params,pStatusServiceName, sizeof(pStatusServiceName),a+1,',',0);
- Left = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 2, ',', 0));
- Top = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 3, ',', 0));
- Right = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 4, ',', 0));
- Bottom = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 5, ',', 0));
- GetParamN(Params, TL, SIZEOF(TL), a + 6, ',', 0);
-
- MinWidth = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 7, ',', 0));
- MinHeight = atoi(GetParamN(Params, buf2, SIZEOF(buf2), a + 8, ',', 0));
- GetParamNT(Params, Hint, SIZEOF(Hint), a + 9, ',', 0);
+ Left = atoi(GetParamN(Params, buf2, _countof(buf2), a + 2, ',', 0));
+ Top = atoi(GetParamN(Params, buf2, _countof(buf2), a + 3, ',', 0));
+ Right = atoi(GetParamN(Params, buf2, _countof(buf2), a + 4, ',', 0));
+ Bottom = atoi(GetParamN(Params, buf2, _countof(buf2), a + 5, ',', 0));
+ GetParamN(Params, TL, _countof(TL), a + 6, ',', 0);
+
+ MinWidth = atoi(GetParamN(Params, buf2, _countof(buf2), a + 7, ',', 0));
+ MinHeight = atoi(GetParamN(Params, buf2, _countof(buf2), a + 8, ',', 0));
+ GetParamNT(Params, Hint, _countof(Hint), a + 9, ',', 0);
if (a) {
- GetParamN(Params, Section, SIZEOF(Section), 2, ',', 0);
- GetParamN(Params, Type, SIZEOF(Type), 3, ',', 0);
+ GetParamN(Params, Section, _countof(Section), 2, ',', 0);
+ GetParamN(Params, Type, _countof(Type), 3, ',', 0);
}
alingnto = ((TL[0] == 'R') ? SBF_ALIGN_TL_RIGHT : 0)
+ ((TL[0] == 'C') ? SBF_ALIGN_TL_HCENTER : 0)
@@ -560,7 +560,7 @@ int RegisterObjectByParce(char * ObjectName, char * Params)
SKINOBJECTDESCRIPTOR obj = { 0 };
char buf[250];
obj.szObjectID = mir_strdup(ObjectName);
- GetParamN(Params, buf, SIZEOF(buf), 0, ',', 0);
+ GetParamN(Params, buf, _countof(buf), 0, ',', 0);
if (!mir_strcmpi(buf, "Glyph"))
obj.bType = OT_GLYPHOBJECT;
else if (!mir_strcmpi(buf, "Font"))
@@ -570,26 +570,26 @@ int RegisterObjectByParce(char * ObjectName, char * Params)
case OT_GLYPHOBJECT:
{
GLYPHOBJECT gl = { 0 };
- GetParamN(Params, buf, SIZEOF(buf), 1, ',', 0);
+ GetParamN(Params, buf, _countof(buf), 1, ',', 0);
if (!mir_strcmpi(buf, "Solid")) {
// Solid
gl.Style = ST_BRUSH;
- int r = atoi(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
- int g = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
- int b = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
- gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
+ int r = atoi(GetParamN(Params, buf, _countof(buf), 2, ',', 0));
+ int g = atoi(GetParamN(Params, buf, _countof(buf), 3, ',', 0));
+ int b = atoi(GetParamN(Params, buf, _countof(buf), 4, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, _countof(buf), 5, ',', 0));
gl.dwColor = RGB(r, g, b);
}
else if (!mir_strcmpi(buf, "Image")) {
// Image
gl.Style = ST_IMAGE;
- gl.szFileName = mir_strdup(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
- gl.dwLeft = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
- gl.dwTop = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
- gl.dwRight = atoi(GetParamN(Params, buf, SIZEOF(buf), 6, ',', 0));
- gl.dwBottom = atoi(GetParamN(Params, buf, SIZEOF(buf), 7, ',', 0));
- gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 8, ',', 0));
- GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0);
+ gl.szFileName = mir_strdup(GetParamN(Params, buf, _countof(buf), 2, ',', 0));
+ gl.dwLeft = atoi(GetParamN(Params, buf, _countof(buf), 4, ',', 0));
+ gl.dwTop = atoi(GetParamN(Params, buf, _countof(buf), 5, ',', 0));
+ gl.dwRight = atoi(GetParamN(Params, buf, _countof(buf), 6, ',', 0));
+ gl.dwBottom = atoi(GetParamN(Params, buf, _countof(buf), 7, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, _countof(buf), 8, ',', 0));
+ GetParamN(Params, buf, _countof(buf), 3, ',', 0);
if (!mir_strcmpi(buf, "TileBoth")) gl.FitMode = FM_TILE_BOTH;
else if (!mir_strcmpi(buf, "TileVert")) gl.FitMode = FM_TILE_VERT;
else if (!mir_strcmpi(buf, "TileHorz")) gl.FitMode = FM_TILE_HORZ;
@@ -598,19 +598,19 @@ int RegisterObjectByParce(char * ObjectName, char * Params)
else if (!mir_strcmpi(buf, "Fragment")) {
//Image
gl.Style = ST_FRAGMENT;
- gl.szFileName = mir_strdup(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
-
- gl.clipArea.x = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
- gl.clipArea.y = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
- gl.szclipArea.cx = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
- gl.szclipArea.cy = atoi(GetParamN(Params, buf, SIZEOF(buf), 6, ',', 0));
-
- gl.dwLeft = atoi(GetParamN(Params, buf, SIZEOF(buf), 8, ',', 0));
- gl.dwTop = atoi(GetParamN(Params, buf, SIZEOF(buf), 9, ',', 0));
- gl.dwRight = atoi(GetParamN(Params, buf, SIZEOF(buf), 10, ',', 0));
- gl.dwBottom = atoi(GetParamN(Params, buf, SIZEOF(buf), 11, ',', 0));
- gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 12, ',', 0));
- GetParamN(Params, buf, SIZEOF(buf), 7, ',', 0);
+ gl.szFileName = mir_strdup(GetParamN(Params, buf, _countof(buf), 2, ',', 0));
+
+ gl.clipArea.x = atoi(GetParamN(Params, buf, _countof(buf), 3, ',', 0));
+ gl.clipArea.y = atoi(GetParamN(Params, buf, _countof(buf), 4, ',', 0));
+ gl.szclipArea.cx = atoi(GetParamN(Params, buf, _countof(buf), 5, ',', 0));
+ gl.szclipArea.cy = atoi(GetParamN(Params, buf, _countof(buf), 6, ',', 0));
+
+ gl.dwLeft = atoi(GetParamN(Params, buf, _countof(buf), 8, ',', 0));
+ gl.dwTop = atoi(GetParamN(Params, buf, _countof(buf), 9, ',', 0));
+ gl.dwRight = atoi(GetParamN(Params, buf, _countof(buf), 10, ',', 0));
+ gl.dwBottom = atoi(GetParamN(Params, buf, _countof(buf), 11, ',', 0));
+ gl.dwAlpha = atoi(GetParamN(Params, buf, _countof(buf), 12, ',', 0));
+ GetParamN(Params, buf, _countof(buf), 7, ',', 0);
if (!mir_strcmpi(buf, "TileBoth")) gl.FitMode = FM_TILE_BOTH;
else if (!mir_strcmpi(buf, "TileVert")) gl.FitMode = FM_TILE_VERT;
else if (!mir_strcmpi(buf, "TileHorz")) gl.FitMode = FM_TILE_HORZ;
@@ -641,6 +641,6 @@ int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMas
rq.hDC = hdc;
rq.rcDestRect = *rcSize;
rq.rcClipRect = *rcClip;
- mir_strncpy(rq.szObjectID, "Masked draw", SIZEOF(rq.szObjectID));
+ mir_strncpy(rq.szObjectID, "Masked draw", _countof(rq.szObjectID));
return ske_Service_DrawGlyph((WPARAM)&rq, (LPARAM)ModernMask);
}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index 7d785529e3..1f087a1cb4 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -770,12 +770,12 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
if (msg == WM_LBUTTONDOWN && bCtrl) {
if (g_CluiData.bFilterEffective != CLVM_FILTER_PROTOS || !bShift) {
ApplyViewMode("");
- mir_snprintf(g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s|", p.szAccountName);
+ mir_snprintf(g_CluiData.protoFilter, _countof(g_CluiData.protoFilter), "%s|", p.szAccountName);
g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
}
else {
char protoF[sizeof(g_CluiData.protoFilter)];
- mir_snprintf(protoF, SIZEOF(protoF), "%s|", p.szAccountName);
+ mir_snprintf(protoF, _countof(protoF), "%s|", p.szAccountName);
char *pos = strstri(g_CluiData.protoFilter, p.szAccountName);
if (pos) {
// remove filter
@@ -789,7 +789,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
else {
//add filter
- mir_snprintf(g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s%s", g_CluiData.protoFilter, protoF);
+ mir_snprintf(g_CluiData.protoFilter, _countof(g_CluiData.protoFilter), "%s%s", g_CluiData.protoFilter, protoF);
g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
}
}
@@ -809,11 +809,11 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
continue;
char protoF[sizeof(g_CluiData.protoFilter)];
- mir_snprintf(protoF, SIZEOF(protoF), "%s|", accs[i]->szModuleName);
+ mir_snprintf(protoF, _countof(protoF), "%s|", accs[i]->szModuleName);
if (strstri(g_CluiData.protoFilter, protoF)) {
if (!first)
- mir_strncat(filterName, "; ", SIZEOF(filterName) - mir_strlen(filterName));
- mir_strncat(filterName, T2Utf(accs[i]->tszAccountName), SIZEOF(filterName) - mir_strlen(filterName));
+ mir_strncat(filterName, "; ", _countof(filterName) - mir_strlen(filterName));
+ mir_strncat(filterName, T2Utf(accs[i]->tszAccountName), _countof(filterName) - mir_strlen(filterName));
first = false;
}
}
diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp
index 7625191703..601dad4d04 100644
--- a/plugins/Clist_modern/src/modern_statusbar_options.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp
@@ -241,14 +241,14 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
TCHAR *align[] = { LPGENT("Left"), LPGENT("Center"), LPGENT("Right") };
- for (int i = 0; i < SIZEOF(align); i++)
+ for (int i = 0; i < _countof(align); i++)
SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateTS(align[i]));
SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
}
{
TCHAR *align[] = { LPGENT("Top"), LPGENT("Center"), LPGENT("Bottom") };
- for (int i = 0; i < SIZEOF(align); i++)
+ for (int i = 0; i < _countof(align); i++)
SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateTS(align[i]));
SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
}
@@ -403,25 +403,25 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
StatusBarProtocolOptions *sbpo = (StatusBarProtocolOptions*)SendMessage(hwndComboBox, CB_GETITEMDATA, i, 0);
char settingBuf[256];
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarAccountIsCustom_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "SBarAccountIsCustom_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->AccountIsCustomized);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "HideAccount_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "HideAccount_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->HideAccount);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarShow_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "SBarShow_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->SBarShow);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarRightClk_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "SBarRightClk_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->SBarRightClk);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "UseConnectingIcon_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "UseConnectingIcon_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->UseConnectingIcon);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "ShowUnreadEmails_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "ShowUnreadEmails_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, (BYTE)sbpo->ShowUnreadEmails);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "ShowXStatus_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "ShowXStatus_%s", sbpo->szName);
db_set_b(NULL, "CLUI", settingBuf, sbpo->ShowXStatus);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "PaddingLeft_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "PaddingLeft_%s", sbpo->szName);
db_set_dw(NULL, "CLUI", settingBuf, sbpo->PaddingLeft);
- mir_snprintf(settingBuf, SIZEOF(settingBuf), "PaddingRight_%s", sbpo->szName);
+ mir_snprintf(settingBuf, _countof(settingBuf), "PaddingRight_%s", sbpo->szName);
db_set_dw(NULL, "CLUI", settingBuf, sbpo->PaddingRight);
}
diff --git a/plugins/Clist_modern/src/modern_sync.cpp b/plugins/Clist_modern/src/modern_sync.cpp
index 68b0927bad..8266c95660 100644
--- a/plugins/Clist_modern/src/modern_sync.cpp
+++ b/plugins/Clist_modern/src/modern_sync.cpp
@@ -84,7 +84,7 @@ int SyncCall(void * vproc, int count, ...)
int i;
params[0] = (LPARAM)count;
va_start(va, count);
- for (i = 0; i < count && i < SIZEOF(params) - 1; i++)
+ for (i = 0; i < count && i < _countof(params) - 1; i++)
params[i + 1] = va_arg(va, LPARAM);
va_end(va);
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp
index 34418e3818..dbf6a79907 100644
--- a/plugins/Clist_modern/src/modern_tbbutton.cpp
+++ b/plugins/Clist_modern/src/modern_tbbutton.cpp
@@ -101,7 +101,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint, POINT *pOffset)
if (!g_CluiData.fDisableSkinEngine) {
char szRequest[128];
/* painting */
- mir_snprintf(szRequest, SIZEOF(szRequest), "Button,ID=%s,Hovered=%s,Pressed=%s,Focused=%s",
+ mir_snprintf(szRequest, _countof(szRequest), "Button,ID=%s,Hovered=%s,Pressed=%s,Focused=%s",
bct->szButtonID, // ID
b2str(bct->stateId == PBS_HOT), // Hovered
b2str(bct->stateId == PBS_PRESSED || bct->bIsPushed == TRUE), // Pressed
@@ -239,7 +239,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_SETTEXT:
- mir_tstrncpy(bct->szText, (TCHAR*)lParam, SIZEOF(bct->szText));
+ mir_tstrncpy(bct->szText, (TCHAR*)lParam, _countof(bct->szText));
break;
case WM_SETFONT:
diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp
index 37bd25dacd..2e4cdd5ba4 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 < SIZEOF(BTNS); i++) {
+ for (int i = 0; i < _countof(BTNS); i++) {
TTBButton tbb = { 0 };
tbb.cbSize = sizeof(tbb);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index 9da5d24f42..5bd9b5db27 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -388,11 +388,11 @@ void SaveState()
if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_strncat(newProtoFilter, szTemp, SIZEOF(newProtoFilter) - mir_strlen(newProtoFilter));
- mir_strncat(newProtoFilter, "|", SIZEOF(newProtoFilter) - mir_strlen(newProtoFilter));
+ mir_strncat(newProtoFilter, szTemp, _countof(newProtoFilter) - mir_strlen(newProtoFilter));
+ mir_strncat(newProtoFilter, "|", _countof(newProtoFilter) - mir_strlen(newProtoFilter));
newProtoFilter[2047] = 0;
}
}
@@ -409,11 +409,11 @@ void SaveState()
if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_tstrncat(newGroupFilter, szTemp, SIZEOF(newGroupFilter) - mir_tstrlen(newGroupFilter));
- mir_tstrncat(newGroupFilter, _T("|"), SIZEOF(newGroupFilter) - mir_tstrlen(newGroupFilter));
+ mir_tstrncat(newGroupFilter, szTemp, _countof(newGroupFilter) - mir_tstrlen(newGroupFilter));
+ mir_tstrncat(newGroupFilter, _T("|"), _countof(newGroupFilter) - mir_tstrlen(newGroupFilter));
newGroupFilter[2047] = 0;
}
}
@@ -499,7 +499,7 @@ static void UpdateFilters()
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szTempBuf);
T2Utf szBuf(szTempBuf);
- mir_strncpy(g_szModename, szBuf, SIZEOF(g_szModename));
+ mir_strncpy(g_szModename, szBuf, _countof(g_szModename));
mir_sntprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf);
SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
@@ -532,12 +532,12 @@ static void UpdateFilters()
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp);
+ mir_snprintf(szMask, _countof(szMask), "%s|", szTemp);
if (szPF && strstr(szPF, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -553,14 +553,14 @@ static void UpdateFilters()
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_sntprintf(szMask, SIZEOF(szMask), _T("%s|"), szTemp);
+ mir_sntprintf(szMask, _countof(szMask), _T("%s|"), szTemp);
if (szGF && _tcsstr(szGF, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -770,7 +770,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TCHAR szBuf[256];
szBuf[0] = 0;
- GetDlgItemText(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf));
+ GetDlgItemText(hwndDlg, IDC_NEWVIEMODE, szBuf, _countof(szBuf));
szBuf[255] = 0;
if (szBuf[0] != 0) {
@@ -1262,8 +1262,8 @@ void ApplyViewMode(const char *Name, bool onlySelector)
mir_snprintf(szSetting, "%c%s_PF", 246, Name);
if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_strlen(dbv.pszVal) >= 2) {
- mir_strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
- g_CluiData.protoFilter[SIZEOF(g_CluiData.protoFilter) - 1] = 0;
+ mir_strncpy(g_CluiData.protoFilter, dbv.pszVal, _countof(g_CluiData.protoFilter));
+ g_CluiData.protoFilter[_countof(g_CluiData.protoFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_PROTOS;
}
mir_free(dbv.pszVal);
@@ -1271,8 +1271,8 @@ void ApplyViewMode(const char *Name, bool onlySelector)
mir_snprintf(szSetting, "%c%s_GF", 246, Name);
if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_tstrlen(dbv.ptszVal) >= 2) {
- mir_tstrncpy(g_CluiData.groupFilter, dbv.ptszVal, SIZEOF(g_CluiData.groupFilter));
- g_CluiData.groupFilter[SIZEOF(g_CluiData.groupFilter) - 1] = 0;
+ mir_tstrncpy(g_CluiData.groupFilter, dbv.ptszVal, _countof(g_CluiData.groupFilter));
+ g_CluiData.groupFilter[_countof(g_CluiData.groupFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_GROUPS;
}
mir_free(dbv.ptszVal);
@@ -1294,7 +1294,7 @@ void ApplyViewMode(const char *Name, bool onlySelector)
if (g_CluiData.filterFlags & CLVM_AUTOCLEAR) {
mir_snprintf(szSetting, "%c%s_OPT", 246, Name);
DWORD timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
- mir_strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, SIZEOF(g_CluiData.old_viewmode));
+ mir_strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, _countof(g_CluiData.old_viewmode));
g_CluiData.old_viewmode[255] = 0;
CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
}
@@ -1302,7 +1302,7 @@ void ApplyViewMode(const char *Name, bool onlySelector)
mir_snprintf(szSetting, "%c_LastMode", 246);
db_set_s(NULL, CLVM_MODULE, szSetting, Name);
}
- mir_strncpy(g_CluiData.current_viewmode, Name, SIZEOF(g_CluiData.current_viewmode));
+ mir_strncpy(g_CluiData.current_viewmode, Name, _countof(g_CluiData.current_viewmode));
g_CluiData.current_viewmode[255] = 0;
if (g_CluiData.filterFlags & CLVM_USELASTMSG) {
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index a87419a58c..0bd79d24c2 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -45,7 +45,7 @@ static int g_index = -1;
static void InitDefaultButtons()
{
- for (int i = 0; i < SIZEOF(BTNS); i++) {
+ for (int i = 0; i < _countof(BTNS); i++) {
TTBButton tbb = { sizeof(tbb) };
g_index = i;
@@ -72,7 +72,7 @@ static void InitDefaultButtons()
void ClcSetButtonState(int ctrlid, int status)
{
- for (int i = 0; i < SIZEOF(BTNS); i++)
+ for (int i = 0; i < _countof(BTNS); i++)
if (BTNS[i].ctrlid == ctrlid) {
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)BTNS[i].hButton, status ? TTBST_PUSHED : 0);
break;
@@ -81,7 +81,7 @@ void ClcSetButtonState(int ctrlid, int status)
HWND ClcGetButtonWindow(int ctrlid)
{
- for (int i = 0; i < SIZEOF(BTNS); i++)
+ for (int i = 0; i < _countof(BTNS); i++)
if (BTNS[i].ctrlid == ctrlid)
return BTNS[i].hwndButton;
@@ -90,7 +90,7 @@ HWND ClcGetButtonWindow(int ctrlid)
int ClcGetButtonId(HWND hwnd)
{
- for (int i = 0; i < SIZEOF(BTNS); i++)
+ for (int i = 0; i < _countof(BTNS); i++)
if (BTNS[i].hwndButton == hwnd)
return BTNS[i].ctrlid;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index dba83c3b88..e4cc7df2c4 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -476,7 +476,7 @@ int LocateStorePosition(int Frameid, int maxstored)
for (int i = 0; i < maxstored; i++) {
char settingname[255];
- mir_snprintf(settingname, SIZEOF(settingname), "Name%d", i);
+ mir_snprintf(settingname, _countof(settingname), "Name%d", i);
ptrT frmname(db_get_tsa(0, CLUIFrameModule, settingname));
if (frmname == NULL) continue;
if (mir_tstrcmpi(frmname, Frames[Frameid].name) == 0)
@@ -1772,7 +1772,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM)
if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) {
TCHAR ptszClassName[256];
- GetClassName(Frames[nFramescount].hWnd, ptszClassName, SIZEOF(ptszClassName));
+ GetClassName(Frames[nFramescount].hWnd, ptszClassName, _countof(ptszClassName));
Frames[nFramescount].name = mir_tstrdup(ptszClassName);
}
else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name);
@@ -2598,7 +2598,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
int pos = id2pos(Frameid);
if (pos != -1) {
int oldflags;
- mir_snprintf(TBcapt, SIZEOF(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
+ mir_snprintf(TBcapt, _countof(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating,
Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y,
Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y,
@@ -3085,7 +3085,7 @@ TCHAR g_ptszEventName[100];
static int CLUIFrameOnModulesLoad(WPARAM, LPARAM)
{
- mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId());
+ mir_sntprintf(g_ptszEventName, _countof(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId());
g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName);
hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL);
SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE);
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index 038344b989..c294072ba4 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -227,7 +227,7 @@ IconItemT iconItem[] = {
void InitIconLibMenuIcons(void)
{
- Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem));
+ Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem));
}
void InitGroupMenus(void)
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 87136ab986..7e73793bfc 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -418,7 +418,7 @@ LBL_Def:
ClcContact *contact;
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
RTL_DetectAndSet(contact, 0);
@@ -503,7 +503,7 @@ LBL_Def:
contact->proto = GetContactProto(wParam);
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
- mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
RTL_DetectAndSet(contact, 0);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 332632a305..c745bfac31 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -485,7 +485,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str
}
if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) {
if (!cfg::getTString(hContact, "CList", "Group", &dbv)) {
- mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[1]);
+ mir_sntprintf(szGroupMask, _countof(szGroupMask), _T("%s|"), &dbv.ptszVal[1]);
filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0));
mir_free(dbv.ptszVal);
}
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp
index eb8047691e..aa07621ba0 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -156,7 +156,7 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Automatic (RTL)"));
DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (int i = 0; i < SIZEOF(checkBoxToGroupStyleEx); i++)
+ for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToGroupStyleEx[i].id, (exStyle & checkBoxToGroupStyleEx[i].flag) ^ (checkBoxToGroupStyleEx[i].flag * checkBoxToGroupStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOGROUPICON, (cfg::dat.dwFlags & CLUI_FRAME_NOGROUPICON) ? BST_CHECKED : BST_UNCHECKED);
@@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam,
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
- for (int i = 0; i < SIZEOF(checkBoxToGroupStyleEx); i++) {
+ for (int i = 0; i < _countof(checkBoxToGroupStyleEx); i++) {
if ((IsDlgButtonChecked(hwndDlg, checkBoxToGroupStyleEx[i].id) == 0) == checkBoxToGroupStyleEx[i].not_t)
exStyle |= checkBoxToGroupStyleEx[i].flag;
else
@@ -599,10 +599,10 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
DWORD exStyle = cfg::getDword("CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM)&accel);
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
- for (int i = 0; i < SIZEOF(checkBoxToStyleEx); i++)
+ for (int i = 0; i < _countof(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag * checkBoxToStyleEx[i].not_t) ? BST_CHECKED : BST_UNCHECKED);
}
CheckDlgButton(hwndDlg, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED);
@@ -744,8 +744,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_COMMAND:
if (LOWORD(wParam) == IDC_BROWSE) {
TCHAR str[MAX_PATH], filter[512];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("bmp");
if (!GetOpenFileName(&ofn))
@@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
cfg::writeByte("CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR));
char str[MAX_PATH], strrel[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, _countof(str));
if (PathToRelative(str, strrel))
cfg::writeString(NULL, "CLC", "BkBitmap", strrel);
else
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 6f8ee502a7..4dd4748b27 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -1110,7 +1110,7 @@ bgskipped:
int fHeight = 0;
TCHAR szResult[80];
- if (TimeZone_PrintDateTime(cEntry->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0))
+ if (TimeZone_PrintDateTime(cEntry->hTimeZone, _T("t"), szResult, _countof(szResult), 0))
goto nodisplay;
COLORREF oldColor = GetTextColor(hdcMem);
@@ -1501,7 +1501,7 @@ bgdone:
pts[5].x = pts[2].x + 1; pts[5].y = pts[1].y + 2;
pts[6].x = pts[1].x; pts[6].y = pts[5].y;
pts[7].x = pts[0].x; pts[7].y = pts[4].y;
- HRGN hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ HRGN hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush);
FillRgn(hdcMem, hRgn, hBrush);
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp
index 26be09aaac..bb19f80c8e 100644
--- a/plugins/Clist_nicer/src/clistmod.cpp
+++ b/plugins/Clist_nicer/src/clistmod.cpp
@@ -66,7 +66,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON
if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) {
if (szProto) {
char szBuf[128];
- mir_snprintf(szBuf, SIZEOF(szBuf), "%s_conn", szProto);
+ mir_snprintf(szBuf, _countof(szBuf), "%s_conn", szProto);
*phIcon = IcoLib_GetIcon(szBuf);
}
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 3561a641f8..94dddfd150 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -247,18 +247,18 @@ static void CacheClientIcons()
for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
char szBuffer[128];
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
+ mir_snprintf(szBuffer, _countof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
overlayicons[i - IDI_OVL_OFFLINE] = IcoLib_GetIcon(szBuffer);
}
}
static void InitIcoLib()
{
- Icon_Register(g_hInst, LPGEN("Contact list")"/"LPGEN("Default"), myIcons, SIZEOF(myIcons));
+ Icon_Register(g_hInst, LPGEN("Contact list")"/"LPGEN("Default"), myIcons, _countof(myIcons));
for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
char szBuffer[128];
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
+ mir_snprintf(szBuffer, _countof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
IconItemT icon = { pcli->pfnGetStatusModeDescription(ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE), GSMDF_TCHAR), szBuffer, i };
Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Overlay icons"), &icon, 1);
}
@@ -271,7 +271,7 @@ static void InitIcoLib()
continue;
TCHAR szDescr[128];
- mir_sntprintf(szDescr, SIZEOF(szDescr), TranslateT("%s connecting"), accs[k]->tszAccountName);
+ mir_sntprintf(szDescr, _countof(szDescr), TranslateT("%s connecting"), accs[k]->tszAccountName);
IconItemT icon = { szDescr, "conn", IDI_PROTOCONNECTING };
Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Connecting icons"), &icon, 1, accs[k]->szModuleName);
}
@@ -1424,7 +1424,7 @@ skipbg:
if (serviceFailure) {
char szError[512];
- mir_snprintf(szError, SIZEOF(szError), Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins."), item->szService, item->szName);
+ mir_snprintf(szError, _countof(szError), Translate("The service %s specified by the %s button definition was not found. You may need to install additional plugins."), item->szService, item->szName);
MessageBoxA(0, szError, Translate("Service failure"), MB_OK);
}
break;
@@ -1685,7 +1685,7 @@ buttons_done:
if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE) {
char szBuffer[128];
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_conn", pd->RealName);
+ mir_snprintf(szBuffer, _countof(szBuffer), "%s_conn", pd->RealName);
hIcon = IcoLib_GetIcon(szBuffer);
}
else if (cfg::dat.bShowXStatusOnSbar && status > ID_STATUS_OFFLINE) {
@@ -1733,8 +1733,8 @@ buttons_done:
TCHAR szName[64];
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
- mir_tstrncpy(szName, pa->tszAccountName, SIZEOF(szName));
- szName[SIZEOF(szName) - 1] = 0;
+ mir_tstrncpy(szName, pa->tszAccountName, _countof(szName));
+ szName[_countof(szName) - 1] = 0;
}
else
szName[0] = 0;
@@ -2012,12 +2012,12 @@ static clistFontDescr[] =
void FS_RegisterFonts()
{
FontIDT fid = { sizeof(fid) };
- _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group));
+ _tcsncpy(fid.group, LPGENT("Contact list"), _countof(fid.group));
strncpy(fid.dbSettingsGroup, "CLC", 5);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE;
HDC hdc = GetDC(NULL);
- for (int i = 0; i < SIZEOF(clistFontDescr); i++) {
+ for (int i = 0; i < _countof(clistFontDescr); i++) {
LOGFONT lf;
pcli->pfnGetFontSetting(i, &lf, &fid.deffontsettings.colour);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
@@ -2030,11 +2030,11 @@ void FS_RegisterFonts()
fid.flags &= ~FIDF_CLASSMASK;
fid.flags |= clistFontDescr[i].iMask;
- _tcsncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name));
+ _tcsncpy(fid.name, clistFontDescr[i].tszName, _countof(fid.name));
char idstr[10];
mir_snprintf(idstr, "Font%d", i);
- strncpy(fid.prefix, idstr, SIZEOF(fid.prefix));
+ strncpy(fid.prefix, idstr, _countof(fid.prefix));
fid.order = i;
FontRegisterT(&fid);
}
@@ -2047,32 +2047,32 @@ void FS_RegisterFonts()
strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
strncpy(colourid.setting, "BkColour", sizeof(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
- _tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group));
+ _tcsncpy(colourid.name, LPGENT("Background"), _countof(colourid.name));
+ _tcsncpy(colourid.group, LPGENT("Contact list"), _countof(colourid.group));
colourid.defcolour = CLCDEFAULT_BKCOLOUR;
ColourRegisterT(&colourid);
strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name));
+ _tcsncpy(colourid.name, LPGENT("Selected text"), _countof(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR;
ColourRegisterT(&colourid);
strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name));
+ _tcsncpy(colourid.name, LPGENT("Hottrack text"), _countof(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR;
ColourRegisterT(&colourid);
strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name));
+ _tcsncpy(colourid.name, LPGENT("Quicksearch text"), _countof(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR;
ColourRegisterT(&colourid);
strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup));
strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Embedded frames border"), SIZEOF(colourid.name));
+ _tcsncpy(colourid.name, LPGENT("Embedded frames border"), _countof(colourid.name));
colourid.order = 1;
colourid.defcolour = RGB(40, 40, 40);
ColourRegisterT(&colourid);
diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp
index 7fac4e76ba..3bdd48aeb9 100644
--- a/plugins/Clist_nicer/src/cluiopts.cpp
+++ b/plugins/Clist_nicer/src/cluiopts.cpp
@@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
TCHAR title[256];
- GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title));
+ GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
cfg::writeTString(NULL, "CList", "TitleText", title);
SetWindowText(pcli->hwndContactList, title);
}
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 906ebbf6aa..351e4073c4 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -33,7 +33,7 @@ static INT_PTR GetClistVersion(WPARAM, LPARAM lParam)
{
static char g_szVersionString[256];
- mir_snprintf(g_szVersionString, SIZEOF(g_szVersionString), "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version)));
+ mir_snprintf(g_szVersionString, _countof(g_szVersionString), "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version)));
if (!IsBadWritePtr((LPVOID)lParam, 4))
*((DWORD *)lParam) = pluginInfo.version;
@@ -133,8 +133,8 @@ void CluiProtocolStatusChanged(int, const char*)
if (showOpts & 1)
x += 16;
if (showOpts & 2) {
- mir_tstrncpy(szName, pa->tszAccountName, SIZEOF(szName));
- szName[SIZEOF(szName) - 1] = 0;
+ mir_tstrncpy(szName, pa->tszAccountName, _countof(szName));
+ szName[_countof(szName) - 1] = 0;
if ((showOpts & 4) && mir_tstrlen(szName) < sizeof(szName) - 1)
mir_tstrcat(szName, _T(" "));
GetTextExtentPoint32(hdc, szName, (int)mir_tstrlen(szName), &textSize);
@@ -211,7 +211,7 @@ void CluiProtocolStatusChanged(int, const char*)
iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int)wStatus, 0, &hIcon);
g_maxStatus = (int)wStatus;
if (szMaxProto)
- strncpy_s(g_maxProto, SIZEOF(g_maxProto), szMaxProto, _TRUNCATE);
+ strncpy_s(g_maxProto, _countof(g_maxProto), szMaxProto, _TRUNCATE);
}
/*
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp
index b7163ef979..ba013a2202 100644
--- a/plugins/Clist_nicer/src/config.cpp
+++ b/plugins/Clist_nicer/src/config.cpp
@@ -253,13 +253,13 @@ INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM)
case WM_INITDIALOG: {
char szBuffer[2048];
#ifdef _WIN64
- mir_snprintf(szBuffer, SIZEOF(szBuffer),
+ mir_snprintf(szBuffer, _countof(szBuffer),
"Exception %16.16X at address %16.16X occured in %s at line %d.\r\n\r\nEAX=%16.16X EBX=%16.16X ECX=%16.16X\r\nEDX=%16.16X ESI=%16.16X EDI=%16.16X\r\nEBP=%16.16X ESP=%16.16X EIP=%16.16X",
exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine,
exCtx.Rax, exCtx.Rbx, exCtx.Rcx, exCtx.Rdx,
exCtx.Rsi, exCtx.Rdi, exCtx.Rbp, exCtx.Rsp, exCtx.Rip);
#else
- mir_snprintf(szBuffer, SIZEOF(szBuffer),
+ mir_snprintf(szBuffer, _countof(szBuffer),
"Exception %8.8X at address %8.8X occured in %s at line %d.\r\n\r\nEAX=%8.8X EBX=%8.8X ECX=%8.8X\r\nEDX=%8.8X ESI=%8.8X EDI=%8.8X\r\nEBP=%8.8X ESP=%8.8X EIP=%8.8X",
exRecord.ExceptionCode, exRecord.ExceptionAddress, exSzFile, exLine,
exCtx.Eax,exCtx.Ebx, exCtx.Ecx, exCtx.Edx,
@@ -303,8 +303,8 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, TCH
memcpy(&exRecord, ep->ExceptionRecord, sizeof(EXCEPTION_RECORD));
memcpy(&exCtx, ep->ContextRecord, sizeof(CONTEXT));
- mir_snprintf(exSzFile, SIZEOF(exSzFile), "%s%s", szName, szExt);
- mir_sntprintf(exReason, SIZEOF(exReason), _T("An application error has occured: %s"), szReason);
+ mir_snprintf(exSzFile, _countof(exSzFile), "%s%s", szName, szExt);
+ mir_sntprintf(exReason, _countof(exReason), _T("An application error has occured: %s"), szReason);
exLine = line;
exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0);
exAllowContinue = fAllowContinue;
@@ -370,7 +370,7 @@ void CRTException::display() const
TCHAR *tszMsg = mir_a2t(what());
TCHAR tszBoxMsg[500];
- mir_sntprintf(tszBoxMsg, SIZEOF(tszBoxMsg), _T("%s\n\n(%s)"), tszMsg, m_szParam);
+ mir_sntprintf(tszBoxMsg, _countof(tszBoxMsg), _T("%s\n\n(%s)"), tszMsg, m_szParam);
::MessageBox(0, tszBoxMsg, _T("Clist_nicer runtime error"), MB_OK | MB_ICONERROR);
mir_free(tszMsg);
}
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 4349b1130d..937a550431 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -260,7 +260,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto)
if (szProto == NULL)
return NULL;
- for (int i = SIZEOF(_StatusItems); i < arStatusItems.getCount(); i++) {
+ 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;
@@ -272,7 +272,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto)
void LoadExtBkSettingsFromDB()
{
int i, n;
- for (i = 0; i < SIZEOF(_StatusItems); i++) {
+ for (i = 0; i < _countof(_StatusItems); i++) {
StatusItems_t *p = (StatusItems_t*)mir_alloc(sizeof(StatusItems_t));
*p = _StatusItems[i];
arStatusItems.insert(p);
@@ -287,9 +287,9 @@ void LoadExtBkSettingsFromDB()
*p = _StatusItems[0];
ID_EXTBK_LAST++;
- mir_snprintf(p->szDBname, SIZEOF(p->szDBname), "EXBK_%s", accs[i]->szModuleName);
+ mir_snprintf(p->szDBname, _countof(p->szDBname), "EXBK_%s", accs[i]->szModuleName);
if (i == 0)
- mir_snprintf(p->szName, SIZEOF(p->szName), "{-}%s", accs[i]->szModuleName);
+ mir_snprintf(p->szName, _countof(p->szName), "{-}%s", accs[i]->szModuleName);
else
strncpy_s(p->szName, accs[i]->szModuleName, _TRUNCATE);
p->statusID = ID_EXTBK_LAST;
@@ -487,34 +487,34 @@ void extbk_export(char *file)
}
for (n = 0; n <= FONTID_LAST; n++) {
- mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n);
+ mir_snprintf(szSection, _countof(szSection), "Font%d", n);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dName", n);
if (!cfg::getString(NULL, "CLC", szKey, &dbv)) {
WritePrivateProfileStringA(szSection, "Name", dbv.pszVal, file);
mir_free(dbv.pszVal);
}
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSize", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Size", &data, 1, file);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSty", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Style", &data, 1, file);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSet", n);
data = (DWORD)cfg::getByte("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Set", &data, 1, file);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dCol", n);
data = cfg::getDword("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Color", &data, 4, file);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dFlags", n);
data = (DWORD)cfg::getDword("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Flags", &data, 4, file);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dAs", n);
data = (DWORD)cfg::getWord("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "SameAs", &data, 2, file);
}
@@ -700,12 +700,12 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file)
this_item->ALPHA = min(this_item->ALPHA, 100);
clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR));
- mir_snprintf(def_color, SIZEOF(def_color), "%6.6x", clr);
+ mir_snprintf(def_color, _countof(def_color), "%6.6x", clr);
GetPrivateProfileStringA(szItem, "Color1", def_color, buffer, 400, file);
this_item->COLOR = HexStringToLong(buffer);
clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2));
- mir_snprintf(def_color, SIZEOF(def_color), "%6.6x", clr);
+ mir_snprintf(def_color, _countof(def_color), "%6.6x", clr);
GetPrivateProfileStringA(szItem, "Color2", def_color, buffer, 400, file);
this_item->COLOR2 = HexStringToLong(buffer);
@@ -777,7 +777,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);
- mir_snprintf(szFinalName, SIZEOF(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer);
+ mir_snprintf(szFinalName, _countof(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer);
tmpItem.alpha = GetPrivateProfileIntA(itemname, "Alpha", 100, szFileName);
tmpItem.alpha = min(tmpItem.alpha, 100);
tmpItem.alpha = (BYTE)((FLOAT)(((FLOAT)tmpItem.alpha) / 100) * 255);
@@ -853,7 +853,7 @@ done_with_glyph:
goto imgread_done;
}
for (n = 0;; n++) {
- mir_snprintf(szItemNr, SIZEOF(szItemNr), "Item%d", n);
+ mir_snprintf(szItemNr, _countof(szItemNr), "Item%d", n);
GetPrivateProfileStringA(itemname, szItemNr, "None", buffer, 500, szFileName);
if (!mir_strcmp(buffer, "None"))
break;
@@ -1274,7 +1274,7 @@ void LoadPerContactSkins(TCHAR *tszFileName)
char UIN[40];
switch (dbv.type) {
case DBVT_DWORD:
- mir_snprintf(UIN, SIZEOF(UIN), "%d", dbv.dVal);
+ mir_snprintf(UIN, _countof(UIN), "%d", dbv.dVal);
break;
case DBVT_ASCIIZ:
strncpy_s(UIN, dbv.pszVal, _TRUNCATE);
@@ -1363,38 +1363,38 @@ void extbk_import(char *file, HWND hwndDlg)
GetPrivateProfileStructA("Global", "Version", &version, 4, file);
if (version >= 2) {
for (n = 0; n <= FONTID_LAST; n++) {
- mir_snprintf(szSection, SIZEOF(szSection), "Font%d", n);
+ mir_snprintf(szSection, _countof(szSection), "Font%d", n);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dName", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dName", n);
GetPrivateProfileStringA(szSection, "Name", "Arial", buffer, sizeof(buffer), file);
cfg::writeString(NULL, "CLC", szKey, buffer);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSize", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSize", n);
data = 0;
GetPrivateProfileStructA(szSection, "Size", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSty", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSty", n);
data = 0;
GetPrivateProfileStructA(szSection, "Style", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dSet", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dSet", n);
data = 0;
GetPrivateProfileStructA(szSection, "Set", &data, 1, file);
cfg::writeByte("CLC", szKey, (BYTE)data);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dCol", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dCol", n);
data = 0;
GetPrivateProfileStructA(szSection, "Color", &data, 4, file);
cfg::writeDword("CLC", szKey, data);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dFlags", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dFlags", n);
data = 0;
GetPrivateProfileStructA(szSection, "Flags", &data, 4, file);
cfg::writeDword("CLC", szKey, (WORD)data);
- mir_snprintf(szKey, SIZEOF(szKey), "Font%dAs", n);
+ mir_snprintf(szKey, _countof(szKey), "Font%dAs", n);
data = 0;
GetPrivateProfileStructA(szSection, "SameAs", &data, 2, file);
cfg::writeDword("CLC", szKey, (WORD)data);
@@ -1563,7 +1563,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
case IDC_RELOAD:
TCHAR tszFilename[MAX_PATH], tszFinalPath[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, SIZEOF(tszFilename));
+ GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, _countof(tszFilename));
tszFilename[MAX_PATH - 1] = 0;
MY_pathToAbsolute(tszFilename, tszFinalPath);
if (PathFileExists(tszFinalPath)) {
@@ -1666,7 +1666,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "clist";
if (!GetSaveFileNameA(&ofn))
@@ -1684,7 +1684,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "";
if (!GetOpenFileNameA(&ofn))
diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp
index aee0daaf58..a7eb1b83cb 100644
--- a/plugins/Clist_nicer/src/rowheight_funcs.cpp
+++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp
@@ -95,7 +95,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd)
int other_fonts[] = { FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS };
// Get contact font size
- for (i = 0; i < SIZEOF(contact_fonts); i++)
+ for (i = 0; i < _countof(contact_fonts); i++)
if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight)
max_height = dat->fontInfo[contact_fonts[i]].fontHeight;
@@ -103,7 +103,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd)
max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight;
// Get other font sizes
- for (i = 0; i < SIZEOF(other_fonts); i++) {
+ for (i = 0; i < _countof(other_fonts); i++) {
if (max_height < dat->fontInfo[other_fonts[i]].fontHeight)
max_height = dat->fontInfo[other_fonts[i]].fontHeight;
}
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp
index 52a96f8b7d..774e193a8d 100644
--- a/plugins/Clist_nicer/src/statusbar.cpp
+++ b/plugins/Clist_nicer/src/statusbar.cpp
@@ -160,7 +160,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
BYTE isLocked = cfg::getByte(PD->RealName, "LockMainStatus", 0);
TCHAR szTipText[256];
- mir_sntprintf(szTipText, SIZEOF(szTipText), _T("<b>%s</b>: %s%s"),
+ mir_sntprintf(szTipText, _countof(szTipText), _T("<b>%s</b>: %s%s"),
PD->RealName, pcli->pfnGetStatusModeDescription(wStatus, 0), isLocked ? _T(" (LOCKED)") : _T(""));
CLCINFOTIP ti = { sizeof(ti) };
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 3a89f5c938..c19d607890 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -342,7 +342,7 @@ void SaveState()
if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
@@ -364,7 +364,7 @@ void SaveState()
if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
@@ -475,12 +475,12 @@ void UpdateFilters()
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp);
+ mir_snprintf(szMask, _countof(szMask), "%s|", szTemp);
if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -497,14 +497,14 @@ void UpdateFilters()
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = SIZEOF(szTemp);
+ item.cchTextMax = _countof(szTemp);
ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- mir_sntprintf(szMask, SIZEOF(szMask), _T("%s|"), szTemp);
+ mir_sntprintf(szMask, _countof(szMask), _T("%s|"), szTemp);
if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask))
ListView_SetCheckState(hwndList, i, TRUE)
else
@@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP
char szBuf[256];
szBuf[0] = 0;
- GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf));
+ GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, _countof(szBuf));
szBuf[255] = 0;
if (mir_strlen(szBuf) > 2) {
@@ -883,7 +883,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_USER + 100:
{
bool bSkinned = cfg::getByte("CLCExt", "bskinned", 0) != 0;
- for (int i = 0; i < SIZEOF(_buttons); i++) {
+ for (int i = 0; i < _countof(_buttons); i++) {
HWND hwndButton = GetDlgItem(hwnd, _buttons[i].btn_id);
SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(_buttons[i].icon));
CustomizeButton(hwndButton, bSkinned, !bSkinned, bSkinned);
@@ -1060,8 +1060,8 @@ void ApplyViewMode(const char *name)
mir_snprintf(szSetting, "%c%s_GF", 246, name);
if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_tstrlen(dbv.ptszVal) >= 2) {
- _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter));
- cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0;
+ _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, _countof(cfg::dat.groupFilter));
+ cfg::dat.groupFilter[_countof(cfg::dat.groupFilter) - 1] = 0;
cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
}
mir_free(dbv.ptszVal);
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp
index 59b0ce634c..9331e01ffe 100644
--- a/plugins/CmdLine/src/utils.cpp
+++ b/plugins/CmdLine/src/utils.cpp
@@ -210,17 +210,17 @@ char* GetContactID(MCONTACT hContact, char *szProto)
char tmp[16];
switch (ctInfo.type) {
case CNFT_BYTE:
- mir_snprintf(tmp, SIZEOF(tmp), "%d", ctInfo.bVal);
+ mir_snprintf(tmp, _countof(tmp), "%d", ctInfo.bVal);
buffer = strdup(tmp);
break;
case CNFT_WORD:
- mir_snprintf(tmp, SIZEOF(tmp), "%d", ctInfo.wVal);
+ mir_snprintf(tmp, _countof(tmp), "%d", ctInfo.wVal);
buffer = strdup(tmp);
break;
case CNFT_DWORD:
- mir_snprintf(tmp, SIZEOF(tmp), "%ld", ctInfo.dVal);
+ mir_snprintf(tmp, _countof(tmp), "%ld", ctInfo.dVal);
buffer = strdup(tmp);
break;
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 2d458a31d3..2f787d6f39 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -197,16 +197,16 @@ void fillExceptionsListView(HWND hwndDlg)
ListView_InsertItem(hwndList, &lvI);
lvI.iSubItem = 1;
if (tmp->intIntPort == -1)
- mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:*"), tmp->strIntIp);
+ mir_sntprintf(tmpAddress, _countof(tmpAddress), _T("%s:*"), tmp->strIntIp);
else
- mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:%d"), tmp->strIntIp, tmp->intIntPort);
+ mir_sntprintf(tmpAddress, _countof(tmpAddress), _T("%s:%d"), tmp->strIntIp, tmp->intIntPort);
lvI.pszText = tmpAddress;
ListView_SetItem(hwndList, &lvI);
lvI.iSubItem = 2;
if (tmp->intExtPort == -1)
- mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:*"), tmp->strExtIp);
+ mir_sntprintf(tmpAddress, _countof(tmpAddress), _T("%s:*"), tmp->strExtIp);
else
- mir_sntprintf(tmpAddress, SIZEOF(tmpAddress), _T("%s:%d"), tmp->strExtIp, tmp->intExtPort);
+ mir_sntprintf(tmpAddress, _countof(tmpAddress), _T("%s:%d"), tmp->strExtIp, tmp->intExtPort);
lvI.pszText = tmpAddress;
ListView_SetItem(hwndList, &lvI);
lvI.iSubItem = 3;
@@ -252,20 +252,20 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L
case ID_OK:
{
TCHAR tmpPort[6];
- GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, _countof(tmpPort));
if (tmpPort[0] == '*')
connCurrentEditModal->intIntPort = -1;
else
connCurrentEditModal->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort));
+ 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);
- GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, SIZEOF(connCurrentEditModal->strIntIp));
- GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, SIZEOF(connCurrentEditModal->strExtIp));
- GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, SIZEOF(connCurrentEditModal->PName));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, _countof(connCurrentEditModal->strIntIp));
+ GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, _countof(connCurrentEditModal->strExtIp));
+ GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, _countof(connCurrentEditModal->PName));
connCurrentEditModal->Pid = !(BOOL)SendDlgItemMessage(hWnd, ID_CBO_ACTION, CB_GETCURSEL, 0, 0);
@@ -303,7 +303,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
bOptionsOpen = TRUE;
TranslateDialogDefault(hwndDlg);//translate miranda function
#ifdef _WIN64
- mir_sntprintf(buff,SIZEOF(buff),_T("%d.%d.%d.%d/64"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
+ mir_sntprintf(buff,_countof(buff),_T("%d.%d.%d.%d/64"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
#else
mir_sntprintf(buff, _T("%d.%d.%d.%d/32"), HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOWORD(pluginInfo.version)));
#endif
@@ -717,10 +717,10 @@ static unsigned __stdcall checkthread(void *)
#ifdef _DEBUG
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), _T("%s:%d\n%s:%d"), cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort);
+ mir_sntprintf(msg, _countof(msg), _T("%s:%d\n%s:%d"), cur->strIntIp, cur->intIntPort, cur->strExtIp, cur->intExtPort);
_OutputDebugString(_T("New connection: %s"), msg);
#endif
- pid2name(cur->Pid, cur->PName, SIZEOF(cur->PName));
+ pid2name(cur->Pid, cur->PName, _countof(cur->PName));
if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100))
{
if (checkFilter(connExceptions, cur))
@@ -798,12 +798,12 @@ void showMsg(TCHAR *pName, DWORD pid, TCHAR *intIp, TCHAR *extIp, int intPort, i
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
TCHAR hostName[128];
- getDnsName(extIp, hostName, SIZEOF(hostName));
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s:%d\n%s:%d"), hostName, extPort, intIp, intPort);
+ getDnsName(extIp, hostName, _countof(hostName));
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), _T("%s:%d\n%s:%d"), hostName, extPort, intIp, intPort);
}
- else mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s:%d\n%s:%d"), extIp, extPort, intIp, intPort);
+ else mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), _T("%s:%d\n%s:%d"), extIp, extPort, intIp, intPort);
- mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), _T("%s (%s)"), pName, tcpStates[state - 1]);
+ mir_sntprintf(ppd.lptzContactName, _countof(ppd.lptzContactName), _T("%s (%s)"), pName, tcpStates[state - 1]);
if (settingSetColours) {
ppd.colorBack = settingBgColor;
diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp
index b35421de9e..892da06cf3 100644
--- a/plugins/ConnectionNotify/src/debug.cpp
+++ b/plugins/ConnectionNotify/src/debug.cpp
@@ -27,7 +27,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...)
case 's':
{
TCHAR* s = va_arg(argptr, TCHAR *);
- mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s);
+ mir_sntprintf(OutMsg, _countof(OutMsg), format, s);
_tcsncpy(format, OutMsg, _countof(OutMsg));
j = (int)mir_tstrlen(format);
mir_tstrcat(format, _T(" "));
@@ -37,7 +37,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...)
case 'c':
{
char c = (char)va_arg(argptr, int);
- mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c);
+ mir_sntprintf(OutMsg, _countof(OutMsg), format, c);
_tcsncpy(format, OutMsg, _countof(OutMsg));
j = (int)mir_tstrlen(format);
mir_tstrcat(format, _T(" "));
@@ -47,7 +47,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...)
case 'd':
{
int d = va_arg(argptr, int);
- mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d);
+ mir_sntprintf(OutMsg, _countof(OutMsg), format, d);
_tcsncpy(format, OutMsg, _countof(OutMsg));
j = (int)mir_tstrlen(format);
mir_tstrcat(format, _T(" "));
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp
index f825ac9dba..3c99603852 100644
--- a/plugins/ConnectionNotify/src/filter.cpp
+++ b/plugins/ConnectionNotify/src/filter.cpp
@@ -85,20 +85,20 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM
connCurrentEdit->next = connExceptions;
connExceptions = connCurrentEdit;
}
- GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, _countof(tmpPort));
if (tmpPort[0] == '*')
connCurrentEdit->intIntPort = -1;
else
connCurrentEdit->intIntPort = GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort));
+ 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);
- GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, SIZEOF(connCurrentEdit->strIntIp));
- GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, SIZEOF(connCurrentEdit->strExtIp));
- GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, SIZEOF(connCurrentEdit->PName));
+ 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;
diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp
index 8f0eaa2155..a12dfb0837 100644
--- a/plugins/ConnectionNotify/src/netstat.cpp
+++ b/plugins/ConnectionNotify/src/netstat.cpp
@@ -42,14 +42,14 @@ struct CONNECTION *GetConnectionsTable()
IpAddr.S_un.S_addr = (ULONG)pTcpTable->table[i].dwLocalAddr;
//_snprintf(newConn->strIntIp,_countof(newConn->strIntIp),"%d.%d.%d.%d",IpAddr.S_un.S_un_b.s_b1,IpAddr.S_un.S_un_b.s_b2,IpAddr.S_un.S_un_b.s_b3,IpAddr.S_un.S_un_b.s_b4);
TCHAR *strIntIp = mir_a2t(inet_ntoa(IpAddr));
- _tcsncpy(newConn->strIntIp, strIntIp, SIZEOF(newConn->strIntIp) - 1);
+ _tcsncpy(newConn->strIntIp, strIntIp, _countof(newConn->strIntIp) - 1);
mir_free(strIntIp);
}
if (pTcpTable->table[i].dwRemoteAddr) {
IpAddr.S_un.S_addr = (u_long)pTcpTable->table[i].dwRemoteAddr;
TCHAR *strExtIp = mir_a2t(inet_ntoa(IpAddr));
- _tcsncpy(newConn->strExtIp, strExtIp, SIZEOF(newConn->strExtIp) - 1);
+ _tcsncpy(newConn->strExtIp, strExtIp, _countof(newConn->strExtIp) - 1);
mir_free(strExtIp);
}
newConn->state = pTcpTable->table[i].dwState;
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp
index 4ab6c325c4..12ee46ef68 100644
--- a/plugins/Console/src/Console.cpp
+++ b/plugins/Console/src/Console.cpp
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP
mir_subclassWindow(dat->hList, SubclassProc);
// init buttons
- for (int i = 0; i < SIZEOF(ctrls); i++) {
+ for (int i = 0; i < _countof(ctrls); i++) {
HWND hwnd = GetDlgItem(hwndDlg, ctrls[i].control);
SendMessage(hwnd, ctrls[i].type, 0, 0);
SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcons[i + ICON_FIRST]);
@@ -502,7 +502,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP
if (!buf) break;
while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) {
- ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText) - 1);
+ ListView_GetItemText(dat->hList, idx, 0, szText, _countof(szText) - 1);
src = szText;
while (*dst++ = *src++);
dst--;
@@ -565,7 +565,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LP
flags |= LVNI_SELECTED;
while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) {
- ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText));
+ ListView_GetItemText(dat->hList, idx, 0, szText, _countof(szText));
_ftprintf(fp, _T("%s\n"), szText);
}
fclose(fp);
@@ -628,11 +628,11 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
// restore position
Utils_RestoreWindowPosition(hwndDlg, NULL, "Console", "Console", RWPF_HIDDEN);
- CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(name), (LPARAM)name);
+ CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)name);
- CallService(MS_DB_GETPROFILEPATHT, (WPARAM)SIZEOF(path), (LPARAM)path);
+ CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)path);
- mir_sntprintf(title, SIZEOF(title), _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name);
+ mir_sntprintf(title, _countof(title), _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name);
SetWindowText(hwndDlg, title);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[0]);
@@ -953,7 +953,7 @@ static int OnFastDump(WPARAM wParam, LPARAM lParam)
TCHAR *str = dumpMsg->szMsg;
char *szModule = (wParam) ? ((NETLIBUSER *)wParam)->szDescriptiveName : "[Core]";
- mir_strncpy(dumpMsg->szModule, szModule, SIZEOF(dumpMsg->szModule));
+ mir_strncpy(dumpMsg->szModule, szModule, _countof(dumpMsg->szModule));
wchar_t *ucs2 = mir_a2u(logMsg->pszHead);
mir_wstrcpy(str, ucs2);
@@ -1115,8 +1115,8 @@ static int OnFontChange(WPARAM, LPARAM)
FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENT("Console"), SIZEOF(fid.group));
- mir_tstrncpy(fid.name, LPGENT("Text"), SIZEOF(fid.name));
+ mir_tstrncpy(fid.group, LPGENT("Console"), _countof(fid.group));
+ mir_tstrncpy(fid.name, LPGENT("Text"), _countof(fid.name));
colLogFont = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&LogFont);
@@ -1139,28 +1139,28 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM)
FontIDT fid = { 0 };
fid.cbSize = sizeof(fid);
- mir_tstrncpy(fid.group, LPGENT("Console"), SIZEOF(fid.group));
- mir_tstrncpy(fid.name, LPGENT("Text"), SIZEOF(fid.name));
- mir_strncpy(fid.dbSettingsGroup, "Console", SIZEOF(fid.dbSettingsGroup));
- mir_strncpy(fid.prefix, "ConsoleFont", SIZEOF(fid.prefix));
- mir_tstrncpy(fid.backgroundGroup, LPGENT("Console"), SIZEOF(fid.backgroundGroup));
- mir_tstrncpy(fid.backgroundName, LPGENT("Background"), SIZEOF(fid.backgroundName));
+ mir_tstrncpy(fid.group, LPGENT("Console"), _countof(fid.group));
+ mir_tstrncpy(fid.name, LPGENT("Text"), _countof(fid.name));
+ mir_strncpy(fid.dbSettingsGroup, "Console", _countof(fid.dbSettingsGroup));
+ mir_strncpy(fid.prefix, "ConsoleFont", _countof(fid.prefix));
+ mir_tstrncpy(fid.backgroundGroup, LPGENT("Console"), _countof(fid.backgroundGroup));
+ mir_tstrncpy(fid.backgroundName, LPGENT("Background"), _countof(fid.backgroundName));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.colour = RGB(0, 0, 0);
fid.deffontsettings.size = 10;
fid.deffontsettings.style = 0;
- mir_tstrncpy(fid.deffontsettings.szFace, _T("Courier"), SIZEOF(fid.deffontsettings.szFace));
+ mir_tstrncpy(fid.deffontsettings.szFace, _T("Courier"), _countof(fid.deffontsettings.szFace));
FontRegisterT(&fid);
HookEvent(ME_FONT_RELOAD, OnFontChange);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(cid);
- mir_tstrncpy(cid.group, LPGENT("Console"), SIZEOF(cid.group));
- mir_tstrncpy(cid.name, LPGENT("Background"), SIZEOF(cid.name));
- mir_strncpy(cid.dbSettingsGroup, "Console", SIZEOF(cid.dbSettingsGroup));
- mir_strncpy(cid.setting, "BgColor", SIZEOF(cid.setting));
+ mir_tstrncpy(cid.group, LPGENT("Console"), _countof(cid.group));
+ mir_tstrncpy(cid.name, LPGENT("Background"), _countof(cid.name));
+ mir_strncpy(cid.dbSettingsGroup, "Console", _countof(cid.dbSettingsGroup));
+ mir_strncpy(cid.setting, "BgColor", _countof(cid.setting));
cid.defcolour = RGB(255, 255, 255);
ColourRegisterT(&cid);
@@ -1230,13 +1230,13 @@ void InitConsole()
hIcons[1] = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_NOSCROLL), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
hIcons[2] = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_PAUSED), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
- for (i = 0; i < SIZEOF(ctrls); i++) {
+ for (i = 0; i < _countof(ctrls); i++) {
hIcons[i + ICON_FIRST] = (HICON)LoadImage(hInst, MAKEINTRESOURCE(ctrls[i].icon), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
}
- gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, SIZEOF(logicons), 0);
+ gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, _countof(logicons), 0);
- for (i = 0; i < SIZEOF(logicons); i++)
+ for (i = 0; i < _countof(logicons); i++)
{
hi = (HICON)LoadImage(hInst, MAKEINTRESOURCE(logicons[i]), IMAGE_ICON, LOGICONX_SIZE, LOGICONY_SIZE, 0);
if (hi)
@@ -1264,7 +1264,7 @@ void ShutdownConsole(void)
if (gImg) ImageList_Destroy(gImg);
- for (i = 0; i < SIZEOF(hIcons); i++) {
+ for (i = 0; i < _countof(hIcons); i++) {
if (hIcons[i]) DestroyIcon(hIcons[i]);
}
}
diff --git a/plugins/Console/src/init.cpp b/plugins/Console/src/init.cpp
index 0b1e1f83af..ed851e6e20 100644
--- a/plugins/Console/src/init.cpp
+++ b/plugins/Console/src/init.cpp
@@ -61,7 +61,7 @@ static IconItem iconList[] =
HANDLE LoadIcon(int iIconID)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconID)
return iconList[i].hIcolib;
return NULL;
@@ -71,7 +71,7 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
- Icon_Register(hInst, "Console", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Console", iconList, _countof(iconList));
InitCommonControls();
InitConsole();
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp
index 12d7923f76..f1264fe660 100644
--- a/plugins/ContactsPlus/src/main.cpp
+++ b/plugins/ContactsPlus/src/main.cpp
@@ -74,7 +74,7 @@ static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
//add event to the contact list
TCHAR caToolTip[128];
- mir_sntprintf(caToolTip, SIZEOF(caToolTip), _T("%s %s"), TranslateT("Contacts received from"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(caToolTip, _countof(caToolTip), _T("%s %s"), TranslateT("Contacts received from"), pcli->pfnGetContactDisplayName(hContact, 0));
CLISTEVENT cle = { sizeof(cle) };
cle.hContact = hContact;
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp
index 84331201a3..49729cfcf2 100644
--- a/plugins/ContactsPlus/src/receive.cpp
+++ b/plugins/ContactsPlus/src/receive.cpp
@@ -459,7 +459,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
UnhookEvent(wndData->hHook);
DestroyMenu(wndData->mhPopup);
{
- for (int i = 0; i < SIZEOF(wndData->hIcons); i++)
+ for (int i = 0; i < _countof(wndData->hIcons); i++)
DestroyIcon(wndData->hIcons[i]);
}
delete wndData; // automatically calls destructor
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp
index 2e0217c9e0..f06309e72b 100644
--- a/plugins/ContactsPlus/src/send.cpp
+++ b/plugins/ContactsPlus/src/send.cpp
@@ -462,7 +462,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
break;
case WM_DESTROY:
- for (int i = 0; i < SIZEOF(wndData->hIcons); i++)
+ for (int i = 0; i < _countof(wndData->hIcons); i++)
DestroyIcon(wndData->hIcons[i]);
WindowList_Remove(g_hSendWindowList, hwndDlg);
delete wndData;
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp
index 475879861e..3d07a8f99c 100644
--- a/plugins/ContactsPlus/src/utils.cpp
+++ b/plugins/ContactsPlus/src/utils.cpp
@@ -115,7 +115,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact)
void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, TCHAR *pszTitleStart)
{
TCHAR newtitle[512];
- mir_tstrncpy(newtitle, TranslateTS(pszTitleStart), SIZEOF(newtitle));
+ mir_tstrncpy(newtitle, TranslateTS(pszTitleStart), _countof(newtitle));
if (hContact) {
char *szProto = GetContactProto(hContact);
@@ -124,13 +124,13 @@ void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, TCHAR *pszTitleStart)
TCHAR *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR oldTitle[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_NAME, oldTitle, SIZEOF(oldTitle));
+ GetDlgItemText(hwndDlg, IDC_NAME, oldTitle, _countof(oldTitle));
if (mir_tstrcmp(uid ? uid : contactName, oldTitle))
SetDlgItemText(hwndDlg, IDC_NAME, uid ? uid : contactName);
TCHAR *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), TranslateTS(pszTitleStart), contactName, szStatus);
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s %s (%s)"), TranslateTS(pszTitleStart), contactName, szStatus);
}
}
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index cc80628b6c..5f887b2745 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -55,7 +55,7 @@ static void CALLBACK SetExtraImage(MCONTACT hContact)
ExtraIcon_Clear(hExtraIcon, hContact);
else {
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
+ mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
}
}
diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp
index 8c4ad30328..c11f0b4b9d 100644
--- a/plugins/CountryFlags/src/icons.cpp
+++ b/plugins/CountryFlags/src/icons.cpp
@@ -70,7 +70,7 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber)
}
/* binary search in index array */
- int low = 0, i, high = SIZEOF(BitmapIndexMap)-1;
+ int low = 0, i, high = _countof(BitmapIndexMap)-1;
if (countryNumber <= BitmapIndexMap[high])
while (low <= high) {
i = low+((high-low)/2);
@@ -146,7 +146,7 @@ HICON __fastcall LoadFlagIcon(int countryNumber)
szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber = 0xFFFF, 0);
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
return IcoLib_GetIcon(szId);
}
@@ -197,7 +197,7 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam)
POINT aptTriangle[3] = { 0 };
aptTriangle[1].y = bm.bmHeight-1;
aptTriangle[2].x = bm.bmWidth-1;
- HRGN hrgn = CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
+ HRGN hrgn = CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING);
if (hrgn != NULL) {
SelectClipRgn(hdc,hrgn);
DeleteObject(hrgn);
@@ -244,7 +244,7 @@ void InitIcons(void)
sid.description.a = (char*)countries[i].szName;
/* create identifier */
- mir_snprintf(szId, SIZEOF(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
/* create icon */
HICON hIcon = ImageList_GetIcon(himl,index,ILD_NORMAL);
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp
index 76976594ba..49dcc881b6 100644
--- a/plugins/CountryFlags/src/ip2country.cpp
+++ b/plugins/CountryFlags/src/ip2country.cpp
@@ -226,12 +226,12 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut)
/* convert */
for(i=0;i<nCountriesCount;i++) {
/* map different writings */
- for(j=0;j<SIZEOF(differentCountryNames);j++)
+ for(j=0;j<_countof(differentCountryNames);j++)
if (!mir_tstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
buf=(char*)differentCountryNames[j].szCSV;
break;
}
- if (j == SIZEOF(differentCountryNames))
+ if (j == _countof(differentCountryNames))
buf=(char*)countries[i].szName;
/* check country */
if (!mir_strcmpi(pszCountry,buf)) {
@@ -246,7 +246,7 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut)
}
/* not in list */
if (i == nCountriesCount) {
- mir_snprintf(out, SIZEOF(out), "Unknown: %s-%s [%s, %s]\n", pszFrom, pszTo, pszTwo, pszCountry);
+ mir_snprintf(out, _countof(out), "Unknown: %s-%s [%s, %s]\n", pszFrom, pszTo, pszTwo, pszCountry);
OutputDebugStringA(out); /* all ascii */
}
}
diff --git a/plugins/CountryFlags/src/utils.cpp b/plugins/CountryFlags/src/utils.cpp
index 9c0d0c6596..958a99fb25 100644
--- a/plugins/CountryFlags/src/utils.cpp
+++ b/plugins/CountryFlags/src/utils.cpp
@@ -70,7 +70,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT,UINT_PTR idTimer,DWORD cur
callList=NULL;
}
#ifdef _DEBUG
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"buffered call: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"buffered call: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
OutputDebugStringA(szDbgLine);
#endif
CallFunctionAsync((void (CALLBACK *)(void*))pfnBuffProc,(void*)lParam); /* compatible */
@@ -83,7 +83,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT,UINT_PTR idTimer,DWORD cur
/* set next timer */
if (nCallListCount) {
#ifdef _DEBUG
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"next buffered timeout: %ums\n",uElapseNext); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"next buffered timeout: %ums\n",uElapseNext); /* all ascii */
OutputDebugStringA(szDbgLine);
#endif
idBufferedTimer=SetTimer(hwnd,idBufferedTimer,uElapseNext,BufferedProcTimer); /* will be reset */
@@ -130,10 +130,10 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula
#ifdef _DEBUG
{ char szDbgLine[256];
data->pszProcName=pszProcName;
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"buffered queue: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"buffered queue: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
OutputDebugStringA(szDbgLine);
if (!idBufferedTimer) {
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"next buffered timeout: %ums\n",uElapse); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"next buffered timeout: %ums\n",uElapse); /* all ascii */
OutputDebugStringA(szDbgLine);
}
}
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index 554761f09a..5cdccfc845 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -68,7 +68,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam)
CreateDirectoryTree(VersionInfoFolder);
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_sntprintf(path, _countof(path), TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDumpFile != INVALID_HANDLE_VALUE) {
@@ -159,7 +159,7 @@ INT_PTR CopyLinkToClipboard(WPARAM, LPARAM)
ptrT tmp(db_get_wsa(NULL, PluginName, "Username"));
if (tmp != NULL) {
TCHAR buffer[MAX_PATH];
- mir_sntprintf(buffer, SIZEOF(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
+ mir_sntprintf(buffer, _countof(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
int bufLen = (sizeof(buffer) + 1) * sizeof(TCHAR);
HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
@@ -241,7 +241,7 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM)
static int ModulesLoaded(WPARAM, LPARAM)
{
char temp[MAX_PATH];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(temp), (LPARAM)temp);
crs_a2t(vertxt, temp);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
@@ -373,7 +373,7 @@ extern "C" int __declspec(dllexport) Load(void)
profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
if (catchcrashes && !needrestart)
- mir_sntprintf(CrashLogFolder, SIZEOF(CrashLogFolder), TEXT("%s\\CrashLog"), profpath);
+ mir_sntprintf(CrashLogFolder, _countof(CrashLogFolder), TEXT("%s\\CrashLog"), profpath);
_tcsncpy_s(VersionInfoFolder, profpath, _TRUNCATE);
diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp
index d7c5df3424..d3ccc95dff 100644
--- a/plugins/CrashDumper/src/crshdmp_icons.cpp
+++ b/plugins/CrashDumper/src/crshdmp_icons.cpp
@@ -30,12 +30,12 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(hInst, LPGEN("Crash Dumper"), iconList, SIZEOF(iconList), PluginName);
+ Icon_Register(hInst, LPGEN("Crash Dumper"), iconList, _countof(iconList), PluginName);
}
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
@@ -44,7 +44,7 @@ HICON LoadIconEx(int iconId, bool big)
HANDLE GetIconHandle(int iconId)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp
index 35153a6954..80e6b474fc 100644
--- a/plugins/CrashDumper/src/dumper.cpp
+++ b/plugins/CrashDumper/src/dumper.cpp
@@ -85,14 +85,14 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M
FindData* data = (FindData*)UserContext;
if ((DWORD)(data->Offset - ModuleBase) < ModuleSize) {
- const size_t len = SIZEOF(data->pModule->ModuleName);
+ const size_t len = _countof(data->pModule->ModuleName);
strncpy(data->pModule->ModuleName, ModuleName, len);
data->pModule->ModuleName[len - 1] = 0;
data->pModule->BaseOfImage = ModuleBase;
const HMODULE hModule = (HMODULE)ModuleBase;
- GetModuleFileNameA(hModule, data->pModule->LoadedImageName, SIZEOF(data->pModule->LoadedImageName));
+ GetModuleFileNameA(hModule, data->pModule->LoadedImageName, _countof(data->pModule->LoadedImageName));
return FALSE;
}
@@ -475,7 +475,7 @@ void PrintVersionInfo(CMString& buffer, unsigned flags)
buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime);
TCHAR profpn[MAX_PATH];
- mir_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname);
+ mir_sntprintf(profpn, _countof(profpn), TEXT("%s\\%s"), profpathfull, profname);
buffer.AppendFormat(TEXT("Profile: %s\r\n"), profpn);
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp
index a7aaab2a45..91535bb12e 100644
--- a/plugins/CrashDumper/src/exhndlr.cpp
+++ b/plugins/CrashDumper/src/exhndlr.cpp
@@ -30,12 +30,12 @@ int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep)
char str[256];
int off = mir_snprintf(str, "dbghelp.dll v.5.0 or later required to provide a crash report\n");
- off += mir_snprintf(str + off, SIZEOF(str) - off, "Missing Module: %s ", dlld->szDll);
+ off += mir_snprintf(str + off, _countof(str) - off, "Missing Module: %s ", dlld->szDll);
if (dlld->dlp.fImportByName)
- mir_snprintf(str + off, SIZEOF(str) - off, "Function: %s ", dlld->dlp.szProcName);
+ mir_snprintf(str + off, _countof(str) - off, "Function: %s ", dlld->dlp.szProcName);
else
- mir_snprintf(str + off, SIZEOF(str) - off, "Ordinal: %x ", dlld->dlp.dwOrdinal);
+ 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);
}
@@ -55,13 +55,13 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)
__try {
if (dtsubfldr) {
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_sntprintf(path, _countof(path), TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, _countof(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);
}
else
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, _countof(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);
@@ -82,18 +82,18 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)
__try {
if (dtsubfldr) {
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_sntprintf(path, _countof(path), TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, _countof(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);
}
else
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, _countof(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);
- mir_sntprintf(path, SIZEOF(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);
+ mir_sntprintf(path, _countof(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);
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp
index b5ea469cba..5f6066cafa 100644
--- a/plugins/CrashDumper/src/ui.cpp
+++ b/plugins/CrashDumper/src/ui.cpp
@@ -233,10 +233,10 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
char szSetting[100];
- GetDlgItemTextA(hwndDlg, IDC_USERNAME, szSetting, SIZEOF(szSetting));
+ GetDlgItemTextA(hwndDlg, IDC_USERNAME, szSetting, _countof(szSetting));
db_set_s(NULL, PluginName, "Username", szSetting);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, SIZEOF(szSetting));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, _countof(szSetting));
db_set_s(NULL, PluginName, "Password", szSetting);
db_set_b(NULL, PluginName, "UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN));
@@ -282,7 +282,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case 3:
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_sntprintf(path, _countof(path), TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW);
break;
@@ -305,7 +305,7 @@ void ShowMessage(int type, const TCHAR* format, ...)
va_list va;
va_start(va, format);
- int len = mir_vsntprintf(pi.lptzText, SIZEOF(pi.lptzText) - 1, format, va);
+ int len = mir_vsntprintf(pi.lptzText, _countof(pi.lptzText) - 1, format, va);
pi.lptzText[len] = 0;
va_end(va);
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp
index 652bace135..f904e6ef5c 100644
--- a/plugins/CrashDumper/src/utils.cpp
+++ b/plugins/CrashDumper/src/utils.cpp
@@ -288,15 +288,15 @@ void GetInternetExplorerVersion(CMString &buffer)
TCHAR iVer[64] = { 0 };
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey)) {
- size = SIZEOF(ieBuild);
+ size = _countof(ieBuild);
if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS)
ieBuild[0] = 0;
- size = SIZEOF(ieVersion);
+ size = _countof(ieVersion);
if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS)
ieVersion[0] = 0;
- size = SIZEOF(iVer);
+ size = _countof(iVer);
if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE)iVer, &size) != ERROR_SUCCESS)
iVer[0] = 0;
@@ -351,11 +351,11 @@ void GetProcessorString(CMString &buffer)
TCHAR cpuName[512] = { 0 };
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey)) {
- size = SIZEOF(cpuName);
+ size = _countof(cpuName);
if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)cpuName, &size) != ERROR_SUCCESS)
mir_tstrcpy(cpuName, TEXT("Unknown"));
- size = SIZEOF(cpuIdent);
+ 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)
mir_tstrcpy(cpuIdent, TEXT("Unknown"));
diff --git a/plugins/CryptoPP/src/GPGw/passdialog.cpp b/plugins/CryptoPP/src/GPGw/passdialog.cpp
index 08ca1678a4..18389c31d6 100644
--- a/plugins/CryptoPP/src/GPGw/passdialog.cpp
+++ b/plugins/CryptoPP/src/GPGw/passdialog.cpp
@@ -15,7 +15,7 @@ INT_PTR CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, L
{
case IDOK:
memset(dlgpassphrase, 0, sizeof(dlgpassphrase));
- GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, SIZEOF(dlgpassphrase));
+ GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, _countof(dlgpassphrase));
case IDCANCEL:
EndDialog(hdlg, wparam);
return TRUE;
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp
index aa28878fad..d095b64df0 100644
--- a/plugins/Db3x_mmap/src/database.cpp
+++ b/plugins/Db3x_mmap/src/database.cpp
@@ -87,7 +87,7 @@ void __cdecl dbpanic(void *)
msg = TranslateT("Disk is full. Miranda will now shut down.");
TCHAR err[256];
- mir_sntprintf(err, SIZEOF(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
+ mir_sntprintf(err, _countof(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);
}
@@ -128,13 +128,13 @@ char* printVariant(DBVARIANT* p)
static char boo[1000];
switch (p->type) {
- case DBVT_BYTE: mir_snprintf(boo, SIZEOF(boo), "byte: %d", p->bVal ); break;
- case DBVT_WORD: mir_snprintf(boo, SIZEOF(boo), "word: %d", p->wVal ); break;
- case DBVT_DWORD: mir_snprintf(boo, SIZEOF(boo), "dword: %d", p->dVal ); break;
+ case DBVT_BYTE: mir_snprintf(boo, _countof(boo), "byte: %d", p->bVal ); break;
+ case DBVT_WORD: mir_snprintf(boo, _countof(boo), "word: %d", p->wVal ); break;
+ case DBVT_DWORD: mir_snprintf(boo, _countof(boo), "dword: %d", p->dVal ); break;
case DBVT_UTF8:
- case DBVT_ASCIIZ: mir_snprintf(boo, SIZEOF(boo), "string: '%s'", p->pszVal); break;
+ case DBVT_ASCIIZ: mir_snprintf(boo, _countof(boo), "string: '%s'", p->pszVal); break;
case DBVT_DELETED: mir_strcpy(boo, "deleted"); break;
- default: mir_snprintf(boo, SIZEOF(boo), "crap: %d", p->type ); break;
+ default: mir_snprintf(boo, _countof(boo), "crap: %d", p->type ); break;
}
return boo;
}
diff --git a/plugins/Db3x_mmap/src/dbheaders.cpp b/plugins/Db3x_mmap/src/dbheaders.cpp
index 8598fe26ce..2a5c15de99 100644
--- a/plugins/Db3x_mmap/src/dbheaders.cpp
+++ b/plugins/Db3x_mmap/src/dbheaders.cpp
@@ -71,7 +71,7 @@ int CDb3Mmap::CheckDbHeaders(bool bInteractive)
if (bInteractive)
if (IDYES == MessageBox(NULL, TranslateTS(tszOldHeaders), TranslateT("Obsolete database format"), MB_YESNO | MB_ICONWARNING)) {
TCHAR tszCurPath[MAX_PATH];
- GetModuleFileName(NULL, tszCurPath, SIZEOF(tszCurPath));
+ GetModuleFileName(NULL, tszCurPath, _countof(tszCurPath));
TCHAR *p = _tcsrchr(tszCurPath, '\\');
if (p) *p = 0;
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp
index ee14dd7a17..8a11e52b51 100644
--- a/plugins/Db3x_mmap/src/dbintf.cpp
+++ b/plugins/Db3x_mmap/src/dbintf.cpp
@@ -219,7 +219,7 @@ int CDb3Mmap::Start(DBCHeckCallback *callback)
int CDb3Mmap::CheckDb(int phase, int firstTime)
{
- if (phase >= SIZEOF(Workers))
+ if (phase >= _countof(Workers))
return ERROR_OUT_OF_PAPER;
return (this->*Workers[phase])(firstTime);
diff --git a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
index c96d0b010e..695698ee7f 100644
--- a/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
+++ b/plugins/Db3x_mmap/src/dbtool/modulechain.cpp
@@ -97,7 +97,7 @@ int CDb3Mmap::WorkModuleChain(int firstTime)
}
if (n) {
TCHAR szModuleName[257];
- MultiByteToWideChar(CP_ACP, 0, modChain[iCurrentModName].name, -1, szModuleName, SIZEOF(szModuleName));
+ MultiByteToWideChar(CP_ACP, 0, modChain[iCurrentModName].name, -1, szModuleName, _countof(szModuleName));
TCHAR *pszModuleName = szModuleName;
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Module name '%s' is not unique: %d duplicates found"), pszModuleName, n);
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp
index c19b0fc031..4ac0e56d8f 100644
--- a/plugins/Db3x_mmap/src/ui.cpp
+++ b/plugins/Db3x_mmap/src/ui.cpp
@@ -100,7 +100,7 @@ static INT_PTR CALLBACK sttEnterPassword(HWND hwndDlg, UINT uMsg, WPARAM wParam,
break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_USERPASS, param->newPass, SIZEOF(param->newPass));
+ GetDlgItemText(hwndDlg, IDC_USERPASS, param->newPass, _countof(param->newPass));
EndDialog(hwndDlg, IDOK);
}
break;
@@ -142,7 +142,7 @@ static bool CheckOldPassword(HWND hwndDlg, CDb3Mmap *db)
{
if (db->usesPassword()) {
TCHAR buf[100];
- GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, _countof(buf));
if (!db->m_crypto->checkPassword(T2Utf(buf))) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Wrong old password entered!"));
return false;
@@ -200,13 +200,13 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam
case IDOK:
TCHAR buf2[100];
- GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, SIZEOF(buf2));
+ GetDlgItemText(hwndDlg, IDC_USERPASS1, buf2, _countof(buf2));
if (mir_tstrlen(buf2) < 3) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Password is too short!"));
goto LBL_Error;
}
- GetDlgItemText(hwndDlg, IDC_USERPASS2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_USERPASS2, buf, _countof(buf));
if (mir_tstrcmp(buf2, buf)) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Passwords do not match!"));
goto LBL_Error;
@@ -310,7 +310,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
{
CDb3Mmap *db = (CDb3Mmap*)obj;
- Icon_Register(g_hInst, LPGEN("Database"), iconList, SIZEOF(iconList), "mmap");
+ Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mmap");
HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db);
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp
index c7f1149dde..54166a4afb 100644
--- a/plugins/DbChecker/src/main.cpp
+++ b/plugins/DbChecker/src/main.cpp
@@ -73,7 +73,7 @@ static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam)
bLaunchMiranda = lParam != 0;
bAutoExit = lParam == 2;
bServiceMode = false;
- _tcsncpy(opts.filename, (TCHAR*)wParam, SIZEOF(opts.filename));
+ _tcsncpy(opts.filename, (TCHAR*)wParam, _countof(opts.filename));
return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
}
diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp
index 09cdb16243..49d4b88bf7 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:
{
TCHAR szError[256];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, opts.error, 0, szError, SIZEOF(szError), NULL);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, opts.error, 0, szError, _countof(szError), NULL);
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 562f0cabb4..ff6a5d7202 100644
--- a/plugins/DbChecker/src/progress.cpp
+++ b/plugins/DbChecker/src/progress.cpp
@@ -34,7 +34,7 @@ void AddToStatus(int flags, const TCHAR* fmt, ...)
va_start(vararg, fmt);
TCHAR str[256];
- mir_vsntprintf(str, SIZEOF(str), fmt, vararg);
+ mir_vsntprintf(str, _countof(str), fmt, vararg);
va_end(vararg);
int i = SendMessage(hwndStatus, LB_ADDSTRING, 0, (LPARAM)str);
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp
index 65e5f69c67..2a04830ae0 100644
--- a/plugins/DbChecker/src/selectdb.cpp
+++ b/plugins/DbChecker/src/selectdb.cpp
@@ -36,7 +36,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage)
if (opts.dbChecker == NULL) {
DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
if (dblink == NULL) {
- mir_sntprintf(tszMsg, SIZEOF(tszMsg),
+ mir_sntprintf(tszMsg, _countof(tszMsg),
TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
opts.filename);
LBL_Error:
@@ -45,7 +45,7 @@ int OpenDatabase(HWND hdlg, INT iNextPage)
}
if (dblink->CheckDB == NULL) {
- mir_sntprintf(tszMsg, SIZEOF(tszMsg),
+ mir_sntprintf(tszMsg, _countof(tszMsg),
TranslateT("Database driver '%s' doesn't support checking."),
TranslateTS(dblink->szFullName));
goto LBL_Error;
@@ -79,8 +79,8 @@ void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath)
mir_tstrcpy(szMirandaBootIni, szMirandaDir);
mir_tstrcat(szMirandaBootIni, _T("\\mirandaboot.ini"));
- GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T("./Profiles"), szProfileDir, SIZEOF(szProfileDir), szMirandaBootIni);
- ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, SIZEOF(szExpandedProfileDir));
+ GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T("./Profiles"), szProfileDir, _countof(szProfileDir), szMirandaBootIni);
+ ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, _countof(szExpandedProfileDir));
_tchdir(szMirandaDir);
if (!_tfullpath(szPath, szExpandedProfileDir, cbPath))
mir_tstrncpy(szPath, szMirandaDir, cbPath);
@@ -129,7 +129,7 @@ static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir)
int iNewItem = ListView_InsertItem(hwndList, &lvi);
TCHAR szSize[20];
- mir_sntprintf(szSize, SIZEOF(szSize), _T("%.2lf MB"), totalSize / 1048576.0);
+ mir_sntprintf(szSize, _countof(szSize), _T("%.2lf MB"), totalSize / 1048576.0);
ListView_SetItemText(hwndList, iNewItem, 1, szSize);
return iNewItem;
}
@@ -149,7 +149,7 @@ void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix)
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(fd.cFileName, _T(".")) || !mir_tstrcmp(fd.cFileName, _T("..")))
continue;
- mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s\\%s\\%s.dat"), szProfileDir, fd.cFileName, fd.cFileName);
+ mir_sntprintf(szFilename, _countof(szFilename), _T("%s\\%s\\%s.dat"), szProfileDir, fd.cFileName, fd.cFileName);
if (_taccess(szFilename, 0) == 0)
AddDatabaseToList(GetDlgItem(hdlg, IDC_DBLIST), szFilename, szPrefix);
} while (FindNextFile(hFind, &fd));
@@ -192,7 +192,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
ListView_InsertColumn(GetDlgItem(hdlg, IDC_DBLIST), 1, &lvc);
TCHAR szMirandaPath[MAX_PATH];
- GetModuleFileName(NULL, szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileName(NULL, szMirandaPath, _countof(szMirandaPath));
TCHAR *str2 = _tcsrchr(szMirandaPath, '\\');
if (str2 != NULL)
*str2 = 0;
@@ -201,11 +201,11 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
HKEY hKey;
TCHAR szProfileDir[MAX_PATH];
TCHAR szMirandaProfiles[MAX_PATH];
- DWORD cbData = SIZEOF(szMirandaPath);
+ DWORD cbData = _countof(szMirandaPath);
mir_tstrcpy(szMirandaProfiles, szMirandaPath);
mir_tstrcat(szMirandaProfiles, _T("\\Profiles"));
- GetProfileDirectory(szMirandaPath, szProfileDir, SIZEOF(szProfileDir));
+ GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir));
// search in profile dir (using ini file)
if (mir_tstrcmpi(szProfileDir, szMirandaProfiles))
@@ -219,7 +219,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\miranda32.exe"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKey, _T("Path"), NULL, NULL, (PBYTE)szMirandaPath, &cbData) == ERROR_SUCCESS) {
if (mir_tstrcmp(szProfileDir, szMirandaPath)) {
- GetProfileDirectory(szMirandaPath, szProfileDir, SIZEOF(szProfileDir));
+ GetProfileDirectory(szMirandaPath, szProfileDir, _countof(szProfileDir));
FindAdd(hdlg, szProfileDir, _T("[reg]\\"));
}
}
@@ -246,7 +246,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
return TRUE;
case WZN_PAGECHANGING:
- GetDlgItemText(hdlg, IDC_FILE, opts.filename, SIZEOF(opts.filename));
+ GetDlgItemText(hdlg, IDC_FILE, opts.filename, _countof(opts.filename));
break;
case WM_COMMAND:
@@ -272,7 +272,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
tmp = addstring(tmp, _T("*"));
*tmp = 0;
- GetDlgItemText(hdlg, IDC_FILE, str, SIZEOF(str));
+ GetDlgItemText(hdlg, IDC_FILE, str, _countof(str));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hdlg;
ofn.hInstance = NULL;
@@ -280,7 +280,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
ofn.lpstrDefExt = _T("dat");
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
if (GetOpenFileName(&ofn)) {
int i = AddDatabaseToList(GetDlgItem(hdlg, IDC_DBLIST), str, _T(""));
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp
index 58448a4e0f..62f30e1c42 100644
--- a/plugins/DbChecker/src/wizard.cpp
+++ b/plugins/DbChecker/src/wizard.cpp
@@ -71,7 +71,7 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam,
case WM_CTLCOLORSTATIC:
if ((GetWindowLongPtr((HWND)lParam, GWL_STYLE) & 0xFFFF) == 0) {
char szText[256];
- GetWindowTextA((HWND)lParam, szText, SIZEOF(szText));
+ GetWindowTextA((HWND)lParam, szText, _countof(szText));
if (!mir_strcmp(szText, "whiterect")) {
SetTextColor((HDC)wParam, RGB(255, 255, 255));
SetBkColor((HDC)wParam, RGB(255, 255, 255));
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp
index 708df28a97..c89063058b 100644
--- a/plugins/DbChecker/src/worker.cpp
+++ b/plugins/DbChecker/src/worker.cpp
@@ -54,9 +54,9 @@ static void Finalize(time_t& ts)
}
for (int i = 1;; i++) {
if (i == 1)
- mir_sntprintf(opts.backupFilename, SIZEOF(opts.backupFilename), TranslateT("%s\\Backup of %s"), dbPath, dbFile);
+ mir_sntprintf(opts.backupFilename, _countof(opts.backupFilename), TranslateT("%s\\Backup of %s"), dbPath, dbFile);
else
- mir_sntprintf(opts.backupFilename, SIZEOF(opts.backupFilename), TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile);
+ mir_sntprintf(opts.backupFilename, _countof(opts.backupFilename), TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile);
if (_taccess(opts.backupFilename, 0) == -1) break;
}
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp
index 12e68246c5..8e13789c0a 100644
--- a/plugins/DbEditorPP/src/copymodule.cpp
+++ b/plugins/DbEditorPP/src/copymodule.cpp
@@ -35,13 +35,13 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
if (ApplyProtoFilter(hContact))
continue;
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, 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, SIZEOF(name));
+ GetContactName(NULL, NULL, 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);
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp
index aba293adc1..4905fedd10 100644
--- a/plugins/DbEditorPP/src/deletemodule.cpp
+++ b/plugins/DbEditorPP/src/deletemodule.cpp
@@ -92,7 +92,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
case IDOK:
{
char module[FLD_SIZE];
- GetDlgItemTextA(hwnd, IDC_CONTACTS, module, SIZEOF(module));
+ GetDlgItemTextA(hwnd, IDC_CONTACTS, module, _countof(module));
SetCursor(LoadCursor(NULL, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
deleteModule(hContact, module, 0);
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp
index 37fc728f24..281fd6d10c 100644
--- a/plugins/DbEditorPP/src/exportimport.cpp
+++ b/plugins/DbEditorPP/src/exportimport.cpp
@@ -16,7 +16,7 @@ int Openfile(TCHAR *outputFile, const char *module, int maxlen)
if (module) {
int n = 0;
- mir_tstrncpy(filename, _A2T(module), SIZEOF(filename));
+ mir_tstrncpy(filename, _A2T(module), _countof(filename));
while (filename[n]) {
switch (filename[n]) {
@@ -121,27 +121,27 @@ char* NickFromHContact(MCONTACT hContact)
int loaded = 0;
szProto[0] = 0;
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
loaded = Proto_IsProtocolLoaded(szProto) ? 1 : 0;
- if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, SIZEOF(name)))
- mir_strncpy(name, "(UNKNOWN)", SIZEOF(name));
+ if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name)))
+ mir_strncpy(name, "(UNKNOWN)", _countof(name));
if (!loaded) {
if (szProto[0])
- mir_snprintf(nick, SIZEOF(nick), "%s (%s)", name, szProto);
+ mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto);
else
- mir_strncpy(nick, name, SIZEOF(nick));
+ mir_strncpy(nick, name, _countof(nick));
}
else {
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
char szUID[FLD_SIZE];
- GetValueA(hContact, szProto, uid, szUID, SIZEOF(szUID));
- mir_snprintf(nick, SIZEOF(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID);
+ GetValueA(hContact, szProto, uid, szUID, _countof(szUID));
+ mir_snprintf(nick, _countof(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID);
}
else
- mir_snprintf(nick, SIZEOF(nick), "%s (%s)", name, szProto);
+ mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto);
}
}
@@ -269,9 +269,9 @@ MCONTACT CheckNewContact(const char *myProto, const char *uid, const char *myNam
char szProto[FLD_SIZE], szName[NAME_SIZE];
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
if (!mir_strcmp(szProto, myProto))
- if (GetValueA(hContact, szProto, uid, szName, SIZEOF(szName)) && !mir_strcmp(szName, myName))
+ if (GetValueA(hContact, szProto, uid, szName, _countof(szName)) && !mir_strcmp(szName, myName))
return hContact;
return INVALID_CONTACT_ID;
@@ -314,19 +314,19 @@ void importSettings(MCONTACT hContact, char *utf8)
char *p1 = strrchr(&importstring[i], '>*{');
char *p2 = strrchr(&importstring[i], '}*');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szUID)) {
strncpy(szUID, p1 + 1, p2 - p1 - 2);
p1 = strrchr(&importstring[i], ')*<');
p2 = strrchr(&importstring[i], '>*{');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(uid)) {
strncpy(uid, p1 + 1, p2 - p1 - 3);
p1 = strrchr(&importstring[i], ' *(');
p2 = strrchr(&importstring[i], ')*<');
- if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) {
+ if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szProto)) {
strncpy(szProto, p1 + 1, p2 - p1 - 3);
char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -446,7 +446,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
TCHAR name[NAME_SIZE], msg[MSG_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, SIZEOF(name));
+ GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
mir_sntprintf(msg, TranslateT("Import to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -516,11 +516,11 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath)
mir_tstrcpy(szFileNames, _T(""));
if (!FilePath)
- offset = Openfile2Import(szFileNames, SIZEOF(szFileNames));
+ offset = Openfile2Import(szFileNames, _countof(szFileNames));
else {
_A2T tmp(FilePath);
if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES)
- mir_tstrncpy(szFileNames, tmp, SIZEOF(szFileNames));
+ mir_tstrncpy(szFileNames, tmp, _countof(szFileNames));
}
int index = 0;
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index 6481fcf027..496d78fe81 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -98,11 +98,11 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
TCHAR text[FLD_SIZE];
TCHAR replace[FLD_SIZE] = {0};
- if (!GetDlgItemText(hwnd, IDC_TEXT, text, SIZEOF(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;
+ if (!GetDlgItemText(hwnd, IDC_TEXT, text, _countof(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;
// empty replace is done only for exact match or entire replace
if (LOWORD(wParam) == IDOK &&
- !GetDlgItemText(hwnd, IDC_REPLACE, replace, SIZEOF(replace)) &&
+ !GetDlgItemText(hwnd, IDC_REPLACE, replace, _countof(replace)) &&
(!IsDlgButtonChecked(hwnd, IDC_ENTIRELY) && !IsDlgButtonChecked(hwnd, IDC_EXACT)))
break;
@@ -192,8 +192,8 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
ItemInfo ii = {0};
ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, SIZEOF(ii.module));
- ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, SIZEOF(ii.setting));
+ ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, _countof(ii.module));
+ ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, _countof(ii.setting));
if (ii.setting[0])
ii.type = FW_SETTINGNAME;
else if (ii.module[0])
@@ -245,7 +245,7 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set
else
mode = TranslateT("Found");
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp
index 4bcd1cfc90..1e3d755ff0 100644
--- a/plugins/DbEditorPP/src/icons.cpp
+++ b/plugins/DbEditorPP/src/icons.cpp
@@ -42,7 +42,7 @@ IconItem iconList[] = {
HANDLE GetIcoLibHandle(int icon)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == icon)
return iconList[i].hIcolib;
return INVALID_HANDLE_VALUE;
@@ -50,12 +50,12 @@ HANDLE GetIcoLibHandle(int icon)
void IcoLibRegister(void)
{
- Icon_Register(hInst, modFullname, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, modFullname, iconList, _countof(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == icon)
return IcoLib_GetIconByHandle(iconList[i].hIcolib);
@@ -68,11 +68,11 @@ static int protoCount = 0;
HIMAGELIST LoadIcons()
{
HICON hIcon;
- HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, SIZEOF(dbeIcons), 5);
+ HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5);
if (!hil) return NULL;
- for(int i = 0; i < SIZEOF(dbeIcons); i++)
+ for(int i = 0; i < _countof(dbeIcons); i++)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
Proto_EnumAccounts(&protoCount, &protocols);
@@ -97,11 +97,11 @@ int GetProtoIconIndex(const char *szProto)
if (protoCount && protocols) {
for (int i = 0; i < protoCount; i++) {
if (!mir_strcmp(protocols[i]->szModuleName, szProto))
- return i + SIZEOF(dbeIcons);
+ return i + _countof(dbeIcons);
}
if (Proto_IsProtocolLoaded(szProto))
- return SIZEOF(dbeIcons) - 2; // ICO_ONLINE;
+ return _countof(dbeIcons) - 2; // ICO_ONLINE;
}
}
- return SIZEOF(dbeIcons) - 1; // ICO_OFFLINE;
+ return _countof(dbeIcons) - 1; // ICO_OFFLINE;
}
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp
index 0ddb715f5d..b132390c45 100644
--- a/plugins/DbEditorPP/src/main.cpp
+++ b/plugins/DbEditorPP/src/main.cpp
@@ -230,7 +230,7 @@ char *StringFromBlob(BYTE *blob, WORD len)
for (j = 0; j < len; j++)
{
- mir_snprintf(tmp, SIZEOF(tmp), "%02X ", blob[j]);
+ mir_snprintf(tmp, _countof(tmp), "%02X ", blob[j]);
mir_strcat(data, tmp);
}
return data;
@@ -451,33 +451,33 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle
name[0] = 0;
if (hContact && (!proto || !proto[0])) {
- if (!db_get_static(hContact, "Protocol", "p", tmp, SIZEOF(tmp)))
+ if (!db_get_static(hContact, "Protocol", "p", tmp, _countof(tmp)))
szProto = tmp;
}
for (int i = 0; i < NAMEORDERCOUNT - 1; i++) {
switch (nameOrder[i]) {
case 0: // custom name
- GetValue(hContact, "CList", "MyHandle", name, SIZEOF(name));
+ GetValue(hContact, "CList", "MyHandle", name, _countof(name));
break;
case 1: // nick
if (!szProto) break;
- GetValue(hContact, szProto, "Nick", name, SIZEOF(name));
+ GetValue(hContact, szProto, "Nick", name, _countof(name));
break;
/*
case 2: // First Name
if (!szProto) break;
- GetValue(hContact, szProto, "FirstName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "FirstName", name, _countof(name));
break;
*/
case 3: // E-mail
if (!szProto) break;
- GetValue(hContact, szProto, "e-mail", name, SIZEOF(name));
+ GetValue(hContact, szProto, "e-mail", name, _countof(name));
break;
/*
case 4: // Last Name
- GetValue(hContact, szProto, "LastName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "LastName", name, _countof(name));
break;
*/
case 5: // Unique id
@@ -486,21 +486,21 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle
// protocol must define a PFLAG_UNIQUEIDSETTING
char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
- GetValue(hContact, szProto, uid, name, SIZEOF(name));
+ GetValue(hContact, szProto, uid, name, _countof(name));
}
break;
case 6: // first + last name
{
if (!szProto) break;
- GetValue(hContact, szProto, "FirstName", name, SIZEOF(name));
+ GetValue(hContact, szProto, "FirstName", name, _countof(name));
int len = (int)mir_tstrlen(name);
- if (len + 2 < SIZEOF(name)) {
+ if (len + 2 < _countof(name)) {
if (len)
- mir_tstrncat(name, _T(" "), SIZEOF(name));
+ mir_tstrncat(name, _T(" "), _countof(name));
len++;
- GetValue(hContact, szProto, "LastName", &name[len], SIZEOF(name) - len);
+ GetValue(hContact, szProto, "LastName", &name[len], _countof(name) - len);
}
}
break;
@@ -511,7 +511,7 @@ int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxle
}
if (!name[0])
- mir_tstrncpy(name, TranslateT("<UNKNOWN>"), SIZEOF(name));
+ mir_tstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name));
if (szProto && szProto[0]) {
if (g_Order)
@@ -538,7 +538,7 @@ int ApplyProtoFilter(MCONTACT hContact)
int loaded = 0;
char szProto[FLD_SIZE];
- if (!db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
loaded = Proto_IsProtocolLoaded(szProto) ? 1 : 0;
if ((loaded && g_Mode == MODE_UNLOADED) || (!loaded && g_Mode == MODE_LOADED))
@@ -571,7 +571,7 @@ void saveListSettings(HWND hwnd, ColumnsSettings *cs)
int i = 0;
while (cs[i].name) {
if (ListView_GetColumn(hwnd, cs[i].index, &sLC)) {
- mir_snprintf(tmp, SIZEOF(tmp), cs[i].dbname, i);
+ mir_snprintf(tmp, _countof(tmp), cs[i].dbname, i);
db_set_w(NULL, modname, tmp, (WORD)sLC.cx);
}
i++;
@@ -585,8 +585,8 @@ INT_PTR CALLBACK ColumnsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam)
const int maxSize = 1024;
TCHAR text1[maxSize];
TCHAR text2[maxSize];
- ListView_GetItemText(params.hList, lParam1, params.column, text1, SIZEOF(text1));
- ListView_GetItemText(params.hList, lParam2, params.column, text2, SIZEOF(text2));
+ ListView_GetItemText(params.hList, lParam1, params.column, text1, _countof(text1));
+ ListView_GetItemText(params.hList, lParam2, params.column, text2, _countof(text2));
int res = mir_tstrcmpi(text1, text2);
return (params.column == params.last) ? -res : res;
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 87482e939d..74723eb983 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -116,7 +116,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(hwnd);
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
if (TreeView_GetItem(hwnd, &tvi) && tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
MCONTACT hContact = mtis->hContact;
@@ -177,7 +177,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
char setting[FLD_SIZE];
int idx = ListView_GetSelectionMark(hwnd);
if (idx == -1 ) return 0;
- ListView_GetItemTextA(hwnd, idx, 0, setting, SIZEOF(setting));
+ ListView_GetItemTextA(hwnd, idx, 0, setting, _countof(setting));
if (wParam == VK_F2)
editSetting(info.hContact, info.module, setting);
@@ -322,7 +322,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
tvi.hItem = item;
if (TreeView_GetItem(hwnd2Tree, &tvi)) {
MCONTACT hContact = 0;
@@ -348,7 +348,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (pos != -1) {
char data[FLD_SIZE];
- ListView_GetItemTextA(hwnd2List, pos, 0, data, SIZEOF(data));
+ ListView_GetItemTextA(hwnd2List, pos, 0, data, _countof(data));
db_set_s(NULL, modname, "LastSetting", data);
}
else
@@ -409,7 +409,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(hwnd2Tree);
tvi.pszText = text; // modulename
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
if (!TreeView_GetItem(hwnd2Tree, &tvi)) break;
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
if (mtis && (mtis->type == MODULE))
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp
index b6d90ff1b1..dc30d2f473 100644
--- a/plugins/DbEditorPP/src/modsettingenum.cpp
+++ b/plugins/DbEditorPP/src/modsettingenum.cpp
@@ -113,7 +113,7 @@ int enumResidentProc(const char *setting, DWORD, LPARAM)
char str[FLD_SIZE];
const char *end = strstr(setting, "/");
- if (end && (end - setting) < SIZEOF(str)) {
+ if (end && (end - setting) < _countof(str)) {
mir_strncpy(str, setting, end - setting + 1);
if (m_lResidentModules.getIndex(str) == -1)
m_lResidentModules.insert(mir_strdup(str));
@@ -152,9 +152,9 @@ int IsResidentSetting(const char *module, const char *setting)
if (!setting) return 1;
char str[2*FLD_SIZE];
- mir_strncpy(str, module, SIZEOF(str)-1);
+ mir_strncpy(str, module, _countof(str)-1);
mir_strcat(str, "/");
- mir_strncat(str, setting, SIZEOF(str));
+ mir_strncat(str, setting, _countof(str));
return m_lResidentSettings.getIndex(str) != -1;
}
@@ -244,9 +244,9 @@ int fixResidentSettings()
for (setting = SettingList.first; setting; setting = setting->next) {
- mir_strncpy(str, module->name, SIZEOF(str)-1);
+ mir_strncpy(str, module->name, _countof(str)-1);
mir_strcat(str, "/");
- mir_strncat(str, setting->name, SIZEOF(str));
+ mir_strncat(str, setting->name, _countof(str));
int idx = m_lResidentSettings.getIndex(str);
if (idx == -1)
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp
index 1611cd0c71..04963061d0 100644
--- a/plugins/DbEditorPP/src/moduletree.cpp
+++ b/plugins/DbEditorPP/src/moduletree.cpp
@@ -63,12 +63,12 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec
if (hSelectedContact != hContact)
lParam->type |= EMPTY;
- if (db_get_static(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
+ if (db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto)))
szProto[0] = 0;
icon = GetProtoIconIndex(szProto);
- GetContactName(hContact, szProto, name, SIZEOF(name));
+ GetContactName(hContact, szProto, name, _countof(name));
tvi.item.pszText = name;
tvi.item.iImage = icon;
@@ -162,7 +162,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module)
item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = SIZEOF(text);
+ item.cchTextMax = _countof(text);
do {
do {
lastItem = item.hItem;
@@ -241,7 +241,7 @@ http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?t
item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = SIZEOF(text);
+ item.cchTextMax = _countof(text);
prelastItem = item.hItem;
do {
@@ -330,7 +330,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param)
TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
tvi.hItem = item;
TreeView_GetItem(hwnd2Tree, &tvi);
@@ -340,18 +340,18 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param)
if (mtis->type == CONTACT)
SelectedModule[0] = 0;
else
- mir_strncpy(SelectedModule, _T2A(text), SIZEOF(SelectedModule));
+ mir_strncpy(SelectedModule, _T2A(text), _countof(SelectedModule));
Select = 1;
}
}
break;
case 2: // restore saved
- if (GetValueA(NULL, modname, "LastModule", SelectedModule, SIZEOF(SelectedModule))) {
+ if (GetValueA(NULL, modname, "LastModule", SelectedModule, _countof(SelectedModule))) {
hSelectedContact = db_get_dw(NULL, modname, "LastContact", INVALID_CONTACT_ID);
if (hSelectedContact != INVALID_CONTACT_ID)
Select = 1;
- GetValueA(NULL, modname, "LastSetting", SelectedSetting, SIZEOF(SelectedSetting));
+ GetValueA(NULL, modname, "LastSetting", SelectedSetting, _countof(SelectedSetting));
}
break;
@@ -508,7 +508,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = pnmtv->itemNew.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(pnmtv->hdr.hwndFrom, &tvi);
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
@@ -589,7 +589,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h
tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_PARAM;
tvi.hItem = ptvdi->item.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
@@ -631,7 +631,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti.hItem;
tvi.pszText = text;
- tvi.cchTextMax = SIZEOF(text);
+ tvi.cchTextMax = _countof(text);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
if (!tvi.lParam) return;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp
index 000f283c3a..42a4bc69a1 100644
--- a/plugins/DbEditorPP/src/renamemodule.cpp
+++ b/plugins/DbEditorPP/src/renamemodule.cpp
@@ -31,7 +31,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
TranslateDialogDefault(hwnd);
TCHAR msg[MSG_SIZE], name[NAME_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, SIZEOF(name));
+ GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -42,7 +42,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case IDOK:
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) {
char modulename[FLD_SIZE];
- GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, SIZEOF(modulename));
+ GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename));
if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
// null contact
db_set_b(NULL, modulename, "(Default)", 0);
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp
index 49445328c1..cc1ebbebab 100644
--- a/plugins/DbEditorPP/src/settinglist.cpp
+++ b/plugins/DbEditorPP/src/settinglist.cpp
@@ -144,7 +144,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s
while (i < items) {
if (ListView_GetItemState(hwnd2List, i, LVIS_SELECTED)) {
- if (ListView_GetItemTextA(hwnd2List, i, 0, text, SIZEOF(text)))
+ if (ListView_GetItemTextA(hwnd2List, i, 0, text, _countof(text)))
db_unset(hContact, module, text);
items--;
}
@@ -289,7 +289,7 @@ void addListHandle(MCONTACT hContact)
lvi.lParam = hContact;
lvi.iImage = IMAGE_HANDLE;
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
lvi.pszText = name;
int index = ListView_InsertItem(hwnd2List, &lvi);
@@ -337,13 +337,13 @@ void PopulateSettings(MCONTACT hContact, const char *module)
{
// save module as it can be erased by ClearListView()
char tmp[FLD_SIZE];
- mir_strncpy(tmp, module, SIZEOF(tmp));
+ mir_strncpy(tmp, module, _countof(tmp));
// clear any settings that may be there...
ClearListView();
info.hContact = hContact;
- mir_strncpy(info.module, tmp, SIZEOF(info.module));
+ mir_strncpy(info.module, tmp, _countof(info.module));
ModuleSettingLL setlist;
@@ -609,7 +609,7 @@ void EditLabel(int item, int subitem)
info.hwnd2Edit = NULL;
}
- if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, SIZEOF(setting))) return;
+ if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, _countof(setting))) return;
if (!setting[0] || !ListView_GetSubItemRect(hwnd2List, item, subitem, LVIR_LABEL, &rc))
return;
@@ -712,7 +712,7 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)
if (!g_Inline || hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) {
char setting[FLD_SIZE];
EditFinish(hti.iItem);
- if (ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, SIZEOF(setting)))
+ if (ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, _countof(setting)))
editSetting(info.hContact, info.module, setting);
}
else
@@ -853,7 +853,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to
}
char setting[FLD_SIZE];
- if (!ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, SIZEOF(setting))) return;
+ if (!ListView_GetItemTextA(hwnd2List, hti.iItem, 0, setting, _countof(setting))) return;
// check if the setting is being watched and if it is then check the menu item
int watchIdx = WatchedArrayIndex(info.hContact, info.module, setting, 1);
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp
index 246678306d..876ac8262b 100644
--- a/plugins/DbEditorPP/src/settingsdlg.cpp
+++ b/plugins/DbEditorPP/src/settingsdlg.cpp
@@ -189,7 +189,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
TCHAR settingname[FLD_SIZE];
- GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, SIZEOF(settingname));
+ GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, _countof(settingname));
if (settingname[0])
{
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index b9bc71cefd..a43c1e46c3 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -116,7 +116,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam)
TCHAR data[32], tmp[16], name[NAME_SIZE];
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
lvItem.pszText = name;
index = ListView_InsertItem(hwnd, &lvItem);
@@ -321,8 +321,8 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ItemInfo ii;
ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemTextA(hwndVars, hti.iItem, 1, ii.module, SIZEOF(ii.module));
- ListView_GetItemTextA(hwndVars, hti.iItem, 2, ii.setting, SIZEOF(ii.setting));
+ ListView_GetItemTextA(hwndVars, hti.iItem, 1, ii.module, _countof(ii.module));
+ ListView_GetItemTextA(hwndVars, hti.iItem, 2, ii.setting, _countof(ii.setting));
ii.type = FW_SETTINGNAME;
SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
}
@@ -372,17 +372,17 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
int timeout = db_get_b(NULL, modname, "PopupDelay", 3);
TCHAR name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
- GetContactName(hContact, NULL, name, SIZEOF(name));
+ GetContactName(hContact, NULL, name, _countof(name));
// 2nd line
- int type = GetValue(hContact, module, setting, value, SIZEOF(value));
+ int type = GetValue(hContact, module, setting, value, _countof(value));
mir_sntprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""), _A2T(module), _A2T(setting), DBVType(type), value);
POPUPDATAT ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
- mir_tstrncpy(ppd.lptzContactName, name, SIZEOF(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, text, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, name, _countof(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, text, _countof(ppd.lptzText));
ppd.colorBack = colorBack;
ppd.colorText = colorText;
ppd.iSeconds = timeout ? timeout : -1;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index e54c7fdecb..07d4a13a97 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -181,7 +181,7 @@ int RotateBackups(TCHAR *backupfolder, TCHAR *dbname)
if (options.num_backups == 0)
return 0; /* Roration disabled. */
- mir_sntprintf(backupfolderTmp, SIZEOF(backupfolderTmp), _T("%s\\%s*"), backupfolder, dbname);
+ mir_sntprintf(backupfolderTmp, _countof(backupfolderTmp), _T("%s\\%s*"), backupfolder, dbname);
hFind = FindFirstFile(backupfolderTmp, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return 0;
@@ -201,7 +201,7 @@ int RotateBackups(TCHAR *backupfolder, TCHAR *dbname)
if (i > 0)
qsort(bf, i, sizeof(backupFile), Comp); /* Sort the list of found files by date in descending order. */
for (; i >= options.num_backups; i --) {
- mir_sntprintf(backupfolderTmp, SIZEOF(backupfolderTmp), _T("%s\\%s"), backupfolder, bf[(i - 1)].Name);
+ mir_sntprintf(backupfolderTmp, _countof(backupfolderTmp), _T("%s\\%s"), backupfolder, bf[(i - 1)].Name);
DeleteFile(backupfolderTmp);
}
err_out:
@@ -218,12 +218,12 @@ int Backup(TCHAR *backup_filename)
HWND progress_dialog = NULL;
SYSTEMTIME st;
- CallService(MS_DB_GETPROFILENAMET, SIZEOF(dbname), (LPARAM)dbname);
+ CallService(MS_DB_GETPROFILENAMET, _countof(dbname), (LPARAM)dbname);
if (backup_filename == NULL) {
int err;
TCHAR *backupfolder, buffer[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD size = SIZEOF(buffer);
+ DWORD size = _countof(buffer);
bZip = options.use_zip != 0;
backupfolder = Utils_ReplaceVarsT(options.folder);
@@ -237,7 +237,7 @@ int Backup(TCHAR *backup_filename)
GetLocalTime(&st);
GetComputerName(buffer, &size);
- mir_sntprintf(dest_file, SIZEOF(dest_file), _T("%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s"), backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? _T("zip") : _T("dat"));
+ mir_sntprintf(dest_file, _countof(dest_file), _T("%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s"), backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? _T("zip") : _T("dat"));
mir_free(backupfolder);
}
else {
@@ -253,7 +253,7 @@ int Backup(TCHAR *backup_filename)
SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
- mir_sntprintf(source_file, SIZEOF(source_file), _T("%s\\%s"), profilePath, dbname);
+ mir_sntprintf(source_file, _countof(source_file), _T("%s\\%s"), profilePath, dbname);
TCHAR *pathtmp = Utils_ReplaceVarsT(source_file);
BOOL res = 0;
if (bZip)
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index 3488432561..5392ab2d9e 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -41,7 +41,7 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
- Icon_Register(g_hInstance, LPGEN("Database")"/"LPGEN("Database backups"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInstance, LPGEN("Database")"/"LPGEN("Database backups"), iconList, _countof(iconList));
return 0;
}
@@ -55,7 +55,7 @@ extern "C" __declspec(dllexport) int Unload(void)
static int FoldersGetBackupPath(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hFolder, options.folder, SIZEOF(options.folder), DIR SUB_DIR);
+ FoldersGetCustomPathT(hFolder, options.folder, _countof(options.folder), DIR SUB_DIR);
return 0;
}
INT_PTR ABService(WPARAM, LPARAM)
@@ -67,16 +67,16 @@ INT_PTR DBSaveAs(WPARAM, LPARAM)
{
TCHAR fname_buff[MAX_PATH], tszFilter[200];
OPENFILENAME ofn = { 0 };
- CallService(MS_DB_GETPROFILENAMET, SIZEOF(fname_buff), (LPARAM)fname_buff);
+ CallService(MS_DB_GETPROFILENAMET, _countof(fname_buff), (LPARAM)fname_buff);
- mir_sntprintf(tszFilter, SIZEOF(tszFilter), _T("%s (*.dat)%c*.dat%c%s (*.zip)%c*.zip%c%s (*.*)%c*%c"),
+ mir_sntprintf(tszFilter, _countof(tszFilter), _T("%s (*.dat)%c*.dat%c%s (*.zip)%c*.zip%c%s (*.*)%c*%c"),
TranslateT("Miranda NG databases"), 0, 0,
TranslateT("Compressed Miranda NG databases"), 0, 0,
TranslateT("All files"), 0, 0);
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = fname_buff;
- ofn.nMaxFile = SIZEOF(fname_buff);
+ ofn.nMaxFile = _countof(fname_buff);
ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT;
ofn.lpstrFilter = tszFilter;
ofn.nFilterIndex = 1;
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index d02bb47032..4be09cbf23 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -48,13 +48,13 @@ int LoadOptions(void)
if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':')
_tcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE);
else
- mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s\\%s"), profilePath, dbv.ptszVal);
+ mir_sntprintf(options.folder, _countof(options.folder), _T("%s\\%s"), profilePath, dbv.ptszVal);
db_free(&dbv);
mir_free(tmp);
}
else
- mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s%s"), DIR, SUB_DIR);
+ mir_sntprintf(options.folder, _countof(options.folder), _T("%s%s"), DIR, SUB_DIR);
}
options.num_backups = db_get_w(0, "AutoBackups", "NumBackups", 3);
@@ -76,7 +76,7 @@ int SaveOptions(void)
db_set_w(0, "AutoBackups", "Period", (WORD)options.period);
db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
- mir_sntprintf(prof_dir, SIZEOF(prof_dir), _T("%s\\"), profilePath);
+ mir_sntprintf(prof_dir, _countof(prof_dir), _T("%s\\"), profilePath);
size_t prof_len = mir_tstrlen(prof_dir);
size_t opt_len = mir_tstrlen(options.folder);
@@ -89,7 +89,7 @@ int SaveOptions(void)
TCHAR *tmp = Utils_ReplaceVarsT(options.folder);
if (mir_tstrlen(tmp) < 2 || tmp[1] != ':') {
_tcsncpy_s(prof_dir, options.folder, _TRUNCATE);
- mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s\\%s"), profilePath, prof_dir);
+ mir_sntprintf(options.folder, _countof(options.folder), _T("%s\\%s"), profilePath, prof_dir);
}
mir_free(tmp);
db_set_w(0, "AutoBackups", "NumBackups", options.num_backups);
@@ -188,7 +188,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
else {
TCHAR tszTooltipText[4096];
- mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
+ mir_sntprintf(tszTooltipText, _countof(tszTooltipText), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
_T("%miranda_path%"), TranslateT("path to Miranda root folder"),
_T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"),
_T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"),
@@ -326,9 +326,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR buff[10];
- GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, _countof(buff));
new_options.period = _ttoi(buff);
- GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, _countof(buff));
new_options.num_backups = _ttoi(buff);
switch (SendDlgItemMessage(hwndDlg, IDC_PT, CB_GETCURSEL, 0, 0)) {
@@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case 2: new_options.period_type = PT_MINUTES; break;
}
- GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, SIZEOF(folder_buff));
+ GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, _countof(folder_buff));
{
TCHAR backupfolder[MAX_PATH] = { 0 };
BOOL folder_ok = TRUE;
@@ -346,7 +346,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':')
_tcsncpy_s(backupfolder, tmp, _TRUNCATE);
else
- mir_sntprintf(backupfolder, SIZEOF(backupfolder), _T("%s\\%s"), profilePath, tmp);
+ mir_sntprintf(backupfolder, _countof(backupfolder), _T("%s\\%s"), profilePath, tmp);
mir_free(tmp);
int err = CreateDirectoryTreeT(backupfolder);
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index 02894645a2..2aa36de2d7 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -144,7 +144,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param)
instance->DestroyAccessToken();
char requestToken[128];
- GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, SIZEOF(requestToken));
+ GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, _countof(requestToken));
GetAccessTokenRequest request(requestToken);
NLHR_PTR response(request.Send(instance->hNetlibConnection));
diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp
index ba92aaa8f2..b4b8574344 100644
--- a/plugins/Dropbox/src/dropbox_icons.cpp
+++ b/plugins/Dropbox/src/dropbox_icons.cpp
@@ -8,12 +8,12 @@ static IconItem iconList[] =
void InitializeIcons()
{
- Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, SIZEOF(iconList), MODULE);
+ Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
}
HANDLE GetIconHandleByName(const char *name)
{
- for (size_t i = 0; i < SIZEOF(iconList); i++)
+ for (size_t i = 0; i < _countof(iconList); i++)
if (mir_strcmpi(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
@@ -22,7 +22,7 @@ HANDLE GetIconHandleByName(const char *name)
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp
index 24dd3c62c8..3909ea4750 100644
--- a/plugins/Dropbox/src/dropbox_services.cpp
+++ b/plugins/Dropbox/src/dropbox_services.cpp
@@ -179,7 +179,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam)
{ "delete", &CDropbox::CommandDelete }
};
- for (int i = 0; i < SIZEOF(commands); i++)
+ for (int i = 0; i < _countof(commands); i++)
{
if (!mir_strcmp(szMessage+1, commands[i].szCommand))
{
@@ -199,7 +199,7 @@ INT_PTR CDropbox::ProtoSendMessage(WPARAM, LPARAM lParam)
}
char help[1024];
- mir_snprintf(help, SIZEOF(help), Translate("\"%s\" is not valid.\nUse \"/help\" for more info."), szMessage);
+ mir_snprintf(help, _countof(help), Translate("\"%s\" is not valid.\nUse \"/help\" for more info."), szMessage);
CallContactService(GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)help);
return 0;
}
diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h
index 6fa8816c93..7a4bd11bb0 100644
--- a/plugins/Dropbox/src/http_request.h
+++ b/plugins/Dropbox/src/http_request.h
@@ -69,7 +69,7 @@ protected:
char cPair[128];
mir_snprintf(
cPair,
- SIZEOF(cPair),
+ _countof(cPair),
"%s:%s",
szLogin,
szPassword);
@@ -79,7 +79,7 @@ protected:
char value[128];
mir_snprintf(
value,
- SIZEOF(value),
+ _countof(value),
"Basic %s",
ePair);
@@ -96,7 +96,7 @@ protected:
char value[128];
mir_snprintf(
value,
- SIZEOF(value),
+ _countof(value),
"Bearer %s",
szValue);
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp
index 52a21e8a18..5d2c21c5db 100644
--- a/plugins/Exchange/src/MirandaExchange.cpp
+++ b/plugins/Exchange/src/MirandaExchange.cpp
@@ -435,8 +435,8 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass
TCHAR szPID[20];
_tstrtime(szPID);
- _tcsncpy(szPIDandName, m_szUsername, SIZEOF(szPIDandName)-1);
- mir_tstrncat(szPIDandName, szPID, SIZEOF(szPIDandName) - mir_tstrlen(szPIDandName));
+ _tcsncpy(szPIDandName, m_szUsername, _countof(szPIDandName)-1);
+ mir_tstrncat(szPIDandName, szPID, _countof(szPIDandName) - mir_tstrlen(szPIDandName));
hr = CreateProfile(szPIDandName);
if ( HR_FAILED(hr)) {
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp
index 754cefb113..badc63fc33 100644
--- a/plugins/Exchange/src/dlg_handlers.cpp
+++ b/plugins/Exchange/src/dlg_handlers.cpp
@@ -41,13 +41,13 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
int bCheck = db_get_b(NULL, ModuleName, "Check", 1);
TCHAR buffer[4096];
- GetStringFromDatabase("Username", _T(""), buffer, SIZEOF(buffer));
+ GetStringFromDatabase("Username", _T(""), buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_USER_EDIT, buffer);
- GetStringFromDatabase("Password", _T(""), buffer, SIZEOF(buffer));
+ GetStringFromDatabase("Password", _T(""), buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer);
- GetStringFromDatabase("Server", _T(""), buffer, SIZEOF(buffer));
+ GetStringFromDatabase("Server", _T(""), buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer);
SetDlgItemInt(hWnd, IDC_PORT_EDIT, db_get_dw(NULL, ModuleName, "Port", EXCHANGE_PORT), FALSE);
@@ -111,16 +111,16 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
db_set_b(NULL, ModuleName, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
TCHAR buffer[4096];
- GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, _countof(buffer));
db_set_ts(NULL, ModuleName, "Username", buffer);
- GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, _countof(buffer));
db_set_ts(NULL, ModuleName, "Password", buffer);
- GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, _countof(buffer));
db_set_ts(NULL, ModuleName, "Server", buffer);
- GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, SIZEOF(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, "Interval", GetDlgItemInt(hWnd,IDC_INTERVAL_EDIT,NULL,FALSE));
@@ -174,7 +174,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
for (int i = 0; i < count; i++) {
if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) {
TCHAR emailID[4096]; //uhh
- ListView_GetItemText(hWnd, i, 2, emailID, SIZEOF(emailID));
+ ListView_GetItemText(hWnd, i, 2, emailID, _countof(emailID));
exchangeServer.OpenMessage(emailID);
}
}
@@ -303,7 +303,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 2;
- item.cchTextMax = SIZEOF(emailID);
+ item.cchTextMax = _countof(emailID);
item.pszText = emailID;
ListView_GetItem(hList, &item);
exchangeServer.MarkEmailAsRead(emailID);
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp
index ae6b2309e7..c362ac3852 100644
--- a/plugins/Exchange/src/emails.cpp
+++ b/plugins/Exchange/src/emails.cpp
@@ -280,9 +280,9 @@ int CExchangeServer::Check(int bNoEmailsNotify)
if (((count > 0) || ((bNoEmailsNotify) && (count >= 0))) && (count != -1)) {
TCHAR buffer[1024];
if (count != 1)
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("You have %d unread emails..."), count);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("You have %d unread emails..."), count);
else
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("You have one unread email..."));
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("You have one unread email..."));
ShowMessage(buffer, count);
}
diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h
index 1557d84bb1..c638329261 100644
--- a/plugins/ExternalAPI/m_variables.h
+++ b/plugins/ExternalAPI/m_variables.h
@@ -32,7 +32,7 @@
#include <m_button.h>
#endif
-#ifndef SIZEOF
+#ifndef _countof
#include <win2k.h>
#endif
@@ -516,7 +516,7 @@ __inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) {
if (ServiceExists(MS_VARS_GETSKINITEM))
hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON);
- GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, SIZEOF(tszClass));
+ GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, _countof(tszClass));
if (!mir_tstrcmp(tszClass, _T("Button"))) {
if (hIcon != NULL) {
SetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)|BS_ICON);
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp
index 4322f9d5c1..c16bd30ea5 100644
--- a/plugins/FTPFileYM/src/dialog.cpp
+++ b/plugins/FTPFileYM/src/dialog.cpp
@@ -133,7 +133,7 @@ void UploadDialog::Tab::select()
void UploadDialog::Tab::labelCompleted()
{
TCHAR buff[64], buff2[256];
- mir_sntprintf(buff2, SIZEOF(buff2), _T("* %s"), Utils::getTextFragment(this->job->stzFileName, 20, buff));
+ mir_sntprintf(buff2, _countof(buff2), _T("* %s"), Utils::getTextFragment(this->job->stzFileName, 20, buff));
TCITEM tab = {0};
tab.mask = TCIF_TEXT;
@@ -301,7 +301,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
bool bChecked = (tab->iOptAutoDelete == -1) ? true : false;
TCHAR buff[256];
- for (int i = 0; i < SIZEOF(times); i++)
+ for (int i = 0; i < _countof(times); i++)
{
if (i == 3 || i == 7)
AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0);
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp
index ef6ffd166a..5b69b107fa 100644
--- a/plugins/FTPFileYM/src/ftpfile.cpp
+++ b/plugins/FTPFileYM/src/ftpfile.cpp
@@ -84,7 +84,7 @@ static IconItem iconList[] =
static void InitIcolib()
{
- Icon_Register(hInst, LPGEN("FTP File"), iconList, SIZEOF(iconList), MODULE);
+ Icon_Register(hInst, LPGEN("FTP File"), iconList, _countof(iconList), MODULE);
}
void InitMenuItems()
@@ -112,7 +112,7 @@ void InitMenuItems()
for (int i = 0; i < ServerList::FTP_COUNT; i++)
{
if (DB::getStringF(0, MODULE, "Name%d", i, stzName))
- mir_sntprintf(stzName, SIZEOF(stzName), TranslateT("FTP Server %d"), i + 1);
+ mir_sntprintf(stzName, _countof(stzName), TranslateT("FTP Server %d"), i + 1);
mi.flags = CMIF_TCHAR;
mi.hParentMenu = 0;
diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp
index 9fa21c5a5b..5683564719 100644
--- a/plugins/FTPFileYM/src/job_generic.cpp
+++ b/plugins/FTPFileYM/src/job_generic.cpp
@@ -54,7 +54,7 @@ int GenericJob::openFileDialog()
ofn.nFilterIndex = 1;
ofn.lpstrFile = this->stzFilePath;
ofn.lpstrTitle = TranslateT("FTP File - Select files");
- ofn.nMaxFile = SIZEOF(this->stzFilePath);
+ ofn.nMaxFile = _countof(this->stzFilePath);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_NOCHANGEDIR;
return GetOpenFileName(&ofn);
}
@@ -85,7 +85,7 @@ void GenericJob::getFilesFromOpenDialog()
TCHAR *ptr = this->stzFilePath + length + 1;
while (ptr[0])
{
- mir_sntprintf(stzFile, SIZEOF(stzFile), _T("%s\\%s"), this->stzFilePath, ptr);
+ mir_sntprintf(stzFile, _countof(stzFile), _T("%s\\%s"), this->stzFilePath, ptr);
this->addFile(stzFile);
ptr += mir_tstrlen(ptr) + 1;
}
@@ -113,7 +113,7 @@ int GenericJob::getFilesFromFolder(TCHAR *stzFolder)
{
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
- mir_sntprintf(stzFile, SIZEOF(stzFile), _T("%s\\%s"), stzFolder, ffd.cFileName);
+ mir_sntprintf(stzFile, _countof(stzFile), _T("%s\\%s"), stzFolder, ffd.cFileName);
this->addFile(stzFile);
}
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp
index 11fe8c22fe..13b3b80844 100644
--- a/plugins/FTPFileYM/src/job_packer.cpp
+++ b/plugins/FTPFileYM/src/job_packer.cpp
@@ -55,9 +55,9 @@ void PackerJob::getZipFilePath()
if (stzFileName[0] == '\0')
mir_tstrcpy(stzFileName, _T("archive"));
- GetTempPath(SIZEOF(buff), buff);
+ GetTempPath(_countof(buff), buff);
- mir_sntprintf(this->stzFilePath, SIZEOF(this->stzFilePath), _T("%s%s.zip"), buff, stzFileName);
+ mir_sntprintf(this->stzFilePath, _countof(this->stzFilePath), _T("%s%s.zip"), buff, stzFileName);
mir_tstrcpy(this->stzFileName, Utils::getFileNameFromPath(this->stzFilePath));
if (opt.bSetZipName)
@@ -254,10 +254,10 @@ void PackerJob::updateStats()
this->lastUpdateTick = dwNewTick;
double speed = ((double)this->uiReaded / 1024)/(time(NULL) - this->startTS);
- mir_sntprintf(this->tab->stzSpeed, SIZEOF(this->tab->stzSpeed), TranslateT("%0.1f kB/s"), speed);
+ mir_sntprintf(this->tab->stzSpeed, _countof(this->tab->stzSpeed), TranslateT("%0.1f kB/s"), speed);
double perc = this->uiFileSize ? ((double)this->uiReaded / this->uiFileSize) * 100 : 0;
- mir_sntprintf(this->tab->stzComplet, SIZEOF(this->tab->stzComplet), TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)this->uiReaded/1024, (int)this->uiFileSize/1024);
+ mir_sntprintf(this->tab->stzComplet, _countof(this->tab->stzComplet), TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)this->uiReaded/1024, (int)this->uiFileSize/1024);
TCHAR buff[256];
long s = (this->uiFileSize - this->uiReaded) / (long)(speed * 1024);
@@ -268,7 +268,7 @@ void PackerJob::updateStats()
if (d > 0) mir_sntprintf(buff, _T("%dd %02d:%02d:%02d"), d, h, m, s);
else mir_sntprintf(buff, _T("%02d:%02d:%02d"), h, m, s);
- mir_sntprintf(this->tab->stzRemain, SIZEOF(this->tab->stzRemain), TranslateT("%s (%d kB/%d kB)"), buff, (this->uiFileSize - this->uiReaded)/1024, this->uiFileSize/1024);
+ mir_sntprintf(this->tab->stzRemain, _countof(this->tab->stzRemain), TranslateT("%s (%d kB/%d kB)"), buff, (this->uiFileSize - this->uiReaded)/1024, this->uiFileSize/1024);
this->refreshTab(false);
}
@@ -338,7 +338,7 @@ void PackerJob::closeAllTabs()
void PackerJob::createToolTip()
{
TCHAR *server = mir_a2t(this->ftp->szServer);
- mir_sntprintf(uDlg->stzToolTipText, SIZEOF(uDlg->stzToolTipText),
+ mir_sntprintf(uDlg->stzToolTipText, _countof(uDlg->stzToolTipText),
TranslateT("Status: %s\r\nFile: %s\r\nServer: %s"),
this->getStatusString(),
this->stzFileName,
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp
index 11601a67d4..88fa9b34e0 100644
--- a/plugins/FTPFileYM/src/job_upload.cpp
+++ b/plugins/FTPFileYM/src/job_upload.cpp
@@ -35,14 +35,14 @@ UploadJob::UploadJob(UploadJob *job) :
GenericJob(job),fp(NULL),uiSent(0),uiTotalSent(0),uiFileSize(0)
{
mir_strcpy(this->szFileLink, job->szFileLink);
- for (int i = 0; i < SIZEOF(this->lastSpeed); i++)
+ for (int i = 0; i < _countof(this->lastSpeed); i++)
this->lastSpeed[i] = 0;
}
UploadJob::UploadJob(PackerJob *job) :
GenericJob(job),fp(NULL),uiSent(0),uiTotalSent(0),uiFileSize(0)
{
- for (int i = 0; i < SIZEOF(this->lastSpeed); i++)
+ for (int i = 0; i < _countof(this->lastSpeed); i++)
this->lastSpeed[i] = 0;
Utils::makeSafeString(job->stzFileName, this->szSafeFileName);
@@ -385,19 +385,19 @@ void UploadJob::updateStats()
if (this->uiSent && (time(NULL) > this->startTS)) {
double speed = ((double)this->uiSent / 1024)/(time(NULL) - this->startTS);
this->avgSpeed = speed;
- for (int i = 0; i < SIZEOF(this->lastSpeed); i++) {
+ for (int i = 0; i < _countof(this->lastSpeed); i++) {
this->avgSpeed += (this->lastSpeed[i] == 0 ? speed : this->lastSpeed[i]);
- if (i < SIZEOF(this->lastSpeed) - 1)
+ if (i < _countof(this->lastSpeed) - 1)
this->lastSpeed[i + 1] = this->lastSpeed[i];
}
- this->avgSpeed /= SIZEOF(this->lastSpeed) + 1;
+ this->avgSpeed /= _countof(this->lastSpeed) + 1;
this->lastSpeed[0] = speed;
- mir_sntprintf(this->tab->stzSpeed, SIZEOF(this->tab->stzSpeed), _T("%0.1f kB/s"), this->avgSpeed);
+ mir_sntprintf(this->tab->stzSpeed, _countof(this->tab->stzSpeed), _T("%0.1f kB/s"), this->avgSpeed);
double perc = this->uiFileSize ? ((double)this->uiTotalSent / this->uiFileSize) * 100 : 0;
- mir_sntprintf(this->tab->stzComplet, SIZEOF(this->tab->stzComplet), _T("%0.1f%% (%d kB/%d kB)"), perc, (int)this->uiTotalSent/1024, (int)this->uiFileSize/1024);
+ mir_sntprintf(this->tab->stzComplet, _countof(this->tab->stzComplet), _T("%0.1f%% (%d kB/%d kB)"), perc, (int)this->uiTotalSent/1024, (int)this->uiFileSize/1024);
long s = (this->uiFileSize - this->uiTotalSent) / (long)(this->avgSpeed * 1024);
int d = (s / 60 / 60 / 24);
@@ -408,7 +408,7 @@ void UploadJob::updateStats()
TCHAR buff[256];
if (d > 0) mir_sntprintf(buff, _T("%dd %02d:%02d:%02d"), d, h, m, s);
else mir_sntprintf(buff, _T("%02d:%02d:%02d"), h, m, s);
- mir_sntprintf(this->tab->stzRemain, SIZEOF(this->tab->stzRemain), _T("%s (%d kB/%d kB)"), buff, (this->uiFileSize - this->uiTotalSent)/1024, this->uiFileSize/1024);
+ mir_sntprintf(this->tab->stzRemain, _countof(this->tab->stzRemain), _T("%s (%d kB/%d kB)"), buff, (this->uiFileSize - this->uiTotalSent)/1024, this->uiFileSize/1024);
this->refreshTab(false);
}
@@ -498,12 +498,12 @@ void UploadJob::closeAllTabs()
void UploadJob::createToolTip()
{
TCHAR *server = mir_a2t(this->ftp->szServer);
- mir_sntprintf(uDlg->stzToolTipText, SIZEOF(uDlg->stzToolTipText),
+ mir_sntprintf(uDlg->stzToolTipText, _countof(uDlg->stzToolTipText),
TranslateT("Status: %s\r\nFile: %s\r\nServer: %s"),
this->getStatusString(), this->stzFileName, server);
if (this->tab->stzSpeed[0] && this->tab->stzComplet[0] && this->tab->stzRemain[0])
- mir_sntprintf(uDlg->stzToolTipText, SIZEOF(uDlg->stzToolTipText),
+ mir_sntprintf(uDlg->stzToolTipText, _countof(uDlg->stzToolTipText),
TranslateT("%s\r\nSpeed: %s\r\nCompleted: %s\r\nRemaining: %s"),
uDlg->stzToolTipText, this->tab->stzSpeed, this->tab->stzComplet, this->tab->stzRemain);
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp
index e7503416cb..a68bcd1496 100644
--- a/plugins/FTPFileYM/src/options.cpp
+++ b/plugins/FTPFileYM/src/options.cpp
@@ -153,13 +153,13 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa
opt.defaultFTP = opt.selected;
ServerList::FTP *ftp = ftpList.getSelected();
- GetDlgItemText(hwndDlg, IDC_FTPLIST, ftp->stzName, SIZEOF(ftp->stzName));
- GetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer, SIZEOF(ftp->szServer));
- GetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser, SIZEOF(ftp->szUser));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass, SIZEOF(ftp->szPass));
- GetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir, SIZEOF(ftp->szDir));
- GetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl, SIZEOF(ftp->szUrl));
- GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->szChmod, SIZEOF(ftp->szChmod));
+ GetDlgItemText(hwndDlg, IDC_FTPLIST, ftp->stzName, _countof(ftp->stzName));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer, _countof(ftp->szServer));
+ GetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser, _countof(ftp->szUser));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass, _countof(ftp->szPass));
+ GetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir, _countof(ftp->szDir));
+ GetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl, _countof(ftp->szUrl));
+ GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->szChmod, _countof(ftp->szChmod));
ftp->ftpProto = (ServerList::FTP::EProtoType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST));
ftp->iPort = GetDlgItemInt(hwndDlg, IDC_PORT, 0, 0);
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp
index 95c677b77c..bb20a4bb74 100644
--- a/plugins/FTPFileYM/src/serverlist.cpp
+++ b/plugins/FTPFileYM/src/serverlist.cpp
@@ -65,7 +65,7 @@ void ServerList::saveToDb() const
ServerList::FTP::FTP(int index)
{
if (DB::getStringF(0, MODULE, "Name%d", index, this->stzName))
- mir_sntprintf(this->stzName, SIZEOF(this->stzName), TranslateT("FTP Server %d"), index + 1);
+ mir_sntprintf(this->stzName, _countof(this->stzName), TranslateT("FTP Server %d"), index + 1);
DB::getAStringF(0, MODULE, "Password%d", index, this->szPass);
DB::getAStringF(0, MODULE, "Server%d", index, this->szServer);
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp
index 896eae5cca..d35e8c890e 100644
--- a/plugins/FavContacts/src/contact_cache.cpp
+++ b/plugins/FavContacts/src/contact_cache.cpp
@@ -148,8 +148,8 @@ void CContactCache::TContactInfo::LoadInfo()
CNF_CONAME, CNF_CODEPT, CNF_COCITY, CNF_COSTATE, CNF_COSTREET, CNF_COCOUNTRY
};
- for (int i = 0; i < SIZEOF(items); ++i)
- if (AppendInfo(p, SIZEOF(info) - (p - info), hContact, items[i]))
+ for (int i = 0; i < _countof(items); ++i)
+ if (AppendInfo(p, _countof(info) - (p - info), hContact, items[i]))
p += mir_tstrlen(p) + 1;
*p = 0;
@@ -180,7 +180,7 @@ bool CContactCache::filter(int rate, TCHAR *str)
HKL kbdLayoutActive = GetKeyboardLayout(GetCurrentThreadId());
HKL kbdLayouts[10];
- int nKbdLayouts = GetKeyboardLayoutList(SIZEOF(kbdLayouts), kbdLayouts);
+ int nKbdLayouts = GetKeyboardLayoutList(_countof(kbdLayouts), kbdLayouts);
TCHAR buf[256];
BYTE keyState[256] = { 0 };
@@ -193,7 +193,7 @@ bool CContactCache::filter(int rate, TCHAR *str)
for (i = 0; str[i]; ++i) {
UINT vk = VkKeyScanEx(str[i], kbdLayoutActive);
UINT scan = MapVirtualKeyEx(vk, 0, kbdLayoutActive);
- ToUnicodeEx(vk, scan, keyState, buf + i, SIZEOF(buf) - i, 0, kbdLayouts[iLayout]);
+ ToUnicodeEx(vk, scan, keyState, buf + i, _countof(buf) - i, 0, kbdLayouts[iLayout]);
}
buf[i] = 0;
}
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp
index 62579e9ba2..42cc773ae7 100644
--- a/plugins/FavContacts/src/main.cpp
+++ b/plugins/FavContacts/src/main.cpp
@@ -78,7 +78,7 @@ extern "C" __declspec(dllexport) int Load(void)
/////////////////////////////////////////////////////////////////////////////////////
- Icon_Register(g_hInst, LPGEN("Favorites"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, LPGEN("Favorites"), iconList, _countof(iconList));
LoadHttpApi();
return 0;
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp
index 0045f5da1b..2bb6fef449 100644
--- a/plugins/FavContacts/src/menu.cpp
+++ b/plugins/FavContacts/src/menu.cpp
@@ -394,7 +394,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam,
g_filter[l-1] = 0;
}
else if (_istalnum(LOWORD(wParam))) {
- if (mir_tstrlen(g_filter) < SIZEOF(g_filter) - 1) {
+ if (mir_tstrlen(g_filter) < _countof(g_filter) - 1) {
TCHAR s[] = { LOWORD(wParam), 0 };
mir_tstrcat(g_filter, s);
}
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp
index c958e08dcc..1edaf90842 100644
--- a/plugins/FileAsMessage/src/dialog.cpp
+++ b/plugins/FileAsMessage/src/dialog.cpp
@@ -193,7 +193,7 @@ void FILEECHO::setState(DWORD state)
iState = state;
int indx;
- for (indx = 0; indx < SIZEOF(controlEnabled); indx++)
+ for (indx = 0; indx < _countof(controlEnabled); indx++)
{
EnableWindow(GetDlgItem(hDlg, controlEnabled[indx][0]), (iState & controlEnabled[indx][1]) != 0);
}
@@ -243,9 +243,9 @@ void FILEECHO::updateTitle()
contactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0);
if (iState == STATE_OPERATE && chunkCount != 0)
- mir_snprintf(newtitle, SIZEOF(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, _countof(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName);
else
- mir_snprintf(newtitle, SIZEOF(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName);
+ mir_snprintf(newtitle, _countof(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName);
SetWindowText(hDlg, newtitle);
}
@@ -412,9 +412,9 @@ void FILEECHO::sendReq()
if (*p == '\\')
mir_strcpy(filename, p + 1);
- mir_snprintf(sendbuf, SIZEOF(sendbuf), Translate("Size: %d bytes"), fileSize);
+ mir_snprintf(sendbuf, _countof(sendbuf), Translate("Size: %d bytes"), fileSize);
SetDlgItemText(hDlg, IDC_FILESIZE, sendbuf);
- mir_snprintf(sendbuf, SIZEOF(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary + '0', codeSymb, chunkCount, fileSize);
+ mir_snprintf(sendbuf, _countof(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary + '0', codeSymb, chunkCount, fileSize);
sendCmd(0, CMD_REQ, sendbuf, filename);
SetDlgItemText(hDlg, IDC_STATUS, Translate("Request sent. Awaiting of acceptance.."));
@@ -429,7 +429,7 @@ void FILEECHO::incomeRequest(char *param)
char *p = strchr(param, '?');
if (p == NULL) return; *p++ = 0;
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf);
- mir_strncat(buf, param, SIZEOF(buf) - mir_strlen(buf));
+ mir_strncat(buf, param, _countof(buf) - mir_strlen(buf));
free(filename);
filename = mir_strdup(buf);
// p == &c
@@ -618,7 +618,7 @@ void FILEECHO::onSendTimer()
}
char prefix[128];
- mir_snprintf(prefix, SIZEOF(prefix), "%X,%X,%X>", chunkIndx + 1, chunkPos[chunkIndx], chksum);
+ mir_snprintf(prefix, _countof(prefix), "%X,%X,%X>", chunkIndx + 1, chunkPos[chunkIndx], chksum);
#ifdef DEBUG
overhead += mir_tstrlen((char*)buffer);
#endif
@@ -869,7 +869,7 @@ void CreateDirectoryTree(char *szDir)
DWORD dwAttributes;
char *pszLastBackslash, szTestDir[MAX_PATH];
- mir_strncpy(szTestDir, szDir, SIZEOF(szTestDir));
+ mir_strncpy(szTestDir, szDir, _countof(szTestDir));
if ((dwAttributes = GetFileAttributes(szTestDir)) != 0xffffffff && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return;
pszLastBackslash = strrchr(szTestDir, '\\');
@@ -1151,7 +1151,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
memset(&ofn, 0, sizeof(ofn));
*str = 0;
- GetDlgItemText(hDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hDlg, IDC_FILENAME, str, _countof(str));
//ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
@@ -1159,7 +1159,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
ofn.lpstrFile = str;
ofn.Flags = dat->inSend ? OFN_FILEMUSTEXIST : 0;
ofn.lpstrTitle = dat->inSend ? Translate("Select a file") : Translate("Save as");
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
if (!GetOpenFileName(&ofn)) break;
if (!dat->inSend && dat->iState == STATE_FINISHED) break;
@@ -1169,7 +1169,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (size != -1)
mir_snprintf(str, Translate("Size: %d bytes"), size);
else
- mir_strncpy(str, Translate("Can't get a file size"), SIZEOF(str));
+ mir_strncpy(str, Translate("Can't get a file size"), _countof(str));
SetDlgItemText(hDlg, IDC_FILESIZE, str);
break;
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp
index 6892863329..1e405a38c4 100644
--- a/plugins/FileAsMessage/src/main.cpp
+++ b/plugins/FileAsMessage/src/main.cpp
@@ -42,7 +42,7 @@ int iIconId[5] = { 3, 2, 4, 1, 0 };
//
int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam)
{
- for (int indx = 0; indx < SIZEOF(hIcons); indx++)
+ for (int indx = 0; indx < _countof(hIcons); indx++)
hIcons[indx] = IcoLib_GetIconByHandle(iconList[indx].hIcolib);
WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0, 0);
@@ -169,7 +169,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD dwVersi
static int OnModulesLoaded(WPARAM wparam, LPARAM lparam)
{
- for (int indx = 0; indx < SIZEOF(hIcons); indx++)
+ for (int indx = 0; indx < _countof(hIcons); indx++)
hIcons[indx] = IcoLib_GetIconByHandle(iconList[indx].hIcolib);
hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
@@ -191,7 +191,7 @@ extern "C" __declspec(dllexport) int Load(void)
InitCRC32();
- Icon_Register(hInst, "fileAsMessage", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "fileAsMessage", iconList, _countof(iconList));
hFileList = WindowList_Create();
diff --git a/plugins/FileAsMessage/src/optionsdlg.cpp b/plugins/FileAsMessage/src/optionsdlg.cpp
index df20bc5ade..d8b34e5e38 100644
--- a/plugins/FileAsMessage/src/optionsdlg.cpp
+++ b/plugins/FileAsMessage/src/optionsdlg.cpp
@@ -43,7 +43,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
{
TranslateDialogDefault(hwndDlg);
- for (int indx = 0; indx < SIZEOF(settingId); indx++)
+ for (int indx = 0; indx < _countof(settingId); indx++)
if (settingId[indx] > 0)
SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, db_get_dw(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]));
else
@@ -59,7 +59,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (//MAKEWPARAM(IDC_AUTO, BN_CLICKED) != wParam ||
MAKEWPARAM(IDC_ALPHANUM, BN_CLICKED) != wParam)
{
- for (int indx = 0; indx < SIZEOF(settingId); indx++)
+ for (int indx = 0; indx < _countof(settingId); indx++)
{
if (LOWORD(wParam) == abs(settingId[indx]))
{
@@ -88,7 +88,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
int value;
BOOL succ;
- for (int indx = 0; indx < SIZEOF(settingId); indx++)
+ for (int indx = 0; indx < _countof(settingId); indx++)
{
if (settingId[indx] > 0)
value = SendDlgItemMessage(hwndDlg, settingId[indx], CPM_GETCOLOUR, 0, 0);
diff --git a/plugins/FingerprintNG/src/masks.cpp b/plugins/FingerprintNG/src/masks.cpp
index 31a2ddce6b..e10f8a7a51 100644
--- a/plugins/FingerprintNG/src/masks.cpp
+++ b/plugins/FingerprintNG/src/masks.cpp
@@ -636,7 +636,7 @@ KN_FP_MASK def_kn_fp_mask[] =
};
-int DEFAULT_KN_FP_MASK_COUNT = SIZEOF(def_kn_fp_mask);
+int DEFAULT_KN_FP_MASK_COUNT = _countof(def_kn_fp_mask);
//#########################################################################################################################################################################
//################################# OVERLAYS LAYER #1 #################################################################################################################
@@ -763,7 +763,7 @@ KN_FP_MASK def_kn_fp_overlays_mask[] =
{ "client_on_mobile", _T("*(mobile)*"), LPGENT("Mobile overlay"), IDI_PLATFORM_MOBILE, OVERLAYS_PLATFORM_CASE },
};
-int DEFAULT_KN_FP_OVERLAYS_COUNT = SIZEOF(def_kn_fp_overlays_mask);
+int DEFAULT_KN_FP_OVERLAYS_COUNT = _countof(def_kn_fp_overlays_mask);
//#########################################################################################################################################################################
//#########################################################################################################################################################################
@@ -806,7 +806,7 @@ KN_FP_MASK def_kn_fp_overlays2_mask[] =
{ "client_MirIM_04_over", _T("*Miranda*0.4.*"), LPGENT("Miranda IM v0.4 #2 overlay"), IDI_MIRANDA_IM_V4, MIRANDA_VERSION_CASE },
};
-int DEFAULT_KN_FP_OVERLAYS2_COUNT = SIZEOF(def_kn_fp_overlays2_mask);
+int DEFAULT_KN_FP_OVERLAYS2_COUNT = _countof(def_kn_fp_overlays2_mask);
//#########################################################################################################################################################################
//#########################################################################################################################################################################
@@ -820,7 +820,7 @@ KN_FP_MASK def_kn_fp_overlays3_mask[] =
{ "client_Unicode", _T("*unicode*"), LPGENT("Unicode overlay"), IDI_UNICODE_CLIENT, OVERLAYS_UNICODE_CASE },
};
-int DEFAULT_KN_FP_OVERLAYS3_COUNT = SIZEOF(def_kn_fp_overlays3_mask);
+int DEFAULT_KN_FP_OVERLAYS3_COUNT = _countof(def_kn_fp_overlays3_mask);
//#########################################################################################################################################################################
//#########################################################################################################################################################################
@@ -833,4 +833,4 @@ KN_FP_MASK def_kn_fp_overlays4_mask[] =
{ "client_SecureIM_over", _T("*Secure*IM*"), LPGENT("SecureIM overlay"), IDI_SECUREIM_OVERLAY, OVERLAYS_SECURITY_CASE },
};
-int DEFAULT_KN_FP_OVERLAYS4_COUNT = SIZEOF(def_kn_fp_overlays4_mask); \ No newline at end of file
+int DEFAULT_KN_FP_OVERLAYS4_COUNT = _countof(def_kn_fp_overlays4_mask);
diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp
index c3f62ba8bb..8ebe8bd2c9 100644
--- a/plugins/FingerprintNG/src/options.cpp
+++ b/plugins/FingerprintNG/src/options.cpp
@@ -83,13 +83,13 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- for (i = 0; i < SIZEOF(settings); i++)
+ for (i = 0; i < _countof(settings); i++)
LoadDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName, settings[i].defValue);
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
- for (i = 0; i < SIZEOF(settings); i++)
+ for (i = 0; i < _countof(settings); i++)
if (settings[i].idCtrl == LOWORD(wParam)) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -99,7 +99,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_NOTIFY:
NMHDR *hdr = (NMHDR *)lParam;
if (hdr && hdr->code == PSN_APPLY) {
- for (i = 0; i < SIZEOF(settings); i++)
+ for (i = 0; i < _countof(settings); i++)
StoreDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName);
ClearFI();
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp
index 38f688381e..4280ed8f61 100644
--- a/plugins/FloatingContacts/src/filedrop.cpp
+++ b/plugins/FloatingContacts/src/filedrop.cpp
@@ -202,7 +202,7 @@ static int CountFiles(char *szItem)
if (NULL != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
- mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName);
+ mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
++nCount;
@@ -237,7 +237,7 @@ static void SaveFiles(char *szItem, char **ppFiles, int *pnCount)
if (NULL != strstr(szItem, "*.*")) {
size_t offset = mir_strlen(szDirName) - 3;
- mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName);
+ mir_snprintf(szDirName + offset, _countof(szDirName) - offset, "%s\0", fd.cFileName);
}
ppFiles[*pnCount] = _strdup(szDirName);
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index 0a5fd39e64..35c42ab534 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -908,7 +908,7 @@ extern "C" int __declspec(dllexport) Load()
InitOptions();
- for (int i = 0; i < SIZEOF(s_fonts); i++) {
+ for (int i = 0; i < _countof(s_fonts); i++) {
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, FALSE);
if (i == FLT_FONTID_OFFINVIS || i == FLT_FONTID_INVIS)
@@ -917,7 +917,7 @@ extern "C" int __declspec(dllexport) Load()
COLORREF defColor = GetSysColor((i == FLT_FONTID_NOTONLIST) ? COLOR_3DSHADOW : COLOR_WINDOWTEXT);
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), "Font%d", i);
+ mir_snprintf(szId, _countof(szId), "Font%d", i);
FontService_RegisterFont(MODULE, szId, LPGENT("Floating contacts"), s_fonts[i], NULL, NULL, i + 1, false, &lf, defColor);
}
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp
index 2e0cf20636..3f6a7e8c0d 100644
--- a/plugins/FloatingContacts/src/options.cpp
+++ b/plugins/FloatingContacts/src/options.cpp
@@ -199,7 +199,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
- mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", btOpacity);
+ mir_snprintf(szPercent, _countof(szPercent), "%d%%", btOpacity);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0);
@@ -230,7 +230,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
fcOpt.thumbAlpha = (BYTE)((nPos * 255) / 100);
SetThumbsOpacity(fcOpt.thumbAlpha);
- mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", nPos);
+ mir_snprintf(szPercent, _countof(szPercent), "%d%%", nPos);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -245,8 +245,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
case IDC_BROWSE:
{
TCHAR str[MAX_PATH], filter[512];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -254,7 +254,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("bmp");
if (!GetOpenFileName(&ofn))
@@ -302,7 +302,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
db_set_b(NULL, MODULE, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
TCHAR str[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
db_set_ts(NULL, MODULE, "BkBitmap", str);
WORD flags = 0;
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp
index ff347d9ba2..b5e6668912 100644
--- a/plugins/Folders/src/dlg_handlers.cpp
+++ b/plugins/Folders/src/dlg_handlers.cpp
@@ -91,7 +91,7 @@ static void SaveItem(HWND hWnd, PFolderItem item, int bEnableApply)
return;
TCHAR buffer[MAX_FOLDER_SIZE];
- GetEditText(hWnd, buffer, SIZEOF(buffer));
+ GetEditText(hWnd, buffer, _countof(buffer));
item->SetFormat(buffer);
if (bEnableApply)
@@ -123,7 +123,7 @@ static INT_PTR CALLBACK DlgProcVariables(HWND hWnd, UINT msg, WPARAM wParam, LPA
switch (msg) {
case WM_INITDIALOG:
- mir_sntprintf(tszMessage, SIZEOF(tszMessage), _T("%s\r\n%s\r\n\r\n%s\t\t%s\r\n%%miranda_path%%\t\t%s\r\n%%profile_path%%\t\t%s\r\n\t\t\t%s\r\n%%current_profile%%\t\t%s\r\n\t\t\t%s\r\n\r\n\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n%s\r\n%%miranda_path%%\t\t\t%s\r\n%%profile_path%%\t\t\t%s\r\n%%current_profile%%\t\t\t%s\r\n%%temp%%\t\t\t\t%s\r\n%%profile_path%%\\%%current_profile%%\t%s\r\n%%miranda_path%%\\plugins\\config\t%s\r\n' %%miranda_path%%\\\\\\\\ '\t\t%s\r\n\r\n%s"),
+ mir_sntprintf(tszMessage, _countof(tszMessage), _T("%s\r\n%s\r\n\r\n%s\t\t%s\r\n%%miranda_path%%\t\t%s\r\n%%profile_path%%\t\t%s\r\n\t\t\t%s\r\n%%current_profile%%\t\t%s\r\n\t\t\t%s\r\n\r\n\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n%s\r\n%%miranda_path%%\t\t\t%s\r\n%%profile_path%%\t\t\t%s\r\n%%current_profile%%\t\t\t%s\r\n%%temp%%\t\t\t\t%s\r\n%%profile_path%%\\%%current_profile%%\t%s\r\n%%miranda_path%%\\plugins\\config\t%s\r\n' %%miranda_path%%\\\\\\\\ '\t\t%s\r\n\r\n%s"),
TranslateT("Don't forget to click on Apply to save the changes. If you don't then the changes won't"),
TranslateT("be saved to the database, they will only be valid for this session."),
TranslateT("Variable string"),
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp
index a66984ab7e..22043a172c 100644
--- a/plugins/Folders/src/folderItem.cpp
+++ b/plugins/Folders/src/folderItem.cpp
@@ -114,8 +114,8 @@ int CFolderItem::FolderDeleteOldDirectory(int showFolder)
void CFolderItem::GetDataFromDatabase(const TCHAR *szNotFound)
{
char szSettingName[256];
- strcpy_s(szSettingName, SIZEOF(szSettingName), m_szSection);
- strcat_s(szSettingName, SIZEOF(szSettingName), m_szName);
+ strcpy_s(szSettingName, _countof(szSettingName), m_szSection);
+ strcat_s(szSettingName, _countof(szSettingName), m_szName);
ptrT tszValue(db_get_tsa(NULL, ModuleName, szSettingName));
SetFormat(tszValue != NULL ? tszValue : szNotFound);
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp
index dfd24f6b59..80fd22c6b2 100644
--- a/plugins/Folders/src/services.cpp
+++ b/plugins/Folders/src/services.cpp
@@ -79,15 +79,15 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam)
int InitServices()
{
- CallService(MS_DB_GETPROFILEPATHT, SIZEOF(szCurrentProfilePath), (LPARAM)szCurrentProfilePath);
- CallService(MS_DB_GETPROFILENAMET, SIZEOF(szCurrentProfile), (LPARAM)szCurrentProfile);
+ CallService(MS_DB_GETPROFILEPATHT, _countof(szCurrentProfilePath), (LPARAM)szCurrentProfilePath);
+ CallService(MS_DB_GETPROFILENAMET, _countof(szCurrentProfile), (LPARAM)szCurrentProfile);
TCHAR *pos = _tcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0;
- GetModuleFileName(GetModuleHandleA("mir_app.dll"), szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileName(GetModuleHandleA("mir_app.dll"), szMirandaPath, _countof(szMirandaPath));
pos = _tcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0;
TCHAR *szTemp = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- mir_sntprintf(szUserDataPath, SIZEOF(szUserDataPath), szTemp);
+ mir_sntprintf(szUserDataPath, _countof(szUserDataPath), szTemp);
mir_free(szTemp);
CreateServiceFunction(MS_FOLDERS_GET_PATH, GetPathService);
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp
index 19ce5830ac..f329cbf2e0 100644
--- a/plugins/GmailNotifier/src/options.cpp
+++ b/plugins/GmailNotifier/src/options.cpp
@@ -1,7 +1,7 @@
#include "gmail.h"
static void SaveButton(HWND hwndDlg,HWND hwndCombo, int curIndex) {
- if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, SIZEOF(acc[curIndex].name))) {
+ if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, _countof(acc[curIndex].name))) {
char *tail = strstr(acc[curIndex].name, "@");
if (tail && mir_strcmp(tail + 1, "gmail.com") != 0)
mir_strcpy(acc[curIndex].hosted, tail + 1);
@@ -10,7 +10,7 @@ static void SaveButton(HWND hwndDlg,HWND hwndCombo, int curIndex) {
SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0);
db_set_s(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name);
db_set_s(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name);
- GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, SIZEOF(acc[curIndex].pass));
+ GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, _countof(acc[curIndex].pass));
db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass);
}
}
@@ -128,12 +128,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
OPENFILENAME OpenFileName;
TCHAR szName[_MAX_PATH];
memset(&OpenFileName, 0, sizeof(OPENFILENAME));
- GetDlgItemText(hwndDlg, IDC_PRG, szName, SIZEOF(szName));
+ GetDlgItemText(hwndDlg, IDC_PRG, szName, _countof(szName));
OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hwndDlg;
OpenFileName.lpstrFilter = _T("Executables (*.exe;*.com;*.bat)\0*.exe;*.com;*.bat\0\0");
OpenFileName.lpstrFile = szName;
- OpenFileName.nMaxFile = SIZEOF(szName);
+ OpenFileName.nMaxFile = _countof(szName);
OpenFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
if (!GetOpenFileName(&OpenFileName))
return 0;
@@ -224,7 +224,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
else if (IsDlgButtonChecked(hwndDlg, IDC_STARTPRG) == BST_CHECKED) {
opt.OpenUsePrg = 2;
}
- GetDlgItemTextA(hwndDlg, IDC_PRG, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PRG, str, _countof(str));
db_set_dw(NULL, pluginName, "OpenUsePrg", opt.OpenUsePrg);
db_set_s(NULL, pluginName, "OpenUsePrgPath", str);
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp
index cf1157ad3b..b76183bcf3 100644
--- a/plugins/HTTPServer/src/GuiElements.cpp
+++ b/plugins/HTTPServer/src/GuiElements.cpp
@@ -284,7 +284,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook(
HWND hFileName = GetDlgItem(hWndFileDlg, edt1);
char pszFileName[MAX_PATH];
- GetWindowText(hFileName, pszFileName, SIZEOF(pszFileName));
+ GetWindowText(hFileName, pszFileName, _countof(pszFileName));
if (mir_strcmp(pstShare->pszSrvPath, szSelection) &&
mir_strcmp(pszFileName, pszShareDirStr)) {
@@ -435,7 +435,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) {
ofn.lStructSize = sizeof(OPENFILENAME);
char temp[MAX_PATH];
- mir_snprintf(temp, SIZEOF(temp), _T("%s (*.*)%c*.*%c%c"), Translate("All files"), 0, 0, 0);
+ mir_snprintf(temp, _countof(temp), _T("%s (*.*)%c*.*%c%c"), Translate("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = pstNewShare->pszRealPath;
@@ -854,7 +854,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara
LVITEM sItem = { 0 };
sItem.mask = LVIF_TEXT;
sItem.pszText = szTmp;
- sItem.cchTextMax = SIZEOF(szTmp);
+ sItem.cchTextMax = _countof(szTmp);
switch (LOWORD(wParam)) {
case IDC_SHOWHIDDENSHARES: {
@@ -1212,11 +1212,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_TEST_EXTERNALIP: {
char szUrl[ 500 ];
char szKeyWord[ 1000 ];
- GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szUrl, SIZEOF(szUrl));
- GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, SIZEOF(szKeyWord));
+ GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szUrl, _countof(szUrl));
+ GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, _countof(szKeyWord));
DWORD dwExternalIP = GetExternIP(szUrl, szKeyWord);
- mir_snprintf(szKeyWord, SIZEOF(szKeyWord), Translate("Your external IP was detected as %d.%d.%d.%d\r\nby: %s") ,
+ mir_snprintf(szKeyWord, _countof(szKeyWord), Translate("Your external IP was detected as %d.%d.%d.%d\r\nby: %s") ,
SplitIpAddress(dwExternalIP) ,
szUrl);
MessageBox(hwndDlg, szKeyWord, MSG_BOX_TITEL, MB_OK);
@@ -1229,7 +1229,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (p->code) {
case PSN_APPLY: {
char szTemp[ 500 ];
- if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, SIZEOF(szTemp)))
+ if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, _countof(szTemp)))
db_set_s(NULL, MODULE, "ExternalSrvName", szTemp);
bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
@@ -1252,11 +1252,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
db_set_b(NULL, MODULE, "ShowPopups", bShowPopups);
- GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, _countof(szTemp));
sUrlAddress = szTemp;
db_set_s(NULL, MODULE, "UrlAddress", sUrlAddress.c_str());
- GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, _countof(szTemp));
sPageKeyword = szTemp;
db_set_s(NULL, MODULE, "PageKeyword", sPageKeyword.c_str());
dwExternalIpAddress = 0;
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp
index e1398215bc..a4e2597fd7 100644
--- a/plugins/HTTPServer/src/HttpUser.cpp
+++ b/plugins/HTTPServer/src/HttpUser.cpp
@@ -231,7 +231,7 @@ void CLHttpUser::SendError(int iErrorCode, const char * pszError, const char * p
pszDescription = pszError;
char szBuf[1000];
- DWORD dwBytesToWrite = mir_snprintf(szBuf, SIZEOF(szBuf),
+ DWORD dwBytesToWrite = mir_snprintf(szBuf, _countof(szBuf),
"HTTP/1.1 %i %s\r\n"
"Date: %s\r\n"
"Server: MirandaWeb/%s\r\n"
@@ -281,7 +281,7 @@ void CLHttpUser::SendRedir(int iErrorCode, const char * pszError, const char * p
pszDescription = pszError;
char szBuff[1000];
- DWORD dwBytesToWrite = mir_snprintf(szBuff, SIZEOF(szBuff),
+ DWORD dwBytesToWrite = mir_snprintf(szBuff, _countof(szBuff),
"HTTP/1.1 %i %s\r\n"
"Date: %s\r\n"
"Server: MirandaWeb/%s\r\n"
@@ -546,7 +546,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {
char szETag[ 50 ];
{
- int nETagLen = mir_snprintf(szETag, SIZEOF(szETag), "\"%x-%x-%x\"",
+ int nETagLen = mir_snprintf(szETag, _countof(szETag), "\"%x-%x-%x\"",
nDataSize, stFileTime.dwHighDateTime, stFileTime.dwLowDateTime);
if (!apszParam[eIfRange] || (strncmp(szETag, apszParam[eIfRange], nETagLen) == 0)) {
@@ -616,7 +616,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {
"Last-Modified: %s\r\n"
"\r\n";
- dwBytesToWrite = mir_snprintf(szBuf, SIZEOF(szBuf), szHttpPartial,
+ dwBytesToWrite = mir_snprintf(szBuf, _countof(szBuf), szHttpPartial,
szCurTime,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
szETag,
@@ -638,7 +638,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) {
"Last-Modified: %s\r\n"
"\r\n";
- dwBytesToWrite = mir_snprintf(szBuf, SIZEOF(szBuf), szHttpOk,
+ dwBytesToWrite = mir_snprintf(szBuf, _countof(szBuf), szHttpOk,
szCurTime,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
szETag,
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp
index 6170657766..04a991cb4e 100644
--- a/plugins/HTTPServer/src/IndexHTML.cpp
+++ b/plugins/HTTPServer/src/IndexHTML.cpp
@@ -317,14 +317,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
bool bEvenOdd = 0;
bool bKnownFileType = false;
- strncpy(szBuffer, pszSrvPath, SIZEOF(szBuffer)-1);
+ strncpy(szBuffer, pszSrvPath, _countof(szBuffer)-1);
char* pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
*pszTemp = '\0';
pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
- strncpy(szName, pszTemp + 1, SIZEOF(szName)-1);
+ strncpy(szName, pszTemp + 1, _countof(szName)-1);
if (szName[0] == '\0')
mir_strcpy(szName, "my Miranda Webserver");
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp
index 6a4e232798..b6b79bab1d 100644
--- a/plugins/HTTPServer/src/IndexXML.cpp
+++ b/plugins/HTTPServer/src/IndexXML.cpp
@@ -32,7 +32,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace,
char* pszSign = strchr(pszSrc, pszReplace);
if (pszSign) {
- strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1);
+ strncpy(szBuffer, pszSrc, _countof(szBuffer)-1);
do {
mir_strcpy(szBuffer + (pszSign - pszSrc), pszNew);
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index 24ff38bc1e..1629bfcf18 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -347,7 +347,7 @@ bool bWriteConfigurationFile() {
} else {
CLFileShareNode * pclCur = pclFirstNode;
while (pclCur) {
- DWORD dwBytesToWrite = mir_snprintf(szBuf, SIZEOF(szBuf), szXmlData ,
+ DWORD dwBytesToWrite = mir_snprintf(szBuf, _countof(szBuf), szXmlData ,
pclCur->st.pszSrvPath,
pclCur->pszOrigRealPath,
pclCur->st.nMaxDownloads,
@@ -900,7 +900,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) {
MessageBox(NULL, _T("Failed to retrieve plugin path."), MSG_BOX_TITEL, MB_OK);
return 1;
}
- mir_tstrncat(szPluginPath, _T("\\HTTPServer\\"), SIZEOF(szPluginPath) - mir_tstrlen(szPluginPath));
+ mir_tstrncat(szPluginPath, _T("\\HTTPServer\\"), _countof(szPluginPath) - mir_tstrlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if((err != 0) && (err != ERROR_ALREADY_EXISTS))
{
diff --git a/plugins/HistoryLinkListPlus/src/linklist.h b/plugins/HistoryLinkListPlus/src/linklist.h
index 867e5a8e7d..aa5d140cfe 100644
--- a/plugins/HistoryLinkListPlus/src/linklist.h
+++ b/plugins/HistoryLinkListPlus/src/linklist.h
@@ -129,7 +129,7 @@ typedef struct {
#define LINKLIST_SHOW_TYPE "ShowMessageType"
-#define _mstrlen(x) (SIZEOF(x) - 1)
+#define _mstrlen(x) (_countof(x) - 1)
#define MAKE_TXT_COL(BGCol) ((DWORD)~BGCol & 0x00FFFFFF)
#define DM_LINKSPLITTER WM_USER+99
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
index 28e5520a86..5a3ef9fd49 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp
@@ -76,9 +76,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
SetClassLongPtr(hDlg, GCLP_HICON, (LONG_PTR)LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)));
WindowList_Add(hWindowList, hDlg, DlgParam->hContact);
- mir_sntprintf(title, SIZEOF(title), _T("%s [%s]"), TranslateT("Linklist plugin"), (LPCTSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)DlgParam->hContact, GCDNF_TCHAR));
+ mir_sntprintf(title, _countof(title), _T("%s [%s]"), TranslateT("Linklist plugin"), (LPCTSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)DlgParam->hContact, GCDNF_TCHAR));
SetWindowText(hDlg, title);
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterProc);
@@ -207,7 +207,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case IDM_CLEARSEARCH: // clear search results
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
SetDlgItemText(hDlg, IDC_MAIN, _T(""));
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
@@ -221,7 +221,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendMessage(hDlg, WM_CLOSE, 0, 0);
break;
case IDM_DIR_IN: // view only incoming messages
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
if ((GetMenuState(listMenu, IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
break; // not possible if search dialog is open
@@ -234,11 +234,11 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckMenuItem(listMenu, IDM_DIR_OUT, MF_UNCHECKED);
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
}
- GetFilterText(GetMenu(hDlg), filter, SIZEOF(filter));
+ GetFilterText(GetMenu(hDlg), filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
case IDM_DIR_OUT: // view only outgoing messages
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
if ((GetMenuState(listMenu, IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
break; // not possible if search dialog is open
@@ -251,11 +251,11 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckMenuItem(listMenu, IDM_DIR_IN, MF_UNCHECKED);
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
}
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
case IDM_TYPE_WEB: // view only e-mail addresses
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
// not possible if search dialog is open
if ((GetMenuState(listMenu, IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
@@ -269,7 +269,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckMenuItem(listMenu, IDM_TYPE_MAIL, MF_UNCHECKED);
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
}
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
case IDM_TYPE_MAIL: // view only URLs
@@ -284,7 +284,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
CheckMenuItem(listMenu, IDM_TYPE_WEB, MF_UNCHECKED);
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, NULL, 0);
}
- GetFilterText(listMenu, filter, SIZEOF(filter));
+ GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
}
@@ -413,7 +413,7 @@ INT_PTR CALLBACK SearchDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
WriteLinkList(hListDlg, flags, DlgParam->listStart, buffer, 0);
mir_free(buffer);
}
- mir_sntprintf(filter, SIZEOF(filter), _T("%s: %s"), TXT_FILTER, TXT_SEARCHFILTER);
+ mir_sntprintf(filter, _countof(filter), _T("%s: %s"), TXT_FILTER, TXT_SEARCHFILTER);
SetDlgItemText(hWndMain, IDC_STATUS, filter);
} break;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
index 8948ececc7..d7fefdaacb 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
@@ -115,14 +115,14 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
_tcsncpy_s(wordsearch, wordlen, msg + wordStart, (wordlen - 1));
CharLower(wordsearch);
- for (j = 0; j < SIZEOF(hyperlinkPrefixes); j ++) {
+ for (j = 0; j < _countof(hyperlinkPrefixes); j ++) {
if (!_tcsncmp(wordsearch, hyperlinkPrefixes[j], mir_tstrlen(hyperlinkPrefixes[j]))) {
isLink = 1;
break;
}
}
if (!isLink) {
- for (j = 0; j < SIZEOF(hyperlinkSubstrings); j ++) {
+ for (j = 0; j < _countof(hyperlinkSubstrings); j ++) {
if (_tcsstr(wordsearch + 1,hyperlinkSubstrings[j])) {
isLink = 1;
break;
@@ -142,14 +142,14 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
_tcsncpy_s(link, _T("http://"), _mstrlen(_T("http://")));
// Link longer than defined max -> cut link to max
if (wordlen > (LINK_MAX - _mstrlen(_T("http://"))))
- _tcsncpy_s((link + _mstrlen(_T("http://"))), (SIZEOF(link) - _mstrlen(_T("http://"))), word, LINK_MAX - _mstrlen(_T("http://")));
+ _tcsncpy_s((link + _mstrlen(_T("http://"))), (_countof(link) - _mstrlen(_T("http://"))), word, LINK_MAX - _mstrlen(_T("http://")));
else
- _tcsncpy_s((link + _mstrlen(_T("http://"))), (SIZEOF(link) - _mstrlen(_T("http://"))), word, wordlen);
+ _tcsncpy_s((link + _mstrlen(_T("http://"))), (_countof(link) - _mstrlen(_T("http://"))), word, wordlen);
} else {
_tcsncpy_s(link, word, ((wordlen > LINK_MAX) ? LINK_MAX : wordlen));
}
- TimeZone_ToStringT(dbei->timestamp, _T("d-t"), dbdate, SIZEOF(dbdate));
+ TimeZone_ToStringT(dbei->timestamp, _T("d-t"), dbdate, _countof(dbdate));
date_ptr = _tcstok_s(dbdate, _T("-"), &tok_ctx);
time_ptr = _tcstok_s(NULL, _T("-"), &tok_ctx);
_tcsncpy_s(date, date_ptr, _TRUNCATE);
@@ -164,7 +164,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
if (type == LINK_MAIL && _tcsstr(link, _T("mailto:")) == NULL) {
_tcsncpy_s(templink, link, _TRUNCATE);
_tcsncpy_s(link, _T("mailto:"), _TRUNCATE);
- _tcsncpy_s((link + _mstrlen(_T("mailto:"))), (SIZEOF(link) - _mstrlen(_T("mailto:"))), templink, _TRUNCATE);
+ _tcsncpy_s((link + _mstrlen(_T("mailto:"))), (_countof(link) - _mstrlen(_T("mailto:"))), templink, _TRUNCATE);
}
// Add new Element to list:
@@ -310,7 +310,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
_tcscpy_s(cf.szFaceName, _T("Arial"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- mir_sntprintf(searchText, SIZEOF(searchText), _T("%s '%s': %d\n\n"), TranslateT("Matches for searchtext"), searchString, listCount);
+ mir_sntprintf(searchText, _countof(searchText), _T("%s '%s': %d\n\n"), TranslateT("Matches for searchtext"), searchString, listCount);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)searchText);
linePos += 2;
}
@@ -459,7 +459,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
type = _T("[UNK ]");
}
- mir_sntprintf(textLine, SIZEOF(textLine), _T("%s%s%s%s%s%s%s\n"),
+ mir_sntprintf(textLine, _countof(textLine), _T("%s%s%s%s%s%s%s\n"),
options.showDirection ? (actualElement->direction==DIRECTION_IN?_T("[in ]"):_T("[out]")) : _T(""),
options.showDirection? _T(" ") : _T(""),
options.showType ? type : _T(""),
@@ -1254,7 +1254,7 @@ BOOL SaveEditAsStream( HWND hDlg )
mir_sntprintf(temp, _T("%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c"), TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = szFilename;
- ofn.nMaxFile = SIZEOF(szFilename);
+ ofn.nMaxFile = _countof(szFilename);
ofn.lpstrTitle = TranslateT("Save RTF File");
ofn.Flags = OFN_OVERWRITEPROMPT;
// Get a filename or quit
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp
index 87dc659185..92746b37e4 100644
--- a/plugins/HistorySweeperLight/src/options.cpp
+++ b/plugins/HistorySweeperLight/src/options.cpp
@@ -52,23 +52,23 @@ static IconItem iconList[] =
{ LPGEN("Delete All"), "actDel", IDI_ACTDEL }
};
-static HANDLE hIconLibItem[SIZEOF(iconList)];
+static HANDLE hIconLibItem[_countof(iconList)];
void InitIcons(void)
{
- Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList), ModuleName);
+ Icon_Register(hInst, ModuleName, iconList, _countof(iconList), ModuleName);
}
HICON LoadIconEx(const char* name)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", ModuleName, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", ModuleName, name);
return IcoLib_GetIcon(szSettingName);
}
HANDLE GetIconHandle(const char* name)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (mir_strcmp(iconList[i].szName, name) == 0)
return hIconLibItem[i];
@@ -78,7 +78,7 @@ HANDLE GetIconHandle(const char* name)
void ReleaseIconEx(const char* name)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", ModuleName, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", ModuleName, name);
IcoLib_Release(szSettingName);
}
@@ -118,12 +118,12 @@ void LoadSettings(HWND hwndDlg)
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_RESETCONTENT, 0, 0);
- for (i = 0; i < SIZEOF(time_stamp_strings); i++) {
+ for (i = 0; i < _countof(time_stamp_strings); i++) {
ptrT ptszTimeStr(Langpack_PcharToTchar(time_stamp_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
- for (i = 0; i < SIZEOF(keep_strings); i++) {
+ for (i = 0; i < _countof(keep_strings); i++) {
ptrT ptszTimeStr(Langpack_PcharToTchar(keep_strings[i]));
SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp
index 0f4f1ab8cd..a5694d933f 100644
--- a/plugins/IEHistory/src/dlgHandlers.cpp
+++ b/plugins/IEHistory/src/dlgHandlers.cpp
@@ -546,7 +546,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
count = 0;
else {
TCHAR buffer[1024];
- GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, _countof(buffer));
count = _tstol(buffer);
count = (count < 0) ? 0 : count;
}
@@ -643,7 +643,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
if (type == SEARCH_TEXT) { //text search
TCHAR text[2048]; //TODO buffer overrun
- GetDlgItemText(hWnd, IDC_SEARCH_TEXT, text, SIZEOF(text));
+ GetDlgItemText(hWnd, IDC_SEARCH_TEXT, text, _countof(text));
searchResult = SearchHistory(data->contact, data->hLastFoundEvent, text, direction, type);
}
else { //time search
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index 7938502f89..6ce6b6cc19 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -83,8 +83,8 @@ char *HistoryHTMLBuilder::timestampToString(time_t check)
{
static char szResult[512];
char str[80];
- TimeZone_ToString(check, "d t", str, SIZEOF(str));
- mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult));
+ TimeZone_ToString(check, "d t", str, _countof(str));
+ mir_strncat(szResult, str, _countof(szResult) - mir_strlen(szResult));
mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp
index 7ac74ea989..740fd36264 100644
--- a/plugins/IEView/src/MUCCHTMLBuilder.cpp
+++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp
@@ -105,8 +105,8 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check)
else
szFormat = (char *)"";
- TimeZone_ToString(check, szFormat, str, SIZEOF(str));
- mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult));
+ TimeZone_ToString(check, szFormat, str, _countof(str));
+ mir_strncat(szResult, str, _countof(szResult) - mir_strlen(szResult));
mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp
index 16c7e3e020..cb4d82d711 100644
--- a/plugins/IEView/src/Options.cpp
+++ b/plugins/IEView/src/Options.cpp
@@ -78,11 +78,11 @@ static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setSRMMFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
proto->setSRMMBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
proto->setSRMMCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
proto->setSRMMTemplateFilenameTemp(path);
}
}
@@ -108,11 +108,11 @@ static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setChatFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
proto->setChatBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
proto->setChatCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
proto->setChatTemplateFilenameTemp(path);
}
}
@@ -138,11 +138,11 @@ static void SaveHistoryProtoSettings(HWND hwndDlg, ProtocolSettings *proto)
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setHistoryFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, _countof(path));
proto->setHistoryBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, _countof(path));
proto->setHistoryCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, _countof(path));
proto->setHistoryTemplateFilenameTemp(path);
}
}
@@ -447,7 +447,7 @@ int IEViewOptInit(WPARAM wParam, LPARAM)
odp.ptszGroup = LPGENT("Skins");
odp.ptszTitle = LPGENT("IEView");
- for (size_t i = 1; i < SIZEOF(tabPages); i++) {
+ for (size_t i = 1; i < _countof(tabPages); i++) {
odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
odp.pfnDlgProc = tabPages[i].dlgProc;
odp.ptszTab = tabPages[i].tabName;
@@ -510,7 +510,7 @@ static INT_PTR CALLBACK IEViewGeneralOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
EnableWindow(GetDlgItem(hwndDlg, IDC_EMBED_SIZE), IsDlgButtonChecked(hwndDlg, IDC_ENABLE_EMBED));
{
TCHAR* size[] = { _T("320 x 205"), _T("480 x 385"), _T("560 x 349"), _T("640 x 390") };
- for (int i = 0; i < SIZEOF(size); ++i) {
+ for (int i = 0; i < _countof(size); ++i) {
int item = SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(size[i]));
SendDlgItemMessage(hwndDlg, IDC_EMBED_SIZE, CB_SETITEMDATA, item, 0);
}
@@ -605,30 +605,30 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
MarkChanges(2, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(2, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(2, hwndDlg);
}
@@ -737,30 +737,30 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
MarkChanges(4, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(4, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(4, hwndDlg);
}
@@ -870,30 +870,30 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA
MarkChanges(8, hwndDlg);
break;
case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.ivt)%c*.ivt%c%s%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
UpdateTemplateIcons(hwndDlg, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.jpg,*.gif,*.png,*.bmp)%c*.ivt%c%s%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(8, hwndDlg);
}
break;
case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, SIZEOF(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, SIZEOF(path))) {
+ mir_snprintf(filter, _countof(filter), "%s (*.css)%c*.ivt%c%s%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
MarkChanges(8, hwndDlg);
}
@@ -1495,13 +1495,13 @@ void Options::init()
else continue;
/* SRMM settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
proto->setSRMMEnable(i == 0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
proto->setSRMMMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
proto->setSRMMFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1510,7 +1510,7 @@ void Options::init()
proto->setSRMMBackgroundFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1519,7 +1519,7 @@ void Options::init()
proto->setSRMMCssFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1528,13 +1528,13 @@ void Options::init()
}
/* Group chat settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
proto->setChatEnable(i == 0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
proto->setChatMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
proto->setChatFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1543,7 +1543,7 @@ void Options::init()
proto->setChatBackgroundFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1552,7 +1552,7 @@ void Options::init()
proto->setChatCssFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1561,13 +1561,13 @@ void Options::init()
}
/* History settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
proto->setHistoryEnable(i == 0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
proto->setHistoryMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
proto->setHistoryFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128));
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1576,7 +1576,7 @@ void Options::init()
proto->setHistoryBackgroundFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
if (strncmp(tmpPath, "http://", 7))
@@ -1585,7 +1585,7 @@ void Options::init()
proto->setHistoryCssFilename(tmpPath);
db_free(&dbv);
}
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) {
mir_strcpy(tmpPath, dbv.pszVal);
PathToAbsolute(dbv.pszVal, tmpPath);
@@ -1681,67 +1681,67 @@ void Options::saveProtocolSettings()
char tmpPath[MAX_PATH];
proto->copyFromTemp();
/* SRMM settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isSRMMEnable());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getSRMMMode());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getSRMMFlags());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND);
mir_strcpy(tmpPath, proto->getSRMMBackgroundFilename());
PathToRelative(proto->getSRMMBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS);
mir_strcpy(tmpPath, proto->getSRMMCssFilename());
PathToRelative(proto->getSRMMCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE);
mir_strcpy(tmpPath, proto->getSRMMTemplateFilename());
PathToRelative(proto->getSRMMTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* Group Chat settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isChatEnable());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getChatMode());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getChatFlags());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND);
mir_strcpy(tmpPath, proto->getChatBackgroundFilename());
PathToRelative(proto->getChatBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS);
mir_strcpy(tmpPath, proto->getChatCssFilename());
PathToRelative(proto->getChatCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE);
mir_strcpy(tmpPath, proto->getChatTemplateFilename());
PathToRelative(proto->getChatTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
/* History settings */
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->isHistoryEnable());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
db_set_b(NULL, ieviewModuleName, dbsName, proto->getHistoryMode());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
db_set_dw(NULL, ieviewModuleName, dbsName, proto->getHistoryFlags());
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND);
mir_strcpy(tmpPath, proto->getHistoryBackgroundFilename());
PathToRelative(proto->getHistoryBackgroundFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS);
mir_strcpy(tmpPath, proto->getHistoryCssFilename());
PathToRelative(proto->getHistoryCssFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
- mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
+ mir_snprintf(dbsName, _countof(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE);
mir_strcpy(tmpPath, proto->getHistoryTemplateFilename());
PathToRelative(proto->getHistoryTemplateFilename(), tmpPath);
db_set_s(NULL, ieviewModuleName, dbsName, tmpPath);
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index 7143720889..4faadcca27 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -136,13 +136,13 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod
today = mktime(&tm_today);
if (dwFlags & SMF_LOG_USERELATIVEDATE && check >= today) {
- strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1);
+ strncpy(szResult, Translate("Today"), _countof(szResult)-1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
}
else if (dwFlags & SMF_LOG_USERELATIVEDATE && check > (today - 86400)) {
- strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1);
+ strncpy(szResult, Translate("Yesterday"), _countof(szResult)-1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
@@ -161,8 +161,8 @@ char* ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod
mir_strcat(format, (dwFlags & SMF_LOG_SHOWSECONDS) ? "s" : "t");
}
if (format[0] != '\0') {
- TimeZone_ToString(check, format, str, SIZEOF(str));
- mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult));
+ TimeZone_ToString(check, format, str, _countof(str));
+ mir_strncat(szResult, str, _countof(szResult) - mir_strlen(szResult));
}
mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
index 5f02f33da0..fc739de97e 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
@@ -189,8 +189,8 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG
szResult[0] = '\0';
}
}
- TimeZone_ToString(check, szFormat, str, SIZEOF(str));
- mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult));
+ TimeZone_ToString(check, szFormat, str, _countof(str));
+ mir_strncat(szResult, str, _countof(szResult) - mir_strlen(szResult));
mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp
index e9a6271fde..afbbeceab5 100644
--- a/plugins/IEView/src/Template.cpp
+++ b/plugins/IEView/src/Template.cpp
@@ -359,7 +359,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename,
if (sscanf(store, "%s", tmp2) == EOF) continue;
//template start
bool bFound = false;
- for (unsigned i = 0; i < SIZEOF(templateNames); i++) {
+ for (unsigned i = 0; i < _countof(templateNames); i++) {
if (!strncmp(store, templateNames[i].tokenString, templateNames[i].tokenLen)) {
bFound = true;
break;
@@ -386,7 +386,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename,
"MessageOutGroupStart", "MessageOutGroupInner",
"hMessageOutGroupStart", "hMessageOutGroupInner" };
tmap->grouping = true;
- for (i = 0; i < SIZEOF(groupTemplates); i++) {
+ for (i = 0; i < _countof(groupTemplates); i++) {
if (tmap->getTemplate(groupTemplates[i]) == NULL) {
tmap->grouping = false;
break;
@@ -394,7 +394,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename,
}
static const char *rtlTemplates[] = { "MessageInRTL", "MessageOutRTL" }; //"HTMLStartRTL",
tmap->rtl = true;
- for (i = 0; i < SIZEOF(rtlTemplates); i++) {
+ for (i = 0; i < _countof(rtlTemplates); i++) {
if (tmap->getTemplate(rtlTemplates[i]) == NULL) {
tmap->rtl = false;
break;
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp
index d7f5ecc85c..8f42cf907a 100644
--- a/plugins/IEView/src/TemplateHTMLBuilder.cpp
+++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp
@@ -57,7 +57,7 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto)
if (ace->cbSize == sizeof(avatarCacheEntry))
result = ace->szFilename;
else // compatibility: in M0.9 it will always be char*
- MultiByteToWideChar(CP_ACP, 0, (char*)ace->szFilename, -1, tmpPath, SIZEOF(tmpPath));
+ MultiByteToWideChar(CP_ACP, 0, (char*)ace->szFilename, -1, tmpPath, _countof(tmpPath));
}
}
if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
@@ -122,7 +122,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo
TCHAR str[300];
if (mode) // time
- TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t"), str, SIZEOF(str));
+ TimeZone_ToStringT(check, (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t"), str, _countof(str));
else { // date
struct tm tm_now, tm_today;
time_t now = time(NULL);
@@ -132,11 +132,11 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo
tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
today = mktime(&tm_today);
if (dwFlags & Options::LOG_RELATIVE_DATE && check >= today)
- _tcsncpy(str, TranslateT("Today"), SIZEOF(str));
+ _tcsncpy(str, TranslateT("Today"), _countof(str));
else if (dwFlags & Options::LOG_RELATIVE_DATE && check > (today - 86400))
- _tcsncpy(str, TranslateT("Yesterday"), SIZEOF(str));
+ _tcsncpy(str, TranslateT("Yesterday"), _countof(str));
else
- TimeZone_ToStringT(check, (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d"), str, SIZEOF(str));
+ TimeZone_ToStringT(check, (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d"), str, _countof(str));
}
mir_strncpy(szResult, T2Utf(str), 500);
@@ -169,7 +169,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr
return;
mir_strcpy(tempBase, "file://");
- mir_strncat(tempBase, tmpm->getFilename(), SIZEOF(tempBase) - mir_strlen(tempBase));
+ mir_strncat(tempBase, tmpm->getFilename(), _countof(tempBase) - mir_strlen(tempBase));
char *pathrun = tempBase + mir_strlen(tempBase);
while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase))
pathrun--;
@@ -186,7 +186,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr
szNameOut = mir_strdup("&nbsp;");
szNameIn = mir_strdup("&nbsp;");
}
- mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.png", tempBase);
+ mir_snprintf(tempStr, _countof(tempStr), "%snoavatar.png", tempBase);
TCHAR szNoAvatarPath[MAX_PATH];
_tcsncpy_s(szNoAvatarPath, _A2T(protoSettings->getSRMMTemplateFilename()), _TRUNCATE);
TCHAR *szNoAvatarPathTmp = _tcsrchr(szNoAvatarPath, '\\');
@@ -194,9 +194,9 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr
*szNoAvatarPathTmp = 0;
mir_tstrcat(szNoAvatarPath, _T("\\noavatar.png"));
if (_taccess(szNoAvatarPath, 0) == -1)
- mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.jpg", tempBase);
+ mir_snprintf(tempStr, _countof(tempStr), "%snoavatar.jpg", tempBase);
else
- mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.png", tempBase);
+ mir_snprintf(tempStr, _countof(tempStr), "%snoavatar.png", tempBase);
char *szNoAvatar = mir_utf8encode(tempStr);
char *szAvatarIn = getAvatar(event->hContact, szRealProto);
@@ -368,9 +368,9 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event,
*szNoAvatarPathTmp = 0;
mir_tstrcat(szNoAvatarPath, _T("\\noavatar.png"));
if (_taccess(szNoAvatarPath, 0) == -1)
- mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.jpg", tempBase);
+ mir_snprintf(tempStr, _countof(tempStr), "%snoavatar.jpg", tempBase);
else
- mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.png", tempBase);
+ mir_snprintf(tempStr, _countof(tempStr), "%snoavatar.png", tempBase);
char *szNoAvatar = mir_utf8encode(tempStr);
char *szAvatarIn = NULL;
@@ -426,12 +426,12 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event,
if (isSent) {
szAvatar = szAvatarOut;
szUIN = szUINOut;
- mir_snprintf(szCID, SIZEOF(szCID), "%d", 0);
+ mir_snprintf(szCID, _countof(szCID), "%d", 0);
}
else {
szAvatar = szAvatarIn;
szUIN = szUINIn;
- mir_snprintf(szCID, SIZEOF(szCID), "%d", (int)event->hContact);
+ mir_snprintf(szCID, _countof(szCID), "%d", (int)event->hContact);
}
tmpltName[0] = groupTemplate;
tmpltName[1] = NULL;
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp
index bcceb62910..ad8083d2d4 100644
--- a/plugins/IgnoreState/src/main.cpp
+++ b/plugins/IgnoreState/src/main.cpp
@@ -43,7 +43,7 @@ IGNOREITEMS ii[] = {
{ LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING }
};
-int nII = SIZEOF(ii);
+int nII = _countof(ii);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -90,7 +90,7 @@ INT_PTR isIgnored(MCONTACT hContact, int type)
if (isIgnored(hContact, ii[i].type))
ii[i].filtered ? filtered++ : all++;
- return (all + filtered == SIZEOF(ii) - 1) ? 1 : (all > 0 ? -1 : 0);
+ return (all + filtered == _countof(ii) - 1) ? 1 : (all > 0 ? -1 : 0);
}
void applyExtraImage(MCONTACT hContact)
@@ -121,7 +121,7 @@ VOID fill_filter(void)
currentFilter = bUseMirandaSettings ? db_get_dw(NULL, "Ignore", "Default1", 0) : db_get_dw(NULL, MODULENAME, "Filter", 0x8);
- for (int i = 0; i < SIZEOF(ii); i++) {
+ for (int i = 0; i < _countof(ii); i++) {
if (checkState((ii[i].type)))
ii[i].filtered = true;
else
@@ -167,7 +167,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
//IcoLib support
- Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, _countof(iconList));
hExtraIcon = ExtraIcon_Register("ignore", LPGEN("Ignore State"), "ignore_full");
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 88aadd22ea..ddaa811273 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -77,7 +77,7 @@ void AddMessage(const TCHAR* fmt, ...)
va_list args;
TCHAR msgBuf[4096];
va_start(args, fmt);
- mir_vsntprintf(msgBuf, SIZEOF(msgBuf), TranslateTS(fmt), args);
+ mir_vsntprintf(msgBuf, _countof(msgBuf), TranslateTS(fmt), args);
SendMessage(hdlgProgress, PROGM_ADDMESSAGE, 0, (LPARAM)msgBuf);
}
@@ -252,7 +252,7 @@ static LRESULT CALLBACK ListWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
r.top--; r.bottom--;
TCHAR tszText[100];
- ListView_GetItemText(hwnd, hit.iItem, 1, tszText, SIZEOF(tszText));
+ ListView_GetItemText(hwnd, hit.iItem, 1, tszText, _countof(tszText));
LVITEM lvitem;
lvitem.iItem = hit.iItem;
@@ -734,7 +734,7 @@ void ImportMeta(DBCachedContact *ccSrc)
ccDst->pSubs[i] = MapContact(ccSrc->pSubs[i]);
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "Handle%d", i);
+ mir_snprintf(szSettingName, _countof(szSettingName), "Handle%d", i);
db_set_dw(hDest, META_PROTO, szSettingName, ccDst->pSubs[i]);
db_set_b(ccDst->pSubs[i], META_PROTO, "IsSubcontact", 1);
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp
index eaf35058fb..4d9e697389 100644
--- a/plugins/Import/src/miranda.cpp
+++ b/plugins/Import/src/miranda.cpp
@@ -33,7 +33,7 @@ static void SearchForLists(HWND hwndDlg, const TCHAR *mirandaPath, const TCHAR *
{
// find in Miranda profile subfolders
TCHAR searchspec[MAX_PATH];
- mir_sntprintf(searchspec, SIZEOF(searchspec), _T("%s\\*.*"), mirandaPath);
+ mir_sntprintf(searchspec, _countof(searchspec), _T("%s\\*.*"), mirandaPath);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchspec, &fd);
@@ -52,7 +52,7 @@ static void SearchForLists(HWND hwndDlg, const TCHAR *mirandaPath, const TCHAR *
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, _T("%s\\%s\\%s.dat"), mirandaPath, fd.cFileName, fd.cFileName);
if (_taccess(buf, 0) == 0) {
- mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), fd.cFileName);
+ mir_sntprintf(profile, _countof(profile), _T("%s.dat"), fd.cFileName);
int i = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)profile);
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETITEMDATA, i, (LPARAM)mir_tstrdup(buf));
@@ -82,7 +82,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_LIST, LBN_SELCHANGE), 0);
TCHAR filename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, filename, SIZEOF(filename));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, filename, _countof(filename));
if (_taccess(filename, 4))
SendMessage(GetParent(hwndDlg), WIZM_DISABLEBUTTON, 1, 0);
return TRUE;
@@ -95,7 +95,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
case IDOK:
TCHAR filename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, filename, SIZEOF(filename));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, filename, _countof(filename));
if (_taccess(filename, 4)) {
MessageBox(hwndDlg, TranslateT("The given file does not exist. Please check that you have entered the name correctly."), TranslateT("Miranda Import"), MB_OK);
break;
@@ -122,7 +122,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
ptrT pfd(Utils_ReplaceVarsT(_T("%miranda_profilesdir%")));
TCHAR str[MAX_PATH], text[256];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
mir_sntprintf(text, _T("%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c"), TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
@@ -132,7 +132,7 @@ INT_PTR CALLBACK MirandaPageProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM
ofn.lpstrDefExt = _T("dat");
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_DONTADDTORECENT;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.lpstrInitialDir = pfd;
if (GetOpenFileName(&ofn)) {
SetDlgItemText(hwndDlg, IDC_FILENAME, str);
@@ -306,15 +306,15 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hwndDlg, UINT message, WPARAM wP
case IDC_INCOMING:
case IDC_OUTGOING:
if (LOWORD(wParam) == IDC_ALL)
- for (int i = 0; i < SIZEOF(SysControls); i++)
+ for (int i = 0; i < _countof(SysControls); i++)
CheckDlgButton(hwndDlg, SysControls[i], IsDlgButtonChecked(hwndDlg, SysControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_OUTGOING)
- for (int i = 0; i < SIZEOF(InControls); i++)
+ for (int i = 0; i < _countof(InControls); i++)
CheckDlgButton(hwndDlg, InControls[i], IsDlgButtonChecked(hwndDlg, InControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
if (LOWORD(wParam) != IDC_INCOMING)
- for (int i = 0; i < SIZEOF(OutControls); i++)
+ for (int i = 0; i < _countof(OutControls); i++)
CheckDlgButton(hwndDlg, OutControls[i], IsDlgButtonChecked(hwndDlg, OutControls[i]) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
break;
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index 180294196b..3c48c93462 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -218,7 +218,7 @@ static IconItem iconList[] =
HICON GetIcon(int iIconId, bool size)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
@@ -227,7 +227,7 @@ HICON GetIcon(int iIconId, bool size)
HANDLE GetIconHandle(int iIconId)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iIconId)
return iconList[i].hIcolib;
@@ -236,5 +236,5 @@ HANDLE GetIconHandle(int iIconId)
void RegisterIcons()
{
- Icon_Register(hInst, "Import", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Import", iconList, _countof(iconList));
}
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp
index 2a6bf1080f..a02ea38828 100644
--- a/plugins/KeyboardNotify/src/ignore.cpp
+++ b/plugins/KeyboardNotify/src/ignore.cpp
@@ -59,7 +59,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if(hChildItem)
SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (i=0; i < SIZEOF(iconOn); i++)
+ for (i=0; i < _countof(iconOn); i++)
if(iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0)
iconOn[i] = 0;
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
@@ -70,7 +70,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while(hItem) {
- for (i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < _countof(iconOn); i++) {
iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if(iconOn[i] && iImage == 0)
iconOn[i] = 0;
@@ -80,7 +80,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for (i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < _countof(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+3:0):EMPTY_EXTRA_ICON));
if(groupChildCount)
groupChildCount[i] += childCount[i];
@@ -210,7 +210,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_EVENT_FILE));
ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_MIRANDA));
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- for (i=0; i < SIZEOF(hIcons); i++)
+ for (i=0; i < _countof(hIcons); i++)
hIcons[i] = ImageList_GetIcon(hIml, 1+i, ILD_NORMAL);
}
SendDlgItemMessage(hwndDlg, IDC_ALLICON, STM_SETICON, (WPARAM)hIcons[0], 0);
@@ -317,7 +317,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case WM_DESTROY:
{ int i;
HIMAGELIST hIml;
- for (i=0; i < SIZEOF(hIcons); i++)
+ for (i=0; i < _countof(hIcons); i++)
DestroyIcon(hIcons[i]);
hIml = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
ImageList_Destroy(hIml);
diff --git a/plugins/KeyboardNotify/src/keyboard.cpp b/plugins/KeyboardNotify/src/keyboard.cpp
index 3ce6d8cba3..ee6abec586 100644
--- a/plugins/KeyboardNotify/src/keyboard.cpp
+++ b/plugins/KeyboardNotify/src/keyboard.cpp
@@ -51,11 +51,11 @@ BOOL OpenKeyboardDevice()
TCHAR aux1[MAX_PATH+1], aux2[MAX_PATH+1];
do {
- mir_sntprintf(aux1, SIZEOF(aux1), _T("Kbd%d"), i);
- mir_sntprintf(aux2, SIZEOF(aux2), _T("\\Device\\KeyboardClass%d"), i);
+ mir_sntprintf(aux1, _countof(aux1), _T("Kbd%d"), i);
+ mir_sntprintf(aux2, _countof(aux2), _T("\\Device\\KeyboardClass%d"), i);
DefineDosDevice(DDD_RAW_TARGET_PATH, aux1, aux2);
- mir_sntprintf(aux1, SIZEOF(aux1), _T("\\\\.\\Kbd%d"), i);
+ mir_sntprintf(aux1, _countof(aux1), _T("\\\\.\\Kbd%d"), i);
hKbdDev[i] = CreateFile(aux1, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
@@ -91,7 +91,7 @@ void CloseKeyboardDevice()
if (hKbdDev[i] != INVALID_HANDLE_VALUE)
CloseHandle(hKbdDev[i]);
- mir_sntprintf(aux, SIZEOF(aux), _T("Kbd%d"), i);
+ mir_sntprintf(aux, _countof(aux), _T("Kbd%d"), i);
DefineDosDevice(DDD_REMOVE_DEFINITION, aux, NULL);
} while (hKbdDev[i] != INVALID_HANDLE_VALUE && ++i < MAX_KBDHANDLES);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index d3d18ab646..4b41e844a5 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -721,9 +721,9 @@ static int ModulesLoaded(WPARAM, LPARAM)
// Create some synchronisation objects
createEventPrefix(eventPrefix, MAX_PATH - 11);
- mir_sntprintf(eventName, SIZEOF(eventName), _T("%s/FlashEvent"), eventPrefix);
+ mir_sntprintf(eventName, _countof(eventName), _T("%s/FlashEvent"), eventPrefix);
hFlashEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
- mir_sntprintf(eventName, SIZEOF(eventName), _T("%s/ExitEvent"), eventPrefix);
+ mir_sntprintf(eventName, _countof(eventName), _T("%s/ExitEvent"), eventPrefix);
hExitEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
hThread = mir_forkthread(FlashThreadFunction, 0);
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp
index a0b31b6e55..50e34cc3c8 100644
--- a/plugins/KeyboardNotify/src/options.cpp
+++ b/plugins/KeyboardNotify/src/options.cpp
@@ -758,7 +758,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
break;
case CBN_EDITCHANGE:
- GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme));
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme));
if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) { //new theme
SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T(""));
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE);
@@ -780,13 +780,13 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if(HIWORD(wParam) == EN_CHANGE) {
TCHAR theme[MAX_PATH+1], customAux[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme));
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme));
int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
if (item == CB_ERR)
return TRUE;
str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
if (str) {
- GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, SIZEOF(customAux));
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, _countof(customAux));
if (mir_wstrcmp(str, customAux))
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE);
else
@@ -798,7 +798,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR custom[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, SIZEOF(custom));
+ GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, _countof(custom));
SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom));
testSequence(custom);
}
@@ -807,7 +807,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR theme[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme));
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme));
if (!theme[0])
return TRUE;
int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme);
@@ -827,7 +827,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR theme[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme));
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme));
int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
if (str) {
@@ -842,7 +842,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR theme[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme));
+ GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme));
int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme);
str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0);
if (str)
@@ -884,7 +884,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
ofn.lpstrFilter = filter;
ofn.lpstrFile = path;
ofn.Flags = OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NOREADONLYRETURN|OFN_PATHMUSTEXIST;
- ofn.nMaxFile = SIZEOF(path);
+ ofn.nMaxFile = _countof(path);
ofn.lpstrDefExt = _T("knt");
if(GetSaveFileName(&ofn))
exportThemes(path);
@@ -912,7 +912,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
ofn.lpstrFilter = filter;
ofn.lpstrFile = path;
ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
- ofn.nMaxFile = SIZEOF(path);
+ ofn.nMaxFile = _countof(path);
ofn.lpstrDefExt = _T("knt");
if(GetOpenFileName(&ofn)) {
importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED);
@@ -1115,7 +1115,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE);
break;
case CBN_EDITCHANGE:
- GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, SIZEOF(szFileName));
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName));
if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName)) == CB_ERR) { //new program
EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE);
@@ -1131,7 +1131,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
int item;
TCHAR szFileName[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, SIZEOF(szFileName));
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName));
if (!szFileName[0])
break;
item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_ADDSTRING, 0, (LPARAM)szFileName);
@@ -1144,7 +1144,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
int item;
TCHAR szFileName[MAX_PATH+1];
- GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, SIZEOF(szFileName));
+ GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName));
item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName);
SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_DELETESTRING, (WPARAM)item, 0);
if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) {
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index b28d5d8670..22f811d67e 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -140,7 +140,7 @@ extern "C" int __declspec(dllexport) Load(void)
InitOptions();
// icons
- Icon_Register(hInst, LPGEN("ListeningTo"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("ListeningTo"), iconList, _countof(iconList));
// Extra icon support
hExtraIcon = ExtraIcon_Register(MODULE_NAME "_icon", LPGEN("Listening to music"), "listening_to_icon");
@@ -217,10 +217,10 @@ void RegisterProtocol(char *proto, TCHAR *account)
size_t id = proto_items.size();
proto_items.resize(id+1);
- strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto));
- proto_items[id].proto[SIZEOF(proto_items[id].proto)-1] = 0;
+ strncpy(proto_items[id].proto, proto, _countof(proto_items[id].proto));
+ proto_items[id].proto[_countof(proto_items[id].proto)-1] = 0;
- mir_tstrncpy(proto_items[id].account, account, SIZEOF(proto_items[id].account));
+ mir_tstrncpy(proto_items[id].account, account, _countof(proto_items[id].account));
proto_items[id].hMenu = NULL;
proto_items[id].old_xstatus = 0;
@@ -240,7 +240,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam)
{
if (wParam == PRAC_UPGRADED || wParam == PRAC_CHANGED)
{
- mir_tstrncpy(info->account, proto->tszAccountName, SIZEOF(info->account));
+ mir_tstrncpy(info->account, proto->tszAccountName, _countof(info->account));
TCHAR text[512];
mir_sntprintf(text, TranslateT("Send to %s"), info->account);
@@ -571,9 +571,9 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL)
};
Buffer<TCHAR> name;
- ReplaceTemplate(&name, NULL, opts.xstatus_name, fr, SIZEOF(fr));
+ ReplaceTemplate(&name, NULL, opts.xstatus_name, fr, _countof(fr));
Buffer<TCHAR> msg;
- ReplaceTemplate(&msg, NULL, opts.xstatus_message, fr, SIZEOF(fr));
+ ReplaceTemplate(&msg, NULL, opts.xstatus_message, fr, _countof(fr));
ics.flags = CSSF_TCHAR | CSSF_MASK_STATUS | CSSF_MASK_NAME | CSSF_MASK_MESSAGE;
ics.ptszName = name.str;
@@ -663,9 +663,9 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL)
};
Buffer<TCHAR> name;
- ReplaceTemplate(&name, NULL, opts.xstatus_name, fr, SIZEOF(fr));
+ ReplaceTemplate(&name, NULL, opts.xstatus_name, fr, _countof(fr));
Buffer<TCHAR> msg;
- ReplaceTemplate(&msg, NULL, opts.xstatus_message, fr, SIZEOF(fr));
+ ReplaceTemplate(&msg, NULL, opts.xstatus_message, fr, _countof(fr));
status = XSTATUS_MUSIC;
ics.flags = CSSF_TCHAR | CSSF_MASK_STATUS | CSSF_MASK_NAME | CSSF_MASK_MESSAGE;
@@ -781,7 +781,7 @@ TCHAR *GetParsedFormat(LISTENINGTOINFO *lti)
};
Buffer<TCHAR> ret;
- ReplaceTemplate(&ret, NULL, opts.templ, fr, SIZEOF(fr));
+ ReplaceTemplate(&ret, NULL, opts.templ, fr, _countof(fr));
return ret.detach();
}
@@ -986,7 +986,7 @@ TCHAR* VariablesParseInfo(ARGUMENTSINFO *ai)
};
Buffer<TCHAR> ret;
- ReplaceTemplate(&ret, NULL, opts.templ, fr, SIZEOF(fr));
+ ReplaceTemplate(&ret, NULL, opts.templ, fr, _countof(fr));
return ret.detach();
}
diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp
index 2c6f5c0d75..81e1257b20 100644
--- a/plugins/ListeningTo/src/options.cpp
+++ b/plugins/ListeningTo/src/options.cpp
@@ -122,9 +122,9 @@ void DeInitOptions()
void LoadOptions()
{
- LoadOpts(optionsControls, SIZEOF(optionsControls), MODULE_NAME);
- LoadOpts(formatControls, SIZEOF(formatControls), MODULE_NAME);
- LoadOpts(playersControls, SIZEOF(playersControls), MODULE_NAME);
+ LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME);
+ LoadOpts(formatControls, _countof(formatControls), MODULE_NAME);
+ LoadOpts(playersControls, _countof(playersControls), MODULE_NAME);
}
@@ -182,7 +182,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
BOOL ret;
if (msg != WM_INITDIALOG)
- ret = SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ ret = SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
switch (msg) {
case WM_INITDIALOG:
@@ -204,7 +204,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
}
- ret = SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ ret = SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
OptionsEnableDisableCtrls(hwndDlg);
break;
@@ -252,7 +252,7 @@ static void PlayersEnableDisableCtrls(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_PLAYERS_L), enabled);
BOOL needPoll = FALSE;
- for (int i = 0; i < SIZEOF(playerDlgs); i += 2) {
+ for (int i = 0; i < _countof(playerDlgs); i += 2) {
EnableWindow(GetDlgItem(hwndDlg, playerDlgs[i+1]), enabled);
if (players[playerDlgs[i]]->needPoll && IsDlgButtonChecked(hwndDlg, playerDlgs[i+1]))
needPoll = TRUE;
@@ -269,7 +269,7 @@ static void PlayersEnableDisableCtrls(HWND hwndDlg)
static INT_PTR CALLBACK PlayersDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BOOL ret = SaveOptsDlgProc(playersControls, SIZEOF(playersControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ BOOL ret = SaveOptsDlgProc(playersControls, _countof(playersControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
switch (msg) {
case WM_INITDIALOG:
@@ -297,6 +297,6 @@ static INT_PTR CALLBACK PlayersDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
static INT_PTR CALLBACK FormatDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- return SaveOptsDlgProc(formatControls, SIZEOF(formatControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(formatControls, _countof(formatControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
diff --git a/plugins/ListeningTo/src/players/foobar.cpp b/plugins/ListeningTo/src/players/foobar.cpp
index d4c59934bd..bcb42dbf3f 100644
--- a/plugins/ListeningTo/src/players/foobar.cpp
+++ b/plugins/ListeningTo/src/players/foobar.cpp
@@ -30,5 +30,5 @@ Foobar::Foobar()
{
name = _T("foobar2000");
window_classes = wcs;
- num_window_classes = SIZEOF(wcs);
+ num_window_classes = _countof(wcs);
}
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp
index d5da94ec7d..72ee921605 100644
--- a/plugins/ListeningTo/src/players/generic.cpp
+++ b/plugins/ListeningTo/src/players/generic.cpp
@@ -36,7 +36,7 @@ int m_log(const TCHAR *function, const TCHAR *fmt, ...)
GetCurrentThreadId(), GetTickCount(), function);
va_start(va, fmt);
- mir_vsntprintf(&text[len], SIZEOF(text) - len, fmt, va);
+ mir_vsntprintf(&text[len], _countof(text) - len, fmt, va);
va_end(va);
BOOL writeBOM = (GetFileAttributes(_T("c:\\miranda_listeningto.log.txt")) == INVALID_FILE_ATTRIBUTES);
diff --git a/plugins/ListeningTo/src/players/player.cpp b/plugins/ListeningTo/src/players/player.cpp
index 36b63a8523..aea9eed1ba 100644
--- a/plugins/ListeningTo/src/players/player.cpp
+++ b/plugins/ListeningTo/src/players/player.cpp
@@ -155,7 +155,7 @@ void CodeInjectionPlayer::InjectCode()
// Get the dll path
char dll_path[1024] = {0};
- if (!GetModuleFileNameA(hInst, dll_path, SIZEOF(dll_path)))
+ if (!GetModuleFileNameA(hInst, dll_path, _countof(dll_path)))
return;
char *p = strrchr(dll_path, '\\');
diff --git a/plugins/ListeningTo/src/players/winamp.cpp b/plugins/ListeningTo/src/players/winamp.cpp
index 20feea2b65..6ce85ab775 100644
--- a/plugins/ListeningTo/src/players/winamp.cpp
+++ b/plugins/ListeningTo/src/players/winamp.cpp
@@ -27,7 +27,7 @@ Winamp::Winamp()
{
name = _T("Winamp");
window_classes = wcs;
- num_window_classes = SIZEOF(wcs);
+ num_window_classes = _countof(wcs);
message_window_class = MIRANDA_WINDOWCLASS _T(".Winamp");
dll_name = "gen_mlt";
}
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index decd4e0a18..2ff07d5fde 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -235,7 +235,7 @@ void init_pluginname()
HANDLE hFind = FindFirstFileA(text, &ffd);
if(hFind != INVALID_HANDLE_VALUE) {
- strncpy_s(text, SIZEOF(text), ffd.cFileName, mir_strlen(ffd.cFileName));
+ strncpy_s(text, _countof(text), ffd.cFileName, mir_strlen(ffd.cFileName));
FindClose(hFind);
}
// Check if we have relative or full path
@@ -252,7 +252,7 @@ void init_pluginname()
}
// copy to static variable
- strncpy_s(PLUGINNAME, SIZEOF(PLUGINNAME), p, mir_strlen(p));
+ strncpy_s(PLUGINNAME, _countof(PLUGINNAME), p, mir_strlen(p));
assert(mir_strlen(PLUGINNAME)>0);
}
@@ -273,7 +273,7 @@ BOOL strrep(char *src, char *needle, char *newstring)
begining[pos]='\0';
pos = pos+(int)mir_strlen(needle);
- strncpy_s(tail, _countof(tail), src+pos, SIZEOF(tail));
+ strncpy_s(tail, _countof(tail), src+pos, _countof(tail));
begining[pos]='\0';
pos = sprintf(src, "%s%s%s", begining, newstring, tail); //!!!!!!!!!!!!!!!!
@@ -333,8 +333,8 @@ void Click(HWND hWnd,BOOL execute)
if(execute && settingCommand[0] ) {
char tmpcommand[2*MAX_SETTING_STR];
char tmpparameters[2*MAX_SETTING_STR];
- strncpy_s(tmpcommand, SIZEOF(tmpcommand), settingCommand, SIZEOF(tmpcommand));
- strncpy_s(tmpparameters, SIZEOF(tmpparameters), settingParameters, SIZEOF(tmpparameters));
+ strncpy_s(tmpcommand, _countof(tmpcommand), settingCommand, _countof(tmpcommand));
+ strncpy_s(tmpparameters, _countof(tmpparameters), settingParameters, _countof(tmpparameters));
strrep(tmpcommand, "%OID%", pid->strNote);
strrep(tmpparameters, "%OID%", pid->strNote);
log_p(L"executing: %S %S", tmpcommand, tmpparameters);
@@ -429,10 +429,10 @@ BOOL checkNotesIniFile(BOOL bInfo)
if(settingIniAnswer == 1)
{
if(mir_strlen(tmp) > 0) {
- strcat_s(tmp, SIZEOF(tmp), ",");
- strcat_s(tmp, SIZEOF(tmp), PLUGINNAME_lower); //add our plugin to extensions
+ strcat_s(tmp, _countof(tmp), ",");
+ strcat_s(tmp, _countof(tmp), PLUGINNAME_lower); //add our plugin to extensions
} else {
- strncpy_s(tmp, SIZEOF(tmp), PLUGINNAME_lower, mir_strlen(PLUGINNAME_lower)); //set our plugin as extension
+ strncpy_s(tmp, _countof(tmp), PLUGINNAME_lower, mir_strlen(PLUGINNAME_lower)); //set our plugin as extension
}
(OSSetEnvironmentVariable1) ("EXTMGR_ADDINS", tmp); //set notes.ini entry
@@ -474,8 +474,8 @@ void showMsg(TCHAR* sender,TCHAR* text, DWORD id, char *strUID)
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL; //(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
- _tcscpy_s(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), sender);
- _tcscpy_s(ppd.lptzText, SIZEOF(ppd.lptzText), text);
+ _tcscpy_s(ppd.lptzContactName, _countof(ppd.lptzContactName), sender);
+ _tcscpy_s(ppd.lptzText, _countof(ppd.lptzText), text);
if(settingSetColours)
{
ppd.colorBack = settingBgColor;
@@ -486,7 +486,7 @@ void showMsg(TCHAR* sender,TCHAR* text, DWORD id, char *strUID)
ppd.iSeconds=settingInterval1;
//Now the "additional" data.
mpd->id = id;
- strncpy_s(mpd->strNote, SIZEOF(mpd->strNote), strUID, mir_strlen(strUID));
+ strncpy_s(mpd->strNote, _countof(mpd->strNote), strUID, mir_strlen(strUID));
//mpd->newStatus = ID_STATUS_ONLINE;
//Now that the plugin data has been filled, we add it to the PopUpData.
@@ -794,10 +794,10 @@ void checkthread(void*)
if(attSize){
WCHAR field_attachments_UNICODE[MAX_FIELD];
- mir_sntprintf(field_attachments_UNICODE, SIZEOF(field_attachments_UNICODE), TranslateW(L"Attachments: %d bytes"), attSize);
- mir_sntprintf(msgSubject, SIZEOF(msgSubject), L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE );
+ mir_sntprintf(field_attachments_UNICODE, _countof(field_attachments_UNICODE), TranslateW(L"Attachments: %d bytes"), attSize);
+ mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE );
} else {
- mir_sntprintf(msgSubject, SIZEOF(msgSubject), L"%S\n%s", field_date, field_subject_UNICODE );
+ mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s", field_date, field_subject_UNICODE );
}
//check if this is not filtered msg
@@ -975,27 +975,27 @@ void LoadSettings()
DBVARIANT dbv;
if(!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)){
- strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, SIZEOF(settingDatabase));
+ strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, _countof(settingDatabase));
db_free(&dbv);
}
if(!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) {
- strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, SIZEOF(settingServer));
+ strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, _countof(settingServer));
db_free(&dbv);
}
if(!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) {
- strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, SIZEOF(settingServerSec));
+ strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, _countof(settingServerSec));
db_free(&dbv);
}
if(!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) {
- strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, SIZEOF(settingPassword));
+ strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, _countof(settingPassword));
db_free(&dbv);
}
if(!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
- strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, SIZEOF(settingCommand));
+ strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, _countof(settingCommand));
db_free(&dbv);
}
if(!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
- strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, SIZEOF(settingParameters));
+ strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, _countof(settingParameters));
db_free(&dbv);
}
@@ -1036,7 +1036,7 @@ void LoadSettings()
void SaveSettings(HWND hwndDlg)
{
char buff[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, SIZEOF(settingServer));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
db_set_s(NULL, PLUGINNAME, "LNServer", settingServer );
db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec);
db_set_s(NULL, PLUGINNAME, "LNPassword", settingPassword);
@@ -1067,8 +1067,8 @@ void SaveSettings(HWND hwndDlg)
for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETCOUNT, 0, 0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_SENDER ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterSender, SIZEOF(settingFilterSender), text);
- _tcscat_s(settingFilterSender, SIZEOF(settingFilterSender), TEXT(";"));
+ _tcscat_s(settingFilterSender, _countof(settingFilterSender), text);
+ _tcscat_s(settingFilterSender, _countof(settingFilterSender), TEXT(";"));
}
db_set_ts(NULL, PLUGINNAME, "LNFilterSender", settingFilterSender);
@@ -1076,8 +1076,8 @@ void SaveSettings(HWND hwndDlg)
for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, 0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_SUBJECT ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterSubject, SIZEOF(settingFilterSubject), text);
- _tcscat_s(settingFilterSubject, SIZEOF(settingFilterSubject), TEXT(";"));
+ _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), text);
+ _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), TEXT(";"));
}
db_set_ts(NULL, PLUGINNAME, "LNFilterSubject", settingFilterSubject);
@@ -1085,8 +1085,8 @@ void SaveSettings(HWND hwndDlg)
for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, 0); i++){
TCHAR text[512] = TEXT("");
SendDlgItemMessage(hwndDlg,IDC_FILTER_TO ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterTo, SIZEOF(settingFilterTo), text);
- _tcscat_s(settingFilterTo, SIZEOF(settingFilterTo), TEXT(";"));
+ _tcscat_s(settingFilterTo, _countof(settingFilterTo), text);
+ _tcscat_s(settingFilterTo, _countof(settingFilterTo), TEXT(";"));
}
db_set_ts(NULL, PLUGINNAME, "LNFilterTo", settingFilterTo);
}
@@ -1129,15 +1129,15 @@ INT_PTR CALLBACK DlgProcLotusNotifyConnectionOpts(HWND hwndDlg, UINT msg, WPARAM
{
case IDC_BUTTON_DETECT:
lookupLotusDefaultSettings(hwndDlg);
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, SIZEOF(settingServer));
- GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, SIZEOF(settingDatabase));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
+ GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
break;
case IDC_BUTTON_CHECK:
settingIniCheck = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BUTTON_CHECK);
checkNotesIniFile(TRUE);
break;
case IDC_DATABASE:
- GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, SIZEOF(settingDatabase));
+ GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
break;
case IDC_SERVER:
switch(HIWORD(wParam))
@@ -1161,10 +1161,10 @@ INT_PTR CALLBACK DlgProcLotusNotifyConnectionOpts(HWND hwndDlg, UINT msg, WPARAM
}
break;
case IDC_SERVERSEC:
- GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, SIZEOF(settingServerSec));
+ GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, _countof(settingServerSec));
break;
case IDC_PASSWORD:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, SIZEOF(settingPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, _countof(settingPassword));
break;
case IDC_INTERVAL:
settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE);
@@ -1275,10 +1275,10 @@ INT_PTR CALLBACK DlgProcLotusNotifyPopupOpts(HWND hwndDlg, UINT msg, WPARAM wPar
settingEvenNonClicked = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMEMBEREVENNONCLICKED);
break;
case IDC_COMMAND:
- GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, SIZEOF(settingCommand));
+ GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, _countof(settingCommand));
break;
case IDC_PARAMETERS:
- GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, SIZEOF(settingParameters));
+ GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, _countof(settingParameters));
break;
case IDC_BUTTON_CLEAR:
deleteElements();
@@ -1398,7 +1398,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARAM wPara
switch(LOWORD(wParam))
{
case IDC_BUTTON_ADD_SENDER_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, SIZEOF(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, _countof(tmp));
if (strlen(tmp) > 0)
{
SendDlgItemMessageA(hwndDlg, IDC_FILTER_SENDER, CB_ADDSTRING, 0, (LPARAM)tmp);
@@ -1412,7 +1412,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARAM wPara
PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BUTTON_ADD_SUBJECT_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, SIZEOF(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, _countof(tmp));
if (strlen(tmp) > 0)
{
SendDlgItemMessageA(hwndDlg, IDC_FILTER_SUBJECT, CB_ADDSTRING, 0, (LPARAM)tmp);
@@ -1426,7 +1426,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARAM wPara
PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BUTTON_ADD_TO_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, SIZEOF(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, _countof(tmp));
if (strlen(tmp) > 0)
{
SendDlgItemMessageA(hwndDlg, IDC_FILTER_TO, CB_ADDSTRING, 0, (LPARAM)tmp);
@@ -1617,7 +1617,7 @@ void checkEnvPath(TCHAR *path)
return;
}
- assert(mir_tstrlen(path) + mir_tstrlen(cur) + 1 < SIZEOF(nowy));
+ assert(mir_tstrlen(path) + mir_tstrlen(cur) + 1 < _countof(nowy));
_tcsncpy_s(nowy, _T("PATH="), _TRUNCATE);
_tcscat_s(nowy, cur);
if(cur[mir_tstrlen(cur)-1]!=';')
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 895f5d0f1d..18e67d1720 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -297,11 +297,11 @@ int StatusMsgExists(MCONTACT hContact)
LPSTR module = GetContactProto(hContact);
if (!module) return 0;
- for (int i = 0; i < SIZEOF(statusMsg); i++) {
+ for (int i = 0; i < _countof(statusMsg); i++) {
if (statusMsg[i].flag & 8)
- mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
+ mir_snprintf(par, _countof(par), "%s/%s", module, statusMsg[i].name);
else
- strncpy(par, statusMsg[i].name, SIZEOF(par)-1);
+ strncpy(par, statusMsg[i].name, _countof(par)-1);
LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
@@ -341,9 +341,9 @@ void getIP(MCONTACT hContact, LPSTR szProto, LPSTR szIP)
DWORD mIP = db_get_dw(hContact, szProto, "IP", 0);
DWORD rIP = db_get_dw(hContact, szProto, "RealIP", 0);
if (mIP)
- mir_snprintf(szmIP, SIZEOF(szmIP), "External IP: %d.%d.%d.%d\r\n", mIP >> 24, (mIP >> 16) & 0xFF, (mIP >> 8) & 0xFF, mIP & 0xFF);
+ mir_snprintf(szmIP, _countof(szmIP), "External IP: %d.%d.%d.%d\r\n", mIP >> 24, (mIP >> 16) & 0xFF, (mIP >> 8) & 0xFF, mIP & 0xFF);
if (rIP)
- mir_snprintf(szrIP, SIZEOF(szrIP), "Internal IP: %d.%d.%d.%d\r\n", rIP >> 24, (rIP >> 16) & 0xFF, (rIP >> 8) & 0xFF, rIP & 0xFF);
+ mir_snprintf(szrIP, _countof(szrIP), "Internal IP: %d.%d.%d.%d\r\n", rIP >> 24, (rIP >> 16) & 0xFF, (rIP >> 8) & 0xFF, rIP & 0xFF);
mir_strcpy(szIP, szrIP);
mir_strcat(szIP, szmIP);
}
@@ -401,7 +401,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpara
case IDOK:
{
TCHAR tszReason[256] = { 0 };
- GetDlgItemText(hdlg, IDC_REASON, tszReason, SIZEOF(tszReason));
+ GetDlgItemText(hdlg, IDC_REASON, tszReason, _countof(tszReason));
CallContactService(hcontact, PSS_AUTHREQUEST, 0, (LPARAM)tszReason);
} // fall through
case IDCANCEL:
@@ -505,7 +505,7 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID)
TCHAR buffer[256];
char szID[256];
- GetID(hContact, szProto, (LPSTR)&szID, SIZEOF(szID));
+ GetID(hContact, szProto, (LPSTR)&szID, _countof(szID));
if (szID[0]) {
if (bShowID) {
if (bTrimID && (mir_strlen(szID) > MAX_IDLEN)) {
@@ -513,7 +513,7 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID)
szID[MAX_IDLEN + 1] = 0;
}
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s [%S]"), TranslateT("Copy ID"), szID);
+ mir_sntprintf(buffer, _countof(buffer), _T("%s [%S]"), TranslateT("Copy ID"), szID);
mi.ptszName = buffer;
}
else mi.ptszName = LPGENT("Copy ID");
@@ -596,7 +596,7 @@ INT_PTR onCopyID(WPARAM wparam, LPARAM lparam)
if (szProto == NULL)
return 0;
- GetID(hContact, szProto, (LPSTR)&szID, SIZEOF(szID));
+ GetID(hContact, szProto, (LPSTR)&szID, _countof(szID));
if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_CIDN) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
@@ -607,7 +607,7 @@ INT_PTR onCopyID(WPARAM wparam, LPARAM lparam)
mir_snprintf(buffer, "%s: %s", szProto, szID);
}
else
- strncpy(buffer, szID, SIZEOF(buffer)-1);
+ strncpy(buffer, szID, _countof(buffer)-1);
CopyToClipboard((HWND)lparam, buffer, 0);
if (CTRL_IS_PRESSED && bPopupService)
@@ -628,21 +628,21 @@ INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam)
return 0;
buffer[0] = 0;
- for (int i = 0; i < SIZEOF(statusMsg); i++) {
+ for (int i = 0; i < _countof(statusMsg); i++) {
if (statusMsg[i].flag & 8)
- mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
+ mir_snprintf(par, _countof(par), "%s/%s", module, statusMsg[i].name);
else
- strncpy(par, statusMsg[i].name, SIZEOF(par) - 1);
+ strncpy(par, statusMsg[i].name, _countof(par) - 1);
LPTSTR msg = db_get_tsa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
if (_tcsclen(msg)) {
if (flags & VF_SMNAME) {
- mir_tstrncat(buffer, TranslateTS(statusMsg[i].fullName), (SIZEOF(buffer) - _tcsclen(buffer) - 1));
- mir_tstrncat(buffer, _T(": "), (SIZEOF(buffer) - _tcsclen(buffer) - 1));
+ mir_tstrncat(buffer, TranslateTS(statusMsg[i].fullName), (_countof(buffer) - _tcsclen(buffer) - 1));
+ mir_tstrncat(buffer, _T(": "), (_countof(buffer) - _tcsclen(buffer) - 1));
}
- mir_tstrncat(buffer, msg, (SIZEOF(buffer) - _tcsclen(buffer) - 1));
- mir_tstrncat(buffer, _T("\r\n"), (SIZEOF(buffer) - _tcsclen(buffer) - 1));
+ mir_tstrncat(buffer, msg, (_countof(buffer) - _tcsclen(buffer) - 1));
+ mir_tstrncat(buffer, _T("\r\n"), (_countof(buffer) - _tcsclen(buffer) - 1));
}
mir_free(msg);
}
@@ -727,11 +727,11 @@ int isIgnored(MCONTACT hContact, int type)
return CallService(MS_IGNORE_ISIGNORED, hContact, (LPARAM)type);
int i = 0, all = 0;
- for (i = 1; i < SIZEOF(ii); i++)
+ for (i = 1; i < _countof(ii); i++)
if (isIgnored(hContact, ii[i].type))
all++;
- return (all == SIZEOF(ii) - 1) ? 1 : 0; // ignoring all or not
+ return (all == _countof(ii) - 1) ? 1 : 0; // ignoring all or not
}
INT_PTR onIgnore(WPARAM wparam, LPARAM lparam)
@@ -798,14 +798,14 @@ int BuildMenu(WPARAM wparam, LPARAM)
bEnabled = bShowAll || (flags & VF_IGN);
Menu_ShowItem(hmenuIgnore, bEnabled);
if (bEnabled) {
- for (int i = 1; i < SIZEOF(ii); i++) {
+ for (int i = 1; i < _countof(ii); i++) {
int check = isIgnored(hContact, ii[i].type);
if (check)
all++;
ModifySubmenuItem(hIgnoreItem[i], ii[i].name, check, 0);
- if (all == SIZEOF(ii) - 1) // ignor all
+ if (all == _countof(ii) - 1) // ignor all
check = 1;
else
check = 0;
@@ -1001,7 +1001,7 @@ static int PluginInit(WPARAM, LPARAM)
hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, Skin_LoadIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type);
pos += 100000; // insert separator
- for (i = 1; i < SIZEOF(ii); i++)
+ for (i = 1; i < _countof(ii); i++)
hIgnoreItem[i] = AddSubmenuItem(hmenuIgnore, ii[i].name, Skin_LoadIcon(ii[i].icon), 0, MS_IGNORE, pos++, ii[i].type);
pos += 100000; // insert separator
@@ -1086,8 +1086,8 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
- Icon_Register(hinstance, LPGEN("MenuItemEx"), iconList, SIZEOF(iconList));
- Icon_Register(hinstance, LPGEN("MenuItemEx"), overlayIconList, SIZEOF(overlayIconList));
+ Icon_Register(hinstance, LPGEN("MenuItemEx"), iconList, _countof(iconList));
+ Icon_Register(hinstance, LPGEN("MenuItemEx"), overlayIconList, _countof(overlayIconList));
HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp
index 495f34fb78..40960b4c0b 100644
--- a/plugins/MenuItemEx/src/options.cpp
+++ b/plugins/MenuItemEx/src/options.cpp
@@ -38,7 +38,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
TranslateDialogDefault(hdlg);
- for (i = 0; i < SIZEOF(checkboxes); i++)
+ for (i = 0; i < _countof(checkboxes); i++)
{
CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED);
}
@@ -47,7 +47,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
for (i = 0; i < 4; i++)
{
- GetDlgItemText(hdlg, checkboxes[i].idc, buffer, (SIZEOF(buffer) - 3));
+ GetDlgItemText(hdlg, checkboxes[i].idc, buffer, (_countof(buffer) - 3));
mir_tstrcat(buffer, _T(" *"));
SetDlgItemText(hdlg, checkboxes[i].idc, buffer);
}
@@ -72,7 +72,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
case PSN_APPLY:
DWORD mod_flags = 0;
- for (i = 0; i < SIZEOF(checkboxes); i++)
+ for (i = 0; i < _countof(checkboxes); i++)
mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0;
db_set_dw(NULL, MODULENAME, "flags", mod_flags);
diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp
index a8a9fa8aec..bdb80a7eba 100644
--- a/plugins/MessageState/src/messagestate.cpp
+++ b/plugins/MessageState/src/messagestate.cpp
@@ -41,7 +41,7 @@ void SetSRMMIcon(MCONTACT hContact, SRMM_ICON_TYPE type, time_t time = 0)
sid.hIcon = IcoLib_GetIcon("read_icon");
TCHAR ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
- _tcsftime_l(ttime, SIZEOF(ttime), _T("%X %x"), localtime(&time), locale);
+ _tcsftime_l(ttime, _countof(ttime), _T("%X %x"), localtime(&time), locale);
_free_locale(locale);
CMString tooltip(FORMAT, L"%s %s", TranslateT("Last message read at"), ttime);
sid.tszTooltip = mir_tstrdup(tooltip.GetBuffer());
@@ -150,7 +150,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_DB_EVENT_FILTER_ADD, OnEventFilterAdd);
// IcoLib support
- for (size_t i = 0; i < SIZEOF(Icons); i++)
+ for (size_t i = 0; i < _countof(Icons); i++)
Icon_Register(g_hInst, MODULENAME, &Icons[i], 1);
StatusIconData sid = { sizeof(sid) };
diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp
index f729e9d448..cf06ef7359 100644
--- a/plugins/MirFox/src/MirandaOptions.cpp
+++ b/plugins/MirFox/src/MirandaOptions.cpp
@@ -218,7 +218,7 @@ static void setListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
if(hChildItem) {
setListGroupIcons(hwndList, hChildItem, hItem, childCount); //recursion
}
- for( i=0; i < SIZEOF(iconOn); i++){
+ for( i=0; i < _countof(iconOn); i++){
if(iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem,i) == 0){
iconOn[i] = 0;
}
@@ -234,7 +234,7 @@ static void setListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
}
while(hItem) {
- for ( i=0; i < SIZEOF(iconOn); i++) {
+ for ( i=0; i < _countof(iconOn); i++) {
iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if(iconOn[i] && iImage==0){
iconOn[i]=0;
@@ -247,7 +247,7 @@ static void setListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
}
//set icons
- for( i=0; i < SIZEOF(iconOn); i++) {
+ for( i=0; i < _countof(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i,childCount[i]?(iconOn[i]?i+1:0):0xFF));
if(groupChildCount){
groupChildCount[i]+=childCount[i];
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp
index b213b3d1c9..b5bb5a0fd6 100644
--- a/plugins/MirFox/src/MirandaUtils.cpp
+++ b/plugins/MirFox/src/MirandaUtils.cpp
@@ -52,7 +52,7 @@ std::wstring& MirandaUtils::getProfileName()
}
wchar_t mirandaProfileNameW[128] = {0};
- CallService(MS_DB_GETPROFILENAMEW, SIZEOF(mirandaProfileNameW), (WPARAM)mirandaProfileNameW);
+ CallService(MS_DB_GETPROFILENAMEW, _countof(mirandaProfileNameW), (WPARAM)mirandaProfileNameW);
profileName.append(mirandaProfileNameW);
return profileName;
@@ -68,7 +68,7 @@ std::wstring& MirandaUtils::getDisplayName()
displayName.append(L"Miranda NG v.");
char mirandaVersion[128];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(mirandaVersion), (LPARAM)mirandaVersion);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(mirandaVersion), (LPARAM)mirandaVersion);
displayName.append(_A2T(mirandaVersion));
displayName.append(L" (");
displayName.append(getProfileName());
diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp
index bbe1819862..06e02dd65c 100644
--- a/plugins/MirFox/src/MirfoxMiranda.cpp
+++ b/plugins/MirFox/src/MirfoxMiranda.cpp
@@ -116,7 +116,7 @@ void CMirfoxMiranda::initializeSharedMemoryData(MirfoxData& mirfoxData, SharedMe
} else {
mirfoxData.processCsmId = result.processCsmId;
wchar_t prefix[7];
- mir_sntprintf(prefix, SIZEOF(prefix), L"MNG%d", result.processCsmId);
+ mir_sntprintf(prefix, _countof(prefix), L"MNG%d", result.processCsmId);
logger->set6CharsPrefix(prefix);
}
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp
index e3bbe36b54..1ff2b97f53 100644
--- a/plugins/MirLua/src/m_icolib.cpp
+++ b/plugins/MirLua/src/m_icolib.cpp
@@ -3,10 +3,10 @@
static int lua_AddIcon(lua_State *L)
{
TCHAR filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, SIZEOF(filePath));
+ GetModuleFileName(g_hInstance, filePath, _countof(filePath));
char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
SKINICONDESC si = { 0 };
si.flags = SIDF_PATH_TCHAR;
@@ -25,7 +25,7 @@ static int lua_AddIcon(lua_State *L)
static int lua_GetIcon(lua_State *L)
{
char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
HANDLE res = ::IcoLib_GetIconHandle(iconName);
lua_pushlightuserdata(L, res);
@@ -42,7 +42,7 @@ static int lua_RemoveIcon(lua_State *L)
else if (lua_isstring(L, 1))
{
char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, lua_tostring(L, 1));
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, lua_tostring(L, 1));
::IcoLib_RemoveIcon(iconName);
}
else
diff --git a/plugins/MirLua/src/mlua_loader.cpp b/plugins/MirLua/src/mlua_loader.cpp
index c3b1d2edf2..1e62b2653d 100644
--- a/plugins/MirLua/src/mlua_loader.cpp
+++ b/plugins/MirLua/src/mlua_loader.cpp
@@ -35,9 +35,9 @@ void CLuaLoader::LoadScripts()
{
TCHAR scriptDir[MAX_PATH];
- FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, SIZEOF(scriptDir), VARST(COMMON_SCRIPTS_PATHT));
+ FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, _countof(scriptDir), VARST(COMMON_SCRIPTS_PATHT));
LoadScripts(scriptDir);
- FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, SIZEOF(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT));
+ FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, _countof(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT));
LoadScripts(scriptDir);
} \ No newline at end of file
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp
index 0b06623bde..8cd86f0f3d 100644
--- a/plugins/MirLua/src/mlua_options.cpp
+++ b/plugins/MirLua/src/mlua_options.cpp
@@ -50,13 +50,13 @@ void CLuaOptions::OnInitDialog()
m_scripts.AddColumn(0, _T("Script"), 300);
TCHAR scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
- FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, SIZEOF(scriptDir), VARST(COMMON_SCRIPTS_PATHT));
+ FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, _countof(scriptDir), VARST(COMMON_SCRIPTS_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
mir_sntprintf(header, _T("%s (%s)"), TranslateT("Common scripts"), relativeScriptDir);
m_scripts.AddGroup(0, header);
LoadScripts(scriptDir, 0);
- FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, SIZEOF(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT));
+ FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, _countof(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
mir_sntprintf(header, _T("%s (%s)"), TranslateT("Custom scripts"), relativeScriptDir);
m_scripts.AddGroup(1, header);
@@ -71,7 +71,7 @@ void CLuaOptions::OnApply()
for (int iItem = 0; iItem < count; iItem++)
{
TCHAR fileName[MAX_PATH];
- m_scripts.GetItemText(iItem, 0, fileName, SIZEOF(fileName));
+ m_scripts.GetItemText(iItem, 0, fileName, _countof(fileName));
if (!m_scripts.GetCheckState(iItem))
db_set_b(NULL, MODULE, _T2A(fileName), 0);
else
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index c688048302..76a690976e 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -41,9 +41,9 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact));
const TCHAR *name =contact_get_nameT(hContact);
- mir_sntprintf(title, SIZEOF(title), TranslateT(LANG_SMP_PROGRESS_TITLE), name, proto);
+ mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_PROGRESS_TITLE), name, proto);
SetWindowText(hwndDlg, title);
- mir_sntprintf(title, SIZEOF(title), TranslateT(LANG_SMP_PROGRESS_DESC), name, proto);
+ mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_PROGRESS_DESC), name, proto);
mir_free(proto);
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEADPRO, title);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context);
@@ -328,7 +328,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
MCONTACT hContact = (MCONTACT)context->app_data;
TCHAR title[512], *proto = mir_a2t(GetContactProto(hContact));
- mir_sntprintf(title, SIZEOF(title), TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto);
+ mir_sntprintf(title, _countof(title), TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(hContact), proto);
mir_free(proto);
SetWindowText(hwndDlg, title);
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title);
@@ -421,7 +421,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) {
if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
TCHAR msg[512];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
ShowError(msg);
}else {
int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0);
@@ -443,7 +443,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
TCHAR msg[512];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT(hContact));
ShowError(msg);
}else {
int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
@@ -737,7 +737,7 @@ unsigned int CALLBACK verify_context_thread(void *param)
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, "verified");
otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact));
ShowMessage(hContact, msg);
SetEncryptionStatus(hContact, otr_context_get_trust(context));
break;
@@ -745,7 +745,7 @@ unsigned int CALLBACK verify_context_thread(void *param)
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, NULL);
otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
+ mir_sntprintf(msg, _countof(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
ShowMessage(hContact, msg);
SetEncryptionStatus(hContact, otr_context_get_trust(context));
break;
diff --git a/plugins/MirOTR/src/icons.cpp b/plugins/MirOTR/src/icons.cpp
index fa92c1804c..9b952736b1 100644
--- a/plugins/MirOTR/src/icons.cpp
+++ b/plugins/MirOTR/src/icons.cpp
@@ -11,5 +11,5 @@ static IconItem iconList[] = {
void InitIcons()
{
- Icon_Register(hInst, "OTR", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "OTR", iconList, _countof(iconList));
}
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp
index 6c685d11f8..4cab62e690 100644
--- a/plugins/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/src/mirotrmenu.cpp
@@ -107,17 +107,17 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM)
switch (level) {
case TRUST_PRIVATE:{
mi.hIcolibItem = IcoLib_GetIconHandle(ICON_PRIVATE);
- mir_tstrncpy(text,TranslateT(LANG_STATUS_PRIVATE),SIZEOF(text));
+ mir_tstrncpy(text,TranslateT(LANG_STATUS_PRIVATE),_countof(text));
size_t len = mir_tstrlen(text);
- if(len < SIZEOF(text))
- mir_sntprintf(text+len, SIZEOF(text)-len, _T(" [v%i]"), context->protocol_version);
+ if(len < _countof(text))
+ mir_sntprintf(text+len, _countof(text)-len, _T(" [v%i]"), context->protocol_version);
break;}
case TRUST_UNVERIFIED:{
mi.hIcolibItem = IcoLib_GetIconHandle(ICON_UNVERIFIED);
- mir_tstrncpy(text,TranslateT(LANG_STATUS_UNVERIFIED),SIZEOF(text));
+ mir_tstrncpy(text,TranslateT(LANG_STATUS_UNVERIFIED),_countof(text));
size_t len = mir_tstrlen(text);
- if(len < SIZEOF(text))
- mir_sntprintf(text+len, SIZEOF(text)-len, _T(" [v%i]"), context->protocol_version);
+ if(len < _countof(text))
+ mir_sntprintf(text+len, _countof(text)-len, _T(" [v%i]"), context->protocol_version);
break;}
case TRUST_FINISHED:
mi.hIcolibItem = IcoLib_GetIconHandle(ICON_FINISHED);
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index 5178e6cf25..ef55726f0c 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -37,7 +37,7 @@ void SetFilenames(const TCHAR *path)
int FoldersChanged(WPARAM wParam, LPARAM lParam)
{
TCHAR path[MAX_PATH];
- if ( FoldersGetCustomPathT(hPATH_MIROTR, path, SIZEOF(path), _T("")))
+ if ( FoldersGetCustomPathT(hPATH_MIROTR, path, _countof(path), _T("")))
SetFilenames( VARST(DATA_DIRECTORY));
else
SetFilenames(path);
@@ -352,7 +352,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
if (sel != -1) {
PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS();
opts->refresh = hwndDlg;
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, SIZEOF(opts->proto));
+ ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, _countof(opts->proto));
CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0));
}
break;
@@ -361,7 +361,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS));
if (sel != -1) {
TCHAR buff_proto[128];
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, SIZEOF(buff_proto));
+ ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, _countof(buff_proto));
TCHAR buff[512];
mir_sntprintf(buff, TranslateT(LANG_OTR_ASK_REMOVEKEY), buff_proto);
if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION | MB_YESNO)) {
@@ -416,7 +416,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_NEWKEY), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), TRUE);
TCHAR buff[50];
- ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 1, buff, SIZEOF(buff));
+ ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 1, buff, _countof(buff));
SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff);
}
}
@@ -428,7 +428,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
if (proto == NULL)
continue;
- ListView_GetItemText(lv, i, 1, policy, SIZEOF(policy));
+ ListView_GetItemText(lv, i, 1, policy, _countof(policy));
db_set_dw(0, MODULENAME"_ProtoPol", proto, policy_from_string(policy));
}
// handle apply
@@ -579,7 +579,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
else {
EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), TRUE);
TCHAR buff[50];
- ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 2, buff, SIZEOF(buff));
+ ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, notif->iItem, 2, buff, _countof(buff));
SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff);
}
}
@@ -595,7 +595,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
MCONTACT hContact = (MCONTACT)lvi.lParam;
ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR buff[50];
- ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, SIZEOF(buff));
+ ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, _countof(buff));
if (_tcsncmp(buff, TranslateT(LANG_YES), 50) == 0) {
(*cp)[hContact].htmlconv = HTMLCONV_DISABLE;
ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_NO));
@@ -750,8 +750,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
- mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
- buff[SIZEOF(buff) - 1] = '\0';
+ mir_sntprintf(buff, _countof(buff) - 1, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
+ buff[_countof(buff) - 1] = '\0';
ShowError(buff);
}
else {
@@ -781,8 +781,8 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
TCHAR buff[1024], hash[45];
otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
- mir_sntprintf(buff, SIZEOF(buff) - 1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
- buff[SIZEOF(buff) - 1] = '\0';
+ mir_sntprintf(buff, _countof(buff) - 1, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
+ buff[_countof(buff) - 1] = '\0';
ShowError(buff);
}
else otrl_context_forget_fingerprint(it->first, 1);
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index 9d5a690cd3..b7ee6b3963 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -182,7 +182,7 @@ extern "C" {
if (context->protocol_version < MIROTR_PROTO_LATEST){
size_t remaining = mir_tstrlen(buff);
TCHAR *offset = buff + remaining;
- remaining = SIZEOF(buff) - remaining;
+ remaining = _countof(buff) - remaining;
mir_sntprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version);
}
ShowMessage(hContact, buff);
@@ -314,68 +314,68 @@ extern "C" {
break;
case OTRL_MSGEVENT_ENCRYPTION_REQUIRED:
msgfunc = ShowMessageInline;
- mir_tstrncpy(msg, TranslateT("Attempting to start a private conversation..."), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("Attempting to start a private conversation..."), _countof(msg));
break;
case OTRL_MSGEVENT_ENCRYPTION_ERROR:
msgfunc = ShowMessageInline;
- mir_tstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), _countof(msg));
break;
case OTRL_MSGEVENT_CONNECTION_ENDED:
msgfunc = ShowMessageInline;
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("'%s' has already closed his/her private connection to you; you should do the same"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("'%s' has already closed his/her private connection to you; you should do the same"), contact);
break;
case OTRL_MSGEVENT_SETUP_ERROR:
// title = TranslateT("OTR Error");
if (!err) err = GPG_ERR_INV_VALUE;
switch (gcry_err_code(err)){
case GPG_ERR_INV_VALUE:
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received"));
+ mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received"));
break;
default:{
TCHAR* tmp = mir_utf8decodeT(gcry_strerror(err));
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("Error setting up private conversation: %s"), tmp);
+ mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), tmp);
mir_free(tmp); }
}
break;
case OTRL_MSGEVENT_MSG_REFLECTED:
// title = TranslateT("OTR Error");
- mir_tstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), _countof(msg));
break;
case OTRL_MSGEVENT_MSG_RESENT:
// title = TranslateT("Message resent");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The last message to '%s' was resent"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The last message to '%s' was resent"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE:
// title = TranslateT("Unreadable message");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The encrypted message received from '%s' is unreadable, as you are not currently communicating privately"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The encrypted message received from '%s' is unreadable, as you are not currently communicating privately"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_UNREADABLE:
// title = TranslateT("OTR Error");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("We received an unreadable encrypted message from '%s'"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("We received an unreadable encrypted message from '%s'"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_MALFORMED:
// title = TranslateT("OTR Error");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("We received a malformed data message from '%s'"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("We received a malformed data message from '%s'"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:{
// title = TranslateT("OTR Error");
TCHAR* tmp = mir_utf8decodeT(message);
- mir_tstrncpy(msg, tmp, SIZEOF(msg));
+ mir_tstrncpy(msg, tmp, _countof(msg));
mir_free(tmp);
break; }
case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:{
// title = TranslateT("Received unencrypted message");
TCHAR* tmp = mir_utf8decodeT(message);
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The following message received from '%s' was NOT encrypted: [%s]"), contact, tmp);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The following message received from '%s' was NOT encrypted: [%s]"), contact, tmp);
mir_free(tmp);
break; }
case OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE:
// title = TranslateT("Received message for a different session");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("'%s' has sent a message intended for a different session. If you are logged in multiple times, another session may have received the message."), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("'%s' has sent a message intended for a different session. If you are logged in multiple times, another session may have received the message."), contact);
break;
default:
// title = TranslateT("OTR Error");
- mir_tstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG"), _countof(msg));
}
if (msg[0])
msgfunc(hContact, msg);
diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp
index d5837ae2bc..e3e33c5adb 100644
--- a/plugins/MirOTR/src/svcs_menu.cpp
+++ b/plugins/MirOTR/src/svcs_menu.cpp
@@ -22,7 +22,7 @@ int StartOTR(MCONTACT hContact) {
TCHAR* nick=ProtoGetNickname(proto);
if(nick){
TCHAR msg[1024];
- TCHAR* msgend = msg+SIZEOF(msg)-1;
+ TCHAR* msgend = msg+_countof(msg)-1;
TCHAR* msgoff = msg;
for(const char* c=MIROTR_PROTO_HELLO; *c; *msgoff++=*c++);
*msgoff++ = '\n';
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 0dfc5a2407..d8e5e968e1 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -68,7 +68,7 @@ void VerifyFingerprintMessage(ConnContext *context, bool verify) {
MCONTACT hContact = (MCONTACT)context->app_data;
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
+ mir_sntprintf(msg, _countof(msg), (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
ShowMessage(hContact, msg);
SetEncryptionStatus(hContact, otr_context_get_trust(context));
}
@@ -155,7 +155,7 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTA
if ( !options.bHavePopups) {
TCHAR title[256];
- mir_sntprintf(title, SIZEOF(title), _T("%s Message"), _T(MODULENAME));
+ mir_sntprintf(title, _countof(title), _T("%s Message"), _T(MODULENAME));
if(line1 && line2) {
int size = int(mir_tstrlen(line1) + mir_tstrlen(line2) + 3);
@@ -205,7 +205,7 @@ void ShowWarning(TCHAR *msg) {
if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL;
if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB;
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s Warning"), _T(MODULENAME));
+ mir_sntprintf(buffer, _countof(buffer), _T("%s Warning"), _T(MODULENAME));
TCHAR *message;
switch(disp) {
@@ -251,7 +251,7 @@ void ShowError(TCHAR *msg) {
if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL;
if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB;
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s Error"), _T(MODULENAME));
+ mir_sntprintf(buffer, _countof(buffer), _T("%s Error"), _T(MODULENAME));
TCHAR *message;
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index f8ff7c95c4..f6a2c7440c 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -210,7 +210,7 @@ tstring CAppletManager::TranslateString(TCHAR *szString,...)
va_list body;
va_start(body, szString);
- _vstprintf_s(out, SIZEOF(out), szTranslatedString, body);
+ _vstprintf_s(out, _countof(out), szTranslatedString, body);
va_end(body);
return out;
}
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp
index 6fe8307ecf..4d92132a1b 100644
--- a/plugins/MirandaG15/src/CConfig.cpp
+++ b/plugins/MirandaG15/src/CConfig.cpp
@@ -289,7 +289,7 @@ void CConfig::SaveFontSettings(int iFont)
char szSetting[128];
// Height
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dHeight",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dHeight",iFont);
db_set_b(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfHeight);
// Style
int style = 0;
@@ -297,13 +297,13 @@ void CConfig::SaveFontSettings(int iFont)
style |= FONTF_BOLD;
if(m_logfont[iFont].lfItalic)
style |= FONTF_ITALIC;
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dStyle",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dStyle",iFont);
db_set_b(NULL, "MirandaG15", szSetting, style);
// Charset
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dCharset",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dCharset",iFont);
db_set_b(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfCharSet);
// Name
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dName",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dName",iFont);
db_set_ts(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfFaceName);
UpdateFontSettings(iFont);
@@ -322,18 +322,18 @@ void CConfig::LoadFontSettings(int iFont)
m_logfont[iFont].lfQuality = DEFAULT_QUALITY;
m_logfont[iFont].lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
// Height
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dHeight",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dHeight",iFont);
m_logfont[iFont].lfHeight = (char) db_get_b(NULL, "MirandaG15", szSetting, -MulDiv(6, 96, 72));
// Style
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dStyle",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dStyle",iFont);
int style = db_get_b(NULL, "MirandaG15", szSetting, 0);
m_logfont[iFont].lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
m_logfont[iFont].lfItalic = style & FONTF_ITALIC ? 1 : 0;
// Charset
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dCharset",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dCharset",iFont);
m_logfont[iFont].lfCharSet = db_get_b(NULL, "MirandaG15", szSetting, DEFAULT_CHARSET);
// Name
- mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dName",iFont);
+ mir_snprintf(szSetting,_countof(szSetting),"Font%dName",iFont);
DBVARIANT dbv;
if (db_get_ts(NULL, "MirandaG15", szSetting, &dbv))
mir_tstrcpy(m_logfont[iFont].lfFaceName,_T("Small Fonts"));
@@ -507,10 +507,10 @@ INT_PTR CALLBACK CConfig::ChatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
CheckDlgButton(hwndDlg, IDC_SESSION_SCROLLFIRST, m_aiIntSettings[SESSION_AUTOSCROLL] == SESSION_AUTOSCROLL_FIRST? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SESSION_SCROLLLAST, m_aiIntSettings[SESSION_AUTOSCROLL] == SESSION_AUTOSCROLL_LAST? BST_CHECKED : BST_UNCHECKED);
- _itoa_s(m_aiIntSettings[SESSION_LOGSIZE], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[SESSION_LOGSIZE], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_SESSION_LOGSIZE, buf);
- _itoa_s(m_aiIntSettings[SESSION_CLOSETIMER], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[SESSION_CLOSETIMER], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_SESSION_CLOSETIMER, buf);
m_bInitializingDialog = false;
@@ -543,10 +543,10 @@ INT_PTR CALLBACK CConfig::ChatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
m_abBoolSettings[MAXIMIZED_TITLE] = IsDlgButtonChecked(hwndDlg,IDC_MAXIMIZED_TITLE) == BST_UNCHECKED ? true : false;
m_abBoolSettings[MAXIMIZED_LABELS] = IsDlgButtonChecked(hwndDlg,IDC_MAXIMIZED_LABELS) == BST_UNCHECKED ? true : false;
- GetDlgItemTextA(hwndDlg,IDC_SESSION_LOGSIZE,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_SESSION_LOGSIZE,buf,_countof(buf));
m_aiIntSettings[SESSION_LOGSIZE] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_SESSION_CLOSETIMER,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_SESSION_CLOSETIMER,buf,_countof(buf));
m_aiIntSettings[SESSION_CLOSETIMER] = atoi(buf) >= 0 ? atoi(buf):1;
CConfig::SaveSettings();
@@ -622,16 +622,16 @@ INT_PTR CALLBACK CConfig::NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM w
CheckDlgButton(hwndDlg, IDC_NOTIFY_SKIP_STATUS, m_abBoolSettings[NOTIFY_SKIP_STATUS] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIFY_SKIP_MESSAGES, m_abBoolSettings[NOTIFY_SKIP_MESSAGES] ? BST_CHECKED : BST_UNCHECKED);
- _itoa_s(m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_NOTIFY_CHANNELCUTOFF_OFFSET, buf);
- _itoa_s(m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_NOTIFY_NICKCUTOFF_OFFSET, buf);
- _itoa_s(m_aiIntSettings[NOTIFY_LOGSIZE], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[NOTIFY_LOGSIZE], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_NOTIFY_LOGSIZE, buf);
- _itoa_s(m_aiIntSettings[NOTIFY_DURATION], buf, SIZEOF(buf), 10);
+ _itoa_s(m_aiIntSettings[NOTIFY_DURATION], buf, _countof(buf), 10);
SetDlgItemTextA(hwndDlg, IDC_NOTIFY_DURATION, buf);
CheckDlgButton(hwndDlg, IDC_NOTIFY_TITLEHIDE, m_aiIntSettings[NOTIFY_TITLE] == NOTIFY_TITLE_HIDE? BST_CHECKED : BST_UNCHECKED);
@@ -699,16 +699,16 @@ INT_PTR CALLBACK CConfig::NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM w
m_abBoolSettings[NOTIFY_SKIP_SIGNOFF] = IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_SKIP_SIGNOFF) == BST_CHECKED ? true : false;
m_abBoolSettings[NOTIFY_SKIP_STATUS] = IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_SKIP_STATUS) == BST_CHECKED ? true : false;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_CHANNELCUTOFF_OFFSET,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_CHANNELCUTOFF_OFFSET,buf,_countof(buf));
m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_NICKCUTOFF_OFFSET,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_NICKCUTOFF_OFFSET,buf,_countof(buf));
m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_DURATION,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_DURATION,buf,_countof(buf));
m_aiIntSettings[NOTIFY_DURATION] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_LOGSIZE,buf,SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_LOGSIZE,buf,_countof(buf));
m_aiIntSettings[NOTIFY_LOGSIZE] = atoi(buf) > 0 ? atoi(buf):1;
if(IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_TITLEHIDE) == BST_CHECKED)
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp
index 30fab7c64d..256e727e6b 100644
--- a/plugins/MobileState/src/main.cpp
+++ b/plugins/MobileState/src/main.cpp
@@ -60,7 +60,7 @@ bool hasMobileClient(MCONTACT hContact, LPARAM)
_tcslwr(client);
// Find whether this client contain something from clients list
- for (size_t i = 0; i < SIZEOF(clients); i++)
+ for (size_t i = 0; i < _countof(clients); i++)
if (_tcsstr(client, clients[i]))
return true;
}
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp
index b661a453ae..0e7d47fb0d 100644
--- a/plugins/ModernOpt/src/modernopt.cpp
+++ b/plugins/ModernOpt/src/modernopt.cpp
@@ -188,7 +188,7 @@ static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
hwndCtrl = GetDlgItem(hwndDlg, IDC_ICOTABS);
- for (i = 0; i < SIZEOF(g_ModernOptPages); ++i)
+ for (i = 0; i < _countof(g_ModernOptPages); ++i)
if (g_ModernOptPages[i].bShow && g_ModernOptPages[i].bShowTab)
{
HICON hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(g_ModernOptPages[i].iIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
diff --git a/plugins/ModernOpt/src/mopt_home.cpp b/plugins/ModernOpt/src/mopt_home.cpp
index ad5682d23a..c8154a4e12 100644
--- a/plugins/ModernOpt/src/mopt_home.cpp
+++ b/plugins/ModernOpt/src/mopt_home.cpp
@@ -35,7 +35,7 @@ INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- for (i = 0; i < SIZEOF(g_ModernOptPages); ++i) {
+ for (i = 0; i < _countof(g_ModernOptPages); ++i) {
if (g_ModernOptPages[i].idcButton) {
HWND hwndCtrl = GetDlgItem(hwndDlg, g_ModernOptPages[i].idcButton);
if (g_ModernOptPages[i].bShow) {
@@ -57,7 +57,7 @@ INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
break;
default:
- for (i = 0; i < SIZEOF(g_ModernOptPages); ++i) {
+ for (i = 0; i < _countof(g_ModernOptPages); ++i) {
if (g_ModernOptPages[i].idcButton == LOWORD(wParam))
{
CallService(MS_MODERNOPT_SELECTPAGE, i, 0);
diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp
index 2b49e1ddf8..70d47e9239 100644
--- a/plugins/ModernOpt/src/mopt_selector.cpp
+++ b/plugins/ModernOpt/src/mopt_selector.cpp
@@ -85,7 +85,7 @@ struct TSkinListItem
if (TCHAR *p = _tcsrchr(title, _T('.'))) *p = 0;
TCHAR curPath[MAX_PATH];
- GetCurrentDirectory(SIZEOF(curPath), curPath);
+ GetCurrentDirectory(_countof(curPath), curPath);
path = (TCHAR *)mir_alloc(MAX_PATH * sizeof(TCHAR));
PathToRelativeT(curPath, path);
@@ -130,7 +130,7 @@ static void BuildSkinList(HWND hwndList, TCHAR *szExt, int nExtLength = -1, bool
{
if (start) {
static TCHAR mirPath[MAX_PATH];
- GetModuleFileName(NULL, mirPath, SIZEOF(mirPath));
+ GetModuleFileName(NULL, mirPath, _countof(mirPath));
if (TCHAR *p = _tcsrchr(mirPath, _T('\\'))) *p = 0;
SetCurrentDirectory(mirPath);
SendMessage(hwndList, LB_RESETCONTENT, 0, 0);
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp
index 567a5402bf..1bbfba97a2 100644
--- a/plugins/MsgPopup/src/main.cpp
+++ b/plugins/MsgPopup/src/main.cpp
@@ -199,9 +199,9 @@ void LoadConfig()
{
for (int indx = 0; indx < 4; indx++) {
char szNameFG[4], szNameBG[4], szNameTO[4];
- mir_snprintf(szNameFG, SIZEOF(szNameFG), "FG%d", indx);
- mir_snprintf(szNameBG, SIZEOF(szNameBG), "BG%d", indx);
- mir_snprintf(szNameTO, SIZEOF(szNameTO), "TO%d", indx);
+ mir_snprintf(szNameFG, _countof(szNameFG), "FG%d", indx);
+ mir_snprintf(szNameBG, _countof(szNameBG), "BG%d", indx);
+ mir_snprintf(szNameTO, _countof(szNameTO), "TO%d", indx);
options.FG[indx] = db_get_dw(NULL, SERVICENAME, szNameFG, optionsDefault.FG[indx]);
options.BG[indx] = db_get_dw(NULL, SERVICENAME, szNameBG, optionsDefault.BG[indx]);
options.Timeout[indx] = db_get_dw(NULL, SERVICENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]);
diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp
index 3fe5552085..a57f74a925 100644
--- a/plugins/MsgPopup/src/options.cpp
+++ b/plugins/MsgPopup/src/options.cpp
@@ -99,9 +99,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
int indx;
for (indx = 0; indx < 4; indx++) {
- mir_snprintf(szNameFG, SIZEOF(szNameFG), "FG%d", indx);
- mir_snprintf(szNameBG, SIZEOF(szNameBG), "BG%d", indx);
- mir_snprintf(szNameTO, SIZEOF(szNameTO), "TO%d", indx);
+ mir_snprintf(szNameFG, _countof(szNameFG), "FG%d", indx);
+ mir_snprintf(szNameBG, _countof(szNameBG), "BG%d", indx);
+ mir_snprintf(szNameTO, _countof(szNameTO), "TO%d", indx);
DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]);
DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]);
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp
index e76ac7a885..87a4b04606 100755
--- a/plugins/Msg_Export/src/FileViewer.cpp
+++ b/plugins/Msg_Export/src/FileViewer.cpp
@@ -198,7 +198,7 @@ int CLStreamRTFInfo::nWriteHeader(char *pszTarget, int nLen)
*/
char szRtfHeader[400];
- int nSrcLen = mir_snprintf(szRtfHeader, SIZEOF(szRtfHeader),
+ int nSrcLen = mir_snprintf(szRtfHeader, _countof(szRtfHeader),
"{\\rtf1\\ansi\r\n"
"{\\colortbl ;\\red%d\\green%d\\blue%d;\\red%d\\green%d\\blue%d;}\r\n"
"\\viewkind4\\uc1\\pard\\cf2 ",
@@ -625,9 +625,9 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg)
TCHAR szTmp[1500];
if (nDBCount == -1)
- mir_sntprintf(szTmp, SIZEOF(szTmp), TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str());
+ mir_sntprintf(szTmp, _countof(szTmp), TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str());
else
- mir_sntprintf(szTmp, SIZEOF(szTmp), TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount);
+ mir_sntprintf(szTmp, _countof(szTmp), TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount);
SETTEXTEX stText = { 0 };
stText.codepage = 1200;
@@ -674,7 +674,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg)
CloseHandle(hFile);
TCHAR szTmp[100];
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("File open time %d\n"), GetTickCount() - dwStart);
+ mir_sntprintf(szTmp, _countof(szTmp), _T("File open time %d\n"), GetTickCount() - dwStart);
OutputDebugString(szTmp);
GETTEXTLENGTHEX sData = { 0 };
@@ -686,7 +686,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg)
if (!bScrollToBottom)
SendMessage(hRichEdit, EM_SETSCROLLPOS, 0, (LPARAM)&ptOldPos);
- mir_sntprintf(szTmp, SIZEOF(szTmp), TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart);
+ mir_sntprintf(szTmp, _countof(szTmp), TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart);
OutputDebugString(szTmp);
return true;
}
@@ -985,7 +985,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR szFormat[200];
TCHAR szTitle[200];
- if (GetWindowText(hwndDlg, szFormat, SIZEOF(szFormat))) {
+ if (GetWindowText(hwndDlg, szFormat, _countof(szFormat))) {
const TCHAR *pszNick = NickFromHandle(pclDlg->hContact);
tstring sPath = pclDlg->sPath;
string::size_type n = sPath.find_last_of('\\');
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index d458e782da..dd6ebaae35 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -297,7 +297,7 @@ void SetToDefault(HWND hParent)
}
TCHAR szTemp[500];
- if (!GetDlgItemText(hParent, IDC_DEFAULT_FILE, szTemp, SIZEOF(szTemp)))
+ if (!GetDlgItemText(hParent, IDC_DEFAULT_FILE, szTemp, _countof(szTemp)))
return;
LVITEM sItem = { 0 };
@@ -359,16 +359,16 @@ BOOL bApplyChanges(HWND hwndDlg)
nMaxLineWidth = nTmp;
}
- GetDlgItemText(hwndDlg, IDC_EXPORT_TIMEFORMAT, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_EXPORT_TIMEFORMAT, szTemp, _countof(szTemp));
sTimeFormat = szTemp;
- GetDlgItemText(hwndDlg, IDC_EXPORT_DIR, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_EXPORT_DIR, szTemp, _countof(szTemp));
sExportDir = szTemp;
- GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szTemp, _countof(szTemp));
sDefaultFile = szTemp;
- GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szTemp, _countof(szTemp));
sFileViewerPrg = szTemp;
bUseInternalViewer(IsDlgButtonChecked(hwndDlg, IDC_USE_INTERNAL_VIEWER) == BST_CHECKED);
@@ -394,7 +394,7 @@ BOOL bApplyChanges(HWND hwndDlg)
sItem.iItem = nCur;
sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
sItem.pszText = szTemp;
- sItem.cchTextMax = SIZEOF(szTemp);
+ sItem.cchTextMax = _countof(szTemp);
if (ListView_GetItem(hMapUser, &sItem))
{
@@ -469,7 +469,7 @@ void AutoFindeFileNames(HWND hwndDlg)
{
TCHAR szDefaultFile[500];
- GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szDefaultFile, SIZEOF(szDefaultFile));
+ GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szDefaultFile, _countof(szDefaultFile));
LVITEM sItem = { 0 };
@@ -483,7 +483,7 @@ void AutoFindeFileNames(HWND hwndDlg)
sItem.iItem = nCur;
sItem.iSubItem = 1;
sItem.pszText = szSearch;
- sItem.cchTextMax = SIZEOF(szSearch);
+ sItem.cchTextMax = _countof(szSearch);
if (!ListView_GetItem(hMapUser, &sItem))
{
@@ -502,7 +502,7 @@ void AutoFindeFileNames(HWND hwndDlg)
sItem.iItem = nSubCur;
sItem.iSubItem = 1;
sItem.pszText = szSubCur;
- sItem.cchTextMax = SIZEOF(szSubCur);
+ sItem.cchTextMax = _countof(szSubCur);
if (ListView_GetItem(hMapUser, &sItem))
{
size_t nLen = mir_tstrlen(szSubCur);
@@ -521,13 +521,13 @@ void AutoFindeFileNames(HWND hwndDlg)
{
tstring sFileName;
szSearch[0] = 0;
- ListView_GetItemText(hMapUser, nCur, 0, szSearch, SIZEOF(szSearch));
+ ListView_GetItemText(hMapUser, nCur, 0, szSearch, _countof(szSearch));
bool bPriHasFileName = szSearch[0] != 0;
if (bPriHasFileName)
sFileName = szSearch;
szSearch[0] = 0;
- ListView_GetItemText(hMapUser, nStortestIndex, 0, szSearch, SIZEOF(szSearch));
+ ListView_GetItemText(hMapUser, nStortestIndex, 0, szSearch, _countof(szSearch));
bool bSubHasFileName = szSearch[0] != 0;
if (bSubHasFileName)
sFileName = szSearch;
@@ -571,7 +571,7 @@ void AutoFindeFileNames(HWND hwndDlg)
void OpenHelp(HWND hwndDlg)
{
TCHAR szPath[MAX_PATH];
- if (GetModuleFileName(hInstance, szPath, SIZEOF(szPath)))
+ if (GetModuleFileName(hInstance, szPath, _countof(szPath)))
{
size_t nLen = mir_tstrlen(szPath);
if (nLen > 3)
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
DWORD dwUIN = db_get_dw(hContact, sTmpA.c_str(), "UIN", 0);
TCHAR szTmp[50];
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%d"), dwUIN);
+ mir_sntprintf(szTmp, _countof(szTmp), _T("%d"), dwUIN);
sItem.iSubItem = 3;
sItem.pszText = szTmp;
ListView_SetItem(hMapUser, &sItem);
@@ -892,13 +892,13 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
TCHAR szFile[260]; // buffer for file name
TCHAR buf[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, SIZEOF(szFile));
+ GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, _countof(szFile));
// Initialize OPENFILENAME
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
mir_sntprintf(buf, _T("%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c"), TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = buf;
ofn.nFilterIndex = 1;
@@ -1186,7 +1186,7 @@ BOOL bApplyChanges2(HWND hwndDlg)
sItem.iItem = nCur;
sItem.mask = LVIF_TEXT | LVIF_IMAGE;
sItem.pszText = &szTemp[12];
- sItem.cchTextMax = (SIZEOF(szTemp) - 15);
+ sItem.cchTextMax = (_countof(szTemp) - 15);
if (::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem))
{
if (sItem.iImage)
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index 023c90a90b..a50cb84626 100755
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -518,7 +518,7 @@ bool bWriteHexToFile(HANDLE hFile, void * pData, int nSize)
BYTE * p = (BYTE*)pData;
for (int n = 0; n < nSize; n++)
{
- mir_snprintf(cBuf, SIZEOF(cBuf), "%.2X ", p[n]);
+ mir_snprintf(cBuf, _countof(cBuf), "%.2X ", p[n]);
if (!bWriteToFile(hFile, cBuf, 3))
return false;
}
@@ -774,7 +774,7 @@ void ReplaceDefines(MCONTACT hContact, tstring & sTarget)
if (dwUIN)
{
TCHAR sTmp[20];
- mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%d"), dwUIN);
+ mir_sntprintf(sTmp, _countof(sTmp), _T("%d"), dwUIN);
sReplaceUin = sTmp;
}
else
@@ -871,11 +871,11 @@ void ReplaceTimeVariables(tstring &sRet)
GetLocalTime(&stTime);
TCHAR sTmp[20];
- mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%d"), stTime.wYear);
+ mir_sntprintf(sTmp, _countof(sTmp), _T("%d"), stTime.wYear);
ReplaceAll(sRet, _T("%year%"), sTmp);
- mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%.2d"), stTime.wMonth);
+ mir_sntprintf(sTmp, _countof(sTmp), _T("%.2d"), stTime.wMonth);
ReplaceAll(sRet, _T("%month%"), sTmp);
- mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%.2d"), stTime.wDay);
+ mir_sntprintf(sTmp, _countof(sTmp), _T("%.2d"), stTime.wDay);
ReplaceAll(sRet, _T("%day%"), sTmp);
}
}
@@ -941,7 +941,7 @@ void DisplayErrorDialog(const TCHAR *pszError, tstring& sFilePath, DBEVENTINFO *
ofn.lStructSize = sizeof(OPENFILENAME);
//ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFilter = TranslateT("All\0*.*\0Text\0*.TXT\0\0");
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
@@ -1132,7 +1132,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei)
nFirstColumnWidth,
dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str());
- TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], SIZEOF(szTemp) - nIndent - 2);
+ TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], _countof(szTemp) - nIndent - 2);
nIndent = (int)mir_tstrlen(szTemp);
szTemp[nIndent++] = ' ';
@@ -1460,7 +1460,7 @@ bool bWriteIndentedToFile(HANDLE hFile, int nIndent, const TCHAR *pszSrc, bool b
// then we will look for a ? and so on.
const TCHAR ac[] = { _T(' '), _T('?'), _T('-'), _T('.'), _T(',') };
- for (int y = 0; y < SIZEOF(ac); y++)
+ for (int y = 0; y < _countof(ac); y++)
{
for (int n = nLineLen; n > 0; n--)
{
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index 8f570a717b..7b286f837b 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -54,8 +54,8 @@ void DeInitProtocolData()
Protocol::Protocol(const char *aName, const TCHAR *descr)
{
- mir_strncpy(name, aName, SIZEOF(name));
- mir_tstrncpy(description, descr, SIZEOF(description));
+ mir_strncpy(name, aName, _countof(name));
+ mir_tstrncpy(description, descr, _countof(description));
data_changed = true;
@@ -129,14 +129,14 @@ int Protocol::GetStatus()
if (custom_status == 0) {
TCHAR *tmp = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
- lcopystr(status_name, tmp, SIZEOF(status_name));
+ lcopystr(status_name, tmp, _countof(status_name));
}
else {
TCHAR *p = (tszXStatusName[0] != 0) ? TranslateTS(tszXStatusName) : TranslateT("<no status name>");
if (tszXStatusMessage[0])
- mir_sntprintf(status_name, SIZEOF(status_name), _T("%s: %s"), p, tszXStatusMessage);
+ mir_sntprintf(status_name, _countof(status_name), _T("%s: %s"), p, tszXStatusMessage);
else
- lcopystr(status_name, p, SIZEOF(status_name));
+ lcopystr(status_name, p, _countof(status_name));
}
return status;
@@ -170,7 +170,7 @@ void Protocol::SetStatus(int aStatus)
pse[0]->status = aStatus;
pse[0]->szName = name;
- GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg));
+ GetStatusMsg(aStatus, status_msg, _countof(status_msg));
pse[0]->szMsg = status_msg;
CallService(MS_CS_SETSTATUSEX, (WPARAM)&pse, 0);
@@ -184,7 +184,7 @@ void Protocol::SetStatus(int aStatus)
if (CanSetStatusMsg(aStatus)) {
TCHAR status_msg[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
- GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg));
+ GetStatusMsg(aStatus, status_msg, _countof(status_msg));
SetStatusMsg(aStatus, status_msg);
}
}
@@ -226,7 +226,7 @@ void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size)
TCHAR* Protocol::GetStatusMsg()
{
- GetStatusMsg(status, status_message, SIZEOF(status_message));
+ GetStatusMsg(status, status_message, _countof(status_message));
return status_message;
}
@@ -309,11 +309,11 @@ TCHAR *Protocol::GetNick()
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) {
// CNF_DISPLAY always returns a string type
- lcopystr(nickname, ci.pszVal, SIZEOF(nickname));
+ lcopystr(nickname, ci.pszVal, _countof(nickname));
mir_free(ci.pszVal);
}
else
- lcopystr(nickname, _T(""), SIZEOF(nickname));
+ lcopystr(nickname, _T(""), _countof(nickname));
return nickname;
}
@@ -365,17 +365,17 @@ bool Protocol::ListeningToEnabled()
TCHAR *Protocol::GetListeningTo()
{
if (!CanGetListeningTo()) {
- lcopystr(listening_to, _T(""), SIZEOF(listening_to));
+ lcopystr(listening_to, _T(""), _countof(listening_to));
return listening_to;
}
DBVARIANT dbv = { 0 };
if (db_get_ts(NULL, name, "ListeningTo", &dbv)) {
- lcopystr(listening_to, _T(""), SIZEOF(listening_to));
+ lcopystr(listening_to, _T(""), _countof(listening_to));
return listening_to;
}
- lcopystr(listening_to, dbv.ptszVal, SIZEOF(listening_to));
+ lcopystr(listening_to, dbv.ptszVal, _countof(listening_to));
db_free(&dbv);
return listening_to;
}
@@ -485,7 +485,7 @@ void ProtocolArray::SetNicks(const TCHAR *nick)
if (nick == NULL || nick[0] == '\0')
return;
- mir_tstrncpy(default_nick, nick, SIZEOF(default_nick));
+ mir_tstrncpy(default_nick, nick, _countof(default_nick));
db_set_ts(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick);
@@ -522,7 +522,7 @@ void ProtocolArray::GetDefaultNick()
{
ptrT tszNick(db_get_tsa(0, MODULE_NAME, SETTING_DEFAULT_NICK));
if (tszNick)
- mir_tstrncpy(default_nick, tszNick, SIZEOF(default_nick));
+ mir_tstrncpy(default_nick, tszNick, _countof(default_nick));
else
default_nick[0] = '\0';
}
@@ -531,7 +531,7 @@ void ProtocolArray::GetDefaultAvatar()
{
ptrT tszFile(db_get_tsa(0, "ContactPhoto", "File"));
if (tszFile)
- mir_tstrncpy(default_avatar_file, tszFile, SIZEOF(default_avatar_file));
+ mir_tstrncpy(default_avatar_file, tszFile, _countof(default_avatar_file));
else
default_avatar_file[0] = '\0';
}
@@ -550,7 +550,7 @@ TCHAR *ProtocolArray::GetDefaultStatusMsg(int status)
TCHAR *tmp = (TCHAR *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)status, 0);
if (tmp != NULL) {
- mir_tstrncpy(default_status_message, tmp, SIZEOF(default_status_message));
+ mir_tstrncpy(default_status_message, tmp, _countof(default_status_message));
mir_free(tmp);
}
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 924a9fc2e2..83f26077c1 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -234,19 +234,19 @@ int CreateFrame()
memset(&font_id[i], 0, sizeof(font_id[i]));
font_id[i].cbSize = sizeof(FontIDT);
- mir_tstrncpy(font_id[i].group, LPGENT("My details"), SIZEOF(font_id[i].group));
- mir_tstrncpy(font_id[i].name, font_names[i], SIZEOF(font_id[i].name));
- mir_strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, SIZEOF(font_id[i].dbSettingsGroup));
- mir_tstrncpy(font_id[i].backgroundName, LPGENT("Background"), SIZEOF(font_id[i].backgroundName));
- mir_tstrncpy(font_id[i].backgroundGroup, LPGENT("My details"), SIZEOF(font_id[i].backgroundGroup));
+ mir_tstrncpy(font_id[i].group, LPGENT("My details"), _countof(font_id[i].group));
+ mir_tstrncpy(font_id[i].name, font_names[i], _countof(font_id[i].name));
+ mir_strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, _countof(font_id[i].dbSettingsGroup));
+ mir_tstrncpy(font_id[i].backgroundName, LPGENT("Background"), _countof(font_id[i].backgroundName));
+ mir_tstrncpy(font_id[i].backgroundGroup, LPGENT("My details"), _countof(font_id[i].backgroundGroup));
- mir_strncpy(font_id[i].prefix, font_settings[i], SIZEOF(font_id[i].prefix));
+ mir_strncpy(font_id[i].prefix, font_settings[i], _countof(font_id[i].prefix));
font_id[i].deffontsettings.colour = font_colors[i];
font_id[i].deffontsettings.size = -MulDiv(font_sizes[i], GetDeviceCaps(hdc, LOGPIXELSY), 72);
font_id[i].deffontsettings.style = font_styles[i];
font_id[i].deffontsettings.charset = DEFAULT_CHARSET;
- mir_tstrncpy(font_id[i].deffontsettings.szFace, _T("Tahoma"), SIZEOF(font_id[i].deffontsettings.szFace));
+ mir_tstrncpy(font_id[i].deffontsettings.szFace, _T("Tahoma"), _countof(font_id[i].deffontsettings.szFace));
font_id[i].order = i;
font_id[i].flags = FIDF_DEFAULTVALID;
FontRegisterT(&font_id[i]);
@@ -1475,7 +1475,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P
// Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable listening to for %s"), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Enable listening to for %s"), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1715,7 +1715,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
// Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my avatar for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my avatar for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1755,7 +1755,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
// Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my nickname for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1803,7 +1803,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my status message for %s..."), proto->description);
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
@@ -1822,7 +1822,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
}
// Add this to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."),
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my status message for %s..."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR));
MENUITEMINFO mii = { 0 };
@@ -1888,7 +1888,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TCHAR tmp[128];
MENUITEMINFO mii = { 0 };
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable listening to for %s"), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Enable listening to for %s"), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1904,7 +1904,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InsertMenuItem(submenu, 0, TRUE, &mii);
// Add this to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."),
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my status message for %s..."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR));
memset(&mii, 0, sizeof(mii));
@@ -1924,7 +1924,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my status message for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1942,7 +1942,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InsertMenuItem(submenu, 0, TRUE, &mii);
}
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my nickname for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1959,7 +1959,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
InsertMenuItem(submenu, 0, TRUE, &mii);
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my avatar for %s..."), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my avatar for %s..."), proto->description);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp
index 9b7d0742f0..a2a6d38cae 100644
--- a/plugins/MyDetails/src/mydetails.cpp
+++ b/plugins/MyDetails/src/mydetails.cpp
@@ -150,7 +150,7 @@ extern "C" __declspec(dllexport) int Load()
if (IcoLib_GetIcon("LISTENING_TO_ICON") == NULL)
Icon_Register(hInst, LPGEN("Contact list"), iconList, 1);
- Icon_Register(hInst, LPGEN("My details"), iconList + 1, SIZEOF(iconList) - 1);
+ Icon_Register(hInst, LPGEN("My details"), iconList + 1, _countof(iconList) - 1);
// Register services
CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname);
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp
index 139b3160b5..826454adc1 100644
--- a/plugins/MyDetails/src/options.cpp
+++ b/plugins/MyDetails/src/options.cpp
@@ -60,7 +60,7 @@ static OptPageControl pageControls[] = {
// Initializations needed by options
void LoadOptions()
{
- LoadOpts(pageControls, SIZEOF(pageControls), MODULE_NAME);
+ LoadOpts(pageControls, _countof(pageControls), MODULE_NAME);
// This is created here to assert that this key always exists
opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
@@ -72,7 +72,7 @@ void LoadOptions()
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BOOL ret = SaveOptsDlgProc(pageControls, SIZEOF(pageControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ BOOL ret = SaveOptsDlgProc(pageControls, _countof(pageControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
switch (msg) {
case WM_INITDIALOG:
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp
index 3c2e515bcc..bddb20c124 100644
--- a/plugins/MyDetails/src/services.cpp
+++ b/plugins/MyDetails/src/services.cpp
@@ -70,7 +70,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam
Protocol *proto = protocols->Get(proto_num);
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s"), proto->description);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT("Set my nickname for %s"), proto->description);
SetWindowText(hwndDlg, tmp);
@@ -93,7 +93,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam
case IDOK:
{
TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE];
- GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, _countof(tmp));
LONG_PTR proto_num = GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (proto_num == -1)
@@ -332,7 +332,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w
}
TCHAR title[256];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set my status message for %s"), proto->description);
+ mir_sntprintf(title, _countof(title), TranslateT("Set my status message for %s"), proto->description);
SetWindowText(hwndDlg, title);
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg());
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(NULL, data->status));
TCHAR title[256];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set my status message for %s"),
+ mir_sntprintf(title, _countof(title), TranslateT("Set my status message for %s"),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, data->status, GSMDF_TCHAR));
SetWindowText(hwndDlg, title);
@@ -360,7 +360,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w
case IDOK:
{
TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
- GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, _countof(tmp));
SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp
index 8f70efaf24..38d69042b3 100644
--- a/plugins/NewAwaySysMod/src/AwayOpt.cpp
+++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp
@@ -138,13 +138,13 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_MESSAGEDLG_MSGTITLE, EM_LIMITTEXT, TREEITEMTITLE_MAXLEN, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGEDLG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0);
// init image buttons
- for (int i = 0; i < SIZEOF(Dlg1Buttons); i++) {
+ for (int i = 0; i < _countof(Dlg1Buttons); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg1Buttons[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(Dlg1Buttons[i].Text), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
// now default status message buttons
- for (int i = 0; i < SIZEOF(Dlg1DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg1DefMsgDlgItems[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)pcli->pfnGetStatusModeDescription(Dlg1DefMsgDlgItems[i].Status, 0), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
@@ -162,10 +162,10 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < SIZEOF(Dlg1DefMsgDlgItems); i++)
+ for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++)
SendDlgItemMessage(hwndDlg, Dlg1DefMsgDlgItems[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg1DefMsgDlgItems[i].IconIndex]);
- for (int i = 0; i < SIZEOF(Dlg1Buttons); i++)
+ for (int i = 0; i < _countof(Dlg1Buttons); i++)
if (Dlg1Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Dlg1Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg1Buttons[i].IconIndex]);
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SetDlgItemText(hwndDlg, IDC_MESSAGEDLG_MSGDATA, TranslateT("You can put your frequently used and favorite messages in this category."));
}
}
- for (int i = 0; i < SIZEOF(Dlg1DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg1DefMsgDlgItems[i].DlgItem);
Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg1DefMsgDlgItems[i].Status) == pnm->ItemNew->ID);
}
@@ -227,7 +227,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP
_ASSERT(SelectedItem);
// SelectedItem contains the same info as one of ItemOld or ItemNew - so we'll just use SelectedItem and won't bother with identifying which of ItemOld or ItemNew is currently selected
if ((pnm->ItemOld && pnm->ItemOld->ID == SelectedItem->ID) || (pnm->ItemNew && pnm->ItemNew->ID == SelectedItem->ID)) {
- for (int i = 0; i < SIZEOF(Dlg1DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg1DefMsgDlgItems[i].DlgItem);
Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg1DefMsgDlgItems[i].Status) == SelectedItem->ID);
}
@@ -272,7 +272,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_MESSAGEDLG_DEF_INV:
case IDC_MESSAGEDLG_DEF_OTP:
case IDC_MESSAGEDLG_DEF_OTL:
- for (int i = 0; i < SIZEOF(Dlg1DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
if (LOWORD(wParam) == Dlg1DefMsgDlgItems[i].DlgItem) {
MsgTree->SetDefMsg(Dlg1DefMsgDlgItems[i].Status, MsgTree->GetSelection()->ID); // PSM_CHANGED is sent here through MTN_DEFMSGCHANGED, so we don't need to send it once more
break;
@@ -373,7 +373,7 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_WAITFORMSG_SPIN, UDM_SETRANGE32, -1, 9999);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_RECENTMSGSCOUNT_SPIN, UDM_SETRANGE32, 0, 99);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN, UDM_SETRANGE32, 30, 99999);
- for (int i = 0; i < SIZEOF(Dlg2StatusButtons); i++) {
+ for (int i = 0; i < _countof(Dlg2StatusButtons); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg2StatusButtons[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)pcli->pfnGetStatusModeDescription(Dlg2StatusButtons[i].Status, 0), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
@@ -386,7 +386,7 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < SIZEOF(Dlg2StatusButtons); i++)
+ for (int i = 0; i < _countof(Dlg2StatusButtons); i++)
SendDlgItemMessage(hwndDlg, Dlg2StatusButtons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg2StatusButtons[i].IconIndex]);
break;
@@ -523,10 +523,10 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
_T("Miranda"), AUTOREPLY_IDLE_MIRANDA
};
- for (int i = 0; i < SIZEOF(IdleComboValues); i++)
+ for (int i = 0; i < _countof(IdleComboValues); i++)
SendMessage(hCombo, CB_SETITEMDATA, SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(IdleComboValues[i].Text)), IdleComboValues[i].Meaning);
- for (int i = 0; i < SIZEOF(Dlg3StatusButtons); i++) {
+ for (int i = 0; i < _countof(Dlg3StatusButtons); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg3StatusButtons[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)pcli->pfnGetStatusModeDescription(Dlg3StatusButtons[i].Status, 0), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
@@ -557,7 +557,7 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.hwnd = hwndDlg;
- for (int i = 0; i < SIZEOF(Tooltips); i++) {
+ for (int i = 0; i < _countof(Tooltips); i++) {
ti.uId = (UINT)GetDlgItem(hwndDlg, Tooltips[i].DlgItemID);
ti.lpszText = TranslateTS(Tooltips[i].Text);
SendMessage(hWndTooltips, TTM_ADDTOOL, 0, (LPARAM)&ti);
@@ -573,7 +573,7 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < SIZEOF(Dlg3StatusButtons); i++)
+ for (int i = 0; i < _countof(Dlg3StatusButtons); i++)
SendDlgItemMessage(hwndDlg, Dlg3StatusButtons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg3StatusButtons[i].IconIndex]);
variables_skin_helpbutton(hwndDlg, IDC_REPLYDLG_VARS);
@@ -693,13 +693,13 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendDlgItemMessage(hwndDlg, IDC_MESSAGEDLG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0);
// init image buttons
- for (int i = 0; i < SIZEOF(Dlg4Buttons); i++) {
+ for (int i = 0; i < _countof(Dlg4Buttons); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg4Buttons[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(Dlg4Buttons[i].Text), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
// now default status message buttons
- for (int i = 0; i < SIZEOF(Dlg4DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg4DefMsgDlgItems); i++) {
HWND hButton = GetDlgItem(hwndDlg, Dlg4DefMsgDlgItems[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)pcli->pfnGetStatusModeDescription(Dlg4DefMsgDlgItems[i].Status, 0), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
@@ -717,10 +717,10 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < SIZEOF(Dlg4DefMsgDlgItems); i++)
+ for (int i = 0; i < _countof(Dlg4DefMsgDlgItems); i++)
SendDlgItemMessage(hwndDlg, Dlg4DefMsgDlgItems[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg4DefMsgDlgItems[i].IconIndex]);
- for (int i = 0; i < SIZEOF(Dlg4Buttons); i++)
+ for (int i = 0; i < _countof(Dlg4Buttons); i++)
if (Dlg4Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Dlg4Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg4Buttons[i].IconIndex]);
@@ -767,7 +767,7 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SetDlgItemText(hwndDlg, IDC_MESSAGEDLG_MSGDATA, TranslateT("You can put your frequently used and favorite messages in this category."));
}
}
- for (int i = 0; i < SIZEOF(Dlg4DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg4DefMsgDlgItems); i++) {
COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg4DefMsgDlgItems[i].DlgItem);
Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg4DefMsgDlgItems[i].Status) == pnm->ItemNew->ID);
}
@@ -781,7 +781,7 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
CBaseTreeItem* SelectedItem = MsgTree->GetSelection();
_ASSERT(SelectedItem);
if ((pnm->ItemOld && pnm->ItemOld->ID == SelectedItem->ID) || (pnm->ItemNew && pnm->ItemNew->ID == SelectedItem->ID)) { // SelectedItem contains the same info as one of ItemOld or ItemNew - so we'll just use SelectedItem and won't bother with identifying which of ItemOld or ItemNew is currently selected
- for (int i = 0; i < SIZEOF(Dlg4DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg4DefMsgDlgItems); i++) {
COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg4DefMsgDlgItems[i].DlgItem);
Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg4DefMsgDlgItems[i].Status) == SelectedItem->ID);
}
@@ -826,7 +826,7 @@ INT_PTR CALLBACK MessagesModernOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case IDC_MESSAGEDLG_DEF_INV:
case IDC_MESSAGEDLG_DEF_OTP:
case IDC_MESSAGEDLG_DEF_OTL:
- for (int i = 0; i < SIZEOF(Dlg4DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(Dlg4DefMsgDlgItems); i++) {
if (LOWORD(wParam) == Dlg4DefMsgDlgItems[i].DlgItem) {
// PSM_CHANGED is sent here through MTN_DEFMSGCHANGED, so we don't need to send it once more
MsgTree->SetDefMsg(Dlg4DefMsgDlgItems[i].Status, MsgTree->GetSelection()->ID);
@@ -952,7 +952,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
if (hChildItem)
SetListGroupIcons(hwndList, hChildItem, hItem);
- for (int i = 0; i < SIZEOF(Icons); i++) {
+ for (int i = 0; i < _countof(Icons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
if (Icons[i] == 0xFF)
Icons[i] = Icon;
@@ -963,7 +963,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
}
hItem = (FirstItemType == CLCIT_CONTACT) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (int i = 0; i < SIZEOF(Icons); i++) {
+ for (int i = 0; i < _countof(Icons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
if (Icons[i] == 0xFF)
Icons[i] = Icon;
@@ -974,7 +974,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
}
// set icons
- for (int i = 0; i < SIZEOF(Icons); i++)
+ for (int i = 0; i < _countof(Icons); i++)
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, Icons[i]));
}
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp
index 90976f1d3c..769ec125ae 100644
--- a/plugins/NewAwaySysMod/src/AwaySys.cpp
+++ b/plugins/NewAwaySysMod/src/AwaySys.cpp
@@ -231,7 +231,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam)
}
int i;
- for (i = SIZEOF(StatusModeList) - 1; i >= 0; i--)
+ for (i = _countof(StatusModeList) - 1; i >= 0; i--)
if (wParam == StatusModeList[i].Status)
break;
if (i < 0)
@@ -300,20 +300,20 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM)
TCHAR szSetStr[256], szReadStr[256];
if (szProto) {
int i;
- for (i = SIZEOF(StatusModeList) - 1; i >= 0; i--)
+ for (i = _countof(StatusModeList) - 1; i >= 0; i--)
if (iMode == StatusModeList[i].Status)
break;
// the protocol supports status message sending for current status, or autoreplying
if ((Flag1 & PF1_MODEMSGSEND && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iMode)) || ((Flag1 & PF1_IM) == PF1_IM && (i < 0 || !g_AutoreplyOptPage.GetDBValueCopy(StatusModeList[i].DisableReplyCtlID)))) {
- mir_sntprintf(szSetStr, SIZEOF(szSetStr), TranslateT("Set %s message for the contact"), pcli->pfnGetStatusModeDescription(iMode, 0), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(szSetStr, _countof(szSetStr), TranslateT("Set %s message for the contact"), pcli->pfnGetStatusModeDescription(iMode, 0), pcli->pfnGetContactDisplayName(hContact, 0));
miSetMsg.ptszName = szSetStr;
miSetMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME;
}
// the protocol supports status message reading for contact's status
if (Flag1 & PF1_MODEMSGRECV && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iContactMode)) {
- mir_sntprintf(szReadStr, SIZEOF(szReadStr), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iContactMode, 0));
+ mir_sntprintf(szReadStr, _countof(szReadStr), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iContactMode, 0));
miReadMsg.ptszName = szReadStr;
miReadMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME | CMIM_ICON;
miReadMsg.hIcon = Skin_LoadProtoIcon(szProto, iContactMode);
@@ -692,7 +692,7 @@ int MirandaLoaded(WPARAM, LPARAM)
tr.szService = MS_AWAYSYS_VARIABLESHANDLER;
tr.szCleanupService = MS_AWAYSYS_FREEVARMEM;
tr.memType = TR_MEM_OWNER;
- for (int i = 0; i < SIZEOF(Variables); i++) {
+ for (int i = 0; i < _countof(Variables); i++) {
tr.flags = Variables[i].Flags | TRF_CALLSVC | TRF_TCHAR;
tr.tszTokenString = Variables[i].Name;
tr.szHelpText = Variables[i].Descr;
@@ -713,7 +713,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
- Icon_Register(g_hInstance, MOD_NAME, iconList, SIZEOF(iconList), "nas");
+ Icon_Register(g_hInstance, MOD_NAME, iconList, _countof(iconList), "nas");
InitCommonControls();
InitOptions(); // must be called before we hook CallService
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp
index 827bd0be7c..6790efa6b2 100644
--- a/plugins/NewAwaySysMod/src/Client.cpp
+++ b/plugins/NewAwaySysMod/src/Client.cpp
@@ -123,7 +123,7 @@ void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg)
ID_STATUS_IDLE, "Idl"
};
- for (int i = 0; i < SIZEOF(StatusSettings); i++) {
+ for (int i = 0; i < _countof(StatusSettings); i++) {
if (iMode == StatusSettings[i].Status) {
db_set_ts(NULL, "SRAway", CString(StatusSettings[i].Setting) + "Msg", CurMsg);
db_set_ts(NULL, "SRAway", CString(StatusSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
diff --git a/plugins/NewAwaySysMod/src/Common.h b/plugins/NewAwaySysMod/src/Common.h
index 36b036c619..cc744ea932 100644
--- a/plugins/NewAwaySysMod/src/Common.h
+++ b/plugins/NewAwaySysMod/src/Common.h
@@ -153,8 +153,8 @@
#define DB_SETTINGSVER "SettingsVer"
-#ifndef SIZEOF
-#define SIZEOF(s) (sizeof(s) / sizeof(*s))
+#ifndef _countof
+#define _countof(s) (sizeof(s) / sizeof(*s))
#endif
#define UM_ICONSCHANGED (WM_USER + 121)
@@ -322,7 +322,7 @@ static __inline int LogMessage(const char *Format, ...)
char szText[8096];
mir_strcpy(szText, LOG_PREFIX);
va_start(va, Format);
- mir_vsnprintf(szText + (SIZEOF(LOG_PREFIX) - 1), sizeof(szText) - (SIZEOF(LOG_PREFIX) - 1), Format, va);
+ mir_vsnprintf(szText + (_countof(LOG_PREFIX) - 1), sizeof(szText) - (_countof(LOG_PREFIX) - 1), Format, va);
va_end(va);
return CallService(MS_NETLIB_LOG, NULL, (LPARAM)szText);
}
diff --git a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp
index 1cc6c21e01..7c66b0eff1 100644
--- a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp
+++ b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp
@@ -44,8 +44,8 @@
#define CGSM_ISCHECKED 3 // mask for BM_GETCHECK
#define CGSM_GETSTATE 7 // mask to get only valid values for BM_GETSTATE
-#ifndef SIZEOF
-#define SIZEOF(s) (sizeof(s) / sizeof(*s))
+#ifndef _countof
+#define _countof(s) (sizeof(s) / sizeof(*s))
#endif
class CCheckboxData
@@ -266,7 +266,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l
{ 0, 0, DFCS_PUSHED, DFCS_INACTIVE,
DFCS_CHECKED, DFCS_CHECKED, DFCS_CHECKED | DFCS_PUSHED, DFCS_CHECKED | DFCS_INACTIVE,
DFCS_BUTTON3STATE | DFCS_CHECKED, DFCS_BUTTON3STATE | DFCS_CHECKED, DFCS_BUTTON3STATE | DFCS_INACTIVE | DFCS_CHECKED | DFCS_PUSHED, DFCS_BUTTON3STATE | DFCS_INACTIVE | DFCS_CHECKED | DFCS_PUSHED };
- _ASSERT(StateID >= 1 && StateID <= SIZEOF(dfcStates));
+ _ASSERT(StateID >= 1 && StateID <= _countof(dfcStates));
DrawFrameControl(hdcMem, &rc, DFC_BUTTON, dfcStates[StateID - 1]);
}
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
index 20411a6b86..7290ada575 100644
--- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
+++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
@@ -175,7 +175,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
unsigned int iMode = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int i;
- for (i = SIZEOF(StatusModeList) - 1; i >= 0; i--)
+ for (i = _countof(StatusModeList) - 1; i >= 0; i--)
if (iMode == StatusModeList[i].Status)
break;
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp
index 921c52d620..4eb3f9ba12 100644
--- a/plugins/NewAwaySysMod/src/MsgTree.cpp
+++ b/plugins/NewAwaySysMod/src/MsgTree.cpp
@@ -174,7 +174,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L
TreeView_GetItemRect(lpNMCD->nmcd.hdr.hwndFrom, (HTREEITEM)lpNMCD->nmcd.dwItemSpec, &rc, true);
int iSize = GetSystemMetrics(SM_CXSMICON);
int x = rc.left - iSize - 5;
- for (int i = 0; i < SIZEOF(SettingsList); i++) {
+ for (int i = 0; i < _countof(SettingsList); i++) {
if (lpNMCD->nmcd.lItemlParam == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(NULL, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
x -= iSize + 1;
@@ -391,13 +391,13 @@ static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam,
mii.fMask = MIIM_BITMAP | MIIM_DATA | MIIM_STATE | MIIM_CHECKMARKS;
mii.hbmpItem = HBMMENU_CALLBACK;
int i;
- for (i = 0; i < SIZEOF(MenuItems); i++) { // set icons
+ for (i = 0; i < _countof(MenuItems); i++) { // set icons
mii.dwItemData = MenuItems[i].IconID;
SetMenuItemInfo(hPopupMenu, MenuItems[i].ItemID, false, &mii);
}
mii.fMask = MIIM_STATE;
mii.fState = MFS_CHECKED;
- for (i = 0; i < SIZEOF(SettingsList); i++) // set checkmarks
+ for (i = 0; i < _countof(SettingsList); i++) // set checkmarks
if (TreeCtrl->Value[Order].ID == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
SetMenuItemInfo(hPopupMenu, SettingsList[i].MenuItemID, false, &mii);
@@ -424,7 +424,7 @@ static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam,
case IDR_MSGTREEMENU_DEF_INV:
case IDR_MSGTREEMENU_DEF_OTP:
case IDR_MSGTREEMENU_DEF_OTL:
- for (int i = 0; i < SIZEOF(SettingsList); i++) {
+ for (int i = 0; i < _countof(SettingsList); i++) {
if (SettingsList[i].MenuItemID == MenuResult) {
dat->SetDefMsg(SettingsList[i].Status, tvi.lParam);
break;
@@ -513,7 +513,7 @@ bool CMsgTree::SetSelection(int ID, int Flags) // set ID = -1 to unselect; retur
int CMsgTree::GetDefMsg(int iMode)
{
- for (int i = 0; i < SIZEOF(SettingsList); i++)
+ for (int i = 0; i < _countof(SettingsList); i++)
if (SettingsList[i].Status == iMode)
return MsgTreePage.GetValue(SettingsList[i].DBSetting);
@@ -522,7 +522,7 @@ int CMsgTree::GetDefMsg(int iMode)
void CMsgTree::SetDefMsg(int iMode, int ID)
{
- for (int i = 0; i < SIZEOF(SettingsList); i++) {
+ for (int i = 0; i < _countof(SettingsList); i++) {
if (SettingsList[i].Status == iMode) {
if (MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
RECT rc;
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp
index 6ef034d2f9..6527a0731b 100644
--- a/plugins/NewAwaySysMod/src/Notification.cpp
+++ b/plugins/NewAwaySysMod/src/Notification.cpp
@@ -69,7 +69,7 @@ void ShowLog(TCString &LogFilePath)
int Result = (int)ShellExecute(NULL, _T("open"), LogFilePath, NULL, NULL, SW_SHOW);
if (Result <= 32) {
TCHAR szError[64];
- mir_sntprintf(szError, SIZEOF(szError), TranslateT("Error #%d"), Result);
+ mir_sntprintf(szError, _countof(szError), TranslateT("Error #%d"), Result);
ShowMsg(szError, TranslateT("Can't open log file ") + LogFilePath, true);
}
}
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp
index 1c3dfe98a0..5610280b56 100644
--- a/plugins/NewAwaySysMod/src/Options.cpp
+++ b/plugins/NewAwaySysMod/src/Options.cpp
@@ -263,7 +263,7 @@ typedef struct
int TreeReadEnum(const char *szSetting, LPARAM lParam)
{
sTreeReadEnumData *TreeReadEnumData = (sTreeReadEnumData*)lParam;
- int Len = TreeReadEnumData->TreeCtrl->sDBSetting.GetLen() + SIZEOF(TREEITEM_DBSTR_TITLE) - 1;
+ int Len = TreeReadEnumData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
if (!strncmp(szSetting, TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
short ParentID = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, *TreeReadEnumData->sModule,
@@ -648,7 +648,7 @@ typedef struct
int ListReadEnum(const char *szSetting, LPARAM lParam)
{
sListReadEnumData *ListReadEnumData = (sListReadEnumData*)lParam;
- int Len = ListReadEnumData->sDBSettingPrefix->GetLen() + ListReadEnumData->ListCtrl->sDBSetting.GetLen() + SIZEOF(LISTITEM_DBSTR_TEXT) - 1;
+ int Len = ListReadEnumData->sDBSettingPrefix->GetLen() + ListReadEnumData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
if (!strncmp(szSetting, *ListReadEnumData->sDBSettingPrefix + ListReadEnumData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
ListReadEnumData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, *ListReadEnumData->sModule, *ListReadEnumData->sDBSettingPrefix + szSetting, _T(""));
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp
index 74b21baf71..baac915742 100644
--- a/plugins/NewAwaySysMod/src/Properties.cpp
+++ b/plugins/NewAwaySysMod/src/Properties.cpp
@@ -314,7 +314,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder)
IDS_MESSAGEDLG_DEF_OTL, ID_STATUS_OUTTOLUNCH
};
- for (int i = 0; i < SIZEOF(DefMsgDlgItems); i++) {
+ for (int i = 0; i < _countof(DefMsgDlgItems); i++) {
if (DefMsgDlgItems[i].Status == Status) {
DefMsgID = MsgTreeData.GetDBValue(DefMsgDlgItems[i].DBSetting);
break;
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h
index c0dbd1dab7..50c3ee4762 100644
--- a/plugins/NewAwaySysMod/src/Properties.h
+++ b/plugins/NewAwaySysMod/src/Properties.h
@@ -123,7 +123,7 @@ public:
int cxIcon = GetSystemMetrics(SM_CXSMICON);
int cyIcon = GetSystemMetrics(SM_CYSMICON);
int i;
- for (i = 0; i < SIZEOF(Icons); i++) {
+ for (i = 0; i < _countof(Icons); i++) {
if (IconList.GetSize() > i && IconList[i])
DestroyIcon(IconList[i]);
@@ -317,7 +317,7 @@ public:
CString ProtoStatusToDBSetting(const char *Prefix, int MoreOpt_PerStatusID = 0)
{
if (!MoreOpt_PerStatusID || g_MoreOptPage.GetDBValueCopy(MoreOpt_PerStatusID)) {
- for (int i = 0; i < SIZEOF(StatusSettings); i++)
+ for (int i = 0; i < _countof(StatusSettings); i++)
if (Status == StatusSettings[i].Status)
return szProto ? (CString(Prefix) + "_" + szProto + "_" + StatusSettings[i].Setting) : (CString(Prefix) + StatusSettings[i].Setting);
}
@@ -381,7 +381,7 @@ public:
__inline CString StatusToDBSetting(int Status, const char *Prefix, int MoreOpt_PerStatusID = 0)
{
if (!MoreOpt_PerStatusID || g_MoreOptPage.GetDBValueCopy(MoreOpt_PerStatusID))
- for (int i = 0; i < SIZEOF(StatusSettings); i++)
+ for (int i = 0; i < _countof(StatusSettings); i++)
if (Status == StatusSettings[i].Status)
return CString(Prefix) + StatusSettings[i].Setting;
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
index f1018316b8..2988164015 100644
--- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
@@ -69,11 +69,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
TCHAR *contactName = pcli->pfnGetContactDisplayName(awayData->hContact, 0);
char *szProto = GetContactProto(awayData->hContact);
TCHAR *status = pcli->pfnGetStatusModeDescription(db_get_w(awayData->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- GetWindowText(hwndDlg, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, status, contactName);
+ GetWindowText(hwndDlg, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, status, contactName);
SetWindowText(hwndDlg, str);
- GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, status);
+ GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, status);
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, str);
}
return true;
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
index a485cd6097..d91cae662f 100644
--- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
@@ -434,7 +434,7 @@ void UpdateCheckboxesState(CCList *CList)
HICON g_LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", "", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", "", name);
return IcoLib_GetIcon(szSettingName, big);
}
@@ -601,7 +601,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
// init image buttons
- for (int i = 0; i < SIZEOF(Buttons); i++) {
+ for (int i = 0; i < _countof(Buttons); i++) {
HWND hButton = GetDlgItem(hwndDlg, Buttons[i].DlgItem);
SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(Buttons[i].Text), BATF_TCHAR);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
@@ -612,7 +612,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandleA("mir_app.dll"), NULL);
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
- for (int i = 0; i < SIZEOF(Tooltips); i++) {
+ for (int i = 0; i < _countof(Tooltips); i++) {
ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, Tooltips[i].DlgItemID);
ti.lpszText = TranslateTS(Tooltips[i].Text);
SendMessage(hWndTooltips, TTM_ADDTOOL, 0, (LPARAM)&ti);
@@ -849,7 +849,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
return true;
}
TCHAR BtnTitle[64];
- mir_sntprintf(BtnTitle, SIZEOF(BtnTitle), TranslateT("Closing in %d"), Countdown);
+ mir_sntprintf(BtnTitle, _countof(BtnTitle), TranslateT("Closing in %d"), Countdown);
SetDlgItemText(hwndDlg, IDC_OK, BtnTitle);
Countdown--;
}
@@ -1013,7 +1013,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
break;
case UM_ICONSCHANGED:
- for (int i = 0; i < SIZEOF(Buttons); i++)
+ for (int i = 0; i < _countof(Buttons); i++)
if (Buttons[i].IconIndex != ILI_NOICON)
SendDlgItemMessage(hwndDlg, Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Buttons[i].IconIndex]);
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp
index e7c6d1ffee..487aa7d1fc 100644
--- a/plugins/NewEventNotify/src/popup.cpp
+++ b/plugins/NewEventNotify/src/popup.cpp
@@ -231,7 +231,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
if (pcBlob >= pcEnd)
break;
}
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Received %d contacts."), nContacts);
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("Received %d contacts."), nContacts);
comment1 = mir_tstrdup(szBuf);
}
commentFix = POPUP_COMMENT_CONTACTS;
@@ -254,7 +254,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
char *pszEmail = pszLast + mir_strlen(pszLast) + 1;
- mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob));
+ mir_snprintf(szUin, _countof(szUin), "%d", *((DWORD*)dbei->pBlob));
if (mir_strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
szNick = mir_utf8decodeT(pszNick);
@@ -290,7 +290,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
char *pszEmail = pszLast + mir_strlen(pszLast) + 1;
- mir_snprintf(szUin, SIZEOF(szUin), "%d", *((DWORD*)dbei->pBlob));
+ mir_snprintf(szUin, _countof(szUin), "%d", *((DWORD*)dbei->pBlob));
if (mir_strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
szNick = mir_utf8decodeT(pszNick);
@@ -540,12 +540,12 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent)
TCHAR lpzText[MAX_SECONDLINE*2] = _T("\0\0");
if (pdata->pluginOptions->bShowHeaders)
- mir_sntprintf(lpzText, SIZEOF(lpzText), TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
+ mir_sntprintf(lpzText, _countof(lpzText), TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
int doReverse = pdata->pluginOptions->bShowON;
if ((pdata->firstShowEventData != pdata->firstEventData && doReverse) || (pdata->firstShowEventData != pdata->lastEventData && !doReverse))
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s...\n"), lpzText);
+ mir_sntprintf(lpzText, _countof(lpzText), _T("%s...\n"), lpzText);
//take the active event as starting one
EVENT_DATA_EX *eventData = pdata->firstShowEventData;
@@ -573,17 +573,17 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent)
TCHAR timestamp[MAX_DATASIZE];
TCHAR formatTime[MAX_DATASIZE];
if (pdata->pluginOptions->bShowDate)
- _tcsncpy(formatTime, _T("%Y.%m.%d"), SIZEOF(formatTime));
+ _tcsncpy(formatTime, _T("%Y.%m.%d"), _countof(formatTime));
else if (pdata->pluginOptions->bShowTime)
- mir_tstrncat(formatTime, _T(" %H:%M"), SIZEOF(formatTime) - mir_tstrlen(formatTime));
+ mir_tstrncat(formatTime, _T(" %H:%M"), _countof(formatTime) - mir_tstrlen(formatTime));
time_t localTime = dbe.timestamp;
- _tcsftime(timestamp, SIZEOF(timestamp), formatTime, localtime(&localTime));
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s[b][i]%s[/i][/b]\n"), lpzText, timestamp);
+ _tcsftime(timestamp, _countof(timestamp), formatTime, localtime(&localTime));
+ mir_sntprintf(lpzText, _countof(lpzText), _T("%s[b][i]%s[/i][/b]\n"), lpzText, timestamp);
}
// prepare event preview
TCHAR* szEventPreview = GetEventPreview(&dbe);
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s%s"), lpzText, szEventPreview);
+ mir_sntprintf(lpzText, _countof(lpzText), _T("%s%s"), lpzText, szEventPreview);
mir_free(szEventPreview);
if (dbe.pBlob)
@@ -595,11 +595,11 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent)
else if ((iEvent >= pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg) || !eventData->prev)
break;
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s\n"), lpzText);
+ mir_sntprintf(lpzText, _countof(lpzText), _T("%s\n"), lpzText);
}
if ((doReverse && eventData->next) || (!doReverse && eventData->prev))
- mir_sntprintf(lpzText, SIZEOF(lpzText), _T("%s\n..."), lpzText);
+ mir_sntprintf(lpzText, _countof(lpzText), _T("%s\n..."), lpzText);
PUChangeTextT(pdata->hWnd, lpzText);
return 0;
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp
index af4783d659..0a541b7662 100644
--- a/plugins/NewXstatusNotify/src/indsnd.cpp
+++ b/plugins/NewXstatusNotify/src/indsnd.cpp
@@ -32,7 +32,7 @@ void PreviewSound(HWND hList)
int hlpStatus = lvi.lParam;
- ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff));
if (!mir_tstrcmp(buff, TranslateT(DEFAULT_SOUND))) {
if (hlpStatus < ID_STATUS_MIN)
SkinPlaySound(StatusListEx[hlpStatus].lpzSkinSoundName);
@@ -72,9 +72,9 @@ TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff, size_t bufflen)
ofn.hInstance = hInst;
TCHAR filter[MAX_PATH];
if (GetModuleHandle(_T("bass_interface.dll")))
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*.*)%c*%c"), TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*.*)%c*%c"), TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
else
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.wav)%c*.wav%c%s (*.*)%c*%c"), TranslateT("Wave files"), 0, 0, TranslateT("All files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.wav)%c*.wav%c%s (*.*)%c*%c"), TranslateT("Wave files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lpstrFilter = filter;
ofn.lpstrFile = buff;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
@@ -171,11 +171,11 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) {
- _tcsncpy(buff, dbv.ptszVal, SIZEOF(buff)-1);
+ _tcsncpy(buff, dbv.ptszVal, _countof(buff)-1);
db_free(&dbv);
}
else
- _tcsncpy(buff, TranslateT(DEFAULT_SOUND), SIZEOF(buff)-1);
+ _tcsncpy(buff, TranslateT(DEFAULT_SOUND), _countof(buff)-1);
ListView_SetItemText(hList, lvi.iItem, 1, buff);
}
@@ -237,7 +237,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
//Cycle through the list reading the text associated to each status.
for (lvi.iItem = ListView_GetItemCount(hList) - 1; lvi.iItem >= 0; lvi.iItem--) {
ListView_GetItem(hList, &lvi);
- ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff));
if (!mir_tstrcmp(buff, TranslateT(DEFAULT_SOUND))) {
if (lvi.lParam < ID_STATUS_MIN)
@@ -349,7 +349,7 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g
if (hChildItem)
SetGroupsIcons(hwndList, hChildItem, hItem, childCount);
- for (int i = 0; i < SIZEOF(iconOn); i++) {
+ for (int i = 0; i < _countof(iconOn); i++) {
if (iconOn[i] && GetExtraImage(hwndList, hItem, i) == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
}
@@ -364,7 +364,7 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (int i = 0; i < SIZEOF(iconOn); i++) {
+ for (int i = 0; i < _countof(iconOn); i++) {
int image = GetExtraImage(hwndList, hItem, i);
if (iconOn[i] && image == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
@@ -377,7 +377,7 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g
}
//set icons
- for (int i = 0; i < SIZEOF(iconOn); i++) {
+ for (int i = 0; i < _countof(iconOn); i++) {
SetExtraImage(hwndList, hParentItem, i, childCount[i] ? (iconOn[i] ? i : EXTRA_IMAGE_DOT) : EMPTY_EXTRA_ICON);
if (groupChildCount)
groupChildCount[i] += childCount[i];
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index d8de67a965..69b6dc751e 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -88,7 +88,7 @@ BYTE GetGender(MCONTACT hContact)
HANDLE GetIconHandle(char *szIcon)
{
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, szIcon);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, szIcon);
return IcoLib_GetIconHandle(szSettingName);
}
@@ -328,7 +328,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name)
DBVARIANT dbv;
TCHAR stzSoundFile[MAX_PATH] = { 0 };
if (!db_get_ts(hContact, MODULE, name, &dbv)) {
- _tcsncpy(stzSoundFile, dbv.ptszVal, SIZEOF(stzSoundFile)-1);
+ _tcsncpy(stzSoundFile, dbv.ptszVal, _countof(stzSoundFile)-1);
db_free(&dbv);
}
@@ -416,8 +416,8 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
// check if that proto from which we received statuschange notification, isn't in autodisable list
if (opt.AutoDisable) {
char statusIDs[12], statusIDp[12];
- mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
- mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
+ mir_snprintf(statusIDs, _countof(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, _countof(statusIDp), "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
}
@@ -443,7 +443,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
if (opt.BlinkIcon && !opt.TempDisabled) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, newStatus) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now %s"), pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText);
+ mir_sntprintf(str, _countof(str), TranslateT("%s is now %s"), pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText);
BlinkIcon(hContact, hIcon, str);
}
@@ -457,9 +457,9 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus)
if (opt.LogToFile) {
TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, SIZEOF(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
- mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, _countof(stzDate));
+ mir_sntprintf(stzText, _countof(stzText), TranslateT("%s, %s. %s changed status to %s (was %s)\r\n"),
stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText,
StatusList[Index(oldStatus)].lpzStandardText);
LogToFile(stzText);
@@ -553,7 +553,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
}
else if (strstr(cws->szSetting, "text")) {
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%s", szSetting, "Msg");
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%s", szSetting, "Msg");
smi.compare = CompareStatusMsg(&smi, cws, dbSetting);
if (smi.compare == COMPARE_SAME) {
replaceStrT(smi.newstatusmsg, 0);
@@ -651,11 +651,11 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
goto skip_notify;
char dbSetting[64];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", szProto);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", szProto);
// this proto is not set for status message notifications
if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
goto skip_notify;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d", IDC_CHK_STATUS_MESSAGE);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%d", IDC_CHK_STATUS_MESSAGE);
// status message change notifications are disabled
if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
goto skip_notify;
@@ -666,8 +666,8 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
// check if our status isn't on autodisable list
if (opt.AutoDisable) {
char statusIDs[12], statusIDp[12];
- mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
- mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
+ mir_snprintf(statusIDs, _countof(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, _countof(statusIDp), "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
}
@@ -695,7 +695,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
TCHAR *str;
if (smi.compare == COMPARE_DEL) {
char protoname[MAX_PATH];
- mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgRemoved", szProto);
+ mir_snprintf(protoname, _countof(protoname), "%s_TPopupSMsgRemoved", szProto);
DBVARIANT dbVar = { 0 };
if (db_get_ts(NULL, MODULE, protoname, &dbVar)) {
str = GetStr(&smi, DEFAULT_POPUP_SMSGREMOVED);
@@ -707,7 +707,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
}
else {
char protoname[MAX_PATH];
- mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgChanged", szProto);
+ mir_snprintf(protoname, _countof(protoname), "%s_TPopupSMsgChanged", szProto);
DBVARIANT dbVar = { 0 };
if (db_get_ts(NULL, MODULE, protoname, &dbVar)) {
str = GetStr(&smi, DEFAULT_POPUP_SMSGCHANGED);
@@ -733,7 +733,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled) {
HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE);
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s changed status message to %s"), pcli->pfnGetContactDisplayName(hContact, 0), smi.newstatusmsg);
+ mir_sntprintf(str, _countof(str), TranslateT("%s changed status message to %s"), pcli->pfnGetContactDisplayName(hContact, 0), smi.newstatusmsg);
BlinkIcon(hContact, hIcon, str);
}
@@ -751,8 +751,8 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
if (opt.SMsgLogToFile && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1)) {
TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, SIZEOF(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, _countof(stzDate));
TCHAR *str;
if (smi.compare == COMPARE_DEL)
@@ -760,7 +760,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
else
str = GetStr(&smi, templates.LogSMsgChanged);
- mir_sntprintf(stzText, SIZEOF(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), str);
+ mir_sntprintf(stzText, _countof(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime, pcli->pfnGetContactDisplayName(hContact, 0), str);
LogToFile(stzText);
mir_free(str);
@@ -1098,7 +1098,7 @@ static IconItem iconList[] =
void InitIcolib()
{
- Icon_Register(hInst, LPGEN("New Status Notify"), iconList, SIZEOF(iconList), MODULE);
+ Icon_Register(hInst, LPGEN("New Status Notify"), iconList, _countof(iconList), MODULE);
}
void InitSound()
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp
index 2fc03679d2..f1a078ec3d 100644
--- a/plugins/NewXstatusNotify/src/options.cpp
+++ b/plugins/NewXstatusNotify/src/options.cpp
@@ -31,20 +31,20 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
void LoadTemplates()
{
- DBGetStringDefault(0, MODULE, "TPopupXChanged", templates.PopupXstatusChanged, SIZEOF(templates.PopupXstatusChanged), DEFAULT_POPUP_CHANGED);
- DBGetStringDefault(0, MODULE, "TPopupXRemoved", templates.PopupXstatusRemoved, SIZEOF(templates.PopupXstatusRemoved), DEFAULT_POPUP_REMOVED);
- DBGetStringDefault(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged, SIZEOF(templates.PopupXMsgChanged), DEFAULT_POPUP_MSGCHANGED);
- DBGetStringDefault(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved, SIZEOF(templates.PopupXMsgRemoved), DEFAULT_POPUP_MSGREMOVED);
+ DBGetStringDefault(0, MODULE, "TPopupXChanged", templates.PopupXstatusChanged, _countof(templates.PopupXstatusChanged), DEFAULT_POPUP_CHANGED);
+ DBGetStringDefault(0, MODULE, "TPopupXRemoved", templates.PopupXstatusRemoved, _countof(templates.PopupXstatusRemoved), DEFAULT_POPUP_REMOVED);
+ DBGetStringDefault(0, MODULE, "TPopupXMsgChanged", templates.PopupXMsgChanged, _countof(templates.PopupXMsgChanged), DEFAULT_POPUP_MSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TPopupXMsgRemoved", templates.PopupXMsgRemoved, _countof(templates.PopupXMsgRemoved), DEFAULT_POPUP_MSGREMOVED);
- DBGetStringDefault(0, MODULE, "TLogXChanged", templates.LogXstatusChanged, SIZEOF(templates.LogXstatusChanged), DEFAULT_LOG_CHANGED);
- DBGetStringDefault(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved, SIZEOF(templates.LogXstatusRemoved), DEFAULT_LOG_REMOVED);
- DBGetStringDefault(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged, SIZEOF(templates.LogXMsgChanged), DEFAULT_LOG_MSGCHANGED);
- DBGetStringDefault(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved, SIZEOF(templates.LogXMsgRemoved), DEFAULT_LOG_MSGREMOVED);
- DBGetStringDefault(0, MODULE, "TLogXOpening", templates.LogXstatusOpening, SIZEOF(templates.LogXstatusOpening), DEFAULT_LOG_OPENING);
+ DBGetStringDefault(0, MODULE, "TLogXChanged", templates.LogXstatusChanged, _countof(templates.LogXstatusChanged), DEFAULT_LOG_CHANGED);
+ DBGetStringDefault(0, MODULE, "TLogXRemoved", templates.LogXstatusRemoved, _countof(templates.LogXstatusRemoved), DEFAULT_LOG_REMOVED);
+ DBGetStringDefault(0, MODULE, "TLogXMsgChanged", templates.LogXMsgChanged, _countof(templates.LogXMsgChanged), DEFAULT_LOG_MSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TLogXMsgRemoved", templates.LogXMsgRemoved, _countof(templates.LogXMsgRemoved), DEFAULT_LOG_MSGREMOVED);
+ DBGetStringDefault(0, MODULE, "TLogXOpening", templates.LogXstatusOpening, _countof(templates.LogXstatusOpening), DEFAULT_LOG_OPENING);
- DBGetStringDefault(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged, SIZEOF(templates.LogSMsgChanged), DEFAULT_LOG_SMSGCHANGED);
- DBGetStringDefault(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved, SIZEOF(templates.LogSMsgRemoved), DEFAULT_LOG_SMSGREMOVED);
- DBGetStringDefault(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening, SIZEOF(templates.LogSMsgOpening), DEFAULT_LOG_SMSGOPENING);
+ DBGetStringDefault(0, MODULE, "TLogSMsgChanged", templates.LogSMsgChanged, _countof(templates.LogSMsgChanged), DEFAULT_LOG_SMSGCHANGED);
+ DBGetStringDefault(0, MODULE, "TLogSMsgRemoved", templates.LogSMsgRemoved, _countof(templates.LogSMsgRemoved), DEFAULT_LOG_SMSGREMOVED);
+ DBGetStringDefault(0, MODULE, "TLogSMsgOpening", templates.LogSMsgOpening, _countof(templates.LogSMsgOpening), DEFAULT_LOG_SMSGOPENING);
templates.PopupXFlags = db_get_b(0, MODULE, "TPopupXFlags", NOTIFY_NEW_XSTATUS | NOTIFY_NEW_MESSAGE);
templates.PopupSMsgFlags = db_get_b(0, MODULE, "TPopupSMsgFlags", NOTIFY_NEW_MESSAGE);
@@ -218,7 +218,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
//Statuses notified
char status[8];
- mir_snprintf(status, SIZEOF(status), "%d", i);
+ mir_snprintf(status, _countof(status), "%d", i);
CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, status, 1) ? BST_CHECKED : BST_UNCHECKED);
}
CheckDlgButton(hwndDlg, IDC_CHK_FROMOFFLINE, opt.FromOffline ? BST_CHECKED : BST_UNCHECKED);
@@ -249,14 +249,14 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
TCHAR buff[MAX_PATH];
OPENFILENAME ofn = { 0 };
- GetDlgItemText(hwndDlg, IDC_LOGFILE, buff, SIZEOF(buff));
+ GetDlgItemText(hwndDlg, IDC_LOGFILE, buff, _countof(buff));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrFile = buff;
ofn.nMaxFile = MAX_PATH;
ofn.hwndOwner = hwndDlg;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.*)%c*.*%c%s (*.log)%c*.log%c%s (*.txt)%c*.txt%c"), TranslateT("All Files"), 0, 0, TranslateT("Log"), 0, 0, TranslateT("Text"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.*)%c*.*%c%s (*.log)%c*.log%c%s (*.txt)%c*.txt%c"), TranslateT("All Files"), 0, 0, TranslateT("Log"), 0, 0, TranslateT("Text"), 0, 0);
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 2;
ofn.lpstrInitialDir = buff;
@@ -284,12 +284,12 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
opt.HiddenContactsToo = IsDlgButtonChecked(hwndDlg, IDC_HIDDENCONTACTSTOO);
opt.UseIndSnd = IsDlgButtonChecked(hwndDlg, IDC_USEINDIVSOUNDS);
- GetDlgItemText(hwndDlg, IDC_LOGFILE, opt.LogFilePath, SIZEOF(opt.LogFilePath));
+ GetDlgItemText(hwndDlg, IDC_LOGFILE, opt.LogFilePath, _countof(opt.LogFilePath));
//Notified statuses
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
char status[8];
- mir_snprintf(status, SIZEOF(status), "%d", i);
+ mir_snprintf(status, _countof(status), "%d", i);
db_set_b(NULL, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
}
opt.FromOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_FROMOFFLINE);
@@ -336,7 +336,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetDlgItemInt(hwndDlg, IDC_CONNECTIONTIMEOUT_VALUE, opt.PopupConnectionTimeout, TRUE);
//Mouse actions
- for (int i = 0; i < SIZEOF(PopupActions); i++) {
+ for (int i = 0; i < _countof(PopupActions); i++) {
SendDlgItemMessage(hwndDlg, IDC_STATUS_LC, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_STATUS_LC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendDlgItemMessage(hwndDlg, IDC_STATUS_RC, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_STATUS_RC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
@@ -381,13 +381,13 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
TCHAR str[MAX_SECONDLINE] = { 0 };
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
- _tcsncpy(str, _T(""), SIZEOF(str));
+ _tcsncpy(str, _T(""), _countof(str));
if (opt.ShowStatus) {
if (opt.UseAlternativeText == 1)
- _tcsncpy(str, StatusList[Index(i)].lpzUStatusText, SIZEOF(str));
+ _tcsncpy(str, StatusList[Index(i)].lpzUStatusText, _countof(str));
else
- _tcsncpy(str, StatusList[Index(i)].lpzStandardText, SIZEOF(str));
+ _tcsncpy(str, StatusList[Index(i)].lpzStandardText, _countof(str));
if (opt.ShowPreviousStatus) {
TCHAR buff[MAX_STATUSTEXT];
@@ -405,9 +405,9 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, i), i, str);
}
- _tcsncpy(str, TranslateT("This is extra status"), SIZEOF(str));
+ _tcsncpy(str, TranslateT("This is extra status"), _countof(str));
ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str);
- _tcsncpy(str, TranslateT("This is status message"), SIZEOF(str));
+ _tcsncpy(str, TranslateT("This is status message"), _countof(str));
ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str);
return FALSE;
@@ -630,10 +630,10 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
(IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGREMOVE) ? NOTIFY_REMOVE_MESSAGE : 0);
// Templates
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupXstatusChanged, SIZEOF(templates.PopupXstatusChanged));
- GetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupXstatusRemoved, SIZEOF(templates.PopupXstatusRemoved));
- GetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupXMsgChanged, SIZEOF(templates.PopupXMsgChanged));
- GetDlgItemText(hwndDlg, IDC_ED_TREMOVEMSG, templates.PopupXMsgRemoved, SIZEOF(templates.PopupXMsgRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TCHANGE, templates.PopupXstatusChanged, _countof(templates.PopupXstatusChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TREMOVE, templates.PopupXstatusRemoved, _countof(templates.PopupXstatusRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TCHANGEMSG, templates.PopupXMsgChanged, _countof(templates.PopupXMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TREMOVEMSG, templates.PopupXMsgRemoved, _countof(templates.PopupXMsgRemoved));
// Save options to db
SaveOptions();
@@ -729,19 +729,19 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DBVARIANT dbVar = { 0 };
char protoname[MAX_PATH] = { 0 };
- mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgChanged", protos[i]->szModuleName);
+ mir_snprintf(protoname, _countof(protoname), "%s_TPopupSMsgChanged", protos[i]->szModuleName);
if (db_get_ts(NULL, MODULE, protoname, &dbVar))
- _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg));
+ _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, _countof(prototemplate->ProtoTemplateMsg));
else {
- _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg));
+ _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateMsg));
db_free(&dbVar);
}
- mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgRemoved", protos[i]->szModuleName);
+ mir_snprintf(protoname, _countof(protoname), "%s_TPopupSMsgRemoved", protos[i]->szModuleName);
if (db_get_ts(NULL, MODULE, protoname, &dbVar))
- _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved));
+ _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, _countof(prototemplate->ProtoTemplateRemoved));
else {
- _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved));
+ _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateRemoved));
db_free(&dbVar);
}
@@ -749,7 +749,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ProtoTemplates.insert(prototemplate, ProtoTemplates.getCount());
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", protos[i]->szModuleName);
ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULE, dbSetting, TRUE));
lvItem.iItem++;
}
@@ -862,7 +862,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ListView_GetItem(hList, &lvItem);
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", (char *)lvItem.lParam);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", (char *)lvItem.lParam);
db_set_b(NULL, MODULE, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
}
}
@@ -999,11 +999,11 @@ INT_PTR CALLBACK DlgProcXLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
(IsDlgButtonChecked(hwndDlg, IDC_CHK_XSTATUSOPENING) ? NOTIFY_OPENING_ML : 0);
// Templates
- GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSCHANGED, templates.LogXstatusChanged, SIZEOF(templates.LogXstatusChanged));
- GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSREMOVED, templates.LogXstatusRemoved, SIZEOF(templates.LogXstatusRemoved));
- GetDlgItemText(hwndDlg, IDC_ED_TMSGCHANGED, templates.LogXMsgChanged, SIZEOF(templates.LogXMsgChanged));
- GetDlgItemText(hwndDlg, IDC_ED_TMSGREMOVED, templates.LogXMsgRemoved, SIZEOF(templates.LogXMsgRemoved));
- GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSOPENING, templates.LogXstatusOpening, SIZEOF(templates.LogXstatusOpening));
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSCHANGED, templates.LogXstatusChanged, _countof(templates.LogXstatusChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSREMOVED, templates.LogXstatusRemoved, _countof(templates.LogXstatusRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TMSGCHANGED, templates.LogXMsgChanged, _countof(templates.LogXMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_ED_TMSGREMOVED, templates.LogXMsgRemoved, _countof(templates.LogXMsgRemoved));
+ GetDlgItemText(hwndDlg, IDC_ED_TXSTATUSOPENING, templates.LogXstatusOpening, _countof(templates.LogXstatusOpening));
SaveOptions();
SaveTemplates();
@@ -1170,9 +1170,9 @@ INT_PTR CALLBACK DlgProcLogOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
(IsDlgButtonChecked(hwndDlg, IDC_LOG_SMSGOPENING) ? NOTIFY_OPENING_ML : 0);
// Templates
- GetDlgItemText(hwndDlg, IDC_LOG_TSMSGCHANGED, templates.LogSMsgChanged, SIZEOF(templates.LogSMsgChanged));
- GetDlgItemText(hwndDlg, IDC_LOG_TSMSGREMOVED, templates.LogSMsgRemoved, SIZEOF(templates.LogSMsgRemoved));
- GetDlgItemText(hwndDlg, IDC_LOG_TSMSGOPENING, templates.LogSMsgOpening, SIZEOF(templates.LogSMsgOpening));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGCHANGED, templates.LogSMsgChanged, _countof(templates.LogSMsgChanged));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGREMOVED, templates.LogSMsgRemoved, _countof(templates.LogSMsgRemoved));
+ GetDlgItemText(hwndDlg, IDC_LOG_TSMSGOPENING, templates.LogSMsgOpening, _countof(templates.LogSMsgOpening));
SaveOptions();
SaveTemplates();
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp
index 8410aea172..fd1127dae2 100644
--- a/plugins/NewXstatusNotify/src/popup.cpp
+++ b/plugins/NewXstatusNotify/src/popup.cpp
@@ -36,7 +36,7 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const TCHAR
}
_tcsncpy_s(ppd.lptzContactName, buf, _TRUNCATE);
- _tcsncpy(ppd.lptzText, stzText, SIZEOF(ppd.lptzText));
+ _tcsncpy(ppd.lptzText, stzText, _countof(ppd.lptzText));
switch (opt.Colors) {
case POPUP_COLOR_OWN:
@@ -85,9 +85,9 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj)
TCHAR stzText[1024];
if (pstzLast)
- mir_sntprintf(stzText, SIZEOF(stzText), _T("%s\n%s"), pstzLast, tszStatus);
+ mir_sntprintf(stzText, _countof(stzText), _T("%s\n%s"), pstzLast, tszStatus);
else
- _tcsncpy(stzText, tszStatus, SIZEOF(stzText));
+ _tcsncpy(stzText, tszStatus, _countof(stzText));
SendMessage(pdp->hWnd, WM_SETREDRAW, FALSE, 0);
PUChangeTextT(pdp->hWnd, stzText);
SendMessage(pdp->hWnd, WM_SETREDRAW, TRUE, 0);
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index e89551ab6c..dcc0640267 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -226,7 +226,7 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc)
HICON hIcon = NULL;
TCHAR str[256] = { 0 };
TCHAR stzType[32];
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType));
+ mir_sntprintf(str, _countof(str), TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType));
if (opt.BlinkIcon_Status) {
DBVARIANT dbv;
@@ -289,7 +289,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc)
TCHAR stzLastLog[2 * MAX_TEXT_LEN];
CMString stzLogText(ReplaceVars(xsc, Template));
- DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, SIZEOF(stzLastLog), _T(""));
+ DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, _countof(stzLastLog), _T(""));
if (opt.XLogToDB) {
db_set_ws(xsc->hContact, MODULE, DB_LASTLOG, stzLogText);
@@ -322,8 +322,8 @@ void LogChangeToFile(XSTATUSCHANGE *xsc)
TCHAR stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN];
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, SIZEOF(stzTime));
- GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, _countof(stzTime));
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, _countof(stzDate));
TCHAR *Template = _T("");
switch (xsc->action) {
@@ -337,7 +337,7 @@ void LogChangeToFile(XSTATUSCHANGE *xsc)
Template = templates.LogXMsgRemoved; break;
}
- mir_sntprintf(stzText, SIZEOF(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime,
+ mir_sntprintf(stzText, _countof(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime,
pcli->pfnGetContactDisplayName(xsc->hContact, 0), ReplaceVars(xsc, Template).GetString());
LogToFile(stzText);
@@ -369,8 +369,8 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc)
if (opt.AutoDisable) {
char statusIDs[12], statusIDp[12];
WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0);
- mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
- mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
+ mir_snprintf(statusIDs, _countof(statusIDs), "s%d", myStatus);
+ mir_snprintf(statusIDp, _countof(statusIDp), "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound;
bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup;
}
@@ -480,22 +480,22 @@ void AddXStatusEventThread(void *arg)
TCHAR stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN];
if (ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) {
- GetJabberAdvStatusText(hContact, szProto, "mood", "title", stzTitle, SIZEOF(stzTitle));
+ GetJabberAdvStatusText(hContact, szProto, "mood", "title", stzTitle, _countof(stzTitle));
if (stzTitle[0]) {
- GetJabberAdvStatusText(hContact, szProto, "mood", "text", stzText, SIZEOF(stzText));
+ GetJabberAdvStatusText(hContact, szProto, "mood", "text", stzText, _countof(stzText));
LogXstatusChange(hContact, szProto, TYPE_JABBER_MOOD, stzTitle, stzText);
}
- GetJabberAdvStatusText(hContact, szProto, "activity", "title", stzTitle, SIZEOF(stzTitle));
+ GetJabberAdvStatusText(hContact, szProto, "activity", "title", stzTitle, _countof(stzTitle));
if (stzTitle[0]) {
- GetJabberAdvStatusText(hContact, szProto, "activity", "text", stzText, SIZEOF(stzText));
+ GetJabberAdvStatusText(hContact, szProto, "activity", "text", stzText, _countof(stzText));
LogXstatusChange(hContact, szProto, TYPE_JABBER_ACTIVITY, stzTitle, stzText);
}
}
else {
- GetIcqXStatus(hContact, szProto, "XStatusName", stzTitle, SIZEOF(stzTitle));
+ GetIcqXStatus(hContact, szProto, "XStatusName", stzTitle, _countof(stzTitle));
if (stzTitle[0]) {
- GetIcqXStatus(hContact, szProto, "XStatusMsg", stzText, SIZEOF(stzText));
+ GetIcqXStatus(hContact, szProto, "XStatusMsg", stzText, _countof(stzText));
LogXstatusChange(hContact, szProto, TYPE_ICQ_XSTATUS, stzTitle, stzText);
}
}
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index c474f0df33..d5206f3858 100644
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -26,7 +26,7 @@ static IconItem iconList[] =
void InitIconLib()
{
- Icon_Register(hInst, szGPGModuleName, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, szGPGModuleName, iconList, _countof(iconList));
}
HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook)
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 9275f0d0e2..6f64c97c5e 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -288,7 +288,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
break;
case ID_OK:
{
- ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp));
+ ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp));
TCHAR *name = new TCHAR [64];
ListView_GetItemText(hwndList, itemnum, 2, name, 64);
{
@@ -321,7 +321,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
boost::algorithm::erase_all(out, "\r");
{
char buf[64];
- GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf));
if(!mir_strcmp(buf, Translate("Default")))
{
db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
@@ -350,7 +350,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
}
TCHAR passwd[64];
- GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, SIZEOF(passwd));
+ GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, _countof(passwd));
if(passwd[0])
{
string dbsetting = "szKey_";
@@ -448,7 +448,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
break;
case IDC_DELETE_KEY:
- ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp));
+ ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp));
{
string out;
DWORD code;
@@ -496,7 +496,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
{
char buf[64];
- GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf));
if(!mir_strcmp(buf, Translate("Default")))
{
db_unset(NULL, szGPGModuleName, "GPGPubKey");
@@ -624,7 +624,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
{
char buf[64];
- GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf));
if(!mir_strcmp(buf, Translate("Default")))
{
db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
@@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case IDC_ACCOUNT:
{
char buf[64];
- GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf));
+ GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf));
if(!mir_strcmp(buf, Translate("Default")))
{
string keyinfo = Translate("key ID");
@@ -676,7 +676,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
{
if(OpenClipboard(hwndDlg))
{
- ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp));
+ ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp));
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -706,7 +706,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
if(!szKey)
{
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
@@ -718,7 +718,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
{
GlobalFree(hMem);
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
@@ -741,7 +741,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
mir_free(path);
if(!file.is_open())
break; //TODO: handle error
- ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp));
+ ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp));
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -767,7 +767,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
break;
case IDC_CHANGE_PASSWD:
- ListView_GetItemText(hwndList, itemnum, 0, key_id_global, SIZEOF(key_id_global));
+ ListView_GetItemText(hwndList, itemnum, 0, key_id_global, _countof(key_id_global));
// extern void ShowChangePasswdDlg();
// ShowChangePasswdDlg();
//temporary code follows
@@ -1001,7 +1001,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case ID_OK:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
if(tmp[0])
{
char *mir_path = new char [MAX_PATH];
@@ -1051,7 +1051,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK);
}
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
while(tmp[mir_tstrlen(tmp)-1] == '\\')
tmp[mir_tstrlen(tmp)-1] = '\0';
if(!tmp[0])
@@ -1079,7 +1079,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_GENERATE_RANDOM:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
if(tmp[0])
{
char *mir_path = new char [MAX_PATH];
@@ -1129,7 +1129,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended that you use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK);
}
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
while(tmp[mir_tstrlen(tmp)-1] == '\\')
tmp[mir_tstrlen(tmp)-1] = '\0';
if(!tmp[0])
@@ -1803,7 +1803,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar
{
case IDOK:
{
- ListView_GetItemText(hwndList, itemnum2, 0, id, SIZEOF(id));
+ ListView_GetItemText(hwndList, itemnum2, 0, id, _countof(id));
extern HWND hPubKeyEdit;
string out;
DWORD code;
@@ -2050,11 +2050,11 @@ void InitCheck()
if(!home_dir_access || !temp_access || !gpg_valid)
{
TCHAR buf[4096];
- _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf));
- mir_tstrncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf) - mir_tstrlen(buf));
- mir_tstrncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf) - mir_tstrlen(buf));
+ _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), _countof(buf));
+ mir_tstrncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), _countof(buf) - mir_tstrlen(buf));
+ mir_tstrncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_tstrlen(buf));
if(!gpg_valid)
- mir_tstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), SIZEOF(buf) - mir_tstrlen(buf));
+ mir_tstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), _countof(buf) - mir_tstrlen(buf));
MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK);
}
if(!gpg_valid)
@@ -2304,8 +2304,8 @@ void ImportKey()
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
if(db_mc_isMeta(hContact))
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 2fe285c330..384f1d7fb1 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -957,7 +957,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
case IDOK:
{
TCHAR tmp[64];
- GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, _countof(tmp));
if(tmp[0])
{
extern TCHAR *password;
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 3973d1cd39..68d705f19c 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -356,7 +356,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if(!szKey)
{
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
@@ -370,7 +370,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
GlobalFree(hMem);
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
@@ -379,7 +379,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
{
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to open clipboard with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to open clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
}
@@ -439,7 +439,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0;
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
return TRUE;
@@ -568,9 +568,9 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case PSN_APPLY:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
while(tmp[mir_tstrlen(tmp)-1] == '\\')
tmp[mir_tstrlen(tmp)-1] = '\0';
db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
@@ -635,22 +635,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags") != 0;
{
TCHAR tmp[128];
- GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(inopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(inclosetag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(outopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp)+1));
@@ -905,8 +905,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 34728486b2..711fbadf95 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -61,14 +61,14 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx
ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName);
ofn.Flags=OFN_EXPLORER;
ofn.lpstrTitle=TranslateW(WindowTittle);
- _tcsncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1);
+ _tcsncpy(filter,TranslateW(szExtDesc), _countof(filter)-1);
pfilter=filter+mir_tstrlen(filter)+1;
mir_tstrcpy(pfilter, szExt);
pfilter[mir_tstrlen(pfilter)+1] = '\0';
pfilter[mir_tstrlen(pfilter)+2] = '\0';
ofn.lpstrFilter=filter;
tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T(""));
- _tcsncpy(str, tmp, SIZEOF(str)-1);
+ _tcsncpy(str, tmp, _countof(str)-1);
mir_free(tmp);
if(mir_tstrlen(str)< 2)
str[0] = '\0';
@@ -1541,11 +1541,11 @@ void ExportGpGKeysFunc(int type)
file.close();
TCHAR msg[512];
if(type == 2)
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys);
+ mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys);
else if(type == 1)
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported all private keys."));
+ mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported all private keys."));
else if(!type)
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported %d public keys."), exported_keys);
+ mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported %d public keys."), exported_keys);
MessageBox(NULL, msg, TranslateT("Keys export result"), MB_OK);
}
@@ -1862,8 +1862,8 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
f<<toUTF16(key).c_str();
@@ -1890,9 +1890,9 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
file.close();
TCHAR msg[512];
if(processed_private_keys)
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys);
+ mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys);
else
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully processed %d public keys."), processed_keys);
+ mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully processed %d public keys."), processed_keys);
MessageBox(NULL, msg, TranslateT("Keys import result"), MB_OK);
return 0;
}
@@ -2084,16 +2084,16 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara
std::string old_pass, new_pass;
extern TCHAR key_id_global[17];
TCHAR buf[256] = {0};
- GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf));
new_pass = toUTF8(buf);
- GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(buf));
if(new_pass != toUTF8(buf))
{
MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK);
//key_id_global[0] = 0;
break;
}
- GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf));
old_pass = toUTF8(buf);
bool old_pass_match = false;
TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp
index 1cfe612b5a..5824d075a0 100644
--- a/plugins/NewsAggregator/Src/Authentication.cpp
+++ b/plugins/NewsAggregator/Src/Authentication.cpp
@@ -28,9 +28,9 @@ void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
}
else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
TCHAR buf[MAX_PATH] = {0};
- GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, buf, _countof(buf));
tlogin = mir_tstrdup(buf);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, _countof(buf));
tpass = mir_tstrdup(buf);
}
char *user = mir_t2a(tlogin), *pass = mir_t2a(tpass);
@@ -56,10 +56,10 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (SelItem.hwndList) {
TCHAR str[MAX_PATH];
- if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, SIZEOF(str)))
+ if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, _countof(str)))
SetDlgItemText(hwndDlg, IDC_FEEDNAME, str);
else {
- GetDlgItemText(SelItem.hwndList, IDC_FEEDURL, str, SIZEOF(str));
+ GetDlgItemText(SelItem.hwndList, IDC_FEEDURL, str, _countof(str));
SetDlgItemText(hwndDlg, IDC_FEEDNAME, str);
}
}
@@ -87,11 +87,11 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ItemInfo &SelItem = *(ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR username[MAX_PATH];
char passw[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, SIZEOF(username))) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, _countof(username))) {
MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
- if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, SIZEOF(passw))) {
+ if (!GetDlgItemTextA(hwndDlg, IDC_FEEDPASSWORD, passw, _countof(passw))) {
MessageBox(hwndDlg, TranslateT("Enter your password"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp
index 68736cebdb..9e156a3162 100644
--- a/plugins/NewsAggregator/Src/CheckFeed.cpp
+++ b/plugins/NewsAggregator/Src/CheckFeed.cpp
@@ -47,7 +47,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg)
HXML child = xi.getChild(chan, j);
if (!mir_tstrcmpi(xi.getName(child), _T("title"))) {
TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
+ mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
TCHAR *tszTitle = (TCHAR *)xi.getText(child);
return tszTitle;
@@ -59,7 +59,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg)
HXML child = xi.getChild(node, j);
if (!mir_tstrcmpi(xi.getName(child), _T("title"))) {
TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
+ mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
TCHAR *tszTitle = (TCHAR *)xi.getText(child);
return tszTitle;
@@ -73,7 +73,7 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg)
}
Netlib_LogfT(hNetlibUser, _T("%s is not a valid feed's address."), tszURL);
TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis not a valid feed's address."), tszURL);
+ mir_sntprintf(mes, _countof(mes), TranslateT("%s\nis not a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR);
return NULL;
}
@@ -199,7 +199,7 @@ void CheckCurrentFeed(MCONTACT hContact)
LPCTSTR szAttrName = xi.getAttrName(node, i);
if (!mir_tstrcmpi(szAttrName, _T("version"))) {
TCHAR ver[MAX_PATH];
- mir_sntprintf(ver, SIZEOF(ver), _T("RSS %s"), xi.getAttrValue(node, szAttrName));
+ mir_sntprintf(ver, _countof(ver), _T("RSS %s"), xi.getAttrValue(node, szAttrName));
db_set_ts(hContact, MODULE, "MirVer", ver);
break;
}
@@ -267,7 +267,7 @@ void CheckCurrentFeed(MCONTACT hContact)
CMString filename = szNick;
filename.Replace(_T("/"), _T("_"));
- mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext);
+ mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext);
CreateDirectoryTreeT(tszRoot);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
@@ -393,7 +393,7 @@ void CheckCurrentFeed(MCONTACT hContact)
ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
@@ -538,7 +538,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact)
ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
@@ -571,7 +571,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact)
ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ mir_sntprintf(ai.filename, _countof(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
if (DownloadFile(url, ai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp
index 3b2ef7fd8c..fe6e512c29 100644
--- a/plugins/NewsAggregator/Src/ExportImport.cpp
+++ b/plugins/NewsAggregator/Src/ExportImport.cpp
@@ -41,7 +41,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDOK:
{
TCHAR FileName[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, SIZEOF(FileName));
+ GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName));
int bytesParsed = 0;
HXML hXml = xi.parseFile(FileName, &bytesParsed, NULL);
if(hXml != NULL) {
@@ -130,7 +130,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if ( !group)
group = (TCHAR *)xi.getAttrValue(parent, xi.getAttrName(parent, i));
else {
- mir_sntprintf(tmpgroup, SIZEOF(tmpgroup), _T("%s\\%s"), xi.getAttrValue(parent, xi.getAttrName(parent, i)), group);
+ mir_sntprintf(tmpgroup, _countof(tmpgroup), _T("%s\\%s"), xi.getAttrValue(parent, xi.getAttrName(parent, i)), group);
group = tmpgroup;
}
break;
@@ -209,9 +209,9 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
TCHAR mes[MAX_PATH];
if (DUPES)
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
+ mir_sntprintf(mes, _countof(mes), TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
else
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("Imported %d feed(s)."), count);
+ mir_sntprintf(mes, _countof(mes), TranslateT("Imported %d feed(s)."), count);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
}
}
@@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.opml, *.xml)%c*.opml;*.xml%c%c"), TranslateT("OPML files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.opml, *.xml)%c*.opml;*.xml%c%c"), TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
@@ -491,7 +491,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp
index 9b100c8b06..05828449ff 100644
--- a/plugins/NewsAggregator/Src/Icons.cpp
+++ b/plugins/NewsAggregator/Src/Icons.cpp
@@ -33,19 +33,19 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(hInst, LPGEN("News Aggregator"), iconList, SIZEOF(iconList), MODULE);
+ Icon_Register(hInst, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
}
HICON LoadIconEx(const char *name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(const char *name)
{
- for (int i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < _countof(iconList); i++)
if ( !mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp
index b8849fc775..66006753ff 100644
--- a/plugins/NewsAggregator/Src/Options.cpp
+++ b/plugins/NewsAggregator/Src/Options.cpp
@@ -40,37 +40,37 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
TCHAR str[MAX_PATH];
char passw[MAX_PATH];
{
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
break;
}
MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
Proto_AddToContact(hContact, MODULE);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ts(hContact, MODULE, "Nick", str);
HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
db_set_ts(hContact, MODULE, "URL", str);
db_set_b(hContact, MODULE, "CheckState", 1);
db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ts(hContact, MODULE, "MsgFormat", str);
db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
db_set_b(hContact, MODULE, "UseAuth", 1);
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
db_set_ts(hContact, MODULE, "Login", str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
db_set_s(hContact, MODULE, "Password", passw);
}
DeleteAllItems(hwndList);
@@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_TAGHELP:
TCHAR tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
+ mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
_T("#<title>#"), TranslateT("The title of the item."),
_T("#<description>#"), TranslateT("The item synopsis."),
_T("#<link>#"), TranslateT("The URL of the item."),
@@ -115,7 +115,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
TCHAR tszURL[MAX_PATH] = { 0 }, *tszTitle = NULL;
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0)
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0)
tszTitle = CheckFeed(tszURL, hwndDlg);
else
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
@@ -204,33 +204,33 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
ItemInfo *SelItem = (ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char passw[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
break;
}
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
db_set_ts(SelItem->hContact, MODULE, "URL", str);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ts(SelItem->hContact, MODULE, "Nick", str);
db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ts(SelItem->hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
db_set_b(SelItem->hContact, MODULE, "UseAuth", 1);
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
db_set_ts(SelItem->hContact, MODULE, "Login", str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
db_set_s(SelItem->hContact, MODULE, "Password", passw);
}
else {
@@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_TAGHELP:
TCHAR tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
+ mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
_T("#<title>#"), TranslateT("The title of the item."),
_T("#<description>#"), TranslateT("The item synopsis."),
_T("#<link>#"), TranslateT("The URL of the item."),
@@ -278,7 +278,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_DISCOVERY:
TCHAR tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) {
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) {
EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
TCHAR *tszTitle = CheckFeed(tszURL, hwndDlg);
@@ -361,33 +361,33 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char passw[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
+ if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) {
MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
break;
}
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str))) {
+ if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
break;
}
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
db_set_ts(hContact, MODULE, "URL", str);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
db_set_ts(hContact, MODULE, "Nick", str);
db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, NULL, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
db_set_ts(hContact, MODULE, "MsgFormat", str);
if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
db_set_b(hContact, MODULE, "UseAuth", 1);
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
db_set_ts(hContact, MODULE, "Login", str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, SIZEOF(passw));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
db_set_s(hContact, MODULE, "Password", passw);
}
else {
@@ -415,7 +415,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_TAGHELP:
TCHAR tszTagHelp[1024];
- mir_sntprintf(tszTagHelp, SIZEOF(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
+ mir_sntprintf(tszTagHelp, _countof(tszTagHelp), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
_T("#<title>#"), TranslateT("The title of the item."),
_T("#<description>#"), TranslateT("The item synopsis."),
_T("#<link>#"), TranslateT("The URL of the item."),
@@ -433,7 +433,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_DISCOVERY:
TCHAR tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, SIZEOF(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) {
+ if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) {
EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
TCHAR *tszTitle = CheckFeed(tszURL, hwndDlg);
@@ -485,8 +485,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
sel = ListView_GetSelectionMark(hwndList);
{
ItemInfo SelItem = { 0 };
- ListView_GetItemText(hwndList, sel, 0, SelItem.nick, SIZEOF(SelItem.nick));
- ListView_GetItemText(hwndList, sel, 1, SelItem.url, SIZEOF(SelItem.url));
+ ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
+ ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
SelItem.SelNumber = sel;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem);
@@ -497,8 +497,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Contact deleting"), MB_YESNO | MB_ICONWARNING) == IDYES) {
TCHAR nick[MAX_PATH], url[MAX_PATH];
int sel = ListView_GetSelectionMark(hwndList);
- ListView_GetItemText(hwndList, sel, 0, nick, SIZEOF(nick));
- ListView_GetItemText(hwndList, sel, 1, url, SIZEOF(url));
+ ListView_GetItemText(hwndList, sel, 0, nick, _countof(nick));
+ ListView_GetItemText(hwndList, sel, 1, url, _countof(url));
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
ptrT dbNick(db_get_tsa(hContact, MODULE, "Nick"));
@@ -556,8 +556,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
sel = ListView_GetHotItem(hwndList);
if (sel != -1) {
ItemInfo SelItem = { 0 };
- ListView_GetItemText(hwndList, sel, 0, SelItem.nick, SIZEOF(SelItem.nick));
- ListView_GetItemText(hwndList, sel, 1, SelItem.url, SIZEOF(SelItem.url));
+ ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
+ ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
SelItem.hwndList = hwndList;
SelItem.SelNumber = sel;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem);
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index eb88bf1f1c..fa81455bb7 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -40,7 +40,7 @@ int NewsAggrInit(WPARAM, LPARAM)
if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)))
FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T(""));
else
- mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot));
+ mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), _countof(tszRoot));
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp
index 15553d20b3..e0835972cf 100644
--- a/plugins/NoHistory/src/icons.cpp
+++ b/plugins/NoHistory/src/icons.cpp
@@ -19,7 +19,7 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam)
void InitIcons()
{
- Icon_Register(hInst, LPGEN("No History"), iconList, SIZEOF(iconList), MODULE);
+ Icon_Register(hInst, LPGEN("No History"), iconList, _countof(iconList), MODULE);
ReloadIcons(0, 0);
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp
index 961ec57d88..66d278aa69 100644
--- a/plugins/Non-IM Contact/src/contactinfo.cpp
+++ b/plugins/Non-IM Contact/src/contactinfo.cpp
@@ -10,9 +10,9 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
char name[2048];
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hContact);
- if (!db_get_static(hContact, MODNAME, "Name", name, SIZEOF(name))) break;
+ if (!db_get_static(hContact, MODNAME, "Name", name, _countof(name))) break;
SetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, name);
- if (!db_get_static(hContact, MODNAME, "ToolTip", name, SIZEOF(name))) break;
+ if (!db_get_static(hContact, MODNAME, "ToolTip", name, _countof(name))) break;
SetDlgItemTextA(hwnd, IDC_TOOLTIP, name);
}
return TRUE;
@@ -29,7 +29,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_DISPLAY_NAME))) {
char text[512];
- GetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, text, _countof(text));
db_set_s(hContact, MODNAME, "Name", text);
WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
}
@@ -40,7 +40,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TOOLTIP))) {
char text[2048];
- GetDlgItemTextA(hwnd, IDC_TOOLTIP, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_TOOLTIP, text, _countof(text));
db_set_s(hContact, MODNAME, "ToolTip", text);
WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
}
@@ -157,7 +157,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (!db_get_w(NULL, MODNAME, "Timer", 1))
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, TranslateT("Non-IM Contact protocol timer is Disabled"));
else {
- mir_sntprintf(string, SIZEOF(string), TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1));
+ mir_sntprintf(string, _countof(string), TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1));
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, string);
}
}
@@ -200,7 +200,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case IDC_OPEN_FOLDER:
if (BrowseForFolder(hwnd, szFileName)) {
- mir_snprintf(szFileName, SIZEOF(szFileName), "%s ,/e", szFileName);
+ mir_snprintf(szFileName, _countof(szFileName), "%s ,/e", szFileName);
SetDlgItemTextA(hwnd, IDC_LINK, "explorer.exe");
SetDlgItemTextA(hwnd, IDC_PARAMS, szFileName);
}
@@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_LINK))) {
char text[512];
- GetDlgItemTextA(hwnd, IDC_LINK, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_LINK, text, _countof(text));
db_set_s(hContact, MODNAME, "ProgramString", text);
WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
}
@@ -225,7 +225,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_PARAMS))) {
char text[512];
- GetDlgItemTextA(hwnd, IDC_PARAMS, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_PARAMS, text, _countof(text));
db_set_s(hContact, MODNAME, "ProgramParamsString", text);
WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
}
@@ -233,7 +233,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_GROUP))) {
TCHAR text[512];
- GetDlgItemText(hwnd, IDC_GROUP, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDC_GROUP, text, _countof(text));
Clist_CreateGroup(NULL, text);
db_set_ts(hContact, "CList", "Group", text);
}
@@ -252,7 +252,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER)) {
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER))) {
TCHAR text[512];
- GetDlgItemText(hwnd, IDC_TIMER, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDC_TIMER, text, _countof(text));
db_set_w(hContact, MODNAME, "Timer", (WORD)_ttoi(text));
}
else db_set_w(hContact, MODNAME, "Timer", 15);
@@ -311,7 +311,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int i = 0, j = 0, k = 0;
char *string = oldString[k];
MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2;
- if (db_get_static(hContact1, MODNAME, "Name", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, MODNAME, "Name", dbVar1, _countof(dbVar1))) {
char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) + 1);
GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) + 1);
// get the list of replace strings
@@ -347,7 +347,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_s(hContact2, MODNAME, "Name", dbVar2);
// copy the ProgramString
- if (db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, _countof(dbVar1))) {
mir_strcpy(dbVar2, "");
for (i = 0; i <= k; i++)
copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
@@ -355,7 +355,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_s(hContact2, MODNAME, "ProgramString", dbVar2);
}
// copy the ProgramParamString
- if (db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, _countof(dbVar1))) {
mir_strcpy(dbVar2, "");
for (i = 0; i <= k; i++)
copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
@@ -363,7 +363,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_s(hContact2, MODNAME, "ProgramParamString", dbVar2);
}
// copy the group
- if (db_get_static(hContact1, "CList", "Group", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, "CList", "Group", dbVar1, _countof(dbVar1))) {
mir_strcpy(dbVar2, "");
for (i = 0; i <= k; i++)
copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
@@ -371,7 +371,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_s(hContact2, "CList", "Group", dbVar2);
}
// copy the ToolTip
- if (db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, _countof(dbVar1))) {
mir_strcpy(dbVar2, "");
for (i = 0; i <= k; i++)
copyReplaceString(dbVar1, dbVar2, oldString[i], newString[i]);
@@ -390,7 +390,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
else {
char dbVar1[2000];
MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (db_get_static(hContact1, MODNAME, "Name", dbVar1, SIZEOF(dbVar1))) {
+ if (db_get_static(hContact1, MODNAME, "Name", dbVar1, _countof(dbVar1))) {
MCONTACT hContact2 = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
if (!hContact2) {
msg("contact did not get created", "");
@@ -400,19 +400,19 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE);
db_set_s(hContact2, MODNAME, "Nick", Translate("New Non-IM Contact"));
db_set_s(hContact2, MODNAME, "Name", dbVar1);
- if (db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, SIZEOF(dbVar1)))
+ if (db_get_static(hContact1, MODNAME, "ProgramString", dbVar1, _countof(dbVar1)))
db_set_s(hContact2, MODNAME, "ProgramString", dbVar1);
// copy the ProgramParamString
- if (db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, SIZEOF(dbVar1)))
+ if (db_get_static(hContact1, MODNAME, "ProgramParamString", dbVar1, _countof(dbVar1)))
db_set_s(hContact2, MODNAME, "ProgramParamString", dbVar1);
// copy the group
- if (db_get_static(hContact1, "CList", "Group", dbVar1, SIZEOF(dbVar1)))
+ if (db_get_static(hContact1, "CList", "Group", dbVar1, _countof(dbVar1)))
db_set_s(hContact2, "CList", "Group", dbVar1);
// copy the ToolTip
- if (db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, SIZEOF(dbVar1)))
+ if (db_get_static(hContact1, MODNAME, "ToolTip", dbVar1, _countof(dbVar1)))
db_set_s(hContact2, MODNAME, "ToolTip", dbVar1);
// timer
@@ -453,15 +453,15 @@ void ExportContact(MCONTACT hContact)
// else
FILE *file = fopen(szFileName, "a");
if (file) {
- if (db_get_static(hContact, MODNAME, "Name", DBVar, SIZEOF(DBVar))) {
+ if (db_get_static(hContact, MODNAME, "Name", DBVar, _countof(DBVar))) {
fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramString", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ProgramString", DBVar, _countof(DBVar)))
fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, _countof(DBVar)))
fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ToolTip", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ToolTip", DBVar, _countof(DBVar)))
fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (db_get_static(hContact, "CList", "Group", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, "CList", "Group", DBVar, _countof(DBVar)))
fprintf(file, "Group=%s\r\n", DBVar);
if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
fprintf(file, "Icon=%d\r\n", tmp);
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp
index 1565321cb4..a948737802 100644
--- a/plugins/Non-IM Contact/src/dialog.cpp
+++ b/plugins/Non-IM Contact/src/dialog.cpp
@@ -61,7 +61,7 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TCHAR tmp[5];
db_set_b(NULL, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) {
- GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, _countof(tmp));
db_set_w(NULL, MODNAME, "Timer", (WORD)_ttoi(tmp));
}
else db_set_w(NULL, MODNAME, "Timer", 0);
@@ -136,7 +136,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
char tmp[MAX_STRING_LENGTH];
int i = 0, j;
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, tmp, SIZEOF(tmp));
+ GetDlgItemTextA(hwnd, IDC_STRING, tmp, _countof(tmp));
if (tmp[mir_strlen(tmp) - 1] == '(') {
for (i = 0; i < VARS; i++) {
if (!mir_strcmp(braceList[i].var, &tmp[mir_strlen(tmp) - mir_strlen(braceList[i].var)])) {
@@ -179,7 +179,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
char str2replace[MAX_STRING_LENGTH];
int error;
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, str2replace, SIZEOF(str2replace));
+ GetDlgItemTextA(hwnd, IDC_STRING, str2replace, _countof(str2replace));
switch (stringReplacer(str2replace, replacedString, NULL)) {
case ERROR_NO_LINE_AFTER_VAR_F:
replacedString.Format("ERROR: no %s", "%line or %wholeline or %lastline after %fn");
@@ -288,10 +288,10 @@ void DoPropertySheet(MCONTACT hContact, HINSTANCE hInst)
psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
psh.hInstance = hInst;
psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
- db_get_static(hContact, MODNAME, "Nick", nick, SIZEOF(nick));
- mir_snprintf(title, SIZEOF(title), Translate("Edit Non-IM Contact \"%s\""), nick);
+ db_get_static(hContact, MODNAME, "Nick", nick, _countof(nick));
+ mir_snprintf(title, _countof(title), Translate("Edit Non-IM Contact \"%s\""), nick);
psh.pszCaption = title;
- psh.nPages = SIZEOF(psp);
+ psh.nPages = _countof(psp);
psh.ppsp = (LPCPROPSHEETPAGEA)&psp;
psh.pfnCallback = PropSheetProc;
@@ -307,7 +307,7 @@ INT_PTR addContact(WPARAM wParam, LPARAM lParam)
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
db_set_ts(hContact, MODNAME, "Nick", TranslateT("New Non-IM Contact"));
DoPropertySheet(hContact, hInst);
- if (!db_get_static(hContact, MODNAME, "Name", tmp, SIZEOF(tmp)))
+ if (!db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
replaceAllStrings(hContact);
return 0;
@@ -324,7 +324,7 @@ INT_PTR editContact(WPARAM wParam, LPARAM lParam)
db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact"));
}
DoPropertySheet(hContact, hInst);
- if (!db_get_static(hContact, MODNAME, "Name", tmp, SIZEOF(tmp)))
+ if (!db_get_static(hContact, MODNAME, "Name", tmp, _countof(tmp)))
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
replaceAllStrings(hContact);
return 0;
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp
index 677f2d2455..5d5ba5945c 100644
--- a/plugins/Non-IM Contact/src/files.cpp
+++ b/plugins/Non-IM Contact/src/files.cpp
@@ -17,15 +17,15 @@ INT_PTR exportContacts(WPARAM wParam, LPARAM lParam)
for (MCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) {
int tmp;
char DBVar[1024];
- if (db_get_static(hContact, MODNAME, "Name", DBVar, SIZEOF(DBVar))) {
+ if (db_get_static(hContact, MODNAME, "Name", DBVar, _countof(DBVar))) {
fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramString", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ProgramString", DBVar, _countof(DBVar)))
fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar, _countof(DBVar)))
fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ToolTip", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, MODNAME, "ToolTip", DBVar, _countof(DBVar)))
fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (db_get_static(hContact, "CList", "Group", DBVar, SIZEOF(DBVar)))
+ if (db_get_static(hContact, "CList", "Group", DBVar, _countof(DBVar)))
fprintf(file, "Group=%s\r\n", DBVar);
if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
fprintf(file, "Icon=%d\r\n", tmp);
@@ -76,7 +76,7 @@ void reloadFiles(HWND fileList)
SendMessage(fileList, CB_RESETCONTENT, 0, 0);
for (i = 0;; i++) {
mir_snprintf(fn, "fn%d", i);
- if (db_get_static(NULL, MODNAME, fn, file, SIZEOF(file))) {
+ if (db_get_static(NULL, MODNAME, fn, file, _countof(file))) {
index = SendMessageA(fileList, CB_ADDSTRING, 0, (LPARAM)file);
SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)i);
SendMessage(fileList, CB_SETCURSEL, index, 0);
@@ -105,13 +105,13 @@ void readFile(HWND hwnd)
char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
int fileNumber = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
mir_snprintf(fn, "fn%d", fileNumber);
- if (!db_get_static(NULL, MODNAME, fn, szFileName, SIZEOF(szFileName))) {
+ if (!db_get_static(NULL, MODNAME, fn, szFileName, _countof(szFileName))) {
msg(Translate("File couldn't be opened"), fn);
return;
}
if (!strncmp("http://", szFileName, mir_strlen("http://")) || !strncmp("https://", szFileName, mir_strlen("https://")))
- mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
+ mir_snprintf(szFileName, _countof(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
FILE *filen = fopen(szFileName, "r");
if (!filen) {
@@ -127,7 +127,7 @@ void readFile(HWND hwnd)
else if (temp[mir_strlen(temp) - 1] == '\n')
temp[mir_strlen(temp) - 1] = '\0';
else temp[mir_strlen(temp)] = '\0';
- mir_snprintf(temp1, SIZEOF(temp1), Translate("line(%-3d) = | %s"), lineNumber, temp);
+ mir_snprintf(temp1, _countof(temp1), Translate("line(%-3d) = | %s"), lineNumber, temp);
SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1);
lineNumber++;
fileLength++;
@@ -149,7 +149,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int i = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
mir_snprintf(fn, "fn%d", i);
SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0);
- if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string))) {
+ if (db_get_static(NULL, MODNAME, fn, string, _countof(string))) {
if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) {
SetDlgItemTextA(hwnd, IDC_URL, string);
mir_snprintf(fn, "fn%d_timer", i);
@@ -172,22 +172,22 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_URL))) {
char text[512], url[512], fn[10] = "fn0", szFileName[MAX_PATH], temp[512];
int i, timer;
- GetDlgItemTextA(hwnd, IDC_URL, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_URL, text, _countof(text));
mir_strcpy(url, text);
if (!InternetDownloadFile(text)) {
for (i = 0;; i++) {
mir_snprintf(fn, "fn%d", i);
- if (!db_get_static(NULL, MODNAME, fn, text, SIZEOF(text)))
+ if (!db_get_static(NULL, MODNAME, fn, text, _countof(text)))
break;
}
- mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\%s.html", getMimDir(temp), fn);
+ mir_snprintf(szFileName, _countof(szFileName), "%s\\plugins\\%s.html", getMimDir(temp), fn);
if (savehtml(szFileName)) {
mir_snprintf(fn, "fn%d", i);
db_set_s(NULL, MODNAME, fn, url);
if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER)))
timer = 60;
else {
- GetDlgItemTextA(hwnd, IDC_WWW_TIMER, text, SIZEOF(text));
+ GetDlgItemTextA(hwnd, IDC_WWW_TIMER, text, _countof(text));
timer = atoi(text);
}
mir_snprintf(fn, "fn%d_timer", i);
@@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
char file[MAX_PATH], fn[6];
for (i = 0;; i++) {
mir_snprintf(fn, "fn%d", i);
- if (!db_get_static(NULL, MODNAME, fn, file, SIZEOF(file)))
+ if (!db_get_static(NULL, MODNAME, fn, file, _countof(file)))
break;
}
if (Openfile(file, 1)) {
@@ -239,7 +239,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
else {
mir_snprintf(fn, "fn%d", i);
- while (db_get_static(NULL, MODNAME, fn, tmp, SIZEOF(tmp))) {
+ while (db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) {
mir_snprintf(fn1, "fn%d", i - 1);
db_set_s(NULL, MODNAME, fn1, tmp);
mir_snprintf(fn, "fn%d", ++i);
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
char fn[20], tmp[MAX_PATH];
SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10));
mir_snprintf(fn, "fn%d", index);
- if (db_get_static(NULL, MODNAME, fn, tmp, SIZEOF(tmp))) {
+ if (db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) {
if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) {
SetDlgItemTextA(hwnd, IDC_URL, tmp);
mir_snprintf(fn, "fn%d_timer", index);
@@ -290,12 +290,12 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
mir_snprintf(fn, "fn%d", i);
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER))) {
TCHAR text[5];
- GetDlgItemText(hwnd, IDC_WWW_TIMER, text, SIZEOF(text));
+ GetDlgItemText(hwnd, IDC_WWW_TIMER, text, _countof(text));
timer = _ttoi(text);
}
else timer = 60;
- if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string)))
+ if (db_get_static(NULL, MODNAME, fn, string, _countof(string)))
if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) {
mir_snprintf(fn, "fn%d_timer", i);
db_set_w(NULL, MODNAME, fn, (WORD)timer);
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp
index 7b556e486e..5b41419efd 100644
--- a/plugins/Non-IM Contact/src/main.cpp
+++ b/plugins/Non-IM Contact/src/main.cpp
@@ -32,8 +32,8 @@ INT_PTR doubleClick(WPARAM wParam, LPARAM lParam)
if (proto && !mir_strcmp(proto, MODNAME)) {
if (GetKeyState(VK_CONTROL) & 0x8000) // ctrl is pressed
editContact(wParam, 0); // for later when i add a second double click setting
- else if (db_get_static(wParam, MODNAME, "Program", program, SIZEOF(program)) && mir_strcmp(program, "")) {
- if (!db_get_static(wParam, MODNAME, "ProgramParams", params, SIZEOF(params)))
+ else if (db_get_static(wParam, MODNAME, "Program", program, _countof(program)) && mir_strcmp(program, "")) {
+ if (!db_get_static(wParam, MODNAME, "ProgramParams", params, _countof(params)))
mir_strcpy(params, "");
if (strstr(program, "http://") || strstr(program, "https://"))
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)program);
@@ -118,7 +118,7 @@ extern "C" __declspec(dllexport) int Load()
mir_getLP(&pluginInfoEx);
mir_getCLI();
- Icon_Register(hInst, LPGEN("Non-IM Contact"), icoList, SIZEOF(icoList));
+ Icon_Register(hInst, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
HookEvent(ME_OPT_INITIALISE, NimcOptInit);
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp
index 456fc8d86e..4837219d2c 100644
--- a/plugins/Non-IM Contact/src/namereplacing.cpp
+++ b/plugins/Non-IM Contact/src/namereplacing.cpp
@@ -3,7 +3,7 @@
int readFileIntoArray(int fileNumber, char *FileContents[])
{
char dbSetting[20], temp[MAX_STRING_LENGTH];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "fn%d", fileNumber);
+ mir_snprintf(dbSetting, _countof(dbSetting), "fn%d", fileNumber);
char *szVar = db_get_sa(NULL, MODNAME, dbSetting);
if (szVar == NULL)
@@ -11,9 +11,9 @@ int readFileIntoArray(int fileNumber, char *FileContents[])
char tszFileName[MAX_PATH];
if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 7))
- mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
+ mir_snprintf(tszFileName, _countof(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
else
- mir_strncpy(tszFileName, szVar, SIZEOF(tszFileName));
+ mir_strncpy(tszFileName, szVar, _countof(tszFileName));
mir_free(szVar);
FILE* file = fopen(tszFileName, "r");
@@ -405,9 +405,9 @@ int lastChecked(CMStringA &szNewStr, const char *str)
return 0;
if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 8))
- mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), file);
+ mir_snprintf(tszFileName, _countof(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), file);
else
- mir_strncpy(tszFileName, szVar, SIZEOF(tszFileName));
+ mir_strncpy(tszFileName, szVar, _countof(tszFileName));
mir_free(szVar);
HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -417,7 +417,7 @@ int lastChecked(CMStringA &szNewStr, const char *str)
if (GetLastWriteTime(hFile, tszFileName)) {
CloseHandle(hFile);
szNewStr.Append(tszFileName);
- mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s%d))", szPattern, file);
+ mir_snprintf(tszFileName, _countof(tszFileName), "%s%d))", szPattern, file);
return (int)mir_strlen(tszFileName);
}
CloseHandle(hFile);
@@ -540,8 +540,8 @@ int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hCont
return ERROR_NO_FILE;
}
else {
- mir_snprintf(tempString, SIZEOF(tempString), "fn%d", tempInt);
- if (db_get_static(NULL, MODNAME, tempString, tempString, SIZEOF(tempString)))
+ mir_snprintf(tempString, _countof(tempString), "fn%d", tempInt);
+ if (db_get_static(NULL, MODNAME, tempString, tempString, _countof(tempString)))
szNewString.Append(tempString);
else return ERROR_NO_FILE;
positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1;
@@ -578,7 +578,7 @@ void WriteSetting(MCONTACT hContact, char* module1, char* setting1, char* module
CMStringA newString;
char text[MAX_STRING_LENGTH];
int error = 0, status = GetLCStatus(0, 0);
- if (db_get_static(hContact, module1, setting1, text, SIZEOF(text))) {
+ if (db_get_static(hContact, module1, setting1, text, _countof(text))) {
switch (stringReplacer(text, newString, hContact)) {
case ERROR_NO_LINE_AFTER_VAR_F:
newString.Format(Translate("%s - ERROR: no line specified or line not found (in %s)"), text, setting1);
@@ -622,11 +622,11 @@ void replaceAllStrings(MCONTACT hContact)
WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
/* tooltips*/
WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
- if (db_get_static(hContact, MODNAME, "Program", tmp1, SIZEOF(tmp1)) && db_get_static(hContact, MODNAME, "ProgramParams", tmp2, SIZEOF(tmp2))) {
- mir_snprintf(tmp3, SIZEOF(tmp3), "%s %s", tmp1, tmp2);
+ if (db_get_static(hContact, MODNAME, "Program", tmp1, _countof(tmp1)) && db_get_static(hContact, MODNAME, "ProgramParams", tmp2, _countof(tmp2))) {
+ mir_snprintf(tmp3, _countof(tmp3), "%s %s", tmp1, tmp2);
db_set_s(hContact, "UserInfo", "FirstName", tmp3);
}
- else if (db_get_static(hContact, MODNAME, "Program", tmp1, SIZEOF(tmp1))) {
+ else if (db_get_static(hContact, MODNAME, "Program", tmp1, _countof(tmp1))) {
db_set_s(hContact, "UserInfo", "FirstName", tmp1);
}
else db_set_s(hContact, "UserInfo", "FirstName", "");
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp
index cbd5ba7f29..5f19b802f0 100644
--- a/plugins/Non-IM Contact/src/timer.cpp
+++ b/plugins/Non-IM Contact/src/timer.cpp
@@ -24,7 +24,7 @@ void timerFunc(void *di)
/* update the web pages*/
for (int i = 0;; i++) {
mir_snprintf(fn, "fn%d", i);
- if (!db_get_static(NULL, MODNAME, fn, text, SIZEOF(text)))
+ if (!db_get_static(NULL, MODNAME, fn, text, _countof(text)))
break;
if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) {
@@ -32,7 +32,7 @@ void timerFunc(void *di)
int timer = db_get_w(NULL, MODNAME, fn, 60);
if (timer && !(timerCount % timer)) {
if (!InternetDownloadFile(text)) {
- mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), i);
+ mir_snprintf(szFileName, _countof(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), i);
savehtml(szFileName);
}
}
@@ -43,7 +43,7 @@ void timerFunc(void *di)
for (MCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) {
int timer = db_get_w(hContact, MODNAME, "Timer", 15);
if (timer && !(timerCount % timer))
- if (db_get_static(hContact, MODNAME, "Name", text, SIZEOF(text)))
+ if (db_get_static(hContact, MODNAME, "Name", text, _countof(text)))
replaceAllStrings(hContact);
}
}
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp
index a19ad4f3da..42ed98f0fb 100644
--- a/plugins/NotesAndReminders/src/main.cpp
+++ b/plugins/NotesAndReminders/src/main.cpp
@@ -110,7 +110,7 @@ IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(hinstance, LPGEN("Sticky Notes"), iconList, SIZEOF(iconList), MODULENAME);
+ Icon_Register(hinstance, LPGEN("Sticky Notes"), iconList, _countof(iconList), MODULENAME);
}
int OnOptInitialise(WPARAM w, LPARAM L)
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index e3cfb87c52..3f553dee1e 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -381,7 +381,7 @@ void LoadNotes(BOOL bIsStartup)
{
char *DelPos;
- mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I);
if (Value)
{
@@ -694,7 +694,7 @@ void PurgeNotes(void)
NotesCount = db_get_dw(0,MODULENAME,"NotesData",0);
for(I = 0; I < NotesCount; I++)
{
- mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I);
db_unset(0,MODULENAME,ValueName);
}
}
@@ -940,7 +940,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified)
Value[0xffff] = 0;
}
- mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", NotesCount - I - 1); // we do not reverse notes in DB
+ mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", NotesCount - I - 1); // we do not reverse notes in DB
db_set_blob(0, MODULENAME, ValueName, Value, n+1);
@@ -956,7 +956,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified)
// delete any left over DB note entries
for(; I < OldNotesCount; I++)
{
- mir_snprintf(ValueName, SIZEOF(ValueName), "NotesData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "NotesData%d", I);
db_unset(0,MODULENAME,ValueName);
}
@@ -1024,10 +1024,10 @@ static BOOL DoContextMenu(HWND AhWnd,WPARAM wParam,LPARAM lParam)
HMENU hBg = GetSubMenu(hSub, FindMenuItem(hSub, _T("Background Color")));
HMENU hFg = GetSubMenu(hSub, FindMenuItem(hSub, _T("Text Color")));
- for (i=0; i<SIZEOF(clrPresets); i++)
+ for (i=0; i<_countof(clrPresets); i++)
InsertMenu(hBg, i, MF_BYPOSITION|MF_OWNERDRAW, IDM_COLORPRESET_BG+i, TranslateTS(clrPresets[i].szName));
- for (i=0; i<SIZEOF(clrPresets); i++)
+ for (i=0; i<_countof(clrPresets); i++)
InsertMenu(hFg, i, MF_BYPOSITION|MF_OWNERDRAW, IDM_COLORPRESET_FG+i, TranslateTS(clrPresets[i].szName));
}
@@ -1404,12 +1404,12 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l
if (lpMeasureItem->CtlType != ODT_MENU)
break;
- if (lpMeasureItem->itemID >= IDM_COLORPRESET_BG && lpMeasureItem->itemID <= IDM_COLORPRESET_BG+SIZEOF(clrPresets))
+ if (lpMeasureItem->itemID >= IDM_COLORPRESET_BG && lpMeasureItem->itemID <= IDM_COLORPRESET_BG+_countof(clrPresets))
{
MeasureColorPresetMenuItem(hdlg, lpMeasureItem, clrPresets + (lpMeasureItem->itemID - IDM_COLORPRESET_BG));
return TRUE;
}
- else if (lpMeasureItem->itemID >= IDM_COLORPRESET_FG && lpMeasureItem->itemID <= IDM_COLORPRESET_FG+SIZEOF(clrPresets))
+ else if (lpMeasureItem->itemID >= IDM_COLORPRESET_FG && lpMeasureItem->itemID <= IDM_COLORPRESET_FG+_countof(clrPresets))
{
MeasureColorPresetMenuItem(hdlg, lpMeasureItem, clrPresets + (lpMeasureItem->itemID - IDM_COLORPRESET_FG));
return TRUE;
@@ -1424,12 +1424,12 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l
if (lpDrawItem->CtlType != ODT_MENU)
break;
- if (lpDrawItem->itemID >= IDM_COLORPRESET_BG && lpDrawItem->itemID <= IDM_COLORPRESET_BG+SIZEOF(clrPresets))
+ if (lpDrawItem->itemID >= IDM_COLORPRESET_BG && lpDrawItem->itemID <= IDM_COLORPRESET_BG+_countof(clrPresets))
{
PaintColorPresetMenuItem(lpDrawItem, clrPresets + (lpDrawItem->itemID - IDM_COLORPRESET_BG));
return TRUE;
}
- else if (lpDrawItem->itemID >= IDM_COLORPRESET_FG && lpDrawItem->itemID <= IDM_COLORPRESET_FG+SIZEOF(clrPresets))
+ else if (lpDrawItem->itemID >= IDM_COLORPRESET_FG && lpDrawItem->itemID <= IDM_COLORPRESET_FG+_countof(clrPresets))
{
PaintColorPresetMenuItem(lpDrawItem, clrPresets + (lpDrawItem->itemID - IDM_COLORPRESET_FG));
return TRUE;
@@ -1459,7 +1459,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l
H = SN->REHwnd;
- if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG+SIZEOF(clrPresets))
+ if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG+_countof(clrPresets))
{
SN->BgColor = clrPresets[id-IDM_COLORPRESET_BG].color | 0xff000000;
SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff);
@@ -1467,7 +1467,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l
JustSaveNotes();
return FALSE;
}
- else if (id >= IDM_COLORPRESET_FG && id <= IDM_COLORPRESET_FG+SIZEOF(clrPresets))
+ else if (id >= IDM_COLORPRESET_FG && id <= IDM_COLORPRESET_FG+_countof(clrPresets))
{
CHARFORMAT CF = {0};
SN->FgColor = clrPresets[id-IDM_COLORPRESET_FG].color | 0xff000000;
@@ -2025,7 +2025,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM
switch (NM->hdr.code)
{
case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, SIZEOF(g_notesListColGeom));
+ UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, _countof(g_notesListColGeom));
break;
}
}
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp
index 71c6e76902..fe5590f7a3 100644
--- a/plugins/NotesAndReminders/src/options.cpp
+++ b/plugins/NotesAndReminders/src/options.cpp
@@ -230,21 +230,21 @@ void RegisterFontServiceFonts()
FontIDT fontid = {0};
fontid.cbSize = sizeof(FontIDT);
- _tcsncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group));
- _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) );
- strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
+ _tcsncpy(fontid.group, _T(SECTIONNAME), _countof(fontid.group));
+ _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), _countof(fontid.backgroundGroup) );
+ strncpy(fontid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup));
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
HDC hDC = GetDC(NULL);
int nFontScale = GetDeviceCaps(hDC, LOGPIXELSY);
ReleaseDC(NULL, hDC);
- for (int i = 0; i < SIZEOF(fontOptionsList); i++)
+ for (int i = 0; i < _countof(fontOptionsList); i++)
{
fontid.order = i;
mir_snprintf(szTemp, "Font%d", i);
- strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix));
- _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
+ strncpy(fontid.prefix, szTemp, _countof(fontid.prefix));
+ _tcsncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name));
fontid.deffontsettings.colour = fontOptionsList[i].defColour;
fontid.deffontsettings.size = (char)-MulDiv(fontOptionsList[i].defSize, nFontScale, 72);
@@ -252,8 +252,8 @@ void RegisterFontServiceFonts()
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace);
- _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace));
- _tcsncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fontid.backgroundName));
+ _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace));
+ _tcsncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, _countof(fontid.backgroundName));
FontRegisterT(&fontid);
}
@@ -261,16 +261,16 @@ void RegisterFontServiceFonts()
ColourIDT colorid = {0};
colorid.cbSize = sizeof(ColourIDT);
- _tcsncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group));
- strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
+ _tcsncpy(colorid.group, _T(SECTIONNAME), _countof(colorid.group));
+ strncpy(colorid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup));
colorid.flags = 0;
- for (int i = 0; i < SIZEOF(colourOptionsList); i++)
+ for (int i = 0; i < _countof(colourOptionsList); i++)
{
colorid.order = i;
- _tcsncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name));
+ _tcsncpy(colorid.name, colourOptionsList[i].szName, _countof(colorid.name));
colorid.defcolour = colourOptionsList[i].defColour;
- strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting));
+ strncpy(colorid.setting, colourOptionsList[i].szSettingName, _countof(colorid.setting));
ColourRegisterT(&colorid);
}
@@ -284,8 +284,8 @@ void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour)
FontIDT fontid = {0};
fontid.cbSize = sizeof(fontid);
- _tcsncpy(fontid.group, LPGENT(SECTIONNAME), SIZEOF(fontid.group));
- _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
+ _tcsncpy(fontid.group, LPGENT(SECTIONNAME), _countof(fontid.group));
+ _tcsncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name));
COLORREF col = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)lf);
@@ -360,9 +360,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar
SendDlgItemMessage(hdlg,IDC_COMBODATE,CB_RESETCONTENT,0,0);
SendDlgItemMessage(hdlg,IDC_COMBOTIME,CB_RESETCONTENT,0,0);
- for (i=0; i<SIZEOF(dateFormats); i++)
+ for (i=0; i<_countof(dateFormats); i++)
SendDlgItemMessage(hdlg,IDC_COMBODATE,CB_ADDSTRING,0,(LPARAM)dateFormats[i].lpszUI);
- for (i=0; i<SIZEOF(timeFormats); i++)
+ for (i=0; i<_countof(timeFormats); i++)
SendDlgItemMessage(hdlg,IDC_COMBOTIME,CB_ADDSTRING,0,(LPARAM)timeFormats[i].lpszUI);
SendDlgItemMessage(hdlg,IDC_COMBODATE,CB_ADDSTRING,0,(LPARAM)Translate("None"));
SendDlgItemMessage(hdlg,IDC_COMBOTIME,CB_ADDSTRING,0,(LPARAM)Translate("None"));
@@ -467,7 +467,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar
ofn.hwndOwner = hdlg;
ofn.lpstrFilter = TranslateT("Executable Files\0*.exe\0All Files\0*.*\0\0");
ofn.lpstrFile = s;
- ofn.nMaxFile = SIZEOF(s);
+ ofn.nMaxFile = _countof(s);
ofn.lpstrTitle = TranslateT("Select Executable");
ofn.lpstrInitialDir = _T(".");
ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_ENABLESIZING | OFN_DONTADDTORECENT;
@@ -573,10 +573,10 @@ void InitSettings(void)
g_CloseAfterAddReminder = (BOOL)db_get_dw(0,MODULENAME,"CloseAfterAddReminder",1);
g_UseDefaultPlaySound = !(BOOL)db_get_dw(0,MODULENAME,"UseMCI",1);
- ReadSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,SIZEOF(g_reminderListGeom));
- ReadSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,SIZEOF(g_reminderListColGeom));
- ReadSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,SIZEOF(g_notesListGeom));
- ReadSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,SIZEOF(g_notesListColGeom));
+ ReadSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,_countof(g_reminderListGeom));
+ ReadSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,_countof(g_reminderListColGeom));
+ ReadSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,_countof(g_notesListGeom));
+ ReadSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,_countof(g_notesListColGeom));
BodyColor = db_get_dw(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
@@ -594,13 +594,13 @@ void TermSettings(void)
{
if (g_reminderListGeom[2] > 0 && g_reminderListGeom[3] > 0)
{
- WriteSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,SIZEOF(g_reminderListGeom));
- WriteSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,SIZEOF(g_reminderListColGeom));
+ WriteSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,_countof(g_reminderListGeom));
+ WriteSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,_countof(g_reminderListColGeom));
}
if (g_notesListGeom[2] > 0 && g_notesListGeom[3] > 0)
{
- WriteSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,SIZEOF(g_notesListGeom));
- WriteSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,SIZEOF(g_notesListColGeom));
+ WriteSettingIntArray(0,MODULENAME,"NotesListGeom",g_notesListGeom,_countof(g_notesListGeom));
+ WriteSettingIntArray(0,MODULENAME,"NotesListColGeom",g_notesListColGeom,_countof(g_notesListColGeom));
}
if (g_lpszAltBrowser)
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index be97aea7cb..192ea34e5c 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -215,7 +215,7 @@ void PurgeReminders(void)
ReminderCount = db_get_dw(0,MODULENAME,"RemindersData",0);
for(I = 0;I < ReminderCount;I++)
{
- mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I);
db_unset(0, MODULENAME, ValueName);
}
}
@@ -287,7 +287,7 @@ void JustSaveReminders(void)
Value[0xffff] = 0;
}
- mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", ReminderCount - I - 1); // do not want to reverse in DB
+ mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", ReminderCount - I - 1); // do not want to reverse in DB
db_set_blob(0, MODULENAME, ValueName, Value, n+1);
@@ -297,7 +297,7 @@ void JustSaveReminders(void)
// delete any left over DB reminder entries
for(; I < OldReminderCount; I++)
{
- mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I);
db_unset(0, MODULENAME, ValueName);
}
}
@@ -317,7 +317,7 @@ void LoadReminders(void)
{
Size = 65535;
Value = NULL;
- mir_snprintf(ValueName, SIZEOF(ValueName), "RemindersData%d", I);
+ mir_snprintf(ValueName, _countof(ValueName), "RemindersData%d", I);
ReadSettingBlob(0, MODULENAME, ValueName, &Size, (void**)&Value);
@@ -607,7 +607,7 @@ INT_PTR OpenTriggeredReminder(WPARAM w, LPARAM l)
pReminder->handle = H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), 0, DlgProcNotifyReminder);
- mir_snprintf(S, SIZEOF(S), "%s! - %s", Translate("Reminder"), S1);
+ mir_snprintf(S, _countof(S), "%s! - %s", Translate("Reminder"), S1);
SetWindowText(H, S);
if (pReminder->Reminder)
@@ -642,7 +642,7 @@ static void SkinPlaySoundPoly(LPCSTR pszSoundName)
char szShort[MAX_PATH];
char s[512];
GetShortPathNameA(szFull, szShort, sizeof(szShort));
- mir_snprintf(s, SIZEOF(s), "play \"%s\"", szShort);
+ mir_snprintf(s, _countof(s), "play \"%s\"", szShort);
mciSendStringA(s, NULL, 0, NULL);
}
@@ -1055,7 +1055,7 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S
const int m = (i&1) ? 30 : 0;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
- mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
+ mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
// item data contains time offset from midnight in seconds (bit 31 is set to flag that
// combo box items are absolute times and not relative times like below
@@ -1086,35 +1086,35 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
wCurHour = tm2.wHour;
wCurMinute = tm2.wMinute;
- mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
+ mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC));
// 5 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (5 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%02d:%02d (5 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC));
// 10 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (10 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%02d:%02d (10 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC));
// 15 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (15 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%02d:%02d (15 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC));
// 30 minutes
li.QuadPart += (ULONGLONG)15 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (30 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%02d:%02d (30 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, lpszMinutes);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart-ref)/FILETIME_TICKS_PER_SEC));
@@ -1142,13 +1142,13 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S
}
// icq-style display 1.0, 1.5 etc. hours even though that isn't accurate due to rounding
- //mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, 1+(i>>1), (i&1) ? 5 : 0, lpszHours);
+ //mir_snprintf(s, _countof(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, 1+(i>>1), (i&1) ? 5 : 0, lpszHours);
// display delta time more accurately to match reformatting (that icq doesn't do)
dt = (UINT)((li.QuadPart/MinutesToFileTime) - (ref/MinutesToFileTime));
if (dt < 60)
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%02d:%02d (%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt, lpszMinutes);
else
- mir_snprintf(s, SIZEOF(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt/60, ((dt%60)*10)/60, lpszHours);
+ mir_snprintf(s, _countof(s), "%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt/60, ((dt%60)*10)/60, lpszHours);
n = SendDlgItemMessage(Dialog,nIDTime,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDTime,CB_SETITEMDATA,n, dt*60);
@@ -1179,39 +1179,39 @@ static void PopulateTimeOffsetCombo(HWND Dialog, UINT nIDCombo)
// 5 - 55 minutes (in 5 minute steps)
for (i = 1; i < 12; i++)
{
- mir_snprintf(s, SIZEOF(s), "%d %s", i*5, lpszMinutes);
+ mir_snprintf(s, _countof(s), "%d %s", i*5, lpszMinutes);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA,n, i*5);
}
// 1 hour
- mir_snprintf(s, SIZEOF(s), "1 %s", lpszHour);
+ mir_snprintf(s, _countof(s), "1 %s", lpszHour);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 60);
// 2, 4, 8 hours
for (i = 2; i <= 8; i+=2)
{
- mir_snprintf(s, SIZEOF(s), "%d %s", i, lpszHours);
+ mir_snprintf(s, _countof(s), "%d %s", i, lpszHours);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, i*60);
}
// 1 day
- mir_snprintf(s, SIZEOF(s), "1 %s", lpszDay);
+ mir_snprintf(s, _countof(s), "1 %s", lpszDay);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 24*60);
// 2-4 days
for (i = 2; i <= 4; i++)
{
- mir_snprintf(s, SIZEOF(s), "%d %s", i, lpszDays);
+ mir_snprintf(s, _countof(s), "%d %s", i, lpszDays);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, i*24*60);
}
// 1 week
- mir_snprintf(s, SIZEOF(s), "1 %s", lpszWeek);
+ mir_snprintf(s, _countof(s), "1 %s", lpszWeek);
n = SendDlgItemMessage(Dialog,nIDCombo,CB_ADDSTRING,0,(LPARAM)s);
SendDlgItemMessage(Dialog,nIDCombo,CB_SETITEMDATA, n, 7*24*60);
}
@@ -1570,7 +1570,7 @@ INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog,UINT Message,WPARAM wParam,LP
// which could potentially mess up things otherwise)
{
char s[32];
- mir_snprintf(s, SIZEOF(s), "%I64x", li.QuadPart);
+ mir_snprintf(s, _countof(s), "%I64x", li.QuadPart);
SetDlgItemText(Dialog, IDC_REFTIME, s);
}
@@ -1915,7 +1915,7 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA
// which could potentially mess up things otherwise)
{
char s[32];
- mir_snprintf(s, SIZEOF(s), "%I64x", li.QuadPart);
+ mir_snprintf(s, _countof(s), "%I64x", li.QuadPart);
SetDlgItemText(Dialog, IDC_REFTIME, s);
}
@@ -1938,7 +1938,7 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA
{
int n;
char s[32];
- mir_snprintf(s, SIZEOF(s), "%02d:%02d", (UINT)tm.wHour, (UINT)tm.wMinute);
+ mir_snprintf(s, _countof(s), "%02d:%02d", (UINT)tm.wHour, (UINT)tm.wMinute);
// search for preset first
n = SendDlgItemMessage(Dialog, IDC_TIME, CB_FINDSTRING, (WPARAM)-1, (LPARAM)s);
@@ -1966,33 +1966,33 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA
n = SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)Translate("Never"));
SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_SETITEMDATA, n, 0);
- mir_snprintf(s, SIZEOF(s), "%s 5 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 5 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)5);
- mir_snprintf(s, SIZEOF(s), "%s 10 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 10 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)10);
- mir_snprintf(s, SIZEOF(s), "%s 15 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 15 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)15);
- mir_snprintf(s, SIZEOF(s), "%s 20 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 20 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)20);
- mir_snprintf(s, SIZEOF(s), "%s 30 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 30 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog,IDC_COMBO_REPEATSND,CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)30);
- mir_snprintf(s, SIZEOF(s), "%s 60 %s", lpszEvery, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s 60 %s", lpszEvery, lpszSeconds);
n = SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_ADDSTRING, 0, (LPARAM)s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETITEMDATA, n, (LPARAM)60);
if (NewReminderVisible == 2 && pEditReminder->RepeatSound)
{
- mir_snprintf(s, SIZEOF(s), "%s %d %s", lpszEvery, pEditReminder->RepeatSound, lpszSeconds);
+ mir_snprintf(s, _countof(s), "%s %d %s", lpszEvery, pEditReminder->RepeatSound, lpszSeconds);
SetDlgItemText(Dialog, IDC_COMBO_REPEATSND, s);
SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_SETCURSEL, SendDlgItemMessage(Dialog, IDC_COMBO_REPEATSND, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)s), 0);
}
@@ -2489,7 +2489,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA
switch (NM->hdr.code)
{
case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, SIZEOF(g_reminderListColGeom));
+ UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, _countof(g_reminderListColGeom));
break;
}
}
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp
index 51ceaef1df..109654a678 100644
--- a/plugins/NotifyAnything/src/options.cpp
+++ b/plugins/NotifyAnything/src/options.cpp
@@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
case NA_LOG_BROWSE:
if (HIWORD(wParam) == BN_CLICKED) {
TCHAR szTemp[MAX_PATH + 1], szTemp1[MAX_PATH + 1], szProfileDir[MAX_PATH + 1];
- GetDlgItemText(hwndDlg, NA_LOG_FILENAME, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(hwndDlg, NA_LOG_FILENAME, szTemp, _countof(szTemp));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szTemp;
@@ -108,7 +108,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
s.allow_execute = IsDlgButtonChecked(hwndDlg, NA_ALLOW_EXECUTE) != BST_UNCHECKED;
TCHAR buf[1000];
- if (!GetDlgItemText(hwndDlg, NA_PORT, buf, SIZEOF(buf)))
+ if (!GetDlgItemText(hwndDlg, NA_PORT, buf, _countof(buf)))
buf[0] = '\0';
int port = _ttoi(buf);
if (port <= 0 || port > 65535)
@@ -116,7 +116,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
else
s.port = port;
- if (!GetDlgItemText(hwndDlg, NA_PASSWORD, buf, SIZEOF(buf)))
+ if (!GetDlgItemText(hwndDlg, NA_PASSWORD, buf, _countof(buf)))
buf[0] = '\0';
s.password = buf;
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 8f627acfa2..b6d2a36aa4 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -50,7 +50,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
int diff = time(NULL) - db_get_dw(hContact, "Nudge", "LastSent", time(NULL) - 30);
if (diff < GlobalNudge.sendTimeSec) {
TCHAR msg[500];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
+ mir_sntprintf(msg, _countof(msg), TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
if (GlobalNudge.useByProtocol) {
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
@@ -207,8 +207,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
void LoadProtocols(void)
{
//Load the default nudge
- mir_snprintf(DefaultNudge.ProtocolName, SIZEOF(DefaultNudge.ProtocolName), "Default");
- mir_snprintf(DefaultNudge.NudgeSoundname, SIZEOF(DefaultNudge.NudgeSoundname), "Nudge : Default");
+ mir_snprintf(DefaultNudge.ProtocolName, _countof(DefaultNudge.ProtocolName), "Default");
+ mir_snprintf(DefaultNudge.NudgeSoundname, _countof(DefaultNudge.NudgeSoundname), "Nudge : Default");
SkinAddNewSoundEx(DefaultNudge.NudgeSoundname, LPGEN("Nudge"), LPGEN("Default Nudge"));
DefaultNudge.Load();
@@ -231,7 +231,7 @@ static IconItem iconList[] =
// Load icons
void LoadIcons(void)
{
- Icon_Register(hInst, LPGEN("Nudge"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Nudge"), iconList, _countof(iconList));
}
// Nudge support
@@ -513,7 +513,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto)
// Add a specific sound per protocol
CNudgeElement *p = new CNudgeElement();
- mir_snprintf(p->NudgeSoundname, SIZEOF(p->NudgeSoundname), "%s: Nudge", proto->szModuleName);
+ mir_snprintf(p->NudgeSoundname, _countof(p->NudgeSoundname), "%s: Nudge", proto->szModuleName);
strcpy_s(p->ProtocolName, proto->szModuleName);
_tcscpy_s(p->AccountName, proto->tszAccountName);
@@ -522,7 +522,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto)
p->hEvent = hevent;
TCHAR soundDesc[MAXMODULELABELLENGTH + 10];
- mir_sntprintf(soundDesc, SIZEOF(soundDesc), LPGENT("Nudge for %s"), proto->tszAccountName);
+ mir_sntprintf(soundDesc, _countof(soundDesc), LPGENT("Nudge for %s"), proto->tszAccountName);
SkinAddNewSoundExT(p->NudgeSoundname, LPGENT("Nudge"), soundDesc);
arNudges.insert(p);
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp
index 75dc07b063..f2817152ef 100644
--- a/plugins/Nudge/src/nudge.cpp
+++ b/plugins/Nudge/src/nudge.cpp
@@ -3,55 +3,55 @@
void CNudge::Save(void)
{
char SectionName[512];
- mir_snprintf(SectionName, SIZEOF(SectionName), "useByProtocol");
+ mir_snprintf(SectionName, _countof(SectionName), "useByProtocol");
db_set_b(NULL, MODULENAME, SectionName, this->useByProtocol);
- mir_snprintf(SectionName, SIZEOF(SectionName), "RecvTimeSec");
+ mir_snprintf(SectionName, _countof(SectionName), "RecvTimeSec");
db_set_dw(NULL, MODULENAME, SectionName, this->recvTimeSec);
- mir_snprintf(SectionName, SIZEOF(SectionName), "SendTimeSec");
+ mir_snprintf(SectionName, _countof(SectionName), "SendTimeSec");
db_set_dw(NULL, MODULENAME, SectionName, this->sendTimeSec);
- mir_snprintf(SectionName, SIZEOF(SectionName), "ResendDelaySec");
+ mir_snprintf(SectionName, _countof(SectionName), "ResendDelaySec");
db_set_dw(NULL, MODULENAME, SectionName, this->resendDelaySec);
}
void CNudge::Load(void)
{
char SectionName[512];
- mir_snprintf(SectionName, SIZEOF(SectionName), "useByProtocol");
+ mir_snprintf(SectionName, _countof(SectionName), "useByProtocol");
this->useByProtocol = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "RecvTimeSec");
+ mir_snprintf(SectionName, _countof(SectionName), "RecvTimeSec");
this->recvTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
- mir_snprintf(SectionName, SIZEOF(SectionName), "SendTimeSec");
+ mir_snprintf(SectionName, _countof(SectionName), "SendTimeSec");
this->sendTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
- mir_snprintf(SectionName, SIZEOF(SectionName), "ResendDelaySec");
+ mir_snprintf(SectionName, _countof(SectionName), "ResendDelaySec");
this->resendDelaySec = db_get_dw(NULL, MODULENAME, SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openMessageWindow", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-openMessageWindow", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->openMessageWindow);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openContactList", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-openContactList", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->openContactList);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-useIgnore", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-useIgnore", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->useIgnoreSettings);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showStatus", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-showStatus", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->showStatus);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showPopup", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-showPopup", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->showPopup);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeClist", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-shakeClist", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->shakeClist);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeChat", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-shakeChat", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->shakeChat);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-enabled", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-enabled", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->enabled);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-autoResend", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-autoResend", ProtocolName);
db_set_b(NULL, MODULENAME, SectionName, this->autoResend);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-statusFlags", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-statusFlags", ProtocolName);
db_set_dw(NULL, MODULENAME, SectionName, this->statusFlags);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-recText", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-recText", ProtocolName);
db_set_ts(NULL, MODULENAME, SectionName, this->recText);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-senText", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-senText", ProtocolName);
db_set_ts(NULL, MODULENAME, SectionName, this->senText);
}
@@ -59,28 +59,28 @@ void CNudgeElement::Load(void)
{
DBVARIANT dbv;
char SectionName[512];
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openMessageWindow", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-openMessageWindow", ProtocolName);
this->openMessageWindow = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-openContactList", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-openContactList", ProtocolName);
this->openContactList = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-useIgnore", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-useIgnore", ProtocolName);
this->useIgnoreSettings = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showStatus", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-showStatus", ProtocolName);
this->showStatus = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-showPopup", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-showPopup", ProtocolName);
this->showPopup = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeClist", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-shakeClist", ProtocolName);
this->shakeClist = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-shakeChat", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-shakeChat", ProtocolName);
this->shakeChat = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-enabled", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-enabled", ProtocolName);
this->enabled = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-autoResend", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-autoResend", ProtocolName);
this->autoResend = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-statusFlags", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-statusFlags", ProtocolName);
this->statusFlags = db_get_dw(NULL, MODULENAME, SectionName, 967);
- mir_snprintf(SectionName,SIZEOF(SectionName),"%s-recText", ProtocolName);
+ mir_snprintf(SectionName,_countof(SectionName),"%s-recText", ProtocolName);
if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) {
_tcsncpy(this->recText, dbv.ptszVal, TEXT_LEN);
if (_tcsclen(this->recText) < 1)
@@ -89,7 +89,7 @@ void CNudgeElement::Load(void)
}
else _tcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
- mir_snprintf(SectionName, SIZEOF(SectionName), "%s-senText", ProtocolName);
+ mir_snprintf(SectionName, _countof(SectionName), "%s-senText", ProtocolName);
if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) {
_tcsncpy(this->senText, dbv.ptszVal, TEXT_LEN);
if (_tcsclen(this->senText) < 1)
diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp
index fb5f98a8ad..4d428e92b7 100644
--- a/plugins/Nudge/src/options.cpp
+++ b/plugins/Nudge/src/options.cpp
@@ -94,14 +94,14 @@ static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
TranslateDialogDefault(hwnd);
{
TCHAR szBuf[20];
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), shake.nMoveClist);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%d"), shake.nMoveClist);
SetDlgItemText(hwnd, IDC_LNUMBER_CLIST, szBuf);
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), shake.nMoveChat);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%d"), shake.nMoveChat);
SetDlgItemText(hwnd, IDC_LNUMBER_CHAT, szBuf);
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), shake.nScaleClist);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%d"), shake.nScaleClist);
SetDlgItemText(hwnd, IDC_LSCALE_CLIST, szBuf);
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), shake.nScaleChat);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%d"), shake.nScaleChat);
SetDlgItemText(hwnd, IDC_LSCALE_CHAT, szBuf);
}
@@ -132,7 +132,7 @@ static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
{
TCHAR szBuf[20];
DWORD dwPos = SendMessage((HWND)lParam, TBM_GETPOS, 0, 0);
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%d"), dwPos);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%d"), dwPos);
if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST))
SetDlgItemText(hwnd, IDC_LNUMBER_CLIST, szBuf);
if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT))
diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp
index b224ca5393..1219db8b77 100644
--- a/plugins/OpenFolder/src/openFolder.cpp
+++ b/plugins/OpenFolder/src/openFolder.cpp
@@ -30,7 +30,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
static INT_PTR MenuCommand_OpenFolder(WPARAM, LPARAM)
{
TCHAR szMirandaPath[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, _countof(szMirandaPath));
TCHAR *p = _tcsrchr(szMirandaPath, '\\');
if (p)
p[1] = 0;
@@ -64,7 +64,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
HICON LoadIconExEx(const char* IcoLibName, int NonIcoLibIcon)
{
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", OPENFOLDER_MODULE_NAME, IcoLibName);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", OPENFOLDER_MODULE_NAME, IcoLibName);
return IcoLib_GetIcon(szSettingName);
}
diff --git a/plugins/OpenSSL/src/ssl_openssl.cpp b/plugins/OpenSSL/src/ssl_openssl.cpp
index 7884af8da4..6a50102bd6 100644
--- a/plugins/OpenSSL/src/ssl_openssl.cpp
+++ b/plugins/OpenSSL/src/ssl_openssl.cpp
@@ -267,11 +267,11 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool showPopup = fal
break;
default:
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL);
}
TCHAR szMsgBuf2[512];
- mir_sntprintf(szMsgBuf2, SIZEOF(szMsgBuf2), _T("SSL connection failure (%x %u): %s"), scRet, line, szMsgBuf);
+ mir_sntprintf(szMsgBuf2, _countof(szMsgBuf2), _T("SSL connection failure (%x %u): %s"), scRet, line, szMsgBuf);
char* szMsg = Utf8EncodeT(szMsgBuf2);
SslLog(szMsg);
@@ -432,7 +432,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF
ChainPara.cbSize = sizeof(ChainPara);
ChainPara.RequestedUsage.dwType = USAGE_MATCH_TYPE_OR;
- ChainPara.RequestedUsage.Usage.cUsageIdentifier = SIZEOF(rgszUsages);
+ ChainPara.RequestedUsage.Usage.cUsageIdentifier = _countof(rgszUsages);
ChainPara.RequestedUsage.Usage.rgpszUsageIdentifier = rgszUsages;
if (!g_Crypt.CertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore,
&ChainPara, 0, NULL, &pChainContext))
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index c0157b32fa..4af9065bf3 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -96,11 +96,11 @@ static VOID MakePopupAction(POPUPACTION &pa, INT id)
switch (id) {
case IDYES:
pa.lchIcon = IcoLib_GetIcon("btn_ok");
- strncpy_s(pa.lpzTitle, MODNAME"/Yes", SIZEOF(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODNAME"/Yes", _countof(pa.lpzTitle));
break;
case IDNO:
pa.lchIcon = IcoLib_GetIcon("btn_cancel");
- strncpy_s(pa.lpzTitle, MODNAME"/No", SIZEOF(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODNAME"/No", _countof(pa.lpzTitle));
break;
}
}
@@ -115,8 +115,8 @@ VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType)
pd.cbSize = sizeof(pd);
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = Skin_LoadIcon(PopupsList[Number].Icon);
- mir_tstrncpy(pd.lptzText, Text, SIZEOF(pd.lptzText));
- mir_tstrncpy(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, Text, _countof(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, Title, _countof(pd.lptzContactName));
switch (MyOptions.DefColors) {
case byCOLOR_WINDOWS:
pd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -179,7 +179,7 @@ static void __stdcall CreateDownloadDialog(void*)
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
- mir_tstrncpy(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
+ mir_tstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
}
@@ -349,33 +349,33 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
if (todo[i].enabled) {
switch (todo[i].FileType) {
case 1:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Pack"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Pack"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 2:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Plugins"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Plugins"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 3:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Icons"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Icons"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 4:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
case 5:
- mir_sntprintf(tszFileDest, SIZEOF(tszFileDest), _T("%s\\Others"), tszRoot);
+ mir_sntprintf(tszFileDest, _countof(tszFileDest), _T("%s\\Others"), tszRoot);
CreateDirectory(tszFileDest, NULL);
break;
default:
- mir_tstrncpy(tszFileDest, tszRoot, SIZEOF(tszFileDest));
+ mir_tstrncpy(tszFileDest, tszRoot, _countof(tszFileDest));
break;
}
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\Backups"), tszRoot);
CreateDirectory(tszBuff, NULL);
- mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
- mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
+ mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, _countof(tszFileName));
+ mir_sntprintf(todo[i].File.tszDiskPath, _countof(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
UpdatesCount++;
tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL) - 5];
@@ -399,8 +399,8 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
continue;
}
}
- mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
+ mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
+ mir_snprintf(szKey, _countof(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
arFilePath.push_back(todo[i].File.tszDiskPath);
@@ -413,9 +413,9 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
}
if (UpdatesCount > 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
else if (UpdatesCount == 1 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), _countof(tszBuff));
if (UpdatesCount > 0 && mir_tstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
INT rc = -1;
Title = TranslateT("Pack Updater");
@@ -452,10 +452,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
case 2:
tszUtilRootPlug = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins"));
if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootPlug);
@@ -465,10 +465,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
case 3:
tszUtilRootIco = Utils_ReplaceVarsT(_T("%miranda_path%\\Icons"));
if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRootIco);
@@ -478,10 +478,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
case 4:
tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRoot);
@@ -491,10 +491,10 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
case 5:
tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
if (mir_tstrcmp(arAdvFolder[i].c_str(), _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, arFileName[i].c_str());
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
- mir_sntprintf(tszFilePathBack, SIZEOF(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, arAdvFolder[i].c_str(), arFileName[i].c_str());
+ mir_sntprintf(tszFilePathBack, _countof(tszFilePathBack), _T("%s\\Backups\\%s"), tszRoot, arFileName[i].c_str());
MoveFile(tszFilePathDest, tszFilePathBack);
MoveFile(arFilePath[i].c_str(), tszFilePathDest);
mir_free(tszUtilRoot);
@@ -505,7 +505,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
db_set_b(NULL, MODNAME, "Reminder", 2);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
+ mir_sntprintf(tszBuff, _countof(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index 56a35e8ecf..6d3a8588da 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, MyOptions.Timeout, TRUE);
//Mouse actions
- for (i = 0; i < SIZEOF(PopupActions); i++) {
+ for (i = 0; i < _countof(PopupActions); i++) {
SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
@@ -204,7 +204,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Popups nitified
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
- mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
+ mir_snprintf(str2, _countof(str2), "Popups%dM", i);
CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i + 40071)))
@@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
- mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
+ mir_snprintf(str2, _countof(str2), "Popups%dM", i);
db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp
index c7987a96e0..4438634c52 100644
--- a/plugins/PackUpdater/Src/PackUpdater.cpp
+++ b/plugins/PackUpdater/Src/PackUpdater.cpp
@@ -55,7 +55,7 @@ extern "C" __declspec(dllexport) int Load(void)
mir_getLP(&pluginInfoEx);
TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER));
- mir_tstrncpy(tszRoot, tszFolder, SIZEOF(tszRoot));
+ mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot));
hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
if (hPackUpdaterFolder)
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index 2b118cc3cf..4706dda99c 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -43,7 +43,7 @@ IconItem iconList[] =
VOID IcoLibInit()
{
- Icon_Register(hInst, MODULEA, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, MODULEA, iconList, _countof(iconList));
}
BOOL NetlibInit()
@@ -205,10 +205,10 @@ static void CheckUpdates(void *)
}
// Download version info
pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl));
- mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, SIZEOF(pFileUrl->tszDownloadURL));
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\tmp.ini"), tszRoot);
- mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath));
- mir_tstrncpy(tszTmpIni, tszBuff, SIZEOF(tszTmpIni));
+ mir_tstrncpy(pFileUrl->tszDownloadURL, tszDownloadURL, _countof(pFileUrl->tszDownloadURL));
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%s\\tmp.ini"), tszRoot);
+ mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, _countof(pFileUrl->tszDiskPath));
+ mir_tstrncpy(tszTmpIni, tszBuff, _countof(tszTmpIni));
Title = TranslateT("Pack Updater");
Text = TranslateT("Downloading version info...");
DlgDownloadProc();
@@ -221,29 +221,29 @@ static void CheckUpdates(void *)
for (CurrentFile = 0; CurrentFile < FileCount; CurrentFile++) {
FILEINFO FileInfo = { _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), _T(""), { _T(""), _T("") } };
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
+ mir_snprintf(szKey, _countof(szKey), "File_%d_CurrentVersion", CurrentFile + 1);
ptrT tszCurVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszCurVer)
- mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, SIZEOF(FileInfo.tszCurVer));
+ mir_tstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
- mir_tstrncpy(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer));
+ mir_tstrncpy(FileInfo.tszCurVer, _T(""), _countof(FileInfo.tszCurVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
+ mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1);
ptrT tszLastVer(db_get_tsa(NULL, MODNAME, szKey));
if (tszLastVer)
- mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, SIZEOF(FileInfo.tszLastVer));
+ mir_tstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
- mir_tstrncpy(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer));
+ mir_tstrncpy(FileInfo.tszLastVer, _T(""), _countof(FileInfo.tszLastVer));
Files.push_back(FileInfo);
// Read version info
- mir_sntprintf(tszFileInfo, SIZEOF(tszFileInfo), _T("FileInfo_%d"), CurrentFile + 1);
- GetPrivateProfileString(tszFileInfo, _T("FileVersion"), _T(""), Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszNewVer), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("Message"), _T(""), Files[CurrentFile].tszMessage, SIZEOF(Files[CurrentFile].tszMessage), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("DownloadURL"), _T(""), Files[CurrentFile].File.tszDownloadURL, SIZEOF(Files[CurrentFile].File.tszDownloadURL), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("AdvFolder"), _T(""), Files[CurrentFile].tszAdvFolder, SIZEOF(Files[CurrentFile].tszAdvFolder), tszTmpIni);
- GetPrivateProfileString(tszFileInfo, _T("Descr"), _T(""), Files[CurrentFile].tszDescr, SIZEOF(Files[CurrentFile].tszDescr), tszTmpIni);
+ mir_sntprintf(tszFileInfo, _countof(tszFileInfo), _T("FileInfo_%d"), CurrentFile + 1);
+ GetPrivateProfileString(tszFileInfo, _T("FileVersion"), _T(""), Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszNewVer), tszTmpIni);
+ GetPrivateProfileString(tszFileInfo, _T("Message"), _T(""), Files[CurrentFile].tszMessage, _countof(Files[CurrentFile].tszMessage), tszTmpIni);
+ GetPrivateProfileString(tszFileInfo, _T("DownloadURL"), _T(""), Files[CurrentFile].File.tszDownloadURL, _countof(Files[CurrentFile].File.tszDownloadURL), tszTmpIni);
+ GetPrivateProfileString(tszFileInfo, _T("AdvFolder"), _T(""), Files[CurrentFile].tszAdvFolder, _countof(Files[CurrentFile].tszAdvFolder), tszTmpIni);
+ GetPrivateProfileString(tszFileInfo, _T("Descr"), _T(""), Files[CurrentFile].tszDescr, _countof(Files[CurrentFile].tszDescr), tszTmpIni);
GetPrivateProfileString(tszFileInfo, _T("DiskFileName"), _T(""), tszBuff, MAX_PATH, tszTmpIni);
if (_tcsstr(tszBuff, _T("\\"))) { //check update name
@@ -257,17 +257,17 @@ static void CheckUpdates(void *)
MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
- mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, SIZEOF(Files[CurrentFile].File.tszDiskPath));
- GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, SIZEOF(Files[CurrentFile].tszInfoURL), tszTmpIni);
+ mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, _countof(Files[CurrentFile].File.tszDiskPath));
+ GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, _countof(Files[CurrentFile].tszInfoURL), tszTmpIni);
Files[CurrentFile].FileType = GetPrivateProfileInt(tszFileInfo, _T("FileType"), 0, tszTmpIni);
Files[CurrentFile].Force = GetPrivateProfileInt(tszFileInfo, _T("Force"), 0, tszTmpIni);
Files[CurrentFile].FileNum = CurrentFile + 1;
if (Files[CurrentFile].FileType == 2) {
if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0)
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("Plugins\\%s"), Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("Plugins\\%s\\%s"), Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("Plugins\\%s\\%s"), Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
TCHAR pluginFolderName[MAX_PATH];
PathToAbsoluteT(tszBuff, pluginFolderName);
if (!Files[CurrentFile].Force && (IsPluginDisabled(Files[CurrentFile].File.tszDiskPath) || !Exists(pluginFolderName))) //check if plugin disabled or not exists
@@ -294,26 +294,26 @@ static void CheckUpdates(void *)
case 2: {
VARST tszUtilRootPlug(_T("%miranda_path%\\Plugins"));
if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootPlug, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootPlug, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
case 3: {
VARST tszUtilRootIco(_T("%miranda_path%\\Icons"));
if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRootIco, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRootIco, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
case 4:
case 5: {
VARST tszUtilRoot = Utils_ReplaceVarsT(_T("%miranda_path%"));
if (mir_tstrcmp(Files[CurrentFile].tszAdvFolder, _T("")) == 0)
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s"), tszUtilRoot, Files[CurrentFile].File.tszDiskPath);
else
- mir_sntprintf(tszFilePathDest, SIZEOF(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
+ mir_sntprintf(tszFilePathDest, _countof(tszFilePathDest), _T("%s\\%s\\%s"), tszUtilRoot, Files[CurrentFile].tszAdvFolder, Files[CurrentFile].File.tszDiskPath);
}
break;
}//end* switch (Files[CurrentFile].FileType)
@@ -321,8 +321,8 @@ static void CheckUpdates(void *)
if (Files[CurrentFile].Force || Exists(tszFilePathDest))
UpdateFiles.push_back(Files[CurrentFile]);
// Save last version
- mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer));
- mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
+ mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
+ mir_snprintf(szKey, _countof(szKey), "File_%d_LastVersion", CurrentFile + 1);
db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
} //end checking all files in for ()
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp
index 197d03623b..f7547f8d8d 100644
--- a/plugins/PasteIt/src/Options.cpp
+++ b/plugins/PasteIt/src/Options.cpp
@@ -799,7 +799,7 @@ void Options::Save()
}
buf[j++] = '_';
- mir_strncpy(buf + j, "formats", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "formats", _countof(buf) - j);
std::wstring forms;
for (std::list<PasteFormat>::iterator it = webOptions[i]->formats.begin(); it != webOptions[i]->formats.end(); ++it)
{
@@ -808,30 +808,30 @@ void Options::Save()
db_set_ws(0, MODULE, buf, forms.c_str());
- mir_strncpy(buf + j, "defFormatId", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->defFormatId.c_str());
if (webOptions[i]->isSendFileName)
{
- mir_strncpy(buf + j, "sendFileName", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
db_set_b(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0);
}
if (webOptions[i]->isPublicPaste)
{
- mir_strncpy(buf + j, "publicPaste", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
db_set_b(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0);
}
if (webOptions[i]->isCombo1)
{
- mir_strncpy(buf + j, "combo1", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "combo1", _countof(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->combo1.c_str());
}
if (webOptions[i]->isPastebin)
{
- mir_strncpy(buf + j, "pastebinUserKey", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str());
}
}
@@ -868,7 +868,7 @@ void Options::Load()
}
buf[j++] = '_';
- mir_strncpy(buf + j, "formats", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "formats", _countof(buf) - j);
DBVARIANT forms;
if (!db_get_ws(0, MODULE, buf, &forms))
{
@@ -899,7 +899,7 @@ void Options::Load()
db_free(&forms);
}
- mir_strncpy(buf + j, "defFormatId", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
DBVARIANT defForm;
if (!db_get_ws(0, MODULE, buf, &defForm))
{
@@ -909,19 +909,19 @@ void Options::Load()
if (webOptions[i]->isSendFileName)
{
- mir_strncpy(buf + j, "sendFileName", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
webOptions[i]->sendFileName = db_get_b(0, MODULE, buf, 1) ? true : false;
}
if (webOptions[i]->isPublicPaste)
{
- mir_strncpy(buf + j, "publicPaste", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
webOptions[i]->publicPaste = db_get_b(0, MODULE, buf, 0) ? true : false;
}
if (webOptions[i]->isCombo1)
{
- mir_strncpy(buf + j, "combo1", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "combo1", _countof(buf) - j);
DBVARIANT combo1;
if (!db_get_ws(0, MODULE, buf, &combo1))
{
@@ -932,7 +932,7 @@ void Options::Load()
if (webOptions[i]->isPastebin)
{
- mir_strncpy(buf + j, "pastebinUserKey", SIZEOF(buf) - j);
+ mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
DBVARIANT pastebinUserKey;
if (!db_get_ws(0, MODULE, buf, &pastebinUserKey))
{
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 64d458b51b..fce900c8dc 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -72,7 +72,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
std::wstring GetFile()
{
TCHAR filter[512];
- mir_tstrncpy(filter, TranslateT("All Files (*.*)"), SIZEOF(filter));
+ mir_tstrncpy(filter, TranslateT("All Files (*.*)"), _countof(filter));
memcpy(filter + mir_tstrlen(filter), _T("\0*.*\0"), 6 * sizeof(TCHAR));
TCHAR stzFilePath[1024];
stzFilePath[0] = 0;
@@ -84,7 +84,7 @@ std::wstring GetFile()
ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = TranslateT("Paste It - Select file");
- ofn.nMaxFile = SIZEOF(stzFilePath);
+ ofn.nMaxFile = _countof(stzFilePath);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
if (GetOpenFileName(&ofn))
{
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp
index 9b7a846d07..52f7c8f147 100644
--- a/plugins/PasteIt/src/PasteToWeb.cpp
+++ b/plugins/PasteIt/src/PasteToWeb.cpp
@@ -384,7 +384,7 @@ void PasteToWeb::FromFile(std::wstring file)
{
if (fileSize.QuadPart > 512000LL)
{
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
if (MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
{
CloseHandle(hFile);
@@ -399,7 +399,7 @@ void PasteToWeb::FromFile(std::wstring file)
mir_free(fromFileData.content);
fromFileData.content = NULL;
fromFileData.contentLen = 0;
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Cannot read file '%s'"), file.c_str());
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("Cannot read file '%s'"), file.c_str());
error = bufErr;
}
}
@@ -413,7 +413,7 @@ void PasteToWeb::FromFile(std::wstring file)
}
else
{
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Cannot open file '%s'"), file.c_str());
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("Cannot open file '%s'"), file.c_str());
error = bufErr;
}
@@ -491,7 +491,7 @@ void PasteToWeb::FromFile(std::wstring file)
}
else
{
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("File '%s' is empty"), file.c_str());
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("File '%s' is empty"), file.c_str());
error = bufErr;
}
mir_free(fromFileData.content);
diff --git a/plugins/PasteIt/src/PasteToWeb1.cpp b/plugins/PasteIt/src/PasteToWeb1.cpp
index 032a7219e2..ecf6dd2055 100644
--- a/plugins/PasteIt/src/PasteToWeb1.cpp
+++ b/plugins/PasteIt/src/PasteToWeb1.cpp
@@ -304,13 +304,13 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst
{
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Error during sending text to web page: %s"), resCont + 17);
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("Error during sending text to web page: %s"), resCont + 17);
error = bufErr;
}
else
{
char* s = mir_u2a_cp(resCont, CP_ACP);
- mir_strncpy(szFileLink, s, SIZEOF(szFileLink));
+ mir_strncpy(szFileLink, s, _countof(szFileLink));
mir_free(s);
}
mir_free(resCont);
@@ -336,7 +336,7 @@ std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password)
{
if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
- mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Error during getting user key from web page: %s"), resCont + 17);
+ mir_sntprintf(bufErr, _countof(bufErr), TranslateT("Error during getting user key from web page: %s"), resCont + 17);
MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR);
}
else
diff --git a/plugins/PasteIt/src/PasteToWeb2.cpp b/plugins/PasteIt/src/PasteToWeb2.cpp
index a7f4c3f0fe..e14db0a966 100644
--- a/plugins/PasteIt/src/PasteToWeb2.cpp
+++ b/plugins/PasteIt/src/PasteToWeb2.cpp
@@ -121,7 +121,7 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst
if (node != NULL)
{
char* s = mir_t2a_cp(xi.getText(node), CP_ACP);
- mir_strncpy(szFileLink, s, SIZEOF(szFileLink));
+ mir_strncpy(szFileLink, s, _countof(szFileLink));
mir_free(s);
error = NULL;
}
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp
index 84dd47d272..88d7dfcf87 100644
--- a/plugins/Ping/src/icmp.cpp
+++ b/plugins/Ping/src/icmp.cpp
@@ -68,7 +68,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply)
{
char winmsg[512], msg[1024];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, 0, winmsg, 512, 0);
- mir_snprintf(msg, SIZEOF(msg), "Ping error (%d): %s", code, winmsg);
+ mir_snprintf(msg, _countof(msg), "Ping error (%d): %s", code, winmsg);
PUShowMessage(msg, SM_NOTIFY);
return false;
}
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp
index 0e99ed7778..7fd6912da9 100644
--- a/plugins/Ping/src/options.cpp
+++ b/plugins/Ping/src/options.cpp
@@ -82,12 +82,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_BTN_LOGBROWSE:
{
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s%c*.txt%c%s%c*.*%c"), TranslateT("Text Files (*.txt)"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s%c*.txt%c%s%c*.*%c"), TranslateT("Text Files (*.txt)"), 0, 0, TranslateT("All Files"), 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = options.log_filename;
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = SIZEOF(options.log_filename);
+ ofn.nMaxFile = _countof(options.log_filename);
ofn.lpstrTitle = TranslateT("Open log file");
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
@@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
options.block_reps = IsDlgButtonChecked(hwndDlg, IDC_CHK_BLOCK) == BST_CHECKED;
options.logging = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG) == BST_CHECKED;
options.log_csv = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOGCSV) == BST_CHECKED;
- GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, SIZEOF(options.log_filename));
+ GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, _countof(options.log_filename));
options.no_test_icon = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOTESTICON) == BST_CHECKED;
@@ -233,14 +233,14 @@ INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_DESTPORT), IsDlgButtonChecked(hwndDlg, IDC_CHK_DESTTCP));
break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName, SIZEOF(add_edit_addr.pszName));
- GetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel, SIZEOF(add_edit_addr.pszLabel));
- GetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand, SIZEOF(add_edit_addr.pszCommand));
- GetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams, SIZEOF(add_edit_addr.pszParams));
+ GetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName, _countof(add_edit_addr.pszName));
+ GetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel, _countof(add_edit_addr.pszLabel));
+ GetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand, _countof(add_edit_addr.pszCommand));
+ GetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams, _countof(add_edit_addr.pszParams));
if (SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_GETCURSEL, 0, 0) != -1)
{
- GetDlgItemTextA(hwndDlg, IDC_COMBO_DESTPROTO, add_edit_addr.pszProto, SIZEOF(add_edit_addr.pszProto));
+ GetDlgItemTextA(hwndDlg, IDC_COMBO_DESTPROTO, add_edit_addr.pszProto, _countof(add_edit_addr.pszProto));
if (!mir_strcmp(add_edit_addr.pszProto, Translate("<none>")))
add_edit_addr.pszProto[0] = '\0';
else {
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp
index a1654e9f1d..3a4f5f26b6 100644
--- a/plugins/Ping/src/ping.cpp
+++ b/plugins/Ping/src/ping.cpp
@@ -151,7 +151,7 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
- Icon_Register(hInst, LPGEN("Ping"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Ping"), iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp
index 1947ada7bf..8e0b7d0846 100644
--- a/plugins/Ping/src/pinggraph.cpp
+++ b/plugins/Ping/src/pinggraph.cpp
@@ -276,10 +276,10 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
RegisterClass(&wndclass);
TCHAR title[256];
- mir_tstrncpy(title, TranslateT("Ping Graph"), SIZEOF(title));
+ mir_tstrncpy(title, TranslateT("Ping Graph"), _countof(title));
if (lParam) {
- mir_tstrncat(title, _T(" - "), SIZEOF(title) - mir_tstrlen(title));
- mir_tstrncat(title, (TCHAR *)lParam, SIZEOF(title) - mir_tstrlen(title));
+ mir_tstrncat(title, _T(" - "), _countof(title) - mir_tstrlen(title));
+ mir_tstrncat(title, (TCHAR *)lParam, _countof(title) - mir_tstrlen(title));
}
HWND parent = 0;
diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp
index cbd590c503..51aa6f73a3 100644
--- a/plugins/Ping/src/pinglist.cpp
+++ b/plugins/Ping/src/pinglist.cpp
@@ -116,13 +116,13 @@ bool read_ping_address(PINGADDRESS &pa) {
DBVARIANT dbv;
if (!db_get_ts(0, buff, "Address", &dbv)) {
- mir_tstrncpy(pa.pszName, dbv.ptszVal, SIZEOF(pa.pszName));
+ mir_tstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
db_free(&dbv);
}
else return false;
if (!db_get_ts(0, buff, "Label", &dbv)) {
- mir_tstrncpy(pa.pszLabel, dbv.ptszVal, SIZEOF(pa.pszLabel));
+ mir_tstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
db_free(&dbv);
}
else return false;
@@ -133,19 +133,19 @@ bool read_ping_address(PINGADDRESS &pa) {
pa.port = (int)db_get_dw(0, buff, "Port", -1);
if (!db_get_s(0, buff, "Proto", &dbv)) {
- mir_strncpy(pa.pszProto, dbv.pszVal, SIZEOF(pa.pszProto));
+ mir_strncpy(pa.pszProto, dbv.pszVal, _countof(pa.pszProto));
db_free(&dbv);
}
else pa.pszProto[0] = '\0';
if (!db_get_ts(0, buff, "Command", &dbv)) {
- mir_tstrncpy(pa.pszCommand, dbv.ptszVal, SIZEOF(pa.pszCommand));
+ mir_tstrncpy(pa.pszCommand, dbv.ptszVal, _countof(pa.pszCommand));
db_free(&dbv);
}
else
pa.pszCommand[0] = '\0';
if (!db_get_ts(0, buff, "CommandParams", &dbv)) {
- mir_tstrncpy(pa.pszParams, dbv.ptszVal, SIZEOF(pa.pszParams));
+ mir_tstrncpy(pa.pszParams, dbv.ptszVal, _countof(pa.pszParams));
db_free(&dbv);
}
else
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index c0465a06a0..71e4f54b16 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -115,9 +115,9 @@ void __cdecl sttCheckStatusThreadProc(void *vp)
pa.item_id = i->item_id;
pa.miss_count = i->miss_count;
pa.port = i->port;
- mir_tstrncpy(pa.pszLabel, i->pszLabel, SIZEOF(pa.pszLabel));
- mir_tstrncpy(pa.pszName, i->pszName, SIZEOF(pa.pszName));
- mir_strncpy(pa.pszProto, i->pszProto, SIZEOF(pa.pszProto));
+ mir_tstrncpy(pa.pszLabel, i->pszLabel, _countof(pa.pszLabel));
+ mir_tstrncpy(pa.pszName, i->pszName, _countof(pa.pszName));
+ mir_strncpy(pa.pszProto, i->pszProto, _countof(pa.pszProto));
pa.set_status = i->set_status;
pa.status = i->status;
break;
@@ -317,9 +317,9 @@ void CALLBACK TimerProc(
{
TCHAR TBcapt[255];
if (total > 0)
- mir_sntprintf(TBcapt, SIZEOF(TBcapt), _T("Ping (%d/%d)"), upCount, total);
+ mir_sntprintf(TBcapt, _countof(TBcapt), _T("Ping (%d/%d)"), upCount, total);
else
- mir_sntprintf(TBcapt, SIZEOF(TBcapt), _T("Ping"));
+ mir_sntprintf(TBcapt, _countof(TBcapt), _T("Ping"));
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt);
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBTIPNAME | FO_TCHAR, frame_id), (LPARAM)TBcapt);
@@ -1007,27 +1007,27 @@ void InitList()
{
font_id.cbSize = sizeof(FontIDT);
- mir_tstrncpy(font_id.group, LPGENT("Ping"), SIZEOF(font_id.group));
- mir_tstrncpy(font_id.name, LPGENT("List"), SIZEOF(font_id.name));
- mir_strncpy(font_id.dbSettingsGroup, "PING", SIZEOF(font_id.dbSettingsGroup));
- mir_strncpy(font_id.prefix, "Font", SIZEOF(font_id.prefix));
- mir_tstrncpy(font_id.backgroundGroup, _T("Ping"), SIZEOF(font_id.backgroundGroup));
- mir_tstrncpy(font_id.backgroundName, _T("Background"), SIZEOF(font_id.backgroundName));
+ mir_tstrncpy(font_id.group, LPGENT("Ping"), _countof(font_id.group));
+ mir_tstrncpy(font_id.name, LPGENT("List"), _countof(font_id.name));
+ mir_strncpy(font_id.dbSettingsGroup, "PING", _countof(font_id.dbSettingsGroup));
+ mir_strncpy(font_id.prefix, "Font", _countof(font_id.prefix));
+ mir_tstrncpy(font_id.backgroundGroup, _T("Ping"), _countof(font_id.backgroundGroup));
+ mir_tstrncpy(font_id.backgroundName, _T("Background"), _countof(font_id.backgroundName));
font_id.order = 0;
font_id.flags = FIDF_DEFAULTVALID;
font_id.deffontsettings.charset = DEFAULT_CHARSET;
font_id.deffontsettings.size = -14;
font_id.deffontsettings.style = 0;
font_id.deffontsettings.colour = RGB(255, 255, 255);
- mir_tstrncpy(font_id.deffontsettings.szFace, _T("Tahoma"), SIZEOF(font_id.deffontsettings.szFace));
+ mir_tstrncpy(font_id.deffontsettings.szFace, _T("Tahoma"), _countof(font_id.deffontsettings.szFace));
FontRegisterT(&font_id);
bk_col_id.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(bk_col_id.group, _T("Ping"), SIZEOF(bk_col_id.group));
- mir_tstrncpy(bk_col_id.name, _T("Background"), SIZEOF(bk_col_id.name));
- mir_strncpy(bk_col_id.dbSettingsGroup, "PING", SIZEOF(bk_col_id.dbSettingsGroup));
- mir_strncpy(bk_col_id.setting, "BgColor", SIZEOF(bk_col_id.setting));
+ mir_tstrncpy(bk_col_id.group, _T("Ping"), _countof(bk_col_id.group));
+ mir_tstrncpy(bk_col_id.name, _T("Background"), _countof(bk_col_id.name));
+ mir_strncpy(bk_col_id.dbSettingsGroup, "PING", _countof(bk_col_id.dbSettingsGroup));
+ mir_strncpy(bk_col_id.setting, "BgColor", _countof(bk_col_id.setting));
bk_col_id.defcolour = RGB(0, 0, 0);
ColourRegisterT(&bk_col_id);
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp
index aca8eab105..16adad8964 100644
--- a/plugins/Ping/src/utils.cpp
+++ b/plugins/Ping/src/utils.cpp
@@ -38,8 +38,8 @@ void __stdcall ShowPopup(TCHAR *line1, TCHAR *line2, int flags)
ppd->lchContact = NULL;
ppd->lchIcon = (flags ? hIconResponding : hIconNotResponding);
- mir_tstrncpy(ppd->lptzContactName, line1, SIZEOF(ppd->lptzContactName));
- mir_tstrncpy(ppd->lptzText, line2, SIZEOF(ppd->lptzText));
+ mir_tstrncpy(ppd->lptzContactName, line1, _countof(ppd->lptzContactName));
+ mir_tstrncpy(ppd->lptzText, line2, _countof(ppd->lptzText));
ppd->colorBack = GetSysColor(COLOR_BTNFACE);
ppd->colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -221,26 +221,26 @@ void import_ping_address(int index, PINGADDRESS &pa) {
char buf[256];
mir_snprintf(buf, "Address%d", index);
if (!db_get_ts(0, "PingPlug", buf, &dbv)) {
- mir_tstrncpy(pa.pszName, dbv.ptszVal, SIZEOF(pa.pszName));
+ mir_tstrncpy(pa.pszName, dbv.ptszVal, _countof(pa.pszName));
db_free(&dbv);
}
else
- mir_tstrncpy(pa.pszName, TranslateT("Unknown Address"), SIZEOF(pa.pszName));
+ mir_tstrncpy(pa.pszName, TranslateT("Unknown Address"), _countof(pa.pszName));
mir_snprintf(buf, "Label%d", index);
if (!db_get_ts(0, "PingPlug", buf, &dbv)) {
- mir_tstrncpy(pa.pszLabel, dbv.ptszVal, SIZEOF(pa.pszLabel));
+ mir_tstrncpy(pa.pszLabel, dbv.ptszVal, _countof(pa.pszLabel));
db_free(&dbv);
}
else
- mir_tstrncpy(pa.pszLabel, TranslateT("Unknown"), SIZEOF(pa.pszLabel));
+ mir_tstrncpy(pa.pszLabel, TranslateT("Unknown"), _countof(pa.pszLabel));
mir_snprintf(buf, "Port%d", index);
pa.port = (int)db_get_dw(0, "PingPlug", buf, -1);
mir_snprintf(buf, "Proto%d", index);
if (!db_get_s(0, "PingPlug", buf, &dbv)) {
- mir_strncpy(pa.pszProto, dbv.pszVal, SIZEOF(pa.pszProto));
+ mir_strncpy(pa.pszProto, dbv.pszVal, _countof(pa.pszProto));
db_free(&dbv);
mir_snprintf(buf, "Status%d", index);
pa.set_status = db_get_w(0, "PingPlug", buf, ID_STATUS_ONLINE);
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 6b0de1787e..05abb46ee7 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -53,10 +53,10 @@ static void ApplyDownloads(void *param)
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, SIZEOF(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, SIZEOF(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
SafeCreateDirectory(tszFileTemp);
VARST tszMirandaPath(_T("%miranda_path%"));
@@ -113,7 +113,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
TCHAR *p = _tcschr(tszFileName, L'.'); *p = 0;
TCHAR link[MAX_PATH];
- mir_sntprintf(link, SIZEOF(link), PLUGIN_INFO_URL, tszFileName);
+ mir_sntprintf(link, _countof(link), PLUGIN_INFO_URL, tszFileName);
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM) link);
}
}
@@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
OSVERSIONINFO osver = { sizeof(osver) };
if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6) {
wchar_t szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, SIZEOF(szPath));
+ GetModuleFileName(NULL, szPath, _countof(szPath));
TCHAR *ext = _tcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
@@ -346,7 +346,7 @@ static void __stdcall LaunchListDialog(void *param)
static void GetList(void *)
{
TCHAR tszTempPath[MAX_PATH];
- DWORD dwLen = GetTempPath(SIZEOF(tszTempPath), tszTempPath);
+ DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath);
if (tszTempPath[dwLen-1] == '\\')
tszTempPath[dwLen-1] = 0;
@@ -364,17 +364,17 @@ static void GetList(void *)
ServListEntry &hash = hashes[i];
TCHAR tszPath[MAX_PATH];
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\%s"), dirname, hash.m_name);
+ mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirname, hash.m_name);
if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) {
FILEINFO *FileInfo = new FILEINFO;
FileInfo->bDeleteOnly = FALSE;
// copy the relative old name
- _tcsncpy(FileInfo->tszOldName, hash.m_name, SIZEOF(FileInfo->tszOldName));
- _tcsncpy(FileInfo->tszNewName, hash.m_name, SIZEOF(FileInfo->tszNewName));
+ _tcsncpy(FileInfo->tszOldName, hash.m_name, _countof(FileInfo->tszOldName));
+ _tcsncpy(FileInfo->tszNewName, hash.m_name, _countof(FileInfo->tszNewName));
TCHAR tszFileName[MAX_PATH];
- _tcsncpy(tszFileName, _tcsrchr(tszPath, L'\\') + 1, SIZEOF(tszFileName));
+ _tcsncpy(tszFileName, _tcsrchr(tszPath, L'\\') + 1, _countof(tszFileName));
TCHAR *tp = _tcschr(tszFileName, L'.'); *tp = 0;
TCHAR tszRelFileName[MAX_PATH];
@@ -383,8 +383,8 @@ static void GetList(void *)
tp = _tcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
_tcslwr(tp);
- mir_sntprintf(FileInfo->File.tszDiskPath, SIZEOF(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, tszFileName);
- mir_sntprintf(FileInfo->File.tszDownloadURL, SIZEOF(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), baseUrl, tszRelFileName);
+ mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, tszFileName);
+ mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), baseUrl, tszRelFileName);
for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 87fe5e7498..de7eb92b94 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -59,9 +59,9 @@ static void ApplyUpdates(void *param)
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, SIZEOF(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, SIZEOF(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -101,7 +101,7 @@ static void ApplyUpdates(void *param)
if (p.bDeleteOnly) {
// we need only to backup the old file
TCHAR *ptszRelPath = p.tszNewName + _tcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, SIZEOF(tszBackFile), _T("%s\\%s"), tszFileBack, ptszRelPath);
+ mir_sntprintf(tszBackFile, _countof(tszBackFile), _T("%s\\%s"), tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -109,8 +109,8 @@ static void ApplyUpdates(void *param)
// otherwise it would be replaced by unzip
if ( _tcsicmp(p.tszOldName, p.tszNewName)) {
TCHAR tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, SIZEOF(tszSrcPath), _T("%s\\%s"), tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, SIZEOF(tszBackFile), _T("%s\\%s"), tszFileBack, p.tszOldName);
+ mir_sntprintf(tszSrcPath, _countof(tszSrcPath), _T("%s\\%s"), tszMirandaPath, p.tszOldName);
+ mir_sntprintf(tszBackFile, _countof(tszBackFile), _T("%s\\%s"), tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -172,7 +172,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6)
{
wchar_t szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, SIZEOF(szPath));
+ GetModuleFileName(NULL, szPath, _countof(szPath));
TCHAR *ext = _tcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
@@ -374,10 +374,10 @@ static void DlgUpdateSilent(void *lParam)
//create needed folders after escalating priviledges. Folders creates when we actually install updates
TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, SIZEOF(tszFileBack), _T("%s\\Backups"), tszRoot);
+ mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, SIZEOF(tszFileTemp), _T("%s\\Temp"), tszRoot);
+ mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -415,7 +415,7 @@ static void DlgUpdateSilent(void *lParam)
if (p.bDeleteOnly) {
// we need only to backup the old file
TCHAR *ptszRelPath = p.tszNewName + _tcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, SIZEOF(tszBackFile), _T("%s\\%s"), tszFileBack, ptszRelPath);
+ mir_sntprintf(tszBackFile, _countof(tszBackFile), _T("%s\\%s"), tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -423,8 +423,8 @@ static void DlgUpdateSilent(void *lParam)
// otherwise it would be replaced by unzip
if (_tcsicmp(p.tszOldName, p.tszNewName)) {
TCHAR tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, SIZEOF(tszSrcPath), _T("%s\\%s"), tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, SIZEOF(tszBackFile), _T("%s\\%s"), tszFileBack, p.tszOldName);
+ mir_sntprintf(tszSrcPath, _countof(tszSrcPath), _T("%s\\%s"), tszMirandaPath, p.tszOldName);
+ mir_sntprintf(tszBackFile, _countof(tszBackFile), _T("%s\\%s"), tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -452,7 +452,7 @@ static void DlgUpdateSilent(void *lParam)
// 5) Prepare Restart
TCHAR tszTitle[100];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("%d component(s) was updated"), count);
+ mir_sntprintf(tszTitle, _countof(tszTitle), TranslateT("%d component(s) was updated"), count);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
@@ -474,7 +474,7 @@ static void DlgUpdateSilent(void *lParam)
if (!notified) {
// Error, let's try to show MessageBox as last way to inform user about successful update
TCHAR tszText[200];
- mir_sntprintf(tszText, SIZEOF(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_sntprintf(tszText, _countof(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
#if MIRANDA_VER >= 0x0A00
@@ -555,7 +555,7 @@ static renameTable[] =
static bool CheckFileRename(const TCHAR *ptszOldName, TCHAR *pNewName)
{
- for (int i = 0; i < SIZEOF(renameTable); i++) {
+ for (int i = 0; i < _countof(renameTable); i++) {
if (wildcmpit(ptszOldName, renameTable[i].oldName)) {
TCHAR *ptszDest = renameTable[i].newName;
if (ptszDest == NULL)
@@ -590,12 +590,12 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const
// skip profile folder
TCHAR tszProfilePath[MAX_PATH];
- CallService(MS_DB_GETPROFILEPATHT, SIZEOF(tszProfilePath), (LPARAM)tszProfilePath);
+ CallService(MS_DB_GETPROFILEPATHT, _countof(tszProfilePath), (LPARAM)tszProfilePath);
if (!_tcsicmp(tszFolder, tszProfilePath))
return 0;
TCHAR tszBuf[MAX_PATH];
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s\\*"), tszFolder);
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s\\*"), tszFolder);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszBuf, &ffd);
@@ -609,7 +609,7 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// Scan recursively all subfolders
if (_tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T(".."))) {
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s\\%s"), tszFolder, ffd.cFileName);
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s\\%s"), tszFolder, ffd.cFileName);
count += ScanFolder(tszBuf, cbBaseLen, level + 1, tszBaseUrl, hashes, UpdateFiles);
}
}
@@ -620,12 +620,12 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const
if (level == 0)
_tcsncpy(tszNewName, ffd.cFileName, MAX_PATH);
else
- mir_sntprintf(tszNewName, SIZEOF(tszNewName), _T("%s\\%s"), tszFolder + cbBaseLen, ffd.cFileName);
+ mir_sntprintf(tszNewName, _countof(tszNewName), _T("%s\\%s"), tszFolder + cbBaseLen, ffd.cFileName);
}
TCHAR *ptszUrl;
int MyCRC;
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s\\%s"), tszFolder, ffd.cFileName);
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s\\%s"), tszFolder, ffd.cFileName);
bool bDeleteOnly = (tszNewName[0] == 0);
// this file is not marked for deletion
@@ -686,25 +686,25 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const
// Yeah, we've got new version.
FILEINFO *FileInfo = new FILEINFO;
// copy the relative old name
- _tcsncpy(FileInfo->tszOldName, tszBuf + cbBaseLen, SIZEOF(FileInfo->tszOldName));
+ _tcsncpy(FileInfo->tszOldName, tszBuf + cbBaseLen, _countof(FileInfo->tszOldName));
FileInfo->bDeleteOnly = bDeleteOnly;
if (FileInfo->bDeleteOnly) {
// save the full old name for deletion
- _tcsncpy(FileInfo->tszNewName, tszBuf, SIZEOF(FileInfo->tszNewName));
+ _tcsncpy(FileInfo->tszNewName, tszBuf, _countof(FileInfo->tszNewName));
}
else {
- _tcsncpy(FileInfo->tszNewName, ptszUrl, SIZEOF(FileInfo->tszNewName));
+ _tcsncpy(FileInfo->tszNewName, ptszUrl, _countof(FileInfo->tszNewName));
}
- _tcsncpy(tszBuf, ptszUrl, SIZEOF(tszBuf));
+ _tcsncpy(tszBuf, ptszUrl, _countof(tszBuf));
TCHAR *p = _tcsrchr(tszBuf, '.');
if (p) *p = 0;
p = _tcsrchr(tszBuf, '\\');
p = (p) ? p + 1 : tszBuf;
_tcslwr(p);
- mir_sntprintf(FileInfo->File.tszDiskPath, SIZEOF(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, p);
- mir_sntprintf(FileInfo->File.tszDownloadURL, SIZEOF(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszBuf);
+ mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, p);
+ mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, tszBuf);
for (p = _tcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = _tcschr(p, '\\'))
*p++ = '/';
@@ -728,7 +728,7 @@ static void CheckUpdates(void *)
{
Netlib_LogfT(hNetlibUser, _T("Checking for updates"));
TCHAR tszTempPath[MAX_PATH];
- DWORD dwLen = GetTempPath(SIZEOF(tszTempPath), tszTempPath);
+ DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath);
if (tszTempPath[dwLen - 1] == '\\')
tszTempPath[dwLen - 1] = 0;
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp
index 9987cf1179..c63ebaef4a 100644
--- a/plugins/PluginUpdater/src/Events.cpp
+++ b/plugins/PluginUpdater/src/Events.cpp
@@ -51,7 +51,7 @@ int ModulesLoaded(WPARAM, LPARAM)
OnFoldersChanged(0, 0);
}
else
- lstrcpyn(tszRoot, VARST( _T("%miranda_path%\\"DEFAULT_UPDATES_FOLDER)), SIZEOF(tszRoot));
+ lstrcpyn(tszRoot, VARST( _T("%miranda_path%\\"DEFAULT_UPDATES_FOLDER)), _countof(tszRoot));
int iRestartCount = db_get_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 2);
if (iRestartCount > 0)
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index 4cfec11d5f..904a7091e6 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -71,7 +71,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hPopup, UINT uMsg, WPARAM wParam, LPAR
static void _stdcall RestartPrompt(void *)
{
TCHAR tszText[200];
- mir_sntprintf(tszText, SIZEOF(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_sntprintf(tszText, _countof(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(0, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index e8ae139ce7..e32e5ce52c 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -55,7 +55,7 @@ int GetUpdateMode()
if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
// Missing or unknown mode, determine correct from version of running core
char coreVersion[512];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(coreVersion), (LPARAM)coreVersion);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(coreVersion), (LPARAM)coreVersion);
UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
}
@@ -222,7 +222,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
db_set_b(NULL, MODNAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
TCHAR buffer[3] = {0};
- Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, SIZEOF(buffer));
+ Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
db_set_dw(NULL, MODNAME, "Period", opts.Period = _ttoi(buffer));
mir_forkthread(InitTimer, (void*)1);
@@ -247,7 +247,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
else {
TCHAR tszUrl[100];
- GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, SIZEOF(tszUrl));
+ GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
db_set_ts(NULL, MODNAME, DB_SETTING_UPDATE_URL, tszUrl);
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
opts.bForceRedownload = 0;
@@ -286,7 +286,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, PopupOptions.Timeout, TRUE);
//Mouse actions
- for (int i = 0; i < SIZEOF(PopupActions); i++) {
+ for (int i = 0; i < _countof(PopupActions); i++) {
SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index ca93a3442c..69893a42c8 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -73,7 +73,7 @@ extern "C" __declspec(dllexport) int Load(void)
db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0);
- DWORD dwLen = GetTempPath( SIZEOF(tszTempPath), tszTempPath);
+ DWORD dwLen = GetTempPath( _countof(tszTempPath), tszTempPath);
if (tszTempPath[dwLen-1] == '\\')
tszTempPath[dwLen-1] = 0;
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index d5f03c8076..1ea04d468d 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -32,7 +32,7 @@ IconItemT iconList[] =
void InitIcoLib()
{
- Icon_RegisterT(hInst,MODULE,iconList, SIZEOF(iconList));
+ Icon_RegisterT(hInst,MODULE,iconList, _countof(iconList));
}
#endif
@@ -128,8 +128,8 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
// Download version info
FILEURL pFileUrl;
- mir_sntprintf(pFileUrl.tszDownloadURL, SIZEOF(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), baseUrl);
- mir_sntprintf(pFileUrl.tszDiskPath, SIZEOF(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszTempPath);
+ mir_sntprintf(pFileUrl.tszDownloadURL, _countof(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), baseUrl);
+ mir_sntprintf(pFileUrl.tszDiskPath, _countof(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszTempPath);
pFileUrl.CRCsum = 0;
HANDLE nlc;
@@ -153,7 +153,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
DeleteFile(pFileUrl.tszDiskPath);
TCHAR tszTmpIni[MAX_PATH] = {0};
- mir_sntprintf(tszTmpIni, SIZEOF(tszTmpIni), _T("%s\\hashes.txt"), tszTempPath);
+ mir_sntprintf(tszTmpIni, _countof(tszTmpIni), _T("%s\\hashes.txt"), tszTempPath);
FILE *fp = _tfopen(tszTmpIni, _T("r"));
if (!fp) {
Netlib_LogfT(hNetlibUser,_T("Opening %s failed"), tszTempPath);
@@ -163,7 +163,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
bool bDoNotSwitchToStable = false;
char str[200];
- while(fgets(str, SIZEOF(str), fp) != NULL) {
+ while(fgets(str, _countof(str), fp) != NULL) {
rtrim(str);
// Do not allow the user to switch back to stable
if (!strcmp(str, "DoNotSwitchToStable")) {
@@ -261,7 +261,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc)
else {
// try to write it via PU stub
TCHAR tszTempFile[MAX_PATH];
- mir_sntprintf(tszTempFile, SIZEOF(tszTempFile), _T("%s\\pulocal.tmp"), tszTempPath);
+ mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\pulocal.tmp"), tszTempPath);
hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
@@ -468,7 +468,7 @@ bool PrepareEscalation()
{
// First try to create a file near Miranda32.exe
TCHAR szPath[MAX_PATH];
- GetModuleFileName(NULL, szPath, SIZEOF(szPath));
+ GetModuleFileName(NULL, szPath, _countof(szPath));
TCHAR *ext = _tcsrchr(szPath, '.');
if (ext != NULL)
*ext = '\0';
@@ -487,7 +487,7 @@ bool PrepareEscalation()
else {
// Elevate the process. Create a pipe for a stub first
TCHAR tszPipeName[MAX_PATH];
- mir_sntprintf(tszPipeName, SIZEOF(tszPipeName), _T("\\\\.\\pipe\\Miranda_Pu_%d"), GetCurrentProcessId());
+ mir_sntprintf(tszPipeName, _countof(tszPipeName), _T("\\\\.\\pipe\\Miranda_Pu_%d"), GetCurrentProcessId());
hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
hPipe = NULL;
@@ -497,7 +497,7 @@ bool PrepareEscalation()
GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
if ((p = _tcsrchr(szPath, '\\')) != 0)
_tcscpy(p+1, _T("pu_stub.exe"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("%d"), GetCurrentProcessId());
+ mir_sntprintf(cmdLine, _countof(cmdLine), _T("%d"), GetCurrentProcessId());
// Launch a stub
SHELLEXECUTEINFO sei = { sizeof(sei) };
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp
index 43133863b2..a67945be95 100644
--- a/plugins/PluginUpdater/src/unzipfile.cpp
+++ b/plugins/PluginUpdater/src/unzipfile.cpp
@@ -69,12 +69,12 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bo
}
if (ptszBackPath != NULL) {
- PrepareFileName(tszDestFile, SIZEOF(tszDestFile), ptszDestPath, ptszNewName);
- PrepareFileName(tszBackFile, SIZEOF(tszBackFile), ptszBackPath, ptszNewName);
+ PrepareFileName(tszDestFile, _countof(tszDestFile), ptszDestPath, ptszNewName);
+ PrepareFileName(tszBackFile, _countof(tszBackFile), ptszBackPath, ptszNewName);
BackupFile(tszDestFile, tszBackFile);
}
- PrepareFileName(tszDestFile, SIZEOF(tszDestFile), ptszDestPath, ptszNewName);
+ PrepareFileName(tszDestFile, _countof(tszDestFile), ptszDestPath, ptszNewName);
SafeCreateFilePath(tszDestFile);
TCHAR *ptszFile2unzip;
@@ -82,7 +82,7 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bo
ptszFile2unzip = tszDestFile;
else {
TCHAR tszTempPath[MAX_PATH];
- GetTempPath( SIZEOF(tszTempPath), tszTempPath);
+ GetTempPath( _countof(tszTempPath), tszTempPath);
GetTempFileName(tszTempPath, _T("PUtemp"), GetCurrentProcessId(), tszBackFile);
ptszFile2unzip = tszBackFile;
}
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp
index 3d599d9d8e..b897255edc 100644
--- a/plugins/Popup/src/actions.cpp
+++ b/plugins/Popup/src/actions.cpp
@@ -52,7 +52,7 @@ void LoadActions()
#endif
};
- for (int i = 0; i < SIZEOF(actions); ++i)
+ for (int i = 0; i < _countof(actions); ++i)
RegisterAction(&actions[i]);
}
@@ -268,7 +268,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
- for (i = 0; i < SIZEOF(controls); ++i)
+ for (i = 0; i < _countof(controls); ++i)
EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
}
windowInitialized = true;
@@ -282,7 +282,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
{
BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
- for (i = 0; i < SIZEOF(controls); ++i)
+ for (i = 0; i < _countof(controls); ++i)
EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
}
break;
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
index 264f45d188..78a2f58274 100644
--- a/plugins/Popup/src/font.cpp
+++ b/plugins/Popup/src/font.cpp
@@ -30,53 +30,53 @@ void InitFonts()
// Fonts
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group));
- mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(fid.dbSettingsGroup));
+ mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), _countof(fid.group));
+ mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- mir_tstrncpy(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup));
- mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, SIZEOF(fid.backgroundName));
- mir_tstrncpy(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace));
+ mir_tstrncpy(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), _countof(fid.backgroundGroup));
+ mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, _countof(fid.backgroundName));
+ mir_tstrncpy(fid.deffontsettings.szFace, _T("Tahoma"), _countof(fid.deffontsettings.szFace));
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), _countof(fid.name));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
fid.deffontsettings.style = DBFONTF_BOLD;
fid.deffontsettings.colour = RGB(0, 0, 0);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), _countof(fid.name));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
fid.deffontsettings.style = 0;
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), _countof(fid.name));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
fid.deffontsettings.colour = RGB(0, 0, 255);
FontRegisterT(&fid);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
fid.deffontsettings.style = DBFONTF_UNDERLINE;
FontRegisterT(&fid);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
- mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group));
+ mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(cid.dbSettingsGroup));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
- mir_strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting));
+ mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
+ mir_strncpy(cid.setting, PU_COL_BACK_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
ColourRegisterT(&cid);
- mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
- mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting));
+ mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
+ mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
ColourRegisterT(&cid);
@@ -95,36 +95,36 @@ void ReloadFonts()
LOGFONT lf = { 0 };
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.name));
+ mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), _countof(fid.name));
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), _countof(fid.name));
fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.title = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), _countof(fid.name));
fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.clock = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name));
fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.text = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), _countof(fid.name));
fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.action = CreateFontIndirect(&lf);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name));
fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.actionHover = CreateFontIndirect(&lf);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group));
+ mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
- mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
- mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), _countof(cid.group));
+ mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
// update class popupps(only temp at this point, must rework)
diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h
index a39e9053b2..0b6c53a307 100644
--- a/plugins/Popup/src/font.h
+++ b/plugins/Popup/src/font.h
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PU_FNT_AND_COLOR LPGEN("Popups") //common main group for customice\font&color
#define PU_FNT_AND_COLOR_DB MODULNAME //use eg mir_strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB);
-#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....);
+#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, _countof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....);
#define PU_FNT_NAME_TITLE LPGEN("Title") //use eg mir_tstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
#define PU_FNT_NAME_CLOCK LPGEN("Clock")
#define PU_FNT_NAME_TEXT LPGEN("Text")
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp
index 6f355f68a5..a1e25be5f6 100644
--- a/plugins/Popup/src/notifications.cpp
+++ b/plugins/Popup/src/notifications.cpp
@@ -185,30 +185,30 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
FontID fontid = { 0 };
fontid.cbSize = sizeof(fontid);
- mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
+ mir_snprintf(fontid.group, _countof(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
mir_strcpy(fontid.dbSettingsGroup, "PopupNotifications");
fontid.flags = FIDF_DEFAULTVALID;
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = ptd->notification.colorText;
fontid.deffontsettings.size = -11;
- mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", SIZEOF(fontid.deffontsettings.szFace));
+ mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
- mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", notification->lpzName);
- mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName);
+ mir_snprintf(fontid.name, _countof(fontid.name), "%s (colors only)", notification->lpzName);
+ mir_snprintf(fontid.prefix, _countof(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName);
fontid.deffontsettings.style = 0;
FontRegister(&fontid);
ColourID colourid = { 0 };
colourid.cbSize = sizeof(colourid);
- mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
+ mir_snprintf(colourid.group, _countof(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications");
- mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", notification->lpzName);
- mir_snprintf(colourid.setting, SIZEOF(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName);
+ mir_snprintf(colourid.name, _countof(colourid.name), "%s (colors only)", notification->lpzName);
+ mir_snprintf(colourid.setting, _countof(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName);
colourid.defcolour = ptd->notification.colorBack;
ColourRegister(&colourid);
char section[MAXMODULELABELLENGTH], setting[MAXMODULELABELLENGTH];
- mir_snprintf(section, SIZEOF(section), "Popups/%s", notification->lpzGroup);
+ mir_snprintf(section, _countof(section), "Popups/%s", notification->lpzGroup);
mir_snprintf(setting, MODULNAME"_%s_%s", notification->lpzGroup, notification->lpzName);
SKINICONDESC sid = { 0 };
@@ -248,14 +248,14 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen)
LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET)
FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char
fontid.cbSize = sizeof(fontid);
- mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
- mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName);
+ mir_snprintf(fontid.group, _countof(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
+ mir_snprintf(fontid.name, _countof(fontid.name), "%s (colors only)", ptd->notification.lpzName);
ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf);
ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char
colourid.cbSize = sizeof(colourid);
- mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
- mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName);
+ mir_snprintf(colourid.group, _countof(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
+ mir_snprintf(colourid.name, _countof(colourid.name), "%s (colors only)", ptd->notification.lpzName);
ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0);
char setting[MAXMODULELABELLENGTH];
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp
index 1183fa07d6..1557a5ce16 100644
--- a/plugins/Popup/src/opt_adv.cpp
+++ b/plugins/Popup/src/opt_adv.cpp
@@ -161,7 +161,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha);
mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc);
- mir_sntprintf(tstr, SIZEOF(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha));
+ mir_sntprintf(tstr, _countof(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha));
SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopupOptions.OpaqueOnHover ? BST_CHECKED : BST_UNCHECKED);
{
@@ -184,9 +184,9 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemInt(hwnd, IDC_FADEOUT, PopupOptions.FadeOut, FALSE);
UDACCEL aAccels[] = { { 0, 50 }, { 1, 100 }, { 3, 500 } };
SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEINTIME_MAX, SETTING_FADEINTIME_MIN));
- SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels);
+ SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)_countof(aAccels), (LPARAM)&aAccels);
SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEOUTTIME_MAX, SETTING_FADEOUTTIME_MIN));
- SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels);
+ SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETACCEL, (WPARAM)_countof(aAccels), (LPARAM)&aAccels);
BOOL how = PopupOptions.UseAnimations || PopupOptions.UseEffect;
EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), how);
@@ -239,7 +239,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case IDC_TRANS_SLIDER:
PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_GETPOS, 0, 0);
- mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha));
+ mir_sntprintf(tstr, _countof(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha));
SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index 5d70ff8e03..6af58caeb9 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -189,13 +189,13 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
for (i = 0; i < gTreeData.getCount(); ++i) {
switch (gTreeData[i]->typ) {
case 1: // Treeview part for typ 1 (notification)
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription);
+ mir_snprintf(iconName, _countof(iconName), "%s_%S_%S", MODULNAME, gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription);
iconIndex = ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(iconName));
- mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription);
+ mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), gTreeData[i]->pszTreeRoot, gTreeData[i]->pszDescription);
break;
case 2: // Treeview part typ 2 (popup class api)
iconIndex = ImageList_ReplaceIcon(hImgLst, -1, gTreeData[i]->pupClass.hIcon);
- mir_sntprintf(itemName, SIZEOF(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription);
+ mir_sntprintf(itemName, _countof(itemName), _T("%s/%s"), LPGENT("CLASS Plugins")/*gTreeData[i]->pszTreeRoot*/, gTreeData[i]->pszDescription);
break;
}
OptTree_AddItem(hwndTree, itemName, (LPARAM)gTreeData[i], iconIndex);
@@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
OptTree_Translate(hwndTree);
// Bold Title
- for (i = 0; i < SIZEOF(titleIds); ++i) {
+ for (i = 0; i < _countof(titleIds); ++i) {
LOGFONT lf;
GetObject((HFONT)SendDlgItemMessage(hwnd, titleIds[i], WM_GETFONT, 0, 0), sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_INFINITE));
SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)0, TRUE);
// status buttons
- for (i = 0; i < SIZEOF(statusButtons); ++i) {
+ for (i = 0; i < _countof(statusButtons); ++i) {
SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwnd, statusButtons[i].idCtrl, BM_SETIMAGE,
@@ -280,18 +280,18 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
mir_free(psztAction); psztAction = NULL;
}
// enable all controls
- for (i = 0; i < SIZEOF(ctrlsAll); ++i){
+ for (i = 0; i < _countof(ctrlsAll); ++i){
ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1 ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp1);
}
// enable or disable controls ctrlsEnable
- for (i = 0; i < SIZEOF(ctrlsEnable); ++i)
+ for (i = 0; i < _countof(ctrlsEnable); ++i)
EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled ? TRUE : FALSE);
// show or hide controls ctrlsContact
- for (i = 0; i < SIZEOF(ctrlsContact); ++i)
+ for (i = 0; i < _countof(ctrlsContact); ++i)
ShowWindow(GetDlgItem(hwnd, ctrlsContact[i]), ptd->notification.dwFlags&PNF_CONTACT ? SW_SHOW : SW_HIDE);
// statusButtons state
- for (i = 0; i < SIZEOF(statusButtons); ++i)
+ for (i = 0; i < _countof(statusButtons); ++i)
CheckDlgButton(hwnd, statusButtons[i].idCtrl, ptd->disableWhen & statusButtons[i].disableWhenFlag ? BST_CHECKED : BST_UNCHECKED);
}
// element typ2 (CLASS Plugins)
@@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
SetDlgItemInt(hwnd, IDC_TIMEOUT, (UINT)ptd->timeoutValue, TRUE);
SendDlgItemMessage(hwnd, IDC_TIMEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(250, -1));
// enable ctrls
- for (i = 0; i < SIZEOF(ctrlsAll); ++i){
+ for (i = 0; i < _countof(ctrlsAll); ++i){
ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2 ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp2);
}
@@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
} // end if (tvi.lParam)
else {
// enable / disable controls
- for (int i = 0; i < SIZEOF(ctrlsAll); ++i) {
+ for (int i = 0; i < _countof(ctrlsAll); ++i) {
ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0);
}
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
switch (idCtrl) {
case IDC_ENABLE:
ptd->enabled = (BYTE)Button_GetCheck((HWND)lParam);
- for (i = 0; i < SIZEOF(ctrlsEnable); ++i)
+ for (i = 0; i < _countof(ctrlsEnable); ++i)
EnableWindow(GetDlgItem(hwnd, ctrlsEnable[i]), ptd->enabled);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
@@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case IDC_SOFFLINE2: case IDC_SONLINE2: case IDC_SAWAY2: case IDC_SNA2: case IDC_SOCCUPIED2:
case IDC_SDND2: case IDC_SFREE4CHAT2: case IDC_SINVISIBLE2: case IDC_SPHONE2: case IDC_SLUNCH2:
ptd->disableWhen = 0;
- for (i = 0; i < SIZEOF(statusButtons); ++i) {
+ for (i = 0; i < _countof(statusButtons); ++i) {
if (IsDlgButtonChecked(hwnd, statusButtons[i].idCtrl))
ptd->disableWhen |= statusButtons[i].disableWhenFlag;
if (idCtrl == (UINT)statusButtons[i].idCtrl)
diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp
index 750ecf889f..3184928d05 100644
--- a/plugins/Popup/src/opt_contacts.cpp
+++ b/plugins/Popup/src/opt_contacts.cpp
@@ -33,7 +33,7 @@ static void sttSetAllContactIcons(HWND hwndList)
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0);
- for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i)
+ for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i)
// hIml element [0] = SKINICON_OTHER_SMALLDOT
// hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, ((int)dwMode == i) ? i + 1 : 0));
@@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_FULLSCREEN, 0));
ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_BLOCK, 0));
SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*SIZEOF(sttIcons)*/, 0);
+ SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*_countof(sttIcons)*/, 0);
sttResetListOptions(GetDlgItem(hwnd, IDC_LIST));
sttSetAllContactIcons(GetDlgItem(hwnd, IDC_LIST));
}
@@ -86,7 +86,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
int iImage = SendDlgItemMessage(hwnd, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
if (iImage != EMPTY_EXTRA_ICON) {
- for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i)
+ for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i)
// hIml element [0] = SKINICON_OTHER_SMALLDOT
// hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons
SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i == nm->iColumn) ? i + 1 : 0));
@@ -101,7 +101,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
HWND hwndList = GetDlgItem(hwnd, IDC_LIST);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
- for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) {
+ for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) {
if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0))) {
db_set_b(hContact, MODULNAME, "ShowMode", i);
break;
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp
index 129f16fafe..d3e3c436bb 100644
--- a/plugins/Popup/src/opt_gen.cpp
+++ b/plugins/Popup/src/opt_gen.cpp
@@ -225,7 +225,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
continue;
TCHAR prefix[128];
- mir_sntprintf(prefix, SIZEOF(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
+ mir_sntprintf(prefix, _countof(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
pos = AddStatusModes(statusOptions, pos, prefix, protoFlags);
}
}
@@ -240,10 +240,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
continue;
char prefix[128];
- mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName);
+ mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName);
TCHAR pszSettingName[256];
- mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
+ mir_sntprintf(pszSettingName, _countof(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, prefix, 0), pszSettingName);
}
}
@@ -526,10 +526,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
for (int i = 0; i < protocolCount; ++i) {
if (!protocols[i]->bIsVirtual) {
char prefix[128];
- mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName);
+ mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName);
TCHAR pszSettingName[256];
- mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName);
+ mir_sntprintf(pszSettingName, _countof(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName);
db_set_dw(NULL, MODULNAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName));
}
}
@@ -581,7 +581,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
void ErrorMSG(int minValue, int maxValue)
{
TCHAR str[128];
- mir_sntprintf(str, SIZEOF(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
+ mir_sntprintf(str, _countof(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
MSGERROR(str);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp
index 672de348be..25bf6ce808 100644
--- a/plugins/Popup/src/opt_skins.cpp
+++ b/plugins/Popup/src/opt_skins.cpp
@@ -48,7 +48,7 @@ void RegisterOptPrevBox()
err = GetLastError();
if (!g_wndClass.cPopupPreviewBoxWndclass) {
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
@@ -62,7 +62,7 @@ void RegisterOptPrevBox()
err = GetLastError();
if (!g_wndClass.cPopupPlusDlgBox) {
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
}
@@ -210,7 +210,7 @@ static LPTSTR mainOption[] = {
int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions)
{
- for (int i = 0; i < SIZEOF(mainOption); i++) {
+ for (int i = 0; i < _countof(mainOption); i++) {
BOOL bCheck = 0;
switch (i) {
case 0:
@@ -280,7 +280,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn
// check "Skin options" state
char prefix[128];
- mir_snprintf(prefix, SIZEOF(prefix), "skin.%S", PopupOptions.SkinPack);
+ mir_snprintf(prefix, _countof(prefix), "skin.%S", PopupOptions.SkinPack);
OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount,
db_get_dw(NULL, MODULNAME, prefix, dwSkinOptions), _T("Skin options"));
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp
index e6bb00b1bd..c238b5f499 100644
--- a/plugins/Popup/src/opttree.cpp
+++ b/plugins/Popup/src/opttree.cpp
@@ -33,7 +33,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem)
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.hItem = hItem;
tvi.pszText = buf;
- tvi.cchTextMax = SIZEOF(buf);
+ tvi.cchTextMax = _countof(buf);
SendMessage(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
tvi.pszText = TranslateTS(tvi.pszText);
SendMessage(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi);
@@ -80,7 +80,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp
index a8f269635f..2bbda488f6 100644
--- a/plugins/Popup/src/popup_thread.cpp
+++ b/plugins/Popup/src/popup_thread.cpp
@@ -222,7 +222,7 @@ static unsigned __stdcall PopupThread(void *)
err = GetLastError();
if (!g_wndClass.cPopupThreadManagerWnd) {
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index f1183f6dd4..f31013e2e6 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -65,7 +65,7 @@ bool LoadPopupWnd2()
if (!g_wndClass.cPopupWnd2) {
res = false;
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK);
}
@@ -80,7 +80,7 @@ bool LoadPopupWnd2()
err = GetLastError();
if (!g_wndClass.cPopupEditBox) {
TCHAR msg[2048];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"),
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"),
wclw.cbSize, // UINT cbSize;
wclw.style, // UINT style;
wclw.lpfnWndProc, // WNDPROC lpfnWndProc;
@@ -116,7 +116,7 @@ bool LoadPopupWnd2()
if (!g_wndClass.cPopupMenuHostWnd) {
res = false;
TCHAR msg[1024];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
MSGERROR(msg);
}
@@ -350,7 +350,7 @@ void PopupWnd2::show()
if (*PopupOptions.Effect) {
char vfxService[128];
- mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect);
+ mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect);
if (ServiceExists(vfxService))
if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) {
effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0);
@@ -437,7 +437,7 @@ void PopupWnd2::hide()
if (*PopupOptions.Effect) {
char vfxService[128];
- mir_snprintf(vfxService, SIZEOF(vfxService), "Popup/Vfx/%S", PopupOptions.Effect);
+ mir_snprintf(vfxService, _countof(vfxService), "Popup/Vfx/%S", PopupOptions.Effect);
if (ServiceExists(vfxService))
if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) {
effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0);
@@ -712,7 +712,7 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd)
m_PluginWindowProc = ppd->PluginWindowProc;
if (m_options->DisplayTime)
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time));
else m_time[0] = 0;
fixDefaults();
@@ -752,9 +752,9 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd)
if (m_options->DisplayTime) {
if (ppd->dwTimestamp)
- TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, SIZEOF(m_time));
+ TimeZone_ToStringT(ppd->dwTimestamp, _T("t"), m_time, _countof(m_time));
else
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time));
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, _countof(m_time));
}
else m_time[0] = 0;
@@ -847,7 +847,7 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
switch (wParam) {
case VK_RETURN:
TCHAR msg[2048];
- GetWindowText(hwnd, msg, SIZEOF(msg));
+ GetWindowText(hwnd, msg, _countof(msg));
if (mir_wstrlen(msg) == 0) {
DestroyWindow(hwnd);
return 0;
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index b77c87a75a..94d87996b9 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -146,7 +146,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (proto) {
char prefix[128];
- mir_snprintf(prefix, SIZEOF(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact));
+ mir_snprintf(prefix, _countof(prefix), LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact));
if (db_get_dw(NULL, MODULNAME, prefix, 0) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
return -1;
if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(CallProtoService(proto, PS_GETSTATUS, 0, 0)))
@@ -381,15 +381,15 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
- mir_sntprintf(fid.group, SIZEOF(fid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
- mir_strncpy(fid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup) - 1);
+ mir_sntprintf(fid.group, _countof(fid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
+ mir_strncpy(fid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup) - 1);
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- mir_tstrncpy(fid.deffontsettings.szFace, _T("Verdana"), SIZEOF(fid.deffontsettings.szFace) - 1);
- mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name) - 1);
- mir_strncpy(fid.prefix, setting, SIZEOF(fid.prefix));
- mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
+ mir_tstrncpy(fid.deffontsettings.szFace, _T("Verdana"), _countof(fid.deffontsettings.szFace) - 1);
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), _countof(fid.name) - 1);
+ mir_strncpy(fid.prefix, setting, _countof(fid.prefix));
+ mir_snprintf(fid.prefix, _countof(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
fid.deffontsettings.style = 0;
fid.deffontsettings.colour = fonts.clText;
FontRegisterT(&fid);
@@ -399,10 +399,10 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
- mir_sntprintf(cid.group, SIZEOF(cid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
- mir_strncpy(cid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup));
- mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
- mir_snprintf(cid.setting, SIZEOF(cid.setting), "%s/BgCol", ptd->pupClass.pszName);
+ mir_sntprintf(cid.group, _countof(cid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
+ mir_strncpy(cid.dbSettingsGroup, PU_MODULCLASS, _countof(fid.dbSettingsGroup));
+ mir_tstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
+ mir_snprintf(cid.setting, _countof(cid.setting), "%s/BgCol", ptd->pupClass.pszName);
cid.defcolour = fonts.clBack;
ColourRegisterT(&cid);
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp
index 1a6a14bdf7..423fb25ea3 100644
--- a/plugins/Popup/src/skin.cpp
+++ b/plugins/Popup/src/skin.cpp
@@ -1095,11 +1095,11 @@ bool Skins::load()
TCHAR dir[1024] = { '\0' };
if (ServiceExists(MS_FOLDERS_GET_PATH)) {
- if (FoldersGetCustomPathT(folderId, dir, SIZEOF(dir), NULL) != 0)
+ if (FoldersGetCustomPathT(folderId, dir, _countof(dir), NULL) != 0)
return false;
}
else {
- mir_tstrncpy(dir, VARST(_T("%miranda_path%\\skins\\popup")), SIZEOF(dir));
+ mir_tstrncpy(dir, VARST(_T("%miranda_path%\\skins\\popup")), _countof(dir));
DWORD fa = GetFileAttributes(dir);
if ((fa == INVALID_FILE_ATTRIBUTES) || !(fa&FILE_ATTRIBUTE_DIRECTORY))
return false;
diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp
index d4d86defaa..e0ba4db09c 100644
--- a/plugins/ProfileManager/src/pmanagerEx.cpp
+++ b/plugins/ProfileManager/src/pmanagerEx.cpp
@@ -49,7 +49,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
static INT_PTR ChangePM(WPARAM, LPARAM)
{
TCHAR fn[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn));
+ GetModuleFileName(GetModuleHandle(NULL), fn, _countof(fn));
ShellExecute(0, _T("open"), fn, _T("/ForceShowPM"), _T(""), 1);
CallService("CloseAction", 0, 0);
return 0;
@@ -58,7 +58,7 @@ static INT_PTR ChangePM(WPARAM, LPARAM)
static INT_PTR LoadPM(WPARAM, LPARAM)
{
TCHAR fn[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), fn, SIZEOF(fn));
+ GetModuleFileName(GetModuleHandle(NULL), fn, _countof(fn));
ShellExecute(0, _T("open"), fn, _T("/ForceShowPM"), _T(""), 1);
return 0;
}
@@ -70,8 +70,8 @@ static INT_PTR CheckDb(WPARAM, LPARAM)
PROCESS_INFORMATION pi;
STARTUPINFO si = { 0 };
si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /svc:dbchecker"), mirandaPath, GetCurrentProcessId());
+ GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+ mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /restart:%d /svc:dbchecker"), mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
@@ -98,7 +98,7 @@ static int OnModulesLoaded(WPARAM, LPARAM)
mi.position = -500200000;
mi.pszPopupName = LPGEN("Database");
- for (int i = 0; i < SIZEOF(iconList); i++) {
+ for (int i = 0; i < _countof(iconList); i++) {
mi.pszName = iconList[i].szDescr;
mi.pszService = iconList[i].szName;
mi.icolibItem = iconList[i].hIcolib;
@@ -115,7 +115,7 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
- Icon_Register(hInst, LPGEN("Profile manager"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Profile manager"), iconList, _countof(iconList));
CreateServiceFunction(SRV_LOAD_PM, LoadPM);
CreateServiceFunction(SRV_CHECK_DB, CheckDb);
diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp
index e35b06d414..465d9e4682 100644
--- a/plugins/QuickContacts/src/options.cpp
+++ b/plugins/QuickContacts/src/options.cpp
@@ -90,7 +90,7 @@ static OptPageControl controls[] = {
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- int ret = SaveOptsDlgProc(controls, SIZEOF(controls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ int ret = SaveOptsDlgProc(controls, _countof(controls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
switch (msg) {
case WM_INITDIALOG:
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index 3a2ea7b491..445e641a62 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -246,7 +246,7 @@ TCHAR *GetListName(c_struct *cs)
{
if (opts.group_append && cs->szgroup[0] != _T('\0'))
{
- mir_sntprintf(tmp_list_name, SIZEOF(tmp_list_name), _T("%s (%s)"), cs->szname, cs->szgroup);
+ mir_sntprintf(tmp_list_name, _countof(tmp_list_name), _T("%s (%s)"), cs->szname, cs->szgroup);
return tmp_list_name;
}
else
@@ -400,7 +400,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
if (dbv.ptszVal != NULL)
- mir_tstrncpy(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
+ mir_tstrncpy(contact->szgroup, dbv.ptszVal, _countof(contact->szgroup));
db_free(&dbv);
}
@@ -408,11 +408,11 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
// Make contact name
TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
- mir_tstrncpy(contact->szname, tmp, SIZEOF(contact->szname));
+ mir_tstrncpy(contact->szname, tmp, _countof(contact->szname));
PROTOACCOUNT *acc = Proto_GetAccount(pszProto);
if (acc != NULL)
- mir_tstrncpy(contact->proto, acc->tszAccountName, SIZEOF(contact->proto));
+ mir_tstrncpy(contact->proto, acc->tszAccountName, _countof(contact->proto));
contact->hcontact = hContact;
contacts.insert(contact);
@@ -526,7 +526,7 @@ MCONTACT GetSelectedContact(HWND hwndDlg)
// Now try the name
TCHAR cname[120] = _T("");
- GetDlgItemText(hwndDlg, IDC_USERNAME, cname, SIZEOF(cname));
+ GetDlgItemText(hwndDlg, IDC_USERNAME, cname, _countof(cname));
for(int loop = 0; loop < contacts.getCount(); loop++)
{
@@ -565,7 +565,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
int ret = SendMessage(hdlg,EM_GETSEL,(WPARAM)&start,(LPARAM)&end);
- GetWindowText(hdlg, sztext, SIZEOF(sztext));
+ GetWindowText(hdlg, sztext, _countof(sztext));
BOOL at_end = (mir_tstrlen(sztext) == (int)end);
@@ -585,7 +585,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
}
SendMessage(hdlg,EM_REPLACESEL,0,(LPARAM)sztext);
- GetWindowText(hdlg, sztext, SIZEOF(sztext));
+ GetWindowText(hdlg, sztext, _countof(sztext));
}
CheckText(hdlg, sztext, !at_end);
@@ -611,7 +611,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
}
else if (wparam == VK_DELETE)
{
- GetWindowText(hdlg, sztext, SIZEOF(sztext));
+ GetWindowText(hdlg, sztext, _countof(sztext));
CheckText(hdlg, sztext, TRUE);
}
@@ -713,7 +713,7 @@ static void FillButton(HWND hwndDlg, int dlgItem, TCHAR *name, TCHAR *key, HICON
if (key == NULL)
full = TranslateTS(name);
else
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (%s)"), TranslateTS(name), key);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (%s)"), TranslateTS(name), key);
SendDlgItemMessage(hwndDlg, dlgItem, BUTTONSETASFLATBTN, 0, 0);
SendDlgItemMessage(hwndDlg, dlgItem, BUTTONADDTOOLTIP, (LPARAM)full, BATF_TCHAR);
@@ -729,7 +729,7 @@ static void FillCheckbox(HWND hwndDlg, int dlgItem, TCHAR *name, TCHAR *key)
if (key == NULL)
full = TranslateTS(name);
else
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (%s)"), TranslateTS(name), key);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (%s)"), TranslateTS(name), key);
SetDlgItemText(hwndDlg, dlgItem, full);
}
@@ -958,7 +958,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (SendMessage(hEdit, EM_GETSEL, 0, 0) != -1)
SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM)_T(""));
- GetWindowText(hEdit, sztext, SIZEOF(sztext));
+ GetWindowText(hEdit, sztext, _countof(sztext));
// Fill combo
BOOL all = IsDlgButtonChecked(hwndDlg, IDC_SHOW_ALL_CONTACTS);
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp
index 261e42198e..9de7e40fc4 100644
--- a/plugins/QuickMessages/src/Utils.cpp
+++ b/plugins/QuickMessages/src/Utils.cpp
@@ -157,22 +157,22 @@ void SaveModuleSettings(int buttonnum,ButtonData* bd)
{
char szMEntry[256]={'\0'};
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,bd->dwPos);
db_set_ts(NULL, PLGNAME,szMEntry,bd->pszName );
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryValue_%u_%u",buttonnum,bd->dwPos);
if(bd->pszValue)
db_set_ts(NULL, PLGNAME,szMEntry,bd->pszValue );
else
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryRel_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->fEntryType );
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryToQMenu_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->bInQMenu);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
db_set_b(NULL, PLGNAME,szMEntry,bd->bIsServName);
}
@@ -181,27 +181,27 @@ void CleanSettings(int buttonnum,int from)
char szMEntry[256]={'\0'};
DBVARIANT dbv = {0};
if(from==-1){
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"ButtonName_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"ButtonName_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"ButtonValue_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"ButtonValue_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"RCEntryIsServiceName_%u",buttonnum);
+ mir_snprintf(szMEntry,_countof(szMEntry),"RCEntryIsServiceName_%u",buttonnum);
db_unset(NULL, PLGNAME,szMEntry);
}
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,from);
while(!db_get_ts(NULL, PLGNAME,szMEntry,&dbv)) {
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryValue_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryRel_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryToQMenu_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,from);
db_unset(NULL, PLGNAME,szMEntry);
- mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,++from);
+ mir_snprintf(szMEntry,_countof(szMEntry),"EntryName_%u_%u",buttonnum,++from);
}
db_free(&dbv);
}
@@ -212,16 +212,16 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
switch (mode) {
case 0:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryToQMenu_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryToQMenu_%u_%u", buttonnum, entrynum);
break;
case 1:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryRel_%u_%u", buttonnum, entrynum);
break;
case 2:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryIsServiceName_%u_%u", buttonnum, entrynum);
break;
case 3:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "RCEntryIsServiceName_%u", buttonnum);
break;
}
return db_get_b(NULL, PLGNAME, szMEntry, 0);
@@ -230,7 +230,7 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
static HANDLE AddIcon(char* szIcoName)
{
TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
+ GetModuleFileName(hinstance, tszPath, _countof(tszPath));
SKINICONDESC sid = { 0 };
sid.flags = SIDF_PATH_TCHAR;
@@ -257,7 +257,7 @@ DWORD BalanceButtons(int buttonsWas, int buttonsNow)
while (buttonsWas < buttonsNow) {
if (ServiceExists(MS_BB_ADDBUTTON)) {
char iconname[40];
- mir_snprintf(iconname, SIZEOF(iconname), LPGEN("Quick Messages Button %u"), buttonsWas);
+ mir_snprintf(iconname, _countof(iconname), LPGEN("Quick Messages Button %u"), buttonsWas);
bb.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
bb.dwButtonID = buttonsWas++;
bb.dwDefPos = 300+buttonsWas;
@@ -348,16 +348,16 @@ TCHAR* getMenuEntry(int buttonnum, int entrynum, BYTE mode)
switch (mode) {
case 0:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryName_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryName_%u_%u", buttonnum, entrynum);
break;
case 1:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "EntryValue_%u_%u", buttonnum, entrynum);
break;
case 2:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonValue_%u", buttonnum);
break;
case 3:
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", buttonnum);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonName_%u", buttonnum);
break;
default:
szMEntry[0] = 0;
@@ -382,7 +382,7 @@ int RegisterCustomButton(WPARAM wParam,LPARAM lParam)
ListData* ld = ButtonsList[i];
char iconname[40];
- mir_snprintf(iconname, SIZEOF(iconname), LPGEN("Quick Messages Button %u"), i);
+ mir_snprintf(iconname, _countof(iconname), LPGEN("Quick Messages Button %u"), i);
BBButton bbd = { sizeof(bbd) };
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index b8091558cb..ce1a2995c9 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -123,7 +123,7 @@ void SetMenuEntryProperties(HWND hdlg)
{
ListData* ld = ( ListData* )tvi.lParam;
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_RCLICKVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue))
@@ -144,7 +144,7 @@ void SetMenuEntryProperties(HWND hdlg)
{
ButtonData* bd = ( ButtonData* )tvi.lParam;
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(mir_tstrlen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue))
@@ -213,7 +213,7 @@ void SaveMenuTree(HWND hdlg)
g_iButtonsCount=TreeView_GetCount(hButtonsList);
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
tvi.hItem=TreeView_GetRoot(hButtonsList);
@@ -260,7 +260,7 @@ void SaveMenuTree(HWND hdlg)
if(ld->ptszQValue)
{
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonValue_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonValue_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
@@ -276,13 +276,13 @@ void SaveMenuTree(HWND hdlg)
}
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "ButtonName_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "ButtonName_%u", iBl);
db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
ld->dwOPFlags=0;
ld->dwPos=iBl;
ld->bIsServName=ld->bIsOpServName;
- mir_snprintf(szMEntry, SIZEOF(szMEntry), "RCEntryIsServiceName_%u", iBl);
+ mir_snprintf(szMEntry, _countof(szMEntry), "RCEntryIsServiceName_%u", iBl);
db_set_b(NULL, PLGNAME,szMEntry,ld->bIsServName);
bDeleted=FALSE;
@@ -492,7 +492,7 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=strbuf;
- tvis.item.cchTextMax=SIZEOF(strbuf);
+ tvis.item.cchTextMax=_countof(strbuf);
tvis.item.hItem=hItem;
TreeView_GetItem(hMenuTree,&tvis.item);
}
@@ -766,12 +766,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
TCHAR szLabel[256];
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hMenuTree);
TreeView_GetItem(hMenuTree,&tvi);
- GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
+ GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit=NULL;
if (!mir_tstrlen(szLabel)) break;
if (bd = (ButtonData*)tvi.lParam){
@@ -828,7 +828,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
ButtonData *bd = ( ButtonData* )tvi.lParam;
if (bd) {
TCHAR szValue[256];
- GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue));
+ GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, _countof(szValue));
if(mir_tstrlen(szValue))
{
if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
@@ -898,12 +898,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
TCHAR szLabel[128];
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hButtonsList);
TreeView_GetItem(hButtonsList,&tvi);
- GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
+ GetWindowText(hwndEdit, szLabel, _countof(szLabel));
hwndEdit=NULL;
if (!mir_tstrlen(szLabel)) break;
@@ -989,7 +989,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, SIZEOF(namebuff));
+ GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, _countof(namebuff));
tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=(mir_tstrlen(namebuff))?namebuff:TranslateT("New Button");
@@ -1039,7 +1039,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
memset(bd,0,sizeof(ButtonData));
- GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, SIZEOF(namebuff));
+ GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, _countof(namebuff));
bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
bd->pszOpName=mir_tstrlen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
@@ -1086,7 +1086,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
while(tvi.hItem){
tvis.hInsertAfter=hti;
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
TreeView_GetItem(hMenuTree,&tvi);
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp
index 67476f6f6a..8b45833498 100644
--- a/plugins/QuickReplies/src/events.cpp
+++ b/plugins/QuickReplies/src/events.cpp
@@ -52,8 +52,8 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1);
char buttonNameTranslated[32], buttonName[32];
- mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x", Translate("Button"), iNumber + 1);
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonNameTranslated, _countof(buttonNameTranslated), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
@@ -81,20 +81,20 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
LIST<wchar_t> replyList(1);
CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
if (mir_strcmp(cbcd->pszModule, buttonName))
return 0;
if (cbcd->dwButtonId != iNumber)
return 1;
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_w(NULL, MODULE, key, 0);
{
if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON)
{
- mir_snprintf(buttonName, SIZEOF(buttonName), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), "%s %x", Translate("Button"), iNumber + 1);
OPENOPTIONSDIALOG ood = {0};
ood.cbSize = sizeof(ood);
@@ -109,7 +109,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
wchar_t *value = db_get_wsa(NULL, MODULE, key);
if (!value)
@@ -137,7 +137,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)replyList[index - 1]);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
if ((BYTE)db_get_b(NULL, MODULE, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
@@ -156,7 +156,7 @@ int OnPreShutdown(WPARAM wParam, LPARAM lParam)
if (ServiceExists(MS_BB_REMOVEBUTTON))
{
char buttonName[32];
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp
index 75e177ab93..3b773487fc 100644
--- a/plugins/QuickReplies/src/options.cpp
+++ b/plugins/QuickReplies/src/options.cpp
@@ -43,7 +43,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam
SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
- GetWindowText(hwnd, text, SIZEOF(text));
+ GetWindowText(hwnd, text, _countof(text));
memmove(text + start, text + end, sizeof(WCHAR) * (mir_wstrlen(text) + 1 - end));
SetWindowText(hwnd, text);
SendMessage(hwnd, EM_SETSEL, start, start);
@@ -71,15 +71,15 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULE, key, 1) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_w(NULL, MODULE, key, 0);
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
wchar_t *value = db_get_wsa(NULL, MODULE, key);
if (value)
{
@@ -117,12 +117,12 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int count = 0;
wchar_t *tszReplies;
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_b(NULL, MODULE, key, 0);
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
db_unset(NULL, MODULE, key);
}
@@ -139,17 +139,17 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int pos = -1, prev = 0;
while ((pos = replies.Find(_T("\r\n"), prev)) != -1)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, count++);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, count++);
db_set_ws(NULL, MODULE, key, replies.Mid(prev, pos - prev).GetBuffer());
prev = pos + 2;
}
}
mir_free(tszReplies);
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
db_set_w(NULL, MODULE, key, count);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
db_set_b(NULL, MODULE, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
return TRUE;
@@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int OnOptInitialized(WPARAM wParam, LPARAM lParam)
{
char tabName[32];
- mir_snprintf(tabName, SIZEOF(tabName), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(tabName, _countof(tabName), "%s %x", Translate("Button"), iNumber + 1);
OPTIONSDIALOGPAGE odp = { 0 };
odp.pszGroup = LPGEN("Message sessions");
diff --git a/plugins/Quotes/src/CommonOptionDlg.cpp b/plugins/Quotes/src/CommonOptionDlg.cpp
index bf3430f43f..be7ea014ce 100644
--- a/plugins/Quotes/src/CommonOptionDlg.cpp
+++ b/plugins/Quotes/src/CommonOptionDlg.cpp
@@ -67,7 +67,7 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr
// refresh rate
HWND hwndCombo = ::GetDlgItem(hWnd, IDC_COMBO_REFRESH_RATE);
LPCTSTR pszRefreshRateTypes[] = { TranslateT("Seconds"), TranslateT("Minutes"), TranslateT("Hours") };
- for (int i = 0; i < SIZEOF(pszRefreshRateTypes); ++i)
+ for (int i = 0; i < _countof(pszRefreshRateTypes); ++i)
{
::SendMessage(hwndCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRefreshRateTypes[i]));
}
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp
index 6205ec3c2e..6976612005 100644
--- a/plugins/Quotes/src/IconLib.cpp
+++ b/plugins/Quotes/src/IconLib.cpp
@@ -18,14 +18,14 @@ static IconItem iconList[] =
void Quotes_IconsInit()
{
- ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, SIZEOF(iconList), QUOTES_PROTOCOL_NAME);
+ ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
}
std::string Quotes_MakeIconName(const char* name)
{
assert(name);
//char szSettingName[100];
- //mir_snprintf(szSettingName,SIZEOF(szSettingName),"%s_%s",QUOTES_PROTOCOL_NAME,name);
+ //mir_snprintf(szSettingName,_countof(szSettingName),"%s_%s",QUOTES_PROTOCOL_NAME,name);
std::string sName(QUOTES_PROTOCOL_NAME);
sName += "_";
sName += name;
@@ -40,7 +40,7 @@ HICON Quotes_LoadIconEx(const char* name, bool bBig /*= false*/)
HANDLE Quotes_GetIconHandle(int iconId)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp
index 17e4237e56..b7f234572b 100644
--- a/plugins/Rate/src/main.cpp
+++ b/plugins/Rate/src/main.cpp
@@ -124,7 +124,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
// IcoLib support
- Icon_Register(g_hInst, LPGEN("Contact rate"), iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, LPGEN("Contact rate"), iconList, _countof(iconList));
// Extra icon support
hExtraIcon = ExtraIcon_Register("contact_rate", LPGEN("Contact rate"), "rate_high");
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp
index 1e8a7ef15f..7cb7e674a3 100644
--- a/plugins/RecentContacts/src/RecentContacts.cpp
+++ b/plugins/RecentContacts/src/RecentContacts.cpp
@@ -278,7 +278,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
GetWindowPlacement(hDlg, &wp);
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", dbLastUC_WindowPosPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", dbLastUC_WindowPosPrefix);
int width = db_get_dw(NULL, dbLastUC_ModuleName, szSettingName, -1);
int right = rect.left - 6;
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp
index daae18a680..679e183168 100644
--- a/plugins/RecentContacts/src/options.cpp
+++ b/plugins/RecentContacts/src/options.cpp
@@ -45,11 +45,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LastUCOpt.WindowAutoSize = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_WINDOWAUTOSIZE);
db_set_b(NULL, dbLastUC_ModuleName, dbLastUC_WindowAutosize, (BYTE)LastUCOpt.WindowAutoSize);
- GetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str, _countof(str));
LastUCOpt.MaxShownContacts= atoi(str);
db_set_b(0,dbLastUC_ModuleName, dbLastUC_MaxShownContacts, LastUCOpt.MaxShownContacts);
- GetDlgItemTextA(hwndDlg, IDC_DATETIME, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DATETIME, str, _countof(str));
db_set_s(0,dbLastUC_ModuleName, dbLastUC_DateTimeFormat, str );
LoadDBSettings();
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp
index 1444053de8..440b36c5c4 100644
--- a/plugins/RemovePersonalSettings/src/rps.cpp
+++ b/plugins/RemovePersonalSettings/src/rps.cpp
@@ -305,7 +305,7 @@ void RemoveProtocolSettings(const char * protocolName)
// Delete it
if (name[0] != '\0') {
- mir_snprintf(moduleName, SIZEOF(moduleName), "%s%s", protocolName, name);
+ mir_snprintf(moduleName, _countof(moduleName), "%s%s", protocolName, name);
DeleteSettingEx(moduleName, NULL);
}
@@ -443,7 +443,7 @@ void RemoveDirectories()
if (accounts[i]->szModuleName == NULL || accounts[i]->szModuleName[0] == '\0')
continue;
- mir_snprintf(dir, SIZEOF(dir), "%s%s", gMirandaDir, accounts[i]->szModuleName);
+ mir_snprintf(dir, _countof(dir), "%s%s", gMirandaDir, accounts[i]->szModuleName);
DeleteFileOrFolder(dir);
}
}
@@ -467,7 +467,7 @@ void RemoveDirectories()
// Delete it
if (name[0] != '\0') {
- mir_snprintf(dir, SIZEOF(dir), "%s%s", gMirandaDir, name);
+ mir_snprintf(dir, _countof(dir), "%s%s", gMirandaDir, name);
DeleteFileOrFolder(dir);
}
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp
index 1cbd805a0b..9125b87dc7 100644
--- a/plugins/SMS/src/SMS_svc.cpp
+++ b/plugins/SMS/src/SMS_svc.cpp
@@ -8,7 +8,7 @@ int LoadServices(void)
pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
// Service creation
- for (size_t i=0;i<SIZEOF(siPluginServices);i++)
+ for (size_t i=0;i<_countof(siPluginServices);i++)
{
memcpy(pszServiceFunctionName,siPluginServices[i].lpszName,(mir_strlen(siPluginServices[i].lpszName)+1));
CreateServiceFunction(szServiceFunction,(MIRANDASERVICE)siPluginServices[i].lpFunc);
@@ -26,7 +26,7 @@ int LoadModules(void)
HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList);
char szServiceFunction[MAX_PATH];
- mir_snprintf(szServiceFunction,SIZEOF(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND);
+ mir_snprintf(szServiceFunction,_countof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 300050000;
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp
index da12ae052a..440f08d8f9 100644
--- a/plugins/SMS/src/functions.cpp
+++ b/plugins/SMS/src/functions.cpp
@@ -99,13 +99,13 @@ DWORD GetContactPhonesCountParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszVa
WCHAR wszPhone[MAX_PHONE_LEN];
size_t i,dwPhoneSize;
- if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhone,SIZEOF(wszPhone),&dwPhoneSize))
+ if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhone,_countof(wszPhone),&dwPhoneSize))
if ( IsPhoneW(wszPhone,dwPhoneSize))
dwRet++;
for (i=0; i <= PHONES_MIN_COUNT; i++) {
- mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i);
- if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhone,SIZEOF(wszPhone),&dwPhoneSize))
+ mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
+ if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhone,_countof(wszPhone),&dwPhoneSize))
if ( IsPhoneW(wszPhone,dwPhoneSize))
dwRet++;
}
@@ -136,7 +136,7 @@ BOOL IsContactPhoneParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,
WCHAR wszPhoneLocal[MAX_PHONE_LEN];
size_t i,dwPhoneSizeLocal;
- if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal))
+ if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneLocal,_countof(wszPhoneLocal),&dwPhoneSizeLocal))
if ( IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize)==CSTR_EQUAL)
@@ -144,8 +144,8 @@ BOOL IsContactPhoneParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,
}
for (i=0; i <= PHONES_MIN_COUNT; i++) {
- mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i);
- if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal)) {
+ mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
+ if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneLocal,_countof(wszPhoneLocal),&dwPhoneSizeLocal)) {
if (IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize) == CSTR_EQUAL)
@@ -416,7 +416,7 @@ static const size_t dwXMLSymbolsCount[] ={sizeof(TCHAR), sizeof(TCHAR), sizeof
//Decode XML coded string. The function translate special xml code into standard characters.
DWORD DecodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize)
{
- DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+ DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),_countof(lpszXMLTags),(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
return(dwRet);
@@ -425,7 +425,7 @@ DWORD DecodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConv
//Encode XML coded string. The function translate special saved xml characters into special characters.
DWORD EncodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize)
{
- DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+ DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),_countof(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
return(dwRet);
@@ -447,7 +447,7 @@ void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour)
if (colour)
{
- mir_snprintf(str,SIZEOF(str),"Font%dCol",i);
+ mir_snprintf(str,_countof(str),"Font%dCol",i);
(*colour)=db_get_dw(NULL,SRMMMOD,str,fontOptionsList[0].defColour);
}
@@ -455,30 +455,30 @@ void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour)
{
if (db_get(NULL,SRMMMOD,str,&dbv))
{
- mir_tstrncpy(lf->lfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName,fontOptionsList[0].szDefFace,_countof(lf->lfFaceName));
}else{
- mir_tstrncpy(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName,dbv.ptszVal,_countof(lf->lfFaceName));
db_free(&dbv);
}
- mir_snprintf(str,SIZEOF(str),"Font%dSize",i);
+ mir_snprintf(str,_countof(str),"Font%dSize",i);
lf->lfHeight=(char)db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defSize);
lf->lfWidth=0;
lf->lfEscapement=0;
lf->lfOrientation=0;
- mir_snprintf(str,SIZEOF(str),"Font%dSty",i);
+ mir_snprintf(str,_countof(str),"Font%dSty",i);
style=db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defStyle);
lf->lfWeight=style&FONTF_BOLD?FW_BOLD:FW_NORMAL;
lf->lfItalic=style&FONTF_ITALIC?1:0;
lf->lfUnderline=0;
lf->lfStrikeOut=0;
- mir_snprintf(str,SIZEOF(str),"Font%dSet",i);
+ mir_snprintf(str,_countof(str),"Font%dSet",i);
lf->lfCharSet=db_get_b(NULL,SRMMMOD,str,MsgDlgGetFontDefaultCharset(lf->lfFaceName));
lf->lfOutPrecision=OUT_DEFAULT_PRECIS;
lf->lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf->lfQuality=DEFAULT_QUALITY;
lf->lfPitchAndFamily=DEFAULT_PITCH|FF_DONTCARE;
- mir_snprintf(str,SIZEOF(str),"Font%d",i);
+ mir_snprintf(str,_countof(str),"Font%d",i);
}
}
diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp
index 0d7eeb597d..824d4a568e 100644
--- a/plugins/SMS/src/main.cpp
+++ b/plugins/SMS/src/main.cpp
@@ -118,17 +118,17 @@ void VersionConversions()
{
WCHAR wsztm[MAX_PATH];
- if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,SIZEOF(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),NULL))
DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
- if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,SIZEOF(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),NULL))
DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
- if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,SIZEOF(wsztm),NULL))
+ if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),NULL))
DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0'));
else
DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK);
diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp
index 63420cb407..4d9cafd7e4 100644
--- a/plugins/SMS/src/options.cpp
+++ b/plugins/SMS/src/options.cpp
@@ -37,14 +37,14 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
- if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),NULL)==FALSE)
- mir_sntprintf(tszSign,SIZEOF(tszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL));
+ if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),NULL)==FALSE)
+ mir_sntprintf(tszSign,_countof(tszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL));
SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign);
{
BOOL bUseSign = DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
CheckDlgButton(hWndDlg, IDC_USESIGNATURE, bUseSign ? BST_CHECKED : BST_UNCHECKED);
- EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),bUseSign);
+ EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),bUseSign);
BOOL bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
CheckDlgButton(hWndDlg, IDC_BEGIN, bSignBebefore ? BST_CHECKED : BST_UNCHECKED);
@@ -60,7 +60,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA
SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0);
switch(LOWORD(wParam)){
case IDC_USESIGNATURE:
- EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE));
+ EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE));
break;
}
break;
@@ -70,7 +70,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA
case 0:
switch (((LPNMHDR)lParam)->code){
case PSN_APPLY:
- GetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign,SIZEOF(tszSign));
+ GetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign,_countof(tszSign));
DB_SMS_SetStringW(NULL,"Signature",tszSign);
DB_SMS_SetByte(NULL,"UseSignature",IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE));
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp
index bc37fe89f3..84eb7cae6e 100644
--- a/plugins/SMS/src/receive.cpp
+++ b/plugins/SMS/src/receive.cpp
@@ -152,10 +152,10 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
tvi.mask=TVIF_TEXT;
tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
tvi.pszText=tszPhone;
- tvi.cchTextMax=SIZEOF(tszPhone);
+ tvi.cchTextMax=_countof(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
}
- else GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(szPhone));
+ else GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(szPhone));
if (ack->result == ACKRESULT_FAILED)
lpszErrorDescription=lpszXML;
@@ -164,7 +164,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam)
GetXMLFieldExBuff(lpszXML,dwXMLSize,szBuff,sizeof(szBuff),NULL,"sms_response","error","params","param",NULL);
}
- mir_sntprintf(tszErrorMessage,SIZEOF(tszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,tszPhone,lpszErrorDescription);
+ mir_sntprintf(tszErrorMessage,_countof(tszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,tszPhone,lpszErrorDescription);
ShowWindow(hWndDlg,SW_SHOWNORMAL);
EnableWindow(hWndDlg,FALSE);
HWND hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc);
@@ -238,7 +238,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent)
}
else {
memcpy(pszServiceFunctionName,SMS_READ,sizeof(SMS_READ));
- mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact));
+ mir_sntprintf(szToolTip,_countof(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact));
CLISTEVENT cle = { sizeof(cle) };
cle.flags = CLEF_TCHAR;
@@ -261,7 +261,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent)
UINT iIcon;
if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) {
memcpy(pszServiceFunctionName,SMS_READ_ACK,sizeof(SMS_READ_ACK));
- mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact));
+ mir_sntprintf(szToolTip,_countof(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact));
CLISTEVENT cle = { sizeof(cle) };
cle.flags = CLEF_TCHAR;
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp
index 3d02256407..230c65c3b8 100644
--- a/plugins/SMS/src/recvdlg.cpp
+++ b/plugins/SMS/src/recvdlg.cpp
@@ -138,7 +138,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
HWND hwndSendSms;
MCONTACT hContact;
- hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone)));
+ hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,_countof(wszPhone)));
hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact);
if (hwndSendSms)
SetFocus(hwndSendSms);
@@ -215,12 +215,12 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
if (dwPhoneSize)
dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
else {
- GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(SIZEOF(wszPhoneLocal)-1),&dwPhoneSize,NULL);
+ GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(_countof(wszPhoneLocal)-1),&dwPhoneSize,NULL);
dwPhoneSize++;
}
lpwszContactDisplayName = GetContactNameW(hContact);
- mir_sntprintf(wszTitle, SIZEOF(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
+ mir_sntprintf(wszTitle, _countof(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH);
SetWindowText(prswdWindowData->hWnd, wszTitle);
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp
index c7e3b640aa..34e1ec1177 100644
--- a/plugins/SMS/src/senddlg.cpp
+++ b/plugins/SMS/src/senddlg.cpp
@@ -146,7 +146,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
size_t dwSignLen = 0;
if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE))
- if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),&dwSignLen))
+ if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),&dwSignLen))
{
SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign);
@@ -155,7 +155,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
EnableWindow(GetDlgItem(hWndDlg,IDOK), dwSignLen != 0);
}
- mir_sntprintf(tszSign,SIZEOF(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg));
+ mir_sntprintf(tszSign,_countof(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg));
SetDlgItemText(hWndDlg,IDC_COUNT,tszSign);
}
@@ -220,12 +220,12 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
tvi.mask=TVIF_TEXT;
tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
tvi.pszText=tszPhone;
- tvi.cchTextMax=SIZEOF(tszPhone);
+ tvi.cchTextMax=_countof(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
}else{
- GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
+ GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone));
}
- mir_sntprintf(tszMessage,SIZEOF(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone);
+ mir_sntprintf(tszMessage,_countof(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone);
KillTimer(hWndDlg,wParam);
ShowWindow(hWndDlg,SW_SHOWNORMAL);
EnableWindow(hWndDlg,FALSE);
@@ -285,11 +285,11 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
tvi.mask = TVIF_TEXT;
tvi.hItem = psswdWindowData->hItemSend;
tvi.pszText = tszPhone;
- tvi.cchTextMax = SIZEOF(tszPhone);
+ tvi.cchTextMax = _countof(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
dwPhoneSize = mir_tstrlen(tszPhone);
}
- else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, SIZEOF(tszPhone));
+ else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone));
dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(int)dwMessageSize+2);
SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
@@ -310,7 +310,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
case IDC_ADDNUMBER:
{
TCHAR tszPhone[MAX_PHONE_LEN];
- if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)))) {
+ if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone)))) {
TVINSERTSTRUCT tvis = {0};
tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.hInsertAfter = TVI_SORT;
@@ -352,7 +352,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
}
}else{
TCHAR tszPhone[MAX_PHONE_LEN];
- size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
+ size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone));
if (IsPhoneW(tszPhone,dwPhoneSize))
{
size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
@@ -394,7 +394,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
EnableWindow(GetDlgItem(hWndDlg,IDOK), dwMessageSize != 0);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg));
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg));
SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff);
}
break;
@@ -405,7 +405,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
TCHAR tszPhone[MAX_PHONE_LEN];
DBVARIANT dbv;
- size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(SIZEOF(tszPhone)-4));
+ size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(_countof(tszPhone)-4));
if (IsPhoneW(tszPhone,dwPhoneSize))
{
if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE)
@@ -413,7 +413,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
mir_tstrcat(tszPhone, _T(" SMS"));
for(DWORD i=0;bCont;i++)
{
- mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i);
+ mir_snprintf(szBuff,_countof(szBuff),"MyPhone%d",i);
if (db_get(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE;
db_free(&dbv);
}
@@ -575,7 +575,7 @@ HWND SendSMSWindowAdd(MCONTACT hContact)
LPTSTR lptszContactDisplayName=GetContactNameW(hContact);
TCHAR tszTitle[MAX_PATH];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS"));
+ mir_sntprintf(tszTitle, _countof(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS"));
SetWindowText(psswdWindowData->hWnd,tszTitle);
SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lptszContactDisplayName);
SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0);
@@ -729,7 +729,7 @@ void SendSMSWindowAsSentSet(HWND hWndDlg)
// lvi.mask=LVIF_TEXT|LVIF_IMAGE;
// lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1;
// lvi.iSubItem=0;
-// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,SIZEOF(szPhone));
+// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,_countof(szPhone));
// lvi.pszText=szPhone;
// lvi.iImage=2;
// ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi);
@@ -881,7 +881,7 @@ void SendSMSWindowNext(HWND hWndDlg)
tvi.mask=TVIF_TEXT;
tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
tvi.pszText=tszPhone;
- tvi.cchTextMax=SIZEOF(tszPhone);
+ tvi.cchTextMax=_countof(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem);
dwPhoneSize=mir_wstrlen(tszPhone);
@@ -985,7 +985,7 @@ void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR
TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN];
size_t i,dwPhoneSize;
- if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize))
+ if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
{
tszPhone[0]='+';
dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
@@ -997,8 +997,8 @@ void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR
for (i=0;TRUE;i++)
{
- mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i);
- if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize))
+ mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
{
tszPhone[0]='+';
dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
@@ -1046,7 +1046,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lp
tvis.hInsertAfter=TVI_SORT;
tvis.item.iImage=tvis.item.iSelectedImage=0;
- if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize))
+ if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
{
tszPhone[0]='+';
dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
@@ -1064,8 +1064,8 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lp
for (i=0;TRUE;i++)
{
- mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i);
- if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize))
+ mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize))
{
tszPhone[0]='+';
dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize);
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index 8559d96745..3005ae0dd6 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -246,8 +246,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,CHAT_MODULE,"NicklistRowDist",12),0));
hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0)?TRUE:FALSE);
hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0)?TRUE:FALSE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, SIZEOF(branch4), 0x1000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
{
TCHAR* pszGroup = NULL;
@@ -323,8 +323,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
else
db_unset(NULL, CHAT_MODULE, "NicklistRowDist");
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, SIZEOF(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, SIZEOF(branch4));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, _countof(branch1));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, _countof(branch4));
pci->ReloadSettings();
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
@@ -365,7 +365,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
TCHAR tszTooltipText[2048];
RECT rect;
- mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText),
+ mir_sntprintf(tszTooltipText, _countof(tszTooltipText),
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
@@ -417,8 +417,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance"), db_get_b(NULL, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE);
hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(NULL, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, branch3, SIZEOF(branch3), 0x03E0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0x0);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, branch3, _countof(branch3), 0x03E0);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
break;
@@ -592,8 +592,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, SIZEOF(branch2));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, SIZEOF(branch3));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, _countof(branch2));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, _countof(branch3));
mir_free(pszText);
@@ -654,7 +654,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_SETRANGE, 0, MAKELONG(100, -1));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_SETPOS, 0, MAKELONG(g_Settings.iPopupTimeout, 0));
- FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), NULL, branch6, SIZEOF(branch6), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), NULL, branch6, _countof(branch6), 0x0000);
break;
case WM_COMMAND:
@@ -714,7 +714,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam
db_set_dw(NULL, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_BKG, CPM_GETCOLOUR, 0, 0));
g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0);
db_set_dw(NULL, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch6, SIZEOF(branch6));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch6, _countof(branch6));
}
return TRUE;
}
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index c099d50a83..280700fbcb 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -53,7 +53,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s
if (pszWordText && pszWordText[0]) {
TCHAR szMenuText[4096];
- mir_sntprintf(szMenuText, SIZEOF(szMenuText), TranslateT("Look up '%s':"), pszWordText);
+ mir_sntprintf(szMenuText, _countof(szMenuText), TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
SetSearchEngineIcons(*hMenu, g_dat.hSearchEngineIconList);
}
@@ -65,7 +65,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s
if (pszWordText)
mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText);
else
- mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
+ mir_tstrncpy(szTemp, TranslateT("&Message"), _countof(szTemp) - 1);
if (mir_tstrlen(szTemp) > 40)
mir_tstrncpy(szTemp + 40, _T("..."), 4);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index cb1655aabc..1ad222c2d8 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -138,7 +138,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
BOOL bToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
int buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
int hSplitterMinTop = TOOLBAR_HEIGHT + si->minLogBoxHeight, hSplitterMinBottom = si->minEditBoxHeight;
- int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
+ int toolbarHeight = bToolbar ? IsToolbarVisible(_countof(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
si->iSplitterY = si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
@@ -147,7 +147,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
if (si->iSplitterY < hSplitterMinBottom)
si->iSplitterY = hSplitterMinBottom;
- ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility, SW_SHOW);
+ ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, buttonVisibility, SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
if (si->iType != GCW_SERVER)
ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
@@ -178,7 +178,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), 0, w - si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY), 0, 0, h - si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 0, 1, h - si->iSplitterY + SPLITTER_HEIGHT, w - 2, si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
- hdwp = ResizeToolbar(hwndDlg, hdwp, w, toolbarTopY + 1, toolbarHeight - 1, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility);
+ hdwp = ResizeToolbar(hwndDlg, hdwp, w, toolbarTopY + 1, toolbarHeight - 1, _countof(toolbarButtons), toolbarButtons, buttonVisibility);
EndDeferWindowPos(hdwp);
if (si->hwndLog != NULL) {
IEVIEWWINDOW ieWindow;
@@ -799,7 +799,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO * p
}
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -967,7 +967,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
TCHAR szNew[2];
szNew[0] = (TCHAR)wParam;
szNew[1] = '\0';
- if (mir_tstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
+ if (mir_tstrlen(si->szSearch) >= _countof(si->szSearch) - 2) {
MessageBeep(MB_OK);
break;
}
@@ -1432,7 +1432,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
char szIndicator = SM_GetStatusIndicator(si, ui);
if (szIndicator > '\0') {
static TCHAR ptszBuf[128];
- mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%c%s"), szIndicator, ui->pszNick);
+ mir_sntprintf(ptszBuf, _countof(ptszBuf), _T("%c%s"), szIndicator, ui->pszNick);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ADDSTRING, 0, (LPARAM)ptszBuf);
}
else SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ADDSTRING, 0, (LPARAM)ui->pszNick);
@@ -1641,7 +1641,7 @@ LABEL_SHOWWINDOW:
USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
if (ui != NULL) {
static TCHAR ptszBuf[1024];
- mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ mir_sntprintf(ptszBuf, _countof(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
@@ -1919,7 +1919,7 @@ LABEL_SHOWWINDOW:
case WM_RBUTTONUP:
hToolbarMenu = CreatePopupMenu();
- for (int i = 0; i < SIZEOF(toolbarButtons); i++) {
+ for (int i = 0; i < _countof(toolbarButtons); i++) {
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
mii.fType = MFT_STRING;
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 3ef13e7fa4..d7ebe89278 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -212,7 +212,7 @@ void ReleaseIcons()
HICON GetCachedIcon(const char *name)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (!mir_strcmp(iconList[i].szName, name))
return IcoLib_GetIconByHandle(iconList[i].hIcolib);
@@ -231,13 +231,13 @@ void LoadGlobalIcons()
ImageList_RemoveAll(g_dat.hChatButtonIconList);
ImageList_RemoveAll(g_dat.hHelperIconList);
ImageList_RemoveAll(g_dat.hSearchEngineIconList);
- for (i = 0; i < SIZEOF(buttonIcons); i++) {
+ for (i = 0; i < _countof(buttonIcons); i++) {
if (buttonIcons[i] == NULL)
ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, NULL, ID_STATUS_OFFLINE);
else
ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(buttonIcons[i]));
}
- for (i = 0; i < SIZEOF(chatButtonIcons); i++)
+ for (i = 0; i < _countof(chatButtonIcons); i++)
ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(chatButtonIcons[i]));
ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp
index 69f9219bf2..a0f1370476 100644
--- a/plugins/Scriver/src/input.cpp
+++ b/plugins/Scriver/src/input.cpp
@@ -293,8 +293,8 @@ void RegisterKeyBindings()
desc.pszName = strName;
desc.pszDescription = strDesc;
for (int i = 0; i < 9; i++) {
- mir_snprintf(strName, SIZEOF(strName), "Scriver/Nav/Tab %d", i + 1);
- mir_snprintf(strDesc, SIZEOF(strDesc), Translate("Navigate: tab %d"), i + 1);
+ mir_snprintf(strName, _countof(strName), "Scriver/Nav/Tab %d", i + 1);
+ mir_snprintf(strDesc, _countof(strDesc), Translate("Navigate: tab %d"), i + 1);
desc.lParam = KB_TAB1 + i;
desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, '1' + i);
Hotkey_Register(&desc);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 995921af6d..5157c96e90 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -191,14 +191,14 @@ static void SetDialogToType(HWND hwndDlg)
ShowWindow(dat->infobarData->hWnd, SW_HIDE);
if (dat->hContact) {
- ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
+ ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
if (!g_dat.smileyAddInstalled)
ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEYS), SW_HIDE);
}
- else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
+ else ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
if (dat->hwndLog != NULL)
@@ -302,7 +302,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
ptrT pszWord(GetRichTextWord(hwnd, &ptl));
if (pszWord && pszWord[0]) {
TCHAR szMenuText[4096];
- mir_sntprintf(szMenuText, SIZEOF(szMenuText), TranslateT("Look up '%s':"), pszWord);
+ mir_sntprintf(szMenuText, _countof(szMenuText), TranslateT("Look up '%s':"), pszWord);
ModifyMenu(hSubMenu, 5, MF_STRING | MF_BYPOSITION, 5, szMenuText);
SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList);
}
@@ -457,7 +457,7 @@ static void SubclassLogEdit(HWND hwnd)
static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
{
ParentWindowData *pdat = dat->parent;
- int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
+ int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(_countof(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
int hSplitterMinTop = toolbarHeight + dat->minLogBoxHeight, hSplitterMinBottom = dat->minEditBoxHeight;
int infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
int infobarHeight = INFO_BAR_HEIGHT;
@@ -522,7 +522,7 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_AVATAR), 0, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTER), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
+ hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
EndDeferWindowPos(hdwp);
if (dat->hwndLog != NULL) {
@@ -750,7 +750,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
dat->minLogBoxHeight = dat->minEditBoxHeight;
dat->toolbarSize.cy = TOOLBAR_HEIGHT;
- dat->toolbarSize.cx = GetToolbarWidth(SIZEOF(toolbarButtons), toolbarButtons);
+ dat->toolbarSize.cx = GetToolbarWidth(_countof(toolbarButtons), toolbarButtons);
if (dat->splitterPos == -1)
dat->splitterPos = dat->minEditBoxHeight;
WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
@@ -770,7 +770,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(hwndDlg, DM_CHANGEICONS, 0, 0);
// Make them flat buttons
- for (int i = 0; i < SIZEOF(toolbarButtons); i++)
+ for (int i = 0; i < _countof(toolbarButtons); i++)
SendDlgItemMessage(hwndDlg, toolbarButtons[i].controlId, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_ADD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Add contact permanently to list"), 0);
@@ -926,7 +926,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_RBUTTONUP:
hToolbarMenu = CreatePopupMenu();
- for (int i = 0; i < SIZEOF(toolbarButtons); i++) {
+ for (int i = 0; i < _countof(toolbarButtons); i++) {
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
mii.fType = MFT_STRING;
@@ -959,7 +959,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
TCHAR** ppFiles = NULL;
for (i = 0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
+ DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
AddToFileList(&ppFiles, &totalCount, szFilename);
}
CallServiceSync(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
@@ -1367,8 +1367,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
else if (dat->lastMessage) {
TCHAR date[64], time[64];
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0);
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, _countof(date), 0);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, _countof(time), 0);
mir_sntprintf(szText, TranslateT("Last message received on %s at %s."), date, time);
sbd.pszText = szText;
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 537673b5a2..82c42d91de 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int RTL_Detect(WCHAR *pszwText);
static int logPixelSY;
static char* pLogIconBmpBits[3];
-static size_t logIconBmpSize[SIZEOF(pLogIconBmpBits)];
+static size_t logIconBmpSize[_countof(pLogIconBmpBits)];
static HIMAGELIST g_hImageList;
#define STREAMSTAGE_HEADER 0
@@ -379,7 +379,7 @@ static char* SetToStyle(int style)
static char szStyle[128];
LOGFONT lf;
LoadMsgDlgFont(style, &lf, NULL);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY);
+ mir_snprintf(szStyle, _countof(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY);
return szStyle;
}
@@ -425,8 +425,8 @@ TCHAR* TimestampToString(DWORD dwFlags, time_t check, int mode)
mir_tstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? _T("s") : _T("t"));
}
if (format[0] != '\0') {
- TimeZone_PrintTimeStamp(NULL, check, format, str, SIZEOF(str), 0);
- mir_tstrncat(szResult, str, SIZEOF(szResult) - mir_tstrlen(szResult));
+ TimeZone_PrintTimeStamp(NULL, check, format, str, _countof(str), 0);
+ mir_tstrncat(szResult, str, _countof(szResult) - mir_tstrlen(szResult));
}
return szResult;
}
@@ -465,7 +465,7 @@ static int DetectURL(wchar_t *text, BOOL firstChar) {
if (!((c >= '0' && c<='9') || (c >= 'A' && c<='Z') || (c >= 'a' && c<='z'))) {
int found = 0;
int i, len = 0;
- int prefixlen = SIZEOF(prefixes);
+ int prefixlen = _countof(prefixes);
for (i = 0; i < prefixlen; i++) {
if (!wcsncmp(text, prefixes[i].text, prefixes[i].length)) {
len = prefixes[i].length;
@@ -909,7 +909,7 @@ void LoadMsgLogIcons(void)
HICON hIcon = NULL;
RECT rc;
- g_hImageList = ImageList_Create(10, 10, ILC_COLOR32 | ILC_MASK, SIZEOF(pLogIconBmpBits), 0);
+ g_hImageList = ImageList_Create(10, 10, ILC_COLOR32 | ILC_MASK, _countof(pLogIconBmpBits), 0);
HBRUSH hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
HBRUSH hInBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR));
HBRUSH hOutBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR));
@@ -929,7 +929,7 @@ void LoadMsgLogIcons(void)
HDC hdcMem = CreateCompatibleDC(hdc);
PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);
HBRUSH hBrush = hBkgBrush;
- for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
+ for (int i = 0; i < _countof(pLogIconBmpBits); i++) {
switch (i) {
case LOGICON_MSG_IN:
ImageList_AddIcon(g_hImageList, GetCachedIcon("scriver_INCOMING"));
@@ -976,7 +976,7 @@ void LoadMsgLogIcons(void)
void FreeMsgLogIcons(void)
{
- for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++)
+ for (int i = 0; i < _countof(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
ImageList_RemoveAll(g_hImageList);
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index 171ebfca17..7b56f8f3d2 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -76,7 +76,7 @@ static const FontOptionsList fontOptionsList[] = {
{ LPGENT("Info bar status message"), RGB(50, 50, 50), _T("Arial"), FONTF_ITALIC, -11, LPGENT("Info bar background")}
};
-int fontOptionsListSize = SIZEOF(fontOptionsList);
+int fontOptionsListSize = _countof(fontOptionsList);
struct ColourOptionsList
{
@@ -108,37 +108,37 @@ void RegisterFontServiceFonts()
FontIDT fid = { sizeof(fid) };
_tcsncpy_s(fid.group, LPGENT("Messaging"), _TRUNCATE);
_tcsncpy_s(fid.backgroundGroup, LPGENT("Messaging"), _TRUNCATE);
- strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
+ strncpy(fid.dbSettingsGroup, SRMMMOD, _countof(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID;
- for (int i = 0; i < SIZEOF(fontOptionsList); i++) {
+ for (int i = 0; i < _countof(fontOptionsList); i++) {
fid.order = i;
char szTemp[100];
mir_snprintf(szTemp, "SRMFont%d", i);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
- _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
+ strncpy(fid.prefix, szTemp, _countof(fid.prefix));
+ _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].defColour;
fid.deffontsettings.size = fontOptionsList[i].defSize;
fid.deffontsettings.style = fontOptionsList[i].defStyle;
fid.deffontsettings.charset = DEFAULT_CHARSET;
- _tcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace));
- _tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fid.deffontsettings.szFace));
+ _tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, _countof(fid.backgroundName));
FontRegisterT(&fid);
}
ColourIDT cid = { sizeof(cid) };
_tcsncpy_s(cid.group, LPGENT("Messaging"), _TRUNCATE);
- strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
+ strncpy(cid.dbSettingsGroup, SRMMMOD, _countof(fid.dbSettingsGroup));
cid.flags = 0;
- for (int i = 0; i < SIZEOF(colourOptionsList); i++) {
+ for (int i = 0; i < _countof(colourOptionsList); i++) {
cid.order = i;
- _tcsncpy(cid.name, colourOptionsList[i].szName, SIZEOF(cid.name));
+ _tcsncpy(cid.name, colourOptionsList[i].szName, _countof(cid.name));
if (colourOptionsList[i].systemColor != -1)
cid.defcolour = GetSysColor(colourOptionsList[i].systemColor);
else
cid.defcolour = colourOptionsList[i].defColour;
- strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting));
+ strncpy(cid.setting, colourOptionsList[i].szSettingName, _countof(cid.setting));
ColourRegisterT(&cid);
}
}
@@ -192,7 +192,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
if (tszFace == NULL)
mir_tstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else
- _tcsncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName));
+ _tcsncpy(lf->lfFaceName, tszFace, _countof(lf->lfFaceName));
mir_snprintf(str, "%s%dSet", "SRMFont", i);
lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET);
@@ -957,7 +957,7 @@ int OptInitialise(WPARAM wParam, LPARAM)
odp.hInstance = g_hInst;
odp.pszTitle = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < SIZEOF(tabPages); i++) {
+ for (int i = 0; i < _countof(tabPages); i++) {
odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
odp.pfnDlgProc = tabPages[i].dlgProc;
odp.pszTab = (char *)tabPages[i].tabName;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index ba09683dd0..fc46292811 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -129,7 +129,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
cle.hDbEvent = hDbEvent;
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName);
+ mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), contactName);
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -208,7 +208,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) {
TCHAR szTip[256];
- mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(szTip, _countof(szTip), TranslateT("%s is typing a message"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
if ( ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2 & SMF2_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn;
tn.szProto = NULL;
@@ -282,7 +282,7 @@ static void RestoreUnreadMessageAlerts(void)
else {
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
}
@@ -629,7 +629,7 @@ STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEU
STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
{
TCHAR sztName[64];
- mir_sntprintf(sztName, SIZEOF(sztName), _T("s%u"), nextStgId++);
+ mir_sntprintf(sztName, _countof(sztName), _T("s%u"), nextStgId++);
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp
index c1071ad415..6a88b6ea87 100644
--- a/plugins/Scriver/src/msgwindow.cpp
+++ b/plugins/Scriver/src/msgwindow.cpp
@@ -88,7 +88,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto)
size_t i, len;
for (len = 0, p = tmplt; *p; p++, len++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i++) {
+ for (i = 0; i < _countof(titleTokenNames); i++) {
int tnlen = (int)mir_tstrlen(titleTokenNames[i]);
if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
len += tokenLen[i] - 1;
@@ -104,7 +104,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto)
TCHAR *title = (TCHAR*)mir_alloc(sizeof(TCHAR) * (len + 1));
for (len = 0, p = tmplt; *p; p++) {
if (*p == '%') {
- for (i = 0; i < SIZEOF(titleTokenNames); i++) {
+ for (i = 0; i < _countof(titleTokenNames); i++) {
size_t tnlen = mir_tstrlen(titleTokenNames[i]);
if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
if (tokens[i] != NULL) {
@@ -115,7 +115,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto)
break;
}
}
- if (i < SIZEOF(titleTokenNames))
+ if (i < _countof(titleTokenNames))
continue;
}
title[len++] = *p;
@@ -128,7 +128,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto)
if (isTemplate)
mir_free(tmplt);
- for (i = 0; i < SIZEOF(titleTokenNames); i++)
+ for (i = 0; i < _countof(titleTokenNames); i++)
mir_free(tokens[i]);
mir_free(pszNewTitleEnd);
@@ -518,9 +518,9 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
curSel = TabCtrl_GetCurSel(hwnd);
item.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_TEXT;
item.pszText = sBuffer;
- item.cchTextMax = SIZEOF(sBuffer);
+ item.cchTextMax = _countof(sBuffer);
TabCtrl_GetItem(hwnd, dat->srcTab, &item);
- sBuffer[SIZEOF(sBuffer) - 1] = '\0';
+ sBuffer[_countof(sBuffer) - 1] = '\0';
if (curSel == dat->srcTab)
curSel = dat->destTab;
@@ -1133,14 +1133,14 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
char *szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
if (!dat->windowWasCascaded) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix);
db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.left);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix);
db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.top);
}
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix);
db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix);
db_set_dw(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
db_set_b(hContact, SRMMMOD, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
if (g_dat.lastParent == dat)
@@ -1259,7 +1259,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (tbd != NULL && dat->hwndActive == hwnd) {
if (tbd->iFlags & TBDF_TEXT) {
TCHAR oldtitle[256];
- GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
+ GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
if (mir_tstrcmp(tbd->pszText, oldtitle))
SetWindowText(hwndDlg, tbd->pszText);
}
@@ -1400,7 +1400,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam)
TCITEM tci;
tci.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_STATE;
tci.pszText = szLabel;
- tci.cchTextMax = SIZEOF(szLabel);
+ tci.cchTextMax = _countof(szLabel);
tci.dwStateMask = TCIS_HIGHLIGHTED;
if (TabCtrl_GetItem(hwnd, iTabIndex, &tci)) {
IMAGEINFO info;
@@ -1508,9 +1508,9 @@ int ScriverRestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szMod
GetWindowPlacement(hwnd, &wp);
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sx", szNamePrefix);
int x = db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sy", szNamePrefix);
int y = db_get_dw(hContact, szModule, szSettingName, -1);
if (x == -1)
return 1;
@@ -1520,9 +1520,9 @@ int ScriverRestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szMod
else {
wp.rcNormalPosition.left = x;
wp.rcNormalPosition.top = y;
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%swidth", szNamePrefix);
wp.rcNormalPosition.right = wp.rcNormalPosition.left + db_get_dw(hContact, szModule, szSettingName, -1);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", szNamePrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sheight", szNamePrefix);
wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + db_get_dw(hContact, szModule, szSettingName, -1);
}
wp.flags = 0;
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index 9b292f7a20..fad8d388c0 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -374,29 +374,29 @@ void SearchWord(TCHAR * word, int engine)
ptrA wordURL(mir_urlEncode(wordUTF));
switch (engine) {
case SEARCHENGINE_WIKIPEDIA:
- mir_snprintf(szURL, SIZEOF(szURL), "http://en.wikipedia.org/wiki/%s", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://en.wikipedia.org/wiki/%s", wordURL);
break;
case SEARCHENGINE_YAHOO:
- mir_snprintf(szURL, SIZEOF(szURL), "http://search.yahoo.com/search?p=%s&ei=UTF-8", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://search.yahoo.com/search?p=%s&ei=UTF-8", wordURL);
break;
case SEARCHENGINE_FOODNETWORK:
- mir_snprintf(szURL, SIZEOF(szURL), "http://search.foodnetwork.com/search/delegate.do?fnSearchString=%s", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://search.foodnetwork.com/search/delegate.do?fnSearchString=%s", wordURL);
break;
case SEARCHENGINE_BING:
- mir_snprintf(szURL, SIZEOF(szURL), "http://www.bing.com/search?q=%s&form=OSDSRC", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://www.bing.com/search?q=%s&form=OSDSRC", wordURL);
break;
case SEARCHENGINE_GOOGLE_MAPS:
- mir_snprintf(szURL, SIZEOF(szURL), "http://maps.google.com/maps?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://maps.google.com/maps?q=%s&ie=utf-8&oe=utf-8", wordURL);
break;
case SEARCHENGINE_GOOGLE_TRANSLATE:
- mir_snprintf(szURL, SIZEOF(szURL), "http://translate.google.com/?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://translate.google.com/?q=%s&ie=utf-8&oe=utf-8", wordURL);
break;
case SEARCHENGINE_YANDEX:
- mir_snprintf(szURL, SIZEOF(szURL), "http://yandex.ru/yandsearch?text=%s", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://yandex.ru/yandsearch?text=%s", wordURL);
break;
case SEARCHENGINE_GOOGLE:
default:
- mir_snprintf(szURL, SIZEOF(szURL), "http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ mir_snprintf(szURL, _countof(szURL), "http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8", wordURL);
break;
}
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index 8d1fcc1fd0..25e004f09d 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -30,7 +30,7 @@ void loadSupportedProtocols()
SupPro *p = (SupPro*)mir_calloc(sizeof(SupPro));
p->name = mir_strdup(protos[i]->szModuleName);
if (szNames && p->name) {
- char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp));
+ char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", _countof(tmp) - mir_strlen(tmp));
LPSTR szName = strstr(szNames, tmp);
if (szName) {
szName = strchr(szName, ':');
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp
index bac49973cf..d13a3a746e 100644
--- a/plugins/SecureIM/src/loadicons.cpp
+++ b/plugins/SecureIM/src/loadicons.cpp
@@ -58,7 +58,7 @@ HINSTANCE LoadIconsPack(const char* szIconsPack)
int ReloadIcons(WPARAM wParam, LPARAM lParam)
{
- for (int i = 0; i < SIZEOF(icons); i++) {
+ for (int i = 0; i < _countof(icons); i++) {
HICON hIcon = IcoLib_GetIcon(icons[i].name);
if (icons[i].tbl == TBL_IEC)
g_hIEC[icons[i].idx] = hIcon;
@@ -94,13 +94,13 @@ void InitIcons(void)
g_hIconInst = hNewIconInst;
TCHAR tszPath[MAX_PATH];
- GetModuleFileName(g_hIconInst, tszPath, SIZEOF(tszPath));
+ GetModuleFileName(g_hIconInst, tszPath, _countof(tszPath));
SKINICONDESC sid = { 0 };
sid.section.a = "SecureIM";
sid.defaultFile.t = tszPath;
- for (int i = 0; i < SIZEOF(icons); i++) {
+ for (int i = 0; i < _countof(icons); i++) {
sid.section.a = icons[i].section;
sid.pszName = icons[i].name;
sid.description.a = icons[i].text;
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index ab5c5de63f..dc6dbbf80b 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -212,7 +212,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
SkinAddNewSound("OutgoingSecureMessage", LPGEN("Outgoing Secure Message"), "Sounds\\oSecureMessage.wav");
// init extra icons
- for (int i = 0; i < SIZEOF(g_IEC); i++)
+ for (int i = 0; i < _countof(g_IEC); i++)
g_IEC[i] = (HANDLE)-1;
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index a3e2b75b60..60beb05651 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -518,7 +518,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
switch (LOWORD(wParam)) {
case IDC_RSA_COPY:
char txt[128];
- GetDlgItemText(hDlg, IDC_RSA_SHA, txt, SIZEOF(txt));
+ GetDlgItemText(hDlg, IDC_RSA_SHA, txt, _countof(txt));
CopyToClipboard(hDlg, txt);
return TRUE;
@@ -803,17 +803,17 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
{
char gpgexe[256];
char filter[128];
- GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, gpgexe, SIZEOF(gpgexe));
+ GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, gpgexe, _countof(gpgexe));
// filter zusammensetzen
- mir_snprintf(filter, SIZEOF(filter), _T("%s (*.exe)%c*.exe%c%c"), Translate("Executable Files"), 0, 0, 0);
+ mir_snprintf(filter, _countof(filter), _T("%s (*.exe)%c*.exe%c%c"), Translate("Executable Files"), 0, 0, 0);
// OPENFILENAME initialisieren
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = filter;
ofn.lpstrFile = gpgexe;
- ofn.nMaxFile = SIZEOF(gpgexe);
+ ofn.nMaxFile = _countof(gpgexe);
ofn.lpstrTitle = Translate("Select GnuPG Executable");
ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY;
@@ -1042,7 +1042,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit)
if (bPGPloaded && ver) {
char pgpVerStr[64];
- mir_snprintf(pgpVerStr, SIZEOF(pgpVerStr), Translate(sim218), ver >> 24, (ver >> 16) & 255, (ver >> 8) & 255);
+ mir_snprintf(pgpVerStr, _countof(pgpVerStr), Translate(sim218), ver >> 24, (ver >> 16) & 255, (ver >> 8) & 255);
SetDlgItemText(hDlg, IDC_PGP_SDK, pgpVerStr);
}
else SetDlgItemText(hDlg, IDC_PGP_SDK, Translate(sim219));
@@ -1327,9 +1327,9 @@ void ApplyGPGSettings(HWND hDlg)
{
char tmp[256];
- GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgExec", tmp);
- GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgHome", tmp);
bSavePass = (IsDlgButtonChecked(hDlg, IDC_SAVEPASS_CBOX) == BST_CHECKED);
@@ -1337,14 +1337,14 @@ void ApplyGPGSettings(HWND hDlg)
BOOL bgpgLogFlag = (IsDlgButtonChecked(hDlg, IDC_LOGGINGON_CBOX) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgLogFlag", bgpgLogFlag);
- GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgLog", tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(0);
BOOL bgpgTmpFlag = (IsDlgButtonChecked(hDlg, IDC_TMPPATHON_CBOX) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgTmpFlag", bgpgTmpFlag);
- GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, SIZEOF(tmp));
+ GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgTmp", tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(0);
@@ -1414,7 +1414,7 @@ void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus)
UINT getListViewPSK(HWND hLV, UINT iItem)
{
char str[128];
- LV_GetItemTextA(hLV, iItem, 4, str, SIZEOF(str));
+ LV_GetItemTextA(hLV, iItem, 4, str, _countof(str));
return strncmp(str, Translate(sim206), sizeof(str)) == 0;
}
@@ -1428,7 +1428,7 @@ void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus)
UINT getListViewPUB(HWND hLV, UINT iItem)
{
char str[128];
- LV_GetItemTextA(hLV, iItem, 4, str, SIZEOF(str));
+ LV_GetItemTextA(hLV, iItem, 4, str, _countof(str));
return strncmp(str, Translate(sim233), sizeof(str)) == 0;
}
@@ -1548,14 +1548,14 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort)
{
// restore sort column
char t[32];
- mir_snprintf(t, SIZEOF(t), "os%02x", (UINT)lParamSort & 0xF0);
+ mir_snprintf(t, _countof(t), "os%02x", (UINT)lParamSort & 0xF0);
if ((lParamSort & 0x0F) == 0)
lParamSort = (int)db_get_b(0, MODULENAME, t, lParamSort + 1);
db_set_b(0, MODULENAME, t, (BYTE)lParamSort);
// restore sort order
- mir_snprintf(t, SIZEOF(t), "os%02x", (UINT)lParamSort);
+ mir_snprintf(t, _countof(t), "os%02x", (UINT)lParamSort);
int m = db_get_b(0, MODULENAME, t, 0);
if (bChangeSortOrder) { m = !m; db_set_b(0, MODULENAME, t, m); }
@@ -1571,7 +1571,7 @@ BOOL ShowSelectKeyDlg(HWND hParent, LPSTR KeyPath)
ofn.lpstrFile = KeyPath;
char temp[MAX_PATH];
- mir_snprintf(temp, SIZEOF(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
+ mir_snprintf(temp, _countof(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrTitle = TranslateT("Open Key File");
if (!GetOpenFileName(&ofn)) return FALSE;
@@ -1628,7 +1628,7 @@ BOOL SaveExportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv)
OPENFILENAME ofn = { sizeof(ofn) };
char temp[MAX_PATH];
- mir_snprintf(temp, SIZEOF(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
+ mir_snprintf(temp, _countof(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.hwndOwner = hParent;
ofn.nMaxFile = MAX_PATH;
@@ -1661,7 +1661,7 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv)
ofn.Flags = OFN_EXPLORER | OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN;
ofn.lpstrFile = szFile;
char temp[MAX_PATH];
- mir_snprintf(temp, SIZEOF(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
+ mir_snprintf(temp, _countof(temp), _T("%s (*.asc)%c*.asc%c%s (*.*)%c*.*%c%c"), Translate("ASC files"), 0, 0, Translate("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrTitle = (priv) ? TranslateT("Load Private Key File") : TranslateT("Load Public Key File");
if (!GetOpenFileName(&ofn))
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp
index 393659d271..88f3235436 100644
--- a/plugins/SecureIM/src/popupOptions.cpp
+++ b/plugins/SecureIM/src/popupOptions.cpp
@@ -111,19 +111,19 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
break;
case IDC_TIMEKEY:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMEKEY, getTimeout, SIZEOF(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMEKEY, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutKey", getTimeout);
break;
case IDC_TIMESEC:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMESEC, getTimeout, SIZEOF(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMESEC, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutSec", getTimeout);
break;
case IDC_TIMESR:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMESR, getTimeout, SIZEOF(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMESR, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutSR", getTimeout);
break;
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp
index 0d5dd38d57..59a5f30230 100644
--- a/plugins/SecureIM/src/svcs_clist.cpp
+++ b/plugins/SecureIM/src/svcs_clist.cpp
@@ -77,7 +77,7 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam)
// check offline/online
if (!ptr) {
// hide menu bars
- for (i = 0; i < SIZEOF(g_hMenu); i++)
+ for (i = 0; i < _countof(g_hMenu); i++)
Menu_ShowItem(g_hMenu[i], false);
return 0;
}
@@ -90,7 +90,7 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam)
bool isMiranda = isClientMiranda(hContact);
// hide all menu bars
- for (i = 0; i < SIZEOF(g_hMenu); i++)
+ for (i = 0; i < _countof(g_hMenu); i++)
Menu_ShowItem(g_hMenu[i], false);
if (isSecureProto && !isChat && isMiranda &&
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp
index 6698122920..857719e78f 100644
--- a/plugins/SeenPlugin/src/history.cpp
+++ b/plugins/SeenPlugin/src/history.cpp
@@ -174,7 +174,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA
TranslateDialogDefault(hwndDlg);
hContact = (MCONTACT)lparam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lparam);
- mir_sntprintf(sztemp, SIZEOF(sztemp), _T("%s: %s"),
+ mir_sntprintf(sztemp, _countof(sztemp), _T("%s: %s"),
CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
TranslateT("last seen history"));
SetWindowText(hwndDlg, sztemp);
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp
index f975ff4f39..3ff3d8751c 100644
--- a/plugins/SeenPlugin/src/missed.cpp
+++ b/plugins/SeenPlugin/src/missed.cpp
@@ -107,9 +107,9 @@ int ShowMissed(void)
TCHAR sztemp[1024], szcount[7];
for (int loop = 0; loop < mcs.count; loop++) {
- mir_tstrncat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR), SIZEOF(sztemp) - mir_tstrlen(sztemp));
+ mir_tstrncat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR), _countof(sztemp) - mir_tstrlen(sztemp));
if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
- mir_sntprintf(szcount, SIZEOF(szcount), _T(" [%i]"), mcs.times[loop]);
+ mir_sntprintf(szcount, _countof(szcount), _T(" [%i]"), mcs.times[loop]);
mir_tstrcat(sztemp, szcount);
}
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp
index e51c8dad93..8bb34912f8 100644
--- a/plugins/SeenPlugin/src/options.cpp
+++ b/plugins/SeenPlugin/src/options.cpp
@@ -92,10 +92,10 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp
SendDlgItemMessage(hdlg, idText, CPM_SETCOLOUR, 0, ppd.colorText);
ppd.lchIcon = Skin_LoadProtoIcon(NULL, idBack);
- GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp));
_tcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL, 0), MAX_CONTACTNAME);
- GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, _countof(szstamp));
_tcsncpy(ppd.lptzText, ParseString(szstamp, NULL, 0), MAX_SECONDLINE);
PUAddPopupT(&ppd);
@@ -131,10 +131,10 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp
case 0:
switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
- GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "PopupStamp", szstamp);
- GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "PopupStampText", szstamp);
bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_POPUPS);
@@ -278,7 +278,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM
if (LOWORD(wparam) == IDC_VARIABLES) {
char szout[2048];
- mir_snprintf(szout, SIZEOF(szout), VARIABLE_LIST);
+ mir_snprintf(szout, _countof(szout), VARIABLE_LIST);
MessageBoxA(hdlg, szout, Translate("Last Seen Variables"), MB_OK | MB_TOPMOST);
}
break; //case WM_COMMAND
@@ -288,19 +288,19 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM
case 0:
switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
- GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "MenuStamp", szstamp);
- GetDlgItemText(hdlg, IDC_USERSTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_USERSTAMP, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "UserStamp", szstamp);
- GetDlgItemText(hdlg, IDC_FILESTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_FILESTAMP, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "FileStamp", szstamp);
- GetDlgItemText(hdlg, IDC_FILENAME, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_FILENAME, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "FileName", szstamp);
- GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, SIZEOF(szstamp));
+ GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, _countof(szstamp));
db_set_ts(NULL, S_MOD, "HistoryStamp", szstamp);
db_set_w(NULL, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, NULL, FALSE) + 1));
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 6a1818d295..65a3d1f613 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -266,7 +266,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
case 'G':
if (!db_get_ts(hcontact, "CList", "Group", &dbv)) {
- _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, dbv.ptszVal, _countof(szdbsetting));
db_free(&dbv);
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -287,7 +287,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
_ltot(ci.dVal, szdbsetting, 10);
break;
case CNFT_ASCIIZ:
- _tcsncpy(szdbsetting, ci.pszVal, SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, ci.pszVal, _countof(szdbsetting));
break;
}
}
@@ -297,10 +297,10 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
case 's':
if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) {
- _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting | 0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting | 0x8000), GSMDF_TCHAR), _countof(szdbsetting));
if (!(isetting & 0x8000)) {
- mir_tstrncat(szdbsetting, _T("/"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting));
- mir_tstrncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_tstrncat(szdbsetting, _T("/"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -317,10 +317,10 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
case 'o':
if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) {
- _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), _countof(szdbsetting));
if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
- mir_tstrncat(szdbsetting, _T("/"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting));
- mir_tstrncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_tstrncat(szdbsetting, _T("/"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
+ mir_tstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_tstrlen(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -333,7 +333,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
if (db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
goto LBL_noData;
- _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, dbv.ptszVal, _countof(szdbsetting));
db_free(&dbv);
charPtr = szdbsetting;
}
@@ -343,13 +343,13 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
goto LBL_noData;
ia.S_un.S_addr = htonl(dwsetting);
- _tcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), _countof(szdbsetting));
charPtr = szdbsetting;
}
goto LBL_charPtr;
case 'P':
- _tcsncpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")), SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")), _countof(szdbsetting));
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -359,7 +359,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
case 'C': // Get Client Info
if (!db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) {
- _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, dbv.ptszVal, _countof(szdbsetting));
db_free(&dbv);
}
else goto LBL_noData;
@@ -374,7 +374,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile)
{
PROTOACCOUNT *pa = Proto_GetAccount(ci.szProto);
if (!pa) goto LBL_noData;
- _tcsncpy(szdbsetting, pa->tszAccountName, SIZEOF(szdbsetting));
+ _tcsncpy(szdbsetting, pa->tszAccountName, _countof(szdbsetting));
charPtr = szdbsetting;
goto LBL_charPtr;
}
@@ -642,7 +642,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam)
if (p == NULL) {
p = (logthread_info*)mir_calloc(sizeof(logthread_info));
p->hContact = hContact;
- mir_strncpy(p->sProtoName, cws->szModule, SIZEOF(p->sProtoName));
+ mir_strncpy(p->sProtoName, cws->szModule, _countof(p->sProtoName));
arContacts.insert(p);
mir_forkthread(waitThread, p);
}
@@ -697,7 +697,7 @@ int ModeChange(WPARAM wparam, LPARAM lparam)
db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
if (!Miranda_Terminated() && IsWatchedProtocol(ack->szModule)) {
logthread_info *info = (logthread_info *)mir_alloc(sizeof(logthread_info));
- mir_strncpy(info->sProtoName, courProtoName, SIZEOF(info->sProtoName));
+ mir_strncpy(info->sProtoName, courProtoName, _countof(info->sProtoName));
info->hContact = 0;
info->currStatus = 0;
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index 60a9880d06..8ab4a7063d 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -166,7 +166,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP
memcpy(tmp+len,_T("[/img][/url]"),13*sizeof(TCHAR)); len+=12;
}
}else
- len=GetDlgItemText(hwndDlg,edtID,tmp,SIZEOF(tmp));
+ len=GetDlgItemText(hwndDlg,edtID,tmp,_countof(tmp));
int retries=3;
do{
if(!OpenClipboard(hwndDlg)){
@@ -382,12 +382,12 @@ void CSend::DB_EventAdd(WORD EventType)
void CSend::Error(LPCTSTR pszFormat, ...) {
TCHAR tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszMsg, SIZEOF(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
+ mir_sntprintf(tszMsg, _countof(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
mir_free(m_ErrorTitle), m_ErrorTitle = mir_tstrdup(tszMsg);
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
mir_free(m_ErrorMsg), m_ErrorMsg = mir_tstrdup(tszMsg);
diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
index 19981fe00b..8e0eb9e5ef 100644
--- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
@@ -199,7 +199,7 @@ void TfrmAbout::btnPageClick() {
TCHAR newTitle[128];
TCHAR* pszPlug = mir_a2t(__PLUGIN_NAME);
TCHAR* pszVer = mir_a2t(__VERSION_STRING_DOTS);
- mir_sntprintf(newTitle,SIZEOF(newTitle), _T("%s - %s\nv%s"), pszPlug, title , pszVer);
+ mir_sntprintf(newTitle,_countof(newTitle), _T("%s - %s\nv%s"), pszPlug, title , pszVer);
mir_free(pszPlug);
mir_free(pszVer);
SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle);
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index 407a953d9a..23a20bc874 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -68,7 +68,7 @@ INT_PTR CALLBACK TfrmMain::DlgProc_CaptureTabPage(HWND hDlg, UINT uMsg, WPARAM w
if(HIWORD(wParam)==BN_CLICKED && LOWORD(wParam)==ID_btnExplore){ /// local file tab
OPENFILENAME ofn={sizeof(OPENFILENAME)};
TCHAR filename[MAX_PATH];
- GetDlgItemText(hDlg,ID_edtSize,filename,SIZEOF(filename));
+ GetDlgItemText(hDlg,ID_edtSize,filename,_countof(filename));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = _T("Images\0*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tif;*.tiff\0");
@@ -235,7 +235,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
if(m_MonitorCount >1) {
TCHAR tszTemp[120];
for(size_t mon=0; mon<m_MonitorCount; ++mon) { /// @todo : fix format for non MSVC compilers
- mir_sntprintf(tszTemp, SIZEOF(tszTemp),_T("%Iu. %s%s"),
+ mir_sntprintf(tszTemp, _countof(tszTemp),_T("%Iu. %s%s"),
mon+1, TranslateT("Monitor"),
(m_Monitors[mon].dwFlags & MONITORINFOF_PRIMARY) ? TranslateT(" (primary)") : _T("")
);
@@ -775,7 +775,7 @@ void TfrmMain::btnCaptureClick() {
if(m_opt_tabCapture==1) m_hTargetWindow=GetDesktopWindow();
else if(m_opt_tabCapture==2){
TCHAR filename[MAX_PATH];
- GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, SIZEOF(filename));
+ GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, _countof(filename));
FILE* fp=_wfopen(filename,_T("rb"));
if(!fp){
TCHAR *err = TranslateT("Select a file");
@@ -910,8 +910,8 @@ void TfrmMain::edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl
_itot(rect.right - rect.left, B, 10);
// _itot_s(rect.bottom - rect.top, H, 16, 10);
_itot(rect.bottom - rect.top, H, 10);
- mir_tstrncat(B, _T("x"), SIZEOF(B) - mir_tstrlen(B));
- mir_tstrncat(B, H, SIZEOF(B) - mir_tstrlen(B));
+ mir_tstrncat(B, _T("x"), _countof(B) - mir_tstrlen(B));
+ mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B));
SetDlgItemText(hTarget, Ctrl, B);
}
@@ -921,8 +921,8 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) {
_itot(ABS(rect.right - rect.left), B, 10);
// _itot_s(ABS(rect.bottom - rect.top), H, 16, 10);
_itot(ABS(rect.bottom - rect.top), H, 10);
- mir_tstrncat(B, _T("x"), SIZEOF(B) - mir_tstrlen(B));
- mir_tstrncat(B, H, SIZEOF(B) - mir_tstrlen(B));
+ mir_tstrncat(B, _T("x"), _countof(B) - mir_tstrlen(B));
+ mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B));
SetDlgItemText(hTarget, Ctrl, B);
}
@@ -953,7 +953,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) {
mir_tstradd(pszFileDesc, TranslateT("for Client area "));
}
mir_tstradd(pszFileDesc, TranslateT("of \""));
- GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, SIZEOF(winText));
+ GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, _countof(winText));
mir_tstradd(pszFileDesc, winText);
if(m_opt_tabCapture==1)
mir_tstradd(pszFileDesc, _T("\""));
@@ -1105,7 +1105,7 @@ void TfrmMain::FormClose() {
bool bCanDelete=m_opt_btnDeleteAfterSend;
if(m_opt_tabCapture==2){ /// existing file
TCHAR description[1024];
- GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, SIZEOF(description));
+ GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, _countof(description));
if(!IsWindowEnabled(GetDlgItem(m_hWnd,ID_chkDesc)) || !m_opt_btnDesc)
*description='\0';
if(m_cSend) {
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
index 5a6911d71b..4a217d2430 100644
--- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp
+++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
@@ -192,7 +192,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien
RECT sizeText;
HFONT hOldFont;
- ccText = GetWindowTextW(ctl->hwnd, wszText, SIZEOF(wszText));
+ ccText = GetWindowTextW(ctl->hwnd, wszText, _countof(wszText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -301,7 +301,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient)
SIZE sizeText;
HFONT hOldFont;
- ccText = GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ ccText = GetWindowText(ctl->hwnd, szText, _countof(szText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -548,7 +548,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
case BUTTONTRANSLATE:
{
TCHAR szButton[MAX_PATH];
- GetWindowText(bct->hwnd, szButton, SIZEOF(szButton));
+ GetWindowText(bct->hwnd, szButton, _countof(szButton));
SetWindowText(bct->hwnd, TranslateTS(szButton));
}
break;
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
index 9fc6ec2705..82ff842cdb 100644
--- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
+++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
@@ -511,8 +511,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
@@ -680,7 +680,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = { 0 };
@@ -703,11 +703,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszTitle, SIZEOF(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
+ mir_sntprintf(tszTitle, _countof(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = {0};
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp
index 7842865d55..919392bc50 100644
--- a/plugins/Sessions/Src/Main.cpp
+++ b/plugins/Sessions/Src/Main.cpp
@@ -202,7 +202,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
int i = 0, length = GetWindowTextLength(GetDlgItem(hdlg, IDC_LIST));
SavePosition(hdlg, "SaveDlg");
if (length > 0) {
- GetDlgItemText(hdlg, IDC_LIST, szUserSessionName, SIZEOF(szUserSessionName));
+ GetDlgItemText(hdlg, IDC_LIST, szUserSessionName, _countof(szUserSessionName));
szUserSessionName[length + 1] = '\0';
if (IsDlgButtonChecked(hdlg, IDC_SELCONTACTS) && bSC) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
@@ -603,17 +603,17 @@ int DelUserDefSession(int ses_count)
}
char szSessionName[256];
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", ses_count);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "UserSessionDsc", ses_count);
db_unset(NULL, MODNAME, szSessionName);
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "FavUserSession", ses_count);
db_unset(NULL, MODNAME, szSessionName);
for (int i = ses_count + 1;; i++) {
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "UserSessionDsc", i);
ptrT szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i - 1);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "UserSessionDsc", i - 1);
if (szSessionNameBuf) {
MarkUserDefSession(i - 1, IsMarkedUserDefSession(i));
db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
@@ -621,7 +621,7 @@ int DelUserDefSession(int ses_count)
else {
db_unset(NULL, MODNAME, szSessionName);
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", i - 1);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "FavUserSession", i - 1);
db_unset(NULL, MODNAME, szSessionName);
break;
}
@@ -639,14 +639,14 @@ int DeleteAutoSession(int ses_count)
}
char szSessionName[256];
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", ses_count);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "SessionDate", ses_count);
db_unset(NULL, MODNAME, szSessionName);
for (int i = ses_count + 1;; i++) {
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "SessionDate", i);
ptrT szSessionNameBuf(db_get_tsa(NULL, MODNAME, szSessionName));
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i - 1);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "SessionDate", i - 1);
if (szSessionNameBuf)
db_set_ts(NULL, MODNAME, szSessionName, szSessionNameBuf);
else {
@@ -894,6 +894,6 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, SessionPreShutdown);
// Icons
- Icon_Register(g_hInst, MODNAME, iconList, SIZEOF(iconList));
+ Icon_Register(g_hInst, MODNAME, iconList, _countof(iconList));
return 0;
}
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp
index 6db5100514..7cec0108b9 100644
--- a/plugins/Sessions/Src/Options.cpp
+++ b/plugins/Sessions/Src/Options.cpp
@@ -378,7 +378,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
if (bSesssionNameChanged) {
if (GetWindowTextLength(hComboBoxEdit)) {
TCHAR szUserSessionName[MAX_PATH] = { '\0' };
- GetWindowText(hComboBoxEdit, szUserSessionName, SIZEOF(szUserSessionName));
+ GetWindowText(hComboBoxEdit, szUserSessionName, _countof(szUserSessionName));
RenameUserDefSession(opses_count, szUserSessionName);
SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT, 0, 0);
LoadSessionToCombobox(hdlg, 1, 255, "UserSessionDsc", 0);
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp
index a5eab0ebb8..039c508fb7 100644
--- a/plugins/Sessions/Src/Utils.cpp
+++ b/plugins/Sessions/Src/Utils.cpp
@@ -127,7 +127,7 @@ bool LoadContactsFromMask(MCONTACT hContact, int mode, int count)
void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode)
{
char szFormNumBuf[100];
- mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%02u", ordernum);
+ mir_snprintf(szFormNumBuf, _countof(szFormNumBuf), "%02u", ordernum);
if (mode == 0) {
ptrA szValue(db_get_sa(hContact, MODNAME, "LastSessionsMarks"));
@@ -149,7 +149,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode)
db_set_s(hContact, MODNAME, "LastSessionsOrder", temp);
}
else if (writemode == 1) {
- mir_snprintf(szFormNumBuf, SIZEOF(szFormNumBuf), "%02u%s", ordernum, "000000000000000000");
+ mir_snprintf(szFormNumBuf, _countof(szFormNumBuf), "%02u%s", ordernum, "000000000000000000");
db_set_s(hContact, MODNAME, "LastSessionsOrder", szFormNumBuf);
}
}
@@ -229,7 +229,7 @@ BOOL ResaveSettings(char *szName, int iFirst, int iLimit, TCHAR *szBuffer)
break;
char szNameBuf[256];
- mir_snprintf(szNameBuf, SIZEOF(szNameBuf), "%s_%u", szName, i);
+ mir_snprintf(szNameBuf, _countof(szNameBuf), "%s_%u", szName, i);
TCHAR *ptszTemp = db_get_tsa(NULL, MODNAME, szNameBuf);
db_set_ts(NULL, MODNAME, szNameBuf, szBuffer);
@@ -297,7 +297,7 @@ int LoadSessionToCombobox(HWND hdlg, BOOL mode, int iLimit, char* pszSetting, in
}
for (int i = 0; i < iLimit; i++) {
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_%u", pszSetting, i);
+ mir_snprintf(szBuffer, _countof(szBuffer), "%s_%u", pszSetting, i);
TCHAR *pszBuffer = db_get_tsa(NULL, MODNAME, szBuffer);
if (pszBuffer) {
if (!IsMarkedUserDefSession(i + iFirstNum) || mode == 1) {
@@ -326,7 +326,7 @@ int FillFavoritesMenu(HMENU hMenu, int iLimit)
for (int i = 0; i < iLimit; i++) {
if (IsMarkedUserDefSession(i)) {
char szBuffer[256];
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s_%u", "UserSessionDsc", i);
+ mir_snprintf(szBuffer, _countof(szBuffer), "%s_%u", "UserSessionDsc", i);
TCHAR *pszBuffer = db_get_tsa(NULL, MODNAME, szBuffer);
if (pszBuffer) {
AppendMenu(hMenu, MF_STRING, i + 1, pszBuffer);
@@ -361,14 +361,14 @@ int CheckContactVisibility(MCONTACT hContact)
void RenameUserDefSession(int ses_count, TCHAR* ptszNewName)
{
char szSession[256];
- mir_snprintf(szSession, SIZEOF(szSession), "%s_%u", "UserSessionDsc", ses_count);
+ mir_snprintf(szSession, _countof(szSession), "%s_%u", "UserSessionDsc", ses_count);
db_set_ts(NULL, MODNAME, szSession, ptszNewName);
}
int MarkUserDefSession(int ses_count, BYTE bCheck)
{
char szSessionName[256];
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "FavUserSession", ses_count);
db_set_b(NULL, MODNAME, szSessionName, bCheck);
return 0;
}
@@ -376,7 +376,7 @@ int MarkUserDefSession(int ses_count, BYTE bCheck)
BYTE IsMarkedUserDefSession(int ses_count)
{
char szSessionName[256];
- mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
+ mir_snprintf(szSessionName, _countof(szSessionName), "%s_%u", "FavUserSession", ses_count);
return db_get_b(NULL, MODNAME, szSessionName, 0);
}
diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp
index 12a09506a4..10e018ae3e 100644
--- a/plugins/ShellExt/src/main.cpp
+++ b/plugins/ShellExt/src/main.cpp
@@ -26,8 +26,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if (fdwReason == DLL_PROCESS_ATTACH) {
bIsVistaPlus = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != NULL;
- GetTempPath(SIZEOF(tszLogPath), tszLogPath);
- _tcscat_s(tszLogPath, SIZEOF(tszLogPath), _T("shlext.log"));
+ GetTempPath(_countof(tszLogPath), tszLogPath);
+ _tcscat_s(tszLogPath, _countof(tszLogPath), _T("shlext.log"));
hInst = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
@@ -127,7 +127,7 @@ STDAPI DllRegisterServer()
return E_FAIL;
TCHAR tszFileName[MAX_PATH];
- GetModuleFileName(hInst, tszFileName, SIZEOF(tszFileName));
+ GetModuleFileName(hInst, tszFileName, _countof(tszFileName));
if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(lstrlen(tszFileName)+1)))
return E_FAIL;
if ( RegSetValueExA(kInprocServer, "ThreadingModel", 0, REG_SZ, (PBYTE)str4, sizeof(str4)))
diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp
index b3402a65f1..3e4ddc83f8 100644
--- a/plugins/ShellExt/src/options.cpp
+++ b/plugins/ShellExt/src/options.cpp
@@ -8,7 +8,7 @@ static void AutoSize(HWND hwnd)
HFONT hOldFont = (HFONT)SelectObject(hDC, hFont);
TCHAR szBuf[MAX_PATH];
- int i = GetWindowText(hwnd, szBuf, SIZEOF(szBuf));
+ int i = GetWindowText(hwnd, szBuf, _countof(szBuf));
SIZE tS;
GetTextExtentPoint32(hDC, szBuf, i, &tS);
@@ -34,7 +34,7 @@ static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LP
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
comReg = IsCOMRegistered();
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s (%s)"),
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%s (%s)"),
TranslateTS(COM_OKSTR[ (comReg & COMREG_OK) != 0 ]),
TranslateTS(COM_APPROVEDSTR[ (comReg & COMREG_APPROVED) != 0 ]));
SetDlgItemText(hwndDlg, IDC_STATUS, szBuf);
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp
index c77d6f3d86..fe15398aee 100644
--- a/plugins/ShellExt/src/shlcom.cpp
+++ b/plugins/ShellExt/src/shlcom.cpp
@@ -90,7 +90,7 @@ BOOL AddToList(TAddArgList& args)
HANDLE hFind = FindFirstFileA(szBuf, &fd);
while (true) {
if (fd.cFileName[0] != '.') {
- mir_snprintf(szBuf, SIZEOF(szBuf),"%s\\%s", args.szFile, fd.cFileName);
+ mir_snprintf(szBuf, _countof(szBuf),"%s\\%s", args.szFile, fd.cFileName);
// keep a copy of the current thing being processed
szThis = args.szFile;
args.szFile = szBuf;
@@ -559,8 +559,8 @@ void CheckUnregisterServer()
if (bIsVistaPlus) {
// launches regsvr to remove the dll under admin.
TCHAR szFileName[MAX_PATH], szBuf[MAX_PATH * 2];
- GetModuleFileName(hInst, szFileName, SIZEOF(szFileName));
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("/s /u \"%s\""), szFileName);
+ GetModuleFileName(hInst, szFileName, _countof(szFileName));
+ mir_sntprintf(szBuf, _countof(szBuf), _T("/s /u \"%s\""), szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = _T("runas");
@@ -588,8 +588,8 @@ void CheckRegisterServer()
TranslateT("Shell context menus requires your permission to register with Windows Explorer (one time only)."),
TranslateT("Miranda NG - Shell context menus (shellext.dll)"), MB_OK | MB_ICONINFORMATION);
// /s = silent
- GetModuleFileName(hInst, szFileName, SIZEOF(szFileName));
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("/s \"%s\""), szFileName);
+ GetModuleFileName(hInst, szFileName, _countof(szFileName));
+ mir_sntprintf(szBuf, _countof(szBuf), _T("/s \"%s\""), szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = _T("runas");
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index c6a38af98c..f87f1b2c09 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -114,7 +114,7 @@ INT CheckDefaults(WPARAM, LPARAM)
for (int c=ID_STATUS_ONLINE; c<ID_STATUS_IDLE; c++)
{
- mir_snprintf(szStatus,SIZEOF(szStatus),"%d",c);
+ mir_snprintf(szStatus,_countof(szStatus),"%d",c);
if (c == ID_STATUS_ONLINE || c == ID_STATUS_FREECHAT || c == ID_STATUS_INVISIBLE)
continue;
else
@@ -193,7 +193,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
if (isQun)
return FALSE;
- mir_snprintf(szStatus,SIZEOF(szStatus),"%d",status);
+ mir_snprintf(szStatus,_countof(szStatus),"%d",status);
if (!db_get_ts(NULL,protocolname,szStatus,&dbv))
{
if (*dbv.ptszVal)
@@ -286,7 +286,7 @@ extern "C" int __declspec(dllexport)Load(void)
HookEvent(ME_DB_EVENT_ADDED, addEvent);
HookEvent(ME_SYSTEM_MODULESLOADED, CheckDefaults);
- Icon_RegisterT(hinstance, _T("Simple Auto Replier"), iconList, SIZEOF(iconList));
+ Icon_RegisterT(hinstance, _T("Simple Auto Replier"), iconList, _countof(iconList));
return 0;
}
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp
index 40b6b01bdd..25055aca41 100644
--- a/plugins/SimpleAR/src/Options.cpp
+++ b/plugins/SimpleAR/src/Options.cpp
@@ -25,7 +25,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
for (INT c = ID_STATUS_ONLINE; c < ID_STATUS_IDLE; c++)
{
- mir_snprintf(tszStatus, SIZEOF(tszStatus), "%d", c);
+ mir_snprintf(tszStatus, _countof(tszStatus), "%d", c);
pszStatus=(TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)c,GSMDF_TCHAR);
if (c == ID_STATUS_ONLINE || c == ID_STATUS_FREECHAT || c == ID_STATUS_INVISIBLE)
continue;
@@ -98,7 +98,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib;
Menu_ModifyItem(hEnableMenu, &mi);
- GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, SIZEOF(ptszText));
+ GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, _countof(ptszText));
db_set_ts(NULL, protocolname, KEY_HEADING, ptszText);
INT size = GetDlgItemInt(hwndDlg, IDC_INTERVAL, &translated, FALSE);
@@ -116,7 +116,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
else
{
char szStatus[6] = {0};
- mir_snprintf(szStatus, SIZEOF(szStatus), "%d", c);
+ mir_snprintf(szStatus, _countof(szStatus), "%d", c);
if (c<ID_STATUS_FREECHAT && ptszMessage[c-ID_STATUS_ONLINE-1])
db_set_ts(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-1]);
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp
index 178dc5206b..30d89eeb56 100644
--- a/plugins/SimpleStatusMsg/src/awaymsg.cpp
+++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp
@@ -110,15 +110,15 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
- GetWindowText(hwndDlg, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, status, contactName);
+ GetWindowText(hwndDlg, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, status, contactName);
SetWindowText(hwndDlg, str);
if (dat->hSeq) {
- GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, status);
+ GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, status);
}
else {
- mir_sntprintf(str, SIZEOF(str), TranslateT("Failed to retrieve %s message."), status);
+ mir_sntprintf(str, _countof(str), TranslateT("Failed to retrieve %s message."), status);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
}
SetDlgItemText(hwndDlg, IDC_RETRIEVING, str);
@@ -165,7 +165,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
break;
if (EmptyClipboard()) {
TCHAR msg[1024];
- int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
+ int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));
if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
@@ -234,8 +234,8 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL;
WindowList_Add(hWindowList2, hwndDlg, dat->hContact);
contactName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)dat->hContact, GCDNF_TCHAR);
- GetWindowText(hwndDlg, format, SIZEOF(format));
- mir_sntprintf(str, SIZEOF(str), format, contactName);
+ GetWindowText(hwndDlg, format, _countof(format));
+ mir_sntprintf(str, _countof(str), format, contactName);
SetWindowText(hwndDlg, str);
if (!dat->hSeq)
DestroyWindow(hwndDlg);
@@ -377,7 +377,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam)
iHidden = 0;
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
clmi.hIcon = Skin_LoadProtoIcon(szProto, iStatus);
- mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
}
@@ -390,7 +390,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam)
clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
if (!iHidden && szMsg != NULL) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
- mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_sntprintf(str, _countof(str), TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
Menu_ModifyItem(hCopyMsgMenuItem, &clmi);
@@ -398,7 +398,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam)
clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
if (!iHidden && szMsg != NULL && StrFindURL(szMsg) != NULL) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
- mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
+ mir_sntprintf(str, _countof(str), TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
clmi.ptszName = str;
}
Menu_ModifyItem(hGoToURLMenuItem, &clmi);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp
index 1e2fa45748..b577217bf0 100644
--- a/plugins/SimpleStatusMsg/src/main.cpp
+++ b/plugins/SimpleStatusMsg/src/main.cpp
@@ -69,21 +69,21 @@ void log2file(const char *fmt, ...)
HANDLE hFile = CreateFileA("simplestatusmsg.log", GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
SetFilePointer(hFile, 0, 0, FILE_END);
- strncpy(szText, "[\0", SIZEOF(szText));
+ strncpy(szText, "[\0", _countof(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
- GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, SIZEOF(szText));
+ GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, _countof(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
- strncpy(szText, "] \0", SIZEOF(szText));
+ strncpy(szText, "] \0", _countof(szText));
va_start(va, fmt);
- mir_vsnprintf(szText + mir_strlen(szText), SIZEOF(szText) - mir_strlen(szText), fmt, va);
+ mir_vsnprintf(szText + mir_strlen(szText), _countof(szText) - mir_strlen(szText), fmt, va);
va_end(va);
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
- strncpy(szText, "\n\0", SIZEOF(szText));
+ strncpy(szText, "\n\0", _countof(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
CloseHandle(hFile);
@@ -225,9 +225,9 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
}
t.wMinute = mm % 60;
t.wHour = mm / 60;
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &t, NULL, substituteStr, SIZEOF(substituteStr));
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &t, NULL, substituteStr, _countof(substituteStr));
}
- else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, SIZEOF(substituteStr));
+ else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr));
if (mir_tstrlen(substituteStr) > 6)
msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
@@ -237,7 +237,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
}
else if (!_tcsnicmp(msg + i, _T("%date%"), 6))
{
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, SIZEOF(substituteStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
if (mir_tstrlen(substituteStr) > 6)
msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
@@ -258,7 +258,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
if (ran_to > ran_from)
{
- mir_sntprintf(substituteStr, SIZEOF(substituteStr), _T("%d"), GetRandom(ran_from, ran_to));
+ mir_sntprintf(substituteStr, _countof(substituteStr), _T("%d"), GetRandom(ran_from, ran_to));
for (k = i + 1; msg[k]; k++) if (msg[k] == '%') { k++; break; }
if (mir_tstrlen(substituteStr) > k - i)
@@ -276,7 +276,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
DBVARIANT dbv;
BOOL rmark[25];
- for (k = 0; k < SIZEOF(rmark); k++) rmark[k] = FALSE;
+ for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
maxk = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
if (maxk == 0) rmark[0] = TRUE;
@@ -324,7 +324,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
DBVARIANT dbv;
BOOL rmark[25];
- for (k = 0; k < SIZEOF(rmark); k++) rmark[k] = FALSE;
+ for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
maxk = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
if (maxk == 0) rmark[0] = TRUE;
@@ -1366,14 +1366,14 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d
if (iCurrentStatus < ID_STATUS_ONLINE)
continue;
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szBuffer, _countof(szBuffer), "FCur%sMsg", accounts->pa[i]->szModuleName);
if (db_get_ts(NULL, "SimpleStatusMsg", szBuffer, &dbv))
continue;
tszMsg = InsertVarsIntoMsg(dbv.ptszVal, accounts->pa[i]->szModuleName, iCurrentStatus, NULL);
db_free(&dbv);
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "Cur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szBuffer, _countof(szBuffer), "Cur%sMsg", accounts->pa[i]->szModuleName);
if (!db_get_ts(NULL, "SimpleStatusMsg", szBuffer, &dbv))
{
if (tszMsg && dbv.ptszVal && !mir_tstrcmp(tszMsg, dbv.ptszVal) || !tszMsg && !dbv.ptszVal)
@@ -1663,7 +1663,7 @@ static TCHAR *ParseDate(ARGUMENTSINFO *ai)
TCHAR szStr[128] = {0};
ai->flags |= AIF_DONTPARSE;
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, SIZEOF(szStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, _countof(szStr));
return mir_tstrdup(szStr);
}
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp
index 083a0aa7e1..0ce63d8e39 100644
--- a/plugins/SimpleStatusMsg/src/msgbox.cpp
+++ b/plugins/SimpleStatusMsg/src/msgbox.cpp
@@ -285,7 +285,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
}
cbei.iItem = -1;
cbei.pszText = (LPTSTR)text;
- cbei.cchTextMax = SIZEOF(text);
+ cbei.cchTextMax = _countof(text);
cbei.lParam = MAKELPARAM(CLEAR_HISTORY, 0);
SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
}
@@ -301,7 +301,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
cbei.iIndent = 1;
}
cbei.pszText = (LPTSTR)text;
- cbei.cchTextMax = SIZEOF(text);
+ cbei.cchTextMax = _countof(text);
cbei.lParam = MAKELPARAM(ADD_MSG, 0);
SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
@@ -316,7 +316,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
}
cbei.iItem = -1;
cbei.pszText = (LPTSTR)text;
- cbei.cchTextMax = SIZEOF(text);
+ cbei.cchTextMax = _countof(text);
cbei.lParam = MAKELPARAM(DELETE_SELECTED, 0);
SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
}
@@ -600,7 +600,7 @@ int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
TCHAR msg[1024], text[1024];
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
- len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg));
+ len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg));
if (!len)
return -1;
@@ -609,7 +609,7 @@ int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
for (int i = 1; i <= data->num_def_msgs; i++, num_items--) {
newitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
newitem.iItem = num_items;
- newitem.cchTextMax = SIZEOF(text);
+ newitem.cchTextMax = _countof(text);
newitem.pszText = text;
SendMessage(data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&newitem);
@@ -622,7 +622,7 @@ int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
newitem.iItem = -1;
newitem.pszText = (LPTSTR)msg;
- newitem.cchTextMax = SIZEOF(msg);
+ newitem.cchTextMax = _countof(msg);
if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) {
newitem.mask = CBEIF_LPARAM | CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
newitem.iImage = I_ICON_MSG;
@@ -643,7 +643,7 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel)
char text[16], buff2[80];
for (i = 1; i <= data->max_hist_msgs; i++) {
- mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
+ mir_snprintf(text, _countof(text), "SMsg%d", i);
db_set_ts(NULL, "SimpleStatusMsg", text, _T(""));
}
db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
@@ -657,7 +657,7 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel)
if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(buff2, _countof(buff2), "Last%sMsg", accounts->pa[i]->szModuleName);
db_set_s(NULL, "SimpleStatusMsg", buff2, "");
}
db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)data->max_hist_msgs);
@@ -687,7 +687,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg)
if (dlg_data->m_iCountdown != -2)
return;
- len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg));
+ len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg));
if (db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0)) {
int index, num_lines = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINECOUNT, 0, 0);
for (int i = 1; i < num_lines; ++i) {
@@ -696,7 +696,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg)
lines++;
}
}
- mir_sntprintf(status_text, SIZEOF(status_text), TranslateT("OK (%d)"), len - (lines - 1));
+ mir_sntprintf(status_text, _countof(status_text), TranslateT("OK (%d)"), len - (lines - 1));
SetDlgItemText(hwndDlg, IDC_OK, status_text);
}
@@ -780,7 +780,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
TCHAR szTitle[256], szProtoName[128];
BOOL bDisabled = msgbox_data->m_szProto && !(CallProtoService(msgbox_data->m_szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND);
- mir_sntprintf(szProtoName, SIZEOF(szProtoName), msgbox_data->m_szProto ? Proto_GetAccount(msgbox_data->m_szProto)->tszAccountName : TranslateT("global"));
+ mir_sntprintf(szProtoName, _countof(szProtoName), msgbox_data->m_szProto ? Proto_GetAccount(msgbox_data->m_szProto)->tszAccountName : TranslateT("global"));
if (iStatus == ID_STATUS_CURRENT) {
if (msgbox_data->m_bOnStartup)
mir_sntprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<startup>"), szProtoName);
@@ -822,7 +822,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
EnableWindow(msgbox_data->recent_cbex, TRUE);
// TODO what if num_start <= 0 ?
- if (GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg)))
+ if (GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg)))
fcursel = SendMessage(msgbox_data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)msg);
if (fcursel != CB_ERR) {
SendMessage(msgbox_data->recent_cbex, CB_SETCURSEL, fcursel, 0);
@@ -830,7 +830,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
}
if ((msgbox_data->m_iDlgFlags & DLG_SHOW_BUTTONS) || (msgbox_data->m_iDlgFlags & DLG_SHOW_BUTTONS_FLAT)) {
- if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg))) {
+ if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg))) {
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BADD)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BADD), FALSE);
}
@@ -845,7 +845,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
COMBOBOXEXITEM cbitem = {0};
cbitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
cbitem.iItem = msgbox_data->curr_sel_msg;
- cbitem.cchTextMax = SIZEOF(msg);
+ cbitem.cchTextMax = _countof(msg);
cbitem.pszText = msg;
SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&cbitem);
if (LOWORD(cbitem.lParam) == PREDEFINED_MSG) {
@@ -904,8 +904,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
TranslateDialogDefault(hwndDlg);
init_data = (struct MsgBoxInitData *)lParam;
- GetWindowText(hwndDlg, szFormat, SIZEOF(szFormat));
- mir_sntprintf(szProtoName, SIZEOF(szProtoName), init_data->m_szProto ? Proto_GetAccount(init_data->m_szProto)->tszAccountName : TranslateT("global"));
+ GetWindowText(hwndDlg, szFormat, _countof(szFormat));
+ mir_sntprintf(szProtoName, _countof(szProtoName), init_data->m_szProto ? Proto_GetAccount(init_data->m_szProto)->tszAccountName : TranslateT("global"));
if (init_data->m_iStatus == ID_STATUS_CURRENT) {
if (init_data->m_bOnStartup)
@@ -1001,7 +1001,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if ((copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS) || (copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS_FLAT)) {
TCHAR msg[1024];
- if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg)))
+ if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BADD), FALSE);
if (copy_init_data->curr_sel_msg == -1) {
@@ -1012,7 +1012,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
COMBOBOXEXITEM cbitem = {0};
cbitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
cbitem.iItem = copy_init_data->curr_sel_msg;
- cbitem.cchTextMax = SIZEOF(msg);
+ cbitem.cchTextMax = _countof(msg);
cbitem.pszText = msg;
SendMessage(copy_init_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&cbitem);
@@ -1099,7 +1099,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
else {
TCHAR str[64];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Closing in %d"), msgbox_data->m_iCountdown);
+ mir_sntprintf(str, _countof(str), TranslateT("Closing in %d"), msgbox_data->m_iCountdown);
SetDlgItemText(hwndDlg, IDC_OK, str);
}
msgbox_data->m_iCountdown--;
@@ -1124,7 +1124,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
- iMsgLen = GetDlgItemText(hwndDlg, IDC_EDIT1, tszMsg, SIZEOF(tszMsg));
+ iMsgLen = GetDlgItemText(hwndDlg, IDC_EDIT1, tszMsg, _countof(tszMsg));
if (iMsgLen == 0) {
char szSetting[80];
@@ -1179,10 +1179,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (!mir_tstrcmp(dbv.ptszVal, tszMsg)) {
found = TRUE;
if (msgbox_data->m_szProto) {
- mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", msgbox_data->m_szProto);
+ mir_snprintf(buff2, _countof(buff2), "Last%sMsg", msgbox_data->m_szProto);
db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
- mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", msgbox_data->m_szProto);
+ mir_snprintf(buff2, _countof(buff2), "%sMsg", msgbox_data->m_szProto);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
}
else {
@@ -1200,10 +1200,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
+ mir_snprintf(buff2, _countof(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
- mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", accounts->pa[j]->szModuleName);
+ mir_snprintf(buff2, _countof(buff2), "%sMsg", accounts->pa[j]->szModuleName);
iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
}
@@ -1227,10 +1227,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
db_set_ts(NULL, "SimpleStatusMsg", buff, tszMsg);
if (msgbox_data->m_szProto) {
- mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", msgbox_data->m_szProto);
+ mir_snprintf(buff2, _countof(buff2), "Last%sMsg", msgbox_data->m_szProto);
db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
- mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", msgbox_data->m_szProto);
+ mir_snprintf(buff2, _countof(buff2), "%sMsg", msgbox_data->m_szProto);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg);
}
else {
@@ -1248,10 +1248,10 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(buff2, SIZEOF(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
+ mir_snprintf(buff2, _countof(buff2), "Last%sMsg", accounts->pa[j]->szModuleName);
db_set_s(NULL, "SimpleStatusMsg", buff2, buff);
- mir_snprintf(buff2, SIZEOF(buff2), "%sMsg", accounts->pa[j]->szModuleName);
+ mir_snprintf(buff2, _countof(buff2), "%sMsg", accounts->pa[j]->szModuleName);
iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName);
db_set_ts(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg);
}
@@ -1292,7 +1292,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BDEL)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BDEL), FALSE);
- if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg))) {
+ if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg))) {
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BADD)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BADD), FALSE);
}
@@ -1345,7 +1345,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
cbitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
cbitem.iItem = cur_sel;
- cbitem.cchTextMax = SIZEOF(text);
+ cbitem.cchTextMax = _countof(text);
cbitem.pszText = text;
SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&cbitem);
@@ -1372,7 +1372,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
int fcursel = CB_ERR, num_start;
num_start = SendMessage(msgbox_data->recent_cbex, CB_GETCOUNT, 0, 0);
num_start -= msgbox_data->num_def_msgs + 1;
- GetDlgItemText(hwndDlg, IDC_EDIT1, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg));
fcursel = SendMessage(msgbox_data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)msg);
SendMessage(msgbox_data->recent_cbex, CB_SETCURSEL, fcursel, 0);
}
@@ -1416,7 +1416,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
histitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
histitem.iItem = cur_sel;
- histitem.cchTextMax = SIZEOF(text);
+ histitem.cchTextMax = _countof(text);
histitem.pszText = text;
SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&histitem);
@@ -1529,7 +1529,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
histitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
histitem.iItem = cur_sel;
- histitem.cchTextMax = SIZEOF(text);
+ histitem.cchTextMax = _countof(text);
histitem.pszText = text;
SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&histitem);
@@ -1593,7 +1593,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
for (i = 1; i <= msgbox_data->num_def_msgs; i++) {
cbitem.mask = CBEIF_LPARAM | CBEIF_TEXT;
cbitem.iItem = num_items;
- cbitem.cchTextMax = SIZEOF(text);
+ cbitem.cchTextMax = _countof(text);
cbitem.pszText = text;
SendMessage(msgbox_data->recent_cbex, CBEM_GETITEM, 0, (LPARAM)&cbitem);
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp
index 931ceaa6bf..8710df7052 100644
--- a/plugins/SimpleStatusMsg/src/options.cpp
+++ b/plugins/SimpleStatusMsg/src/options.cpp
@@ -878,7 +878,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, _countof(msg));
if (len > 0)
{
if (data->proto_msg[j].msg == NULL)
@@ -900,7 +900,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
}
else
{
- GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, _countof(msg));
mir_tstrcpy(data->status_msg[j].msg[i], msg);
}
}
@@ -1346,7 +1346,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w
max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10);
for (i = 1; i <= max_hist_msgs; i++) {
- mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
+ mir_snprintf(text, _countof(text), "SMsg%d", i);
db_set_ts(NULL, "SimpleStatusMsg", text, _T(""));
}
db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp
index cff6593801..486bf5481d 100644
--- a/plugins/SimpleStatusMsg/src/utils.cpp
+++ b/plugins/SimpleStatusMsg/src/utils.cpp
@@ -36,19 +36,19 @@ static IconItem iconList[] =
void IconsInit(void)
{
- Icon_Register(g_hInst, LPGEN("Simple Status Message"), iconList, SIZEOF(iconList), "SimpleStatusMsg");
+ Icon_Register(g_hInst, LPGEN("Simple Status Message"), iconList, _countof(iconList), "SimpleStatusMsg");
}
HICON LoadIconEx(const char *name)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "SimpleStatusMsg_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "SimpleStatusMsg_%s", name);
return IcoLib_GetIcon(szSettingName);
}
HANDLE GetIconHandle(int iconId)
{
- for(int i = 0; i < SIZEOF(iconList); i++)
+ for(int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -58,14 +58,14 @@ HANDLE GetIconHandle(int iconId)
void ReleaseIconEx(const char *name)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "SimpleStatusMsg_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "SimpleStatusMsg_%s", name);
IcoLib_Release(szSettingName);
}
HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc)
{
char szProtoEvent[MAXMODULELABELLENGTH];
- mir_snprintf(szProtoEvent, SIZEOF(szProtoEvent), "%s%s", szModule, szEvent);
+ mir_snprintf(szProtoEvent, _countof(szProtoEvent), "%s%s", szModule, szEvent);
HANDLE res = HookEventParam(szProtoEvent, hookProc, (LPARAM)szModule);
arProtoHooks.insert(res);
return res;
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
index 068342e2fc..fab0d1ce7d 100644
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ b/plugins/SkypeStatusChange/src/main.cpp
@@ -100,7 +100,7 @@ int SSC_OnProtocolAck(WPARAM, LPARAM lParam)
if (!g_Options.IsProtocolExcluded(pAckData->szModule)) {
int nStatus = CallProtoService(pAckData->szModule,PS_GETSTATUS,0,0);
- for(size_t i = 0; i < SIZEOF(g_aStatusCode); ++i) {
+ for(size_t i = 0; i < _countof(g_aStatusCode); ++i) {
const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[i];
if (ms.m_nMirandaStatus == nStatus) {
int nPrevStatus;
@@ -171,7 +171,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
mir_cslock guard(g_csStatusInfo);
si = g_CurrStatusInfo;
}
- if (INVALID_INDEX != si.StatusIndex() && si.StatusIndex() < SIZEOF(g_aStatusCode)) {
+ if (INVALID_INDEX != si.StatusIndex() && si.StatusIndex() < _countof(g_aStatusCode)) {
const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[si.StatusIndex()];
HWND wndSkypeAPIWindow = reinterpret_cast<HWND>(wp);
@@ -179,7 +179,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
char szSkypeCmd[BUFFER_SIZE];
const char szSkypeCmdSetStatus[] = "SET USERSTATUS ";
::strncpy_s(szSkypeCmd,szSkypeCmdSetStatus,sizeof(szSkypeCmdSetStatus)/sizeof(szSkypeCmdSetStatus[0]));
- ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd));
+ ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
DWORD cLength = static_cast<DWORD>(mir_strlen(szSkypeCmd));
COPYDATASTRUCT oCopyData;
@@ -201,7 +201,7 @@ LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
const char szSkypeCmdSetStatusMsg[] = "SET PROFILE MOOD_TEXT ";
::strncpy_s(szSkypeCmd,szSkypeCmdSetStatusMsg,sizeof(szSkypeCmdSetStatusMsg)/sizeof(szSkypeCmdSetStatusMsg[0]));
- ::strncat_s(szSkypeCmd, pMsg, SIZEOF(szSkypeCmd) - mir_strlen(szSkypeCmd));
+ ::strncat_s(szSkypeCmd, pMsg, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
DWORD cLength = static_cast<DWORD>(mir_strlen(szSkypeCmd));
diff --git a/plugins/SkypeStatusChange/src/options.cpp b/plugins/SkypeStatusChange/src/options.cpp
index 5fc56c5a53..d761a98d86 100644
--- a/plugins/SkypeStatusChange/src/options.cpp
+++ b/plugins/SkypeStatusChange/src/options.cpp
@@ -79,7 +79,7 @@ void InitProtocolTree(HWND hDlg,HWND hwndTreeCtrl)
nState = TCBS_UNCHECKED;
}
tree_insert_item(hDlg,hwndTreeCtrl,TranslateTS(g_aStatusCode[OFFLINE_STATUS_INDEX].m_ptszStatusName),hti,nState,pItemData);
- for(size_t k = 0; k < SIZEOF(g_aStatusCode); ++k) {
+ for(size_t k = 0; k < _countof(g_aStatusCode); ++k) {
const CMirandaStatus2SkypeStatus& m2s = g_aStatusCode[k];
unsigned long statusFlags = Proto_Status2Flag(m2s.m_nMirandaStatus);
if ((m2s.m_nMirandaStatus != ID_STATUS_OFFLINE) && (nStatusBits & statusFlags) && !(nStatusExcluded & statusFlags)) {
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index fb3ecbb303..06fe5e161e 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -149,12 +149,12 @@ public:
{
TCHAR szClassName[32] = _T("");
- GetClassName(hwnd, szClassName, SIZEOF(szClassName));
+ GetClassName(hwnd, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("#32770")))
return false;
if ((REdit = GetDlgItem(hwnd, MI_IDC_LOG)) != NULL) {
- GetClassName(REdit, szClassName, SIZEOF(szClassName));
+ GetClassName(REdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
mir_tstrcmp(szClassName, _T("RICHEDIT50W")) != 0)
@@ -163,7 +163,7 @@ public:
else return false;
if ((MEdit = GetDlgItem(hwnd, MI_IDC_MESSAGE)) != NULL) {
- GetClassName(MEdit, szClassName, SIZEOF(szClassName));
+ GetClassName(MEdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("Edit")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 6f2f161101..fd4bca89cc 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -140,7 +140,7 @@ void pathToAbsolute(const CMString& pSrc, CMString& pOut)
TCHAR *szVarPath = Utils_ReplaceVarsT(pSrc.c_str());
if (szVarPath == (TCHAR*)CALLSERVICE_NOTFOUND || szVarPath == NULL) {
TCHAR szExpPath[MAX_PATH];
- ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, SIZEOF(szExpPath));
+ ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, _countof(szExpPath));
PathToAbsoluteT(szExpPath, szOutPath);
}
else {
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index d6086dd8f2..779e988246 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -247,7 +247,7 @@ void OptionsDialogType::AddCategory(void)
{
TCHAR cat[30];
- GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, SIZEOF(cat));
+ GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, _countof(cat));
CMString catd = cat;
if (!catd.IsEmpty()) {
@@ -517,7 +517,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
TCHAR filename[MAX_PATH] = _T("");
ofn.lpstrFile = filename;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
CMString inidir;
SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(item);
@@ -564,7 +564,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
void OptionsDialogType::FilenameChanged(void)
{
TCHAR str[MAX_PATH];
- GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, _countof(str));
SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(GetSelProto());
if (smc->GetFilename() != str) {
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp
index 268a65cef4..20b7dcc85d 100644
--- a/plugins/SmileyAdd/src/smileyroutines.cpp
+++ b/plugins/SmileyAdd/src/smileyroutines.cpp
@@ -235,7 +235,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const
TextDocument->Freeze(&cnt);
TCHAR classname[20];
- GetClassName(hwnd, classname, SIZEOF(classname));
+ GetClassName(hwnd, classname, _countof(classname));
bool ishpp = (_tcsncmp(classname, _T("THppRichEdit"), 12) == 0) || fireView;
SetRichCallback(hwnd, NULL, false, true);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp
index 3c568b9735..c2dc9626e6 100644
--- a/plugins/SmileyAdd/src/smileys.cpp
+++ b/plugins/SmileyAdd/src/smileys.cpp
@@ -310,7 +310,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, bool onlyInfo, boo
if (!noerr) {
static const TCHAR errmsg[] = LPGENT("Smiley pack %s not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), modpath.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), modpath.c_str());
ReportError(msgtxt);
}
@@ -473,7 +473,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString&
if (!noerr) {
static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
errorFound = true;
}
@@ -855,7 +855,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr
packnam = "MSN";
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packnam);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packnam);
paths = A2T_SM(path);
CMString patha;
@@ -882,7 +882,7 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString& defau
packnam = "MSN";
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packnam);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packnam);
CMString paths = A2T_SM(path), patha;
pathToAbsolute(paths, patha);
@@ -953,7 +953,7 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co
CMString displayName = dbv.ptszVal;
if (packname != NULL) {
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packname);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packname);
CMString paths = A2T_SM(path), patha;
pathToAbsolute(paths, patha);
@@ -1033,13 +1033,13 @@ SmileyLookup::SmileyLookup(const CMString& str, const bool regexs, const int ind
matcher->getStartingIndex() != matcher->getEndingIndex());
if (!m_valid) {
static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\".");
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
delete matcher;
}
else {
static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" malformed.") ;
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
if (!m_valid)
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index 89de53ef23..5fde61bc34 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -18,7 +18,7 @@ int CheckBayes()
char* tmp = Utils_ReplaceVars("%miranda_userdata%");
if (tmp[mir_strlen(tmp)-1] == '\\')
tmp[mir_strlen(tmp)-1] = 0;
- mir_snprintf(bayesdb_tmp, SIZEOF(bayesdb_tmp), "%s\\%s", tmp, BAYESDB_PATH);
+ mir_snprintf(bayesdb_tmp, _countof(bayesdb_tmp), "%s\\%s", tmp, BAYESDB_PATH);
mir_free(tmp);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
@@ -83,7 +83,7 @@ int OpenBayes()
tmp = Utils_ReplaceVars("%miranda_userdata%");
if (tmp[mir_strlen(tmp)-1] == '\\')
tmp[mir_strlen(tmp)-1] = 0;
- mir_snprintf(bayesdb_fullpath, SIZEOF(bayesdb_fullpath), "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME);
+ mir_snprintf(bayesdb_fullpath, _countof(bayesdb_fullpath), "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME);
mir_free(tmp);
bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath);
if (sqlite3_open(bayesdb_fullpath_utf8, &bayesdbg) == SQLITE_OK)
@@ -111,7 +111,7 @@ int get_token_count(int type)
if (bayesdb == NULL)
return 0;
- mir_snprintf(q, SIZEOF(q), "SELECT COUNT(1) FROM %s", type == SPAM ? "spam" : "ham");
+ mir_snprintf(q, _countof(q), "SELECT COUNT(1) FROM %s", type == SPAM ? "spam" : "ham");
sqlite3_prepare_v2(bayesdb, q, -1, &stmt, NULL);
if (sqlite3_step(stmt) == SQLITE_ROW) {
count = sqlite3_column_int(stmt, 0);
@@ -166,7 +166,7 @@ int get_token_score(int type, char *token)
if (bayesdb == NULL)
return 0;
- mir_snprintf(sql, SIZEOF(sql), "SELECT num FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
+ mir_snprintf(sql, _countof(sql), "SELECT num FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
tokenhash(token, digest);
sqlite3_prepare_v2(bayesdb, sql, -1, &stmt, NULL);
sqlite3_bind_blob(stmt, 1, digest, 16, NULL);
@@ -324,10 +324,10 @@ void learn(int type, TCHAR *msg)
message = mir_u2a(msg);
tok = strtok(message, DELIMS);
- mir_snprintf(sql_counter, SIZEOF(sql_counter), "UPDATE stats SET value=value+1 WHERE key='%s'", type == SPAM ? "spam_msgcount" : "ham_msgcount");
- mir_snprintf(sql_select, SIZEOF(sql_select), "SELECT 1 FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
- mir_snprintf(sql_update, SIZEOF(sql_update), "UPDATE %s SET num=num+1 WHERE token=?", type ? "spam" : "ham");
- mir_snprintf(sql_insert, SIZEOF(sql_insert), "INSERT INTO %s VALUES(?, 1)", type ? "spam" : "ham");
+ mir_snprintf(sql_counter, _countof(sql_counter), "UPDATE stats SET value=value+1 WHERE key='%s'", type == SPAM ? "spam_msgcount" : "ham_msgcount");
+ mir_snprintf(sql_select, _countof(sql_select), "SELECT 1 FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
+ mir_snprintf(sql_update, _countof(sql_update), "UPDATE %s SET num=num+1 WHERE token=?", type ? "spam" : "ham");
+ mir_snprintf(sql_insert, _countof(sql_insert), "INSERT INTO %s VALUES(?, 1)", type ? "spam" : "ham");
#ifdef _DEBUG
sqlite3_exec(bayesdbg, "BEGIN", NULL, NULL, NULL);
#endif
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp
index 1b7a45727f..24183ba492 100644
--- a/plugins/Spamotron/src/options.cpp
+++ b/plugins/Spamotron/src/options.cpp
@@ -115,10 +115,10 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
CheckDlgButton(optDlg, IDC_OPT_ADD_PERMANENTLY, _getOptB("AddPermanently", defaultAddPermanently) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(optDlg, IDC_OPT_LOG_ACTIONS, _getOptB("LogActions", defaultLogActions) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemText(optDlg, IDC_OPT_IN_MSG_APPROVE_WORDLIST, _getOptS(buf, SIZEOF(buf), "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist));
+ SetDlgItemText(optDlg, IDC_OPT_IN_MSG_APPROVE_WORDLIST, _getOptS(buf, _countof(buf), "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist));
SetDlgItemText(optDlg, IDC_OPT_MAX_MSG_CONTACT, _itot((unsigned int)_getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay), buf, 10));
SetDlgItemText(optDlg, IDC_OPT_MAX_SAME_MSG, _itot((unsigned int)_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay), buf, 10));
- SetDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, _getOptS(buf, SIZEOF(buf), "DontReplyMsgWordlist", defaultDontReplyMsgWordlist));
+ SetDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, _getOptS(buf, _countof(buf), "DontReplyMsgWordlist", defaultDontReplyMsgWordlist));
///Individual protocols list
ListView_SetExtendedListViewStyle(hProtocolsList, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
@@ -199,8 +199,8 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
_saveDlgItemInt(optDlg, IDC_OPT_MAX_SAME_MSG, "MaxSameMsgCountPerDay");
numProtocols = ListView_GetItemCount(hProtocolsList);
for (i = 0; i < numProtocols; i++) {
- ListView_GetItemText(hProtocolsList, i, 0, buf, SIZEOF(buf));
- //wcstombs(protoName, buf, SIZEOF(buf));
+ ListView_GetItemText(hProtocolsList, i, 0, buf, _countof(buf));
+ //wcstombs(protoName, buf, _countof(buf));
memset(protoOption, 0, sizeof(protoOption));
mir_strcat(protoOption, "proto_");
mir_strcat(protoOption, mir_u2a(buf));
@@ -520,7 +520,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
if (!dbuf)
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
- mir_snprintf(cbuf, SIZEOF(cbuf), "%0.04f", get_msg_score(dbuf));
+ mir_snprintf(cbuf, _countof(cbuf), "%0.04f", get_msg_score(dbuf));
SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, _T(""));
MessageBoxA(NULL, cbuf, Translate("Message score"), MB_OK);
free(dbuf);
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 89f62764ce..4101d8db4c 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -402,7 +402,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
case SPAMOTRON_MODE_MATH:
a = (rand() % 10) + 1;
b = (rand() % 10) + 1;
- mir_sntprintf(mexpr, SIZEOF(mexpr), _T("%d + %d"), a, b);
+ mir_sntprintf(mexpr, _countof(mexpr), _T("%d + %d"), a, b);
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallengeMath", defaultAuthChallengeMath);
else
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index 9e54383800..74e3f96bd5 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -370,7 +370,7 @@ TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num)
re = pcre16_compile(regex, 0, &error, &erroroffs, NULL);
if (re == NULL)
return FALSE; // [TODO] and log some error
- _getOptS(response, SIZEOF(response), "Response", defaultResponse);
+ _getOptS(response, _countof(response), "Response", defaultResponse);
ttmp = _tcstok(response, _T("\r\n"));
for (i = 0; ttmp != NULL; i ++) {
@@ -428,7 +428,7 @@ int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage)
{
char *tmp, *tmporig;
TCHAR msg[MAX_BUFFER_LENGTH];
- mir_sntprintf(msg, SIZEOF(msg), message, CONTACT_NAME(hContact));
+ mir_sntprintf(msg, _countof(msg), message, CONTACT_NAME(hContact));
if (_getOptB("LogActions", defaultLogActions)) {
tmp = mir_u2a(msg);
@@ -468,9 +468,9 @@ int LogToSystemHistory(char *message, char *origmessage)
dbei.szModule = PLUGIN_NAME;
dbei.pBlob = (PBYTE)msg;
if (origmessage)
- dbei.cbBlob = (1 + mir_snprintf(msg, SIZEOF(msg), "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
+ dbei.cbBlob = (1 + mir_snprintf(msg, _countof(msg), "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
else
- dbei.cbBlob = (1 + mir_snprintf(msg, SIZEOF(msg), "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
+ dbei.cbBlob = (1 + mir_snprintf(msg, _countof(msg), "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
db_event_add(NULL, &dbei);
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp
index 72fc6548c0..61aa390af8 100644
--- a/plugins/SpellChecker/src/ardialog.cpp
+++ b/plugins/SpellChecker/src/ardialog.cpp
@@ -97,7 +97,7 @@ static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
case EM_PASTESPECIAL:
case WM_PASTE:
TCHAR text[256];
- GetWindowText(hwnd, text, SIZEOF(text));
+ GetWindowText(hwnd, text, _countof(text));
scoped_free<TCHAR> dest = data->dict->autoReplace->filterText(text);
SetWindowText(hwnd, dest);
@@ -217,14 +217,14 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
TCHAR find[256];
if (data->findReadOnly)
- mir_tstrncpy(find, data->find.c_str(), SIZEOF(find));
+ mir_tstrncpy(find, data->find.c_str(), _countof(find));
else {
- GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
+ GetDlgItemText(hwndDlg, IDC_OLD, find, _countof(find));
lstrtrim(find);
}
TCHAR replace[256];
- GetDlgItemText(hwndDlg, IDC_NEW, replace, SIZEOF(replace));
+ GetDlgItemText(hwndDlg, IDC_NEW, replace, _countof(replace));
lstrtrim(replace);
if (!data->findReadOnly && find[0] == 0)
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp
index c22a1fe5aa..283a1ea6db 100644
--- a/plugins/SpellChecker/src/autoreplace.cpp
+++ b/plugins/SpellChecker/src/autoreplace.cpp
@@ -33,7 +33,7 @@ AutoReplacement::AutoReplacement(const TCHAR *replace, BOOL useVariables)
AutoReplaceMap::AutoReplaceMap(TCHAR *aFilename, Dictionary *dict)
{
this->dict = dict;
- mir_tstrncpy(filename, aFilename, SIZEOF(filename));
+ mir_tstrncpy(filename, aFilename, _countof(filename));
loadAutoReplaceMap();
}
@@ -47,7 +47,7 @@ void AutoReplaceMap::loadAutoReplaceMap()
char c;
int pos = 0;
while ((c = fgetc(file)) != EOF) {
- if (c == '\n' || c == '\r' || pos >= SIZEOF(tmp) - 1) {
+ if (c == '\n' || c == '\r' || pos >= _countof(tmp) - 1) {
if (pos > 0) {
tmp[pos] = '\0';
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 18689e9756..9a7ae1775c 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -365,7 +365,7 @@ protected:
void loadCustomDict()
{
TCHAR filename[1024];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("rb"));
if (file != NULL) {
@@ -373,7 +373,7 @@ protected:
char c;
int pos = 0;
while ((c = fgetc(file)) != EOF) {
- if (c == '\n' || c == '\r' || pos >= SIZEOF(tmp) - 1) {
+ if (c == '\n' || c == '\r' || pos >= _countof(tmp) - 1) {
if (pos > 0) {
tmp[pos] = '\0';
hunspell->add(tmp);
@@ -395,12 +395,12 @@ protected:
CreateDirectoryTreeT(userPath);
TCHAR filename[1024];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("ab"));
if (file != NULL) {
char tmp[1024];
- toHunspell(tmp, word, SIZEOF(tmp));
+ toHunspell(tmp, word, _countof(tmp));
fprintf(file, "%s\n", tmp);
fclose(file);
}
@@ -412,7 +412,7 @@ protected:
return;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
hunspell->add(hunspell_word);
}
@@ -443,13 +443,13 @@ protected:
public:
HunspellDictionary(TCHAR *aLanguage, TCHAR *aFileWithoutExtension, TCHAR *anUserPath, TCHAR *aSource)
{
- mir_tstrncpy(language, aLanguage, SIZEOF(language));
- mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension));
- mir_tstrncpy(userPath, anUserPath, SIZEOF(userPath));
+ mir_tstrncpy(language, aLanguage, _countof(language));
+ mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, _countof(fileWithoutExtension));
+ mir_tstrncpy(userPath, anUserPath, _countof(userPath));
if (aSource == NULL)
source[0] = _T('\0');
else
- mir_tstrncpy(source, aSource, SIZEOF(source));
+ mir_tstrncpy(source, aSource, _countof(source));
loaded = LANGUAGE_NOT_LOADED;
localized_name[0] = _T('\0');
@@ -523,8 +523,8 @@ public:
char aff[1024];
- mir_snprintf(dic, SIZEOF(dic), "%S.dic", fileWithoutExtension);
- mir_snprintf(aff, SIZEOF(aff), "%S.aff", fileWithoutExtension);
+ mir_snprintf(dic, _countof(dic), "%S.dic", fileWithoutExtension);
+ mir_snprintf(aff, _countof(aff), "%S.aff", fileWithoutExtension);
hunspell = new Hunspell(aff, dic);
@@ -542,7 +542,7 @@ public:
}
else {
- for (int i = 0; i < SIZEOF(codepages); i++) {
+ for (int i = 0; i < _countof(codepages); i++) {
if (_strcmpi(codepages[i].name, dic_enc) == 0) {
if (IsValidCodePage(codepages[i].codepage))
codePage = codepages[i].codepage;
@@ -581,7 +581,7 @@ public:
// TODO Check if it was generated by auto-replacement
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
return hunspell->spell(hunspell_word);
}
@@ -596,7 +596,7 @@ public:
return ret;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words = NULL;
ret.count = hunspell->suggest(&words, hunspell_word);
@@ -625,7 +625,7 @@ public:
return ret;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words;
int count = hunspell->suggest_auto(&words, hunspell_word);
@@ -654,7 +654,7 @@ public:
return NULL;
char hunspell_word[1024];
- toHunspell(hunspell_word, word, SIZEOF(hunspell_word));
+ toHunspell(hunspell_word, word, _countof(hunspell_word));
char ** words;
int count = hunspell->suggest_auto(&words, hunspell_word);
@@ -733,37 +733,37 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString)
TCHAR ini[32];
TCHAR end[32];
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, SIZEOF(ini));
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, SIZEOF(end));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, _countof(ini));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end));
TCHAR name[64];
- mir_sntprintf(name, SIZEOF(name), _T("%s_%s"), ini, end);
+ mir_sntprintf(name, _countof(name), _T("%s_%s"), ini, end);
for (int i = 0; i < tmp_dicts->getCount(); i++) {
Dictionary *dict = (*tmp_dicts)[i];
if (mir_tstrcmpi(dict->language, name) == 0) {
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, SIZEOF(dict->english_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGLANGUAGE, dict->english_name, _countof(dict->english_name));
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLANGUAGE, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0)
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLOCALIZEDLANGUAGENAME, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SLOCALIZEDLANGUAGENAME, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0)
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SNATIVEDISPLAYNAME, dict->localized_name, SIZEOF(dict->localized_name));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SNATIVEDISPLAYNAME, dict->localized_name, _countof(dict->localized_name));
if (dict->localized_name[0] == 0 && dict->english_name[0] != 0) {
TCHAR country[1024];
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGCOUNTRY, country, SIZEOF(country));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGCOUNTRY, country, _countof(country));
TCHAR name[1024];
if (country[0] != 0)
- mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), dict->english_name, country);
+ mir_sntprintf(name, _countof(name), _T("%s (%s)"), dict->english_name, country);
else
- mir_tstrncpy(name, dict->english_name, SIZEOF(name));
+ mir_tstrncpy(name, dict->english_name, _countof(name));
- mir_tstrncpy(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, TranslateTS(name), _countof(dict->localized_name));
}
if (dict->localized_name[0] != 0) {
- mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
+ mir_sntprintf(dict->full_name, _countof(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
}
break;
}
@@ -787,24 +787,24 @@ void GetDictsInfo(LIST<Dictionary> &dicts)
char lang[128];
WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL);
if (!db_get_ts(NULL, MODULE_NAME, lang, &dbv)) {
- mir_tstrncpy(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, dbv.ptszVal, _countof(dict->localized_name));
db_free(&dbv);
}
if (dict->localized_name[0] == _T('\0')) {
- for (size_t j = 0; j < SIZEOF(aditionalLanguages); j++) {
+ for (size_t j = 0; j < _countof(aditionalLanguages); j++) {
if (!mir_tstrcmp(aditionalLanguages[j].language, dict->language)) {
- mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), _countof(dict->localized_name));
break;
}
}
}
if (dict->localized_name[0] != _T('\0')) {
- mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
+ mir_sntprintf(dict->full_name, _countof(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
}
else {
- mir_tstrncpy(dict->full_name, dict->language, SIZEOF(dict->full_name));
+ mir_tstrncpy(dict->full_name, dict->language, _countof(dict->full_name));
}
}
}
@@ -815,7 +815,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
{
// Load the language files and create an array with then
TCHAR file[1024];
- mir_sntprintf(file, SIZEOF(file), _T("%s\\*.dic"), path);
+ mir_sntprintf(file, _countof(file), _T("%s\\*.dic"), path);
BOOL found = FALSE;
@@ -823,7 +823,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
HANDLE hFFD = FindFirstFile(file, &ffd);
if (hFFD != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(file, SIZEOF(file), _T("%s\\%s"), path, ffd.cFileName);
+ mir_sntprintf(file, _countof(file), _T("%s\\%s"), path, ffd.cFileName);
// Check .dic
DWORD attrib = GetFileAttributes(file);
@@ -871,14 +871,14 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
if (opts.use_other_apps_dicts) {
// Get other apps dicts
- for (int i = 0; i < SIZEOF(otherHunspellApps); i++) {
+ for (int i = 0; i < _countof(otherHunspellApps); i++) {
TCHAR key[1024];
- mir_sntprintf(key, SIZEOF(key), APPPATH, otherHunspellApps[i].key);
+ mir_sntprintf(key, _countof(key), APPPATH, otherHunspellApps[i].key);
HKEY hKey = 0;
LONG lResult = 0;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_QUERY_VALUE, &hKey)) {
- DWORD size = SIZEOF(key);
+ DWORD size = _countof(key);
lResult = RegQueryValueEx(hKey, _T("Path"), NULL, NULL, (LPBYTE)key, &size);
RegCloseKey(hKey);
}
@@ -892,7 +892,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
lResult = ERROR_NO_MORE_ITEMS;
for (DWORD local = 0; local < numValues; local++) {
- DWORD cchValue = SIZEOF(key);
+ DWORD cchValue = _countof(key);
if (ERROR_SUCCESS != RegEnumValue(hKey, local, key, &cchValue, NULL, NULL, NULL, NULL))
break;
key[cchValue] = 0;
@@ -911,7 +911,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
if (ERROR_SUCCESS == lResult) {
TCHAR folder[1024];
- mir_sntprintf(folder, SIZEOF(folder), _T("%s\\Dictionaries"), key);
+ mir_sntprintf(folder, _countof(folder), _T("%s\\Dictionaries"), key);
GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name);
}
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp
index e36ac30ce2..bd8a929a04 100644
--- a/plugins/SpellChecker/src/options.cpp
+++ b/plugins/SpellChecker/src/options.cpp
@@ -84,8 +84,8 @@ void InitOptions()
void LoadOptions()
{
- LoadOpts(optionsControls, SIZEOF(optionsControls), MODULE_NAME);
- LoadOpts(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME);
+ LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME);
+ LoadOpts(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME);
if (languages.getCount() <= 0) {
opts.default_language[0] = _T('\0');
@@ -94,7 +94,7 @@ void LoadOptions()
DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
- mir_tstrncpy(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
+ mir_tstrncpy(opts.default_language, dbv.ptszVal, _countof(opts.default_language));
db_free(&dbv);
}
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return TRUE;
}
- return SaveOptsDlgProc(optionsControls, SIZEOF(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
struct AutoreplaceData
@@ -349,7 +349,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1)
if (item < 0)
find[0] = 0;
else
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, SIZEOF(find));
+ ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, _countof(find));
if (mir_tstrlen(find) > 0) {
AutoReplacement &ar = data->autoReplaceMap[find];
@@ -370,7 +370,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
switch (msg) {
case WM_INITDIALOG:
{
- BOOL ret = SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ BOOL ret = SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
int sel = -1;
for (int i = 0; i < languages.getCount(); i++) {
@@ -431,7 +431,7 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
sel = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
while (sel >= 0) {
TCHAR tmp[256];
- ListView_GetItemText(hList, sel, 0, tmp, SIZEOF(tmp));
+ ListView_GetItemText(hList, sel, 0, tmp, _countof(tmp));
data->RemoveWord(tmp);
changed = TRUE;
@@ -499,5 +499,5 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
return TRUE;
}
- return SaveOptsDlgProc(autoReplaceControls, SIZEOF(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+ return SaveOptsDlgProc(autoReplaceControls, _countof(autoReplaceControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp
index 6f02a86c14..80d2a599ad 100644
--- a/plugins/SpellChecker/src/spellchecker.cpp
+++ b/plugins/SpellChecker/src/spellchecker.cpp
@@ -80,7 +80,7 @@ static int IconsChanged(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %s"),
+ mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
@@ -135,7 +135,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
if (opts.use_flags) {
// Load flags dll
TCHAR flag_file[MAX_PATH];
- mir_sntprintf(flag_file, SIZEOF(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder);
+ mir_sntprintf(flag_file, _countof(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder);
HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE);
TCHAR path[MAX_PATH];
@@ -151,7 +151,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.description.t = p->full_name;
char lang[32];
- mir_snprintf(lang, SIZEOF(lang), "spell_lang_%d", i);
+ mir_snprintf(lang, _countof(lang), "spell_lang_%d", i);
sid.pszName = lang;
HICON hFlag = NULL, hFlagIcoLib = NULL;
@@ -185,7 +185,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
Dictionary *dict = languages[j];
TCHAR filename[MAX_PATH];
- mir_sntprintf(filename, SIZEOF(filename), _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
+ mir_sntprintf(filename, _countof(filename), _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
dict->autoReplace = new AutoReplaceMap(filename, dict);
if (mir_tstrcmp(dict->language, opts.default_language) == 0)
@@ -206,7 +206,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %s"),
+ mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
sid.hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled");
@@ -240,7 +240,7 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
// icons
- Icon_Register(hInst, LPGEN("Spell Checker"), iconList, SIZEOF(iconList));
+ Icon_Register(hInst, LPGEN("Spell Checker"), iconList, _countof(iconList));
// hooks
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index ab777aa39c..f712daa96d 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -292,7 +292,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser,
{
int errors = 0;
TCHAR text[1024];
- dlg->re->GetLine(line, text, SIZEOF(text));
+ dlg->re->GetLine(line, text, _countof(text));
int len = mir_tstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
@@ -381,7 +381,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser,
int dif = dlg->re->Replace(sel.cpMin, sel.cpMax, replacement);
if (dif != 0) {
// Read line again
- dlg->re->GetLine(line, text, SIZEOF(text));
+ dlg->re->GetLine(line, text, _countof(text));
len = mir_tstrlen(text);
int old_first_char = first_char;
@@ -454,8 +454,8 @@ void ToLocaleID(TCHAR *szKLName, size_t size)
USHORT langID = (USHORT)_tcstol(szKLName, &stopped, 16);
TCHAR ini[32], end[32];
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, SIZEOF(ini));
- GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, SIZEOF(end));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO639LANGNAME, ini, _countof(ini));
+ GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end));
mir_sntprintf(szKLName, size, _T("%s_%s"), ini, end);
}
@@ -466,8 +466,8 @@ void LoadDictFromKbdl(Dialog *dlg)
// Use default input language
HKL hkl = GetKeyboardLayout(0);
- mir_sntprintf(szKLName, SIZEOF(szKLName), _T("%x"), (int)LOWORD(hkl));
- ToLocaleID(szKLName, SIZEOF(szKLName));
+ mir_sntprintf(szKLName, _countof(szKLName), _T("%x"), (int)LOWORD(hkl));
+ ToLocaleID(szKLName, _countof(szKLName));
int d = GetClosestLanguage(szKLName);
if (d >= 0) {
@@ -635,7 +635,7 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
TCHAR text[1024];
int first_char;
- GetWordCharRange(dlg, sel, text, SIZEOF(text), first_char);
+ GetWordCharRange(dlg, sel, text, _countof(text), first_char);
SetNoUnderline(dlg->re, sel.cpMin, sel.cpMax);
@@ -702,7 +702,7 @@ int GetClosestLanguage(TCHAR *lang_name)
// Try searching by the prefix only
TCHAR lang[128];
- mir_tstrncpy(lang, lang_name, SIZEOF(lang));
+ mir_tstrncpy(lang, lang_name, _countof(lang));
TCHAR *p = _tcschr(lang, _T('_'));
if (p != NULL)
@@ -760,7 +760,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch
if (mir_tstrcmpi(dict->localized_name, lang) == 0
|| mir_tstrcmpi(dict->english_name, lang) == 0
|| mir_tstrcmpi(dict->language, lang) == 0) {
- mir_tstrncpy(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name));
break;
}
}
@@ -803,18 +803,18 @@ void GetContactLanguage(Dialog *dlg)
if (dlg->hContact == NULL) {
if (!db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
else {
if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
@@ -823,12 +823,12 @@ void GetContactLanguage(Dialog *dlg)
MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact);
if (hMetaContact != NULL) {
if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) {
- mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
}
@@ -846,13 +846,13 @@ void GetContactLanguage(Dialog *dlg)
// Use default lang
if (dlg->lang_name[0] == _T('\0'))
- mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
}
int i = GetClosestLanguage(dlg->lang_name);
if (i < 0) {
// Lost a dict?
- mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, _countof(dlg->lang_name));
i = GetClosestLanguage(dlg->lang_name);
}
@@ -1036,7 +1036,7 @@ TCHAR *GetWordUnderPoint(Dialog *dlg, POINT pt, CHARRANGE &sel)
TCHAR text[1024];
int first_char;
- if (!GetWordCharRange(dlg, sel, text, SIZEOF(text), first_char))
+ if (!GetWordCharRange(dlg, sel, text, _countof(text), first_char))
return NULL;
// copy the word
diff --git a/plugins/SplashScreen/src/debug.h b/plugins/SplashScreen/src/debug.h
index f96d0ff728..c60109a533 100644
--- a/plugins/SplashScreen/src/debug.h
+++ b/plugins/SplashScreen/src/debug.h
@@ -17,7 +17,7 @@ int inline _DebugPopup(MCONTACT hContact, TCHAR *fmt, ...)
TCHAR debug[1024];
va_start(va, fmt);
- mir_sntprintf(debug, SIZEOF(debug), fmt, va);
+ mir_sntprintf(debug, _countof(debug), fmt, va);
if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
POPUPDATAT ppd = { 0 };
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index e08d070729..1633baeccc 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -66,11 +66,11 @@ void SplashMain()
{
// Retrive path to exe of current running Miranda is located
szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
- mir_sntprintf(szhAdvaimgPath, SIZEOF(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
+ mir_sntprintf(szhAdvaimgPath, _countof(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
#ifdef _DEBUG
- mir_sntprintf(szLogFile, SIZEOF(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
+ mir_sntprintf(szLogFile, _countof(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
initLog();
TCHAR *mirandaVerString = mir_a2t(szVersion);
logMessage(_T("Miranda version"), mirandaVerString);
@@ -102,13 +102,13 @@ void SplashMain()
mir_tstrcpy(inBuf, _T("splash\\splash.png"));
TCHAR szExpandedSplashFile[MAX_PATH];
- ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, SIZEOF(szExpandedSplashFile));
+ ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, _countof(szExpandedSplashFile));
mir_tstrcpy(inBuf, szExpandedSplashFile);
TCHAR *pos3 = 0;
pos3 = _tcsrchr(inBuf, _T(':'));
if (pos3 == NULL)
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szMirDir, inBuf);
else
mir_tstrcpy(szSplashFile, inBuf);
@@ -121,13 +121,13 @@ void SplashMain()
mir_tstrcpy(inBuf, _T("sounds\\startup.wav"));
TCHAR szExpandedSoundFile[MAX_PATH];
- ExpandEnvironmentStrings(inBuf, szExpandedSoundFile, SIZEOF(szExpandedSoundFile));
+ ExpandEnvironmentStrings(inBuf, szExpandedSoundFile, _countof(szExpandedSoundFile));
mir_tstrcpy(inBuf, szExpandedSoundFile);
TCHAR *pos2;
pos2 = _tcschr(inBuf, _T(':'));
if (pos2 == NULL)
- mir_sntprintf(szSoundFile, SIZEOF(szSoundFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSoundFile, _countof(szSoundFile), _T("%s\\%s"), szMirDir, inBuf);
else
mir_tstrcpy(szSoundFile, inBuf);
@@ -150,7 +150,7 @@ void SplashMain()
p = _tcsrchr(szSplashDir, _T('\\'));
if (p) *p = 0;
// create the search filter
- mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\*.*"), szSplashDir);
+ mir_sntprintf(szSearch, _countof(szSearch), _T("%s\\*.*"), szSplashDir);
// FFFN will return filenames
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
@@ -187,7 +187,7 @@ void SplashMain()
int r = 0;
if (filescount) r = (rand() % filescount) + 1;
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szSplashDir, files[r - 1]);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szSplashDir, files[r - 1]);
#ifdef _DEBUG
logMessage(_T("final file"), szSplashFile);
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp
index 84dd4618e9..5771ec58de 100644
--- a/plugins/SplashScreen/src/options.cpp
+++ b/plugins/SplashScreen/src/options.cpp
@@ -194,7 +194,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = szTempPath;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = szTempPath;
@@ -308,25 +308,25 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
TCHAR tmp[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "Path", tmp);
- GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "Sound", tmp);
- GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
mir_tstrcpy(szPrefix, tmp);
- GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
options.showtime = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
options.fisteps = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
options.fosteps = _ttoi(tmp);
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp
index ee80c9639f..beecc04357 100644
--- a/plugins/SplashScreen/src/services.cpp
+++ b/plugins/SplashScreen/src/services.cpp
@@ -31,7 +31,7 @@ INT_PTR ShowSplashService(WPARAM wparam, LPARAM lparam)
TCHAR *pos = _tcsrchr(filename, _T(':'));
if (pos == NULL)
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, filename);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szMirDir, filename);
else
mir_tstrcpy(szSplashFile, filename);
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp
index 8f885a74e9..cfbb7b88b4 100644
--- a/plugins/SplashScreen/src/splash.cpp
+++ b/plugins/SplashScreen/src/splash.cpp
@@ -42,9 +42,9 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
#ifdef _DEBUG
TCHAR b[40];
- mir_sntprintf(b, SIZEOF(b), _T("%d"), wParam);
+ mir_sntprintf(b, _countof(b), _T("%d"), wParam);
logMessage(_T("Timer ID"), b);
- mir_sntprintf(b, SIZEOF(b), _T("%d"), options.showtime);
+ mir_sntprintf(b, _countof(b), _T("%d"), options.showtime);
logMessage(_T("ShowTime value"), b);
#endif
@@ -229,7 +229,7 @@ void __cdecl SplashThread(void *arg)
TCHAR verString[256] = { 0 };
TCHAR *mirandaVerString = mir_a2t(szVersion);
- mir_sntprintf(verString, SIZEOF(verString), _T("%s%s"), szPrefix, mirandaVerString);
+ mir_sntprintf(verString, _countof(verString), _T("%s%s"), szPrefix, mirandaVerString);
mir_free(mirandaVerString);
LOGFONT lf = { 0 };
lf.lfHeight = 14;
@@ -327,7 +327,7 @@ BOOL ShowSplash(BOOL bpreview)
timeout = options.showtime;
#ifdef _DEBUG
TCHAR b[40];
- mir_sntprintf(b, SIZEOF(b), _T("%d"), options.showtime);
+ mir_sntprintf(b, _countof(b), _T("%d"), options.showtime);
logMessage(_T("Timeout"), b);
#endif
}
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp
index dbf89fe3ba..8547c18c1c 100644
--- a/plugins/StartupSilence/src/main.cpp
+++ b/plugins/StartupSilence/src/main.cpp
@@ -120,7 +120,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
HookEvent(ME_POPUP_FILTER, DisablePopup);
hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
if (TTBButtons == 1 && hTTBarloaded != NULL) {
- Icon_Register(hInst, "Toolbar/"MENU_NAME, iconttbList, SIZEOF(iconttbList), MENU_NAME);
+ Icon_Register(hInst, "Toolbar/"MENU_NAME, iconttbList, _countof(iconttbList), MENU_NAME);
RemoveTTButtons();
CreateTTButtons(0,0);
}
@@ -160,17 +160,17 @@ void EnablePopupModule()
void InitSettings()
{
- if(gethostname(hostname, SIZEOF(hostname)) == 0){
- mir_snprintf(EnabledComp, SIZEOF(EnabledComp), "%s_Enabled", hostname);
- mir_snprintf(DelayComp, SIZEOF(DelayComp), "%s_Delay", hostname);
- mir_snprintf(PopUpComp, SIZEOF(PopUpComp), "%s_PopUp", hostname);
- mir_snprintf(PopUpTimeComp, SIZEOF(PopUpTimeComp), "%s_PopUpTime", hostname);
- mir_snprintf(MenuitemComp, SIZEOF(MenuitemComp), "%s_MenuItem", hostname);
- mir_snprintf(TTBButtonsComp, SIZEOF(TTBButtonsComp), "%s_TTBButtons", hostname);
- mir_snprintf(DefSoundComp, SIZEOF(DefSoundComp), "%s_DefSound", hostname);
- mir_snprintf(DefPopupComp, SIZEOF(DefPopupComp), "%s_DefPopup", hostname);
- mir_snprintf(DefEnabledComp, SIZEOF(DefEnabledComp), "%s_DefEnabled", hostname);
- mir_snprintf(NonStatusAllowComp, SIZEOF(NonStatusAllowComp), "%s_NonStatusAllow", hostname);
+ if(gethostname(hostname, _countof(hostname)) == 0){
+ mir_snprintf(EnabledComp, _countof(EnabledComp), "%s_Enabled", hostname);
+ mir_snprintf(DelayComp, _countof(DelayComp), "%s_Delay", hostname);
+ mir_snprintf(PopUpComp, _countof(PopUpComp), "%s_PopUp", hostname);
+ mir_snprintf(PopUpTimeComp, _countof(PopUpTimeComp), "%s_PopUpTime", hostname);
+ mir_snprintf(MenuitemComp, _countof(MenuitemComp), "%s_MenuItem", hostname);
+ mir_snprintf(TTBButtonsComp, _countof(TTBButtonsComp), "%s_TTBButtons", hostname);
+ mir_snprintf(DefSoundComp, _countof(DefSoundComp), "%s_DefSound", hostname);
+ mir_snprintf(DefPopupComp, _countof(DefPopupComp), "%s_DefPopup", hostname);
+ mir_snprintf(DefEnabledComp, _countof(DefEnabledComp), "%s_DefEnabled", hostname);
+ mir_snprintf(NonStatusAllowComp, _countof(NonStatusAllowComp), "%s_NonStatusAllow", hostname);
}
//first run on the host, initial setting
if (!(delay = db_get_dw(NULL, MODULE_NAME, DelayComp, 0)))
@@ -219,7 +219,7 @@ void LoadSettings()
void IsMenu()
{
if (MenuItem == 1) {
- Icon_Register(hInst, MENU_NAME, iconList, SIZEOF(iconList), MENU_NAME);
+ Icon_Register(hInst, MENU_NAME, iconList, _countof(iconList), MENU_NAME);
InitMenu();
}
}
@@ -345,7 +345,7 @@ void RemoveTTButtons()
HANDLE GetIconHandle(char *szIcon)
{
char szSettingName[64];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MENU_NAME, szIcon);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MENU_NAME, szIcon);
return IcoLib_GetIconHandle(szSettingName);
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp
index 370819a3f7..5c896b8c11 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp
@@ -66,7 +66,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
settings = ( AAMSGSETTING** )malloc(sizeof(AAMSGSETTING*));
count = 0;
- for (int i=0; i < SIZEOF(statusModeList); i++ ) {
+ for (int i=0; i < _countof(statusModeList); i++ ) {
if ( !( protoModeMsgFlags & Proto_Status2Flag( statusModeList[i] )))
continue;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
index 04be013089..fddb288e73 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp
@@ -183,7 +183,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
- for (int i = 0; i < SIZEOF(statusModeList); i++) {
+ for (int i = 0; i < _countof(statusModeList); i++) {
if ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
lvItem.pszText = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
lvItem.lParam = (LPARAM)statusModePf2List[i];
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
// clear box and add new status, loop status and check if compatible with proto
SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0);
- for (int i=0; i < SIZEOF(statusModeList); i++) {
+ for (int i=0; i < _countof(statusModeList); i++) {
if ((flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame) {
TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
int item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
index 2e1af36c2a..2be09d66f3 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
@@ -212,7 +212,7 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCH
mir_cslock lck(GenStatusCS);
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", cs->szName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", cs->szName);
cs->lastStatus = lastStatus == 0 ? cs->status : lastStatus;
if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
cs->status = ID_STATUS_DISABLED;
@@ -520,7 +520,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
return 0;
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", ack->szModule);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", ack->szModule);
if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
return 0;
@@ -933,8 +933,8 @@ static int ProcessPopup(int reason, LPARAM lParam)
for (int i = 0; i < connectionSettings.getCount(); i++) {
if (mir_tstrlen(ps[i]->tszAccName) > 0 && mir_strlen(ps[i]->szName) > 0) {
if (db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
- mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR));
- mir_tstrncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - mir_tstrlen(protoInfo) - 1);
+ mir_sntprintf(protoInfoLine, _countof(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR));
+ mir_tstrncat(protoInfo, protoInfoLine, _countof(protoInfo) - mir_tstrlen(protoInfo) - 1);
}
}
}
@@ -1051,7 +1051,7 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam)
return -1;
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", szProto);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", szProto);
if (!db_get_b(NULL, MODULENAME, dbSetting, 1)) // 'hard' disabled
return -1;
@@ -1077,7 +1077,7 @@ INT_PTR IsProtocolEnabledService(WPARAM, LPARAM lParam)
char *szProto = (char *)lParam;
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", szProto);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", szProto);
if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
return FALSE;
diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp
index 452ac6e691..5bfc7267cd 100644
--- a/plugins/StatusPlugins/KeepStatus/options.cpp
+++ b/plugins/StatusPlugins/KeepStatus/options.cpp
@@ -71,7 +71,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam
ListView_InsertItem(hList, &lvItem);
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", protos[i]->szModuleName);
ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, TRUE));
lvItem.iItem++;
}
@@ -152,7 +152,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam
ListView_GetItem(hList, &lvItem);
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", (char *)lvItem.lParam);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s_enabled", (char *)lvItem.lParam);
db_set_b(NULL, MODULENAME, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
}
}
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp
index ca7d35b838..21ca2d2385 100644
--- a/plugins/StatusPlugins/StartupStatus/options.cpp
+++ b/plugins/StatusPlugins/StartupStatus/options.cpp
@@ -161,9 +161,9 @@ HRESULT CreateLink(TSettingsList& protoSettings)
{
TCHAR savePath[MAX_PATH];
if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
- _tcsncat_s(savePath, SHORTCUT_FILENAME, SIZEOF(savePath) - mir_tstrlen(savePath));
+ _tcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_tstrlen(savePath));
else
- mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), SHORTCUT_FILENAME);
+ mir_sntprintf(savePath, _countof(savePath), _T(".\\%s"), SHORTCUT_FILENAME);
// Get a pointer to the IShellLink interface.
IShellLink *psl;
@@ -175,7 +175,7 @@ HRESULT CreateLink(TSettingsList& protoSettings)
// Set the path to the shortcut target, and add the
// description.
TCHAR path[MAX_PATH];
- GetModuleFileName(NULL, path, SIZEOF(path));
+ GetModuleFileName(NULL, path, _countof(path));
psl->SetPath(path);
psl->SetDescription(desc);
psl->SetArguments( _A2T(args));
@@ -220,7 +220,7 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
EmptyClipboard();
char cmdl[2048];
- GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, SIZEOF(cmdl));
+ GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, _countof(cmdl));
HGLOBAL cmdlGlob = GlobalAlloc(GMEM_MOVEABLE, sizeof(cmdl));
if (cmdlGlob == NULL) {
CloseClipboard();
@@ -610,7 +610,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
int flags = (CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_2, 0))&~(CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_5, 0));
SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_RESETCONTENT, 0, 0);
- for ( int i=0; i < SIZEOF(statusModeList); i++ ) {
+ for ( int i=0; i < _countof(statusModeList); i++ ) {
if ( (flags&statusModePf2List[i]) || (statusModeList[i] == ID_STATUS_OFFLINE)) {
int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_ADDSTRING, 0, (LPARAM)pcli->pfnGetStatusModeDescription(statusModeList[i], 0));
SendDlgItemMessage(hwndDlg, IDC_STATUS, LB_SETITEMDATA, (WPARAM)item, (LPARAM)statusModeList[i]);
@@ -866,7 +866,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP
case WM_COMMAND:
if (LOWORD(wParam) == IDC_OK) {
TCHAR profileName[128];
- GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, SIZEOF(profileName));
+ GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, _countof(profileName));
SendMessage(hwndParent, UM_ADDPROFILE, 0, (LPARAM)profileName);
// done and exit
DestroyWindow(hwndDlg);
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index a3b6687216..d8a5b7df9a 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -107,7 +107,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
mi.ptszName = profilename;
mi.position = 2000100000 + mcount;
- mir_snprintf(servicename, SIZEOF(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
+ mir_snprintf(servicename, _countof(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
switch(mcount) {
case 0:
hProfileServices[mcount] = CreateServiceFunction(servicename, profileService0);
@@ -190,7 +190,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
for ( int i=0; i < pceCount; i++ ) {
if ( (pce[i].profile == profile) && (!mir_strcmp(pce[i].szProto, szProto))) {
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(mir_tstrlen(dbv.ptszVal)+1));
if (pce[i].msg != NULL) {
@@ -214,7 +214,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
pce[pceCount].profile = profile;
pce[pceCount].szProto = _strdup(szProto);
pce[pceCount].msg = NULL;
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
if (!db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
pce[pceCount].msg = _tcsdup(dbv.ptszVal);
db_free(&dbv);
@@ -339,7 +339,7 @@ static int RegisterHotKeys()
return -1;
char atomname[255];
- mir_snprintf(atomname, SIZEOF(atomname), "StatusProfile_%d", i);
+ mir_snprintf(atomname, _countof(atomname), "StatusProfile_%d", i);
hkInfo[hkiCount].id = GlobalAddAtomA(atomname);
if (hkInfo[hkiCount].id == 0)
continue;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 155cc1e17b..d1591e98c4 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -168,7 +168,7 @@ static void SetLastStatusMessages(TSettingsList &ps)
continue;
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
DBVARIANT dbv;
if (ps[i].szMsg == NULL && !db_get_ts(NULL, MODULENAME, dbSetting, &dbv)) {
@@ -301,9 +301,9 @@ static int OnOkToExit(WPARAM, LPARAM)
continue;
char lastName[128], lastMsg[128];
- mir_snprintf(lastName, SIZEOF(lastName), "%s%s", PREFIX_LAST, pa->szModuleName);
+ mir_snprintf(lastName, _countof(lastName), "%s%s", PREFIX_LAST, pa->szModuleName);
db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
- mir_snprintf(lastMsg, SIZEOF(lastMsg), "%s%s", PREFIX_LASTMSG, pa->szModuleName);
+ mir_snprintf(lastMsg, _countof(lastMsg), "%s%s", PREFIX_LASTMSG, pa->szModuleName);
db_unset(NULL, MODULENAME, lastMsg);
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index 6fc5b99823..e5029981d1 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -45,7 +45,7 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
{
if (iconList[0].hIcolib == NULL)
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index fa128665f6..cbf299a072 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -177,9 +177,9 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus)
TCHAR substituteStr[128];
if (!_tcsnicmp(tszMsg + j, _T("%time%"), 6))
- GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, 0, 0, substituteStr, SIZEOF(substituteStr));
+ GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, 0, 0, substituteStr, _countof(substituteStr));
else if (!_tcsnicmp(tszMsg + j, _T("%date%"), 6))
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, 0, 0, substituteStr, SIZEOF(substituteStr));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, 0, 0, substituteStr, _countof(substituteStr));
else
continue;
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp
index 03b9943ca2..5b5ecca46d 100644
--- a/plugins/StatusPlugins/confirmdialog.cpp
+++ b/plugins/StatusPlugins/confirmdialog.cpp
@@ -269,7 +269,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
// LAST STATUS
if (proto->status == ID_STATUS_LAST) {
TCHAR last[80];
- mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
+ mir_sntprintf(last, _countof(last), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, last);
actualStatus = proto->lastStatus;
}
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else if (proto->status == ID_STATUS_CURRENT) {
int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0);
TCHAR current[80];
- mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
+ mir_sntprintf(current, _countof(current), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, current);
actualStatus = currentStatus;
}
@@ -362,7 +362,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
actualStatus = currentStatus;
}
- for (int i = 0; i < SIZEOF(statusModeList); i++) {
+ for (int i = 0; i < _countof(statusModeList); i++) {
if (((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags)& Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index c4f350208d..5ec631990f 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -247,7 +247,7 @@ void LogSpamToFile(MCONTACT hContact, tstring message)
if (hStopSpamLogDirH)
FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T(""));
else
- mir_tstrncpy(pszName, VARST( _T("%miranda_logpath%")), SIZEOF(pszName));
+ mir_tstrncpy(pszName, VARST( _T("%miranda_logpath%")), _countof(pszName));
filename = pszName;
filename = filename + _T("\\stopspam_mod.log");
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index dc98af0044..9d319e8587 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -279,7 +279,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
CopyRect(&rcText, &rcClient);
TCHAR szText[MAX_PATH];
- GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ GetWindowText(ctl->hwnd, szText, _countof(szText));
SetBkMode(hdcMem, TRANSPARENT);
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
if (ctl->pContainer && CSkin::m_skinEnabled)
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index f351b48a82..aacbf87311 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -72,7 +72,7 @@ static void CB_GetButtonSettings(MCONTACT hContact, CustomButtonData *cbd)
//modulename_buttonID, position_inIM_inCHAT_isLSide_isRSide_CanBeHidden
- mir_snprintf(SettingName, SIZEOF(SettingName), "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID);
+ mir_snprintf(SettingName, _countof(SettingName), "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID);
if (!db_get_s(hContact, "TabSRMM_Toolbar", SettingName, &dbv)) {
token = strtok(dbv.pszVal, "_");
@@ -369,7 +369,7 @@ static int SaveTree(HWND hToolBarTree)
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
tvi.hItem = TreeView_GetRoot(hToolBarTree);
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
{
mir_cslock lck(csToolBar);
@@ -572,7 +572,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = strbuf;
- tvis.item.cchTextMax = SIZEOF(strbuf);
+ tvis.item.cchTextMax = _countof(strbuf);
tvis.item.hItem = (HTREEITEM)hDragItem;
TreeView_GetItem(hToolBarTree, &tvis.item);
TreeView_DeleteItem(hToolBarTree, hDragItem);
@@ -711,7 +711,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
TVITEM tvi;
tvi.hItem = hti;
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
TreeView_GetItem(hToolBarTree, &tvi);
@@ -738,7 +738,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
TVITEM tvi;
tvi.pszText = strbuf;
- tvi.cchTextMax = SIZEOF(strbuf);
+ tvi.cchTextMax = _countof(strbuf);
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hti;
TreeView_GetItem(hToolBarTree, &tvi);
@@ -830,8 +830,8 @@ void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd)
//modulename_buttonID, position_inIM_inCHAT_isLSide_isRSide_CanBeHidden
- mir_snprintf(SettingName, SIZEOF(SettingName), "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID);
- mir_snprintf(SettingParameter, SIZEOF(SettingParameter), "%d_%u_%u_%u_%u_%u", cbd->m_dwPosition, cbd->m_bIMButton, cbd->m_bChatButton, cbd->m_bLSided, cbd->m_bRSided, cbd->m_bCanBeHidden);
+ mir_snprintf(SettingName, _countof(SettingName), "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonOrigID);
+ mir_snprintf(SettingParameter, _countof(SettingParameter), "%d_%u_%u_%u_%u_%u", cbd->m_dwPosition, cbd->m_bIMButton, cbd->m_bChatButton, cbd->m_bLSided, cbd->m_bRSided, cbd->m_bCanBeHidden);
if (!(cbd->m_opFlags & BBSF_NTBDESTRUCT))
db_set_s(hContact, "TabSRMM_Toolbar", SettingName, SettingParameter);
else
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index 86cb4817cc..0b6fadcd20 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -537,7 +537,7 @@ static void AddEventToBuffer(CMStringA &str, LOGSTREAMDATA *streamData)
else _tcsncpy_s(szTemp, streamData->lin->ptszNick, _TRUNCATE);
if (g_Settings.bClickableNicks)
- mir_sntprintf(szTemp2, SIZEOF(szTemp2), _T("~~++#%s#++~~"), szTemp);
+ mir_sntprintf(szTemp2, _countof(szTemp2), _T("~~++#%s#++~~"), szTemp);
else
_tcsncpy_s(szTemp2, szTemp, _TRUNCATE);
@@ -723,7 +723,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (streamData->dat->dwFlags & MWF_DIVIDERWANTED || lin->dwFlags & MWF_DIVIDERWANTED) {
static char szStyle_div[128] = "\0";
if (szStyle_div[0] == 0)
- mir_snprintf(szStyle_div, SIZEOF(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", 17, 18, 0, 0, 5);
+ mir_snprintf(szStyle_div, _countof(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", 17, 18, 0, 0, 5);
lin->dwFlags |= MWF_DIVIDERWANTED;
if (lin->prev || !streamData->bRedraw)
@@ -750,13 +750,13 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
int iii;
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
+ mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
str.Append(szStyle);
}
else {
iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
+ mir_snprintf(szStyle, _countof(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
str.Append(szStyle);
}
@@ -982,7 +982,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedra
// this uses hidden marks in the rich text to find the events which should be deleted
if (si->bTrimmed) {
TCHAR szPattern[50];
- mir_sntprintf(szPattern, SIZEOF(szPattern), _T("~-+%d+-~"), si->pLogEnd);
+ mir_sntprintf(szPattern, _countof(szPattern), _T("~-+%d+-~"), si->pLogEnd);
FINDTEXTEX fi;
fi.lpstrText = szPattern;
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index e41c697c29..2831e517d7 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -184,7 +184,7 @@ static void OnLoadSettings()
for (int i = 0; i < 5; i++) {
char szBuf[40];
- mir_snprintf(szBuf, SIZEOF(szBuf), "NickColor%d", i);
+ mir_snprintf(szBuf, _countof(szBuf), "NickColor%d", i);
g_Settings.nickColors[i] = M.GetDword(CHAT_MODULE, szBuf, g_Settings.UserListColors[0]);
}
g_Settings.nickColors[5] = M.GetDword(CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
@@ -311,7 +311,7 @@ int Chat_Unload(void)
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
- for (int i = 0; i < SIZEOF(g_Settings.UserListFonts); i++)
+ for (int i = 0; i < _countof(g_Settings.UserListFonts); i++)
if (g_Settings.UserListFonts[i])
DeleteObject(g_Settings.UserListFonts[i]);
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index 094579efa5..791b695f5b 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -337,8 +337,8 @@ static IconItem _logicons[] =
// add icons to the skinning module
void Chat_AddIcons(void)
{
- Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat windows"), _icons, SIZEOF(_icons));
- Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat log"), _logicons, SIZEOF(_logicons));
+ Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat windows"), _icons, _countof(_icons));
+ Icon_Register(g_hIconDLL, LPGEN("Message Sessions")"/"LPGEN("Group chat log"), _logicons, _countof(_logicons));
pci->MM_IconsChanged();
}
@@ -406,8 +406,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance and functionality of chat room windows"), TRUE);
hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance of the message log"), TRUE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0x0000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0x0000);
+ FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0x0000);
TCHAR* pszGroup = NULL;
InitSetting(pszGroup, "AddToGroup", _T("Chat rooms"));
@@ -449,8 +449,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
mir_free(pszText);
b = M.GetByte(CHAT_MODULE, "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, _countof(branch1));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, _countof(branch2));
pci->ReloadSettings();
pci->MM_IconsChanged();
@@ -494,62 +494,62 @@ void RegisterFontServiceFonts()
fid.cbSize = sizeof(FontIDT);
cid.cbSize = sizeof(ColourIDT);
- strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
+ strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
- for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) {
+ for (int i = 0; i < _countof(IM_fontOptionsList); i++) {
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, "Font%d", i);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
+ strncpy(fid.prefix, szTemp, _countof(fid.prefix));
fid.order = i;
- _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
+ _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
fid.deffontsettings.size = (char)lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.deffontsettings.charset = lf.lfCharSet;
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.group));
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), _countof(fid.backgroundGroup));
+ _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), _countof(fid.group));
switch (i) {
case MSGFONTID_MYMSG:
case 1:
case MSGFONTID_MYNAME:
case MSGFONTID_MYTIME:
case 21:
- _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), _countof(fid.backgroundName));
break;
case 8:
case 9:
case 12:
case 13:
- _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), _countof(fid.backgroundName));
break;
case 10:
case 11:
case 14:
case 15:
- _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), _countof(fid.backgroundName));
break;
case MSGFONTID_MESSAGEAREA:
- _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.group, LPGENT("Message Sessions"), _countof(fid.group));
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), _countof(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, LPGENT("Input area background"), _countof(fid.backgroundName));
fid.flags |= FIDF_DISABLESTYLES;
fid.flags &= ~FIDF_ALLOWEFFECTS;
break;
case 17:
- _tcsncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, LPGENT("Status background"), _countof(fid.backgroundName));
break;
case 18:
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), _countof(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, LPGENT("Log background"), _countof(fid.backgroundName));
break;
case 19:
- _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, _T(""), _countof(fid.backgroundName));
break;
default:
- _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), _countof(fid.backgroundName));
break;
}
FontRegisterT(&fid);
@@ -557,15 +557,15 @@ void RegisterFontServiceFonts()
fontOptionsList = IP_fontOptionsList;
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
- _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group));
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName));
+ _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), _countof(fid.group));
+ _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), _countof(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, LPGENT("Fields background"), _countof(fid.backgroundName));
for (int i = 0; i < IPFONTCOUNT; i++) {
LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, "Font%d", i + 100);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
+ strncpy(fid.prefix, szTemp, _countof(fid.prefix));
fid.order = i + 100;
- _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
+ _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
fid.deffontsettings.size = (char)lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
@@ -574,20 +574,20 @@ void RegisterFontServiceFonts()
fid.deffontsettings.charset = lf.lfCharSet;
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
if (i == IPFONTCOUNT - 1) {
- _tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
- _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
+ _tcsncpy(fid.backgroundGroup, _T(""), _countof(fid.backgroundGroup));
+ _tcsncpy(fid.backgroundName, _T(""), _countof(fid.backgroundName));
+ _tcsncpy(fid.group, LPGENT("Message Sessions"), _countof(fid.group));
}
FontRegisterT(&fid);
}
- _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group));
- strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup));
+ _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), _countof(cid.group));
+ strncpy(cid.dbSettingsGroup, CHAT_MODULE, _countof(cid.dbSettingsGroup));
for (int i = 0; i <= 7; i++) {
mir_snprintf(szTemp, "NickColor%d", i);
- _tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name));
+ _tcsncpy(cid.name, chatcolorsnames[i], _countof(cid.name));
cid.order = i + 1;
- strncpy(cid.setting, szTemp, SIZEOF(cid.setting));
+ strncpy(cid.setting, szTemp, _countof(cid.setting));
switch (i) {
case 5:
cid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
@@ -613,14 +613,14 @@ void RegisterFontServiceFonts()
ColourRegisterT(&cid);
// static colors (info panel, tool bar background etc...)
- strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
+ strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
+ strncpy(cid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
- for (int i = 0; i < SIZEOF(_clrs); i++) {
+ for (int i = 0; i < _countof(_clrs); i++) {
cid.order = _clrs[i].order;
- _tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
- _tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
- strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting));
+ _tcsncpy(cid.group, _clrs[i].tszGroup, _countof(fid.group));
+ _tcsncpy(cid.name, _clrs[i].tszName, _countof(cid.name));
+ strncpy(cid.setting, _clrs[i].szSetting, _countof(cid.setting));
if (_clrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
else
@@ -628,14 +628,14 @@ void RegisterFontServiceFonts()
ColourRegisterT(&cid);
}
- strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup));
+ strncpy(cid.dbSettingsGroup, SRMSGMOD_T, _countof(fid.dbSettingsGroup));
// text and background colors for tabs
- for (int i = 0; i < SIZEOF(_tabclrs); i++) {
+ for (int i = 0; i < _countof(_tabclrs); i++) {
cid.order = _tabclrs[i].order;
- _tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
- _tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
- strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting));
+ _tcsncpy(cid.group, _tabclrs[i].tszGroup, _countof(fid.group));
+ _tcsncpy(cid.name, _tabclrs[i].tszName, _countof(cid.name));
+ strncpy(cid.setting, _tabclrs[i].szSetting, _countof(cid.setting));
if (_tabclrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
else
@@ -692,7 +692,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (ServiceExists(MS_UTILS_REPLACEVARS)) {
TCHAR tszTooltipText[2048];
- mir_sntprintf(tszTooltipText, SIZEOF(tszTooltipText),
+ mir_sntprintf(tszTooltipText, _countof(tszTooltipText),
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
_T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
@@ -759,12 +759,12 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
*p1 = 0;
TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
- mir_sntprintf(tszInitialDir, SIZEOF(tszInitialDir), _T("%s%s"), M.getChatLogPath(), p);
+ mir_sntprintf(tszInitialDir, _countof(tszInitialDir), _T("%s%s"), M.getChatLogPath(), p);
if (!PathFileExists(tszInitialDir))
_tcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
TCHAR tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All files"), 0, 0, 0);
+ mir_sntprintf(tszTemp, _countof(tszTemp), _T("%s%c*.*%c%c"), TranslateT("All files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lpstrInitialDir = tszInitialDir;
@@ -955,7 +955,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
DWORD dwPopupFlags = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
DWORD dwLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
- for (int i = 0; i < SIZEOF(_eventorder); i++) {
+ for (int i = 0; i < _countof(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
@@ -987,7 +987,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
DWORD dwFilterFlags = 0, dwTrayFlags = 0,
dwPopupFlags = 0, dwLogFlags = 0;
- for (int i = 0; i < SIZEOF(_eventorder); i++) {
+ for (int i = 0; i < _countof(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index e26797e999..a638836b7e 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -55,7 +55,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
TCHAR newcontactname[128];
if (mir_tstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
- CutContactName(contactName, newcontactname, SIZEOF(newcontactname));
+ CutContactName(contactName, newcontactname, _countof(newcontactname));
else
_tcsncpy_s(newcontactname, contactName, _TRUNCATE);
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index fa3c09ec13..9ffc5e7bc1 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -102,7 +102,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
return 0;
va_start(marker, fmt);
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
pd.lchContact = hContact;
@@ -113,7 +113,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
pd.lchIcon = LoadIconEx("window");
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, SIZEOF(pd.lptzContactName), _T("%s - %s"),
+ mir_sntprintf(pd.lptzContactName, _countof(pd.lptzContactName), _T("%s - %s"),
(pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
pcli->pfnGetContactDisplayName(hContact, 0));
@@ -536,7 +536,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO
if (pszWordText && pszWordText[0]) {
TCHAR szMenuText[4096];
- mir_sntprintf(szMenuText, SIZEOF(szMenuText), TranslateT("Look up '%s':"), pszWordText);
+ mir_sntprintf(szMenuText, _countof(szMenuText), TranslateT("Look up '%s':"), pszWordText);
ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
}
else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 2f3063c880..4d5835d9d6 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1031,7 +1031,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
DWORD dwTrayMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
DWORD dwTrayFlags = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0);
- for (int i = 0; i < SIZEOF(_eventorder); i++) {
+ for (int i = 0; i < _countof(_eventorder); i++) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupMask & _eventorder[i] ? (dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayMask & _eventorder[i] ? (dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
@@ -1050,7 +1050,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
int iFlags = 0, i;
DWORD dwMask = 0;
- for (i = 0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < _countof(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1072,7 +1072,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for (i = 0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < _countof(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1094,7 +1094,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for (i = 0; i < SIZEOF(_eventorder); i++) {
+ for (i = 0; i < _countof(_eventorder); i++) {
int result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1323,7 +1323,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
}
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
TranslateT("Nickname"), ui1->pszNick,
TranslateT("Unique ID"), ui1->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status));
@@ -1458,7 +1458,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
else if (wParam < ' ')
break;
else {
- if (mir_tstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
+ if (mir_tstrlen(si->szSearch) >= _countof(si->szSearch) - 2) {
MessageBeep(MB_OK);
break;
}
@@ -1671,7 +1671,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
}
if (tszBuf[0] == 0)
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
TranslateT("Nick"), ui1->pszNick,
TranslateT("Unique ID"), ui1->pszUID,
TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui1->Status));
@@ -1890,7 +1890,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
const TCHAR *szNick = dat->cache->getNick();
if (mir_tstrlen(szNick) > 0) {
if (M.GetByte("cuttitle", 0))
- CutContactName(szNick, dat->newtitle, SIZEOF(dat->newtitle));
+ CutContactName(szNick, dat->newtitle, _countof(dat->newtitle));
else
_tcsncpy_s(dat->newtitle, szNick, _TRUNCATE);
}
@@ -1976,17 +1976,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
else if (diff > 59) {
DWORD hours = diff / 60;
DWORD minutes = diff % 60;
- mir_sntprintf(mi->tszIdleMsg, SIZEOF(mi->tszIdleMsg), TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ?
+ mir_sntprintf(mi->tszIdleMsg, _countof(mi->tszIdleMsg), TranslateT(", %d %s, %d %s idle"), hours, hours > 1 ?
TranslateT("hours") : TranslateT("hour"),
minutes, minutes > 1 ? TranslateT("minutes") : TranslateT("minute"));
}
- else mir_sntprintf(mi->tszIdleMsg, SIZEOF(mi->tszIdleMsg), TranslateT(", %d %s idle"), diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute"));
+ else mir_sntprintf(mi->tszIdleMsg, _countof(mi->tszIdleMsg), TranslateT(", %d %s idle"), diff, diff > 1 ? TranslateT("minutes") : TranslateT("minute"));
}
- mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg);
+ mir_sntprintf(szFinalStatusBarText, _countof(szFinalStatusBarText), TranslateT("%s on %s%s"), dat->szMyNickname, mi->ptszModDispName, mi->tszIdleMsg);
}
else {
if (si->ptszStatusbarText)
- mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText);
+ mir_sntprintf(szFinalStatusBarText, _countof(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText);
else
_tcsncpy_s(szFinalStatusBarText, mi->ptszModDispName, _TRUNCATE);
}
@@ -2570,7 +2570,7 @@ LABEL_SHOWWINDOW:
case ID_SEARCH_GOOGLE:
if (pszWord[0]) {
TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
+ mir_sntprintf(szURL, _countof(szURL), _T("http://www.google.com/search?q=%s"), pszWord);
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL);
}
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -2579,7 +2579,7 @@ LABEL_SHOWWINDOW:
case ID_SEARCH_WIKIPEDIA:
if (pszWord[0]) {
TCHAR szURL[4096];
- mir_sntprintf(szURL, SIZEOF(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
+ mir_sntprintf(szURL, _countof(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL);
}
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -3176,7 +3176,7 @@ LABEL_SHOWWINDOW:
DBVARIANT dbv = { 0 };
char szIndex[10];
char *szKey = "TAB_ContainersW";
- mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
+ mir_snprintf(szIndex, _countof(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
if (iSelection - IDM_CONTAINERMENU >= 0) {
if (!db_get_ts(NULL, szKey, szIndex, &dbv)) {
SendMessage(hwndDlg, DM_CONTAINERSELECTED, 0, (LPARAM)dbv.ptszVal);
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 6429432ee9..861991a6d1 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -190,7 +190,7 @@ bool CContactCache::updateUIN()
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
- mir_sntprintf(m_szUIN, SIZEOF(m_szUIN), _T("%u"), ci.dVal);
+ mir_sntprintf(m_szUIN, _countof(m_szUIN), _T("%u"), ci.dVal);
break;
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 9046c7ce7c..8af158731f 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -166,7 +166,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
CSkin::DrawItem(dcMem, &rcWindow, item);
TCHAR szWindowText[512];
- GetWindowText(hwndDlg, szWindowText, SIZEOF(szWindowText));
+ GetWindowText(hwndDlg, szWindowText, _countof(szWindowText));
szWindowText[511] = 0;
hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption);
GetTextMetrics(dcMem, &tm);
@@ -609,7 +609,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
else {
char szCName[CONTAINER_NAMELEN + 20];
- mir_snprintf(szCName, SIZEOF(szCName), "%s%d", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%d", CONTAINER_PREFIX, pContainer->iContainerIndex);
if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, szCName)) {
if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, szCName))
if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split"))
@@ -1029,8 +1029,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
if (lParam) { // lParam != 0 means sent by a chat window
TCHAR szText[512];
dat = (TWindowData*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
- GetWindowText((HWND)wParam, szText, SIZEOF(szText));
- szText[SIZEOF(szText) - 1] = 0;
+ GetWindowText((HWND)wParam, szText, _countof(szText));
+ szText[_countof(szText) - 1] = 0;
SetWindowText(hwndDlg, szText);
if (dat)
SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hTabIcon != dat->hTabStatusIcon ? dat->hTabIcon : dat->hTabStatusIcon));
@@ -1344,14 +1344,14 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
pContainer->settings = &PluginConfig.globalContainerSettings;
pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
- mir_snprintf(szCname, SIZEOF(szCname), "%s_theme", CONTAINER_PREFIX);
+ mir_snprintf(szCname, _countof(szCname), "%s_theme", CONTAINER_PREFIX);
if (!db_get_ts(pContainer->hContactFrom, SRMSGMOD_T, szCname, &dbv))
szThemeName = dbv.ptszVal;
}
else {
Utils::ReadPrivateContainerSettings(pContainer);
if (szThemeName == NULL) {
- mir_snprintf(szCname, SIZEOF(szCname), "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCname, _countof(szCname), "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex);
if (!db_get_ts(NULL, SRMSGMOD_T, szCname, &dbv))
szThemeName = dbv.ptszVal;
}
@@ -1725,13 +1725,13 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
else {
char szCName[40];
- mir_snprintf(szCName, SIZEOF(szCName), "%s%dx", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%dx", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.left);
- mir_snprintf(szCName, SIZEOF(szCName), "%s%dy", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%dy", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.top);
- mir_snprintf(szCName, SIZEOF(szCName), "%s%dwidth", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%dwidth", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.right - wp.rcNormalPosition.left);
- mir_snprintf(szCName, SIZEOF(szCName), "%s%dheight", CONTAINER_PREFIX, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%dheight", CONTAINER_PREFIX, pContainer->iContainerIndex);
db_set_dw(0, SRMSGMOD_T, szCName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
db_set_b(0, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd == SW_SHOWMAXIMIZED) ? 1 : 0));
@@ -1750,7 +1750,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
char szCName[40];
- mir_snprintf(szCName, SIZEOF(szCName), "%s_theme", CONTAINER_PREFIX);
+ mir_snprintf(szCName, _countof(szCName), "%s_theme", CONTAINER_PREFIX);
if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
@@ -1913,7 +1913,7 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size
_tcsncpy_s(newname, size, oldname, _TRUNCATE);
else {
TCHAR fmt[30];
- mir_sntprintf(fmt, SIZEOF(fmt), _T("%%%d.%ds..."), cutMax, cutMax);
+ mir_sntprintf(fmt, _countof(fmt), _T("%%%d.%ds..."), cutMax, cutMax);
mir_sntprintf(newname, size, fmt, oldname);
}
return 0;
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index b21c826881..6e3a6f8583 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -151,7 +151,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
TranslateDialogDefault(hwndDlg);
SetWindowText(hwndDlg, TranslateT("Container options"));
TCHAR szNewTitle[128];
- mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ?
+ mir_sntprintf(szNewTitle, _countof(szNewTitle), _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ?
TranslateT("Default container") : pContainer->szName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle);
Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins);
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
else {
if (pContainer->settings != &PluginConfig.globalContainerSettings) {
char szCname[40];
- mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
+ mir_snprintf(szCname, _countof(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
pContainer->settings->fPrivate = false;
db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
mir_free(pContainer->settings);
@@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_THEME)) > 0) {
wchar_t szFinalThemeFile[MAX_PATH], szFilename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_THEME, szFilename, SIZEOF(szFilename));
+ GetDlgItemText(hwndDlg, IDC_THEME, szFilename, _countof(szFilename));
szFilename[MAX_PATH - 1] = 0;
PathToAbsoluteT(szFilename, szFinalThemeFile, M.getDataPath());
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index 0fec89b39e..7afb2db8dd 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -584,7 +584,7 @@ void CMenuBar::checkButtons()
m_buttonsInit = true;
}
- ::SendMessage(m_hwndToolbar, TB_ADDBUTTONS, SIZEOF(m_TbButtons), (LPARAM)m_TbButtons);
+ ::SendMessage(m_hwndToolbar, TB_ADDBUTTONS, _countof(m_TbButtons), (LPARAM)m_TbButtons);
m_size_y = HIWORD(::SendMessage(m_hwndToolbar, TB_GETBUTTONSIZE, 0, 0));
@@ -967,19 +967,19 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) {
if (sid->dwId == MSG_ICON_SOUND)
- mir_sntprintf(wBuf, SIZEOF(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
+ mir_sntprintf(wBuf, _countof(wBuf), TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && dat && (dat->bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) {
int mtnStatus = db_get_b(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
- mir_sntprintf(wBuf, SIZEOF(wBuf), TranslateT("Sending typing notifications is %s."),
+ mir_sntprintf(wBuf, _countof(wBuf), TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
}
else if (sid->dwId == MSG_ICON_SESSION)
_tcsncpy_s(wBuf, TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"), _TRUNCATE);
}
else if (sid->tszTooltip)
- _tcsncpy(wBuf, sid->tszTooltip, SIZEOF(wBuf));
+ _tcsncpy(wBuf, sid->tszTooltip, _countof(wBuf));
if (wBuf[0]) {
CallService("mToolTip/ShowTipW", (WPARAM)wBuf, (LPARAM)&ti);
@@ -998,7 +998,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
const TCHAR *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
- mir_sntprintf(wBuf, SIZEOF(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
+ mir_sntprintf(wBuf, _countof(wBuf), szFormat, dat->iOpenJobs, iLength, dat->nMax ? dat->nMax : 20000, iQueued);
CallService("mToolTip/ShowTipW", (WPARAM)wBuf, (LPARAM)&ti);
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index e39e300218..0ed7ff9f4c 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -500,7 +500,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent)
TCHAR szHeader[256];
if (pdata->pluginOptions->bShowHeaders)
- mir_sntprintf(szHeader, SIZEOF(szHeader), _T("%s %d\n"), TranslateT("New messages: "), pdata->nrMerged + 1);
+ mir_sntprintf(szHeader, _countof(szHeader), _T("%s %d\n"), TranslateT("New messages: "), pdata->nrMerged + 1);
else
szHeader[0] = 0;
@@ -513,14 +513,14 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent)
TCHAR timestamp[MAX_DATASIZE];
_tcsftime(timestamp, MAX_DATASIZE, _T("%Y.%m.%d %H:%M"), _localtime32((__time32_t *)&dbe.timestamp));
- mir_sntprintf(pdata->eventData[pdata->nrMerged].tszText, SIZEOF(pdata->eventData[pdata->nrMerged].tszText), _T("\n\n%s\n"), timestamp);
+ mir_sntprintf(pdata->eventData[pdata->nrMerged].tszText, _countof(pdata->eventData[pdata->nrMerged].tszText), _T("\n\n%s\n"), timestamp);
TCHAR *szPreview = GetPreviewT(dbe.eventType, &dbe);
if (szPreview) {
- mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, szPreview, SIZEOF(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
+ mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, szPreview, _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
mir_free(szPreview);
}
- else mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, _T(" "), SIZEOF(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
+ else mir_tstrncat(pdata->eventData[pdata->nrMerged].tszText, _T(" "), _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_tstrlen(pdata->eventData[pdata->nrMerged].tszText));
pdata->eventData[pdata->nrMerged].tszText[MAX_SECONDLINE - 1] = 0;
@@ -544,7 +544,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent)
}
i = (available > 0) ? i + 1 : i + 2;
for (; i <= pdata->nrMerged; i++)
- mir_tstrncat(lpzText, pdata->eventData[i].tszText, SIZEOF(lpzText) - mir_tstrlen(lpzText));
+ mir_tstrncat(lpzText, pdata->eventData[i].tszText, _countof(lpzText) - mir_tstrlen(lpzText));
pdata->eventData[pdata->nrMerged].hEvent = hEvent;
pdata->eventData[pdata->nrMerged].timestamp = dbe.timestamp;
@@ -672,7 +672,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced)
PluginConfig.m_UnreadInTray -= (mii.dwItemData & 0x0000ffff);
if (mii.dwItemData > 0 || bForced) {
TCHAR szMenuEntry[80];
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszProto,
+ mir_sntprintf(szMenuEntry, _countof(szMenuEntry), _T("%s: %s (%s) [%d]"), tszProto,
dat->cache->getNick(), dat->szStatus[0] ? dat->szStatus : _T("(undef)"), mii.dwItemData & 0x0000ffff);
if (!bForced)
@@ -716,7 +716,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro
if (fromEvent == 2) // from chat...
mii.dwItemData |= 0x10000000;
DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND);
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ mir_sntprintf(szMenuEntry, _countof(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
PluginConfig.m_UnreadInTray++;
if (PluginConfig.m_UnreadInTray)
@@ -726,7 +726,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro
else {
szNick = pcli->pfnGetContactDisplayName(hContact, 0);
if (CheckMenuItem(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == -1) {
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
+ mir_sntprintf(szMenuEntry, _countof(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, fromEvent ? 1 : 0);
AppendMenu(PluginConfig.g_hMenuTrayUnread, MF_BYCOMMAND | MF_STRING, (UINT_PTR)hContact, szMenuEntry);
mii.dwItemData = fromEvent ? 1 : 0;
PluginConfig.m_UnreadInTray += (mii.dwItemData & 0x0000ffff);
@@ -744,7 +744,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro
mii.fMask |= MIIM_STRING;
if (fromEvent == 2)
mii.dwItemData |= 0x10000000;
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
+ mir_sntprintf(szMenuEntry, _countof(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
mii.dwTypeData = (LPTSTR)szMenuEntry;
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 13e8eaa563..0b0fcc1ac8 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -45,12 +45,12 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat)
else if (dat) {
TCHAR szFilter[MAX_PATH], szFilename[MAX_PATH];
mir_sntprintf(szFilter, _T("%s%c*.rtf%c%c"), TranslateT("Rich Edit file"), 0, 0, 0);
- mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s.rtf"), dat->cache->getNick());
+ mir_sntprintf(szFilename, _countof(szFilename), _T("%s.rtf"), dat->cache->getNick());
Utils::sanitizeFilename(szFilename);
TCHAR szInitialDir[MAX_PATH + 2];
- mir_sntprintf(szInitialDir, SIZEOF(szInitialDir), _T("%s%s\\"), M.getDataPath(), _T("\\Saved message logs"));
+ mir_sntprintf(szInitialDir, _countof(szInitialDir), _T("%s%s\\"), M.getDataPath(), _T("\\Saved message logs"));
CreateDirectoryTreeT(szInitialDir);
OPENFILENAME ofn = { 0 };
@@ -613,7 +613,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v);
TCHAR tStr[80];
- mir_sntprintf(tStr, SIZEOF(tStr), _T("%s %d.%d.%d.%d [build %d]"),
+ mir_sntprintf(tStr, _countof(tStr), _T("%s %d.%d.%d.%d [build %d]"),
TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, tStr);
}
@@ -1001,7 +1001,7 @@ void TSAPI DM_LoadLocale(TWindowData *dat)
if (!PluginConfig.m_bDontUseDefaultKbd) {
TCHAR szBuf[20];
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20);
- mir_sntprintf(szKLName, SIZEOF(szKLName), _T("0000%s"), szBuf);
+ mir_sntprintf(szKLName, _countof(szKLName), _T("0000%s"), szBuf);
db_set_ts(dat->hContact, SRMSGMOD_T, "locale", szKLName);
}
else {
@@ -1039,7 +1039,7 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat)
TCHAR szBuf[100];
if (dat->bShowTyping) {
SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]);
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("%s is typing a message..."), dat->cache->getNick());
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("%s is typing a message..."), dat->cache->getNick());
}
else if (dat->sbCustom) {
SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon);
@@ -1050,14 +1050,14 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat)
SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0);
if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR)
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("UID: %s"), dat->cache->getUIN());
+ mir_sntprintf(szBuf, _countof(szBuf), _T("UID: %s"), dat->cache->getUIN());
else if (dat->lastMessage) {
TCHAR date[64], time[64];
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, _countof(date), 0);
if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_tstrlen(date) > 6)
date[mir_tstrlen(date) - 5] = 0;
- TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0);
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Last received: %s at %s"), date, time);
+ TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, _countof(time), 0);
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("Last received: %s at %s"), date, time);
}
else szBuf[0] = 0;
}
@@ -1377,7 +1377,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff)
dat->bShowTyping = 2;
dat->nTypeSecs = 86400;
- mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar), TranslateT("%s has entered text."), dat->cache->getNick());
+ mir_sntprintf(dat->szStatusBar, _countof(dat->szStatusBar), TranslateT("%s has entered text."), dat->cache->getNick());
if (hwndStatus && dat->pContainer->hwndActive == hwndDlg)
SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar);
}
@@ -1402,7 +1402,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff)
UpdateStatusBar(dat);
}
else if (dat->nTypeSecs > 0) {
- mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar), TranslateT("%s is typing a message"), dat->cache->getNick());
+ mir_sntprintf(dat->szStatusBar, _countof(dat->szStatusBar), TranslateT("%s is typing a message"), dat->cache->getNick());
dat->nTypeSecs--;
if (hwndStatus && dat->pContainer->hwndActive == hwndDlg) {
@@ -1595,7 +1595,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam)
dat->hQueuedEvents[dat->iNextQueuedEvent++] = hDbEvent;
TCHAR szBuf[100];
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"),
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"),
dat->iNextQueuedEvent);
SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, szBuf);
RedrawWindow(GetDlgItem(hwndDlg, IDC_LOGFROZENTEXT), NULL, NULL, RDW_INVALIDATE);
@@ -1739,7 +1739,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam)
if (lParam != 0) {
if (PluginConfig.m_bCutContactNameOnTabs)
- CutContactName(szNick, newcontactname, SIZEOF(newcontactname));
+ CutContactName(szNick, newcontactname, _countof(newcontactname));
else
_tcsncpy_s(newcontactname, szNick, _TRUNCATE);
@@ -1747,7 +1747,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam)
if (mir_tstrlen(newcontactname) != 0) {
if (PluginConfig.m_bStatusOnTabs)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s)"), newcontactname, dat->szStatus);
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s (%s)"), newcontactname, dat->szStatus);
else
_tcsncpy_s(newtitle, newcontactname, _TRUNCATE);
}
@@ -1759,11 +1759,11 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam)
TCHAR fulluin[256];
if (dat->bIsMeta)
- mir_sntprintf(fulluin, SIZEOF(fulluin),
+ mir_sntprintf(fulluin, _countof(fulluin),
TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."),
bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
else
- mir_sntprintf(fulluin, SIZEOF(fulluin),
+ mir_sntprintf(fulluin, _countof(fulluin),
TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."),
bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
@@ -1775,7 +1775,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam)
if (dat->idle != dwOldIdle || lParam != 0) {
if (item.mask & TCIF_TEXT) {
item.pszText = newtitle;
- _tcsncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle));
+ _tcsncpy(dat->newtitle, newtitle, _countof(dat->newtitle));
dat->newtitle[127] = 0;
if (dat->pWnd)
dat->pWnd->updateTitle(dat->cache->getNick());
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index d20513e72f..4e6216befb 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -562,7 +562,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void)
cle.hDbEvent = hDbEvent;
TCHAR toolTip[256];
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index ddd0fe2350..5c7faa7def 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -150,7 +150,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_CREATE:
- for (int i = 0; i < SIZEOF(_hotkeydescs); i++) {
+ for (int i = 0; i < _countof(_hotkeydescs); i++) {
_hotkeydescs[i].cbSize = sizeof(HOTKEYDESC);
Hotkey_Register(&_hotkeydescs[i]);
}
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 747e5682bf..97c73680fe 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -496,7 +496,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
time_t diff = time(NULL) - m_dat->idle;
int i_hrs = diff / 3600;
int i_mins = (diff - i_hrs * 3600) / 60;
- mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
+ mir_sntprintf(szBuf, _countof(szBuf), TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
}
else _tcscpy_s(szBuf, 256, tszUin);
@@ -543,7 +543,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
TCHAR szResult[80]; szResult[0] = 0;
if (m_dat->hTimeZone) {
- TimeZone_PrintDateTime(m_dat->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0);
+ TimeZone_PrintDateTime(m_dat->hTimeZone, _T("t"), szResult, _countof(szResult), 0);
GetTextExtentPoint32(hdc, szResult, (int)mir_tstrlen(szResult), &sTime);
}
@@ -613,7 +613,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
if (m_height < DEGRADE_THRESHOLD) {
TCHAR tszText[2048];
- mir_sntprintf(tszText, SIZEOF(tszText), TranslateT("Topic is: %s"),
+ mir_sntprintf(tszText, _countof(tszText), TranslateT("Topic is: %s"),
si->ptszTopic ? si->ptszTopic : TranslateT("no topic set."));
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
@@ -670,7 +670,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
SIZE szTitle;
TCHAR szPrefix[100];
- mir_sntprintf(szPrefix, SIZEOF(szPrefix), TranslateT("Topic is: %s"), _T(""));
+ mir_sntprintf(szPrefix, _countof(szPrefix), TranslateT("Topic is: %s"), _T(""));
::GetTextExtentPoint32(hdc, szPrefix, (int)mir_tstrlen(szPrefix), &szTitle);
mapRealRect(rcItem, m_rcUIN, szTitle);
if (m_hoverFlags & HOVER_UIN)
@@ -1061,11 +1061,11 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L
case WM_INITDIALOG:
{
TCHAR tszTitle[100];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("Set panel visibility for this %s"),
+ mir_sntprintf(tszTitle, _countof(tszTitle), TranslateT("Set panel visibility for this %s"),
m_isChat ? TranslateT("chat room") : TranslateT("contact"));
::SetDlgItemText(hwnd, IDC_STATIC_VISIBILTY, tszTitle);
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
+ mir_sntprintf(tszTitle, _countof(tszTitle), m_isChat ? TranslateT("Do not synchronize the panel height with IM windows") :
TranslateT("Do not synchronize the panel height with group chat windows"));
::SetDlgItemText(hwnd, IDC_NOSYNC, tszTitle);
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 8776a324dd..aebd13aa89 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -149,7 +149,7 @@ void CMimAPI::InitPaths()
{
const TCHAR *szUserdataDir = getUserDir();
- mir_sntprintf(m_szProfilePath, SIZEOF(m_szProfilePath), _T("%stabSRMM"), szUserdataDir);
+ mir_sntprintf(m_szProfilePath, _countof(m_szProfilePath), _T("%stabSRMM"), szUserdataDir);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
_tcsncpy_s(m_szChatLogsPath, _T("%miranda_logpath%"), _TRUNCATE);
_tcsncpy_s(m_szSkinsPath, _T("%miranda_path%\\Skins\\TabSRMM"), _TRUNCATE);
@@ -164,7 +164,7 @@ void CMimAPI::InitPaths()
Utils::ensureTralingBackslash(m_szSkinsPath);
- mir_sntprintf(m_szSavedAvatarsPath, SIZEOF(m_szSavedAvatarsPath), _T("%s\\Saved Contact Pictures"), m_szProfilePath);
+ mir_sntprintf(m_szSavedAvatarsPath, _countof(m_szSavedAvatarsPath), _T("%s\\Saved Contact Pictures"), m_szProfilePath);
}
bool CMimAPI::getAeroState()
@@ -299,7 +299,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode)
if (mode) {
TCHAR szTip[256];
- mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(szTip, _countof(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
if (fShowOnClist && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) {
MIRANDASYSTRAYNOTIFY tn;
tn.szProto = NULL;
@@ -550,7 +550,7 @@ nowindowcreate:
cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName);
+ mir_sntprintf(toolTip, _countof(toolTip), TranslateT("Message from %s"), contactName);
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp
index 17913d17c0..ce0537289c 100644
--- a/plugins/TabSRMM/src/modplus.cpp
+++ b/plugins/TabSRMM/src/modplus.cpp
@@ -43,7 +43,7 @@
static TCHAR* getMenuEntry(int i)
{
char MEntry[256];
- mir_snprintf(MEntry, SIZEOF(MEntry), "MenuEntry_%u", i);
+ mir_snprintf(MEntry, _countof(MEntry), "MenuEntry_%u", i);
return db_get_tsa(NULL, "tabmodplus", MEntry);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index bf0f76394e..3393c283e5 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1193,7 +1193,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
else dat->wStatus = ID_STATUS_OFFLINE;
- for (int i = 0; i < SIZEOF(btnControls); i++)
+ for (int i = 0; i < _countof(btnControls); i++)
CustomizeButton(GetDlgItem(hwndDlg, btnControls[i]));
GetMYUIN(dat);
@@ -1280,7 +1280,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
- for (int i = 0; i < SIZEOF(tooltips); i++)
+ for (int i = 0; i < _countof(tooltips); i++)
SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(tooltips[i].text), BATF_TCHAR);
SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
@@ -1292,7 +1292,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetDlgItemText(hwndDlg, IDC_RETRY, TranslateT("Retry"));
UINT _ctrls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
- for (int i = 0; i < SIZEOF(_ctrls); i++) {
+ for (int i = 0; i < _countof(_ctrls); i++) {
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
@@ -2112,7 +2112,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return 0;
case DM_LOADBUTTONBARICONS:
- for (int i = 0; i < SIZEOF(buttonicons); i++) {
+ for (int i = 0; i < _countof(buttonicons); i++) {
SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon);
SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
}
@@ -2331,7 +2331,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
SendJob *job = sendQueue->getJobByIndex(iIndex);
KillTimer(hwndDlg, wParam);
- mir_sntprintf(job->szErrorMsg, SIZEOF(job->szErrorMsg), TranslateT("Delivery failure: %s"),
+ mir_sntprintf(job->szErrorMsg, _countof(job->szErrorMsg), TranslateT("Delivery failure: %s"),
TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
@@ -2549,7 +2549,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
char szIndex[10];
char *szKey = "TAB_ContainersW";
- mir_snprintf(szIndex, SIZEOF(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
+ mir_snprintf(szIndex, _countof(szIndex), "%d", iSelection - IDM_CONTAINERMENU);
if (iSelection - IDM_CONTAINERMENU >= 0) {
ptrT val(db_get_tsa(NULL, szKey, szIndex));
if (val)
@@ -2634,7 +2634,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
if (final_sendformat)
- DoRtfToTags(dat, decoded, SIZEOF(rtfDefColors), rtfDefColors);
+ DoRtfToTags(dat, decoded, _countof(rtfDefColors), rtfDefColors);
decoded.TrimRight();
T2Utf utfResult(decoded);
@@ -3052,7 +3052,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
TCHAR** ppFiles = NULL;
for (i = 0; i < fileCount; i++) {
- DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
+ DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
Utils::AddToFileList(&ppFiles, &totalCount, szFilename);
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 8da7eac733..3925cde528 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -48,7 +48,7 @@ static int g_status_events_size = 0;
bool TSAPI IsStatusEvent(int eventType)
{
if (g_status_events_size == 0)
- g_status_events_size = SIZEOF(g_status_events);
+ g_status_events_size = _countof(g_status_events);
for (int i = 0; i < g_status_events_size; i++) {
if (eventType == g_status_events[i])
@@ -82,7 +82,7 @@ void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fS
TCITEM item = { 0 };
item.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM;
item.pszText = oldText;
- item.cchTextMax = SIZEOF(oldText);
+ item.cchTextMax = _countof(oldText);
TabCtrl_GetItem(hwndTab, dat->iTabID, &item);
int newIndex = LOWORD(iMode);
@@ -135,12 +135,12 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic)
DWORD setView = 1;
TCHAR szTimestamp[100];
- mir_sntprintf(szTimestamp, SIZEOF(szTimestamp), _T("%04u %02u %02u_%02u%02u"), lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
+ mir_sntprintf(szTimestamp, _countof(szTimestamp), _T("%04u %02u %02u_%02u%02u"), lt->tm_year + 1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min);
TCHAR *szProto = mir_a2t(dat->cache->getActiveProto());
TCHAR szFinalPath[MAX_PATH];
- mir_sntprintf(szFinalPath, SIZEOF(szFinalPath), _T("%s\\%s"), M.getSavedAvatarPath(), szProto);
+ mir_sntprintf(szFinalPath, _countof(szFinalPath), _T("%s\\%s"), M.getSavedAvatarPath(), szProto);
mir_free(szProto);
if (CreateDirectory(szFinalPath, 0) == 0) {
@@ -153,17 +153,17 @@ static void SaveAvatarToFile(TWindowData *dat, HBITMAP hbm, int isOwnPic)
TCHAR szBaseName[MAX_PATH];
if (isOwnPic)
- mir_sntprintf(szBaseName, SIZEOF(szBaseName), _T("My Avatar_%s"), szTimestamp);
+ mir_sntprintf(szBaseName, _countof(szBaseName), _T("My Avatar_%s"), szTimestamp);
else
- mir_sntprintf(szBaseName, SIZEOF(szBaseName), _T("%s_%s"), dat->cache->getNick(), szTimestamp);
+ mir_sntprintf(szBaseName, _countof(szBaseName), _T("%s_%s"), dat->cache->getNick(), szTimestamp);
- mir_sntprintf(szFinalFilename, SIZEOF(szFinalFilename), _T("%s.png"), szBaseName);
+ mir_sntprintf(szFinalFilename, _countof(szFinalFilename), _T("%s.png"), szBaseName);
// do not allow / or \ or % in the filename
Utils::sanitizeFilename(szFinalFilename);
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s%c*.bmp;*.png;*.jpg;*.gif%c%c"), TranslateT("Image files"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s%c*.bmp;*.png;*.jpg;*.gif%c%c"), TranslateT("Image files"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lpstrDefExt = _T("png");
@@ -1047,7 +1047,7 @@ void TSAPI GetMYUIN(TWindowData *dat)
mir_free((void*)ci.pszVal);
break;
case CNFT_DWORD:
- mir_sntprintf(dat->myUin, SIZEOF(dat->myUin), _T("%u"), ci.dVal);
+ mir_sntprintf(dat->myUin, _countof(dat->myUin), _T("%u"), ci.dVal);
break;
default:
dat->myUin[0] = 0;
@@ -1285,7 +1285,7 @@ void TSAPI GetLocaleID(TWindowData *dat, const TCHAR *szKLName)
TCHAR szKey[20];
DWORD dwLID = _tcstoul(szKLName, &stopped, 16);
- mir_sntprintf(szKey, SIZEOF(szKey), _T("%04.04x"), LOWORD(dwLID));
+ mir_sntprintf(szKey, _countof(szKey), _T("%04.04x"), LOWORD(dwLID));
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("MIME\\Database\\Rfc1766"), 0, KEY_READ, &hKey)) {
DWORD dwLength = 255;
if (ERROR_SUCCESS == RegQueryValueEx(hKey, szKey, 0, 0, (unsigned char *)szLI, &dwLength)) {
@@ -1305,7 +1305,7 @@ void TSAPI GetLocaleID(TWindowData *dat, const TCHAR *szKLName)
_tcsupr(szLI);
}
fLocaleNotSet = (dat->lcID[0] == 0 && dat->lcID[1] == 0);
- mir_sntprintf(dat->lcID, SIZEOF(dat->lcID), szLI);
+ mir_sntprintf(dat->lcID, _countof(dat->lcID), szLI);
GetStringTypeA(dat->lcid, CT_CTYPE2, (char*)szTest, 3, wCtype2);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
@@ -1581,7 +1581,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat)
SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
CSkin::FillBack(dis->hDC, &dis->rcItem);
}
- GetWindowText(dis->hwndItem, szWindowText, SIZEOF(szWindowText));
+ GetWindowText(dis->hwndItem, szWindowText, _countof(szWindowText));
szWindowText[255] = 0;
SetBkMode(dis->hDC, TRANSPARENT);
DrawText(dis->hDC, szWindowText, -1, &dis->rcItem, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP | DT_END_ELLIPSIS);
@@ -1956,7 +1956,7 @@ void TSAPI SendHBitmapAsFile(const TWindowData *dat, HBITMAP hbmp)
if (filename[0] == 0) { // prompting to save
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s%c*.jpg%c%c"), TranslateT("JPEG-compressed images"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s%c*.jpg%c%c"), TranslateT("JPEG-compressed images"), 0, 0, 0);
OPENFILENAME dlg;
dlg.lStructSize = sizeof(dlg);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index a04ee564cd..525073e419 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -129,9 +129,9 @@ void TSAPI CacheLogFonts()
memset(logfonts, 0, (sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2)));
for (int i = 0; i < MSGDLGFONTCOUNT; i++) {
LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE);
- mir_snprintf(rtfFontsGlobal[i], SIZEOF(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic, logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY);
+ mir_snprintf(rtfFontsGlobal[i], _countof(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic, logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY);
}
- mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], SIZEOF(rtfFontsGlobal[MSGDLGFONTCOUNT]), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0);
+ mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], _countof(rtfFontsGlobal[MSGDLGFONTCOUNT]), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0);
_tcsncpy(szToday, TranslateT("Today"), 20);
_tcsncpy(szYesterday, TranslateT("Yesterday"), 20);
@@ -367,7 +367,7 @@ static TCHAR* Template_MakeRelativeDate(HANDLE hTimeZone, time_t check, TCHAR co
else
szFormat = _T("d");
- TimeZone_PrintTimeStamp(hTimeZone, check, szFormat, szResult, SIZEOF(szResult), 0);
+ TimeZone_PrintTimeStamp(hTimeZone, check, szFormat, szResult, _countof(szResult), 0);
}
return szResult;
}
@@ -460,7 +460,7 @@ static char* Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
if (dwEffectiveFlags & MWF_DIVIDERWANTED) {
static char szStyle_div[128] = "\0";
if (szStyle_div[0] == 0)
- mir_snprintf(szStyle_div, SIZEOF(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS, 0, 0, 5);
+ mir_snprintf(szStyle_div, _countof(szStyle_div), "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS, 0, 0, 5);
str.AppendFormat("\\sl-1\\slmult0\\highlight%d\\cf%d\\-\\par\\sl0", H_MSGFONTID_DIVIDERS, H_MSGFONTID_DIVIDERS);
dat->dwFlags &= ~MWF_DIVIDERWANTED;
@@ -1029,7 +1029,7 @@ static void SetupLogFormatting(TWindowData *dat)
if (dat->hHistoryEvents)
strncpy_s(dat->szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE);
else
- mir_snprintf(dat->szMicroLf, SIZEOF(dat->szMicroLf), "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
+ mir_snprintf(dat->szMicroLf, _countof(dat->szMicroLf), "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
}
static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent)
@@ -1139,7 +1139,7 @@ static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppe
if (dat->hHistoryEvents && dat->curHistory == dat->maxHistory) {
char szPattern[50];
- mir_snprintf(szPattern, SIZEOF(szPattern), "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
+ mir_snprintf(szPattern, _countof(szPattern), "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
FINDTEXTEXA fi;
fi.lpstrText = szPattern;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 192b28fffb..7888c5067b 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -75,7 +75,7 @@ void TSAPI LoadLogfont(int i, LOGFONTA * lf, COLORREF * colour, char *szModule)
lf->lfClipPrecision = lfResult.lfClipPrecision;
lf->lfQuality = lfResult.lfQuality;
lf->lfPitchAndFamily = lfResult.lfPitchAndFamily;
- mir_snprintf(lf->lfFaceName, SIZEOF(lf->lfFaceName), "%S", lfResult.lfFaceName);
+ mir_snprintf(lf->lfFaceName, _countof(lf->lfFaceName), "%S", lfResult.lfFaceName);
}
}
@@ -97,7 +97,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
{
bool fValid = false;
TCHAR tszMask[MAX_PATH];
- mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s*.*"), tszFolder);
+ mir_sntprintf(tszMask, _countof(tszMask), _T("%s*.*"), tszFolder);
WIN32_FIND_DATA fd = { 0 };
HANDLE h = FindFirstFile(tszMask, &fd);
@@ -117,9 +117,9 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox)
LRESULT lr;
TCHAR szBuf[255];
- mir_sntprintf(tszFinalName, SIZEOF(tszFinalName), _T("%s%s"), tszFolder, fd.cFileName);
+ mir_sntprintf(tszFinalName, _countof(tszFinalName), _T("%s%s"), tszFolder, fd.cFileName);
- GetPrivateProfileString(_T("Global"), _T("Name"), _T("None"), szBuf, SIZEOF(szBuf), tszFinalName);
+ GetPrivateProfileString(_T("Global"), _T("Name"), _T("None"), szBuf, _countof(szBuf), tszFinalName);
if (!mir_tstrcmp(szBuf, _T("None"))) {
fd.cFileName[mir_tstrlen(fd.cFileName) - 4] = 0;
_tcsncpy_s(szBuf, fd.cFileName, _TRUNCATE);
@@ -153,7 +153,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox)
_tcsncpy_s(tszSkinRoot, M.getSkinPath(), _TRUNCATE);
SetDlgItemText(GetParent(hwndCombobox), IDC_SKINROOTFOLDER, tszSkinRoot);
- mir_sntprintf(tszFindMask, SIZEOF(tszFindMask), _T("%s*.*"), tszSkinRoot);
+ mir_sntprintf(tszFindMask, _countof(tszFindMask), _T("%s*.*"), tszSkinRoot);
SendMessage(hwndCombobox, CB_RESETCONTENT, 0, 0);
SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<no skin>"));
@@ -163,7 +163,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox)
while (h != INVALID_HANDLE_VALUE) {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fd.cFileName[0] != '.') {
TCHAR tszSubDir[MAX_PATH];
- mir_sntprintf(tszSubDir, SIZEOF(tszSubDir), _T("%s%s\\"), tszSkinRoot, fd.cFileName);
+ mir_sntprintf(tszSubDir, _countof(tszSubDir), _T("%s%s\\"), tszSkinRoot, fd.cFileName);
ScanSkinDir(tszSubDir, hwndCombobox);
}
if (FindNextFile(h, &fd) == 0)
@@ -729,7 +729,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
Utils::showDlgControl(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
Utils::enableDlgControl(GetDlgItem(hwndDlg, IDC_MSGLOGDIDSPLAY), r != 0);
- for (int i = 0; i < SIZEOF(__ctrls); i++)
+ for (int i = 0; i < _countof(__ctrls); i++)
Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE);
}
return 0;
@@ -1488,7 +1488,7 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR
bInit = TRUE;
- for (int i = 0; i < SIZEOF(opts); ++i)
+ for (int i = 0; i < _countof(opts); ++i)
OptCheckBox_Load(hwndDlg, opts + i);
// Always on!
@@ -1572,7 +1572,7 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- for (int i = 0; i < SIZEOF(opts); ++i)
+ for (int i = 0; i < _countof(opts); ++i)
OptCheckBox_Save(hwndDlg, opts + i);
if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 2a95682f6a..2113f88edb 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -473,7 +473,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
TCHAR newcontactname[128], tabtitle[128];
if (contactName && mir_tstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
- CutContactName(contactName, newcontactname, SIZEOF(newcontactname));
+ CutContactName(contactName, newcontactname, _countof(newcontactname));
else
_tcsncpy_s(newcontactname, contactName, _TRUNCATE);
@@ -484,14 +484,14 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
TCHAR *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
if (M.GetByte("tabstatus", 1))
- mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s (%s) "), newcontactname, szStatus);
+ mir_sntprintf(tabtitle, _countof(tabtitle), _T("%s (%s) "), newcontactname, szStatus);
else
- mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s "), newcontactname);
+ mir_sntprintf(tabtitle, _countof(tabtitle), _T("%s "), newcontactname);
newData.item.pszText = tabtitle;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
newData.item.iImage = 0;
- newData.item.cchTextMax = SIZEOF(tabtitle);
+ newData.item.cchTextMax = _countof(tabtitle);
HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
// hide the active tab
@@ -741,12 +741,12 @@ struct {
int nItems;
}
static ICONBLOCKS[] = {
- { LPGEN("Message Sessions")"/"LPGEN("Default"), _deficons, SIZEOF(_deficons) },
- { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _toolbaricons, SIZEOF(_toolbaricons) },
- { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _exttoolbaricons, SIZEOF(_exttoolbaricons) },
- { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _chattoolbaricons, SIZEOF(_chattoolbaricons) },
- { LPGEN("Message Sessions")"/"LPGEN("Message Log"), _logicons, SIZEOF(_logicons) },
- { LPGEN("Message Sessions")"/"LPGEN("Animated Tray"), _trayIcon, SIZEOF(_trayIcon) }
+ { LPGEN("Message Sessions")"/"LPGEN("Default"), _deficons, _countof(_deficons) },
+ { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _toolbaricons, _countof(_toolbaricons) },
+ { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _exttoolbaricons, _countof(_exttoolbaricons) },
+ { LPGEN("Message Sessions")"/"LPGEN("Toolbar"), _chattoolbaricons, _countof(_chattoolbaricons) },
+ { LPGEN("Message Sessions")"/"LPGEN("Message Log"), _logicons, _countof(_logicons) },
+ { LPGEN("Message Sessions")"/"LPGEN("Animated Tray"), _trayIcon, _countof(_trayIcon) }
};
static int GetIconPackVersion(HMODULE hDLL)
@@ -798,7 +798,7 @@ static int TSAPI SetupIconLibConfig()
sid.defaultFile.t = szFilename;
sid.flags = SIDF_PATH_TCHAR;
- for (int n = 0; n < SIZEOF(ICONBLOCKS); n++) {
+ for (int n = 0; n < _countof(ICONBLOCKS); n++) {
sid.section.a = ICONBLOCKS[n].szSection;
for (int i = 0; i < ICONBLOCKS[n].nItems; i++) {
sid.pszName = ICONBLOCKS[n].idesc[i].szName;
@@ -836,7 +836,7 @@ static int TSAPI SetupIconLibConfig()
static int TSAPI LoadFromIconLib()
{
- for (int n = 0; n < SIZEOF(ICONBLOCKS); n++)
+ for (int n = 0; n < _countof(ICONBLOCKS); n++)
for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
*(ICONBLOCKS[n].idesc[i].phIcon) = IcoLib_GetIcon(ICONBLOCKS[n].idesc[i].szName);
@@ -878,7 +878,7 @@ void TSAPI LoadIconTheme()
static void UnloadIcons()
{
- for (int n = 0; n < SIZEOF(ICONBLOCKS); n++)
+ for (int n = 0; n < _countof(ICONBLOCKS); n++)
for (int i = 0; i < ICONBLOCKS[n].nItems; i++)
if (*(ICONBLOCKS[n].idesc[i].phIcon) != 0) {
DestroyIcon(*(ICONBLOCKS[n].idesc[i].phIcon));
@@ -1046,7 +1046,7 @@ STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEU
STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
{
TCHAR sztName[64];
- mir_sntprintf(sztName, SIZEOF(sztName), _T("s%u"), nextStgId++);
+ mir_sntprintf(sztName, _countof(sztName), _T("s%u"), nextStgId++);
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp
index 41b7951151..ad76be6bb3 100644
--- a/plugins/TabSRMM/src/selectcontainer.cpp
+++ b/plugins/TabSRMM/src/selectcontainer.cpp
@@ -47,7 +47,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (lParam) {
TWindowData *dat = (TWindowData*)GetWindowLongPtr((HWND)lParam, GWLP_USERDATA);
if (dat) {
- mir_sntprintf(szNewTitle, SIZEOF(szNewTitle), TranslateT("Select container for %s"), dat->cache->getNick());
+ mir_sntprintf(szNewTitle, _countof(szNewTitle), TranslateT("Select container for %s"), dat->cache->getNick());
SetWindowText(hwndDlg, szNewTitle);
}
}
@@ -102,7 +102,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
if (iLen) {
- GetDlgItemText(hwndDlg, IDC_NEWCONTAINERNAME, szNewName, SIZEOF(szNewName));
+ GetDlgItemText(hwndDlg, IDC_NEWCONTAINERNAME, szNewName, _countof(szNewName));
if (!_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN) || !_tcsncmp(szNewName, TranslateT("Default container"), CONTAINER_NAMELEN)) {
MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
@@ -144,7 +144,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
if (iLen) {
- GetDlgItemText(hwndDlg, IDC_NEWCONTAINER, szNewName, SIZEOF(szNewName));
+ GetDlgItemText(hwndDlg, IDC_NEWCONTAINER, szNewName, _countof(szNewName));
int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)szNewName);
if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
@@ -178,7 +178,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
char szValue[10];
TContainerData *pContainer = 0;
do {
- mir_snprintf(szValue, SIZEOF(szValue), "%d", iCounter);
+ mir_snprintf(szValue, _countof(szValue), "%d", iCounter);
if (db_get_ts(NULL, szKey, szValue, &dbv))
break; // end of list
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index bcc649242e..4110f1dc15 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -73,7 +73,7 @@ void CSendLaterJob::cleanDB()
db_set_dw(hContact, "SendLater", "count", iCount);
// delete flags
- mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
+ mir_snprintf(szKey, _countof(szKey), "$%s", szId);
db_unset(hContact, "SendLater", szKey);
}
}
@@ -87,7 +87,7 @@ void CSendLaterJob::readFlags()
char szKey[100];
DWORD localFlags;
- mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
+ mir_snprintf(szKey, _countof(szKey), "$%s", szId);
localFlags = db_get_dw(hContact, "SendLater", szKey, 0);
if (localFlags & SLF_SUSPEND)
@@ -104,7 +104,7 @@ void CSendLaterJob::writeFlags()
DWORD localFlags = (bCode == JOB_HOLD ? SLF_SUSPEND : 0);
char szKey[100];
- mir_snprintf(szKey, SIZEOF(szKey), "$%s", szId);
+ mir_snprintf(szKey, _countof(szKey), "$%s", szId);
db_set_dw(hContact, "SendLater", szKey, localFlags);
}
}
@@ -130,12 +130,12 @@ CSendLaterJob::~CSendLaterJob()
_tcsncpy_s(ppd.lptzContactName, (tszName ? tszName : TranslateT("'(Unknown contact)'")), _TRUNCATE);
TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[mir_strlen((char *)pBuf) + 1]), 100);
if (fSuccess) {
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("A send later job completed successfully.\nThe original message: %s"),
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), TranslateT("A send later job completed successfully.\nThe original message: %s"),
msgPreview);
mir_free(msgPreview);
}
else if (fFailed) {
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("A send later job failed to complete.\nThe original message: %s"),
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), TranslateT("A send later job failed to complete.\nThe original message: %s"),
msgPreview);
mir_free(msgPreview);
}
@@ -538,9 +538,9 @@ void CSendLater::qMgrFillList(bool fClear)
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
TCHAR tszBuf[255];
- mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s [%s]"), tszNick, c->getRealAccount());
+ mir_sntprintf(tszBuf, _countof(tszBuf), _T("%s [%s]"), tszNick, c->getRealAccount());
lvItem.pszText = tszBuf;
- lvItem.cchTextMax = SIZEOF(tszBuf);
+ lvItem.cchTextMax = _countof(tszBuf);
lvItem.iItem = uIndex++;
lvItem.iSubItem = 0;
lvItem.lParam = LPARAM(p);
@@ -590,7 +590,7 @@ void CSendLater::qMgrFillList(bool fClear)
bCode = p->bCode;
TCHAR tszStatus[20];
- mir_sntprintf(tszStatus, SIZEOF(tszStatus), _T("X/%s[%c] (%d)"), tszStatusText, bCode, p->iSendCount);
+ mir_sntprintf(tszStatus, _countof(tszStatus), _T("X/%s[%c] (%d)"), tszStatusText, bCode, p->iSendCount);
tszStatus[0] = p->szId[0];
lvItem.pszText = tszStatus;
lvItem.iSubItem = 3;
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index db1f572369..baecacb16e 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -215,7 +215,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
if (iSendLength >= iMinLength) {
TCHAR tszError[256];
- mir_sntprintf(tszError, SIZEOF(tszError), TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength);
+ mir_sntprintf(tszError, _countof(tszError), TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength);
::SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
sendQueue->clearJob(iEntry);
return 0;
@@ -270,7 +270,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
size_t iSendLength = getSendLength(iEntry);
if (iSendLength >= dat->nMax) {
- mir_sntprintf(tszError, SIZEOF(tszError), TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax);
+ mir_sntprintf(tszError, _countof(tszError), TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax);
SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
clearJob(iEntry);
return 0;
@@ -540,7 +540,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
SkinPlaySound("SendError");
TCHAR *szAckMsg = mir_a2t((char *)ack->lParam);
- mir_sntprintf(job.szErrorMsg, SIZEOF(job.szErrorMsg), TranslateT("Delivery failure: %s"), szAckMsg);
+ mir_sntprintf(job.szErrorMsg, _countof(job.szErrorMsg), TranslateT("Delivery failure: %s"), szAckMsg);
job.iStatus = SQ_ERROR;
mir_free(szAckMsg);
KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound);
@@ -678,11 +678,11 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
if (fIsSendLater) {
time_t now = time(0);
TCHAR tszTimestamp[30];
- _tcsftime(tszTimestamp, SIZEOF(tszTimestamp), _T("%Y.%m.%d - %H:%M"), _localtime32((__time32_t *)&now));
- mir_snprintf(szKeyName, SIZEOF(szKeyName), "S%d", now);
- mir_sntprintf(tszHeader, SIZEOF(tszHeader), TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
+ _tcsftime(tszTimestamp, _countof(tszTimestamp), _T("%Y.%m.%d - %H:%M"), _localtime32((__time32_t *)&now));
+ mir_snprintf(szKeyName, _countof(szKeyName), "S%d", now);
+ mir_sntprintf(tszHeader, _countof(tszHeader), TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
}
- else mir_sntprintf(tszHeader, SIZEOF(tszHeader), _T("M%d|"), time(0));
+ else mir_sntprintf(tszHeader, _countof(tszHeader), _T("M%d|"), time(0));
T2Utf utf_header(tszHeader);
size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp
index cd460b4856..448d1c4d30 100644
--- a/plugins/TabSRMM/src/srmm.cpp
+++ b/plugins/TabSRMM/src/srmm.cpp
@@ -108,7 +108,7 @@ int _DebugTraceW(const wchar_t *fmt, ...)
GetLocalTime(&st);
- mir_snprintf(tszTime, SIZEOF(tszTime), "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
+ mir_snprintf(tszTime, _countof(tszTime), "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
mir_vsntprintf(debug, ibsize - 10, fmt, va);
@@ -120,7 +120,7 @@ int _DebugTraceW(const wchar_t *fmt, ...)
FILE *f;
CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath);
- mir_snprintf(szLogFileName, SIZEOF(szLogFileName), "%s\\%s", szDataPath, "tabsrmm_debug.log");
+ mir_snprintf(szLogFileName, _countof(szLogFileName), "%s\\%s", szDataPath, "tabsrmm_debug.log");
f = fopen(szLogFileName, "a+");
if (f) {
fputs(tszTime, f);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 612a253363..90de38ad11 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -1350,7 +1350,7 @@ void TSAPI FreeTabConfig()
if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for (int i = 0; i < SIZEOF(PluginConfig.tabConfig.m_brushes); i++)
+ for (int i = 0; i < _countof(PluginConfig.tabConfig.m_brushes); i++)
if (PluginConfig.tabConfig.m_brushes[i])
DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index eec885a529..20b6ea883b 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -696,7 +696,7 @@ void CThumbBase::renderBase()
wchar_t tszTemp[30];
m_rcIcon.top += m_sz.cy;
- mir_sntprintf(tszTemp, SIZEOF(tszTemp), TranslateT("%d unread"), m_dat->dwUnread);
+ mir_sntprintf(tszTemp, _countof(tszTemp), TranslateT("%d unread"), m_dat->dwUnread);
CSkin::RenderText(m_hdc, m_dat->hTheme, tszTemp, &m_rcIcon, m_dtFlags | DT_CENTER | DT_WORD_ELLIPSIS, 10, 0, true);
}
m_rcIcon = m_rcTop;
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index 6ce18c405d..364f423795 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -254,7 +254,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TCHAR newTemplate[TEMPLATE_LENGTH + 2];
- GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, newTemplate, SIZEOF(newTemplate));
+ GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, newTemplate, _countof(newTemplate));
memcpy(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH);
teInfo->changed = FALSE;
teInfo->updateInfo[teInfo->inEdit] = FALSE;
@@ -363,7 +363,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->dwFlags = MWF_LOG_ALL;
dat->dwFlags = (teInfo->rtl ? dat->dwFlags | MWF_LOG_RTL : dat->dwFlags & ~MWF_LOG_RTL);
dat->dwFlags = (iIndex == 0 || iIndex == 1) ? dat->dwFlags & ~MWF_LOG_GROUPMODE : dat->dwFlags | MWF_LOG_GROUPMODE;
- mir_sntprintf(dat->szMyNickname, SIZEOF(dat->szMyNickname), _T("My Nickname"));
+ mir_sntprintf(dat->szMyNickname, _countof(dat->szMyNickname), _T("My Nickname"));
StreamInEvents(hwndDlg, 0, 1, 0, &dbei);
SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETSEL, -1, -1);
if (teInfo->changed)
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 4a5776ee46..c8636f7bf5 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -193,7 +193,7 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
WritePrivateProfileStringA(fontBlocks[n].szBLockname, "Valid", "1", szIniFilename);
for (i = 0; i < fontBlocks[n].iCount; i++) {
mir_snprintf(szTemp, "Font%d", firstIndex + i);
- mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
+ mir_snprintf(szAppname, _countof(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (!db_get_s(NULL, szModule, szTemp, &dbv)) {
WritePrivateProfileStringA(szAppname, "Face", dbv.pszVal, szIniFilename);
db_free(&dbv);
@@ -211,12 +211,12 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, TWindowData *dat)
}
def = SRMSGDEFSET_BKGCOLOUR;
- for (i = 0; i < SIZEOF(_extSettings); i++) {
+ for (i = 0; i < _countof(_extSettings); i++) {
auto &p = _extSettings[i];
WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
}
- for (i = 0; i < SIZEOF(_extSettings_v5); i++) {
+ for (i = 0; i < _countof(_extSettings_v5); i++) {
auto &p = _extSettings_v5[i];
WritePrivateProfileStringA(p.szIniSection, p.szIniName, _itoa(M.GetDword(p.szDbModule, p.szDbSetting, p.dwDef), szBuf, 10), szIniFilename);
}
@@ -276,7 +276,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
}
for (i = 0; i < fontBlocks[n].iCount; i++) {
mir_snprintf(szTemp, "Font%d", firstIndex + i);
- mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
+ mir_snprintf(szAppname, _countof(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) {
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT)
strncpy_s(szBuf, "Arial", _TRUNCATE);
@@ -309,13 +309,13 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
if (dwFlags & THEME_READ_FONTS) {
COLORREF defclr;
- for (i = 0; i < SIZEOF(_extSettings); i++) {
+ for (i = 0; i < _countof(_extSettings); i++) {
db_set_dw(0, _extSettings[i].szDbModule, _extSettings[i].szDbSetting,
GetPrivateProfileIntA(_extSettings[i].szIniSection, _extSettings[i].szIniName, _extSettings[i].dwDef, szIniFilename));
}
if (version >= 5) {
- for (i = 0; i < SIZEOF(_extSettings_v5); i++) {
+ for (i = 0; i < _countof(_extSettings_v5); i++) {
db_set_dw(0, _extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting,
GetPrivateProfileIntA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName, _extSettings_v5[i].dwDef, szIniFilename));
}
@@ -428,7 +428,7 @@ const TCHAR* TSAPI GetThemeFileName(int iMode)
szFilename[0] = 0;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s%c*.tabsrmm%c%c"), TranslateT("TabSRMM themes"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s%c*.tabsrmm%c%c"), TranslateT("TabSRMM themes"), 0, 0, 0);
ofn.lpstrFilter = filter;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = 0;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index e69da7e766..88bd0dc11b 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1212,7 +1212,7 @@ void CSkin::LoadIcon(const TCHAR *szSection, const TCHAR *name, HICON &hIcon)
TCHAR szDrive[MAX_PATH], szDir[MAX_PATH], szImagePath[MAX_PATH];
_tsplitpath(m_tszFileName, szDrive, szDir, NULL, NULL);
- mir_sntprintf(szImagePath, SIZEOF(szImagePath), _T("%s\\%s\\%s"), szDrive, szDir, buffer);
+ mir_sntprintf(szImagePath, _countof(szImagePath), _T("%s\\%s\\%s"), szDrive, szDir, buffer);
hIcon = (HICON)LoadImage(0, szImagePath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
}
else hIcon = NULL;
@@ -1241,12 +1241,12 @@ void CSkin::ReadItem(const int id, const TCHAR *szItem)
this_item->ALPHA = min(this_item->ALPHA, 100);
clr = RGB(GetBValue(defaults->COLOR), GetGValue(defaults->COLOR), GetRValue(defaults->COLOR));
- mir_sntprintf(def_color, SIZEOF(def_color), _T("%6.6x"), clr);
+ mir_sntprintf(def_color, _countof(def_color), _T("%6.6x"), clr);
GetPrivateProfileString(szItem, _T("Color1"), def_color, buffer, 400, m_tszFileName);
this_item->COLOR = HexStringToLong(buffer);
clr = RGB(GetBValue(defaults->COLOR2), GetGValue(defaults->COLOR2), GetRValue(defaults->COLOR2));
- mir_sntprintf(def_color, SIZEOF(def_color), _T("%6.6x"), clr);
+ mir_sntprintf(def_color, _countof(def_color), _T("%6.6x"), clr);
GetPrivateProfileString(szItem, _T("Color2"), def_color, buffer, 400, m_tszFileName);
this_item->COLOR2 = HexStringToLong(buffer);
@@ -1316,7 +1316,7 @@ void CSkin::ReadImageItem(const TCHAR *itemname)
// handle the assignments of image items to skin items
for (int n = 0;; n++) {
- mir_sntprintf(szItemNr, SIZEOF(szItemNr), _T("Item%d"), n);
+ mir_sntprintf(szItemNr, _countof(szItemNr), _T("Item%d"), n);
GetPrivateProfileString(itemname, szItemNr, _T("None"), buffer, 500, m_tszFileName);
if (!mir_tstrcmp(buffer, _T("None")))
break;
@@ -1481,7 +1481,7 @@ void CSkin::Load(void)
GetPrivateProfileString(_T("Theme"), _T("File"), _T("None"), buffer, MAX_PATH, m_tszFileName);
_tsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL);
- mir_sntprintf(szFinalName, SIZEOF(szFinalName), _T("%s\\%s\\%s"), szDrive, szPath, buffer);
+ mir_sntprintf(szFinalName, _countof(szFinalName), _T("%s\\%s\\%s"), szDrive, szPath, buffer);
if (PathFileExists(szFinalName)) {
ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M.GetByte("skin_loadmode", 0));
CacheLogFonts();
@@ -2450,7 +2450,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
m_fAeroSkinsValid = true;
- for (int i = 0; i < SIZEOF(my_default_skin); i++)
+ for (int i = 0; i < _countof(my_default_skin); i++)
if (!Utils::extractResource(g_hInst, my_default_skin[i].ulID, _T("SKIN_GLYPH"), tszBasePath, my_default_skin[i].tszName, fForceOverwrite))
m_fAeroSkinsValid = false;
}
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h
index 5246b619f7..be8986039b 100644
--- a/plugins/TabSRMM/src/themes.h
+++ b/plugins/TabSRMM/src/themes.h
@@ -151,7 +151,7 @@ public:
CImageItem(const TCHAR *szName)
{
memset(this, 0, sizeof(CImageItem));
- mir_sntprintf(m_szName, SIZEOF(m_szName), szName);
+ mir_sntprintf(m_szName, _countof(m_szName), szName);
m_szName[39] = 0;
}
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index 6cd62d5a68..98fdaf9c06 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -90,7 +90,7 @@ static void TrayAnimThread(LPVOID)
void TSAPI CreateTrayMenus(int mode)
{
if (mode) {
- mir_sntprintf(g_eventName, SIZEOF(g_eventName), _T("tsr_evt_%d"), GetCurrentThreadId());
+ mir_sntprintf(g_eventName, _countof(g_eventName), _T("tsr_evt_%d"), GetCurrentThreadId());
g_hEvent = CreateEvent(NULL, FALSE, FALSE, g_eventName);
isAnimThreadRunning = TRUE;
hTrayAnimThread = mir_forkthread(TrayAnimThread, NULL);
@@ -217,7 +217,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, con
PROTOACCOUNT *acc = Proto_GetAccount(szProto);
if (acc && acc->tszAccountName) {
mii.cbSize = sizeof(mii);
- mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s)"), acc->tszAccountName, szFinalNick, szStatus);
+ mir_sntprintf(szMenuEntry, _countof(szMenuEntry), _T("%s: %s (%s)"), acc->tszAccountName, szFinalNick, szStatus);
if (mode) {
if (hMenu == PluginConfig.g_hMenuRecent) {
if (CheckMenuItem(hMenu, (UINT_PTR)hContact, MF_BYCOMMAND | MF_UNCHECKED) == 0) {
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp
index 49a7a70c33..fe42c570b9 100644
--- a/plugins/TabSRMM/src/typingnotify.cpp
+++ b/plugins/TabSRMM/src/typingnotify.cpp
@@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
}
- for (i = 0; i < SIZEOF(colorPicker); i++) {
+ for (i = 0; i < _countof(colorPicker); i++) {
SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
}
@@ -260,7 +260,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
bEnableOthers = true;
}
- for (i = 0; i < SIZEOF(colorPicker); i++)
+ for (i = 0; i < _countof(colorPicker); i++)
Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
@@ -536,11 +536,11 @@ int TN_ModuleInit()
Timeout2 = M.GetByte(Module, SET_TIMEOUT2, DEF_TIMEOUT2);
if (!(M.GetDword(Module, colorPicker[0].desc, 1) && !M.GetDword(Module, colorPicker[0].desc, 0)))
- for (i = 0; i < SIZEOF(colorPicker); i++)
+ for (i = 0; i < _countof(colorPicker); i++)
colorPicker[i].color = M.GetDword(Module, colorPicker[i].desc, 0);
- mir_sntprintf(szStart, SIZEOF(szStart), TranslateT("...is typing a message."));
- mir_sntprintf(szStop, SIZEOF(szStop), TranslateT("...has stopped typing."));
+ mir_sntprintf(szStart, _countof(szStart), TranslateT("...is typing a message."));
+ mir_sntprintf(szStop, _countof(szStop), TranslateT("...has stopped typing."));
if (PluginConfig.g_bPopupAvail && ShowMenu) {
hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index e905fb0908..8bb8a41109 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -152,7 +152,7 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO
clr_found = true;
if (was_added) {
TCHAR wszTemp[100];
- mir_sntprintf(wszTemp, SIZEOF(wszTemp), _T("##col##%06u:%04u"), endmark - closing, ii);
+ mir_sntprintf(wszTemp, _countof(wszTemp), _T("##col##%06u:%04u"), endmark - closing, ii);
wszTemp[99] = 0;
message.insert(beginmark, wszTemp);
}
@@ -641,7 +641,7 @@ void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce
char szCname[50];
TContainerSettings csTemp = { 0 };
- mir_snprintf(szCname, SIZEOF(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
+ mir_snprintf(szCname, _countof(szCname), "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
Utils::ReadContainerSettingsFromDB(0, &csTemp, szCname);
if (csTemp.fPrivate || fForce) {
if (pContainer->settings == 0 || pContainer->settings == &PluginConfig.globalContainerSettings)
@@ -658,10 +658,10 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett
pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED);
if (pContainer->settings->fPrivate) {
- mir_snprintf(szCName, SIZEOF(szCName), "%s%d_Blob", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%d_Blob", szSetting, pContainer->iContainerIndex);
WriteContainerSettingsToDB(0, pContainer->settings, szCName);
}
- mir_snprintf(szCName, SIZEOF(szCName), "%s%d_theme", szSetting, pContainer->iContainerIndex);
+ mir_snprintf(szCName, _countof(szCName), "%s%d_theme", szSetting, pContainer->iContainerIndex);
if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
@@ -893,7 +893,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const TCHAR *tszNam
DWORD dwSize = SizeofResource(g_hInst, hRes), written = 0;
TCHAR szFilename[MAX_PATH];
- mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s%s"), tszPath, tszFilename);
+ mir_sntprintf(szFilename, _countof(szFilename), _T("%s%s"), tszPath, tszFilename);
if (!fForceOverwrite)
if (PathFileExists(szFilename))
return true;
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index 47a814109c..ddf1333b7b 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -100,8 +100,8 @@ bool LoadDS(DISPLAYSUBST *ds, int index)
if (db_get_ts(0, MODULE_ITEMS, setting, &dbv))
return false;
- _tcsncpy(ds->swzName, dbv.ptszVal, SIZEOF(ds->swzName));
- ds->swzName[SIZEOF(ds->swzName) - 1] = 0;
+ _tcsncpy(ds->swzName, dbv.ptszVal, _countof(ds->swzName));
+ ds->swzName[_countof(ds->swzName) - 1] = 0;
db_free(&dbv);
mir_snprintf(setting, "Type%d", index);
@@ -161,15 +161,15 @@ bool LoadDI(DISPLAYITEM *di, int index)
if (db_get_ts(0, MODULE_ITEMS, setting, &dbv))
return false;
- _tcsncpy(di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel));
- di->swzLabel[SIZEOF(di->swzLabel) - 1] = 0;
+ _tcsncpy(di->swzLabel, dbv.ptszVal, _countof(di->swzLabel));
+ di->swzLabel[_countof(di->swzLabel) - 1] = 0;
db_free(&dbv);
mir_snprintf(setting, "DIValue%d", index);
di->swzValue[0] = 0;
if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv)) {
- _tcsncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue));
- di->swzValue[SIZEOF(di->swzValue) - 1] = 0;
+ _tcsncpy(di->swzValue, dbv.ptszVal, _countof(di->swzValue));
+ di->swzValue[_countof(di->swzValue) - 1] = 0;
db_free(&dbv);
}
@@ -516,7 +516,7 @@ void LoadOptions()
}
else if (opt.skinMode == SM_IMAGE) {
if (!db_get_ts(NULL, MODULE, "SkinName", &dbv)) {
- _tcsncpy(opt.szSkinName, dbv.ptszVal, SIZEOF(opt.szSkinName) - 1);
+ _tcsncpy(opt.szSkinName, dbv.ptszVal, _countof(opt.szSkinName) - 1);
db_free(&dbv);
}
}
@@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel);
SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue);
- for (int i = 0; i < SIZEOF(displayItemTypes); i++) {
+ for (int i = 0; i < _countof(displayItemTypes); i++) {
int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(displayItemTypes[i].title));
SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type);
if (displayItemTypes[i].type == di->type)
@@ -573,7 +573,7 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0);
int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0);
- for (int i = 0; i < SIZEOF(displayItemTypes); i++) {
+ for (int i = 0; i < _countof(displayItemTypes); i++) {
if (displayItemTypes[i].type == type)
di->type = displayItemTypes[i].type;
}
@@ -709,10 +709,10 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ds->type = DVT_PROTODB;
else {
ds->type = DVT_DB;
- GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, SIZEOF(ds->szModuleName));
+ GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, _countof(ds->szModuleName));
}
- GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, SIZEOF(ds->szSettingName));
+ GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, _countof(ds->szSettingName));
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETCURSEL, 0, 0);
ds->iTranslateFuncId = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, sel, 0);
@@ -767,7 +767,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- for (int i = 0; i < SIZEOF(btns); i++) {
+ for (int i = 0; i < _countof(btns); i++) {
SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, btns[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(btns[i].swzTooltip), BATF_TCHAR);
if (btns[i].uintCoreIconId)
@@ -994,7 +994,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
item.stateMask = TVIS_STATEIMAGEMASK;
item.hItem = hItem;
item.pszText = buff;
- item.cchTextMax = SIZEOF(buff);
+ item.cchTextMax = _countof(buff);
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
tmpParam = item.lParam;
tmpState = item.state;
@@ -1461,7 +1461,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvi.item.stateMask = TVIS_STATEIMAGEMASK;
- for (int i = 0; i < SIZEOF(extraIconName); i++) {
+ for (int i = 0; i < _countof(extraIconName); i++) {
tvi.item.lParam = (LPARAM)&exIcons[i];
tvi.item.pszText = TranslateTS(extraIconName[exIcons[i].order]);
tvi.item.state = INDEXTOSTATEIMAGEMASK(exIcons[i].vis ? 2 : 1);
@@ -1517,8 +1517,8 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem);
i++;
}
- db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, SIZEOF(opt.exIconsOrder));
- db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, SIZEOF(opt.exIconsVis));
+ db_set_blob(NULL, MODULE, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder));
+ db_set_blob(NULL, MODULE, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis));
opt.iSmileyAddFlags = 0;
opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0)
@@ -1647,7 +1647,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.pszText = swzName;
- tvis.item.cchTextMax = SIZEOF(swzName);
+ tvis.item.cchTextMax = _countof(swzName);
tvis.item.hItem = dat->hDragItem;
tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item);
@@ -1979,7 +1979,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
}
- for (i = 0; i < SIZEOF(trayTipItems); i++) {
+ for (i = 0; i < _countof(trayTipItems); i++) {
tvi.item.pszText = TranslateTS(trayTipItems[i]);
tvi.item.state = INDEXTOSTATEIMAGEMASK(opt.iFirstItems & (1 << i) ? 2 : 1);
TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &tvi);
@@ -2036,7 +2036,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
TVITEM item;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS));
item.pszText = buff;
- item.cchTextMax = SIZEOF(buff);
+ item.cchTextMax = _countof(buff);
item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK;
while (item.hItem != NULL) {
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp
index 0423e7e0ee..1f63f93768 100644
--- a/plugins/TipperYM/src/popwin.cpp
+++ b/plugins/TipperYM/src/popwin.cpp
@@ -78,7 +78,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN);
if (Proto_IsAccountLocked(pa))
- mir_sntprintf(pwd->swzTitle, SIZEOF(pwd->swzTitle), TranslateT("%s (locked)"), pwd->swzTitle);
+ mir_sntprintf(pwd->swzTitle, _countof(pwd->swzTitle), TranslateT("%s (locked)"), pwd->swzTitle);
// protocol status
WORD wStatus = (WORD)CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0);
@@ -106,7 +106,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
TCHAR swzLogon[64];
if (TimestampToTimeDifference(NULL, pwd->clcit.szProto, "LogonTS", swzLogon, 59)) {
TCHAR ago[96];
- mir_sntprintf(ago, SIZEOF(ago), TranslateT("%s ago"), swzLogon);
+ mir_sntprintf(ago, _countof(ago), TranslateT("%s ago"), swzLogon);
AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false);
}
@@ -1500,7 +1500,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
mir_tstrcpy(swzProto, pa->tszAccountName);
if (dwItems & TRAYTIP_LOCKSTATUS)
if (Proto_IsAccountLocked(pa))
- mir_sntprintf(swzProto, SIZEOF(swzProto), TranslateT("%s (locked)"), pa->tszAccountName);
+ mir_sntprintf(swzProto, _countof(swzProto), TranslateT("%s (locked)"), pa->tszAccountName);
AddRow(pwd, swzProto, buff, NULL, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus));
bFirstItem = false;
@@ -1508,7 +1508,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (dwItems & TRAYTIP_LOGON) {
if (TimestampToTimeDifference(NULL, pa->szModuleName, "LogonTS", buff, 59)) {
TCHAR ago[96];
- mir_sntprintf(ago, SIZEOF(ago), TranslateT("%s ago"), buff);
+ mir_sntprintf(ago, _countof(ago), TranslateT("%s ago"), buff);
AddRow(pwd, TranslateT("Log on:"), ago, NULL, false, false, false);
}
}
@@ -1629,7 +1629,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) {
TCHAR *swzProto = a2t(proto);
- mir_sntprintf(swzName, SIZEOF(swzName), _T("%s (%s)"), swzNick, swzProto);
+ mir_sntprintf(swzName, _countof(swzName), _T("%s (%s)"), swzNick, swzProto);
mir_free(swzProto);
}
else mir_tstrcpy(swzName, swzNick);
diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp
index d4335c6cfb..fc93fe0b79 100644
--- a/plugins/TipperYM/src/skin_parser.cpp
+++ b/plugins/TipperYM/src/skin_parser.cpp
@@ -88,7 +88,7 @@ void ParseAboutPart(FILE *fp, TCHAR *buff, TCHAR *szSkinName)
else if (_tcsstr(buff, _T("preview")))
{
TCHAR szImgPath[1024];
- mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, szSkinName, pch);
+ mir_sntprintf(szImgPath, _countof(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, szSkinName, pch);
if (FileExists(szImgPath))
mir_tstrcpy(opt.szPreviewFile, szImgPath);
}
@@ -126,7 +126,7 @@ void ParseImagePart(FILE *fp, TCHAR *buff, int iPart)
if (_tcsstr(buff, _T("image")))
{
TCHAR szImgPath[1024];
- mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, opt.szSkinName, pch);
+ mir_sntprintf(szImgPath, _countof(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, opt.szSkinName, pch);
opt.szImgFile[iPart] = mir_tstrdup(szImgPath);
}
else if (_tcsstr(buff, _T("tm")))
diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp
index bc94a4a38c..4a60c6bc94 100644
--- a/plugins/TipperYM/src/tipper.cpp
+++ b/plugins/TipperYM/src/tipper.cpp
@@ -117,7 +117,7 @@ int EventDeleted(WPARAM wParam, LPARAM lParam)
int ReloadSkinFolder(WPARAM wParam, LPARAM lParam)
{
- FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));
return 0;
}
@@ -255,7 +255,7 @@ int ModulesLoaded(WPARAM, LPARAM)
hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);
hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Tipper"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER));
- FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));
InitTipperSmileys();
LoadOptions();
diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp
index e492d4bbf8..d888abc7a0 100644
--- a/plugins/TipperYM/src/translations.cpp
+++ b/plugins/TipperYM/src/translations.cpp
@@ -233,21 +233,21 @@ TCHAR *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const cha
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", prefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", prefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", prefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", prefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", prefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", prefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -281,21 +281,21 @@ TCHAR *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", szPrefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -330,21 +330,21 @@ TCHAR *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, co
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sSeconds", szPrefix);
int seconds = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -374,14 +374,14 @@ TCHAR *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const cha
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -410,42 +410,42 @@ TCHAR *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const ch
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &month))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sYear", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sYear", szPrefix);
int year = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &year))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sHours", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sHours", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int hours = 0;
if (GetInt(dbv, &hours))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMinutes", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMinutes", szPrefix);
int minutes = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
if (GetInt(dbv, &minutes))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sSeconds", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sSeconds", szPrefix);
int seconds = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -512,14 +512,14 @@ TCHAR *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName,
{
DBVARIANT dbv;
char szSettingName[256];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sDay", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sDay", szPrefix);
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
int day = 0;
if (GetInt(dbv, &day))
{
db_free(&dbv);
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sMonth", szPrefix);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%sMonth", szPrefix);
int month = 0;
if (!db_get(hContact, szModuleName, szSettingName, &dbv))
{
@@ -657,7 +657,7 @@ TCHAR *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *s
int iLang = db_get_b(hContact, szModuleName, szSettingName, 0);
if (iLang)
{
- for (int i = 0; i < SIZEOF(languages); i++)
+ for (int i = 0; i < _countof(languages); i++)
{
if (iLang == languages[i].id)
{
@@ -711,7 +711,7 @@ static DBVTranslation internalTranslations[] =
void InitTranslations()
{
dwNextFuncId = db_get_dw(0, MODULE_ITEMS, "NextFuncId", 1);
- for (int i = 0; i < SIZEOF(internalTranslations); i++)
+ for (int i = 0; i < _countof(internalTranslations); i++)
AddTranslation(&internalTranslations[i]);
hServiceAdd = CreateServiceFunction(MS_TIPPER_ADDTRANSLATION, ServiceAddTranslation);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index aec54e4156..649d9c07ef 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -73,32 +73,32 @@ CTooltipNotify::~CTooltipNotify()
void CTooltipNotify::RegisterFonts()
{
FontIDT fontId = { sizeof(fontId) };
- _tcsncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-1);
- strncpy(fontId.dbSettingsGroup, MODULENAME, SIZEOF(fontId.dbSettingsGroup)-1);
+ _tcsncpy(fontId.group, FONTSERV_GROUP, _countof(fontId.group)-1);
+ strncpy(fontId.dbSettingsGroup, MODULENAME, _countof(fontId.dbSettingsGroup)-1);
fontId.flags = FIDF_DEFAULTVALID;
fontId.deffontsettings.colour = DEF_SETTING_TXTCOLOR;
fontId.deffontsettings.size = -MulDiv(DEF_SETTING_FONT_SIZE, DEF_LOGPIXELSY, 72);
fontId.deffontsettings.style = DEF_SETTING_FONT_STYLE;
fontId.deffontsettings.charset = DEF_SETTING_FONT_CHARSET;
- _tcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, SIZEOF(fontId.deffontsettings.szFace)-1);
+ _tcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, _countof(fontId.deffontsettings.szFace)-1);
fontId.order = 0;
- _tcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, SIZEOF(fontId.backgroundGroup)-1);
+ _tcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, _countof(fontId.backgroundGroup)-1);
ColourIDT colorId = { sizeof(colorId) };
- _tcsncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-1);
- strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1);
+ _tcsncpy(colorId.group, FONTSERV_GROUP, _countof(colorId.group)-1);
+ strncpy(colorId.dbSettingsGroup, MODULENAME, _countof(colorId.dbSettingsGroup)-1);
colorId.flags = 0;
colorId.defcolour = DEF_SETTING_BGCOLOR;
colorId.order = 0;
- for (int i=0; i<SIZEOF(s_fontTable); i++) {
- _tcsncpy(fontId.name, s_fontTable[i].name, SIZEOF(fontId.name)-1);
- strncpy(fontId.prefix, s_fontTable[i].fontPrefix, SIZEOF(fontId.prefix)-1);
- _tcsncpy(fontId.backgroundName, s_fontTable[i].name, SIZEOF(fontId.backgroundName)-1);
+ for (int i=0; i<_countof(s_fontTable); i++) {
+ _tcsncpy(fontId.name, s_fontTable[i].name, _countof(fontId.name)-1);
+ strncpy(fontId.prefix, s_fontTable[i].fontPrefix, _countof(fontId.prefix)-1);
+ _tcsncpy(fontId.backgroundName, s_fontTable[i].name, _countof(fontId.backgroundName)-1);
::FontRegisterT(&fontId);
- _tcsncpy(colorId.name, s_fontTable[i].name, SIZEOF(colorId.name)-1);
- strncpy(colorId.setting, s_fontTable[i].clrPrefix, SIZEOF(colorId.setting)-1);
+ _tcsncpy(colorId.name, s_fontTable[i].name, _countof(colorId.name)-1);
+ strncpy(colorId.setting, s_fontTable[i].clrPrefix, _countof(colorId.setting)-1);
::ColourRegisterT(&colorId);
}
}
@@ -106,7 +106,7 @@ void CTooltipNotify::RegisterFonts()
void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg)
{
TCHAR* fontName = 0;
- for(int i=0; i<SIZEOF(s_fontTable); i++)
+ for(int i=0; i<_countof(s_fontTable); i++)
{
if (s_fontTable[i].status == iStatus)
{
@@ -115,15 +115,15 @@ void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF*
}
if (fontName == 0)
{
- fontName = s_fontTable[SIZEOF(s_fontTable)-1].name;
+ fontName = s_fontTable[_countof(s_fontTable)-1].name;
}
// name and group only
FontIDT fontId = { sizeof(fontId), FONTSERV_GROUP, 0 };
- _tcsncpy(fontId.name, fontName,SIZEOF(fontId.name)-1);
+ _tcsncpy(fontId.name, fontName,_countof(fontId.name)-1);
*text = (COLORREF)::CallService(MS_FONT_GETT, (WPARAM)&fontId, (LPARAM)lf);
ColourIDT colorId = { sizeof(colorId), FONTSERV_GROUP, 0 };
- _tcsncpy(colorId.name, fontName,SIZEOF(colorId.name)-1);
+ _tcsncpy(colorId.name, fontName,_countof(colorId.name)-1);
*bg = (COLORREF)::CallService(MS_COLOUR_GETT, (WPARAM)&colorId, 0);
}
@@ -414,7 +414,7 @@ static arSettings[] =
void CTooltipNotify::MigrateSettings()
{
- for (int i=0; i < SIZEOF(arSettings); i++) {
+ for (int i=0; i < _countof(arSettings); i++) {
int val = db_get_w(NULL, MODULENAME, arSettings[i].szOldSetting, -1);
if (val != -1) {
db_set_w(NULL, MODULENAME, arSettings[i].szNewSetting, val);
@@ -559,7 +559,7 @@ BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
case WM_HSCROLL:
{
TCHAR str[10];
- mir_sntprintf(str, SIZEOF(str), _T("%d%%"), 100 * SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0) / 255);
+ mir_sntprintf(str, _countof(str), _T("%d%%"), 100 * SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0) / 255);
SetDlgItemText(hDlg, IDC_TRANSPERC, str);
if(wParam!=0x12345678) SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
return TRUE;
@@ -694,7 +694,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
WCHAR wszProto[128];
long lLen = MultiByteToWideChar(CP_ACP, 0, ppProtos[i]->szModuleName,
- (int)mir_strlen(ppProtos[i]->szModuleName), wszProto, SIZEOF(wszProto));
+ (int)mir_strlen(ppProtos[i]->szModuleName), wszProto, _countof(wszProto));
wszProto[lLen] = L'\0';
lvi.pszText = wszProto;
@@ -720,7 +720,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
{
TCHAR szProto[64];
- ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, SIZEOF(szProto));
+ ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, _countof(szProto));
char szMultiByteProto[128];
long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_tstrlen(szProto),
@@ -897,7 +897,7 @@ TCHAR *CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize
TCHAR *CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR *szString, int iBufSize)
{
TCHAR szStatus[32];
- StatusToString(iStatus, szStatus, SIZEOF(szStatus));
+ StatusToString(iStatus, szStatus, _countof(szStatus));
// "proro: user is online"
const TCHAR *szFormatString = m_sOptions.bPrefixProto ? _T("%s%s%s") : _T("%.0s%.0s%s");
@@ -912,7 +912,7 @@ TCHAR *CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR *
WCHAR wszProto[32];
- long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)mir_strlen(szProto), wszProto, SIZEOF(wszProto));
+ long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)mir_strlen(szProto), wszProto, _countof(wszProto));
wszProto[lLen] = _T('\0');
mir_sntprintf(szString, iBufSize - 1, szFormatString, wszProto, _T(": "), szContactName);
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp
index b7f5c8995f..fb7566729d 100644
--- a/plugins/TopToolBar/src/InternalButtons.cpp
+++ b/plugins/TopToolBar/src/InternalButtons.cpp
@@ -114,7 +114,7 @@ void InitInternalButtons()
CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt);
CreateServiceFunction(TTBI_SHOWHIDEOFFLINE, TTBInternalShowHideOffline);
- for (int i = 0; i < SIZEOF(stdButtons); i++) {
+ for (int i = 0; i < _countof(stdButtons); i++) {
TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
ttb.name = stdButtons[i].name;
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp
index 6f890d59aa..ec2eab562b 100644
--- a/plugins/TopToolBar/src/ttbopt.cpp
+++ b/plugins/TopToolBar/src/ttbopt.cpp
@@ -241,14 +241,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
- GetDlgItemText(hwndDlg, IDC_EPATH, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_EPATH, str, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("exe");
if (!GetOpenFileName(&ofn))
@@ -290,14 +290,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TreeView_SetItem(hTree, &tvi);
}
- GetDlgItemText(hwndDlg, IDC_ENAME, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_ENAME, buf, _countof(buf));
replaceStr(btn->pszName, _T2A(buf));
tvi.mask = TVIF_TEXT;
tvi.pszText = buf;
TreeView_SetItem(hTree, &tvi);
- GetDlgItemText(hwndDlg, IDC_EPATH, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_EPATH, buf, _countof(buf));
replaceStrT(btn->ptszProgram, buf);
}
break;
@@ -515,7 +515,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = name;
- tvis.item.cchTextMax = SIZEOF(name);
+ tvis.item.cchTextMax = _countof(name);
tvis.item.hItem = dat->hDragItem;
TreeView_GetItem(hTree, &tvis.item);
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp
index 7c54e5f271..5fff652c5f 100644
--- a/plugins/TrafficCounter/src/TrafficCounter.cpp
+++ b/plugins/TrafficCounter/src/TrafficCounter.cpp
@@ -214,7 +214,7 @@ int TrafficCounterModulesLoaded(WPARAM wParam, LPARAM lParam)
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0)
{
if(mir_tstrlen(dbv.ptszVal) > 0)
- mir_tstrncpy(Traffic_CounterFormat, dbv.ptszVal, SIZEOF(Traffic_CounterFormat));
+ mir_tstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
//
db_free(&dbv);
}
@@ -232,7 +232,7 @@ int TrafficCounterModulesLoaded(WPARAM wParam, LPARAM lParam)
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0)
{
if(mir_tstrlen(dbv.ptszVal) > 0)
- mir_tstrncpy(Traffic_TooltipFormat, dbv.ptszVal, SIZEOF(Traffic_TooltipFormat));
+ mir_tstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
//
db_free(&dbv);
}
@@ -1138,7 +1138,7 @@ void NotifyOnSend(void)
ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
_tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME);
//
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d kilobytes sent"),
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), TranslateT("%d kilobytes sent"),
notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
//
ppd.colorBack = Traffic_PopupBkColor;
@@ -1157,7 +1157,7 @@ void NotifyOnRecv(void)
ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
_tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"),MAX_CONTACTNAME);
//
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d kilobytes received"),
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), TranslateT("%d kilobytes received"),
notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
//
ppd.colorBack = Traffic_PopupBkColor;
diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp
index fa304ad0de..2febe16560 100644
--- a/plugins/TrafficCounter/src/misc.cpp
+++ b/plugins/TrafficCounter/src/misc.cpp
@@ -153,7 +153,7 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size)
return 0;
}
- mir_sntprintf(Str1, SIZEOF(Str1), _T("%d.%d"), Value / Divider, Value % Divider);
+ mir_sntprintf(Str1, _countof(Str1), _T("%d.%d"), Value / Divider, Value % Divider);
size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0);
if (!l) return 0;
l += mir_tstrlen(szUnit) + 1;
@@ -210,49 +210,49 @@ size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Siz
if (!mir_tstrcmp(Token, _T("d")))
{
q = Duration / (60 * 60 * 24);
- mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%d"), q);
Duration -= q * 60 * 60 * 24;
}
else
if (!mir_tstrcmp(Token, _T("h")))
{
q = Duration / (60 * 60);
- mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%d"), q);
Duration -= q * 60 * 60;
}
else
if (!mir_tstrcmp(Token, _T("hh")))
{
q = Duration / (60 * 60);
- mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%02d"), q);
Duration -= q * 60 * 60;
}
else
if (!mir_tstrcmp(Token, _T("m")))
{
q = Duration / 60;
- mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%d"), q);
Duration -= q * 60;
}
else
if (!mir_tstrcmp(Token, _T("mm")))
{
q = Duration / 60;
- mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%02d"), q);
Duration -= q * 60;
}
else
if (!mir_tstrcmp(Token, _T("s")))
{
q = Duration;
- mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%d"), q);
Duration -= q;
}
else
if (!mir_tstrcmp(Token, _T("ss")))
{
q = Duration;
- mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q);
+ mir_sntprintf(Token, _countof(Token), _T("%02d"), q);
Duration -= q;
}
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp
index 127b89e4c1..f3a74a2dcd 100644
--- a/plugins/TrafficCounter/src/options.cpp
+++ b/plugins/TrafficCounter/src/options.cpp
@@ -182,7 +182,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!Initialized) {
pOptions = options;
- optionCount = SIZEOF(options);
+ optionCount = _countof(options);
// Åñëè íåò Variables, àêòèâèðóåì ãàëî÷êè äëÿ ñòàðîãî ìåòîäà ðèñîâàíèÿ
if (!bVariablesExists)
for (i = 0; i < 8; i++)
@@ -310,9 +310,9 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
unOptions.ShowOverall = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowOverall");
// Ôîðìàò ñ÷¸ò÷èêîâ
- GetDlgItemText(hwndDlg, IDC_EDIT_COUNTER_FORMAT, Traffic_CounterFormat, SIZEOF(Traffic_CounterFormat));
+ GetDlgItemText(hwndDlg, IDC_EDIT_COUNTER_FORMAT, Traffic_CounterFormat, _countof(Traffic_CounterFormat));
// Ôîðìàò âñïëûâàþùåé ïîäñêàçêè
- GetDlgItemText(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT, Traffic_TooltipFormat, SIZEOF(Traffic_TooltipFormat));
+ GetDlgItemText(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT, Traffic_TooltipFormat, _countof(Traffic_TooltipFormat));
// Êëþ÷åâîé öâåò
UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1);
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp
index 792b0022ef..846e9fef93 100644
--- a/plugins/TrafficCounter/src/opttree.cpp
+++ b/plugins/TrafficCounter/src/opttree.cpp
@@ -34,7 +34,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem)
tvi.mask = TVIF_HANDLE|TVIF_TEXT;
tvi.hItem = hItem;
tvi.pszText = buf;
- tvi.cchTextMax = SIZEOF(buf);
+ tvi.cchTextMax = _countof(buf);
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
// Ïðîâåðèì, íàäî ëè ïåðåâîäèòü.
if ((tvi.lParam != -1) && (pOptions[tvi.lParam].dwFlag & OPTTREE_NOTRANSLATE)) return;
@@ -87,7 +87,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = SIZEOF(str);
+ tvi.cchTextMax = _countof(str);
while (tvi.hItem)
{
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp
index 52c64c4e7f..bd5a5ff6d2 100644
--- a/plugins/TrafficCounter/src/statistics.cpp
+++ b/plugins/TrafficCounter/src/statistics.cpp
@@ -319,7 +319,7 @@ void Stat_ReadFile(BYTE n)
pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\statistics"));
CreateDirectoryTreeT(pszPath);
- mir_sntprintf(FileName, SIZEOF(FileName), _T("%s\\%S.stat"), pszPath, ProtoList[n].name);
+ mir_sntprintf(FileName, _countof(FileName), _T("%s\\%S.stat"), pszPath, ProtoList[n].name);
mir_free(pszPath);
GetLocalTime(&stNow);
ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp
index cb0a760f49..d063b4b3ad 100644
--- a/plugins/TranslitSwitcher/src/Layoutproc.cpp
+++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp
@@ -375,7 +375,7 @@ void SwitchLayout(bool lastword)
return;
TCHAR szClassName[MAX_PATH];
- GetClassName(hwnd2, szClassName, SIZEOF(szClassName));
+ GetClassName(hwnd2, szClassName, _countof(szClassName));
if ((mir_tstrcmp(szClassName, _T("THppRichEdit.UnicodeClass")) == 0 || mir_tstrcmp(szClassName, _T("THistoryGrid.UnicodeClass")) == 0 || mir_tstrcmp(szClassName, _T("TExtHistoryGrid.UnicodeClass")) == 0 || mir_tstrcmp(szClassName, _T("Internet Explorer_Server")) == 0) && ServiceExists(MS_POPUP_SHOWMESSAGE)) { // make popup here
TCHAR buf[2048];
if (mir_tstrcmp(szClassName, _T("Internet Explorer_Server")) == 0) {
@@ -388,9 +388,9 @@ void SwitchLayout(bool lastword)
event.iType = IEE_GET_SELECTION;
event.hwnd = hwnd3;
TCHAR *selected = (TCHAR *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- mir_tstrncpy(buf, selected, SIZEOF(buf));
+ mir_tstrncpy(buf, selected, _countof(buf));
}
- else GetWindowText(hwnd2, buf, SIZEOF(buf)); // gimme, gimme, gimme...
+ else GetWindowText(hwnd2, buf, _countof(buf)); // gimme, gimme, gimme...
size_t slen = mir_tstrlen(buf);
if (slen != 0) {
@@ -429,8 +429,8 @@ void SwitchLayout(bool lastword)
POPUPDATAT pd = { 0 };
pd.lchIcon = IcoLib_GetIcon("Switch Layout and Send");
- mir_tstrncpy(pd.lptzText, buf, SIZEOF(pd.lptzText));
- mir_tstrncpy(pd.lptzContactName, TranslateT("TranslitSwitcher"), SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, buf, _countof(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, TranslateT("TranslitSwitcher"), _countof(pd.lptzContactName));
PUAddPopupT(&pd);
}
}
@@ -514,7 +514,7 @@ void TranslitLayout(bool lastword)
return;
TCHAR szClassName[16];
- GetClassName(hwnd2, szClassName, SIZEOF(szClassName));
+ GetClassName(hwnd2, szClassName, _countof(szClassName));
if (mir_tstrcmpi(szClassName, _T("RichEdit50W")) != 0)
return;
@@ -582,7 +582,7 @@ void InvertCase(bool lastword)
TCHAR szClassName[16];
- GetClassName(hwnd2, szClassName, SIZEOF(szClassName));
+ GetClassName(hwnd2, szClassName, _countof(szClassName));
if (mir_tstrcmpi(szClassName, _T("RichEdit50W")) != 0)
return;
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
index 4c4498dd90..6bbb673832 100644
--- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
+++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp
@@ -81,7 +81,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
{
HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
if (ServiceExists(MS_BB_ADDBUTTON)) {
- Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, SIZEOF(iconList));
+ Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, _countof(iconList));
BBButton bbd = { 0 };
bbd.cbSize = sizeof(BBButton);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 31251d0c20..e8cd5ab68b 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -220,7 +220,7 @@ void SvcFlagsLoadModule()
langid = 1;
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (langid == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", langid); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (langid == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", langid); /* buffer safe */
hExtraIconSvc = ExtraIcon_Register("Flags", LPGEN("Flags (uinfoex)"), szId);
}
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
index efb5c18697..9710ee4f73 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
@@ -102,13 +102,13 @@ static int CountryNumberToBitmapIndex(int countryNumber)
/* binary search in index array */
if (countryNumber > 0) {
int i,high/*,low=0*/;
- high=SIZEOF(BitmapIndexMap);
+ high=_countof(BitmapIndexMap);
/*old code need sortet BitmapIndexMap*/
/*if (countryNumber<=BitmapIndexMap[high])
while(low<=high) {
i=low+((high-low)/2);
// never happens
- if (i<0 || i>=SIZEOF(BitmapIndexMap)) DebugBreak();
+ if (i<0 || i>=_countof(BitmapIndexMap)) DebugBreak();
if (BitmapIndexMap[i]==countryNumber) return i;
if (countryNumber>BitmapIndexMap[i]) low=i+1;
else high=i-1;
@@ -133,7 +133,7 @@ HICON LoadFlag(int countryNumber)
szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0);
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", countryNumber); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", countryNumber); /* buffer safe */
return IcoLib_GetIcon(szId);
}
@@ -255,7 +255,7 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam)
memset(&aptTriangle, 0, sizeof(aptTriangle));
aptTriangle[1].y=bm.bmHeight-1;
aptTriangle[2].x=bm.bmWidth-1;
- HRGN hrgn=CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
+ HRGN hrgn=CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING);
if (hrgn!=NULL) {
SelectClipRgn(hdc,hrgn);
HBITMAP hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor);
@@ -397,7 +397,7 @@ void InitIcons()
for (int i=0; i < nCountriesCount; i++) {
sid.description.t = mir_a2t(LPGEN(countries[i].szName));
/* create identifier */
- mir_snprintf(szId, SIZEOF(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
/* create icon */
sid.hDefaultIcon = ImageList_ExtractIcon(NULL, himl, index);
@@ -421,7 +421,7 @@ void UninitIcons()
for(int i=0;i<nCountriesCount;++i) {
/* create identifier */
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */
IcoLib_RemoveIcon(szId);
}
mir_free(phIconHandles); /* does NULL check */
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index c3a8cee0a6..6515cb28a5 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -270,10 +270,10 @@ int MAnnivDate::DBGetReminderOpts(MCONTACT hContact)
char pszSetting[MAXSETTING];
// read reminder option
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dReminder", _wID);
_bRemind = db_get_b(hContact, Module(), pszSetting, BST_INDETERMINATE);
// read offset
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dOffset", _wID);
_wDaysEarlier = db_get_w(hContact, Module(), pszSetting, (WORD)-1);
}
else {
@@ -309,14 +309,14 @@ int MAnnivDate::DBWriteReminderOpts(MCONTACT hContact)
else if (_wID <= ANID_LAST) {
char pszSetting[MAXSETTING];
// read reminder option
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dReminder", _wID);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dReminder", _wID);
if (_bRemind == BST_INDETERMINATE)
db_unset(hContact, USERINFO, pszSetting);
else
db_set_b(hContact, USERINFO, pszSetting, _bRemind);
// read offset
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dOffset", _wID);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dOffset", _wID);
if (_wDaysEarlier == (WORD)-1)
db_unset(hContact, USERINFO, pszSetting);
else
@@ -626,7 +626,7 @@ int MAnnivDate::DBGetAnniversaryDate(MCONTACT hContact, WORD iIndex)
// read date and convert older versions
CHAR szStamp[MAXSETTING];
- mir_snprintf(szStamp, SIZEOF(szStamp), "Anniv%dDate", iIndex);
+ mir_snprintf(szStamp, _countof(szStamp), "Anniv%dDate", iIndex);
int rc = DBGetDateStamp(hContact, USERINFO, szStamp);
if (!rc) {
_strModule = USERINFO;
@@ -634,7 +634,7 @@ int MAnnivDate::DBGetAnniversaryDate(MCONTACT hContact, WORD iIndex)
_wID = iIndex;
// read description
- mir_snprintf(szStamp, SIZEOF(szStamp), "Anniv%dDesc", iIndex);
+ mir_snprintf(szStamp, _countof(szStamp), "Anniv%dDesc", iIndex);
DBVARIANT dbv;
if (!DB::Setting::GetTString(hContact, USERINFO, szStamp, &dbv)) {
_strDesc = dbv.ptszVal;
@@ -659,10 +659,10 @@ int MAnnivDate::DBWriteAnniversaryDate(MCONTACT hContact, WORD wIndex)
_wID = wIndex;
CHAR pszSetting[MAXSETTING];
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dDate", wIndex);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dDate", wIndex);
if (!DBWriteDateStamp(hContact, USERINFO, pszSetting)) {
// write description
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "Anniv%dDesc", wIndex);
+ mir_snprintf(pszSetting, _countof(pszSetting), "Anniv%dDesc", wIndex);
db_set_ts(hContact, USERINFO, pszSetting, (LPTSTR)Description());
return 0;
}
@@ -683,10 +683,10 @@ static WORD AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *p
TCHAR szDate[MAX_PATH];
TCHAR szoldDate[MAX_PATH];
- pOldCustomDate->DateFormat(szoldDate, SIZEOF(szoldDate));
- pNewProtoDate->DateFormat(szDate, SIZEOF(szDate));
+ pOldCustomDate->DateFormat(szoldDate, _countof(szoldDate));
+ pNewProtoDate->DateFormat(szDate, _countof(szDate));
- mir_sntprintf(szMsg, SIZEOF(szMsg),
+ mir_sntprintf(szMsg, _countof(szMsg),
TranslateT("%s provides a new birthday via protocol.\nIt is %s. The old one was %s.\n\nDo you want to use this as the new birthday for this contact?"),
DB::Contact::DisplayName(hContact), szDate, szoldDate);
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index f5d6d28d63..7a11d5ca3f 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -88,7 +88,7 @@ CPsTreeItem::~CPsTreeItem()
LPCSTR CPsTreeItem::PropertyKey(LPCSTR pszProperty)
{
static CHAR pszSetting[MAXSETTING];
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "{%s\\%s}_%s", _pszPrefix, _pszName, pszProperty);
+ mir_snprintf(pszSetting, _countof(pszSetting), "{%s\\%s}_%s", _pszPrefix, _pszName, pszProperty);
return pszSetting;
}
@@ -121,7 +121,7 @@ LPCSTR CPsTreeItem::GlobalName()
LPCSTR CPsTreeItem::GlobalPropertyKey(LPCSTR pszProperty)
{
static CHAR pszSetting[MAXSETTING];
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "{Global\\%s}_%s", GlobalName(), pszProperty);
+ mir_snprintf(pszSetting, _countof(pszSetting), "{Global\\%s}_%s", GlobalName(), pszProperty);
return pszSetting;
}
@@ -138,7 +138,7 @@ LPCSTR CPsTreeItem::IconKey()
if (pszIconName)
{
static CHAR pszSetting[MAXSETTING];
- mir_snprintf(pszSetting, SIZEOF(pszSetting), MODNAME"_{%s}", pszIconName);
+ mir_snprintf(pszSetting, _countof(pszSetting), MODNAME"_{%s}", pszIconName);
return pszSetting;
}
return NULL;
@@ -283,7 +283,7 @@ HICON CPsTreeItem::ProtoIcon()
for (int i = 0; i < ProtoCount; i++) {
if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) {
CHAR szIconID[MAX_PATH];
- mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName);
+ mir_snprintf(szIconID, _countof(szIconID), "core_status_%s1", pa[i]->szModuleName);
HICON hIco = IcoLib_GetIcon(szIconID);
if (!hIco)
hIco = (HICON)CallProtoService(pa[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL, NULL);
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
index 162f8f83e9..cf8a7ef0d7 100644
--- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp
@@ -364,10 +364,10 @@ INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(MCONTACT hContact)
}
// delete reluctant items
do {
- ofs = mir_snprintf(szSet0, SIZEOF(szSet0), "Anniv%d", wIndex);
+ ofs = mir_snprintf(szSet0, _countof(szSet0), "Anniv%d", wIndex);
ret = 1;
- for (i = 0; i < SIZEOF(szPrefix); i++) {
- mir_strncpy(szSet0 + ofs, szPrefix[i], SIZEOF(szSet0) - ofs);
+ for (i = 0; i < _countof(szPrefix); i++) {
+ mir_strncpy(szSet0 + ofs, szPrefix[i], _countof(szSet0) - ofs);
ret &= db_unset(hContact, USERINFO, szSet0);
}
}
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp
index 50ff993163..5f7241341c 100644
--- a/plugins/UserInfoEx/src/ctrl_button.cpp
+++ b/plugins/UserInfoEx/src/ctrl_button.cpp
@@ -192,7 +192,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien
RECT sizeText;
HFONT hOldFont;
- ccText = GetWindowTextW(ctl->hwnd, wszText, SIZEOF(wszText));
+ ccText = GetWindowTextW(ctl->hwnd, wszText, _countof(wszText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -301,7 +301,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient)
SIZE sizeText;
HFONT hOldFont;
- ccText = GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ ccText = GetWindowText(ctl->hwnd, szText, _countof(szText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -543,7 +543,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
case BUTTONTRANSLATE:
{
TCHAR szButton[MAX_PATH];
- GetWindowText(bct->hwnd, szButton, SIZEOF(szButton));
+ GetWindowText(bct->hwnd, szButton, _countof(szButton));
SetWindowText(bct->hwnd, TranslateTS(szButton));
}
break;
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index bf4e43afd5..7576bf10e6 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -171,11 +171,11 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
{
TCHAR szButton[MAX_PATH];
HWND hBtn = GetDlgItem(hDlg, IDOK);
- GetWindowText(hBtn, szButton, SIZEOF(szButton));
+ GetWindowText(hBtn, szButton, _countof(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
hBtn = GetDlgItem(hDlg, IDCANCEL);
- GetWindowText(hBtn, szButton, SIZEOF(szButton));
+ GetWindowText(hBtn, szButton, _countof(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
}
return TRUE;
@@ -205,7 +205,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR szText[MAXDATASIZE];
LPTSTR pszAdd, pszDot;
if (PtrIsValid(cbi)) {
- GetWindowText((HWND)lParam, szText, SIZEOF(szText));
+ GetWindowText((HWND)lParam, szText, _countof(szText));
EnableWindow(GetDlgItem(hDlg, IDOK),
((pszAdd = _tcschr(szText, '@')) &&
*(pszAdd + 1) != '.' &&
@@ -255,10 +255,10 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
HWND hBtn;
hBtn = GetDlgItem(hDlg, IDOK);
- GetWindowText(hBtn, szButton, SIZEOF(szButton));
+ GetWindowText(hBtn, szButton, _countof(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
hBtn = GetDlgItem(hDlg, IDCANCEL);
- GetWindowText(hBtn, szButton, SIZEOF(szButton));
+ GetWindowText(hBtn, szButton, _countof(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
}
if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit phone number"));
@@ -295,7 +295,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
TCHAR szText[MAXDATASIZE];
int errorPos;
- if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, SIZEOF(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
+ if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only."));
break;
}
@@ -326,9 +326,9 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
int nCurSel = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCURSEL, 0, 0);
UINT nCountry = (nCurSel != CB_ERR) ? SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, nCurSel, 0) : 0;
- GetDlgItemText(hDlg, EDIT_AREA, szArea, SIZEOF(szArea));
- GetDlgItemText(hDlg, EDIT_NUMBER, szData, SIZEOF(szData));
- mir_sntprintf(szPhone, SIZEOF(szPhone), _T("+%u (%s) %s"), nCountry, szArea, szData);
+ GetDlgItemText(hDlg, EDIT_AREA, szArea, _countof(szArea));
+ GetDlgItemText(hDlg, EDIT_NUMBER, szData, _countof(szData));
+ mir_sntprintf(szPhone, _countof(szPhone), _T("+%u (%s) %s"), nCountry, szArea, szData);
noRecursion = 1;
SetDlgItemText(hDlg, EDIT_PHONE, szPhone);
noRecursion = 0;
@@ -342,7 +342,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
{
TCHAR szText[MAXDATASIZE], *pText, *pArea, *pNumber;
int isValid = 1;
- GetDlgItemText(hDlg, EDIT_PHONE, szText, SIZEOF(szText));
+ GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText));
if (szText[0] != '+') isValid = 0;
if (isValid) {
int i, country = _tcstol(szText + 1, &pText, 10);
@@ -778,7 +778,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
!cbex->pItems ||
cbex->iSelectedItem < 0 ||
cbex->iSelectedItem >= cbex->numItems ||
- FAILED(mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
+ FAILED(mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"),
cbex->pItems[cbex->iSelectedItem].szCat, cbex->pItems[cbex->iSelectedItem].pszVal))
)
{
@@ -845,7 +845,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
int errorPos;
TCHAR szEdit[MAXDATASIZE];
- if (ccVal = GetWindowText(cbex->hEdit, szEdit, SIZEOF(szEdit))) {
+ if (ccVal = GetWindowText(cbex->hEdit, szEdit, _countof(szEdit))) {
if (!(ccVal = CheckPhoneSyntax(szEdit, szVal, MAXDATASIZE, errorPos)) || errorPos > -1) {
SetWindowText(cbex->hEdit, szVal);
SendMessage(cbex->hEdit, EM_SETSEL, errorPos, errorPos);
@@ -854,10 +854,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
break;
}
case EDIT_EMAIL:
- ccVal = GetWindowText(cbex->hEdit, szVal, SIZEOF(szVal));
+ ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal));
break;
default:
- ccVal = GetWindowText(cbex->hEdit, szVal, SIZEOF(szVal));
+ ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal));
break;
}
@@ -944,7 +944,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
// set category string
if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
- mir_sntprintf(cbex->pItems[cbex->numItems].szCat, SIZEOF(cbex->pItems[cbex->numItems].szCat), _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
+ mir_sntprintf(cbex->pItems[cbex->numItems].szCat, _countof(cbex->pItems[cbex->numItems].szCat), _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
}
// set value string
@@ -983,8 +983,8 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
// set new category string
if (pItem->wMask & CBEXIM_CAT) {
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
- mir_sntprintf(cbex->pItems[pItem->iItem].szCat, SIZEOF(cbex->pItems[pItem->iItem].szCat), _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, _countof(cbex->pItems[pItem->iItem].szCat)))
+ mir_sntprintf(cbex->pItems[pItem->iItem].szCat, _countof(cbex->pItems[pItem->iItem].szCat), _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
if (pItem->iItem == cbex->iSelectedItem)
SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
}
@@ -1347,7 +1347,7 @@ int CtrlContactAddMyItemsFromDB(
cbi.pszIcon = szIcon;
for (i = 0;
- SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i)) &&
+ SUCCEEDED(mir_snprintf(pszSetting, _countof(pszSetting), szFormatVal, i)) &&
(cbi.wFlags = DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, pszSetting, &dbv));
i++)
{
@@ -1358,7 +1358,7 @@ int CtrlContactAddMyItemsFromDB(
dbv.ptszVal = NULL;
// read category
- if (SUCCEEDED(mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i))) {
+ if (SUCCEEDED(mir_snprintf(pszSetting, _countof(pszSetting), szFormatCat, i))) {
if (cbi.wFlags & CTRLF_HASCUSTOM) {
if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbv))
dbv.type = DBVT_DELETED;
@@ -1426,7 +1426,7 @@ int CtrlContactWriteItemToDB(
db_unset(hContact, pszModule, pszSetting);
else {
if (cbi.wFlags & CBEXIF_SMS)
- mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal) - mir_tstrlen(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), _countof(szVal) - mir_tstrlen(szVal));
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
}
@@ -1476,15 +1476,15 @@ int CtrlContactWriteMyItemsToDB(
while (CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi) && cbi.iItem < 50) {
if (!(cbi.wFlags & CBEXIF_DELETED) && *szVal) {
if (cbi.wFlags & CBEXIF_SMS) {
- mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal) - mir_tstrlen(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), _countof(szVal) - mir_tstrlen(szVal));
}
- mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatCat, i);
+ mir_snprintf(pszSetting, _countof(pszSetting), szFormatCat, i);
if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) {
if (db_set_ts(hContact, pszModule, pszSetting, szCat)) return 1;
}
else
db_unset(hContact, pszModule, pszSetting);
- mir_snprintf(pszSetting, SIZEOF(pszSetting), szFormatVal, i);
+ mir_snprintf(pszSetting, _countof(pszSetting), szFormatVal, i);
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
cbi.wFlags &= ~CTRLF_CHANGED;
cbi.wMask = CBEXIM_FLAGS;
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index 01d6bb911c..1734518c17 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -122,19 +122,19 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
switch (dbv.type)
{
case DBVT_BYTE:
- _itot_s(dbv.bVal, szText, SIZEOF(szText), 10);
+ _itot_s(dbv.bVal, szText, _countof(szText), 10);
SetWindowText(_hwnd, szText);
_pszValue = mir_tstrdup(szText);
break;
case DBVT_WORD:
- _itot_s(dbv.wVal, szText, SIZEOF(szText), 10);
+ _itot_s(dbv.wVal, szText, _countof(szText), 10);
SetWindowText(_hwnd, szText);
_pszValue = mir_tstrdup(szText);
break;
case DBVT_DWORD:
- _itot_s(dbv.dVal, szText, SIZEOF(szText), 10);
+ _itot_s(dbv.dVal, szText, _countof(szText), 10);
SetWindowText(_hwnd, szText);
_pszValue = mir_tstrdup(szText);
break;
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index 23ef5396dd..880ce91789 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -242,15 +242,15 @@ class CAnnivList
case COLUMN_CONTACT:
case COLUMN_PROTO:
case COLUMN_DESC:
- ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, SIZEOF(szText1));
- ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, SIZEOF(szText2));
+ ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, _countof(szText1));
+ ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, _countof(szText2));
result = pDlg->_sortOrder * mir_tstrcmp(szText1, szText2);
break;
case COLUMN_AGE:
case COLUMN_ETA:
- ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, SIZEOF(szText1));
- ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, SIZEOF(szText2));
+ ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, _countof(szText1));
+ ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, _countof(szText2));
result = pDlg->_sortOrder * (_ttoi(szText1) - _ttoi(szText2));
break;
@@ -598,7 +598,7 @@ class CAnnivList
LVCOLUMN lvc;
CHAR pszSetting[MAXSETTING];
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", iSubItem);
+ mir_snprintf(pszSetting, _countof(pszSetting), "AnnivDlg_Col%d", iSubItem);
lvc.cx = db_get_w(NULL, MODNAME, pszSetting, defaultWidth);
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.iSubItem = iSubItem;
@@ -713,7 +713,7 @@ class CAnnivList
AddSubItem(iItem, COLUMN_DESC, (LPTSTR)ad.Description());
// sixth line: date
- ad.DateFormatAlt(szText, SIZEOF(szText));
+ ad.DateFormatAlt(szText, _countof(szText));
AddSubItem(iItem, COLUMN_DATE, szText);
_numRows++;
@@ -877,7 +877,7 @@ public:
int c, cc = Header_GetItemCount(ListView_GetHeader(_hList));
for (c = 0; c < cc; c++) {
- mir_snprintf(pszSetting, SIZEOF(pszSetting), "AnnivDlg_Col%d", c);
+ mir_snprintf(pszSetting, _countof(pszSetting), "AnnivDlg_Col%d", c);
db_set_w(NULL, MODNAME, pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
}
DeleteAllItems();
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index aa3793c929..d2a8f9baec 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -496,8 +496,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
@@ -665,7 +665,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = { 0 };
@@ -688,11 +688,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszTitle, SIZEOF(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
+ mir_sntprintf(tszTitle, _countof(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = {0};
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index e43577998e..3d9324da40 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -137,7 +137,7 @@ private:
EnableWindow(GetDlgItem(_pPs->hDlg, IDOK), FALSE);
EnableWindow(GetDlgItem(_pPs->hDlg, IDAPPLY), FALSE);
- mir_snprintf(_pPs->szUpdating, SIZEOF(_pPs->szUpdating), "%s (%s)", Translate("Uploading"), (*_pPd)->szModuleName);
+ mir_snprintf(_pPs->szUpdating, _countof(_pPs->szUpdating), "%s (%s)", Translate("Uploading"), (*_pPd)->szModuleName);
ShowWindow(GetDlgItem(_pPs->hDlg, TXT_UPDATING), SW_SHOW);
SetTimer(_pPs->hDlg, TIMERID_UPDATING, 100, NULL);
return 0;
@@ -437,56 +437,56 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt
odp.position = 0x8000000;
odp.pfnDlgProc = PSPProcGeneral;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL);
- mir_tstrncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000001;
odp.pfnDlgProc = PSPProcContactHome;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN);
odp.position = 0x8000002;
odp.pfnDlgProc = PSPProcOrigin;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED);
- mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY);
odp.position = 0x8000003;
odp.pfnDlgProc = PSPProcAnniversary;
odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY);
- mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY);
odp.position = 0x8000004;
odp.pfnDlgProc = PSPProcCompany;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY);
- mir_tstrncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000005;
odp.pfnDlgProc = PSPProcContactWork;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tstrncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT);
odp.position = 0x8000006;
odp.pfnDlgProc = PSPProcAbout;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT);
- mir_tstrncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE);
odp.position = 0x8000007;
odp.pfnDlgProc = PSPProcContactProfile;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE);
- mir_tstrncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), _countof(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
return 0;
}
@@ -794,14 +794,14 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
static const WORD idMove[] = { IDC_PAGETITLE, IDC_PAGETITLEBG, IDC_PAGETITLEBG2, IDOK, IDCANCEL, IDAPPLY };
HWND hCtrl;
- for (int i = 0; i < SIZEOF(idResize); i++) {
+ for (int i = 0; i < _countof(idResize); i++) {
if (hCtrl = GetDlgItem(hDlg, idResize[i])) {
GetWindowRect(hCtrl, &rc);
OffsetRect(&rc, -pt.x, -pt.y);
MoveWindow(hCtrl, rc.left, rc.top, rc.right - rc.left + addWidth, rc.bottom - rc.top, FALSE);
}
}
- for (int k = 0; k < SIZEOF(idMove); k++) {
+ for (int k = 0; k < _countof(idMove); k++) {
if (hCtrl = GetDlgItem(hDlg, idMove[k])) {
GetWindowRect(hCtrl, &rc);
OffsetRect(&rc, -pt.x, -pt.y);
@@ -828,7 +828,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
//
pPs->updateAnimFrame = 0;
if (pPs->hContact && *pPs->pszProto) {
- GetDlgItemTextA(hDlg, TXT_UPDATING, pPs->szUpdating, SIZEOF(pPs->szUpdating));
+ GetDlgItemTextA(hDlg, TXT_UPDATING, pPs->szUpdating, _countof(pPs->szUpdating));
ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_HIDE);
if (DlgProc(hDlg, M_CHECKONLINE, NULL, NULL))
@@ -1135,7 +1135,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{ ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 1;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
@@ -1541,7 +1541,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (pPs->hContact != NULL) {
ResetUpdateInfo(pPs);
- mir_snprintf(pPs->szUpdating, SIZEOF(pPs->szUpdating), "%s (%s)", Translate("updating"), pPs->pszProto);
+ mir_snprintf(pPs->szUpdating, _countof(pPs->szUpdating), "%s (%s)", Translate("updating"), pPs->pszProto);
// need meta contact's subcontact information
if (DB::Module::IsMetaAndScan(pPs->pszProto)) {
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index e210d536a1..50e52a490f 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -83,8 +83,8 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey)
if (pszKey && *pszKey) {
char buf[MAXSETTING];
// convert to hash and make bsearch as it is much faster then working with strings
- const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, SIZEOF(buf))));
- return bsearch(&dwHash, dwCiHash, SIZEOF(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL;
+ const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, _countof(buf))));
+ return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL;
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 374f296123..ddee777778 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -54,7 +54,7 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p
tvi.mask = TVIF_STATE|TVIF_TEXT;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.pszText = szModule;
- tvi.cchTextMax = SIZEOF(szModule);
+ tvi.cchTextMax = _countof(szModule);
do {
if (
@@ -89,7 +89,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText)
tvi.mask = TVIF_TEXT;
tvi.pszText = szBuf;
- tvi.cchTextMax = SIZEOF(szBuf);
+ tvi.cchTextMax = _countof(szBuf);
for (tvi.hItem = TreeView_GetChild(hTree, hParent);
tvi.hItem != NULL;
@@ -171,7 +171,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
@@ -225,8 +225,8 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
break;
}
TranslateDialogDefault(hDlg); //to translate oldTitle
- GetWindowText(hDlg, oldTitle, SIZEOF(oldTitle));
- mir_sntprintf(newTitle, SIZEOF(newTitle), _T("%s - %s"), name, oldTitle);
+ GetWindowText(hDlg, oldTitle, _countof(oldTitle));
+ mir_sntprintf(newTitle, _countof(newTitle), _T("%s - %s"), name, oldTitle);
SetWindowText(hDlg, newTitle);
}
@@ -394,7 +394,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
tvi.mask = TVIF_TEXT;
tvi.pszText = szText;
- tvi.cchTextMax = SIZEOF(szText);
+ tvi.cchTextMax = _countof(szText);
// search the tree item of optional items
for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
index 7093d5770f..4f35dc0b5d 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
@@ -61,7 +61,7 @@ static void InitAlteredPlacesBar()
dwFolderID = 17; RegSetValueEx(hkPlacesBar, _T("Place2"), 0, REG_DWORD, (PBYTE)&dwFolderID, sizeof(DWORD));
// Miranda's installation path
- GetModuleFileNameA(GetModuleHandleA("mir_app.dll"), szMirandaPath, SIZEOF(szMirandaPath));
+ GetModuleFileNameA(GetModuleHandleA("mir_app.dll"), szMirandaPath, _countof(szMirandaPath));
p = mir_strrchr(szMirandaPath, '\\');
if (p)
{
@@ -69,7 +69,7 @@ static void InitAlteredPlacesBar()
}
// Miranda's profile path
- if (!CallService(MS_DB_GETPROFILEPATH, SIZEOF(szProfilePath), (LPARAM)szProfilePath))
+ if (!CallService(MS_DB_GETPROFILEPATH, _countof(szProfilePath), (LPARAM)szProfilePath))
{
// only add if different from profile path
RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)mir_strlen(szProfilePath) + 1);
@@ -114,7 +114,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara
// miranda button
switch (tbb->idCommand) {
case 41063:
- mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
+ mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), _countof(szBtnText));
iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
if (iString != -1) tbb->iString = iString;
// set tooltip
@@ -204,7 +204,7 @@ static void GetInitialDir(LPSTR pszInitialDir)
szRelative[0] = 0;
// is some standard path defined
- if (!db_get_static(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) {
+ if (!db_get_static(0, MODNAME, "vCardPath", szRelative, _countof(szRelative))) {
if (!PathToAbsolute(szRelative, pszInitialDir))
mir_strcpy(pszInitialDir, szRelative);
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
index 16d26c73d9..f2d1f52d8d 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
@@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
{ ICO_DLG_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
@@ -194,7 +194,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...)
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, SIZEOF(buf), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
SetDlgItemText(_hDlg, TXT_CONTACT, buf);
}
@@ -221,9 +221,9 @@ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...)
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(buf, SIZEOF(buf), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(buf, _countof(buf), TranslateTS(pszFormat), vl);
va_end(vl);
- GetDlgItemText(_hDlg, TXT_SETTING, tmp, SIZEOF(tmp));
+ GetDlgItemText(_hDlg, TXT_SETTING, tmp, _countof(tmp));
if (mir_tstrcmpi(tmp,buf))
SetDlgItemText(_hDlg, TXT_SETTING, buf);
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index b2a0a1676f..7301d87175 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -35,7 +35,7 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
{ ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? SIZEOF(idIcon) : 2;
+ const int numIconsToSet = db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
index 3b7fea78fe..e9898a9e50 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp
@@ -115,7 +115,7 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent)
{
CHAR szFileName[MAX_PATH] = { 0 };
// create the filename to suggest the user for the to export contact
- DisplayNameToFileName(ExImContact, szFileName, SIZEOF(szFileName));
+ DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
int nIndex = DlgExIm_SaveFileName(hwndParent,
Translate("Select a destination file..."),
FilterString(ExImContact),
@@ -158,7 +158,7 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent)
CHAR szFileName[MAX_PATH] = { 0 };
// create the filename to suggest the user for the to export contact
- DisplayNameToFileName(ExImContact, szFileName, SIZEOF(szFileName));
+ DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
int nIndex = DlgExIm_OpenFileName(hwndParent,
Translate("Import User Details from VCard"),
@@ -280,7 +280,7 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam)
if (SendMessage(hClist,CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) {
SendMessage(hClist,CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem);
LPTSTR temp = mir_tstrdup(ptszGroup);
- mir_sntprintf(tszGroup, SIZEOF(tszGroup),_T("%s%s%s"), ptszItem, mir_tstrlen(temp)? _T("\\"):_T(""), temp);
+ mir_sntprintf(tszGroup, _countof(tszGroup),_T("%s%s%s"), ptszItem, mir_tstrlen(temp)? _T("\\"):_T(""), temp);
mir_free (temp);
}
hParent = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index 17fd80aa2e..2574bf1e8a 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -362,7 +362,7 @@ void DeleteArray(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszFormat, int iSta
{
char pszSetting[MAXSETTING];
do {
- mir_snprintf(pszSetting, SIZEOF(pszSetting), pszFormat, iStart++);
+ mir_snprintf(pszSetting, _countof(pszSetting), pszFormat, iStart++);
}
while (!db_unset(hContact, pszModule, pszSetting));
}
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index ecdaafe2d1..86941be027 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -134,7 +134,7 @@ LPTSTR IcoLib_GetDefaultIconFileName()
};
TCHAR absolute[MAX_PATH];
- for (int i = 0; i < SIZEOF(path); i++) {
+ for (int i = 0; i < _countof(path); i++) {
PathToAbsoluteT(path[i], absolute);
if (PathFileExists(absolute))
return path[i];
@@ -326,7 +326,7 @@ void IcoLib_LoadModule()
// load default icon if required
ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
- for (int i = 0; i < SIZEOF(icoDesc); i++)
+ for (int i = 0; i < _countof(icoDesc); i++)
IcoLib_RegisterIconHandleEx(
icoDesc[i].pszName, icoDesc[i].pszDesc, icoDesc[i].pszSection,
szDefaultFile, icoDesc[i].idResource, icoDesc[i].size, ghDefIcon);
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index 29ddc0cea9..1293c0aa2d 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -82,7 +82,7 @@ void RebuildContact()
}
// delete all MenuItems and set all bytes 0 to avoid problems
- RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
+ RemoveMenuItems (hMenuItem, _countof(hMenuItem));
// support new genmenu style
CLISTMENUITEM mi = { sizeof(mi) };
@@ -178,7 +178,7 @@ void RebuildMain()
}
// delete all MenuItems and set all bytes 0 to avoid problems
- RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
+ RemoveMenuItems (hMenuItem, _countof(hMenuItem));
// support new genmenu style
CLISTMENUITEM mi = { sizeof(mi) };
@@ -316,7 +316,7 @@ void RebuildGroup()
}
// delete all MenuItems and set all bytes 0 to avoid problems
- RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
+ RemoveMenuItems (hMenuItem, _countof(hMenuItem));
// create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it
char text[200];
@@ -413,7 +413,7 @@ void RebuildSubGroup()
}
// delete all MenuItems and set all bytes 0 to avoid problems
- RemoveMenuItems (hMenuItem, SIZEOF(hMenuItem));
+ RemoveMenuItems (hMenuItem, _countof(hMenuItem));
// create service name main (prevent to generate {(Null)/Ex-/Import Group} in db) and set pointer to end it
char text[200];
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp
index b4b90ae57b..3c602c500c 100644
--- a/plugins/UserInfoEx/src/psp_anniversary.cpp
+++ b/plugins/UserInfoEx/src/psp_anniversary.cpp
@@ -148,7 +148,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
{ ICO_BTN_ADD, BM_SETIMAGE, BTN_ADD },
{ ICO_BTN_DELETE, BM_SETIMAGE, BTN_DELETE }
};
- IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon));
+ IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon));
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp
index 089f4239c8..88f61ba4f9 100644
--- a/plugins/UserInfoEx/src/psp_contact.cpp
+++ b/plugins/UserInfoEx/src/psp_contact.cpp
@@ -47,7 +47,7 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
PSGetBoldFont(hDlg, hBoldFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
- mir_sntprintf(szAddr, SIZEOF(szAddr), _T("%s (%s)"), TranslateT("Address"), TranslateT("home"));
+ mir_sntprintf(szAddr, _countof(szAddr), _T("%s (%s)"), TranslateT("Address"), TranslateT("home"));
SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr);
SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR);
TranslateDialogDefault(hDlg);
@@ -194,7 +194,7 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
PSGetBoldFont(hDlg, hBoldFont);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);
- mir_sntprintf(szAddr, SIZEOF(szAddr), _T("%s (%s)"), TranslateT("Address and contact"), TranslateT("company"));
+ mir_sntprintf(szAddr, _countof(szAddr), _T("%s (%s)"), TranslateT("Address and contact"), TranslateT("company"));
SetDlgItemText(hDlg, IDC_PAGETITLE, szAddr);
SendDlgItemMessage(hDlg, BTN_GOTO, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Open in browser"), MBBF_TCHAR);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp
index f5b5980617..946cd6ceb5 100644
--- a/plugins/UserInfoEx/src/psp_general.cpp
+++ b/plugins/UserInfoEx/src/psp_general.cpp
@@ -131,7 +131,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{ ICO_COMMON_MALE, STM_SETIMAGE, ICO_MALE },
{ ICO_COMMON_MARITAL, STM_SETIMAGE, ICO_MARITAL },
};
- IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon));
+ IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon));
}
}
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 4c71f2c8e2..f904adc813 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -278,11 +278,11 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
bInitialized = 0;
{
// menu item settings
- for (int i = 0; i < SIZEOF(ctrl_Menu); i++) {
+ for (int i = 0; i < _countof(ctrl_Menu); i++) {
int flag = db_get_b(NULL, MODNAME, ctrl_Menu[i].pszKey, 2);
// check button and enable / disable control
int idEnable[] = { ctrl_Menu[i].idCheckbox + 1, ctrl_Menu[i].idNONE, ctrl_Menu[i].idALL, ctrl_Menu[i].idEXIMPORT };
- EnableControls(hDlg, idEnable, SIZEOF(idEnable), DBGetCheckBtn(hDlg, ctrl_Menu[i].idCheckbox, ctrl_Menu[i].pszKey, 0));
+ EnableControls(hDlg, idEnable, _countof(idEnable), DBGetCheckBtn(hDlg, ctrl_Menu[i].idCheckbox, ctrl_Menu[i].pszKey, 0));
// set radio button state
int id = ctrl_Menu[i].idNONE; //default
if ((flag & 4) == 4)
@@ -308,7 +308,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
case PSN_APPLY:
// menu item settings
- for (int i = 0; i < SIZEOF(ctrl_Menu); i++) {
+ for (int i = 0; i < _countof(ctrl_Menu); i++) {
int flag = IsDlgButtonChecked(hDlg, ctrl_Menu[i].idCheckbox);
flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idNONE) ? 2 : 0;
flag |= IsDlgButtonChecked(hDlg, ctrl_Menu[i].idALL) ? 4 : 0;
@@ -359,10 +359,10 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam,
case CHECK_OPT_MI_GROUP:
case CHECK_OPT_MI_SUBGROUP:
case CHECK_OPT_MI_ACCOUNT:
- for (int i = 0; i < SIZEOF(ctrl_Menu); i++) {
+ for (int i = 0; i < _countof(ctrl_Menu); i++) {
if (ctrl_Menu[i].idCheckbox == LOWORD(wParam)) {
const int idMenuItems[] = { ctrl_Menu[i].idCheckbox + 1, ctrl_Menu[i].idNONE, ctrl_Menu[i].idALL, ctrl_Menu[i].idEXIMPORT };
- EnableControls(hDlg, idMenuItems, SIZEOF(idMenuItems), Button_GetCheck((HWND)lParam));
+ EnableControls(hDlg, idMenuItems, _countof(idMenuItems), Button_GetCheck((HWND)lParam));
break;
}
}
@@ -555,7 +555,7 @@ static INT_PTR CALLBACK DlgProc_DetailsDlgOpts(HWND hDlg, UINT uMsg, WPARAM wPar
const int idCtrl[] = { CLR_NORMAL, CLR_USER, CLR_BOTH, CLR_CHANGED, CLR_META, TXT_OPT_CLR_NORMAL,
TXT_OPT_CLR_USER, TXT_OPT_CLR_BOTH, TXT_OPT_CLR_CHANGED, TXT_OPT_CLR_META };
- EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bChecked);
+ EnableControls(hDlg, idCtrl, _countof(idCtrl), bChecked);
}
case CHECK_OPT_GROUPS:
@@ -639,7 +639,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
mtLast.DBGetStamp(NULL, MODNAME, SET_REMIND_LASTCHECK);
mtLast.UTCToLocal();
- mtLast.TimeFormat(szTime, SIZEOF(szTime));
+ mtLast.TimeFormat(szTime, _countof(szTime));
SetDlgItemText(hDlg, TXT_REMIND_LASTCHECK, szTime);
@@ -708,7 +708,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
CHECK_REMIND_SECURED, CHECK_REMIND_STARTUP, EDIT_REMIND_SOUNDOFFSET, SPIN_REMIND_SOUNDOFFSET
};
- EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
+ EnableControls(hDlg, idCtrl, _countof(idCtrl), bEnabled);
}
case EDIT_BIRTHMODULE:
@@ -869,7 +869,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
db_set_b(NULL, MODNAME, SET_POPUP_DELAY, 255);
else if (IsDlgButtonChecked(hDlg, RADIO_OPT_POPUP_CUSTOM)) {
TCHAR szDelay[4];
- GetDlgItemText(hDlg, EDIT_DELAY, szDelay, SIZEOF(szDelay));
+ GetDlgItemText(hDlg, EDIT_DELAY, szDelay, _countof(szDelay));
db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)_tcstol(szDelay, NULL, 10));
}
else
@@ -886,7 +886,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
mir_tstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
- mir_tstrncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Birthday"), _countof(ppd.lptzContactName));
ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -899,7 +899,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
PUAddPopupT(&ppd);
// Anniversary
- mir_tstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), _countof(ppd.lptzContactName));
ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -937,7 +937,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
RADIO_OPT_POPUP_PERMANENT, EDIT_DELAY
};
- EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
+ EnableControls(hDlg, idCtrl, _countof(idCtrl), bEnabled);
if (bInitialized)
NotifyParentOfChange(hDlg);
diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp
index 3badb81261..a3275fa436 100644
--- a/plugins/UserInfoEx/src/psp_origin.cpp
+++ b/plugins/UserInfoEx/src/psp_origin.cpp
@@ -90,11 +90,11 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
LPTSTR ptr;
mt.UTCToLocal();
- mt.DateFormatLong(szTime, SIZEOF(szTime));
+ mt.DateFormatLong(szTime, _countof(szTime));
mir_tstrcat(szTime, _T(" - "));
ptr = szTime + mir_tstrlen(szTime);
- mt.TimeFormat(ptr, SIZEOF(szTime) - (ptr - szTime));
+ mt.TimeFormat(ptr, _countof(szTime) - (ptr - szTime));
SetDlgItemText(hDlg, TXT_DATEADDED, szTime);
}
}
@@ -110,7 +110,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
{ ICO_COMMON_CLOCK, STM_SETIMAGE, ICO_CLOCK },
};
- IcoLib_SetCtrlIcons(hDlg, idIcon, SIZEOF(idIcon));
+ IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon));
}
}
}
@@ -134,7 +134,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case WM_TIMER:
{
TCHAR szTime[32];
- CTzCombo::GetObj(hDlg, EDIT_TIMEZONE)->GetTime(szTime, SIZEOF(szTime));
+ CTzCombo::GetObj(hDlg, EDIT_TIMEZONE)->GetTime(szTime, _countof(szTime));
SetDlgItemText(hDlg, TXT_TIME, szTime);
break;
}
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index 9ce4fd36ee..c8773a3419 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -487,12 +487,12 @@ static int ProfileList_AddItemlistFromDB(
for (i = 0, lvi.iItem = iItem; ; i++) {
// read the setting from db
- mir_snprintf(pszSetting, SIZEOF(pszSetting), szValFormat, i);
+ mir_snprintf(pszSetting, _countof(pszSetting), szValFormat, i);
if (DB::Setting::GetTString(hContact, pszModule, pszSetting, &dbvVal))
break;
if (dbvVal.type != DBVT_TCHAR)
continue;
- mir_snprintf(pszSetting, SIZEOF(pszSetting), szCatFormat, i);
+ mir_snprintf(pszSetting, _countof(pszSetting), szCatFormat, i);
DB::Setting::GetAString(hContact, pszModule, pszSetting, &dbvCat);
// create the itemobject
if (!(pItem = (LPLCITEM)mir_alloc(sizeof(LCITEM)))) {
@@ -913,7 +913,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa
if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
break;
- GetWindowText(pList->labelEdit.hEdit, szEdit, SIZEOF(szEdit));
+ GetWindowText(pList->labelEdit.hEdit, szEdit, _countof(szEdit));
// need to create the dropdown list?
if (pList->labelEdit.dropDown.hDrop == NULL) {
@@ -1193,36 +1193,36 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
*szGroup = 0;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.pszText = szGroup;
- lvi.cchTextMax = SIZEOF(szGroup);
+ lvi.cchTextMax = _countof(szGroup);
for (iItem = lvi.iItem = lvi.iSubItem = 0; ListView_GetItem(hList, &lvi); lvi.iItem++) {
if (!PtrIsValid(pItem = (LPLCITEM)lvi.lParam)) {
// delete reluctant items
- if (iFmt < SIZEOF(pFmt)) {
+ if (iFmt < _countof(pFmt)) {
DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
}
// find information about the group
- for (iFmt = 0; iFmt < SIZEOF(pFmt); iFmt++) {
+ for (iFmt = 0; iFmt < _countof(pFmt); iFmt++) {
if (!mir_tstrcmp(szGroup, pFmt[iFmt].szGroup))
break;
}
// indicate, no group was found. should not happen!!
- if (iFmt == SIZEOF(pFmt)) {
+ if (iFmt == _countof(pFmt)) {
*szGroup = 0;
iFmt = -1;
}
iItem = 0;
}
- else if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+ else if (iFmt >= 0 && iFmt < _countof(pFmt)) {
// save value
if (!pItem->pszText[1] || !*pItem->pszText[1])
continue;
if (!(pItem->wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA))) {
- mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szValFmt, iItem);
+ mir_snprintf(pszSetting, _countof(pszSetting), pFmt[iFmt].szValFmt, iItem);
db_set_ts(hContact, pszModule, pszSetting, pItem->pszText[1]);
// save category
- mir_snprintf(pszSetting, SIZEOF(pszSetting), pFmt[iFmt].szCatFmt, iItem);
+ mir_snprintf(pszSetting, _countof(pszSetting), pFmt[iFmt].szCatFmt, iItem);
if (pItem->idstrList && pItem->iListItem > 0 && pItem->iListItem < pItem->idstrListCount)
db_set_s(hContact, pszModule, pszSetting, (LPSTR)pItem->idstrList[pItem->iListItem].pszText);
else if (pItem->pszText[0] && *pItem->pszText[0])
@@ -1239,7 +1239,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
}
}
// delete reluctant items
- if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+ if (iFmt >= 0 && iFmt < _countof(pFmt)) {
DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
}
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp
index b81a5022a6..3dde09a036 100644
--- a/plugins/UserInfoEx/src/svc_avatar.cpp
+++ b/plugins/UserInfoEx/src/svc_avatar.cpp
@@ -33,7 +33,7 @@ namespace NServices
size_t len = mir_strlen(szFileName);
CHAR tmp[64];
- if (WideCharToMultiByte(CP_ACP, 0, zodiac, 64, tmp, SIZEOF(tmp), 0, 0) > 0)
+ if (WideCharToMultiByte(CP_ACP, 0, zodiac, 64, tmp, _countof(tmp), 0, 0) > 0)
mir_snprintf(szFileName + len, cchFileName - len, "\\avatars\\%s.png", tmp);
return !PathFileExistsA(szFileName);
@@ -54,7 +54,7 @@ namespace NServices
// get zodiac for birthday
zodiac = mtb.Zodiac();
- if (!GetContactAvatarFileName(zodiac.pszName, szFileName, SIZEOF(szFileName))) {
+ if (!GetContactAvatarFileName(zodiac.pszName, szFileName, _countof(szFileName))) {
// extract the bitmap from the icon
//GetIconInfo(zodiac.hIcon, &iinfo);
diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp
index 12cd47c49d..0abc59b0fd 100644
--- a/plugins/UserInfoEx/src/svc_constants.cpp
+++ b/plugins/UserInfoEx/src/svc_constants.cpp
@@ -324,7 +324,7 @@ INT_PTR GetCountryList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetMaritalList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplMarital);
+ *pnListSize = _countof(TmplMarital);
*pList = TmplMarital;
SvcConstantsTranslateList(TmplMarital, *pnListSize);
return MIR_OK;
@@ -332,7 +332,7 @@ INT_PTR GetMaritalList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetLanguageList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplLanguages);
+ *pnListSize = _countof(TmplLanguages);
*pList = TmplLanguages;
SvcConstantsTranslateList(TmplLanguages, *pnListSize);
return MIR_OK;
@@ -340,7 +340,7 @@ INT_PTR GetLanguageList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetOccupationList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplOccupations);
+ *pnListSize = _countof(TmplOccupations);
*pList = TmplOccupations;
SvcConstantsTranslateList(TmplOccupations, *pnListSize);
return MIR_OK;
@@ -348,7 +348,7 @@ INT_PTR GetOccupationList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetInterestsList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplInterests);
+ *pnListSize = _countof(TmplInterests);
*pList = TmplInterests;
SvcConstantsTranslateList(TmplInterests, *pnListSize);
return MIR_OK;
@@ -356,7 +356,7 @@ INT_PTR GetInterestsList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetPastList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplPast);
+ *pnListSize = _countof(TmplPast);
*pList = TmplPast;
SvcConstantsTranslateList(TmplPast, *pnListSize);
return MIR_OK;
@@ -364,7 +364,7 @@ INT_PTR GetPastList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetAffiliationsList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplAffiliations);
+ *pnListSize = _countof(TmplAffiliations);
*pList = TmplAffiliations;
SvcConstantsTranslateList(TmplAffiliations, *pnListSize);
return MIR_OK;
@@ -372,7 +372,7 @@ INT_PTR GetAffiliationsList(LPUINT pnListSize, LPIDSTRLIST *pList)
INT_PTR GetNamePrefixList(LPUINT pnListSize, LPIDSTRLIST *pList)
{
- *pnListSize = SIZEOF(TmplPrefixes);
+ *pnListSize = _countof(TmplPrefixes);
*pList = TmplPrefixes;
SvcConstantsTranslateList(TmplPrefixes, *pnListSize);
return MIR_OK;
@@ -403,13 +403,13 @@ static void FORCEINLINE SvcConstantsClearList(UINT pnListSize, LPIDSTRLIST pList
void SvcConstantsUnloadModule(void)
{
- SvcConstantsClearList(SIZEOF(TmplMarital), TmplMarital);
- SvcConstantsClearList(SIZEOF(TmplLanguages), TmplLanguages);
- SvcConstantsClearList(SIZEOF(TmplOccupations), TmplOccupations);
- SvcConstantsClearList(SIZEOF(TmplInterests), TmplInterests);
- SvcConstantsClearList(SIZEOF(TmplPast), TmplPast);
- SvcConstantsClearList(SIZEOF(TmplAffiliations), TmplAffiliations);
- SvcConstantsClearList(SIZEOF(TmplPrefixes), TmplPrefixes);
+ SvcConstantsClearList(_countof(TmplMarital), TmplMarital);
+ SvcConstantsClearList(_countof(TmplLanguages), TmplLanguages);
+ SvcConstantsClearList(_countof(TmplOccupations), TmplOccupations);
+ SvcConstantsClearList(_countof(TmplInterests), TmplInterests);
+ SvcConstantsClearList(_countof(TmplPast), TmplPast);
+ SvcConstantsClearList(_countof(TmplAffiliations), TmplAffiliations);
+ SvcConstantsClearList(_countof(TmplPrefixes), TmplPrefixes);
SvcConstantsClearList(MyCountriesCount, MyCountries);
MIR_FREE(MyCountries);
}
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp
index 662d300256..627d3c2794 100644
--- a/plugins/UserInfoEx/src/svc_contactinfo.cpp
+++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp
@@ -548,12 +548,12 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam)
ci->pszVal = NULL;
if (ci->dwFlag & CNF_UNICODE) {
WCHAR wszDate[80];
- if (GetDateFormatW(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, wszDate, SIZEOF(wszDate)))
+ if (GetDateFormatW(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, wszDate, _countof(wszDate)))
ci->pszVal = (LPTSTR)mir_wstrdup(wszDate);
}
else {
CHAR szDate[80];
- if (GetDateFormatA(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, szDate, SIZEOF(szDate)))
+ if (GetDateFormatA(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, szDate, _countof(szDate)))
ci->pszVal = (LPTSTR)mir_strdup(szDate);
}
ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 6a99a2ac44..9d483e7654 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -119,7 +119,7 @@ public:
va_list vl;
va_start(vl, szText);
- if (mir_vsntprintf(buf, SIZEOF(buf), szText, vl) != -1)
+ if (mir_vsntprintf(buf, _countof(buf), szText, vl) != -1)
{
SetTitle(buf);
}
@@ -179,7 +179,7 @@ public:
}
va_start(vl, szText);
- if (mir_vsntprintf(buf, SIZEOF(buf), fmt, vl) != -1)
+ if (mir_vsntprintf(buf, _countof(buf), fmt, vl) != -1)
{
SetText(buf);
}
@@ -427,7 +427,7 @@ public:
pd.iSeconds = -1;
pd.PluginData = this;
pd.PluginWindowProc = CPopupUpdProgress::WndProc;
- pd.actionCount = SIZEOF(_popupButtons);
+ pd.actionCount = _countof(_popupButtons);
pd.lpActions = _popupButtons;
// dummy text
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 62b097bf4e..82936b60ab 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -148,7 +148,7 @@ static HICON GetAnnivIcon(const CEvent &evt)
if (evt._wDaysLeft > 9)
hIcon = IcoLib_GetIcon(ICO_RMD_DTBX);
else {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
+ mir_snprintf(szIcon, _countof(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
hIcon = IcoLib_GetIcon(szIcon);
}
break;
@@ -157,7 +157,7 @@ static HICON GetAnnivIcon(const CEvent &evt)
if (evt._wDaysLeft > 9)
hIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
else {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
+ mir_snprintf(szIcon, _countof(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
hIcon = IcoLib_GetIcon(szIcon);
}
}
@@ -183,7 +183,7 @@ static void NotifyWithExtraIcon(MCONTACT hContact, const CEvent &evt)
if (evt._wDaysLeft > 9)
icoName = ICO_RMD_DTAX;
else {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
+ mir_snprintf(szIcon, _countof(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
icoName = szIcon;
}
break;
@@ -192,7 +192,7 @@ static void NotifyWithExtraIcon(MCONTACT hContact, const CEvent &evt)
if (evt._wDaysLeft > 9)
icoName = ICO_RMD_DTAX;
else {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
+ mir_snprintf(szIcon, _countof(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
icoName = szIcon;
}
break;
@@ -255,10 +255,10 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT
if (hContact) {
ppd.lchContact = hContact;
- mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),
+ mir_sntprintf(ppd.lptzContactName, _countof(ppd.lptzContactName),
_T("%s - %s"), TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else mir_tstrncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
+ else mir_tstrncpy(ppd.lptzContactName, TranslateT("Reminder"), _countof(ppd.lptzContactName));
mir_tstrncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
@@ -318,12 +318,12 @@ static void NotifyFlashCListIcon(MCONTACT hContact, const CEvent &evt)
switch (evt._eType) {
case CEvent::BIRTHDAY:
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("Birthday"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("Birthday"));
cle.hIcon = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY);
break;
case CEvent::ANNIVERSARY:
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("an anniversary"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%s has %s today."), DB::Contact::DisplayName(hContact), TranslateT("an anniversary"));
cle.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY);
break;
@@ -483,29 +483,29 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti
switch (Diff) {
case 0:
- cchMsg = mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has birthday today."), DB::Contact::DisplayName(hContact));
+ cchMsg = mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%s has birthday today."), DB::Contact::DisplayName(hContact));
break;
case 1:
- cchMsg = mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has birthday tomorrow."), DB::Contact::DisplayName(hContact));
+ cchMsg = mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%s has birthday tomorrow."), DB::Contact::DisplayName(hContact));
break;
default:
- cchMsg = mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%s has birthday in %d days."), DB::Contact::DisplayName(hContact), Diff);
+ cchMsg = mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%s has birthday in %d days."), DB::Contact::DisplayName(hContact), Diff);
}
int age = mtb.Age(&Now);
if (age > 0)
switch (GenderOf(hContact)){
case 0:
- mir_sntprintf(szMsg + cchMsg, SIZEOF(szMsg) - cchMsg,
+ mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nHe/she becomes %d years old."),
age + (Diff > 0));
break;
case 'M':
- mir_sntprintf(szMsg + cchMsg, SIZEOF(szMsg) - cchMsg,
+ mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nHe becomes %d years old."),
age + (Diff > 0));
break;
case 'F':
- mir_sntprintf(szMsg + cchMsg, SIZEOF(szMsg) - cchMsg,
+ mir_sntprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
TranslateT("\nShe becomes %d years old."),
age + (Diff > 0));
break;
@@ -600,10 +600,10 @@ void SvcReminderCheckAll(const ENotify notify)
static int OnCListRebuildIcons(WPARAM, LPARAM)
{
- for (int i = 0; i < SIZEOF(ghCListAnnivIcons); i++)
+ for (int i = 0; i < _countof(ghCListAnnivIcons); i++)
ghCListAnnivIcons[i] = INVALID_HANDLE_VALUE;
- for (int k = 0; k < SIZEOF(ghCListBirthdayIcons); k++)
+ for (int k = 0; k < _countof(ghCListBirthdayIcons); k++)
ghCListBirthdayIcons[k] = INVALID_HANDLE_VALUE;
return 0;
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp
index 05809e970b..18da6a4739 100644
--- a/plugins/UserInfoEx/src/svc_timezone_old.cpp
+++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp
@@ -185,7 +185,7 @@ public:
if (result == ERROR_SUCCESS) {
// clear out old list
this->destroy(); _bias.destroy();
- for (i = 0; ERROR_SUCCESS == RegEnumKey(hKeyRoot, i, szName, SIZEOF(szName)); i++) {
+ for (i = 0; ERROR_SUCCESS == RegEnumKey(hKeyRoot, i, szName, _countof(szName)); i++) {
result = RegOpenKey(hKeyRoot, szName, &hKeyTz);
if (result == ERROR_SUCCESS) {
pTimeZone = new CTimeZone();
diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h
index 4aa0a2602e..ac7c909860 100644
--- a/plugins/Utils/mir_buffer.h
+++ b/plugins/Utils/mir_buffer.h
@@ -468,7 +468,7 @@ static void ReplaceVars(Buffer<TCHAR> *buffer, MCONTACT hContact, TCHAR **variab
else if (foundLen == 6 && _tcsncmp(&buffer->str[j], _T("%date%"), 6) == 0)
{
TCHAR tmp[128];
- TimeZone_ToStringT(time(NULL), _T("d s"), tmp, SIZEOF(tmp));
+ TimeZone_ToStringT(time(NULL), _T("d s"), tmp, _countof(tmp));
buffer->replace(j, i + 1, tmp);
}
else
diff --git a/plugins/Utils/mir_fonts.cpp b/plugins/Utils/mir_fonts.cpp
index d18dfd020c..d617e87b59 100644
--- a/plugins/Utils/mir_fonts.cpp
+++ b/plugins/Utils/mir_fonts.cpp
@@ -12,10 +12,10 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con
fid.cbSize = sizeof(fid);
mir_strncpy(fid.dbSettingsGroup, pszDbModule, sizeof(fid.dbSettingsGroup)); /* buffer safe */
mir_strncpy(fid.prefix, pszDbName, sizeof(fid.prefix)); /* buffer safe */
- mir_tstrncpy(fid.group, pszSection, SIZEOF(fid.group)); /* buffer safe */
- mir_tstrncpy(fid.name, pszDescription, SIZEOF(fid.name)); /* buffer safe */
- mir_tstrncpy(fid.backgroundGroup, pszBackgroundGroup, SIZEOF(fid.backgroundGroup)); /* buffer safe */
- mir_tstrncpy(fid.backgroundName, pszBackgroundName, SIZEOF(fid.backgroundName)); /* buffer safe */
+ mir_tstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer safe */
+ mir_tstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */
+ mir_tstrncpy(fid.backgroundGroup, pszBackgroundGroup, _countof(fid.backgroundGroup)); /* buffer safe */
+ mir_tstrncpy(fid.backgroundName, pszBackgroundName, _countof(fid.backgroundName)); /* buffer safe */
fid.flags = FIDF_ALLOWREREGISTER;
if (bAllowEffects) fid.flags |= FIDF_ALLOWEFFECTS;
fid.order = position;
@@ -28,7 +28,7 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con
if (plfDefault->lfUnderline) fid.deffontsettings.style |= DBFONTF_UNDERLINE;
if (plfDefault->lfStrikeOut) fid.deffontsettings.style |= DBFONTF_STRIKEOUT;
fid.deffontsettings.charset = plfDefault->lfCharSet;
- mir_tstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */
+ mir_tstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */
}
FontRegisterT(&fid);
return 0;
@@ -37,8 +37,8 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con
int FontService_GetFont(const TCHAR *pszSection, const TCHAR *pszDescription, COLORREF *pclr, LOGFONT *plf)
{
FontIDT fid = { 0 };
- mir_tstrncpy(fid.group, pszSection, SIZEOF(fid.group)); /* buffer sfae */
- mir_tstrncpy(fid.name, pszDescription, SIZEOF(fid.name)); /* buffer safe */
+ mir_tstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer sfae */
+ mir_tstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */
*pclr = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)plf); /* uses fallback font on error */
return (int)*pclr == -1;
}
@@ -50,8 +50,8 @@ int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, co
cid.defcolour = clrDefault;
mir_strncpy(cid.dbSettingsGroup, pszDbModule, sizeof(cid.dbSettingsGroup)); /* buffer safe */
mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */
- mir_tstrncpy(cid.group, pszSection, SIZEOF(cid.group)); /* buffer safe */
- mir_tstrncpy(cid.name, pszDescription, SIZEOF(cid.name)); /* buffer safe */
+ mir_tstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */
+ mir_tstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */
ColourRegisterT(&cid);
return 0;
}
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp
index 9618b51c4f..b65b7645e6 100644
--- a/plugins/Utils/mir_options.cpp
+++ b/plugins/Utils/mir_options.cpp
@@ -70,8 +70,8 @@ static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
else {
if (dbPath[0] == _T('\0')) {
char tmp[1024];
- CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM)tmp);
- mir_sntprintf(dbPath, SIZEOF(dbPath), _T("%S\\"), tmp);
+ CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp);
+ mir_sntprintf(dbPath, _countof(dbPath), _T("%S\\"), tmp);
}
size_t len = mir_tstrlen(dbPath);
@@ -88,8 +88,8 @@ static void PathToAbsolute(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)
else {
if (dbPath[0] == _T('\0')) {
char tmp[1024];
- CallService(MS_DB_GETPROFILEPATH, SIZEOF(tmp), (LPARAM)tmp);
- mir_sntprintf(dbPath, SIZEOF(dbPath), _T("%S\\"), tmp);
+ CallService(MS_DB_GETPROFILEPATH, _countof(tmp), (LPARAM)tmp);
+ mir_sntprintf(dbPath, _countof(dbPath), _T("%S\\"), tmp);
}
mir_sntprintf(pOut, outSize, _T("%s%s"), dbPath, pSrc);
@@ -360,7 +360,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha
case CONTROL_TEXT:
{
TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, _countof(tmp));
db_set_ts(NULL, module, ctrl->setting, tmp);
}
break;
@@ -381,7 +381,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha
case CONTROL_FILE:
{
TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, _countof(tmp));
TCHAR rel[1024];
PathToRelative(rel, 1024, tmp);
db_set_ts(NULL, module, ctrl->setting, rel);
@@ -390,7 +390,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha
case CONTROL_COMBO_TEXT:
{
TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, _countof(tmp));
db_set_ts(NULL, module, ctrl->setting, tmp);
}
break;
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 0c8a0642e7..1bd05d180d 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -94,7 +94,7 @@ BYTE getContactInfoType(TCHAR* type)
if (type == NULL || mir_tstrlen(type) == 0 )
return 0;
- for (int i=0; i < SIZEOF(builtinCnfs); i++ )
+ for (int i=0; i < _countof(builtinCnfs); i++ )
if (!mir_tstrcmp( builtinCnfs[i].str, type ))
return builtinCnfs[i].cnfCode;
diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h
index 9cad9fdce1..b6fe9f7c42 100644
--- a/plugins/Variables/src/dbhelpers.h
+++ b/plugins/Variables/src/dbhelpers.h
@@ -26,7 +26,7 @@ static int __inline DBWriteIthSettingByte(DWORD i, MCONTACT hContact,const char
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_set_b(hContact, szModule, dbSetting, val);
}
@@ -34,7 +34,7 @@ static int __inline DBWriteIthSettingWord(DWORD i, MCONTACT hContact,const char
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_set_w(hContact, szModule, dbSetting, val);
}
@@ -42,7 +42,7 @@ static int __inline DBWriteIthSettingDword(DWORD i, MCONTACT hContact,const char
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_set_dw(hContact, szModule, dbSetting, val);
}
@@ -50,7 +50,7 @@ static int __inline DBWriteIthSettingString(DWORD i, MCONTACT hContact,const cha
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_set_s(hContact, szModule, dbSetting, val);
}
@@ -59,7 +59,7 @@ static int __inline DBGetIthSettingByte(DWORD i, MCONTACT hContact, const char *
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_get_b(hContact, szModule, dbSetting, errorValue);
}
@@ -68,7 +68,7 @@ static WORD __inline DBGetIthSettingWord(DWORD i, MCONTACT hContact, const char
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_get_w(hContact, szModule, dbSetting, errorValue);
}
@@ -77,7 +77,7 @@ static DWORD __inline DBGetIthSettingDword(DWORD i, MCONTACT hContact, const cha
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_get_dw(hContact, szModule, dbSetting, errorValue);
}
@@ -86,7 +86,7 @@ static int __inline DBGetIthSetting(DWORD i, MCONTACT hContact, const char *szMo
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_get(hContact, szModule, dbSetting, dbv);
}
@@ -94,7 +94,7 @@ static int __inline DBDeleteIthSetting(DWORD i, MCONTACT hContact,const char *sz
char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
+ mir_snprintf(dbSetting, _countof(dbSetting), "%s%u_%s", PREFIX_ITH, i, szSetting);
return db_unset(hContact, szModule, dbSetting);
}
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp
index c1c6f405ac..8075c5fbc7 100644
--- a/plugins/Variables/src/parse_inet.cpp
+++ b/plugins/Variables/src/parse_inet.cpp
@@ -40,7 +40,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai)
char hex[8];
memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1);
- mir_snprintf(hex, SIZEOF(hex), "%%%x", *(res + cur));
+ mir_snprintf(hex, _countof(hex), "%%%x", *(res + cur));
strncpy(res + cur, hex, mir_strlen(hex));
cur += mir_strlen(hex);
}
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index 4dc0913824..f86f15d467 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -54,7 +54,7 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai)
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
- mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val);
+ mir_sntprintf(szVal, _countof(szVal), _T("%x"), val);
unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(TCHAR));
if (res == NULL)
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp
index 9992d0af5a..ff2b7a18a6 100644
--- a/plugins/Variables/src/parse_metacontacts.cpp
+++ b/plugins/Variables/src/parse_metacontacts.cpp
@@ -51,7 +51,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
TCHAR tszID[40];
- mir_sntprintf(tszID, SIZEOF(tszID), _T("%p"), hContact);
+ mir_sntprintf(tszID, _countof(tszID), _T("%p"), hContact);
szUniqueID = mir_tstrdup(tszID);
}
@@ -91,7 +91,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
TCHAR tszID[40];
- mir_sntprintf(tszID, SIZEOF(tszID), _T("%p"), hContact);
+ mir_sntprintf(tszID, _countof(tszID), _T("%p"), hContact);
szUniqueID = mir_tstrdup(tszID);
}
@@ -131,7 +131,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
TCHAR tszID[40];
- mir_sntprintf(tszID, SIZEOF(tszID), _T("%p"), hContact);
+ mir_sntprintf(tszID, _countof(tszID), _T("%p"), hContact);
szUniqueID = mir_tstrdup(tszID);
}
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index bd07c2c23d..d66ed6d3c1 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -154,7 +154,7 @@ static TCHAR* parseDBProfileName(ARGUMENTSINFO *ai)
return NULL;
TCHAR name[MAX_PATH];
- if (CallService(MS_DB_GETPROFILENAMET, SIZEOF(name), (LPARAM)name))
+ if (CallService(MS_DB_GETPROFILENAMET, _countof(name), (LPARAM)name))
return NULL;
return mir_tstrdup(name);
@@ -166,7 +166,7 @@ static TCHAR* parseDBProfilePath(ARGUMENTSINFO *ai)
return NULL;
TCHAR path[MAX_PATH];
- if (CallService(MS_DB_GETPROFILEPATHT, SIZEOF(path), (LPARAM)path))
+ if (CallService(MS_DB_GETPROFILEPATHT, _countof(path), (LPARAM)path))
return NULL;
return mir_tstrdup(path);
@@ -390,7 +390,7 @@ static TCHAR* parseMirandaPath(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
TCHAR path[MAX_PATH];
- if (GetModuleFileName(NULL, path, SIZEOF(path)) == 0)
+ if (GetModuleFileName(NULL, path, _countof(path)) == 0)
return NULL;
return mir_tstrdup(path);
@@ -712,7 +712,7 @@ static TCHAR *parseMirDateString(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
TCHAR ret[128];
- return mir_tstrdup(TimeZone_ToStringT(time(NULL), _T("d s"), ret, SIZEOF(ret)));
+ return mir_tstrdup(TimeZone_ToStringT(time(NULL), _T("d s"), ret, _countof(ret)));
}
static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai)
@@ -723,7 +723,7 @@ static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
TCHAR corevar[MAX_PATH];
- mir_sntprintf(corevar, SIZEOF(corevar), _T("%%%s%%"), ai->targv[0]);
+ mir_sntprintf(corevar, _countof(corevar), _T("%%%s%%"), ai->targv[0]);
return Utils_ReplaceVarsT(corevar);
}
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 73c83cf22e..5b63678750 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -105,7 +105,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai)
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
- mir_sntprintf(szVal, SIZEOF(szVal), _T("%.0f"), cValue.doubleValue);
+ mir_sntprintf(szVal, _countof(szVal), _T("%.0f"), cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
PdhCloseQuery(hQuery);
mir_free(szCounter);
@@ -282,7 +282,7 @@ static TCHAR *parseDiffTime(ARGUMENTSINFO *ai)
return NULL;
diff = difftime(mktime(&t1), mktime(&t0));
- mir_sntprintf(szTime, SIZEOF(szTime), _T("%.0f"), diff);
+ mir_sntprintf(szTime, _countof(szTime), _T("%.0f"), diff);
return mir_tstrdup(szTime);
}
@@ -371,7 +371,7 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai)
tszRes = NULL;
if (ai->argc > 1)
- _tcsncpy(tszFirst, ai->targv[1], SIZEOF(tszFirst) - 1);
+ _tcsncpy(tszFirst, ai->targv[1], _countof(tszFirst) - 1);
if (ai->argc > 2)
tszFilter = ai->targv[2];
@@ -387,10 +387,10 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai)
bFiles = FALSE;
}
if (tszFirst[mir_tstrlen(tszFirst) - 1] == '\\')
- mir_tstrncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
else {
- mir_tstrncat(tszFirst, _T("\\"), SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
- mir_tstrncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ mir_tstrncat(tszFirst, _T("\\"), _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
}
WIN32_FIND_DATA ffd;
@@ -819,7 +819,7 @@ static TCHAR *parseUpTime(ARGUMENTSINFO *ai)
}
TCHAR szVal[32];
- mir_sntprintf(szVal, SIZEOF(szVal), _T("%u"), cValue.largeValue);
+ mir_sntprintf(szVal, _countof(szVal), _T("%u"), cValue.largeValue);
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
return mir_tstrdup(szVal);
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp
index 5cc11880e4..2e40d2f098 100755
--- a/plugins/Watrack_MPD/src/options.cpp
+++ b/plugins/Watrack_MPD/src/options.cpp
@@ -50,10 +50,10 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR szText[256];
db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE));
gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE);
- GetDlgItemText(hwndDlg, IDC_SERVER, szText, SIZEOF(szText));
+ GetDlgItemText(hwndDlg, IDC_SERVER, szText, _countof(szText));
db_set_ts(NULL, szModuleName, "Server", szText);
mir_tstrcpy(gbHost, szText);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, SIZEOF(szText));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, _countof(szText));
db_set_ts(NULL, szModuleName, "Password", szText);
mir_tstrcpy(gbPassword, szText);
return TRUE;
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index ed3196c1e5..1a4127fa05 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -229,7 +229,7 @@ extern "C" int __declspec(dllexport) Load(void)
// window needed for popup commands
TCHAR SvcFunc[100];
- mir_sntprintf(SvcFunc, SIZEOF(SvcFunc), _T("%s__PopupWindow"), _T(WEATHERPROTONAME));
+ mir_sntprintf(SvcFunc, _countof(SvcFunc), _T("%s__PopupWindow"), _T(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 878b590c65..167675d2e5 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -70,7 +70,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
// set contact info and settings
TCHAR svc[256];
- _tcsncpy(svc, psr->email.t, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0;
+ _tcsncpy(svc, psr->email.t, _countof(svc)); svc[_countof(svc)-1] = 0;
GetSvc(svc);
// set settings by obtaining the default for the service
if (psr->lastName.t[0] != 0) {
@@ -90,7 +90,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
AvatarDownloaded(hContact);
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Current weather information for %s."), psr->nick.t);
+ mir_sntprintf(str, _countof(str), TranslateT("Current weather information for %s."), psr->nick.t);
db_set_ts(hContact, WEATHERPROTONAME, "About", str);
// make the last update tags to something invalid
@@ -104,12 +104,12 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
// if no default station is found, set the new contact as default station
if (opt.Default[0] == 0) {
DBVARIANT dbv;
- GetStationID(hContact, opt.Default, SIZEOF(opt.Default));
+ GetStationID(hContact, opt.Default, _countof(opt.Default));
opt.DefStn = hContact;
if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
// notification message box
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);
}
@@ -155,8 +155,8 @@ static void __cdecl BasicSearchTimerProc(LPVOID hWnd)
INT_PTR WeatherBasicSearch(WPARAM wParam, LPARAM lParam)
{
if (searchId != -1) return 0; //only one search at a time
- _tcsncpy(sID, ( TCHAR* )lParam, SIZEOF(sID));
- sID[SIZEOF(sID)-1] = 0;
+ _tcsncpy(sID, ( TCHAR* )lParam, _countof(sID));
+ sID[_countof(sID)-1] = 0;
searchId = 1;
// create a thread for the ID search
mir_forkthread(BasicSearchTimerProc, NULL);
@@ -210,7 +210,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
if (searchId != -1) return 0; //only one search at a time
searchId = 1;
- GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, SIZEOF(name1));
+ GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
mir_forkthread(NameSearchTimerProc, NULL);
@@ -233,7 +233,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc,
TCHAR *szData = NULL;
// load the page
- mir_snprintf(loc, SIZEOF(loc), sData->SearchURL, sID);
+ mir_snprintf(loc, _countof(loc), sData->SearchURL, sID);
BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0);
if (bFound) {
TCHAR* szInfo = szData;
@@ -250,7 +250,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc,
// give no station name but only ID if the search is unavailable
else _tcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
- mir_sntprintf(newID, SIZEOF(newID), _T("%s/%s"), svc, sID);
+ mir_sntprintf(newID, _countof(newID), _T("%s/%s"), svc, sID);
// set the search result and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
@@ -310,7 +310,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// replace spaces with %20
char loc[256];
T2Utf szSearchName(name);
- mir_snprintf(loc, SIZEOF(loc), sData->SearchURL, ptrA( mir_urlEncode(szSearchName)));
+ mir_snprintf(loc, _countof(loc), sData->SearchURL, ptrA( mir_urlEncode(szSearchName)));
if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) {
TCHAR* szInfo = szData;
search = _tcsstr(szInfo, sData->NotFoundStr); // determine if data is available
@@ -323,14 +323,14 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if station ID appears first in the downloaded data
if ( !mir_tstrcmpi(sData->Single.First, _T("ID"))) {
GetDataValue(&sData->Single.ID, str, &szInfo);
- mir_sntprintf(sID, SIZEOF(sID), _T("%s/%s"), svc, str);
+ mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str);
GetDataValue(&sData->Single.Name, Name, &szInfo);
}
// if station name appears first in the downloaded data
else if ( !mir_tstrcmpi(sData->Single.First, _T("NAME"))) {
GetDataValue(&sData->Single.Name, Name, &szInfo);
GetDataValue(&sData->Single.ID, str, &szInfo);
- mir_sntprintf(sID, SIZEOF(sID), _T("%s/%s"), svc, str);
+ mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str);
}
else
str[0] = 0;
@@ -343,7 +343,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, SIZEOF(Name));
+ _tcsncpy(Name, name, _countof(Name));
// set the data and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
@@ -364,14 +364,14 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if station ID appears first in the downloaded data
if ( !mir_tstrcmpi(sData->Multiple.First, _T("ID"))) {
GetDataValue(&sData->Multiple.ID, str, &szInfo);
- mir_sntprintf(sID, SIZEOF(sID), _T("%s/%s"), svc, str);
+ mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str);
GetDataValue(&sData->Multiple.Name, Name, &szInfo);
}
// if station name appears first in the downloaded data
else if ( !mir_tstrcmpi(sData->Multiple.First, _T("NAME"))) {
GetDataValue(&sData->Multiple.Name, Name, &szInfo);
GetDataValue(&sData->Multiple.ID, str, &szInfo);
- mir_sntprintf(sID, SIZEOF(sID), _T("%s/%s"), svc, str);
+ mir_sntprintf(sID, _countof(sID), _T("%s/%s"), svc, str);
}
else
break;
@@ -382,7 +382,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, SIZEOF(Name));
+ _tcsncpy(Name, name, _countof(Name));
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index bd99e5df8b..4aed6418df 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -30,7 +30,7 @@ static void OpenUrl( TCHAR* format, TCHAR* id )
TCHAR loc[512];
GetID( id );
- mir_sntprintf(loc, SIZEOF(loc), format, id);
+ mir_sntprintf(loc, _countof(loc), format, id);
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)loc );
}
@@ -59,10 +59,10 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam)
{
TCHAR id[256], loc2[256];
- GetStationID(wParam, id, SIZEOF(id));
+ GetStationID(wParam, id, _countof(id));
if (id[0] != 0) {
// check if the complte forecast URL is set. If it is not, display warning and quit
- if (DBGetStaticString(wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
+ if (DBGetStaticString(wParam, WEATHERPROTONAME, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) {
MessageBox(NULL, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
@@ -77,10 +77,10 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam)
INT_PTR WeatherMap(WPARAM wParam, LPARAM lParam)
{
TCHAR id[256], loc2[256];
- GetStationID(wParam, id, SIZEOF(id));
+ GetStationID(wParam, id, _countof(id));
if (id[0] != 0) {
// check if the weather map URL is set. If it is not, display warning and quit
- if (DBGetStaticString(wParam, WEATHERPROTONAME, "MapURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
+ if (DBGetStaticString(wParam, WEATHERPROTONAME, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) {
MessageBox(NULL, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
@@ -227,7 +227,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_ID:
// check if there are 2 parts in the ID (svc/id) seperated by "/"
// if not, don't let user change the setting
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
chop = _tcsstr(str, _T("/"));
if (chop == NULL)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
@@ -238,7 +238,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_NAME:
// check if station name is entered
// if not, don't let user change the setting
- GetDlgItemText(hwndDlg, IDC_NAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_NAME, str, _countof(str));
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), str[0] != 0);
break;
@@ -249,17 +249,17 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if ( !CheckSearch()) return TRUE; // don't download if update is in progress
// get the weather update data using the string in the ID field
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
GetSvc(str);
WIDATA *sData = GetWIData(str);
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
GetID(str);
// if ID search is available, do it
if (sData->IDSearch.Available) {
TCHAR *szData = NULL;
// load the page
- mir_snprintf(loc, SIZEOF(loc), sData->IDSearch.SearchURL, str);
+ mir_snprintf(loc, _countof(loc), sData->IDSearch.SearchURL, str);
str[0] = 0;
if (InternetDownloadFile(loc, NULL, sData->UserAgent, &szData) == 0) {
TCHAR *szInfo = szData;
@@ -285,23 +285,23 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_BROWSE: // fall through
// browse for the external log file
- GetDlgItemText(hwndDlg, IDC_LOG, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOG, str, _countof(str));
// Initialize OPENFILENAME
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = str;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
// set filters
- _tcsncpy(filter, TranslateT("Text Files"), SIZEOF(filter) - 1);
- mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(filter, TranslateT("Text Files"), _countof(filter) - 1);
+ mir_tstrncat(filter, _T(" (*.txt)"), _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter)+1;
- _tcsncpy(pfilter, _T("*.txt"), SIZEOF(filter) - 1);
+ _tcsncpy(pfilter, _T("*.txt"), _countof(filter) - 1);
pfilter = pfilter + mir_tstrlen(pfilter)+1;
- _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - 1);
- mir_tstrncat(pfilter, _T(" (*.*)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - 1);
+ mir_tstrncat(pfilter, _T(" (*.*)"), _countof(filter) - mir_tstrlen(filter));
pfilter = pfilter + mir_tstrlen(pfilter)+1;
- _tcsncpy(pfilter, _T("*.*"), SIZEOF(filter) - 1);
+ _tcsncpy(pfilter, _T("*.*"), _countof(filter) - 1);
pfilter = pfilter + mir_tstrlen(pfilter)+1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
@@ -320,23 +320,23 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_VIEW1:
// view the page for more info
- GetDlgItemText(hwndDlg, IDC_IURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_IURL, str, _countof(str));
if (str[0] == 0) return TRUE;
- GetDlgItemText(hwndDlg, IDC_ID, str2, SIZEOF(str2));
+ GetDlgItemText(hwndDlg, IDC_ID, str2, _countof(str2));
OpenUrl(str, str2);
break;
case IDC_VIEW2:
// view the page for weather map
- GetDlgItemText(hwndDlg, IDC_MURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_MURL, str, _countof(str));
if (str[0] == 0) return TRUE;
- GetDlgItemText(hwndDlg, IDC_ID, str2, SIZEOF(str2));
+ GetDlgItemText(hwndDlg, IDC_ID, str2, _countof(str2));
OpenUrl(str, str2);
break;
case IDC_RESET1:
// reset the more info url to service default
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
GetSvc(str);
sData = GetWIData(str);
SetDlgItemTextA(hwndDlg, IDC_IURL, sData->DefaultURL);
@@ -344,7 +344,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_RESET2:
// reset the weathe map url to service default
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
GetSvc(str);
sData = GetWIData(str);
SetDlgItemText(hwndDlg, IDC_MURL, sData->DefaultMap);
@@ -352,7 +352,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_SVCINFO:
// display the information of the ini file used by the weather station
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
GetSvc(str);
GetINIInfo(str);
break;
@@ -360,26 +360,26 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case IDC_CHANGE:
// temporary disable the protocol while applying the change
// start writing the new settings to database
- GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "ID", str);
if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFA)) { // if default station is set
mir_tstrcpy(opt.Default, str);
opt.DefStn = hContact;
db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
}
- GetDlgItemText(hwndDlg, IDC_NAME, city, SIZEOF(city));
+ GetDlgItemText(hwndDlg, IDC_NAME, city, _countof(city));
db_set_ts(hContact, WEATHERPROTONAME, "Nick", city);
- mir_sntprintf(str2, SIZEOF(str2), TranslateT("Current weather information for %s."), city);
+ mir_sntprintf(str2, _countof(str2), TranslateT("Current weather information for %s."), city);
if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) {
- GetDlgItemText(hwndDlg, IDC_LOG, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOG, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "Log", str);
}
else db_unset(hContact, WEATHERPROTONAME, "Log");
- GetDlgItemText(hwndDlg, IDC_IURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_IURL, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "InfoURL", str);
- GetDlgItemText(hwndDlg, IDC_MURL, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_MURL, str, _countof(str));
db_set_ts(hContact, WEATHERPROTONAME, "MapURL", str);
db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
@@ -452,12 +452,12 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam)
// if the station is not a default station, set it as the new default station
// this is the first weather station encountered from the search
if ( mir_tstrcmp(opt.Default, dbv.ptszVal)) {
- _tcsncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1);
+ _tcsncpy(opt.Default, dbv.ptszVal, _countof(opt.Default) - 1);
opt.DefStn = hContact;
db_free(&dbv);
if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
TCHAR str[255];
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp
index 64fa4fa6d6..22bd529140 100644
--- a/plugins/Weather/src/weather_conv.cpp
+++ b/plugins/Weather/src/weather_conv.cpp
@@ -107,7 +107,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
switch (opt.tUnit) {
case 1:
// rounding
- numToStr((temp-32)/9*5, tstr, SIZEOF(tstr));
+ numToStr((temp-32)/9*5, tstr, _countof(tstr));
if (opt.DoNotAppendUnit)
_tcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
@@ -115,7 +115,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
break;
case 2:
- numToStr(temp, tstr, SIZEOF(tstr));
+ numToStr(temp, tstr, _countof(tstr));
if (opt.DoNotAppendUnit)
_tcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
@@ -212,19 +212,19 @@ void GetSpeed(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
// convert to apporiate unit
switch (opt.wUnit) {
case 1:
- numToStr(tempunit * 3.6, tstr, SIZEOF(tstr));
+ numToStr(tempunit * 3.6, tstr, _countof(tstr));
mir_sntprintf(str, MAX_DATA_LEN, _T("%s %s"), tstr, opt.DoNotAppendUnit ? _T("") : TranslateT("km/h"));
break;
case 2:
- numToStr(tempunit, tstr, SIZEOF(tstr));
+ numToStr(tempunit, tstr, _countof(tstr));
mir_sntprintf(str, MAX_DATA_LEN, _T("%s %s"), tstr, opt.DoNotAppendUnit ? _T("") : TranslateT("m/s"));
break;
case 3:
- numToStr(tempunit / 0.44704, tstr, SIZEOF(tstr));
+ numToStr(tempunit / 0.44704, tstr, _countof(tstr));
mir_sntprintf(str, MAX_DATA_LEN, _T("%s %s"), tstr, opt.DoNotAppendUnit ? _T("") : TranslateT("mph"));
break;
case 4:
- numToStr(tempunit / 0.514444, tstr, SIZEOF(tstr));
+ numToStr(tempunit / 0.514444, tstr, _countof(tstr));
mir_sntprintf(str, MAX_DATA_LEN, _T("%s %s"), tstr, opt.DoNotAppendUnit ? _T("") : TranslateT("knots"));
break;
}
@@ -393,7 +393,7 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data)
do {
j++;
// using the format _T("# Weather <condition name> <counter> #"
- mir_sntprintf(LangPackStr, SIZEOF(LangPackStr), _T("# Weather %s %i #"), statusStr[i], j);
+ mir_sntprintf(LangPackStr, _countof(LangPackStr), _T("# Weather %s %i #"), statusStr[i], j);
_tcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE);
CharLowerBuff(LangPackStr1, (DWORD)mir_tstrlen(LangPackStr1));
if (_tcsstr(cond, LangPackStr1) != NULL)
@@ -522,7 +522,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
switch (chr) {
case 'c': mir_tstrcat(str, w->cond); break;
case 'd': // get the current date
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, lpzDate, SIZEOF(lpzDate));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, lpzDate, _countof(lpzDate));
mir_tstrcat(str, lpzDate); break;
case 'e': mir_tstrcat(str, w->dewpoint); break;
case 'f': mir_tstrcat(str, w->feel); break;
@@ -548,7 +548,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
name[0] = 0;
// read the entire variable name
while (dis[i] != ']' && i < mir_tstrlen(dis)) {
- mir_snprintf(temp, SIZEOF(temp), "%c", dis[i++]);
+ mir_snprintf(temp, _countof(temp), "%c", dis[i++]);
mir_strcat(name, temp);
}
// access the database to get its value
@@ -562,7 +562,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
}
// if the character is not a variable, write the original character to the new string
else {
- mir_sntprintf(lpzDate, SIZEOF(lpzDate), _T("%c"), dis[i]);
+ mir_sntprintf(lpzDate, _countof(lpzDate), _T("%c"), dis[i]);
mir_tstrcat(str, lpzDate);
} }
@@ -634,7 +634,7 @@ TCHAR *GetError(int code)
case 503: str = E503; break;
case 504: str = E504; break;
default:
- mir_sntprintf(str2, SIZEOF(str2), TranslateT("HTTP Error %i"), code);
+ mir_sntprintf(str2, _countof(str2), TranslateT("HTTP Error %i"), code);
str = str2;
break;
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index a5e9c5737d..b800bd0f94 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -47,38 +47,38 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact)
// if the string is not found in database, a value of "N/A" is stored in the field
WEATHERINFO winfo;
winfo.hContact = hContact;
- GetStationID(hContact, winfo.id, SIZEOF(winfo.id));
-
- if (DBGetStaticString(hContact, WEATHERPROTONAME, "Nick", winfo.city, SIZEOF(winfo.city)))
- _tcsncpy(winfo.city, NODATA, SIZEOF(winfo.city) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Update", winfo.update, SIZEOF(winfo.update)))
- _tcsncpy(winfo.update, NODATA, SIZEOF(winfo.update) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Condition", winfo.cond, SIZEOF(winfo.cond)))
- _tcsncpy(winfo.cond, NODATA, SIZEOF(winfo.cond) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Temperature", winfo.temp, SIZEOF(winfo.temp)))
- _tcsncpy(winfo.temp, NODATA, SIZEOF(winfo.temp) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "High", winfo.high, SIZEOF(winfo.high)))
- _tcsncpy(winfo.high, NODATA, SIZEOF(winfo.high) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Low", winfo.low, SIZEOF(winfo.low)))
- _tcsncpy(winfo.low, NODATA, SIZEOF(winfo.low) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunset", winfo.sunset, SIZEOF(winfo.sunset)))
- _tcsncpy(winfo.sunset, NODATA, SIZEOF(winfo.sunset) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunrise", winfo.sunrise, SIZEOF(winfo.sunrise)))
- _tcsncpy(winfo.sunrise, NODATA, SIZEOF(winfo.sunrise) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Speed", winfo.wind, SIZEOF(winfo.wind)))
- _tcsncpy(winfo.wind, NODATA, SIZEOF(winfo.wind) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Direction", winfo.winddir, SIZEOF(winfo.winddir)))
- _tcsncpy(winfo.winddir, NODATA, SIZEOF(winfo.winddir) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Dewpoint", winfo.dewpoint, SIZEOF(winfo.dewpoint)))
- _tcsncpy(winfo.dewpoint, NODATA, SIZEOF(winfo.dewpoint) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Pressure", winfo.pressure, SIZEOF(winfo.pressure)))
- _tcsncpy(winfo.pressure, NODATA, SIZEOF(winfo.pressure) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Visibility", winfo.vis, SIZEOF(winfo.vis)))
- _tcsncpy(winfo.vis, NODATA, SIZEOF(winfo.vis) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Humidity", winfo.humid, SIZEOF(winfo.humid)))
- _tcsncpy(winfo.humid, NODATA, SIZEOF(winfo.humid) - 1);
- if (DBGetStaticString(hContact, WEATHERCONDITION, "Feel", winfo.feel, SIZEOF(winfo.feel)))
- _tcsncpy(winfo.feel, NODATA, SIZEOF(winfo.feel) - 1);
+ GetStationID(hContact, winfo.id, _countof(winfo.id));
+
+ if (DBGetStaticString(hContact, WEATHERPROTONAME, "Nick", winfo.city, _countof(winfo.city)))
+ _tcsncpy(winfo.city, NODATA, _countof(winfo.city) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Update", winfo.update, _countof(winfo.update)))
+ _tcsncpy(winfo.update, NODATA, _countof(winfo.update) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Condition", winfo.cond, _countof(winfo.cond)))
+ _tcsncpy(winfo.cond, NODATA, _countof(winfo.cond) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Temperature", winfo.temp, _countof(winfo.temp)))
+ _tcsncpy(winfo.temp, NODATA, _countof(winfo.temp) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "High", winfo.high, _countof(winfo.high)))
+ _tcsncpy(winfo.high, NODATA, _countof(winfo.high) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Low", winfo.low, _countof(winfo.low)))
+ _tcsncpy(winfo.low, NODATA, _countof(winfo.low) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunset", winfo.sunset, _countof(winfo.sunset)))
+ _tcsncpy(winfo.sunset, NODATA, _countof(winfo.sunset) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunrise", winfo.sunrise, _countof(winfo.sunrise)))
+ _tcsncpy(winfo.sunrise, NODATA, _countof(winfo.sunrise) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Speed", winfo.wind, _countof(winfo.wind)))
+ _tcsncpy(winfo.wind, NODATA, _countof(winfo.wind) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Direction", winfo.winddir, _countof(winfo.winddir)))
+ _tcsncpy(winfo.winddir, NODATA, _countof(winfo.winddir) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Dewpoint", winfo.dewpoint, _countof(winfo.dewpoint)))
+ _tcsncpy(winfo.dewpoint, NODATA, _countof(winfo.dewpoint) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Pressure", winfo.pressure, _countof(winfo.pressure)))
+ _tcsncpy(winfo.pressure, NODATA, _countof(winfo.pressure) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Visibility", winfo.vis, _countof(winfo.vis)))
+ _tcsncpy(winfo.vis, NODATA, _countof(winfo.vis) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Humidity", winfo.humid, _countof(winfo.humid)))
+ _tcsncpy(winfo.humid, NODATA, _countof(winfo.humid) - 1);
+ if (DBGetStaticString(hContact, WEATHERCONDITION, "Feel", winfo.feel, _countof(winfo.feel)))
+ _tcsncpy(winfo.feel, NODATA, _countof(winfo.feel) - 1);
winfo.status = (WORD)db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
return winfo;
@@ -150,11 +150,11 @@ void EraseAllInfo()
// if no default station find, assign a new one
if (opt.Default[0] == 0) {
- GetStationID(hContact, opt.Default, SIZEOF(opt.Default));
+ GetStationID(hContact, opt.Default, _countof(opt.Default));
opt.DefStn = hContact;
if ( !db_get_ts(hContact,WEATHERPROTONAME, "Nick",&dbv)) {
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);
}
@@ -176,12 +176,12 @@ void EraseAllInfo()
// in case where the default station is missing
if (opt.DefStn == NULL && ContactCount != 0) {
if ( !db_get_ts(LastContact, WEATHERPROTONAME, "ID", &dbv)) {
- _tcsncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1);
+ _tcsncpy(opt.Default, dbv.ptszVal, _countof(opt.Default) - 1);
db_free(&dbv);
}
opt.DefStn = LastContact;
if ( !db_get_ts(LastContact,WEATHERPROTONAME, "Nick",&dbv)) {
- mir_sntprintf(str, SIZEOF(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
+ mir_sntprintf(str, _countof(str), TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);
}
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index add11a1e1c..f6258efb74 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -72,7 +72,7 @@ int InternetDownloadFile (char *szUrl, char *cookie, char *userAgent, TCHAR **sz
nlhr.szUrl = szUrl;
nlhr.nlc = hNetlibHttp;
nlhr.headers = headers;
- nlhr.headersCount = SIZEOF(headers);
+ nlhr.headersCount = _countof(headers);
if (cookie == NULL || cookie[0] == 0)
--nlhr.headersCount;
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp
index e4b548b37c..207bc0d338 100644
--- a/plugins/Weather/src/weather_icons.cpp
+++ b/plugins/Weather/src/weather_icons.cpp
@@ -39,19 +39,19 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(hInst, WEATHERPROTONAME, iconList, SIZEOF(iconList), WEATHERPROTONAME);
+ Icon_Register(hInst, WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", WEATHERPROTONAME, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", WEATHERPROTONAME, name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(const char* name)
{
- for (int i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < _countof(iconList); i++)
if (mir_strcmp(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp
index 39e41637c7..8065433f35 100644
--- a/plugins/Weather/src/weather_info.cpp
+++ b/plugins/Weather/src/weather_info.cpp
@@ -152,55 +152,55 @@ void GetINIInfo(TCHAR *pszSvc)
// if the service does not exist among the loaded INI's
if (sData == NULL)
{
- mir_sntprintf(str2, SIZEOF(str2), TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
+ mir_sntprintf(str2, _countof(str2), TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK|MB_ICONINFORMATION);
}
// if exist, get the information
else
{
- mir_sntprintf(str2, SIZEOF(str2), TranslateT("Weather INI information for \"%s\":"), pszSvc);
- mir_tstrncat(str2, _T("\n\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Name:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->DisplayName, SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Internal Name:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->InternalName, SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Author:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Author, SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Version:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t\t"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Version, SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("INI Version:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2));
+ mir_sntprintf(str2, _countof(str2), TranslateT("Weather INI information for \"%s\":"), pszSvc);
+ mir_tstrncat(str2, _T("\n\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Name:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t\t"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->DisplayName, _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Internal Name:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->InternalName, _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Author:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t\t"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->Author, _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Version:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t\t"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->Version, _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("INI Version:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t"), _countof(str2) - mir_tstrlen(str2));
switch (sData->InternalVer) {
- case 1: mir_tstrncat(str2, _T("1.0"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 2: mir_tstrncat(str2, _T("1.1"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 3: mir_tstrncat(str2, _T("1.1a"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 4: mir_tstrncat(str2, _T("1.2"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 5: mir_tstrncat(str2, _T("1.3"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 6: mir_tstrncat(str2, _T("1.4"), SIZEOF(str2) - mir_tstrlen(str2)); break;
- case 7: mir_tstrncat(str2, _T("1.5"), SIZEOF(str2) - mir_tstrlen(str2)); break;
+ case 1: mir_tstrncat(str2, _T("1.0"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 2: mir_tstrncat(str2, _T("1.1"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 3: mir_tstrncat(str2, _T("1.1a"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 4: mir_tstrncat(str2, _T("1.2"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 5: mir_tstrncat(str2, _T("1.3"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 6: mir_tstrncat(str2, _T("1.4"), _countof(str2) - mir_tstrlen(str2)); break;
+ case 7: mir_tstrncat(str2, _T("1.5"), _countof(str2) - mir_tstrlen(str2)); break;
}
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("File Name:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\t"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->ShortFileName, SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Item Count:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i\n"), str2, sData->UpdateDataCount);
- mir_tstrncat(str2, TranslateT("Memory Used:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_sntprintf(str2, SIZEOF(str2), _T("%s\t%i "), str2, sData->MemUsed);
- mir_tstrncat(str2, TranslateT("bytes"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, TranslateT("Description:"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, _T("\n"), SIZEOF(str2) - mir_tstrlen(str2));
- mir_tstrncat(str2, sData->Description, SIZEOF(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("File Name:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\t"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->ShortFileName, _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Item Count:"), _countof(str2) - mir_tstrlen(str2));
+ mir_sntprintf(str2, _countof(str2), _T("%s\t%i\n"), str2, sData->UpdateDataCount);
+ mir_tstrncat(str2, TranslateT("Memory Used:"), _countof(str2) - mir_tstrlen(str2));
+ mir_sntprintf(str2, _countof(str2), _T("%s\t%i "), str2, sData->MemUsed);
+ mir_tstrncat(str2, TranslateT("bytes"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, TranslateT("Description:"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, _T("\n"), _countof(str2) - mir_tstrlen(str2));
+ mir_tstrncat(str2, sData->Description, _countof(str2) - mir_tstrlen(str2));
// display the message box and quit
MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK|MB_ICONINFORMATION);
@@ -216,8 +216,8 @@ void MoreVarList(void)
TCHAR str[10240], tempstr[1024];
// heading
- _tcsncpy(str, VARS_LIST, SIZEOF(str) - 1);
- mir_tstrncat(str, _T("\n\n"), SIZEOF(str) - mir_tstrlen(str));
+ _tcsncpy(str, VARS_LIST, _countof(str) - 1);
+ mir_tstrncat(str, _T("\n\n"), _countof(str) - mir_tstrlen(str));
// loop through all weather services to find custom variables
for (WIDATALIST *Item = WIHead;Item != NULL;Item = Item->next)
{
@@ -227,12 +227,12 @@ void MoreVarList(void)
// the custom variable is defined as "%[<variable name>]"
// ignore the "hi" item and hidden items
if ( mir_tstrcmp(WItem->Item.Name, _T("Ignore")) && WItem->Item.Name[0] != '#') {
- mir_sntprintf(tempstr, SIZEOF(tempstr), _T("%c[%s]"), '%', WItem->Item.Name);
+ mir_sntprintf(tempstr, _countof(tempstr), _T("%c[%s]"), '%', WItem->Item.Name);
TCHAR* find = _tcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
if (find == NULL) {
- mir_tstrncat(str, tempstr, SIZEOF(str) - mir_tstrlen(str));
- mir_tstrncat(str, _T(", "), SIZEOF(str) - mir_tstrlen(str));
+ mir_tstrncat(str, tempstr, _countof(str) - mir_tstrlen(str));
+ mir_tstrncat(str, _T(", "), _countof(str) - mir_tstrlen(str));
}
}
}
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp
index 9e636102dd..c89472cb2c 100644
--- a/plugins/Weather/src/weather_ini.cpp
+++ b/plugins/Weather/src/weather_ini.cpp
@@ -178,12 +178,12 @@ bool LoadWIData(bool dial)
// find all *.ini file in the plugin\weather directory
TCHAR szSearchPath[MAX_PATH], FileName[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, SIZEOF(szSearchPath));
+ GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
TCHAR *chop = _tcsrchr(szSearchPath, '\\');
if (chop == NULL)
return false;
*chop = '\0';
- mir_tstrncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), SIZEOF(szSearchPath) - mir_tstrlen(szSearchPath));
+ mir_tstrncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), _countof(szSearchPath) - mir_tstrlen(szSearchPath));
_tcsncpy(FileName, szSearchPath, MAX_PATH - 1);
WIN32_FIND_DATA fd;
@@ -195,7 +195,7 @@ bool LoadWIData(bool dial)
do {
chop = _tcsrchr(FileName, '\\');
chop[1] = '\0';
- mir_tstrncat(FileName, fd.cFileName, SIZEOF(FileName) - mir_tstrlen(FileName));
+ mir_tstrncat(FileName, fd.cFileName, _countof(FileName) - mir_tstrlen(FileName));
if ( mir_tstrcmpi(fd.cFileName, _T("SAMPLE_INI.INI"))) {
WIDATA Data;
LoadStationData(FileName, fd.cFileName, &Data);
@@ -253,7 +253,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
FILE *pfile = _tfsopen(pszFile, _T("rt"), _SH_DENYWR);
if (pfile != NULL) {
char Line[4096];
- fgets(Line, SIZEOF(Line), pfile);
+ fgets(Line, _countof(Line), pfile);
TrimString(Line);
// make sure it is a valid weather protocol ini file
@@ -274,7 +274,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
else
{
TCHAR str[4096];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Invalid ini format for: %s"), pszFile);
+ mir_sntprintf(str, _countof(str), TranslateT("Invalid ini format for: %s"), pszFile);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONERROR);
fclose(pfile);
return;
@@ -338,7 +338,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
while (!feof(pfile)) {
// determine current tag
- if (fgets(Line, SIZEOF(Line), pfile) == NULL)
+ if (fgets(Line, _countof(Line), pfile) == NULL)
break;
TrimString(Line);
@@ -563,11 +563,11 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
case IDC_STEP2:
{
TCHAR szPath[1024];
- GetModuleFileName(GetModuleHandle(NULL), szPath, SIZEOF(szPath));
+ GetModuleFileName(GetModuleHandle(NULL), szPath, _countof(szPath));
TCHAR *chop = _tcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
- mir_tstrncat(szPath, _T("\\Plugins\\weather\\"), SIZEOF(szPath) - mir_tstrlen(szPath));
+ mir_tstrncat(szPath, _T("\\Plugins\\weather\\"), _countof(szPath) - mir_tstrlen(szPath));
_tmkdir(szPath);
ShellExecute((HWND)lParam, _T("open"), szPath, _T(""), _T(""), SW_SHOW);
}
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 921e1b7275..f1cee4e98b 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -252,7 +252,7 @@ static void addWindow(MCONTACT hContact)
db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv);
TCHAR winname[512];
- mir_sntprintf(winname, SIZEOF(winname), _T("Weather: %s"), dbv.ptszVal);
+ mir_sntprintf(winname, _countof(winname), _T("Weather: %s"), dbv.ptszVal);
db_free(&dbv);
HWND hWnd = CreateWindow( _T("WeatherFrame"), _T(""), WS_CHILD | WS_VISIBLE,
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index 77cc37b97a..691defdd08 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -373,14 +373,14 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
}
// get update time and remove the old timer
- GetDlgItemText(hdlg, IDC_UPDATETIME, str, SIZEOF(str));
+ GetDlgItemText(hdlg, IDC_UPDATETIME, str, _countof(str));
opt.UpdateTime = (WORD)_ttoi(str);
if (opt.UpdateTime < 1) opt.UpdateTime = 1;
KillTimer(NULL, timerId);
timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, (TIMERPROC)timerProc);
// other general options
- GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, SIZEOF(opt.DegreeSign));
+ GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, _countof(opt.DegreeSign));
opt.StartupUpdate = IsDlgButtonChecked(hdlg, IDC_STARTUPUPD);
opt.AutoUpdate = IsDlgButtonChecked(hdlg, IDC_UPDATE);
opt.NoProtoCondition = BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_PROTOCOND);
@@ -472,7 +472,7 @@ INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
SetWindowPos(hdlg, HWND_TOPMOST, rc.left, rc.top, 0, 0, SWP_NOSIZE);
TranslateDialogDefault(hdlg);
// generate the display text for variable list
- _tcsncpy(str, VAR_LIST_OPT, SIZEOF(str) - 1);
+ _tcsncpy(str, VAR_LIST_OPT, _countof(str) - 1);
SetDlgItemText(hdlg, IDC_VARLIST, str);
// make the more variable and other buttons flat
@@ -578,21 +578,21 @@ INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
// free memory for old settings
FreeTextVar();
// save new settings to memory
- GetDlgItemText(hdlg, IDC_CTEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_CTEXT, textstr, _countof(textstr));
wSetData(&opt.cText, textstr);
- GetDlgItemText(hdlg, IDC_BTEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_BTEXT, textstr, _countof(textstr));
wSetData(&opt.bText, textstr);
- GetDlgItemText(hdlg, IDC_BTITLE, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_BTITLE, textstr, _countof(textstr));
wSetData(&opt.bTitle, textstr);
- GetDlgItemText(hdlg, IDC_ETEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_ETEXT, textstr, _countof(textstr));
wSetData(&opt.eText, textstr);
- GetDlgItemText(hdlg, IDC_NTEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_NTEXT, textstr, _countof(textstr));
wSetData(&opt.nText, textstr);
- GetDlgItemText(hdlg, IDC_HTEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_HTEXT, textstr, _countof(textstr));
wSetData(&opt.hText, textstr);
- GetDlgItemText(hdlg, IDC_XTEXT, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_XTEXT, textstr, _countof(textstr));
wSetData(&opt.xText, textstr);
- GetDlgItemText(hdlg, IDC_BTITLE2, textstr, SIZEOF(textstr));
+ GetDlgItemText(hdlg, IDC_BTITLE2, textstr, _countof(textstr));
wSetData(&opt.sText, textstr);
SaveOptions();
UpdateAllInfo(0, 0);
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index 3b08a3c1a5..8e5397ac0d 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -79,8 +79,8 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
TCHAR str1[512], str2[512];
// get the 2 strings
- _tcsncpy(str1, tszMsg, SIZEOF(str1) - 1);
- _tcsncpy(str2, tszMsg, SIZEOF(str2) - 1);
+ _tcsncpy(str1, tszMsg, _countof(str1) - 1);
+ _tcsncpy(str2, tszMsg, _countof(str2) - 1);
TCHAR *chop = _tcschr(str1, 255);
if (chop != NULL)
*chop = '\0';
@@ -88,7 +88,7 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
str1[0] = 0;
chop = _tcschr(str2, 255);
if (chop != NULL)
- _tcsncpy(str2, chop+1, SIZEOF(str2) - 1);
+ _tcsncpy(str2, chop+1, _countof(str2) - 1);
else
str2[0] = 0;
@@ -222,7 +222,7 @@ void ReadPopupOpt(HWND hdlg)
opt.BGColour = SendDlgItemMessage(hdlg,IDC_BGCOLOUR,CPM_GETCOLOUR,0,0);
// get delay time
- GetDlgItemText(hdlg, IDC_DELAY, str, SIZEOF(str));
+ GetDlgItemText(hdlg, IDC_DELAY, str, _countof(str));
int num = _ttoi(str);
opt.pDelay = num;
@@ -237,9 +237,9 @@ void ReadPopupOpt(HWND hdlg)
// popup texts
wfree(&opt.pText);
wfree(&opt.pTitle);
- GetDlgItemText(hdlg, IDC_PText, text, SIZEOF(text));
+ GetDlgItemText(hdlg, IDC_PText, text, _countof(text));
wSetData(&opt.pText, text);
- GetDlgItemText(hdlg, IDC_PTitle, text, SIZEOF(text));
+ GetDlgItemText(hdlg, IDC_PTitle, text, _countof(text));
wSetData(&opt.pTitle, text);
}
@@ -261,9 +261,9 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
// click actions
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
- GetMenuString(hMenu1, opt.LeftClickAction, str, SIZEOF(str), MF_BYCOMMAND);
+ GetMenuString(hMenu1, opt.LeftClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_LeftClick, TranslateTS(str));
- GetMenuString(hMenu1, opt.RightClickAction, str, SIZEOF(str), MF_BYCOMMAND);
+ GetMenuString(hMenu1, opt.RightClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_RightClick, TranslateTS(str));
DestroyMenu(hMenu);
@@ -396,10 +396,10 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_VAR3:
// display variable list
- _tcsncpy(str, _T(" \n"),SIZEOF(str) - 1); // to make the message box wider
- mir_tstrncat(str, VAR_LIST_POPUP, SIZEOF(str) - mir_tstrlen(str));
- mir_tstrncat(str, _T("\n"), SIZEOF(str) - mir_tstrlen(str));
- mir_tstrncat(str, CUSTOM_VARS, SIZEOF(str) - mir_tstrlen(str));
+ _tcsncpy(str, _T(" \n"),_countof(str) - 1); // to make the message box wider
+ mir_tstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_tstrlen(str));
+ mir_tstrncat(str, _T("\n"), _countof(str) - mir_tstrlen(str));
+ mir_tstrncat(str, CUSTOM_VARS, _countof(str) - mir_tstrlen(str));
MessageBox(NULL, str, TranslateT("Variable List"), MB_OK|MB_ICONASTERISK|MB_TOPMOST);
break;
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index c5ce992c7e..93629e09cb 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -133,7 +133,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam)
unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, SIZEOF(szSearchPath));
+ GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
chop = _tcsrchr(szSearchPath, '\\');
if (chop) *chop = '\0';
@@ -148,12 +148,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam)
return GAIR_NOAVATAR;
pai->format = PA_FORMAT_PNG;
- mir_sntprintf(pai->filename, SIZEOF(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
+ mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
if ( _taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_GIF;
- mir_sntprintf(pai->filename, SIZEOF(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
+ mir_sntprintf(pai->filename, _countof(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
if ( _taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index afa00c84a2..5e45b69732 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -58,11 +58,11 @@ int UpdateWeather(MCONTACT hContact)
// error occurs if the return value is not equals to 0
if (opt.ShowWarnings) {
// show warnings by popup
- mir_sntprintf(str, SIZEOF(str) - 105,
+ mir_sntprintf(str, _countof(str) - 105,
TranslateT("Unable to retrieve weather information for %s"), dbv.ptszVal);
- mir_tstrncat(str, _T("\n"), SIZEOF(str) - mir_tstrlen(str));
+ mir_tstrncat(str, _T("\n"), _countof(str) - mir_tstrlen(str));
TCHAR *tszError = GetError(code);
- mir_tstrncat(str, tszError, SIZEOF(str) - mir_tstrlen(str));
+ mir_tstrncat(str, tszError, _countof(str) - mir_tstrlen(str));
WPShowMessage(str, SM_WARNING);
mir_free(tszError);
}
@@ -106,7 +106,7 @@ int UpdateWeather(MCONTACT hContact)
if (!dbres && dbv.ptszVal[0] != 0) {
if (opt.AlertPopup && !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0) && Ch) {
// display alert popup
- mir_sntprintf(str, SIZEOF(str), _T("Alert for %s%c%s"), winfo.city, 255, dbv.ptszVal);
+ mir_sntprintf(str, _countof(str), _T("Alert for %s%c%s"), winfo.city, 255, dbv.ptszVal);
WPShowMessage(str, SM_WEATHERALERT);
}
// alert issued, set display to italic
@@ -381,7 +381,7 @@ int GetWeatherData(MCONTACT hContact)
{
// get eacnh part of the id's
TCHAR id[256];
- GetStationID(hContact, id, SIZEOF(id));
+ GetStationID(hContact, id, _countof(id));
// test ID format
TCHAR* szInfo = _tcschr(id, '/');
@@ -391,7 +391,7 @@ int GetWeatherData(MCONTACT hContact)
GetID(id);
TCHAR Svc[256];
- GetStationID(hContact, Svc, SIZEOF(Svc));
+ GetStationID(hContact, Svc, _countof(Svc));
GetSvc(Svc);
// check for invalid station
@@ -409,19 +409,19 @@ int GetWeatherData(MCONTACT hContact)
// generate update URL
switch(i) {
case 0:
- mir_snprintf(loc, SIZEOF(loc), Data->UpdateURL, _T2A(id));
+ mir_snprintf(loc, _countof(loc), Data->UpdateURL, _T2A(id));
break;
case 1:
- mir_snprintf(loc, SIZEOF(loc), Data->UpdateURL2, _T2A(id));
+ mir_snprintf(loc, _countof(loc), Data->UpdateURL2, _T2A(id));
break;
case 2:
- mir_snprintf(loc, SIZEOF(loc), Data->UpdateURL3, _T2A(id));
+ mir_snprintf(loc, _countof(loc), Data->UpdateURL3, _T2A(id));
break;
case 3:
- mir_snprintf(loc, SIZEOF(loc), Data->UpdateURL4, _T2A(id));
+ mir_snprintf(loc, _countof(loc), Data->UpdateURL4, _T2A(id));
break;
default:
@@ -489,15 +489,15 @@ int GetWeatherData(MCONTACT hContact)
case '[': // variable, add the value to the result string
hasvar = TRUE;
if ( !DBGetData(hContact, _T2A(str2), &dbv)) {
- mir_tstrncat(DataValue, dbv.ptszVal, SIZEOF(DataValue) - mir_tstrlen(DataValue));
- DataValue[SIZEOF(DataValue)-1] = 0;
+ mir_tstrncat(DataValue, dbv.ptszVal, _countof(DataValue) - mir_tstrlen(DataValue));
+ DataValue[_countof(DataValue)-1] = 0;
db_free(&dbv);
}
break;
case'\"': // constant, add it to the result string
- mir_tstrncat(DataValue, TranslateTS(str2), SIZEOF(DataValue) - mir_tstrlen(DataValue));
- DataValue[SIZEOF(DataValue)-1] = 0;
+ mir_tstrncat(DataValue, TranslateTS(str2), _countof(DataValue) - mir_tstrlen(DataValue));
+ DataValue[_countof(DataValue)-1] = 0;
break;
}
@@ -513,8 +513,8 @@ int GetWeatherData(MCONTACT hContact)
// for the "Break Data=" operation
DBVARIANT dbv;
if ( !DBGetData(hContact, _T2A(Item->Item.Start), &dbv)) {
- _tcsncpy(DataValue, dbv.ptszVal, SIZEOF(DataValue));
- DataValue[SIZEOF(DataValue)-1] = 0;
+ _tcsncpy(DataValue, dbv.ptszVal, _countof(DataValue));
+ DataValue[_countof(DataValue)-1] = 0;
db_free(&dbv);
}
else {
@@ -549,7 +549,7 @@ int GetWeatherData(MCONTACT hContact)
// temporary workaround for mToolTip to show feel-like temperature
if ( !mir_tstrcmp(Item->Item.Name, _T("Feel")))
db_set_ts(hContact, WEATHERCONDITION, "Heat Index", DataValue);
- GetStationID(hContact, Svc, SIZEOF(Svc));
+ GetStationID(hContact, Svc, _countof(Svc));
if ( !mir_tstrcmp(Svc, opt.Default))
db_set_ts(NULL, DEFCURRENTWEATHER, _T2A(Item->Item.Name), DataValue);
if ( !mir_tstrcmp(Item->Item.Name, _T("Condition"))) {
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index af318beeb2..d5e57c977f 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -336,7 +336,7 @@ void LoadBriefInfoText(HWND hwndDlg, MCONTACT hContact)
winfo = LoadWeatherInfo(hContact);
// check if data exist. If not, display error message box
if ( !(BOOL)db_get_b(hContact, WEATHERPROTONAME, "IsUpdated", FALSE))
- _tcsncpy(str, WEATHER_NO_INFO, SIZEOF(str) - 1);
+ _tcsncpy(str, WEATHER_NO_INFO, _countof(str) - 1);
else
// set the display text and show the message box
GetDisplay(&winfo, opt.bText, str);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp
index 3df115a69a..936ebef921 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -145,7 +145,7 @@ extern "C" int __declspec(dllexport) Load()
// register netlib handle
char tempNdesc[50];
- mir_snprintf(tempNdesc, SIZEOF(tempNdesc), "%s connection settings", MODULENAME);
+ mir_snprintf(tempNdesc, _countof(tempNdesc), "%s connection settings", MODULENAME);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
@@ -231,7 +231,7 @@ extern "C" int __declspec(dllexport) Load()
mi.flags |= CMIF_KEEPUNTRANSLATED;
TCHAR countername[100];
- mir_sntprintf(countername, SIZEOF(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_sntprintf(countername, _countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.pszContactOwner = NULL;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index e040bac561..d58f6cfe91 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -73,7 +73,7 @@ void ChangeMenuItemCountdown()
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
TCHAR countername[100];
- mir_sntprintf(countername,SIZEOF(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_sntprintf(countername,_countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.ptszName = countername;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemCountdown, (LPARAM)&mi);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index feffb27c1f..5e1810cd89 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -116,7 +116,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam)
if( ((HANDLE)wParam) != NULL) {
DBVARIANT dbv;
db_get_ts(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
- mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
db_free(&dbv);
}
else mir_tstrcpy(ppd.lptzContactName, _T(MODULENAME));
@@ -126,9 +126,9 @@ int PopupAlert(WPARAM wParam, LPARAM lParam)
TCHAR *displaytext = (TCHAR*)lParam;
if ((mir_tstrlen(displaytext) == MAX_SECONDLINE) || (mir_tstrlen(displaytext) > MAX_SECONDLINE))
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext);
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), displaytext);
else if (mir_tstrlen(displaytext) < MAX_SECONDLINE)
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext);
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), displaytext);
if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) {
ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg);
@@ -161,15 +161,15 @@ int OSDAlert(WPARAM hContact, LPARAM lParam)
if (hContact != NULL) {
DBVARIANT dbv;
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
}
if (contactname[0] == 0)
- strncpy_s(contactname, SIZEOF(contactname), MODULENAME, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), MODULENAME, _TRUNCATE);
char *displaytext = (char*)lParam;
- mir_snprintf(newdisplaytext, SIZEOF(newdisplaytext), "%s: %s", contactname, Translate(displaytext));
+ mir_snprintf(newdisplaytext, _countof(newdisplaytext), "%s: %s", contactname, Translate(displaytext));
if (ServiceExists("OSD/Announce"))
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
@@ -188,11 +188,11 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam)
TCHAR *ptszContactName = pcli->pfnGetContactDisplayName(hContact, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s\n%s"), ptszContactName, displaytext);
+ mir_sntprintf(newdisplaytext, _countof(newdisplaytext), _T("%s\n%s"), ptszContactName, displaytext);
PUShowMessageT(newdisplaytext, SM_WARNING);
}
else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s: %s"), ptszContactName, TranslateTS(displaytext));
+ mir_sntprintf(newdisplaytext, _countof(newdisplaytext), _T("%s: %s"), ptszContactName, TranslateTS(displaytext));
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
@@ -220,7 +220,7 @@ void SaveToFile(MCONTACT hContact, char *truncated)
char url[300]; url[0] = '\0';
DBVARIANT dbv;
if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) {
- strncpy_s(url, SIZEOF(url), dbv.pszVal, _TRUNCATE);
+ strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -237,10 +237,10 @@ void SaveToFile(MCONTACT hContact, char *truncated)
time_t ftime = time(NULL);
struct tm *nTime = localtime(&ftime);
- mir_snprintf(timeprefix, SIZEOF(timeprefix), " %s ", Translate("Last updated on"));
+ mir_snprintf(timeprefix, _countof(timeprefix), " %s ", Translate("Last updated on"));
strftime(temptime1, 32, " %a, %b %d, %Y ", nTime);
strftime(temptime2, 32, " %I:%M %p.", nTime);
- mir_snprintf(timestring, SIZEOF(timestring), "(%s)%s\n%s,%s\n", MODULENAME, url, temptime1, temptime2);
+ mir_snprintf(timestring, _countof(timestring), "(%s)%s\n%s,%s\n", MODULENAME, url, temptime1, temptime2);
fputs(timestring, pfile);
fwrite(truncated, mir_strlen(truncated), 1, pfile);
@@ -272,7 +272,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
memset(&tempraw, 0, sizeof(tempraw));
memset(&raw, 0, sizeof(raw));
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ strncpy(tempraw, truncated, _countof(tempraw));
memset(&alertstring, 0, sizeof(alertstring));
memset(&Alerttempstring, 0, sizeof(Alerttempstring));
@@ -345,7 +345,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if (eventIndex == 0) { // string present
if (!db_get_s(hContact, MODULENAME, ALERT_STRING_KEY, &tdbv)) {
- strncpy_s(alertstring, SIZEOF(alertstring), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(alertstring, _countof(alertstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
if ((strstr(tempraw, alertstring)) != 0) { // // ENDALERT EVENT:CHECK FOR STRING
@@ -357,7 +357,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
//
if ((!notpresent)) {
if (alertIndex == 0) { // popup
- mir_sntprintf(displaystring, SIZEOF(displaystring), _T("%s \"%S\" %s."), Translate("The string"), alertstring, Translate("has been found on the web page"));
+ mir_sntprintf(displaystring, _countof(displaystring), _T("%s \"%S\" %s."), Translate("The string"), alertstring, Translate("has been found on the web page"));
WAlertPopup(hContact, displaystring);
// contactlist name//
@@ -397,7 +397,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
}
else if (alertIndex == 3) {
- mir_sntprintf(displaystring, SIZEOF(displaystring), _T("%s \"%s\" %s."), TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
+ mir_sntprintf(displaystring, _countof(displaystring), _T("%s \"%s\" %s."), TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
WAlertOSD(hContact, displaystring);
// contactlist name//
@@ -421,14 +421,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
else if (eventIndex == 1) { // webpage changed
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
@@ -516,11 +516,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if (eventIndex == 2) { // part of webpage changed
Alerttempstring[0] = Alerttempstring2[0] = 0;
if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &tdbv)) {
- strncpy_s(Alerttempstring, SIZEOF(Alerttempstring), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring, _countof(Alerttempstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
}
if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &tdbv)) {
- strncpy_s(Alerttempstring2, SIZEOF(Alerttempstring2), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring2, _countof(Alerttempstring2), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
}
@@ -633,14 +633,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
@@ -802,7 +802,7 @@ void ReadFromFile(void *param)
char contactname[100]; contactname[0] = 0;
if (!db_get_s(hContact, "CList", "MyHandle", &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp
index 67a4ee5a1d..11c7558f9c 100644
--- a/plugins/WebView/src/webview_cleanup.cpp
+++ b/plugins/WebView/src/webview_cleanup.cpp
@@ -788,7 +788,7 @@ void Removewhitespace(char *truncated)
void Filter(char *truncated)
{
char tempraw[MAXSIZE1];
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ strncpy(tempraw, truncated, _countof(tempraw));
for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t'))
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index 8857e78d1a..08c5d32ecd 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -58,13 +58,13 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
char *tempbuffer = (char*)malloc(len + 2);
GetDlgItemTextA(ParentHwnd, IDC_DATA, tempbuffer, len);
- strncpy(buff, tempbuffer, SIZEOF(buff));
+ strncpy(buff, tempbuffer, _countof(buff));
free(tempbuffer);
Filter(buff);
CharUpperBuffA(buff, (int)mir_strlen(buff));
- GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, SIZEOF(NewSearchstr));
+ GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, _countof(NewSearchstr));
CharUpperBuffA(NewSearchstr, (int)mir_strlen(NewSearchstr));
OLDstartposition = startposition;
@@ -125,8 +125,8 @@ static MCONTACT FindContactByUrl(HWND hwndDlg)
TCHAR urltext[300], titlebartxt[300];
int contactcount = 0;
- GetDlgItemText(hwndDlg, IDC_OPEN_URL, urltext, SIZEOF(urltext));
- GetWindowText(hwndDlg, titlebartxt, SIZEOF(titlebartxt));
+ GetDlgItemText(hwndDlg, IDC_OPEN_URL, urltext, _countof(urltext));
+ GetWindowText(hwndDlg, titlebartxt, _countof(titlebartxt));
for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
ptrT db1( db_get_tsa(hContact, MODULENAME, URL_KEY));
@@ -165,11 +165,11 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
_tcsncpy_s(url, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- SetDlgItemText(hwndDlg, IDC_OPEN_URL, FixButtonText(url, SIZEOF(url)));
+ SetDlgItemText(hwndDlg, IDC_OPEN_URL, FixButtonText(url, _countof(url)));
char preservename[100];
if (!db_get_s(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(preservename, SIZEOF(preservename), dbv.pszVal, _TRUNCATE);
+ strncpy_s(preservename, _countof(preservename), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
else preservename[0] = 0;
@@ -233,11 +233,11 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
HDC hdc = GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR));
SelectObject(hdc, (HFONT) SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, tszSizeString, SIZEOF(tszSizeString), &textSize);
+ GetTextExtentPoint32(hdc, tszSizeString, _countof(tszSizeString), &textSize);
int partWidth[2] = { textSize.cx, -1 };
ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
- SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, SIZEOF(partWidth), (LPARAM)partWidth);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, _countof(partWidth), (LPARAM)partWidth);
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0);
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
@@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_OPEN_URL:
- GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, SIZEOF(url));
+ GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, _countof(url));
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url);
db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE);
break;
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index a542e21c0a..9e38568dfa 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -77,7 +77,7 @@ void GetData(void *param)
}
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -87,17 +87,17 @@ void GetData(void *param)
db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1);
if (!db_get_s(hContact, MODULENAME, START_STRING_KEY, &dbv)) {
- strncpy_s(tempstring, SIZEOF(tempstring), dbv.pszVal, _TRUNCATE);
+ strncpy_s(tempstring, _countof(tempstring), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, END_STRING_KEY, &dbv)) {
- strncpy_s(tempstring2, SIZEOF(tempstring2), dbv.pszVal, _TRUNCATE);
+ strncpy_s(tempstring2, _countof(tempstring2), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) {
- strncpy_s(url, SIZEOF(url), dbv.pszVal, _TRUNCATE);
+ strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -287,9 +287,9 @@ void GetData(void *param)
strftime(temptime, 128, "(%b %d,%H:%M:%S)", nTime);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", temptime, dbv.pszVal);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", temptime, dbv.pszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", dbv.pszVal, temptime);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", dbv.pszVal, temptime);
db_free(&dbv);
}
else {
@@ -307,20 +307,20 @@ void GetData(void *param)
db_set_ts(hContact, MODULENAME, PRESERVE_NAME_KEY, dbv.ptszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", temptime, dbv.pszVal);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", temptime, dbv.pszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", dbv.pszVal, temptime);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", dbv.pszVal, temptime);
db_free(&dbv);
}
ftime = time(NULL);
nTime = localtime(&ftime);
- strncpy_s(timeprefix, SIZEOF(timeprefix), Translate("Last updated on"), _TRUNCATE);
- strncpy_s(timeat, SIZEOF(timeat), Translate("at the time"), _TRUNCATE);
+ strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
+ strncpy_s(timeat, _countof(timeat), Translate("at the time"), _TRUNCATE);
strftime(temptime1, 32, " %a, %b %d, %Y ", nTime);
strftime(temptime2, 32, " %I:%M %p.", nTime);
- mir_snprintf(timestring, SIZEOF(timestring), " %s %s%s%s", timeprefix, temptime1, timeat, temptime2);
+ mir_snprintf(timestring, _countof(timestring), " %s %s%s%s", timeprefix, temptime1, timeat, temptime2);
} // end download success
if (DownloadSuccess) {
@@ -334,15 +334,15 @@ void GetData(void *param)
eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
if (eventIndex == 2) {
- strncpy(buff, truncated, SIZEOF(buff));
+ strncpy(buff, truncated, _countof(buff));
Filter(buff);
if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) {
- strncpy_s(Alerttempstring, SIZEOF(Alerttempstring), dbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring, _countof(Alerttempstring), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &dbv)) {
- strncpy_s(Alerttempstring2, SIZEOF(Alerttempstring2), dbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring2, _countof(Alerttempstring2), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index c2d73b811e..68626d4cb1 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -64,7 +64,7 @@ TCHAR* FixButtonText(TCHAR *url, size_t len)
int posafter = (stringafter - buttontext) + 1;
strdel(stringafter, 1);
_tcsncpy_s(stringbefore, pos, buttontext, _TRUNCATE);
- mir_sntprintf(newbuttontext, SIZEOF(buttontext), _T("%s!!%s"), stringbefore, stringafter);
+ mir_sntprintf(newbuttontext, _countof(buttontext), _T("%s!!%s"), stringbefore, stringafter);
posafter = 0;
posbefore = 0;
@@ -202,7 +202,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
TCHAR str3[512];
POPUPDATAT ppd = { 0 };
- GetDlgItemText(hdlg, IDC_DELAY, str3, SIZEOF(str3));
+ GetDlgItemText(hdlg, IDC_DELAY, str3, _countof(str3));
if (IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)) {
BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0));
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int popupdelayval = 0;
TCHAR str2[512];
- GetDlgItemText(hdlg, IDC_DELAY, str2, SIZEOF(str2));
+ GetDlgItemText(hdlg, IDC_DELAY, str2, _countof(str2));
popupdelayval = _ttol(str2);
db_set_dw(NULL, MODULENAME, POP_DELAY_KEY, popupdelayval);
@@ -315,10 +315,10 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SetDlgItemText(hwndDlg, IDC_ALERT_TYPE, TranslateTS(AlertTypes[db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0)]));
SetDlgItemText(hwndDlg, IDC_EVENT_TYPE, TranslateTS(EventTypes[db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0)]));
- for (i = 0; i < SIZEOF(AlertTypes); i++)
+ for (i = 0; i < _countof(AlertTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(AlertTypes[i]));
- for (i = 0; i < SIZEOF(EventTypes); i++)
+ for (i = 0; i < _countof(EventTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(EventTypes[i]));
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) {
@@ -452,7 +452,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_BROWSE:
{
TCHAR szFileName[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, szFileName, SIZEOF(szFileName));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, szFileName, _countof(szFileName));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -461,7 +461,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ofn.lpstrFilter = _T("TEXT Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0");
ofn.lpstrFile = szFileName;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
- ofn.nMaxFile = SIZEOF(szFileName);
+ ofn.nMaxFile = _countof(szFileName);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
if (!GetSaveFileName(&ofn))
@@ -757,19 +757,19 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
}
- GetDlgItemText(hwndDlg, IDC_FILENAME, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, FILE_KEY, buf);
db_set_b(hContact, MODULENAME, APPEND_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND));
db_set_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_AS_RAW));
- GetDlgItemText(hwndDlg, IDC_ALERT_STRING, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_ALERT_STRING, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALERT_STRING_KEY, buf);
- GetDlgItemText(hwndDlg, IDC_START2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_START2, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, buf);
- GetDlgItemText(hwndDlg, IDC_END2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_END2, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALRT_E_STRING_KEY, buf);
db_set_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PREFIX));
@@ -929,10 +929,10 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR string[128];
hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_START, string, SIZEOF(string));
+ GetDlgItemText(hwndDlg, IDC_START, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, string);
- GetDlgItemText(hwndDlg, IDC_END, string, SIZEOF(string));
+ GetDlgItemText(hwndDlg, IDC_END, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_E_STRING_KEY, string);
db_set_w(hContact, MODULENAME, EVNT_INDEX_KEY, 2);
@@ -984,7 +984,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
}
- GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, SIZEOF(contactname));
+ GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, _countof(contactname));
if (_tcschr(contactname, '\\') != NULL) {
MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _T(MODULENAME), MB_OK);
break;
@@ -1024,17 +1024,17 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_URL, url, SIZEOF(url));
+ GetDlgItemText(hwndDlg, IDC_URL, url, _countof(url));
db_set_ts(hContact, MODULENAME, URL_KEY, url);
db_set_ts(hContact, MODULENAME, "Homepage", url);
- GetDlgItemText(hwndDlg, IDC_START, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_START, str, _countof(str));
db_set_ts(hContact, MODULENAME, START_STRING_KEY, str);
- GetDlgItemText(hwndDlg, IDC_END, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_END, str, _countof(str));
db_set_ts(hContact, MODULENAME, END_STRING_KEY, str);
- GetDlgItemText(hwndDlg, IDC_SITE_NAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_SITE_NAME, str, _countof(str));
db_set_ts(hContact, "CList", "MyHandle", str);
db_set_b(hContact, MODULENAME, DBLE_WIN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DBLE_WIN));
@@ -1043,7 +1043,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLEAN));
db_set_b(hContact, MODULENAME, RWSPACE_KEY, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_GETPOS, 0, 0)));
- SetDlgItemText(ParentHwnd, IDC_OPEN_URL, FixButtonText(url, SIZEOF(url)));
+ SetDlgItemText(ParentHwnd, IDC_OPEN_URL, FixButtonText(url, _countof(url)));
SetWindowText(ParentHwnd, str);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
@@ -1121,7 +1121,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
else SetDlgItemText(hwndDlg, IDC_TYPEFACE, Def_font_face);
- for (int i = 0; i < SIZEOF(fontSizes); i++)
+ for (int i = 0; i < _countof(fontSizes); i++)
SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)fontSizes[i]);
SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, wParam, 0);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
HDC hdc = GetDC(hwndDlg);
lf.lfCharSet = DEFAULT_CHARSET;
- GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, SIZEOF(lf.lfFaceName));
+ GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, _countof(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0);
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontScriptsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
@@ -1282,7 +1282,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
db_set_b(NULL, MODULENAME, DATA_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DATAPOPUP));
TCHAR str[100];
- GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, _countof(str));
db_set_ts(NULL, MODULENAME, FONT_FACE_KEY, str);
db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE)));
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 20196b0fd1..3bafe7c9b7 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -57,7 +57,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
else
nick[0] = 0;
- for (int i=0; i < SIZEOF(szInvalidChars); i++ ) {
+ for (int i=0; i < _countof(szInvalidChars); i++ ) {
TCHAR *p = _tcschr(nick, szInvalidChars[i]);
if (p != NULL) {
WErrorPopup((MCONTACT)"ERROR", TranslateT("Invalid symbol present in contact name."));
@@ -81,16 +81,16 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath);
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath);
CreateDirectory(cachedirectorypath, NULL);
TCHAR newcachepath[MAX_PATH + 50], renamedcachepath[MAX_PATH + 50];
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, oldName);
- mir_sntprintf(renamedcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, nick);
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, oldName);
+ mir_sntprintf(renamedcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, nick);
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
@@ -119,14 +119,14 @@ int SiteDeleted(WPARAM wParam, LPARAM lParam)
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath);
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath);
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, contactName);
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, contactName);
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
FILE *pcachefile = _tfopen(newcachepath, _T("r"));
@@ -144,12 +144,12 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM)
{
//GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend);
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend);
if( _taccess(cachedirectorypath, 0) != 0)
WErrorPopup((MCONTACT)"ERROR", TranslateT("Cache folder does not exist."));
@@ -172,7 +172,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam)
return 0;
TCHAR Cnick[200], *Oldnick;
- _tcsncpy(Cnick, url, SIZEOF(Cnick));
+ _tcsncpy(Cnick, url, _countof(Cnick));
if ((Oldnick = _tcsstr(Cnick, _T("://"))) != 0)
Oldnick += 3;
else
@@ -324,7 +324,7 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam)
if (searchId != -1)
return 0; // only one search at a time
- mir_tstrncpy(sID, (TCHAR*)lParam, SIZEOF(sID));
+ mir_tstrncpy(sID, (TCHAR*)lParam, _countof(sID));
searchId = 1;
// create a thread for the ID search
@@ -380,7 +380,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam)
//Convert url into a name for contact
TCHAR Cnick[255];
if (psr->nick.t != NULL)
- _tcsncpy(Cnick, psr->nick.t, SIZEOF(Cnick));
+ _tcsncpy(Cnick, psr->nick.t, _countof(Cnick));
else
Cnick[0] = 0;
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 8e9f057066..caa196e5d8 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -123,7 +123,7 @@ SIZE GetControlTextSize(HWND hCtrl)
const size_t maxSize = 2048;
TCHAR buffer[maxSize];
SIZE size;
- GetWindowText(hCtrl, buffer, SIZEOF(buffer));
+ GetWindowText(hCtrl, buffer, _countof(buffer));
GetTextExtentPoint32(hDC, buffer, (int)mir_tstrlen(buffer), &size);
SelectObject(hDC, oldFont);
ReleaseDC(hCtrl, hDC);
@@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
SetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer);
_itot(commonData.checkInterval, buffer, 10);
SetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
SetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer);
_itot(commonData.cSoundNearDays, buffer, 10);
SetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer);
@@ -306,22 +306,22 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
const int maxSize = 1024;
TCHAR buffer[maxSize];
- GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DAYS_IN_ADVANCE, buffer, _countof(buffer));
TCHAR *stop = NULL;
commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
- GetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DAYS_AFTER, buffer, _countof(buffer));
commonData.daysAfter = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
- GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_CHECK_INTERVAL, buffer, _countof(buffer));
commonData.checkInterval = _ttol(buffer);
if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
- GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_POPUP_TIMEOUT, buffer, _countof(buffer));
TCHAR *pos;
pos = _tcschr(buffer, _T('|'));
if (pos) {
@@ -338,12 +338,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
}
else commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
- GetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_SOUND_NEAR_DAYS_EDIT, buffer, _countof(buffer));
//cSoundNearDays = _ttol(buffer);
commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
- GetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer, SIZEOF(buffer));
+ GetDlgItemText(hWnd, IDC_DLG_TIMEOUT, buffer, _countof(buffer));
commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
@@ -419,7 +419,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
char *szProto = GetContactProto(hContact);
TCHAR buffer[2048];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Set birthday for %s:"), pcli->pfnGetContactDisplayName(hContact, 0));
SetWindowText(hWnd, buffer);
HWND hDate = GetDlgItem(hWnd, IDC_DATE);
@@ -443,7 +443,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case DOB_PROTOCOL:
DateTime_SetMonthCalColor(hDate, MCSC_TITLEBK, COLOR_PROTOCOL);
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%S protocol"), szProto);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("%S protocol"), szProto);
szCurrentModuleTooltip = buffer;
break;
@@ -544,8 +544,8 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam
TCHAR text1[maxSize];
TCHAR text2[maxSize];
long value1, value2;
- ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, SIZEOF(text1));
- ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, SIZEOF(text2));
+ ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, _countof(text1));
+ ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, _countof(text2));
int res = 0;
@@ -609,22 +609,22 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
TCHAR buffer[2048];
if ((dtb <= 366) && (dtb >= 0))
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), dtb);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), dtb);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 2, buffer);
if ((month != 0) && (day != 0))
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%04d-%02d-%02d"), year, month, day);
+ mir_sntprintf(buffer, _countof(buffer), _T("%04d-%02d-%02d"), year, month, day);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 3, buffer);
if (age < 400 && age > 0) //hopefully noone lives longer than this :)
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), age);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), age);
else
- mir_sntprintf(buffer, SIZEOF(buffer), NA);
+ mir_sntprintf(buffer, _countof(buffer), NA);
ListView_SetItemText(hList, entry, 4, buffer);
ListView_SetItemText(hList, entry, 5, GetBirthdayModule(module, hContact));
@@ -694,7 +694,7 @@ void SetBirthdaysCount(HWND hWnd)
{
int count = ListView_GetItemCount((GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST)));
TCHAR title[512];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Birthday list (%d)"), count);
+ mir_sntprintf(title, _countof(title), TranslateT("Birthday list (%d)"), count);
SetWindowText(hWnd, title);
}
@@ -881,7 +881,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
const int MAX_SIZE = 512;
TCHAR buffer[MAX_SIZE];
timeout--;
- mir_sntprintf(buffer, SIZEOF(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
+ mir_sntprintf(buffer, _countof(buffer), (timeout != 2) ? TranslateT("Closing in %d seconds") : TranslateT("Closing in %d second"), timeout);
SetDlgItemText(hWnd, IDC_CLOSE, buffer);
if (timeout <= 0)
@@ -914,9 +914,9 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
ListView_InsertItem(hList, &item);
TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->age);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), data->age);
ListView_SetItemText(hList, index, 1, buffer);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), data->dtb);
+ mir_sntprintf(buffer, _countof(buffer), _T("%d"), data->dtb);
ListView_SetItemText(hList, index, 2, buffer);
BirthdaysSortParams params = { 0 };
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index 6dd5157fb3..b9a7d9db7d 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -45,7 +45,7 @@ static HANDLE AddIcon(char *name, char *description, TCHAR *tszPath, int iDefaul
int AddIcons()
{
TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hInstance, tszPath, SIZEOF(tszPath));
+ GetModuleFileName(hInstance, tszPath, _countof(tszPath));
hCheckMenu = AddIcon("MenuCheck", LPGEN("Check birthdays menu item"), tszPath, IDI_CHECK);
hListMenu = AddIcon("MenuList", LPGEN("List birthdays menu item"), tszPath, IDI_LIST);
@@ -61,10 +61,10 @@ int AddIcons()
hDTB[1] = AddIcon("DTB1", LPGEN("1 day to birthday"), tszPath, IDI_DTB1);
for (int i = 2; i < cDTB; i++) {
mir_snprintf(name, "DTB%d", i);
- mir_snprintf(description, SIZEOF(description), Translate("%d days to birthday"), i);
+ mir_snprintf(description, _countof(description), Translate("%d days to birthday"), i);
hDTB[i] = AddIcon(name, description, tszPath, IDI_DTB0 + i);
}
- mir_snprintf(description, SIZEOF(description), Translate("More than %d days to birthday"), cDTB - 1);
+ mir_snprintf(description, _countof(description), Translate("More than %d days to birthday"), cDTB - 1);
hDTBMore = AddIcon("DTBMore", description, tszPath, IDI_DTBMORE);
hWWIExtraIcons = ExtraIcon_Register("WhenWasIt", LPGEN("WhenWasIt birthday reminder"), "MenuCheck");
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 79c518246d..4f2412143d 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -72,7 +72,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDTBText(dtb, name, text, SIZEOF(text));
+ BuildDTBText(dtb, name, text, _countof(text));
int gender = GetContactGender(hContact);
POPUPDATAT pd = { 0 };
@@ -116,7 +116,7 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDABText(dab, name, text, SIZEOF(text));
+ BuildDABText(dab, name, text, _countof(text));
int gender = GetContactGender(hContact);
POPUPDATAT pd = { 0 };
@@ -156,7 +156,7 @@ int DialogNotifyBirthday(MCONTACT hContact, int dtb, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDTBText(dtb, name, text, SIZEOF(text));
+ BuildDTBText(dtb, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
@@ -178,7 +178,7 @@ int DialogNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
TCHAR text[1024];
- BuildDABText(dab, name, text, SIZEOF(text));
+ BuildDABText(dab, name, text, _countof(text));
if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 3e392520c9..2130782dec 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -220,16 +220,16 @@ INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c"), TranslateT("Birthdays files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c"), TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = SIZEOF(fileName);
+ of.nMaxFile = _countof(fileName);
of.lpstrTitle = TranslateT("Please select a file to import birthdays from...");
of.Flags = OFN_FILEMUSTEXIST;
if (GetOpenFileName(&of)) {
TCHAR buffer[2048];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Importing birthdays from file: %s"), fileName);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Importing birthdays from file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hImportBirthdays);
DoImport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done importing birthdays"), hImportBirthdays);
@@ -245,10 +245,10 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
of.lStructSize = sizeof(OPENFILENAME);
//of.hInstance = hInstance;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = SIZEOF(fileName);
+ of.nMaxFile = _countof(fileName);
of.lpstrTitle = TranslateT("Please select a file to export birthdays to...");
if (GetSaveFileName(&of)) {
@@ -257,7 +257,7 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam)
if (!_tcschr(fn, _T('.')))
mir_tstrcat(fileName, _T(BIRTHDAY_EXTENSION));
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("Exporting birthdays to file: %s"), fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), buffer, hExportBirthdays);
DoExport(fileName);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Done exporting birthdays"), hExportBirthdays);
@@ -278,7 +278,7 @@ int DoImport(TCHAR *fileName)
while (!feof(fin)) {
TCHAR buffer[4096];
- _fgetts(buffer, SIZEOF(buffer), fin);
+ _fgetts(buffer, _countof(buffer), fin);
if (buffer[0] == _T(COMMENT_CHAR))
continue;
@@ -304,7 +304,7 @@ int DoImport(TCHAR *fileName)
}
else {
TCHAR tmp[2048];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
+ mir_sntprintf(tmp, _countof(tmp), TranslateT(NOTFOUND_FORMAT), szHandle, szProto);
ShowPopupMessage(TranslateT("Warning"), tmp, hImportBirthdays);
}
}
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index f8da4effb5..8c396b757f 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -155,17 +155,17 @@ TCHAR* GetContactID(MCONTACT hContact, char *szProto)
TCHAR tmp[16];
switch (ctInfo.type) {
case CNFT_BYTE:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.bVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.bVal);
buffer = _tcsdup(tmp);
break;
case CNFT_WORD:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.wVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.wVal);
buffer = _tcsdup(tmp);
break;
case CNFT_DWORD:
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%ld"), ctInfo.dVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%ld"), ctInfo.dVal);
buffer = _tcsdup(tmp);
break;
diff --git a/plugins/WhoUsesMyFiles/src/list.cpp b/plugins/WhoUsesMyFiles/src/list.cpp
index 48d4bf80e7..89246dc052 100644
--- a/plugins/WhoUsesMyFiles/src/list.cpp
+++ b/plugins/WhoUsesMyFiles/src/list.cpp
@@ -24,7 +24,7 @@ PWumf new_wumf( DWORD dwID,
case PERM_FILE_CREATE: mir_tstrcpy(w->szPerm, _T("Create"));break;
default: mir_tstrcpy(w->szPerm, _T("Execute"));
}
- mir_sntprintf(w->szID, SIZEOF(w->szID), _T("%i"), dwID);
+ mir_sntprintf(w->szID, _countof(w->szID), _T("%i"), dwID);
w->dwID = dwID;
w->dwSess = dwSess;
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp
index 034d84f460..3eb22eb46d 100644
--- a/plugins/WhoUsesMyFiles/src/wumf.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumf.cpp
@@ -148,7 +148,7 @@ void LogWumf(PWumf w)
hLogger = mir_createLog("wumf", _T("WhoIsUsingMyFiles log file"), WumfOptions.LogFile, 0);
if (hLogger == NULL) {
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), _T("Can't open log file %s"), WumfOptions.LogFile);
+ mir_sntprintf(str, _countof(str), _T("Can't open log file %s"), WumfOptions.LogFile);
MessageBox(NULL, str, TranslateT("Error opening file"), MB_OK | MB_ICONSTOP);
WumfOptions.LogToFile = FALSE;
return;
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
index 839d7b5752..3e7a5a1d9d 100644
--- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp
+++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp
@@ -119,7 +119,7 @@ void ShowWumfPopup(PWumf w)
TCHAR text[512], title[512];
if (!WumfOptions.AlertFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return;
- mir_sntprintf(title, SIZEOF(title), _T("%s (%s)"), w->szComp, w->szUser);
+ mir_sntprintf(title, _countof(title), _T("%s (%s)"), w->szComp, w->szUser);
mir_sntprintf(text, _T("%s (%s)"), w->szPath, w->szPerm);
ShowThePopup(w, title, text);
}
@@ -266,7 +266,7 @@ void ChooseFile(HWND hDlg)
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFilter = _T("All files (*.*)\0*.*\0Text files (*.txt)\0*.txt\0Log files (*.log)\0*.log\0\0");
ofn.nFilterIndex = 2;
ofn.Flags = OFN_CREATEPROMPT;
@@ -281,7 +281,7 @@ void ChooseFile(HWND hDlg)
}
else if (CommDlgExtendedError() != 0) {
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError());
+ mir_sntprintf(str, _countof(str), TranslateT("Common Dialog Error 0x%lx"), CommDlgExtendedError());
MessageBox(hDlg, str, TranslateT("Error"), MB_OK | MB_ICONSTOP);
}
}
@@ -413,7 +413,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_FILE:
- GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, SIZEOF(WumfOptions.LogFile));
+ GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, _countof(WumfOptions.LogFile));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -453,7 +453,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara
db_set_b(NULL, MODULENAME, ALERT_UNC, (BYTE)WumfOptions.AlertUNC);
db_set_b(NULL, MODULENAME, LOG_COMP, (BYTE)WumfOptions.LogComp);
db_set_b(NULL, MODULENAME, ALERT_COMP, (BYTE)WumfOptions.AlertComp);
- GetDlgItemText(hwndDlg, IDC_FILE, WumfOptions.LogFile, SIZEOF(WumfOptions.LogFile));
+ GetDlgItemText(hwndDlg, IDC_FILE, WumfOptions.LogFile, _countof(WumfOptions.LogFile));
db_set_ts(NULL, MODULENAME, OPT_FILE, WumfOptions.LogFile);
}
}
diff --git a/plugins/WinterSpeak/src/DialogConfigActive.cpp b/plugins/WinterSpeak/src/DialogConfigActive.cpp
index 479951b24e..925e03804a 100644
--- a/plugins/WinterSpeak/src/DialogConfigActive.cpp
+++ b/plugins/WinterSpeak/src/DialogConfigActive.cpp
@@ -164,7 +164,7 @@ void DialogConfigActive::load(HWND window)
ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_USERONLINE);
SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- for (int i=0; i < SIZEOF(hIcons); i++)
+ for (int i=0; i < _countof(hIcons); i++)
hIcons[i] = ImageList_GetIcon(hIml, 1+i, ILD_NORMAL);
SendDlgItemMessage(window, IDC_ALLICON, STM_SETICON, (WPARAM)hIcons[0], 0);
@@ -284,7 +284,7 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
while (hItem) {
hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (i=0; i < SIZEOF(iconOn); i++)
+ for (i=0; i < _countof(iconOn); i++)
if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i] = 0;
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
@@ -292,7 +292,7 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < _countof(iconOn); i++) {
iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i] = 0;
if (iImage != EMPTY_EXTRA_ICON)
@@ -301,7 +301,7 @@ void DialogConfigActive::SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HAN
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for (i=0; i < SIZEOF(iconOn); i++) {
+ for (i=0; i < _countof(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+3:0) : EMPTY_EXTRA_ICON));
if (groupChildCount) groupChildCount[i]+=childCount[i];
}
diff --git a/plugins/WinterSpeak/src/DialogConfigEngine.cpp b/plugins/WinterSpeak/src/DialogConfigEngine.cpp
index 07a3018118..b7c33c63eb 100644
--- a/plugins/WinterSpeak/src/DialogConfigEngine.cpp
+++ b/plugins/WinterSpeak/src/DialogConfigEngine.cpp
@@ -203,7 +203,7 @@ std::wstring DialogConfigEngine::getEngine(HWND window)
{
WCHAR *text = Hlp_GetDlgItemText(window, IDC_SELECT_ENGINE);
/*char text[100];
- GetDlgItemText(window, IDC_SELECT_ENGINE, mir_a2u(text), SIZEOF(text));*/
+ GetDlgItemText(window, IDC_SELECT_ENGINE, mir_a2u(text), _countof(text));*/
return text;
}
diff --git a/plugins/XSoundNotify/src/Common.h b/plugins/XSoundNotify/src/Common.h
index 2f31a6276e..16a60182fa 100644
--- a/plugins/XSoundNotify/src/Common.h
+++ b/plugins/XSoundNotify/src/Common.h
@@ -31,7 +31,7 @@ struct XSN_Data
__forceinline XSN_Data(MCONTACT _aContact, TCHAR *_path, BYTE _ignore) :
hContact(_aContact)
{
- _tcsncpy(path, _path, SIZEOF(path));
+ _tcsncpy(path, _path, _countof(path));
ignore = _ignore;
}
};
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp
index 00bb9d704f..68a86ced56 100644
--- a/plugins/XSoundNotify/src/dialog.cpp
+++ b/plugins/XSoundNotify/src/dialog.cpp
@@ -42,7 +42,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
TCHAR *nick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
TCHAR value[100];
- mir_sntprintf(value, SIZEOF(value), TranslateT("Custom sound for %s (%s)"), nick, uid);
+ mir_sntprintf(value, _countof(value), TranslateT("Custom sound for %s (%s)"), nick, uid);
SetWindowText(hwndDlg, value);
db_free(&dbvuid);
}
@@ -102,9 +102,9 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
ofn.lStructSize = sizeof(ofn);
TCHAR tmp[MAX_PATH];
if (GetModuleHandle(_T("bass_interface.dll")))
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
else
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
@@ -122,7 +122,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
if (p == NULL)
XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
else {
- _tcsncpy(p->path, FileName, SIZEOF(p->path));
+ _tcsncpy(p->path, FileName, _countof(p->path));
p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
}
EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE);
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp
index 8e414f6a24..8f70bf6c77 100644
--- a/plugins/XSoundNotify/src/options.cpp
+++ b/plugins/XSoundNotify/src/options.cpp
@@ -122,9 +122,9 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ofn.lStructSize = sizeof(ofn);
TCHAR tmp[MAX_PATH];
if (GetModuleHandle(_T("bass_interface.dll")))
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c"), TranslateT("Sound files"), 0, 0, 0);
else
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav)%c*.wav%c%c"), TranslateT("WAV files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = FileName;
@@ -144,7 +144,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0));
else
{
- _tcsncpy(p->path, FileName, SIZEOF(p->path));
+ _tcsncpy(p->path, FileName, _countof(p->path));
p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
}
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp
index e54db97808..e33b915fae 100644
--- a/plugins/XSoundNotify/src/xsn_main.cpp
+++ b/plugins/XSoundNotify/src/xsn_main.cpp
@@ -71,12 +71,12 @@ void InitSelfSounds()
Proto_EnumAccounts(&protoCount, &protos);
for (int i = 0; i < protoCount; i++) {
- for (int j = 0; j < SIZEOF(selfSounds); j++) {
+ for (int j = 0; j < _countof(selfSounds); j++) {
char namebuf[128];
- mir_snprintf(namebuf, SIZEOF(namebuf), "%s%s", protos[i]->szModuleName, selfSounds[j].szName);
+ mir_snprintf(namebuf, _countof(namebuf), "%s%s", protos[i]->szModuleName, selfSounds[j].szName);
TCHAR infobuf[256];
- mir_sntprintf(infobuf, SIZEOF(infobuf), _T("%s [%s]"), TranslateT("Self status"), protos[i]->tszAccountName);
+ mir_sntprintf(infobuf, _countof(infobuf), _T("%s [%s]"), TranslateT("Self status"), protos[i]->tszAccountName);
SkinAddNewSoundExT(namebuf, infobuf, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, selfSounds[j].iStatus, GSMDF_TCHAR));
}
}
@@ -86,7 +86,7 @@ static int ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
if (ack != 0 && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS) {
- for (int i = 0; i < SIZEOF(selfSounds); i++) {
+ for (int i = 0; i < _countof(selfSounds); i++) {
if (selfSounds[i].iStatus == ack->lParam) {
char buf[128];
mir_snprintf(buf, "%s%s", ack->szModule, selfSounds[i].szName);
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp
index f240832bee..4f15b8549c 100644
--- a/plugins/YAMN/src/account.cpp
+++ b/plugins/YAMN/src/account.cpp
@@ -227,7 +227,7 @@ DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugS
Finder=*Parser;
while((*Finder != (TCHAR)0) && (Finder<=End)) Finder++;
- mir_sntprintf(Debug, SIZEOF(Debug), _T("%s: %s,length is %d, remaining %d chars"), DebugString, *Parser, Finder-*Parser, End-Finder);
+ mir_sntprintf(Debug, _countof(Debug), _T("%s: %s,length is %d, remaining %d chars"), DebugString, *Parser, Finder-*Parser, End-Finder);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
if (Finder>=End)
return EACC_FILECOMPATIBILITY;
@@ -282,7 +282,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb
Finder=*Parser;
while((*Finder != (WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++;
- mir_sntprintf(Debug, SIZEOF(Debug), L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, (WCHAR *)End-Finder);
+ mir_sntprintf(Debug, _countof(Debug), L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, (WCHAR *)End-Finder);
MessageBoxW(NULL,Debug,L"debug",MB_OK);
if (Finder>=(WCHAR *)End)
return EACC_FILECOMPATIBILITY;
@@ -338,7 +338,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("NFlags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("NFlags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -347,7 +347,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupB: %04x, remaining %d chars"), Which->PopupB, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("PopupB: %04x, remaining %d chars"), Which->PopupB, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopupT = *(COLORREF *)(*Parser);
@@ -355,7 +355,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupT: %04x, remaining %d chars"), Which->PopupT, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("PopupT: %04x, remaining %d chars"), Which->PopupT, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopupTime = *(DWORD *)(*Parser);
@@ -363,7 +363,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupTime: %04x, remaining %d chars"), Which->PopupTime, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("PopupTime: %04x, remaining %d chars"), Which->PopupTime, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -513,7 +513,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("Port: %d, remaining %d chars"), Which->Server->Port, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("Port: %d, remaining %d chars"), Which->Server->Port, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
#ifdef DEBUG_FILEREAD
@@ -536,19 +536,19 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("Flags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("Flags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->StatusFlags = *(DWORD *)(*Parser);
(*Parser) += sizeof(DWORD);
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("STFlags: %04x, remaining %d chars"), Which->StatusFlags, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("STFlags: %04x, remaining %d chars"), Which->StatusFlags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PluginFlags = *(DWORD *)(*Parser);
(*Parser) += sizeof(DWORD);
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("PFlags: %04x, remaining %d chars"), Which->PluginFlags, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("PFlags: %04x, remaining %d chars"), Which->PluginFlags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -559,7 +559,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("Interval: %d, remaining %d chars"), Which->Interval, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("Interval: %d, remaining %d chars"), Which->Interval, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -602,7 +602,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("LastChecked: %04x, remaining %d chars"), Which->LastChecked, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("LastChecked: %04x, remaining %d chars"), Which->LastChecked, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSChecked = *(SYSTEMTIME *)(*Parser);
@@ -610,7 +610,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSChecked: %04x, remaining %d chars"), Which->LastSChecked, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("LastSChecked: %04x, remaining %d chars"), Which->LastSChecked, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSynchronised = *(SYSTEMTIME *)(*Parser);
@@ -618,7 +618,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSynchronised: %04x, remaining %d chars"), Which->LastSynchronised, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("LastSynchronised: %04x, remaining %d chars"), Which->LastSynchronised, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastMail = *(SYSTEMTIME *)(*Parser);
@@ -626,7 +626,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End)
if (*Parser > End) //WARNING! There's only > at the end of testing
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("LastMail: %04x, remaining %d chars"), Which->LastMail, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("LastMail: %04x, remaining %d chars"), Which->LastMail, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
if (*Parser == End)
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp
index 3de6b12064..87acfa97ac 100644
--- a/plugins/YAMN/src/browser/badconnect.cpp
+++ b/plugins/YAMN/src/browser/badconnect.cpp
@@ -119,7 +119,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP
BadConnectPopup.PluginWindowProc = BadConnectPopupProc;
BadConnectPopup.PluginData = ActualAccount;
- mir_tstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(BadConnectPopup.lptzContactName));
+ mir_tstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(BadConnectPopup.lptzContactName));
}
if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 5aeb0eda6c..1e4ba0ea3d 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -583,7 +583,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, struct CMailNu
SendMessageW(hListView, LVM_SETITEMTEXTW, (WPARAM)item.iItem, (LPARAM)&item);
item.iSubItem = 2;
- mir_sntprintf(SizeStr, SIZEOF(SizeStr), L"%d kB", msgq->MailData->Size / 1024);
+ mir_sntprintf(SizeStr, _countof(SizeStr), L"%d kB", msgq->MailData->Size / 1024);
item.pszText = SizeStr;
SendMessageW(hListView, LVM_SETITEMTEXTW, (WPARAM)item.iItem, (LPARAM)&item);
@@ -601,8 +601,8 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, struct CMailNu
}
if ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW)) {
- mir_tstrncpy(NewMailPopup.lptzContactName, FromStr, SIZEOF(NewMailPopup.lptzContactName));
- mir_tstrncpy(NewMailPopup.lptzText, UnicodeHeader.Subject, SIZEOF(NewMailPopup.lptzText));
+ mir_tstrncpy(NewMailPopup.lptzContactName, FromStr, _countof(NewMailPopup.lptzContactName));
+ mir_tstrncpy(NewMailPopup.lptzText, UnicodeHeader.Subject, _countof(NewMailPopup.lptzText));
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)malloc(sizeof(YAMN_MAILSHOWPARAM));
if (MailParam) {
@@ -654,7 +654,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun + MN->Virtual.PopupRun))
{
char sMsg[250];
- mir_snprintf(sMsg, SIZEOF(sMsg), Translate("%s : %d new mail message(s), %d total"), ActualAccount->Name, MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
+ mir_snprintf(sMsg, _countof(sMsg), Translate("%s : %d new mail message(s), %d total"), ActualAccount->Name, MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
if (!(nflags & YAMN_ACC_CONTNOEVENT)) {
CLISTEVENT cEvent;
cEvent.cbSize = sizeof(CLISTEVENT);
@@ -690,8 +690,8 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
NewMailPopup.PluginWindowProc = NewMailPopupProc;
NewMailPopup.PluginData = (void *)0; //multiple popups
- mir_tstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(NewMailPopup.lptzContactName));
- mir_sntprintf(NewMailPopup.lptzText, SIZEOF(NewMailPopup.lptzText), TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
+ mir_tstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NewMailPopup.lptzContactName));
+ mir_sntprintf(NewMailPopup.lptzText, _countof(NewMailPopup.lptzText), TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC);
PUAddPopupT(&NewMailPopup);
}
@@ -793,11 +793,11 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D
NoNewMailPopup.PluginWindowProc = NoNewMailPopupProc;
NoNewMailPopup.PluginData = (void *)0; //it's not new mail popup
- mir_tstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(NoNewMailPopup.lptzContactName));
+ mir_tstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lptzContactName));
if (MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC)
- mir_sntprintf(NoNewMailPopup.lptzText, SIZEOF(NoNewMailPopup.lptzText), TranslateT("No new mail message, %d spam(s)"), MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC);
+ mir_sntprintf(NoNewMailPopup.lptzText, _countof(NoNewMailPopup.lptzText), TranslateT("No new mail message, %d spam(s)"), MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC);
else
- mir_tstrncpy(NoNewMailPopup.lptzText, TranslateT("No new mail message"), SIZEOF(NoNewMailPopup.lptzText));
+ mir_tstrncpy(NoNewMailPopup.lptzText, TranslateT("No new mail message"), _countof(NoNewMailPopup.lptzText));
PUAddPopupT(&NoNewMailPopup);
}
@@ -1616,8 +1616,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
TCHAR headname[64] = { 0 }, headvalue[256] = { 0 };
for (courRow = 0; courRow < numRows; courRow++) {
if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue;
- ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
- ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
+ ListView_GetItemText(hList, courRow, 0, headname, _countof(headname));
+ ListView_GetItemText(hList, courRow, 1, headvalue, _countof(headvalue));
size_t headnamelen = mir_tstrlen(headname);
if (headnamelen) sizeNeeded += 1 + headnamelen;
sizeNeeded += 3 + mir_tstrlen(headvalue);
@@ -1629,8 +1629,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
int courPos = 0;
for (courRow = 0; courRow < numRows; courRow++) {
if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue;
- ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
- ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
+ ListView_GetItemText(hList, courRow, 0, headname, _countof(headname));
+ ListView_GetItemText(hList, courRow, 1, headvalue, _countof(headvalue));
if (mir_tstrlen(headname)) courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("%s:\t%s\r\n"), headname, headvalue);
else courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("\t%s\r\n"), headvalue);
}
@@ -2162,7 +2162,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR DeleteMsg[1024];
- mir_sntprintf(DeleteMsg, SIZEOF(DeleteMsg), TranslateT("Do you really want to delete %d selected mails?"), Total);
+ mir_sntprintf(DeleteMsg, _countof(DeleteMsg), TranslateT("Do you really want to delete %d selected mails?"), Total);
if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING))
{
struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL };
@@ -2401,10 +2401,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
TCHAR from[128] = { 0 }, subject[256] = { 0 }, size[16] = { 0 }, date[64] = { 0 };
for (courRow = 0; courRow < numRows; courRow++) {
if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue;
- ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
- ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
- ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
- ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
+ ListView_GetItemText(hList, courRow, 0, from, _countof(from));
+ ListView_GetItemText(hList, courRow, 1, subject, _countof(subject));
+ ListView_GetItemText(hList, courRow, 2, size, _countof(size));
+ ListView_GetItemText(hList, courRow, 3, date, _countof(date));
sizeNeeded += 5 + mir_tstrlen(from) + mir_tstrlen(subject) + mir_tstrlen(size) + mir_tstrlen(date);
}
if (sizeNeeded && OpenClipboard(hDlg)) {
@@ -2414,10 +2414,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
int courPos = 0;
for (courRow = 0; courRow < numRows; courRow++) {
if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue;
- ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
- ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
- ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
- ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
+ ListView_GetItemText(hList, courRow, 0, from, _countof(from));
+ ListView_GetItemText(hList, courRow, 1, subject, _countof(subject));
+ ListView_GetItemText(hList, courRow, 2, size, _countof(size));
+ ListView_GetItemText(hList, courRow, 3, date, _countof(date));
courPos += mir_sntprintf(&buff[courPos], sizeNeeded + 1, _T("%s\t%s\t%s\t%s\r\n"), from, subject, size, date);
}
GlobalUnlock(hData);
diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp
index e952e77256..99053b5c49 100644
--- a/plugins/YAMN/src/debug.cpp
+++ b/plugins/YAMN/src/debug.cpp
@@ -43,21 +43,21 @@ void InitDebug()
InitializeCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
- mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugSynchroFileName2, DebugUserDirectory);
+ mir_sntprintf(DebugFileName, _countof(DebugFileName), DebugSynchroFileName2, DebugUserDirectory);
SynchroFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(SynchroFile,"Synchro debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_COMM
- mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugCommFileName2, DebugUserDirectory);
+ mir_sntprintf(DebugFileName, _countof(DebugFileName), DebugCommFileName2, DebugUserDirectory);
CommFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(CommFile,"Communication debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_DECODE
- mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugDecodeFileName2, DebugUserDirectory);
+ mir_sntprintf(DebugFileName, _countof(DebugFileName), DebugDecodeFileName2, DebugUserDirectory);
DecodeFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(DecodeFile,"Decoding kernel debug file created by %s\n",YAMN_VER);
@@ -92,7 +92,7 @@ void DebugLog(HANDLE File,const char *fmt,...)
va_start(vararg,fmt);
str=(char *)malloc(strsize=65536);
- mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
+ mir_snprintf(tids, _countof(tids), "[%x]",GetCurrentThreadId());
while(mir_vsnprintf(str, strsize, fmt, vararg)==-1)
str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
@@ -113,7 +113,7 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...)
va_start(vararg,fmt);
str=(WCHAR *)malloc((strsize=65536)*sizeof(WCHAR));
- mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
+ mir_snprintf(tids, _countof(tids), "[%x]",GetCurrentThreadId());
while(mir_vsnwprintf(str, strsize, fmt, vararg)==-1)
str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp
index 320cda63ff..96c561808d 100644
--- a/plugins/YAMN/src/mails/decode.cpp
+++ b/plugins/YAMN/src/mails/decode.cpp
@@ -151,7 +151,7 @@ struct _tcptable CodePageNamesAll[]=
{ "MAC-", "CR",0,10082}
};
-int CPLENALL = SIZEOF(CodePageNamesAll);
+int CPLENALL = _countof(CodePageNamesAll);
struct _tcptable *CodePageNamesSupp;
int CPLENSUPP = 1;
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp
index aa0d0b0782..4dc0c5aefc 100644
--- a/plugins/YAMN/src/mails/mime.cpp
+++ b/plugins/YAMN/src/mails/mime.cpp
@@ -661,36 +661,36 @@ FailBackRaw:
for (i=0;i<numparts;i++) {
if (i) { // part before first boudary should not have headers
char infoline[1024]; size_t linesize = 0;
- mir_snprintf(infoline, SIZEOF(infoline), "%s %d", Translate("Part"), i);
+ mir_snprintf(infoline, _countof(infoline), "%s %d", Translate("Part"), i);
linesize = mir_strlen(infoline);
if (partData[i].TransEnc) {
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].TransEnc);
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", partData[i].TransEnc);
linesize = mir_strlen(infoline);
}
if (partData[i].ContType) {
char *CharSetStr=strchr(partData[i].ContType,';');
if (CharSetStr) {
CharSetStr[0]=0;
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType);
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", partData[i].ContType);
linesize = mir_strlen(infoline);
partData[i].ContType=CharSetStr+1;
if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", CharSetStr);
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
}
if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; \"%s\"", CharSetStr);
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; \"%s\"", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
}
}
else {
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType);
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", partData[i].ContType);
linesize = mir_strlen(infoline);
}
}
- mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, ".\r\n");
+ mir_snprintf(infoline + linesize, _countof(infoline) - linesize, ".\r\n");
{
WCHAR *temp=0;
dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet;
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp
index 0f5b14e4f1..fc5483e118 100644
--- a/plugins/YAMN/src/main.cpp
+++ b/plugins/YAMN/src/main.cpp
@@ -62,7 +62,7 @@ static void GetProfileDirectory(TCHAR *szPath, int cbPath)
//This is copied from Miranda's sources. In 0.2.1.0 it is needed, in newer vesions of Miranda use MS_DB_GETPROFILEPATH service
{
TCHAR tszOldPath[MAX_PATH];
- CallService(MS_DB_GETPROFILEPATHT, SIZEOF(tszOldPath), (LPARAM)tszOldPath);
+ CallService(MS_DB_GETPROFILEPATHT, _countof(tszOldPath), (LPARAM)tszOldPath);
mir_tstrcat(tszOldPath, _T("\\*.book"));
VARST ptszNewPath( _T("%miranda_userdata%"));
@@ -181,19 +181,19 @@ static IconItem iconList[] =
static void LoadIcons()
{
- Icon_Register(YAMNVar.hInst, "YAMN", iconList, SIZEOF(iconList));
+ Icon_Register(YAMNVar.hInst, "YAMN", iconList, _countof(iconList));
}
HANDLE WINAPI g_GetIconHandle( int idx )
{
- if ( idx >= SIZEOF(iconList))
+ if ( idx >= _countof(iconList))
return NULL;
return iconList[idx].hIcolib;
}
HICON WINAPI g_LoadIconEx( int idx, bool big )
{
- if ( idx >= SIZEOF(iconList))
+ if ( idx >= _countof(iconList))
return NULL;
return IcoLib_GetIcon(iconList[idx].szName, big);
}
@@ -206,7 +206,7 @@ void WINAPI g_ReleaseIcon( HICON hIcon )
static void LoadPlugins()
{
TCHAR szSearchPath[MAX_PATH];
- mir_sntprintf(szSearchPath, SIZEOF(szSearchPath), _T("%s\\Plugins\\YAMN\\*.dll"), szMirandaDir);
+ mir_sntprintf(szSearchPath, _countof(szSearchPath), _T("%s\\Plugins\\YAMN\\*.dll"), szMirandaDir);
hDllPlugins = NULL;
@@ -228,7 +228,7 @@ static void LoadPlugins()
continue;
TCHAR szPluginPath[MAX_PATH];
- mir_sntprintf(szPluginPath, SIZEOF(szPluginPath),_T("%s\\Plugins\\YAMN\\%s"), szMirandaDir, fd.cFileName);
+ mir_sntprintf(szPluginPath, _countof(szPluginPath),_T("%s\\Plugins\\YAMN\\%s"), szMirandaDir, fd.cFileName);
HINSTANCE hDll = LoadLibrary(szPluginPath);
if (hDll == NULL)
continue;
@@ -266,12 +266,12 @@ extern "C" int __declspec(dllexport) Load(void)
PathToAbsoluteT( _T("."), szMirandaDir);
// retrieve the current profile name
- CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn
+ CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn
TCHAR *fc = _tcsrchr(ProfileName, '.');
if ( fc != NULL ) *fc = 0;
// we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file
- GetProfileDirectory(UserDirectory, SIZEOF(UserDirectory));
+ GetProfileDirectory(UserDirectory, _countof(UserDirectory));
// Enumerate all the code pages available for the System Locale
EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp
index 221fbc2aaf..327b08b0c4 100644
--- a/plugins/YAMN/src/proto/netlib.cpp
+++ b/plugins/YAMN/src/proto/netlib.cpp
@@ -18,7 +18,7 @@ void __stdcall SSL_DebugLog(const char *fmt, ...)
va_list vararg;
va_start( vararg, fmt );
- int tBytes = mir_vsnprintf(str, SIZEOF(str), fmt, vararg);
+ int tBytes = mir_vsnprintf(str, _countof(str), fmt, vararg);
if ( tBytes == 0 )
return;
diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp
index f03a7d8a99..f75ad174c6 100644
--- a/plugins/YAMN/src/proto/pop3/pop3.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3.cpp
@@ -201,7 +201,7 @@ char* CPop3Client::User(char* name)
char query[128];
char *Result;
- mir_snprintf(query, SIZEOF(query), "USER %s\r\n", name);
+ mir_snprintf(query, _countof(query), "USER %s\r\n", name);
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
if (AckFlag==POP3_FERR)
@@ -220,7 +220,7 @@ char* CPop3Client::Pass(char* pw)
char query[128];
char *Result;
- mir_snprintf(query, SIZEOF(query), "PASS %s\r\n", pw);
+ mir_snprintf(query, _countof(query), "PASS %s\r\n", pw);
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
if (AckFlag==POP3_FERR)
@@ -246,9 +246,9 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp)
mir_md5_append(&ctx,(const unsigned char *)timestamp,(unsigned int)mir_strlen(timestamp));
mir_md5_append(&ctx,(const unsigned char *)pw,(unsigned int)mir_strlen(pw));
mir_md5_finish(&ctx, digest);
-
+
char hexdigest[40];
- mir_snprintf(query, SIZEOF(query), "APOP %s %s\r\n", name, bin2hex(digest, sizeof(digest), hexdigest));
+ mir_snprintf(query, _countof(query), "APOP %s %s\r\n", name, bin2hex(digest, sizeof(digest), hexdigest));
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
@@ -302,7 +302,7 @@ char* CPop3Client::Top(int nr, int lines)
char query[128];
- mir_snprintf(query, SIZEOF(query), "TOP %d %d\r\n", nr, lines);
+ mir_snprintf(query, _countof(query), "TOP %d %d\r\n", nr, lines);
NetClient->Send(query);
return RecvRest(NetClient->Recv(),POP3_SEARCHDOT);
}
@@ -318,11 +318,11 @@ char* CPop3Client::Uidl(int nr)
if (nr)
{
- mir_snprintf(query, SIZEOF(query), "UIDL %d\r\n", nr);
+ mir_snprintf(query, _countof(query), "UIDL %d\r\n", nr);
NetClient->Send(query);
return RecvRest(NetClient->Recv(),POP3_SEARCHACK);
}
- mir_snprintf(query, SIZEOF(query), "UIDL\r\n");
+ mir_snprintf(query, _countof(query), "UIDL\r\n");
NetClient->Send(query);
return RecvRest(NetClient->Recv(),POP3_SEARCHDOT);
}
@@ -336,7 +336,7 @@ char* CPop3Client::Dele(int nr)
char query[128];
- mir_snprintf(query, SIZEOF(query), "DELE %d\r\n", nr);
+ mir_snprintf(query, _countof(query), "DELE %d\r\n", nr);
NetClient->Send(query);
return RecvRest(NetClient->Recv(),POP3_SEARCHACK);
}
@@ -349,7 +349,7 @@ char* CPop3Client::Retr(int nr)
char query[128];
- mir_snprintf(query, SIZEOF(query), "RETR %d\r\n", nr);
+ mir_snprintf(query, _countof(query), "RETR %d\r\n", nr);
NetClient->Send(query);
RecvRest(NetClient->Recv(),POP3_SEARCHACK);
return NetClient->Recv();
diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp
index 90d9cd5fbf..edfcca0942 100644
--- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp
@@ -380,7 +380,7 @@ DWORD WINAPI ReadPOP3Options(HACCOUNT Which, char **Parser, char *End)
if (*Parser >= End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- mir_sntprintf(Debug, SIZEOF(Debug), _T("CodePage: %d, remaining %d chars"), ((HPOP3ACCOUNT)Which)->CP, End-*Parser);
+ mir_sntprintf(Debug, _countof(Debug), _T("CodePage: %d, remaining %d chars"), ((HPOP3ACCOUNT)Which)->CP, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
return 0;
@@ -713,7 +713,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != NULL; NewMsgsPtr = NewMsgsPtr->Next) {
if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) {
TCHAR accstatus[512];
- mir_sntprintf(accstatus, SIZEOF(accstatus), TranslateT("Reading body %s"), NewMsgsPtr->ID);
+ mir_sntprintf(accstatus, _countof(accstatus), TranslateT("Reading body %s"), NewMsgsPtr->ID);
SetAccountStatus(ActualAccount, accstatus);
DataRX = MyClient->Top(MsgQueuePtr->Number, 100);
#ifdef DEBUG_DECODE
@@ -786,7 +786,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
{
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY) != 0;
DataRX = MyClient->Top(MsgQueuePtr->Number, autoretr ? 100 : 0);
- mir_sntprintf(accstatus, SIZEOF(accstatus), TranslateT("Reading new mail messages (%d%% done)"), 100 * i / msgs);
+ mir_sntprintf(accstatus, _countof(accstatus), TranslateT("Reading new mail messages (%d%% done)"), 100 * i / msgs);
SetAccountStatus(ActualAccount, accstatus);
#ifdef DEBUG_DECODE
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
index 76d45d294a..4aaf1db2c1 100644
--- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
@@ -119,7 +119,7 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam
case IDC_STWWW:
{
char str[1024];
- GetDlgItemTextA(hDlg,IDC_STWWW,str,SIZEOF(str));
+ GetDlgItemTextA(hDlg,IDC_STWWW,str,_countof(str));
CallService(MS_UTILS_OPENURL,OUF_NEWWINDOW,(LPARAM)str);
break;
}
@@ -721,7 +721,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
case WM_YAMN_CHANGETIME:
if ((HPOP3ACCOUNT)wParam == ActualAccount) {
TCHAR Text[256];
- mir_sntprintf(Text,SIZEOF(Text),TranslateT("Time left to next check [s]: %d"),(DWORD)lParam);
+ mir_sntprintf(Text,_countof(Text),TranslateT("Time left to next check [s]: %d"),(DWORD)lParam);
SetDlgItemText(hDlg,IDC_STTIMELEFT,Text);
}
return TRUE;
@@ -734,14 +734,14 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
ActualAccount=NULL;
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
- if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput)))
+ if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,_countof(DlgInput)))
DlgEnableAccount(hDlg,TRUE,FALSE);
else
DlgEnableAccount(hDlg,FALSE,FALSE);
break;
case CBN_KILLFOCUS:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,_countof(DlgInput));
if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))) {
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
@@ -864,7 +864,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
case IDC_BTNAPP:
{
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c"),
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c"),
TranslateT("Executables"), 0, 0, TranslateT("All Files"), 0, 0);
OPENFILENAME OFNStruct = { 0 };
@@ -892,7 +892,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
break;
case IDC_BTNDEL:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,_countof(DlgInput));
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
if ((CB_ERR==(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
|| (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
@@ -939,7 +939,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
size_t Length,index;
UINT Port,Interval;
- if ( GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT, Text, SIZEOF(Text))) {
+ if ( GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT, Text, _countof(Text))) {
Check = (IsDlgButtonChecked(hDlg,IDC_CHECK)==BST_CHECKED);
CheckSSL = (IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
CheckNoTLS = (IsDlgButtonChecked(hDlg,IDC_CHECKNOTLS)==BST_CHECKED);
@@ -975,15 +975,15 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
break;
}
- GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, SIZEOF(Text));
+ GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, _countof(Text));
if (CheckApp && !(Length = mir_strlen(Text))) {
MessageBox(hDlg,TranslateT("Please select application to run"),TranslateT("Input error"),MB_OK);
break;
}
- GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, SIZEOF(Text));
+ GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, _countof(Text));
if ( !( Length = mir_strlen(Text))) {
- GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, SIZEOF(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, _countof(Text));
if ( !(Length = mir_strlen( Text )))
break;
}
@@ -1036,7 +1036,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write enter\n");
#endif
- GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, SIZEOF(Text));
+ GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, _countof(Text));
if ( !(Length = mir_strlen( Text )))
break;
if (NULL != ActualAccount->Name)
@@ -1044,31 +1044,31 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
ActualAccount->Name = new char[ mir_strlen(Text)+1];
mir_strcpy(ActualAccount->Name,Text);
- GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,SIZEOF(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,_countof(Text));
if (NULL != ActualAccount->Server->Name)
delete[] ActualAccount->Server->Name;
ActualAccount->Server->Name=new char[ mir_strlen(Text)+1];
mir_strcpy(ActualAccount->Server->Name,Text);
- GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,SIZEOF(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,_countof(Text));
if (NULL != ActualAccount->Server->Login)
delete[] ActualAccount->Server->Login;
ActualAccount->Server->Login=new char[ mir_strlen(Text)+1];
mir_strcpy(ActualAccount->Server->Login,Text);
- GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,SIZEOF(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,_countof(Text));
if (NULL != ActualAccount->Server->Passwd)
delete[] ActualAccount->Server->Passwd;
ActualAccount->Server->Passwd=new char[ mir_strlen(Text)+1];
mir_strcpy(ActualAccount->Server->Passwd,Text);
- GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,SIZEOF(TextW));
+ GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,_countof(TextW));
if (NULL != ActualAccount->NewMailN.App)
delete[] ActualAccount->NewMailN.App;
ActualAccount->NewMailN.App=new WCHAR[mir_wstrlen(TextW)+1];
mir_wstrcpy(ActualAccount->NewMailN.App,TextW);
- GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,SIZEOF(TextW));
+ GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,_countof(TextW));
if (NULL != ActualAccount->NewMailN.AppParam)
delete[] ActualAccount->NewMailN.AppParam;
ActualAccount->NewMailN.AppParam=new WCHAR[mir_wstrlen(TextW)+1];
@@ -1258,7 +1258,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
case CBN_KILLFOCUS:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,_countof(DlgInput));
if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
@@ -1434,7 +1434,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
BOOL CheckPopN;
UINT Time,TimeN,TimeF;
- if (GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,SIZEOF(Text)))
+ if (GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,_countof(Text)))
{
CheckPopup = (IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED);
CheckPopupW = (IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp
index f98482dcdd..5f6a95b7c8 100644
--- a/plugins/YAPP/src/yapp_history_dlg.cpp
+++ b/plugins/YAPP/src/yapp_history_dlg.cpp
@@ -184,8 +184,8 @@ int CALLBACK PopupsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam)
TCHAR text2[MAX_SIZE];
int res;
- ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, SIZEOF(text1));
- ListView_GetItemText(params.hList, (int) lParam2, params.column, text2, SIZEOF(text2));
+ ListView_GetItemText(params.hList, (int) lParam1, params.column, text1, _countof(text1));
+ ListView_GetItemText(params.hList, (int) lParam2, params.column, text2, _countof(text2));
res = mir_tstrcmpi(text1, text2);
@@ -440,7 +440,7 @@ void RefreshPopupHistory(HWND hWnd, int renderer)
TCHAR filter[MAX_FILTER_SIZE];
DeleteOldEvents(hWnd, renderer); //delete events
- GetDlgItemText(hWnd, IDC_HISTORY_FILTER, filter, SIZEOF(filter)); //get filter text
+ GetDlgItemText(hWnd, IDC_HISTORY_FILTER, filter, _countof(filter)); //get filter text
AddEvents(hWnd, renderer, filter, MatchesFilter);
@@ -481,7 +481,7 @@ void CopyPopupDataToClipboard(HWND hList, int selection)
{
if (ListView_GetItemState(hList, i, LVIS_SELECTED))
{
- ListView_GetItemText(hList, i, selection - 100, buffer, SIZEOF(buffer));
+ ListView_GetItemText(hList, i, selection - 100, buffer, _countof(buffer));
found = 1;
break;
}
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp
index 9539f80349..8bcd350b40 100644
--- a/plugins/YARelay/src/main.cpp
+++ b/plugins/YARelay/src/main.cpp
@@ -241,7 +241,7 @@ extern "C" int __declspec(dllexport) Load()
TCHAR *szForwardTemplate = db_get_tsa(NULL, "yaRelay", "ForwardTemplate");
if (szForwardTemplate){
- _tcsncpy(tszForwardTemplate, szForwardTemplate, SIZEOF(tszForwardTemplate));
+ _tcsncpy(tszForwardTemplate, szForwardTemplate, _countof(tszForwardTemplate));
mir_free(szForwardTemplate);
}
else _tcsncpy(tszForwardTemplate, _T("%u: %m"), MAXTEMPLATESIZE-1);
diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp
index 3215b2eb94..198905d6e1 100644
--- a/plugins/YARelay/src/options.cpp
+++ b/plugins/YARelay/src/options.cpp
@@ -159,7 +159,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK6) == BST_CHECKED) iForwardOnStatus |= STATUS_DND;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK7) == BST_CHECKED) iForwardOnStatus |= STATUS_FREECHAT;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK8) == BST_CHECKED) iForwardOnStatus |= STATUS_INVISIBLE;
- GetDlgItemText(hwndDlg, IDC_EDIT_TEMPLATE, tszForwardTemplate, SIZEOF(tszForwardTemplate));
+ GetDlgItemText(hwndDlg, IDC_EDIT_TEMPLATE, tszForwardTemplate, _countof(tszForwardTemplate));
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_SPLIT) == BST_CHECKED) iSplit = 1; else iSplit = 0;
iSplitMaxSize = GetDlgItemInt(hwndDlg, IDC_EDIT_MAXSIZE, NULL, FALSE);
iSendParts = GetDlgItemInt(hwndDlg, IDC_EDIT_SENDPARTS, NULL, FALSE);
diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp
index fe79736be4..8bb381621f 100644
--- a/plugins/YahooGroups/src/services.cpp
+++ b/plugins/YahooGroups/src/services.cpp
@@ -95,7 +95,7 @@ void AddNewGroup(const char *newGroup)
char group[1024];
*group = 1;
- strncpy_s((group + 1), (SIZEOF(group) - 1), newGroup, _TRUNCATE);
+ strncpy_s((group + 1), (_countof(group) - 1), newGroup, _TRUNCATE);
mir_snprintf(tmp, "%d", index);
const int MAX_SIZE = 1024;
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp
index 9f6f63d865..f4dd3fd7c1 100644
--- a/plugins/YahooGroups/src/utils.cpp
+++ b/plugins/YahooGroups/src/utils.cpp
@@ -271,7 +271,7 @@ TCHAR *GetContactID(MCONTACT hContact, char *szProto)
{
case CNFT_BYTE:
{
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.bVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.bVal);
buffer = _tcsdup(tmp);
break;
@@ -279,7 +279,7 @@ TCHAR *GetContactID(MCONTACT hContact, char *szProto)
case CNFT_WORD:
{
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), ctInfo.wVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%d"), ctInfo.wVal);
buffer = _tcsdup(tmp);
break;
@@ -287,7 +287,7 @@ TCHAR *GetContactID(MCONTACT hContact, char *szProto)
case CNFT_DWORD:
{
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%ld"), ctInfo.dVal);
+ mir_sntprintf(tmp, _countof(tmp), _T("%ld"), ctInfo.dVal);
buffer = _tcsdup(tmp);
break;
@@ -327,7 +327,7 @@ MCONTACT GetContactFromID(TCHAR *szID, char *szProto)
szHandle = GetContactID(hContact, cProtocol);
tmp = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
- _tcsncpy(dispName, tmp, SIZEOF(dispName));
+ _tcsncpy(dispName, tmp, _countof(dispName));
if ((szHandle) && ((mir_tstrcmpi(szHandle, szID) == 0) || (mir_tstrcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0)))
found = 1;
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp
index dae6100000..575d8d203b 100644
--- a/plugins/helpers/gen_helpers.cpp
+++ b/plugins/helpers/gen_helpers.cpp
@@ -82,12 +82,12 @@ int AddDebugLogMessageA(const char* fmt, ...)
va_list va;
va_start(va, fmt);
- mir_vsnprintf(szText, SIZEOF(szText), fmt, va);
+ mir_vsnprintf(szText, _countof(szText), fmt, va);
va_end(va);
#ifdef MODULENAME
- mir_snprintf(szFinal, SIZEOF(szFinal), "%s: %s", MODULENAME, szText);
+ mir_snprintf(szFinal, _countof(szFinal), "%s: %s", MODULENAME, szText);
#else
- strncpy(szFinal, szText, SIZEOF(szFinal));
+ strncpy(szFinal, szText, _countof(szFinal));
#endif
res = WriteToDebugLogA(szFinal);
@@ -103,12 +103,12 @@ int AddDebugLogMessage(const TCHAR* fmt, ...)
va_list va;
va_start(va, fmt);
- mir_vsntprintf(tszText, SIZEOF(tszText), fmt, va);
+ mir_vsntprintf(tszText, _countof(tszText), fmt, va);
va_end(va);
#ifdef MODULENAME
- mir_sntprintf(tszFinal, SIZEOF(tszFinal), _T("%s: %s"), MODULENAME, tszText);
+ mir_sntprintf(tszFinal, _countof(tszFinal), _T("%s: %s"), MODULENAME, tszText);
#else
- _tcsncpy(tszFinal, tszText, SIZEOF(tszFinal));
+ _tcsncpy(tszFinal, tszText, _countof(tszFinal));
#endif
diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp
index 41dc7b5e14..ed6616f903 100644
--- a/plugins/mTextControl/src/FormattedTextDraw.cpp
+++ b/plugins/mTextControl/src/FormattedTextDraw.cpp
@@ -120,7 +120,7 @@ HRESULT CFormattedTextDraw::putTextA(char *newVal)
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_BOLD;
cf.dwEffects = 0;
- mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), _T("MS Shell Dlg"));
+ mir_sntprintf(cf.szFaceName, _countof(cf.szFaceName), _T("MS Shell Dlg"));
m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult);
return S_OK;
@@ -148,7 +148,7 @@ HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal)
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_BOLD;
cf.dwEffects = 0;
- mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), _T("MS Shell Dlg"));
+ mir_sntprintf(cf.szFaceName, _countof(cf.szFaceName), _T("MS Shell Dlg"));
m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult);
return S_OK;
}
@@ -170,7 +170,7 @@ HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc)
cf.crTextColor = GetTextColor((HDC)hdcDraw);
cf.bCharSet = lf.lfCharSet;
cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY);
- mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), lf.lfFaceName);
+ mir_sntprintf(cf.szFaceName, _countof(cf.szFaceName), lf.lfFaceName);
m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult);
m_spTextServices->TxDraw(
@@ -211,7 +211,7 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He
cf.crTextColor = GetTextColor((HDC)hdcDraw);
cf.bCharSet = lf.lfCharSet;
cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY);
- mir_sntprintf(cf.szFaceName, SIZEOF(cf.szFaceName), lf.lfFaceName);
+ mir_sntprintf(cf.szFaceName, _countof(cf.szFaceName), lf.lfFaceName);
if (!m_spTextServices)
return S_FALSE;
diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp
index d83be8c245..cf859202a5 100644
--- a/plugins/mTextControl/src/richeditutils.cpp
+++ b/plugins/mTextControl/src/richeditutils.cpp
@@ -77,7 +77,7 @@ public:
HRESULT STDMETHODCALLTYPE GetNewStorage(LPSTORAGE * lplpstg)
{
TCHAR sztName[64];
- mir_sntprintf(sztName, SIZEOF(sztName), _T("s%u"), this->nextStgId);
+ mir_sntprintf(sztName, _countof(sztName), _T("s%u"), this->nextStgId);
if (this->pictStg == NULL)
return STG_E_MEDIUMFULL;
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp
index af04e7156e..4a622a4559 100644
--- a/plugins/wbOSD/src/events.cpp
+++ b/plugins/wbOSD/src/events.cpp
@@ -63,7 +63,7 @@ int ProtoAck(WPARAM,LPARAM lparam)
DWORD ann = db_get_dw( NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE );
if ( ann & ( 1 << ( ack->lParam - ID_STATUS_OFFLINE ))) {
TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM) ack->lParam,GSMDF_TCHAR));
+ mir_sntprintf(buffer, _countof(buffer), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM) ack->lParam,GSMDF_TCHAR));
ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), ack->hContact);
} } }
@@ -122,7 +122,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
return 0;
TCHAR bufferW[512];
- mir_sntprintf(bufferW, SIZEOF(bufferW), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,newStatus,GSMDF_TCHAR));
+ mir_sntprintf(bufferW, _countof(bufferW), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,newStatus,GSMDF_TCHAR));
ShowOSD(bufferW, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), hContact);
return 0;
}
@@ -152,7 +152,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
logmsg("HookedNewEvent2");
TCHAR buf[512];
- _tcsncpy(buf, DEFAULT_MESSAGEFORMAT,SIZEOF(buf));
+ _tcsncpy(buf, DEFAULT_MESSAGEFORMAT,_countof(buf));
DBVARIANT dbv;
if(!db_get_ts(NULL,THIS_MODULE,"message_format",&dbv)) {
@@ -194,7 +194,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
c2 = DbGetEventTextT( &dbe, 0 );
TCHAR buffer[512];
- mir_sntprintf(buffer, SIZEOF(buffer), buf, c1, c2);
+ mir_sntprintf(buffer, _countof(buffer), buf, c1, c2);
ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG), wParam);
mir_free( c1 );